ia64/xen-unstable

view tools/firmware/acpi/acpi2_0.h @ 6432:b54144915ae6

merge?
author cl349@firebug.cl.cam.ac.uk
date Thu Aug 25 16:26:30 2005 +0000 (2005-08-25)
parents 3428d58a85e1 6e899a3840b2
children 0610add7c3fe
line source
1 /*
2 * Copyright (c) 2004, Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 */
18 #ifndef _ACPI_2_0_H_
19 #define _ACPI_2_0_H_
21 #include "xenctrl.h" // for u8, u16, u32, u64 definition
23 #pragma pack (1)
25 //
26 // common ACPI header.
27 //
29 typedef struct {
30 u32 Signature;
31 u32 Length;
32 u8 Revision;
33 u8 Checksum;
34 u8 OemId[6];
35 u64 OemTableId;
36 u32 OemRevision;
37 u32 CreatorId;
38 u32 CreatorRevision;
39 } ACPI_TABLE_HEADER;
42 #define ACPI_OEM_ID {'I','N','T','E','L',' '}
43 #define ACPI_OEM_TABLE_ID 0x544244 // "TBD"
44 #define ACPI_OEM_REVISION 0x00000002
45 #define ACPI_CREATOR_ID 0x00 // TBD
46 #define ACPI_CREATOR_REVISION 0x00000002
48 //
49 // ACPI 2.0 Generic Address Space definition
50 //
51 typedef struct {
52 u8 AddressSpaceId;
53 u8 RegisterBitWidth;
54 u8 RegisterBitOffset;
55 u8 Reserved;
56 u64 Address;
57 } ACPI_GENERIC_ADDRESS_STRUCTURE;
59 //
60 // Generic Address Space Address IDs
61 //
62 #define ACPI_SYSTEM_MEMORY 0
63 #define ACPI_SYSTEM_IO 1
64 #define ACPI_PCI_CONFIGURATION_SPACE 2
65 #define ACPI_EMBEDDED_CONTROLLER 3
66 #define ACPI_SMBUS 4
67 #define ACPI_FUNCTIONAL_FIXED_HARDWARE 0x7F
69 //
70 // Root System Description Pointer Structure in ACPI 1.0
71 //
72 typedef struct {
73 u64 Signature;
74 u8 Checksum;
75 u8 OemId[6];
76 u8 Reserved;
77 u32 RsdtAddress;
78 } ACPI_1_0_RSDP;
81 //
82 // Root System Description Pointer Structure
83 //
84 typedef struct {
85 u64 Signature;
86 u8 Checksum;
87 u8 OemId[6];
88 u8 Revision;
89 u32 RsdtAddress;
90 u32 Length;
91 u64 XsdtAddress;
92 u8 ExtendedChecksum;
93 u8 Reserved[3];
94 } ACPI_2_0_RSDP;
97 //
98 // The maximum number of entrys in RSDT or XSDT
99 //
100 #define ACPI_MAX_NUM_TABLES 2
102 //
103 // Root System Description Table (RSDT)
104 //
106 typedef struct {
107 ACPI_TABLE_HEADER Header;
108 u32 Entry[ACPI_MAX_NUM_TABLES];
109 }ACPI_2_0_RSDT;
111 //
112 // RSDT Revision (as defined in ACPI 2.0 spec.)
113 //
115 #define ACPI_2_0_RSDT_REVISION 0x01
117 //
118 // Extended System Description Table (XSDT)
119 //
121 typedef struct _ACPI_2_0_XSDT{
122 ACPI_TABLE_HEADER Header;
123 u64 Entry[ACPI_MAX_NUM_TABLES];
124 }ACPI_2_0_XSDT;
125 #define ACPI_2_0_XSDT_REVISION 0x01
127 //
128 // Fixed ACPI Description Table Structure (FADT)
129 //
131 typedef struct {
132 ACPI_TABLE_HEADER Header;
133 u32 FirmwareCtrl;
134 u32 Dsdt;
135 u8 Reserved0;
136 u8 PreferredPmProfile;
137 u16 SciInt;
138 u32 SmiCmd;
139 u8 AcpiEnable;
140 u8 AcpiDisable;
141 u8 S4BiosReq;
142 u8 PstateCnt;
143 u32 Pm1aEvtBlk;
144 u32 Pm1bEvtBlk;
145 u32 Pm1aCntBlk;
146 u32 Pm1bCntBlk;
147 u32 Pm2CntBlk;
148 u32 PmTmrBlk;
149 u32 Gpe0Blk;
150 u32 Gpe1Blk;
151 u8 Pm1EvtLen;
152 u8 Pm1CntLen;
153 u8 Pm2CntLen;
154 u8 PmTmrLen;
155 u8 Gpe0BlkLen;
156 u8 Gpe1BlkLen;
157 u8 Gpe1Base;
158 u8 CstCnt;
159 u16 PLvl2Lat;
160 u16 PLvl3Lat;
161 u16 FlushSize;
162 u16 FlushStride;
163 u8 DutyOffset;
164 u8 DutyWidth;
165 u8 DayAlrm;
166 u8 MonAlrm;
167 u8 Century;
168 u16 IaPcBootArch;
169 u8 Reserved1;
170 u32 Flags;
171 ACPI_GENERIC_ADDRESS_STRUCTURE ResetReg;
172 u8 ResetValue;
173 u8 Reserved2[3];
174 u64 XFirmwareCtrl;
175 u64 XDsdt;
176 ACPI_GENERIC_ADDRESS_STRUCTURE XPm1aEvtBlk;
177 ACPI_GENERIC_ADDRESS_STRUCTURE XPm1bEvtBlk;
178 ACPI_GENERIC_ADDRESS_STRUCTURE XPm1aCntBlk;
179 ACPI_GENERIC_ADDRESS_STRUCTURE XPm1bCntBlk;
180 ACPI_GENERIC_ADDRESS_STRUCTURE XPm2CntBlk;
181 ACPI_GENERIC_ADDRESS_STRUCTURE XPmTmrBlk;
182 ACPI_GENERIC_ADDRESS_STRUCTURE XGpe0Blk;
183 ACPI_GENERIC_ADDRESS_STRUCTURE XGpe1Blk;
184 } ACPI_2_0_FADT;
185 #define ACPI_2_0_FADT_REVISION 0x03
187 //
188 // FADT Boot Architecture Flags
189 //
190 #define ACPI_LEGACY_DEVICES (1 << 0)
191 #define ACPI_8042 (1 << 1)
193 //
194 // FADT Fixed Feature Flags
195 //
196 #define ACPI_WBINVD (1 << 0)
197 #define ACPI_WBINVD_FLUSH (1 << 1)
198 #define ACPI_PROC_C1 (1 << 2)
199 #define ACPI_P_LVL2_UP (1 << 3)
200 #define ACPI_PWR_BUTTON (1 << 4)
201 #define ACPI_SLP_BUTTON (1 << 5)
202 #define ACPI_FIX_RTC (1 << 6)
203 #define ACPI_RTC_S4 (1 << 7)
204 #define ACPI_TMR_VAL_EXT (1 << 8)
205 #define ACPI_DCK_CAP (1 << 9)
206 #define ACPI_RESET_REG_SUP (1 << 10)
207 #define ACPI_SEALED_CASE (1 << 11)
208 #define ACPI_HEADLESS (1 << 12)
209 #define ACPI_CPU_SW_SLP (1 << 13)
211 //
212 // Firmware ACPI Control Structure (FACS)
213 //
214 typedef struct {
215 u32 Signature;
216 u32 Length;
217 u32 HardwareSignature;
218 u32 FirmwareWakingVector;
219 u32 GlobalLock;
220 u32 Flags;
221 u64 XFirmwareWakingVector;
222 u8 Version;
223 u8 Reserved[31];
224 } ACPI_2_0_FACS;
226 #define ACPI_2_0_FACS_VERSION 0x01
228 //
229 // Multiple APIC Description Table header definition (MADT)
230 //
231 typedef struct {
232 ACPI_TABLE_HEADER Header;
233 u32 LocalApicAddress;
234 u32 Flags;
235 } ACPI_2_0_MADT;
237 #define ACPI_2_0_MADT_REVISION 0x01
239 //
240 // Multiple APIC Flags
241 //
242 #define ACPI_PCAT_COMPAT (1 << 0)
244 //
245 // Multiple APIC Description Table APIC structure types
246 //
247 #define ACPI_PROCESSOR_LOCAL_APIC 0x00
248 #define ACPI_IO_APIC 0x01
249 #define ACPI_INTERRUPT_SOURCE_OVERRIDE 0x02
250 #define ACPI_NON_MASKABLE_INTERRUPT_SOURCE 0x03
251 #define ACPI_LOCAL_APIC_NMI 0x04
252 #define ACPI_LOCAL_APIC_ADDRESS_OVERRIDE 0x05
253 #define ACPI_IO_SAPIC 0x06
254 #define ACPI_PROCESSOR_LOCAL_SAPIC 0x07
255 #define ACPI_PLATFORM_INTERRUPT_SOURCES 0x08
257 //
258 // APIC Structure Definitions
259 //
261 //
262 // Processor Local APIC Structure Definition
263 //
265 typedef struct {
266 u8 Type;
267 u8 Length;
268 u8 AcpiProcessorId;
269 u8 ApicId;
270 u32 Flags;
271 } ACPI_LOCAL_APIC_STRUCTURE;
273 //
274 // Local APIC Flags. All other bits are reserved and must be 0.
275 //
277 #define ACPI_LOCAL_APIC_ENABLED (1 << 0)
279 //
280 // IO APIC Structure
281 //
283 typedef struct {
284 u8 Type;
285 u8 Length;
286 u8 IoApicId;
287 u8 Reserved;
288 u32 IoApicAddress;
289 u32 GlobalSystemInterruptBase;
290 } ACPI_IO_APIC_STRUCTURE;
292 // Tabel Signature
293 #define ACPI_2_0_RSDP_SIGNATURE 0x2052545020445352LL // "RSD PTR "
295 #define ACPI_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445344 //"DSDT"
297 #define ACPI_2_0_FACS_SIGNATURE 0x53434146 // "FACS"
299 #define ACPI_2_0_FADT_SIGNATURE 0x50434146 // "FADT"
301 #define ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE 0x43495041 // "APIC"
303 #define ACPI_2_0_RSDT_SIGNATURE 0x54445352 // "RSDT"
305 #define ACPI_2_0_XSDT_SIGNATURE 0x54445358 // "XSDT"
307 #pragma pack ()
309 // The physical that acpi table reside in the guest BIOS
310 //#define ACPI_PHYSICAL_ADDRESS 0xE2000
311 #define ACPI_PHYSICAL_ADDRESS 0xEA000
312 #define ACPI_TABLE_SIZE (2*1024) //Currently 2K is enough
314 void
315 AcpiBuildTable(u8* buf);
317 #endif