1a9643ea8Slogwang /******************************************************************************
2a9643ea8Slogwang  *
3a9643ea8Slogwang  * Name: acbuffer.h - Support for buffers returned by ACPI predefined names
4a9643ea8Slogwang  *
5a9643ea8Slogwang  *****************************************************************************/
6a9643ea8Slogwang 
7*22ce4affSfengbojiang /******************************************************************************
8*22ce4affSfengbojiang  *
9*22ce4affSfengbojiang  * 1. Copyright Notice
10*22ce4affSfengbojiang  *
11*22ce4affSfengbojiang  * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp.
12a9643ea8Slogwang  * All rights reserved.
13a9643ea8Slogwang  *
14*22ce4affSfengbojiang  * 2. License
15*22ce4affSfengbojiang  *
16*22ce4affSfengbojiang  * 2.1. This is your license from Intel Corp. under its intellectual property
17*22ce4affSfengbojiang  * rights. You may have additional license terms from the party that provided
18*22ce4affSfengbojiang  * you this software, covering your right to use that party's intellectual
19*22ce4affSfengbojiang  * property rights.
20*22ce4affSfengbojiang  *
21*22ce4affSfengbojiang  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22*22ce4affSfengbojiang  * copy of the source code appearing in this file ("Covered Code") an
23*22ce4affSfengbojiang  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24*22ce4affSfengbojiang  * base code distributed originally by Intel ("Original Intel Code") to copy,
25*22ce4affSfengbojiang  * make derivatives, distribute, use and display any portion of the Covered
26*22ce4affSfengbojiang  * Code in any form, with the right to sublicense such rights; and
27*22ce4affSfengbojiang  *
28*22ce4affSfengbojiang  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29*22ce4affSfengbojiang  * license (with the right to sublicense), under only those claims of Intel
30*22ce4affSfengbojiang  * patents that are infringed by the Original Intel Code, to make, use, sell,
31*22ce4affSfengbojiang  * offer to sell, and import the Covered Code and derivative works thereof
32*22ce4affSfengbojiang  * solely to the minimum extent necessary to exercise the above copyright
33*22ce4affSfengbojiang  * license, and in no event shall the patent license extend to any additions
34*22ce4affSfengbojiang  * to or modifications of the Original Intel Code. No other license or right
35*22ce4affSfengbojiang  * is granted directly or by implication, estoppel or otherwise;
36*22ce4affSfengbojiang  *
37*22ce4affSfengbojiang  * The above copyright and patent license is granted only if the following
38*22ce4affSfengbojiang  * conditions are met:
39*22ce4affSfengbojiang  *
40*22ce4affSfengbojiang  * 3. Conditions
41*22ce4affSfengbojiang  *
42*22ce4affSfengbojiang  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43*22ce4affSfengbojiang  * Redistribution of source code of any substantial portion of the Covered
44*22ce4affSfengbojiang  * Code or modification with rights to further distribute source must include
45*22ce4affSfengbojiang  * the above Copyright Notice, the above License, this list of Conditions,
46*22ce4affSfengbojiang  * and the following Disclaimer and Export Compliance provision. In addition,
47*22ce4affSfengbojiang  * Licensee must cause all Covered Code to which Licensee contributes to
48*22ce4affSfengbojiang  * contain a file documenting the changes Licensee made to create that Covered
49*22ce4affSfengbojiang  * Code and the date of any change. Licensee must include in that file the
50*22ce4affSfengbojiang  * documentation of any changes made by any predecessor Licensee. Licensee
51*22ce4affSfengbojiang  * must include a prominent statement that the modification is derived,
52*22ce4affSfengbojiang  * directly or indirectly, from Original Intel Code.
53*22ce4affSfengbojiang  *
54*22ce4affSfengbojiang  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55*22ce4affSfengbojiang  * Redistribution of source code of any substantial portion of the Covered
56*22ce4affSfengbojiang  * Code or modification without rights to further distribute source must
57*22ce4affSfengbojiang  * include the following Disclaimer and Export Compliance provision in the
58*22ce4affSfengbojiang  * documentation and/or other materials provided with distribution. In
59*22ce4affSfengbojiang  * addition, Licensee may not authorize further sublicense of source of any
60*22ce4affSfengbojiang  * portion of the Covered Code, and must include terms to the effect that the
61*22ce4affSfengbojiang  * license from Licensee to its licensee is limited to the intellectual
62*22ce4affSfengbojiang  * property embodied in the software Licensee provides to its licensee, and
63*22ce4affSfengbojiang  * not to intellectual property embodied in modifications its licensee may
64*22ce4affSfengbojiang  * make.
65*22ce4affSfengbojiang  *
66*22ce4affSfengbojiang  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67*22ce4affSfengbojiang  * substantial portion of the Covered Code or modification must reproduce the
68*22ce4affSfengbojiang  * above Copyright Notice, and the following Disclaimer and Export Compliance
69*22ce4affSfengbojiang  * provision in the documentation and/or other materials provided with the
70*22ce4affSfengbojiang  * distribution.
71*22ce4affSfengbojiang  *
72*22ce4affSfengbojiang  * 3.4. Intel retains all right, title, and interest in and to the Original
73*22ce4affSfengbojiang  * Intel Code.
74*22ce4affSfengbojiang  *
75*22ce4affSfengbojiang  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76*22ce4affSfengbojiang  * Intel shall be used in advertising or otherwise to promote the sale, use or
77*22ce4affSfengbojiang  * other dealings in products derived from or relating to the Covered Code
78*22ce4affSfengbojiang  * without prior written authorization from Intel.
79*22ce4affSfengbojiang  *
80*22ce4affSfengbojiang  * 4. Disclaimer and Export Compliance
81*22ce4affSfengbojiang  *
82*22ce4affSfengbojiang  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83*22ce4affSfengbojiang  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84*22ce4affSfengbojiang  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85*22ce4affSfengbojiang  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86*22ce4affSfengbojiang  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87*22ce4affSfengbojiang  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88*22ce4affSfengbojiang  * PARTICULAR PURPOSE.
89*22ce4affSfengbojiang  *
90*22ce4affSfengbojiang  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91*22ce4affSfengbojiang  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92*22ce4affSfengbojiang  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93*22ce4affSfengbojiang  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94*22ce4affSfengbojiang  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95*22ce4affSfengbojiang  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96*22ce4affSfengbojiang  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97*22ce4affSfengbojiang  * LIMITED REMEDY.
98*22ce4affSfengbojiang  *
99*22ce4affSfengbojiang  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100*22ce4affSfengbojiang  * software or system incorporating such software without first obtaining any
101*22ce4affSfengbojiang  * required license or other approval from the U. S. Department of Commerce or
102*22ce4affSfengbojiang  * any other agency or department of the United States Government. In the
103*22ce4affSfengbojiang  * event Licensee exports any such software from the United States or
104*22ce4affSfengbojiang  * re-exports any such software from a foreign destination, Licensee shall
105*22ce4affSfengbojiang  * ensure that the distribution and export/re-export of the software is in
106*22ce4affSfengbojiang  * compliance with all laws, regulations, orders, or other restrictions of the
107*22ce4affSfengbojiang  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108*22ce4affSfengbojiang  * any of its subsidiaries will export/re-export any technical data, process,
109*22ce4affSfengbojiang  * software, or service, directly or indirectly, to any country for which the
110*22ce4affSfengbojiang  * United States government or any agency thereof requires an export license,
111*22ce4affSfengbojiang  * other governmental approval, or letter of assurance, without first obtaining
112*22ce4affSfengbojiang  * such license, approval or letter.
113*22ce4affSfengbojiang  *
114*22ce4affSfengbojiang  *****************************************************************************
115*22ce4affSfengbojiang  *
116*22ce4affSfengbojiang  * Alternatively, you may choose to be licensed under the terms of the
117*22ce4affSfengbojiang  * following license:
118*22ce4affSfengbojiang  *
119a9643ea8Slogwang  * Redistribution and use in source and binary forms, with or without
120a9643ea8Slogwang  * modification, are permitted provided that the following conditions
121a9643ea8Slogwang  * are met:
122a9643ea8Slogwang  * 1. Redistributions of source code must retain the above copyright
123a9643ea8Slogwang  *    notice, this list of conditions, and the following disclaimer,
124a9643ea8Slogwang  *    without modification.
125a9643ea8Slogwang  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126a9643ea8Slogwang  *    substantially similar to the "NO WARRANTY" disclaimer below
127a9643ea8Slogwang  *    ("Disclaimer") and any redistribution must be conditioned upon
128a9643ea8Slogwang  *    including a substantially similar Disclaimer requirement for further
129a9643ea8Slogwang  *    binary redistribution.
130a9643ea8Slogwang  * 3. Neither the names of the above-listed copyright holders nor the names
131a9643ea8Slogwang  *    of any contributors may be used to endorse or promote products derived
132a9643ea8Slogwang  *    from this software without specific prior written permission.
133a9643ea8Slogwang  *
134*22ce4affSfengbojiang  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135*22ce4affSfengbojiang  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136*22ce4affSfengbojiang  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137*22ce4affSfengbojiang  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138*22ce4affSfengbojiang  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139*22ce4affSfengbojiang  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140*22ce4affSfengbojiang  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141*22ce4affSfengbojiang  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142*22ce4affSfengbojiang  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143*22ce4affSfengbojiang  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144*22ce4affSfengbojiang  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145*22ce4affSfengbojiang  *
146*22ce4affSfengbojiang  * Alternatively, you may choose to be licensed under the terms of the
147a9643ea8Slogwang  * GNU General Public License ("GPL") version 2 as published by the Free
148a9643ea8Slogwang  * Software Foundation.
149a9643ea8Slogwang  *
150*22ce4affSfengbojiang  *****************************************************************************/
151a9643ea8Slogwang 
152a9643ea8Slogwang #ifndef __ACBUFFER_H__
153a9643ea8Slogwang #define __ACBUFFER_H__
154a9643ea8Slogwang 
155a9643ea8Slogwang /*
156a9643ea8Slogwang  * Contains buffer structures for these predefined names:
157a9643ea8Slogwang  * _FDE, _GRT, _GTM, _PLD, _SRT
158a9643ea8Slogwang  */
159a9643ea8Slogwang 
160a9643ea8Slogwang /*
161a9643ea8Slogwang  * Note: C bitfields are not used for this reason:
162a9643ea8Slogwang  *
163a9643ea8Slogwang  * "Bitfields are great and easy to read, but unfortunately the C language
164a9643ea8Slogwang  * does not specify the layout of bitfields in memory, which means they are
165a9643ea8Slogwang  * essentially useless for dealing with packed data in on-disk formats or
166a9643ea8Slogwang  * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
167a9643ea8Slogwang  * this decision was a design error in C. Ritchie could have picked an order
168a9643ea8Slogwang  * and stuck with it." Norman Ramsey.
169a9643ea8Slogwang  * See http://stackoverflow.com/a/1053662/41661
170a9643ea8Slogwang  */
171a9643ea8Slogwang 
172a9643ea8Slogwang 
173a9643ea8Slogwang /* _FDE return value */
174a9643ea8Slogwang 
175a9643ea8Slogwang typedef struct acpi_fde_info
176a9643ea8Slogwang {
177a9643ea8Slogwang     UINT32              Floppy0;
178a9643ea8Slogwang     UINT32              Floppy1;
179a9643ea8Slogwang     UINT32              Floppy2;
180a9643ea8Slogwang     UINT32              Floppy3;
181a9643ea8Slogwang     UINT32              Tape;
182a9643ea8Slogwang 
183a9643ea8Slogwang } ACPI_FDE_INFO;
184a9643ea8Slogwang 
185a9643ea8Slogwang /*
186a9643ea8Slogwang  * _GRT return value
187a9643ea8Slogwang  * _SRT input value
188a9643ea8Slogwang  */
189a9643ea8Slogwang typedef struct acpi_grt_info
190a9643ea8Slogwang {
191a9643ea8Slogwang     UINT16              Year;
192a9643ea8Slogwang     UINT8               Month;
193a9643ea8Slogwang     UINT8               Day;
194a9643ea8Slogwang     UINT8               Hour;
195a9643ea8Slogwang     UINT8               Minute;
196a9643ea8Slogwang     UINT8               Second;
197a9643ea8Slogwang     UINT8               Valid;
198a9643ea8Slogwang     UINT16              Milliseconds;
199a9643ea8Slogwang     UINT16              Timezone;
200a9643ea8Slogwang     UINT8               Daylight;
201a9643ea8Slogwang     UINT8               Reserved[3];
202a9643ea8Slogwang 
203a9643ea8Slogwang } ACPI_GRT_INFO;
204a9643ea8Slogwang 
205a9643ea8Slogwang /* _GTM return value */
206a9643ea8Slogwang 
207a9643ea8Slogwang typedef struct acpi_gtm_info
208a9643ea8Slogwang {
209a9643ea8Slogwang     UINT32              PioSpeed0;
210a9643ea8Slogwang     UINT32              DmaSpeed0;
211a9643ea8Slogwang     UINT32              PioSpeed1;
212a9643ea8Slogwang     UINT32              DmaSpeed1;
213a9643ea8Slogwang     UINT32              Flags;
214a9643ea8Slogwang 
215a9643ea8Slogwang } ACPI_GTM_INFO;
216a9643ea8Slogwang 
217a9643ea8Slogwang /*
218a9643ea8Slogwang  * Formatted _PLD return value. The minimum size is a package containing
219a9643ea8Slogwang  * one buffer.
220a9643ea8Slogwang  * Revision 1: Buffer is 16 bytes (128 bits)
221a9643ea8Slogwang  * Revision 2: Buffer is 20 bytes (160 bits)
222a9643ea8Slogwang  *
223a9643ea8Slogwang  * Note: This structure is returned from the AcpiDecodePldBuffer
224a9643ea8Slogwang  * interface.
225a9643ea8Slogwang  */
226a9643ea8Slogwang typedef struct acpi_pld_info
227a9643ea8Slogwang {
228a9643ea8Slogwang     UINT8               Revision;
229a9643ea8Slogwang     UINT8               IgnoreColor;
230a9643ea8Slogwang     UINT8               Red;
231a9643ea8Slogwang     UINT8               Green;
232a9643ea8Slogwang     UINT8               Blue;
233a9643ea8Slogwang     UINT16              Width;
234a9643ea8Slogwang     UINT16              Height;
235a9643ea8Slogwang     UINT8               UserVisible;
236a9643ea8Slogwang     UINT8               Dock;
237a9643ea8Slogwang     UINT8               Lid;
238a9643ea8Slogwang     UINT8               Panel;
239a9643ea8Slogwang     UINT8               VerticalPosition;
240a9643ea8Slogwang     UINT8               HorizontalPosition;
241a9643ea8Slogwang     UINT8               Shape;
242a9643ea8Slogwang     UINT8               GroupOrientation;
243a9643ea8Slogwang     UINT8               GroupToken;
244a9643ea8Slogwang     UINT8               GroupPosition;
245a9643ea8Slogwang     UINT8               Bay;
246a9643ea8Slogwang     UINT8               Ejectable;
247a9643ea8Slogwang     UINT8               OspmEjectRequired;
248a9643ea8Slogwang     UINT8               CabinetNumber;
249a9643ea8Slogwang     UINT8               CardCageNumber;
250a9643ea8Slogwang     UINT8               Reference;
251a9643ea8Slogwang     UINT8               Rotation;
252a9643ea8Slogwang     UINT8               Order;
253a9643ea8Slogwang     UINT8               Reserved;
254a9643ea8Slogwang     UINT16              VerticalOffset;
255a9643ea8Slogwang     UINT16              HorizontalOffset;
256a9643ea8Slogwang 
257a9643ea8Slogwang } ACPI_PLD_INFO;
258a9643ea8Slogwang 
259a9643ea8Slogwang 
260a9643ea8Slogwang /*
261a9643ea8Slogwang  * Macros to:
262a9643ea8Slogwang  *     1) Convert a _PLD buffer to internal ACPI_PLD_INFO format - ACPI_PLD_GET*
263a9643ea8Slogwang  *        (Used by AcpiDecodePldBuffer)
264a9643ea8Slogwang  *     2) Construct a _PLD buffer - ACPI_PLD_SET*
265a9643ea8Slogwang  *        (Intended for BIOS use only)
266a9643ea8Slogwang  */
267a9643ea8Slogwang #define ACPI_PLD_REV1_BUFFER_SIZE               16 /* For Revision 1 of the buffer (From ACPI spec) */
268a9643ea8Slogwang #define ACPI_PLD_REV2_BUFFER_SIZE               20 /* For Revision 2 of the buffer (From ACPI spec) */
269a9643ea8Slogwang #define ACPI_PLD_BUFFER_SIZE                    20 /* For Revision 2 of the buffer (From ACPI spec) */
270a9643ea8Slogwang 
271a9643ea8Slogwang /* First 32-bit dword, bits 0:32 */
272a9643ea8Slogwang 
273a9643ea8Slogwang #define ACPI_PLD_GET_REVISION(dword)            ACPI_GET_BITS (dword, 0, ACPI_7BIT_MASK)
274a9643ea8Slogwang #define ACPI_PLD_SET_REVISION(dword,value)      ACPI_SET_BITS (dword, 0, ACPI_7BIT_MASK, value)     /* Offset 0, Len 7 */
275a9643ea8Slogwang 
276a9643ea8Slogwang #define ACPI_PLD_GET_IGNORE_COLOR(dword)        ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK)
277a9643ea8Slogwang #define ACPI_PLD_SET_IGNORE_COLOR(dword,value)  ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value)     /* Offset 7, Len 1 */
278a9643ea8Slogwang 
279a9643ea8Slogwang #define ACPI_PLD_GET_RED(dword)                 ACPI_GET_BITS (dword, 8, ACPI_8BIT_MASK)
280a9643ea8Slogwang #define ACPI_PLD_SET_RED(dword,value)           ACPI_SET_BITS (dword, 8, ACPI_8BIT_MASK, value)    /* Offset 8, Len 8 */
281a9643ea8Slogwang 
282a9643ea8Slogwang #define ACPI_PLD_GET_GREEN(dword)               ACPI_GET_BITS (dword, 16, ACPI_8BIT_MASK)
283a9643ea8Slogwang #define ACPI_PLD_SET_GREEN(dword,value)         ACPI_SET_BITS (dword, 16, ACPI_8BIT_MASK, value)    /* Offset 16, Len 8 */
284a9643ea8Slogwang 
285a9643ea8Slogwang #define ACPI_PLD_GET_BLUE(dword)                ACPI_GET_BITS (dword, 24, ACPI_8BIT_MASK)
286a9643ea8Slogwang #define ACPI_PLD_SET_BLUE(dword,value)          ACPI_SET_BITS (dword, 24, ACPI_8BIT_MASK, value)    /* Offset 24, Len 8 */
287a9643ea8Slogwang 
288a9643ea8Slogwang /* Second 32-bit dword, bits 33:63 */
289a9643ea8Slogwang 
290a9643ea8Slogwang #define ACPI_PLD_GET_WIDTH(dword)               ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK)
291a9643ea8Slogwang #define ACPI_PLD_SET_WIDTH(dword,value)         ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value)    /* Offset 32+0=32, Len 16 */
292a9643ea8Slogwang 
293a9643ea8Slogwang #define ACPI_PLD_GET_HEIGHT(dword)              ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK)
294a9643ea8Slogwang #define ACPI_PLD_SET_HEIGHT(dword,value)        ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value)   /* Offset 32+16=48, Len 16 */
295a9643ea8Slogwang 
296a9643ea8Slogwang /* Third 32-bit dword, bits 64:95 */
297a9643ea8Slogwang 
298a9643ea8Slogwang #define ACPI_PLD_GET_USER_VISIBLE(dword)        ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK)
299a9643ea8Slogwang #define ACPI_PLD_SET_USER_VISIBLE(dword,value)  ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value)     /* Offset 64+0=64, Len 1 */
300a9643ea8Slogwang 
301a9643ea8Slogwang #define ACPI_PLD_GET_DOCK(dword)                ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK)
302a9643ea8Slogwang #define ACPI_PLD_SET_DOCK(dword,value)          ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value)     /* Offset 64+1=65, Len 1 */
303a9643ea8Slogwang 
304a9643ea8Slogwang #define ACPI_PLD_GET_LID(dword)                 ACPI_GET_BITS (dword, 2, ACPI_1BIT_MASK)
305a9643ea8Slogwang #define ACPI_PLD_SET_LID(dword,value)           ACPI_SET_BITS (dword, 2, ACPI_1BIT_MASK, value)     /* Offset 64+2=66, Len 1 */
306a9643ea8Slogwang 
307a9643ea8Slogwang #define ACPI_PLD_GET_PANEL(dword)               ACPI_GET_BITS (dword, 3, ACPI_3BIT_MASK)
308a9643ea8Slogwang #define ACPI_PLD_SET_PANEL(dword,value)         ACPI_SET_BITS (dword, 3, ACPI_3BIT_MASK, value)     /* Offset 64+3=67, Len 3 */
309a9643ea8Slogwang 
310a9643ea8Slogwang #define ACPI_PLD_GET_VERTICAL(dword)            ACPI_GET_BITS (dword, 6, ACPI_2BIT_MASK)
311a9643ea8Slogwang #define ACPI_PLD_SET_VERTICAL(dword,value)      ACPI_SET_BITS (dword, 6, ACPI_2BIT_MASK, value)     /* Offset 64+6=70, Len 2 */
312a9643ea8Slogwang 
313a9643ea8Slogwang #define ACPI_PLD_GET_HORIZONTAL(dword)          ACPI_GET_BITS (dword, 8, ACPI_2BIT_MASK)
314a9643ea8Slogwang #define ACPI_PLD_SET_HORIZONTAL(dword,value)    ACPI_SET_BITS (dword, 8, ACPI_2BIT_MASK, value)     /* Offset 64+8=72, Len 2 */
315a9643ea8Slogwang 
316a9643ea8Slogwang #define ACPI_PLD_GET_SHAPE(dword)               ACPI_GET_BITS (dword, 10, ACPI_4BIT_MASK)
317a9643ea8Slogwang #define ACPI_PLD_SET_SHAPE(dword,value)         ACPI_SET_BITS (dword, 10, ACPI_4BIT_MASK, value)    /* Offset 64+10=74, Len 4 */
318a9643ea8Slogwang 
319a9643ea8Slogwang #define ACPI_PLD_GET_ORIENTATION(dword)         ACPI_GET_BITS (dword, 14, ACPI_1BIT_MASK)
320a9643ea8Slogwang #define ACPI_PLD_SET_ORIENTATION(dword,value)   ACPI_SET_BITS (dword, 14, ACPI_1BIT_MASK, value)    /* Offset 64+14=78, Len 1 */
321a9643ea8Slogwang 
322a9643ea8Slogwang #define ACPI_PLD_GET_TOKEN(dword)               ACPI_GET_BITS (dword, 15, ACPI_8BIT_MASK)
323a9643ea8Slogwang #define ACPI_PLD_SET_TOKEN(dword,value)         ACPI_SET_BITS (dword, 15, ACPI_8BIT_MASK, value)    /* Offset 64+15=79, Len 8 */
324a9643ea8Slogwang 
325a9643ea8Slogwang #define ACPI_PLD_GET_POSITION(dword)            ACPI_GET_BITS (dword, 23, ACPI_8BIT_MASK)
326a9643ea8Slogwang #define ACPI_PLD_SET_POSITION(dword,value)      ACPI_SET_BITS (dword, 23, ACPI_8BIT_MASK, value)    /* Offset 64+23=87, Len 8 */
327a9643ea8Slogwang 
328a9643ea8Slogwang #define ACPI_PLD_GET_BAY(dword)                 ACPI_GET_BITS (dword, 31, ACPI_1BIT_MASK)
329a9643ea8Slogwang #define ACPI_PLD_SET_BAY(dword,value)           ACPI_SET_BITS (dword, 31, ACPI_1BIT_MASK, value)    /* Offset 64+31=95, Len 1 */
330a9643ea8Slogwang 
331a9643ea8Slogwang /* Fourth 32-bit dword, bits 96:127 */
332a9643ea8Slogwang 
333a9643ea8Slogwang #define ACPI_PLD_GET_EJECTABLE(dword)           ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK)
334a9643ea8Slogwang #define ACPI_PLD_SET_EJECTABLE(dword,value)     ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value)     /* Offset 96+0=96, Len 1 */
335a9643ea8Slogwang 
336a9643ea8Slogwang #define ACPI_PLD_GET_OSPM_EJECT(dword)          ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK)
337a9643ea8Slogwang #define ACPI_PLD_SET_OSPM_EJECT(dword,value)    ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value)     /* Offset 96+1=97, Len 1 */
338a9643ea8Slogwang 
339a9643ea8Slogwang #define ACPI_PLD_GET_CABINET(dword)             ACPI_GET_BITS (dword, 2, ACPI_8BIT_MASK)
340a9643ea8Slogwang #define ACPI_PLD_SET_CABINET(dword,value)       ACPI_SET_BITS (dword, 2, ACPI_8BIT_MASK, value)     /* Offset 96+2=98, Len 8 */
341a9643ea8Slogwang 
342a9643ea8Slogwang #define ACPI_PLD_GET_CARD_CAGE(dword)           ACPI_GET_BITS (dword, 10, ACPI_8BIT_MASK)
343a9643ea8Slogwang #define ACPI_PLD_SET_CARD_CAGE(dword,value)     ACPI_SET_BITS (dword, 10, ACPI_8BIT_MASK, value)    /* Offset 96+10=106, Len 8 */
344a9643ea8Slogwang 
345a9643ea8Slogwang #define ACPI_PLD_GET_REFERENCE(dword)           ACPI_GET_BITS (dword, 18, ACPI_1BIT_MASK)
346a9643ea8Slogwang #define ACPI_PLD_SET_REFERENCE(dword,value)     ACPI_SET_BITS (dword, 18, ACPI_1BIT_MASK, value)    /* Offset 96+18=114, Len 1 */
347a9643ea8Slogwang 
348a9643ea8Slogwang #define ACPI_PLD_GET_ROTATION(dword)            ACPI_GET_BITS (dword, 19, ACPI_4BIT_MASK)
349a9643ea8Slogwang #define ACPI_PLD_SET_ROTATION(dword,value)      ACPI_SET_BITS (dword, 19, ACPI_4BIT_MASK, value)    /* Offset 96+19=115, Len 4 */
350a9643ea8Slogwang 
351a9643ea8Slogwang #define ACPI_PLD_GET_ORDER(dword)               ACPI_GET_BITS (dword, 23, ACPI_5BIT_MASK)
352a9643ea8Slogwang #define ACPI_PLD_SET_ORDER(dword,value)         ACPI_SET_BITS (dword, 23, ACPI_5BIT_MASK, value)    /* Offset 96+23=119, Len 5 */
353a9643ea8Slogwang 
354a9643ea8Slogwang /* Fifth 32-bit dword, bits 128:159 (Revision 2 of _PLD only) */
355a9643ea8Slogwang 
356a9643ea8Slogwang #define ACPI_PLD_GET_VERT_OFFSET(dword)         ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK)
357a9643ea8Slogwang #define ACPI_PLD_SET_VERT_OFFSET(dword,value)   ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value)    /* Offset 128+0=128, Len 16 */
358a9643ea8Slogwang 
359a9643ea8Slogwang #define ACPI_PLD_GET_HORIZ_OFFSET(dword)        ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK)
360a9643ea8Slogwang #define ACPI_PLD_SET_HORIZ_OFFSET(dword,value)  ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value)   /* Offset 128+16=144, Len 16 */
361a9643ea8Slogwang 
362a9643ea8Slogwang 
363a9643ea8Slogwang #endif /* ACBUFFER_H */
364