ReactOS 0.4.15-dev-7788-g1ad9096
acbuffer.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Name: acbuffer.h - Support for buffers returned by ACPI predefined names
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2022, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACBUFFER_H__
45#define __ACBUFFER_H__
46
47/*
48 * Contains buffer structures for these predefined names:
49 * _FDE, _GRT, _GTM, _PLD, _SRT
50 */
51
52/*
53 * Note: C bitfields are not used for this reason:
54 *
55 * "Bitfields are great and easy to read, but unfortunately the C language
56 * does not specify the layout of bitfields in memory, which means they are
57 * essentially useless for dealing with packed data in on-disk formats or
58 * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
59 * this decision was a design error in C. Ritchie could have picked an order
60 * and stuck with it." Norman Ramsey.
61 * See http://stackoverflow.com/a/1053662/41661
62 */
63
64
65/* _FDE return value */
66
67typedef struct acpi_fde_info
68{
74
76
77/*
78 * _GRT return value
79 * _SRT input value
80 */
81typedef struct acpi_grt_info
82{
94
96
97/* _GTM return value */
98
99typedef struct acpi_gtm_info
100{
106
108
109/*
110 * Formatted _PLD return value. The minimum size is a package containing
111 * one buffer.
112 * Revision 1: Buffer is 16 bytes (128 bits)
113 * Revision 2: Buffer is 20 bytes (160 bits)
114 *
115 * Note: This structure is returned from the AcpiDecodePldBuffer
116 * interface.
117 */
118typedef struct acpi_pld_info
119{
148
150
151
152/*
153 * Macros to:
154 * 1) Convert a _PLD buffer to internal ACPI_PLD_INFO format - ACPI_PLD_GET*
155 * (Used by AcpiDecodePldBuffer)
156 * 2) Construct a _PLD buffer - ACPI_PLD_SET*
157 * (Intended for BIOS use only)
158 */
159#define ACPI_PLD_REV1_BUFFER_SIZE 16 /* For Revision 1 of the buffer (From ACPI spec) */
160#define ACPI_PLD_REV2_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */
161#define ACPI_PLD_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */
162
163/* First 32-bit dword, bits 0:32 */
164
165#define ACPI_PLD_GET_REVISION(dword) ACPI_GET_BITS (dword, 0, ACPI_7BIT_MASK)
166#define ACPI_PLD_SET_REVISION(dword,value) ACPI_SET_BITS (dword, 0, ACPI_7BIT_MASK, value) /* Offset 0, Len 7 */
167
168#define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK)
169#define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */
170
171#define ACPI_PLD_GET_RED(dword) ACPI_GET_BITS (dword, 8, ACPI_8BIT_MASK)
172#define ACPI_PLD_SET_RED(dword,value) ACPI_SET_BITS (dword, 8, ACPI_8BIT_MASK, value) /* Offset 8, Len 8 */
173
174#define ACPI_PLD_GET_GREEN(dword) ACPI_GET_BITS (dword, 16, ACPI_8BIT_MASK)
175#define ACPI_PLD_SET_GREEN(dword,value) ACPI_SET_BITS (dword, 16, ACPI_8BIT_MASK, value) /* Offset 16, Len 8 */
176
177#define ACPI_PLD_GET_BLUE(dword) ACPI_GET_BITS (dword, 24, ACPI_8BIT_MASK)
178#define ACPI_PLD_SET_BLUE(dword,value) ACPI_SET_BITS (dword, 24, ACPI_8BIT_MASK, value) /* Offset 24, Len 8 */
179
180/* Second 32-bit dword, bits 33:63 */
181
182#define ACPI_PLD_GET_WIDTH(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK)
183#define ACPI_PLD_SET_WIDTH(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 32+0=32, Len 16 */
184
185#define ACPI_PLD_GET_HEIGHT(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK)
186#define ACPI_PLD_SET_HEIGHT(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 32+16=48, Len 16 */
187
188/* Third 32-bit dword, bits 64:95 */
189
190#define ACPI_PLD_GET_USER_VISIBLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK)
191#define ACPI_PLD_SET_USER_VISIBLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 64+0=64, Len 1 */
192
193#define ACPI_PLD_GET_DOCK(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK)
194#define ACPI_PLD_SET_DOCK(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 64+1=65, Len 1 */
195
196#define ACPI_PLD_GET_LID(dword) ACPI_GET_BITS (dword, 2, ACPI_1BIT_MASK)
197#define ACPI_PLD_SET_LID(dword,value) ACPI_SET_BITS (dword, 2, ACPI_1BIT_MASK, value) /* Offset 64+2=66, Len 1 */
198
199#define ACPI_PLD_GET_PANEL(dword) ACPI_GET_BITS (dword, 3, ACPI_3BIT_MASK)
200#define ACPI_PLD_SET_PANEL(dword,value) ACPI_SET_BITS (dword, 3, ACPI_3BIT_MASK, value) /* Offset 64+3=67, Len 3 */
201
202#define ACPI_PLD_GET_VERTICAL(dword) ACPI_GET_BITS (dword, 6, ACPI_2BIT_MASK)
203#define ACPI_PLD_SET_VERTICAL(dword,value) ACPI_SET_BITS (dword, 6, ACPI_2BIT_MASK, value) /* Offset 64+6=70, Len 2 */
204
205#define ACPI_PLD_GET_HORIZONTAL(dword) ACPI_GET_BITS (dword, 8, ACPI_2BIT_MASK)
206#define ACPI_PLD_SET_HORIZONTAL(dword,value) ACPI_SET_BITS (dword, 8, ACPI_2BIT_MASK, value) /* Offset 64+8=72, Len 2 */
207
208#define ACPI_PLD_GET_SHAPE(dword) ACPI_GET_BITS (dword, 10, ACPI_4BIT_MASK)
209#define ACPI_PLD_SET_SHAPE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_4BIT_MASK, value) /* Offset 64+10=74, Len 4 */
210
211#define ACPI_PLD_GET_ORIENTATION(dword) ACPI_GET_BITS (dword, 14, ACPI_1BIT_MASK)
212#define ACPI_PLD_SET_ORIENTATION(dword,value) ACPI_SET_BITS (dword, 14, ACPI_1BIT_MASK, value) /* Offset 64+14=78, Len 1 */
213
214#define ACPI_PLD_GET_TOKEN(dword) ACPI_GET_BITS (dword, 15, ACPI_8BIT_MASK)
215#define ACPI_PLD_SET_TOKEN(dword,value) ACPI_SET_BITS (dword, 15, ACPI_8BIT_MASK, value) /* Offset 64+15=79, Len 8 */
216
217#define ACPI_PLD_GET_POSITION(dword) ACPI_GET_BITS (dword, 23, ACPI_8BIT_MASK)
218#define ACPI_PLD_SET_POSITION(dword,value) ACPI_SET_BITS (dword, 23, ACPI_8BIT_MASK, value) /* Offset 64+23=87, Len 8 */
219
220#define ACPI_PLD_GET_BAY(dword) ACPI_GET_BITS (dword, 31, ACPI_1BIT_MASK)
221#define ACPI_PLD_SET_BAY(dword,value) ACPI_SET_BITS (dword, 31, ACPI_1BIT_MASK, value) /* Offset 64+31=95, Len 1 */
222
223/* Fourth 32-bit dword, bits 96:127 */
224
225#define ACPI_PLD_GET_EJECTABLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK)
226#define ACPI_PLD_SET_EJECTABLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 96+0=96, Len 1 */
227
228#define ACPI_PLD_GET_OSPM_EJECT(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK)
229#define ACPI_PLD_SET_OSPM_EJECT(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 96+1=97, Len 1 */
230
231#define ACPI_PLD_GET_CABINET(dword) ACPI_GET_BITS (dword, 2, ACPI_8BIT_MASK)
232#define ACPI_PLD_SET_CABINET(dword,value) ACPI_SET_BITS (dword, 2, ACPI_8BIT_MASK, value) /* Offset 96+2=98, Len 8 */
233
234#define ACPI_PLD_GET_CARD_CAGE(dword) ACPI_GET_BITS (dword, 10, ACPI_8BIT_MASK)
235#define ACPI_PLD_SET_CARD_CAGE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_8BIT_MASK, value) /* Offset 96+10=106, Len 8 */
236
237#define ACPI_PLD_GET_REFERENCE(dword) ACPI_GET_BITS (dword, 18, ACPI_1BIT_MASK)
238#define ACPI_PLD_SET_REFERENCE(dword,value) ACPI_SET_BITS (dword, 18, ACPI_1BIT_MASK, value) /* Offset 96+18=114, Len 1 */
239
240#define ACPI_PLD_GET_ROTATION(dword) ACPI_GET_BITS (dword, 19, ACPI_4BIT_MASK)
241#define ACPI_PLD_SET_ROTATION(dword,value) ACPI_SET_BITS (dword, 19, ACPI_4BIT_MASK, value) /* Offset 96+19=115, Len 4 */
242
243#define ACPI_PLD_GET_ORDER(dword) ACPI_GET_BITS (dword, 23, ACPI_5BIT_MASK)
244#define ACPI_PLD_SET_ORDER(dword,value) ACPI_SET_BITS (dword, 23, ACPI_5BIT_MASK, value) /* Offset 96+23=119, Len 5 */
245
246/* Fifth 32-bit dword, bits 128:159 (Revision 2 of _PLD only) */
247
248#define ACPI_PLD_GET_VERT_OFFSET(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK)
249#define ACPI_PLD_SET_VERT_OFFSET(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 128+0=128, Len 16 */
250
251#define ACPI_PLD_GET_HORIZ_OFFSET(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK)
252#define ACPI_PLD_SET_HORIZ_OFFSET(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 128+16=144, Len 16 */
253
254/* Panel position defined in _PLD section of ACPI Specification 6.3 */
255
256#define ACPI_PLD_PANEL_TOP 0
257#define ACPI_PLD_PANEL_BOTTOM 1
258#define ACPI_PLD_PANEL_LEFT 2
259#define ACPI_PLD_PANEL_RIGHT 3
260#define ACPI_PLD_PANEL_FRONT 4
261#define ACPI_PLD_PANEL_BACK 5
262#define ACPI_PLD_PANEL_UNKNOWN 6
263
264#endif /* ACBUFFER_H */
unsigned short UINT16
unsigned char UINT8
unsigned int UINT32
struct acpi_gtm_info ACPI_GTM_INFO
struct acpi_grt_info ACPI_GRT_INFO
struct acpi_pld_info ACPI_PLD_INFO
struct acpi_fde_info ACPI_FDE_INFO
UINT32 Floppy1
Definition: acbuffer.h:70
UINT32 Tape
Definition: acbuffer.h:73
UINT32 Floppy0
Definition: acbuffer.h:69
UINT32 Floppy3
Definition: acbuffer.h:72
UINT32 Floppy2
Definition: acbuffer.h:71
UINT8 Hour
Definition: acbuffer.h:86
UINT16 Year
Definition: acbuffer.h:83
UINT8 Daylight
Definition: acbuffer.h:92
UINT16 Milliseconds
Definition: acbuffer.h:90
UINT8 Valid
Definition: acbuffer.h:89
UINT8 Day
Definition: acbuffer.h:85
UINT16 Timezone
Definition: acbuffer.h:91
UINT8 Month
Definition: acbuffer.h:84
UINT8 Second
Definition: acbuffer.h:88
UINT8 Minute
Definition: acbuffer.h:87
UINT32 PioSpeed0
Definition: acbuffer.h:101
UINT32 PioSpeed1
Definition: acbuffer.h:103
UINT32 DmaSpeed0
Definition: acbuffer.h:102
UINT32 DmaSpeed1
Definition: acbuffer.h:104
UINT32 Flags
Definition: acbuffer.h:105
UINT8 VerticalPosition
Definition: acbuffer.h:131
UINT8 Shape
Definition: acbuffer.h:133
UINT8 Blue
Definition: acbuffer.h:124
UINT8 Rotation
Definition: acbuffer.h:143
UINT8 Green
Definition: acbuffer.h:123
UINT16 Width
Definition: acbuffer.h:125
UINT8 UserVisible
Definition: acbuffer.h:127
UINT8 CardCageNumber
Definition: acbuffer.h:141
UINT8 CabinetNumber
Definition: acbuffer.h:140
UINT8 Order
Definition: acbuffer.h:144
UINT8 Dock
Definition: acbuffer.h:128
UINT8 Revision
Definition: acbuffer.h:120
UINT8 GroupPosition
Definition: acbuffer.h:136
UINT8 GroupOrientation
Definition: acbuffer.h:134
UINT8 Ejectable
Definition: acbuffer.h:138
UINT8 IgnoreColor
Definition: acbuffer.h:121
UINT8 Reference
Definition: acbuffer.h:142
UINT8 Panel
Definition: acbuffer.h:130
UINT8 Reserved
Definition: acbuffer.h:145
UINT16 VerticalOffset
Definition: acbuffer.h:146
UINT16 Height
Definition: acbuffer.h:126
UINT16 HorizontalOffset
Definition: acbuffer.h:147
UINT8 OspmEjectRequired
Definition: acbuffer.h:139
UINT8 HorizontalPosition
Definition: acbuffer.h:132
UINT8 GroupToken
Definition: acbuffer.h:135
_Reserved_ PVOID Reserved
Definition: winddi.h:3974