2N/A/******************************************************************************
2N/A *
2N/A * Name: acbuffer.h - Support for buffers returned by ACPI predefined names
2N/A *
2N/A *****************************************************************************/
2N/A
2N/A/*
2N/A * Copyright (C) 2000 - 2016, Intel Corp.
2N/A * All rights reserved.
2N/A *
2N/A * Redistribution and use in source and binary forms, with or without
2N/A * modification, are permitted provided that the following conditions
2N/A * are met:
2N/A * 1. Redistributions of source code must retain the above copyright
2N/A * notice, this list of conditions, and the following disclaimer,
2N/A * without modification.
2N/A * 2. Redistributions in binary form must reproduce at minimum a disclaimer
2N/A * substantially similar to the "NO WARRANTY" disclaimer below
2N/A * ("Disclaimer") and any redistribution must be conditioned upon
2N/A * including a substantially similar Disclaimer requirement for further
2N/A * binary redistribution.
2N/A * 3. Neither the names of the above-listed copyright holders nor the names
2N/A * of any contributors may be used to endorse or promote products derived
2N/A * from this software without specific prior written permission.
2N/A *
2N/A * Alternatively, this software may be distributed under the terms of the
2N/A * GNU General Public License ("GPL") version 2 as published by the Free
2N/A * Software Foundation.
2N/A *
2N/A * NO WARRANTY
2N/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2N/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2N/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
2N/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2N/A * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2N/A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2N/A * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2N/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
2N/A * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
2N/A * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2N/A * POSSIBILITY OF SUCH DAMAGES.
2N/A */
2N/A
2N/A#ifndef __ACBUFFER_H__
2N/A#define __ACBUFFER_H__
2N/A
2N/A/*
2N/A * Contains buffer structures for these predefined names:
2N/A * _FDE, _GRT, _GTM, _PLD, _SRT
2N/A */
2N/A
2N/A/*
2N/A * Note: C bitfields are not used for this reason:
2N/A *
2N/A * "Bitfields are great and easy to read, but unfortunately the C language
2N/A * does not specify the layout of bitfields in memory, which means they are
2N/A * essentially useless for dealing with packed data in on-disk formats or
2N/A * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
2N/A * this decision was a design error in C. Ritchie could have picked an order
2N/A * and stuck with it." Norman Ramsey.
2N/A * See http://stackoverflow.com/a/1053662/41661
2N/A */
2N/A
2N/A
2N/A/* _FDE return value */
2N/A
2N/Atypedef struct acpi_fde_info
2N/A{
2N/A UINT32 Floppy0;
2N/A UINT32 Floppy1;
2N/A UINT32 Floppy2;
2N/A UINT32 Floppy3;
2N/A UINT32 Tape;
2N/A
2N/A} ACPI_FDE_INFO;
2N/A
2N/A/*
2N/A * _GRT return value
2N/A * _SRT input value
2N/A */
2N/Atypedef struct acpi_grt_info
2N/A{
2N/A UINT16 Year;
2N/A UINT8 Month;
2N/A UINT8 Day;
2N/A UINT8 Hour;
2N/A UINT8 Minute;
2N/A UINT8 Second;
2N/A UINT8 Valid;
2N/A UINT16 Milliseconds;
2N/A UINT16 Timezone;
2N/A UINT8 Daylight;
2N/A UINT8 Reserved[3];
2N/A
2N/A} ACPI_GRT_INFO;
2N/A
2N/A/* _GTM return value */
2N/A
2N/Atypedef struct acpi_gtm_info
2N/A{
2N/A UINT32 PioSpeed0;
2N/A UINT32 DmaSpeed0;
2N/A UINT32 PioSpeed1;
2N/A UINT32 DmaSpeed1;
2N/A UINT32 Flags;
2N/A
2N/A} ACPI_GTM_INFO;
2N/A
2N/A/*
2N/A * Formatted _PLD return value. The minimum size is a package containing
2N/A * one buffer.
2N/A * Revision 1: Buffer is 16 bytes (128 bits)
2N/A * Revision 2: Buffer is 20 bytes (160 bits)
2N/A *
2N/A * Note: This structure is returned from the AcpiDecodePldBuffer
2N/A * interface.
2N/A */
2N/Atypedef struct acpi_pld_info
2N/A{
2N/A UINT8 Revision;
2N/A UINT8 IgnoreColor;
2N/A UINT8 Red;
2N/A UINT8 Green;
2N/A UINT8 Blue;
2N/A UINT16 Width;
2N/A UINT16 Height;
2N/A UINT8 UserVisible;
2N/A UINT8 Dock;
2N/A UINT8 Lid;
2N/A UINT8 Panel;
2N/A UINT8 VerticalPosition;
2N/A UINT8 HorizontalPosition;
2N/A UINT8 Shape;
2N/A UINT8 GroupOrientation;
2N/A UINT8 GroupToken;
2N/A UINT8 GroupPosition;
2N/A UINT8 Bay;
2N/A UINT8 Ejectable;
2N/A UINT8 OspmEjectRequired;
2N/A UINT8 CabinetNumber;
2N/A UINT8 CardCageNumber;
2N/A UINT8 Reference;
2N/A UINT8 Rotation;
2N/A UINT8 Order;
2N/A UINT8 Reserved;
2N/A UINT16 VerticalOffset;
2N/A UINT16 HorizontalOffset;
2N/A
2N/A} ACPI_PLD_INFO;
2N/A
2N/A
2N/A/*
2N/A * Macros to:
2N/A * 1) Convert a _PLD buffer to internal ACPI_PLD_INFO format - ACPI_PLD_GET*
2N/A * (Used by AcpiDecodePldBuffer)
2N/A * 2) Construct a _PLD buffer - ACPI_PLD_SET*
2N/A * (Intended for BIOS use only)
2N/A */
2N/A#define ACPI_PLD_REV1_BUFFER_SIZE 16 /* For Revision 1 of the buffer (From ACPI spec) */
2N/A#define ACPI_PLD_REV2_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */
2N/A#define ACPI_PLD_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */
2N/A
2N/A/* First 32-bit dword, bits 0:32 */
2N/A
2N/A#define ACPI_PLD_GET_REVISION(dword) ACPI_GET_BITS (dword, 0, ACPI_7BIT_MASK)
2N/A#define ACPI_PLD_SET_REVISION(dword,value) ACPI_SET_BITS (dword, 0, ACPI_7BIT_MASK, value) /* Offset 0, Len 7 */
2N/A
2N/A#define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK)
2N/A#define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */
2N/A
2N/A#define ACPI_PLD_GET_RED(dword) ACPI_GET_BITS (dword, 8, ACPI_8BIT_MASK)
2N/A#define ACPI_PLD_SET_RED(dword,value) ACPI_SET_BITS (dword, 8, ACPI_8BIT_MASK, value) /* Offset 8, Len 8 */
2N/A
2N/A#define ACPI_PLD_GET_GREEN(dword) ACPI_GET_BITS (dword, 16, ACPI_8BIT_MASK)
2N/A#define ACPI_PLD_SET_GREEN(dword,value) ACPI_SET_BITS (dword, 16, ACPI_8BIT_MASK, value) /* Offset 16, Len 8 */
2N/A
2N/A#define ACPI_PLD_GET_BLUE(dword) ACPI_GET_BITS (dword, 24, ACPI_8BIT_MASK)
2N/A#define ACPI_PLD_SET_BLUE(dword,value) ACPI_SET_BITS (dword, 24, ACPI_8BIT_MASK, value) /* Offset 24, Len 8 */
2N/A
2N/A/* Second 32-bit dword, bits 33:63 */
2N/A
2N/A#define ACPI_PLD_GET_WIDTH(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK)
2N/A#define ACPI_PLD_SET_WIDTH(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 32+0=32, Len 16 */
2N/A
2N/A#define ACPI_PLD_GET_HEIGHT(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK)
2N/A#define ACPI_PLD_SET_HEIGHT(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 32+16=48, Len 16 */
2N/A
2N/A/* Third 32-bit dword, bits 64:95 */
2N/A
2N/A#define ACPI_PLD_GET_USER_VISIBLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK)
2N/A#define ACPI_PLD_SET_USER_VISIBLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 64+0=64, Len 1 */
2N/A
2N/A#define ACPI_PLD_GET_DOCK(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK)
2N/A#define ACPI_PLD_SET_DOCK(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 64+1=65, Len 1 */
2N/A
2N/A#define ACPI_PLD_GET_LID(dword) ACPI_GET_BITS (dword, 2, ACPI_1BIT_MASK)
2N/A#define ACPI_PLD_SET_LID(dword,value) ACPI_SET_BITS (dword, 2, ACPI_1BIT_MASK, value) /* Offset 64+2=66, Len 1 */
2N/A
2N/A#define ACPI_PLD_GET_PANEL(dword) ACPI_GET_BITS (dword, 3, ACPI_3BIT_MASK)
2N/A#define ACPI_PLD_SET_PANEL(dword,value) ACPI_SET_BITS (dword, 3, ACPI_3BIT_MASK, value) /* Offset 64+3=67, Len 3 */
2N/A
2N/A#define ACPI_PLD_GET_VERTICAL(dword) ACPI_GET_BITS (dword, 6, ACPI_2BIT_MASK)
2N/A#define ACPI_PLD_SET_VERTICAL(dword,value) ACPI_SET_BITS (dword, 6, ACPI_2BIT_MASK, value) /* Offset 64+6=70, Len 2 */
2N/A
2N/A#define ACPI_PLD_GET_HORIZONTAL(dword) ACPI_GET_BITS (dword, 8, ACPI_2BIT_MASK)
2N/A#define ACPI_PLD_SET_HORIZONTAL(dword,value) ACPI_SET_BITS (dword, 8, ACPI_2BIT_MASK, value) /* Offset 64+8=72, Len 2 */
2N/A
2N/A#define ACPI_PLD_GET_SHAPE(dword) ACPI_GET_BITS (dword, 10, ACPI_4BIT_MASK)
2N/A#define ACPI_PLD_SET_SHAPE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_4BIT_MASK, value) /* Offset 64+10=74, Len 4 */
2N/A
2N/A#define ACPI_PLD_GET_ORIENTATION(dword) ACPI_GET_BITS (dword, 14, ACPI_1BIT_MASK)
2N/A#define ACPI_PLD_SET_ORIENTATION(dword,value) ACPI_SET_BITS (dword, 14, ACPI_1BIT_MASK, value) /* Offset 64+14=78, Len 1 */
2N/A
2N/A#define ACPI_PLD_GET_TOKEN(dword) ACPI_GET_BITS (dword, 15, ACPI_8BIT_MASK)
2N/A#define ACPI_PLD_SET_TOKEN(dword,value) ACPI_SET_BITS (dword, 15, ACPI_8BIT_MASK, value) /* Offset 64+15=79, Len 8 */
2N/A
2N/A#define ACPI_PLD_GET_POSITION(dword) ACPI_GET_BITS (dword, 23, ACPI_8BIT_MASK)
2N/A#define ACPI_PLD_SET_POSITION(dword,value) ACPI_SET_BITS (dword, 23, ACPI_8BIT_MASK, value) /* Offset 64+23=87, Len 8 */
2N/A
2N/A#define ACPI_PLD_GET_BAY(dword) ACPI_GET_BITS (dword, 31, ACPI_1BIT_MASK)
2N/A#define ACPI_PLD_SET_BAY(dword,value) ACPI_SET_BITS (dword, 31, ACPI_1BIT_MASK, value) /* Offset 64+31=95, Len 1 */
2N/A
2N/A/* Fourth 32-bit dword, bits 96:127 */
2N/A
2N/A#define ACPI_PLD_GET_EJECTABLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK)
2N/A#define ACPI_PLD_SET_EJECTABLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 96+0=96, Len 1 */
2N/A
2N/A#define ACPI_PLD_GET_OSPM_EJECT(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK)
2N/A#define ACPI_PLD_SET_OSPM_EJECT(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 96+1=97, Len 1 */
2N/A
2N/A#define ACPI_PLD_GET_CABINET(dword) ACPI_GET_BITS (dword, 2, ACPI_8BIT_MASK)
2N/A#define ACPI_PLD_SET_CABINET(dword,value) ACPI_SET_BITS (dword, 2, ACPI_8BIT_MASK, value) /* Offset 96+2=98, Len 8 */
2N/A
2N/A#define ACPI_PLD_GET_CARD_CAGE(dword) ACPI_GET_BITS (dword, 10, ACPI_8BIT_MASK)
2N/A#define ACPI_PLD_SET_CARD_CAGE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_8BIT_MASK, value) /* Offset 96+10=106, Len 8 */
2N/A
2N/A#define ACPI_PLD_GET_REFERENCE(dword) ACPI_GET_BITS (dword, 18, ACPI_1BIT_MASK)
2N/A#define ACPI_PLD_SET_REFERENCE(dword,value) ACPI_SET_BITS (dword, 18, ACPI_1BIT_MASK, value) /* Offset 96+18=114, Len 1 */
2N/A
2N/A#define ACPI_PLD_GET_ROTATION(dword) ACPI_GET_BITS (dword, 19, ACPI_4BIT_MASK)
2N/A#define ACPI_PLD_SET_ROTATION(dword,value) ACPI_SET_BITS (dword, 19, ACPI_4BIT_MASK, value) /* Offset 96+19=115, Len 4 */
2N/A
2N/A#define ACPI_PLD_GET_ORDER(dword) ACPI_GET_BITS (dword, 23, ACPI_5BIT_MASK)
2N/A#define ACPI_PLD_SET_ORDER(dword,value) ACPI_SET_BITS (dword, 23, ACPI_5BIT_MASK, value) /* Offset 96+23=119, Len 5 */
2N/A
2N/A/* Fifth 32-bit dword, bits 128:159 (Revision 2 of _PLD only) */
2N/A
2N/A#define ACPI_PLD_GET_VERT_OFFSET(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK)
2N/A#define ACPI_PLD_SET_VERT_OFFSET(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 128+0=128, Len 16 */
2N/A
2N/A#define ACPI_PLD_GET_HORIZ_OFFSET(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK)
2N/A#define ACPI_PLD_SET_HORIZ_OFFSET(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 128+16=144, Len 16 */
2N/A
2N/A
2N/A#endif /* ACBUFFER_H */
2N/A