Merge from vendor branch OPENSSH:
[dragonfly.git] / sys / contrib / dev / acpica / actbl.h
1 /******************************************************************************
2  *
3  * Name: actbl.h - Table data structures defined in ACPI specification
4  *       $Revision: 58 $
5  *
6  *****************************************************************************/
7
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
13  * All rights reserved.
14  *
15  * 2. License
16  *
17  * 2.1. This is your license from Intel Corp. under its intellectual property
18  * rights.  You may have additional license terms from the party that provided
19  * you this software, covering your right to use that party's intellectual
20  * property rights.
21  *
22  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23  * copy of the source code appearing in this file ("Covered Code") an
24  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25  * base code distributed originally by Intel ("Original Intel Code") to copy,
26  * make derivatives, distribute, use and display any portion of the Covered
27  * Code in any form, with the right to sublicense such rights; and
28  *
29  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30  * license (with the right to sublicense), under only those claims of Intel
31  * patents that are infringed by the Original Intel Code, to make, use, sell,
32  * offer to sell, and import the Covered Code and derivative works thereof
33  * solely to the minimum extent necessary to exercise the above copyright
34  * license, and in no event shall the patent license extend to any additions
35  * to or modifications of the Original Intel Code.  No other license or right
36  * is granted directly or by implication, estoppel or otherwise;
37  *
38  * The above copyright and patent license is granted only if the following
39  * conditions are met:
40  *
41  * 3. Conditions
42  *
43  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44  * Redistribution of source code of any substantial portion of the Covered
45  * Code or modification with rights to further distribute source must include
46  * the above Copyright Notice, the above License, this list of Conditions,
47  * and the following Disclaimer and Export Compliance provision.  In addition,
48  * Licensee must cause all Covered Code to which Licensee contributes to
49  * contain a file documenting the changes Licensee made to create that Covered
50  * Code and the date of any change.  Licensee must include in that file the
51  * documentation of any changes made by any predecessor Licensee.  Licensee
52  * must include a prominent statement that the modification is derived,
53  * directly or indirectly, from Original Intel Code.
54  *
55  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56  * Redistribution of source code of any substantial portion of the Covered
57  * Code or modification without rights to further distribute source must
58  * include the following Disclaimer and Export Compliance provision in the
59  * documentation and/or other materials provided with distribution.  In
60  * addition, Licensee may not authorize further sublicense of source of any
61  * portion of the Covered Code, and must include terms to the effect that the
62  * license from Licensee to its licensee is limited to the intellectual
63  * property embodied in the software Licensee provides to its licensee, and
64  * not to intellectual property embodied in modifications its licensee may
65  * make.
66  *
67  * 3.3. Redistribution of Executable. Redistribution in executable form of any
68  * substantial portion of the Covered Code or modification must reproduce the
69  * above Copyright Notice, and the following Disclaimer and Export Compliance
70  * provision in the documentation and/or other materials provided with the
71  * distribution.
72  *
73  * 3.4. Intel retains all right, title, and interest in and to the Original
74  * Intel Code.
75  *
76  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77  * Intel shall be used in advertising or otherwise to promote the sale, use or
78  * other dealings in products derived from or relating to the Covered Code
79  * without prior written authorization from Intel.
80  *
81  * 4. Disclaimer and Export Compliance
82  *
83  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89  * PARTICULAR PURPOSE.
90  *
91  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98  * LIMITED REMEDY.
99  *
100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
101  * software or system incorporating such software without first obtaining any
102  * required license or other approval from the U. S. Department of Commerce or
103  * any other agency or department of the United States Government.  In the
104  * event Licensee exports any such software from the United States or
105  * re-exports any such software from a foreign destination, Licensee shall
106  * ensure that the distribution and export/re-export of the software is in
107  * compliance with all laws, regulations, orders, or other restrictions of the
108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109  * any of its subsidiaries will export/re-export any technical data, process,
110  * software, or service, directly or indirectly, to any country for which the
111  * United States government or any agency thereof requires an export license,
112  * other governmental approval, or letter of assurance, without first obtaining
113  * such license, approval or letter.
114  *
115  *****************************************************************************/
116 /* $DragonFly: src/sys/contrib/dev/acpica/Attic/actbl.h,v 1.1 2003/09/24 03:32:15 drhodus Exp $                                                               */
117
118 #ifndef __ACTBL_H__
119 #define __ACTBL_H__
120
121
122 /*
123  *  Values for description table header signatures
124  */
125 #define RSDP_NAME               "RSDP"
126 #define RSDP_SIG                "RSD PTR "  /* RSDT Pointer signature */
127 #define APIC_SIG                "APIC"      /* Multiple APIC Description Table */
128 #define DSDT_SIG                "DSDT"      /* Differentiated System Description Table */
129 #define FADT_SIG                "FACP"      /* Fixed ACPI Description Table */
130 #define FACS_SIG                "FACS"      /* Firmware ACPI Control Structure */
131 #define PSDT_SIG                "PSDT"      /* Persistent System Description Table */
132 #define RSDT_SIG                "RSDT"      /* Root System Description Table */
133 #define XSDT_SIG                "XSDT"      /* Extended  System Description Table */
134 #define SSDT_SIG                "SSDT"      /* Secondary System Description Table */
135 #define SBST_SIG                "SBST"      /* Smart Battery Specification Table */
136 #define SPIC_SIG                "SPIC"      /* IOSAPIC table */
137 #define BOOT_SIG                "BOOT"      /* Boot table */
138
139
140 #define GL_OWNED                0x02        /* Ownership of global lock is bit 1 */
141
142 /* values of Mapic.Model */
143
144 #define DUAL_PIC                0
145 #define MULTIPLE_APIC           1
146
147 /* values of Type in APIC_HEADER */
148
149 #define APIC_PROC               0
150 #define APIC_IO                 1
151
152
153 /*
154  * Common table types.  The base code can remain
155  * constant if the underlying tables are changed
156  */
157 #define RSDT_DESCRIPTOR         RSDT_DESCRIPTOR_REV2
158 #define XSDT_DESCRIPTOR         XSDT_DESCRIPTOR_REV2
159 #define FACS_DESCRIPTOR         FACS_DESCRIPTOR_REV2
160 #define FADT_DESCRIPTOR         FADT_DESCRIPTOR_REV2
161
162
163 #pragma pack(1)
164
165 /*
166  * Architecture-independent tables
167  * The architecture dependent tables are in separate files
168  */
169 typedef struct rsdp_descriptor /* Root System Descriptor Pointer */
170 {
171     char                    Signature [8];          /* ACPI signature, contains "RSD PTR " */
172     UINT8                   Checksum;               /* To make sum of struct == 0 */
173     char                    OemId [6];              /* OEM identification */
174     UINT8                   Revision;               /* Must be 0 for 1.0, 2 for 2.0 */
175     UINT32                  RsdtPhysicalAddress;    /* 32-bit physical address of RSDT */
176     UINT32                  Length;                 /* XSDT Length in bytes including hdr */
177     UINT64                  XsdtPhysicalAddress;    /* 64-bit physical address of XSDT */
178     UINT8                   ExtendedChecksum;       /* Checksum of entire table */
179     char                    Reserved [3];           /* Reserved field must be 0 */
180
181 } RSDP_DESCRIPTOR;
182
183
184 typedef struct acpi_table_header /* ACPI common table header */
185 {
186     char                    Signature [4];          /* ACPI signature (4 ASCII characters) */
187     UINT32                  Length;                 /* Length of table, in bytes, including header */
188     UINT8                   Revision;               /* ACPI Specification minor version # */
189     UINT8                   Checksum;               /* To make sum of entire table == 0 */
190     char                    OemId [6];              /* OEM identification */
191     char                    OemTableId [8];         /* OEM table identification */
192     UINT32                  OemRevision;            /* OEM revision number */
193     char                    AslCompilerId [4];      /* ASL compiler vendor ID */
194     UINT32                  AslCompilerRevision;    /* ASL compiler revision number */
195
196 } ACPI_TABLE_HEADER;
197
198
199 typedef struct acpi_common_facs  /* Common FACS for internal use */
200 {
201     UINT32                  *GlobalLock;
202     UINT64                  *FirmwareWakingVector;
203     UINT8                   VectorWidth;
204
205 } ACPI_COMMON_FACS;
206
207
208 typedef struct apic_table
209 {
210     ACPI_TABLE_HEADER       Header;                 /* ACPI table header */
211     UINT32                  LocalApicAddress;       /* Physical address for accessing local APICs */
212     UINT32_BIT              PCATCompat      : 1;    /* a one indicates system also has dual 8259s */
213     UINT32_BIT              Reserved1       : 31;
214
215 } APIC_TABLE;
216
217
218 typedef struct apic_header
219 {
220     UINT8                   Type;                   /* APIC type.  Either APIC_PROC or APIC_IO */
221     UINT8                   Length;                 /* Length of APIC structure */
222
223 } APIC_HEADER;
224
225
226 typedef struct processor_apic
227 {
228     APIC_HEADER             Header;
229     UINT8                   ProcessorApicId;        /* ACPI processor id */
230     UINT8                   LocalApicId;            /* Processor's local APIC id */
231     UINT32_BIT              ProcessorEnabled: 1;    /* Processor is usable if set */
232     UINT32_BIT              Reserved1       : 31;
233
234 } PROCESSOR_APIC;
235
236
237 typedef struct io_apic
238 {
239     APIC_HEADER             Header;
240     UINT8                   IoApicId;               /* I/O APIC ID */
241     UINT8                   Reserved;               /* Reserved - must be zero */
242     UINT32                  IoApicAddress;          /* APIC's physical address */
243     UINT32                  Vector;                 /* Interrupt vector index where INTI
244                                                      * lines start */
245 } IO_APIC;
246
247
248 /*
249  *  IA64 TBD:  Add SAPIC Tables
250  */
251
252 /*
253  *  IA64 TBD:   Modify Smart Battery Description to comply with ACPI IA64
254  *              extensions.
255  */
256 typedef struct smart_battery_description_table
257 {
258     ACPI_TABLE_HEADER       Header;
259     UINT32                  WarningLevel;
260     UINT32                  LowLevel;
261     UINT32                  CriticalLevel;
262
263 } SMART_BATTERY_DESCRIPTION_TABLE;
264
265
266 #pragma pack()
267
268
269 /*
270  * ACPI Table information.  We save the table address, length,
271  * and type of memory allocation (mapped or allocated) for each
272  * table for 1) when we exit, and 2) if a new table is installed
273  */
274 #define ACPI_MEM_NOT_ALLOCATED  0
275 #define ACPI_MEM_ALLOCATED      1
276 #define ACPI_MEM_MAPPED         2
277
278 /* Definitions for the Flags bitfield member of ACPI_TABLE_SUPPORT */
279
280 #define ACPI_TABLE_SINGLE       0x00
281 #define ACPI_TABLE_MULTIPLE     0x01
282 #define ACPI_TABLE_EXECUTABLE   0x02
283
284 #define ACPI_TABLE_ROOT         0x00
285 #define ACPI_TABLE_PRIMARY      0x10
286 #define ACPI_TABLE_SECONDARY    0x20
287 #define ACPI_TABLE_ALL          0x30
288 #define ACPI_TABLE_TYPE_MASK    0x30
289
290 /* Data about each known table type */
291
292 typedef struct acpi_table_support
293 {
294     char                    *Name;
295     char                    *Signature;
296     void                    **GlobalPtr;
297     UINT8                   SigLength;
298     UINT8                   Flags;
299
300 } ACPI_TABLE_SUPPORT;
301
302
303 /*
304  * Get the architecture-specific tables
305  */
306 #include "actbl1.h"   /* Acpi 1.0 table definitions */
307 #include "actbl2.h"   /* Acpi 2.0 table definitions */
308
309 #endif /* __ACTBL_H__ */