aboutsummaryrefslogtreecommitdiffstats
path: root/include/acpi/actbl1.h
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2007-02-02 11:48:18 -0500
committerLen Brown <len.brown@intel.com>2007-02-02 21:14:21 -0500
commitf3d2e7865c816258c699ff965768e46b50d536d3 (patch)
tree83d21269e506109275b77d3ed161883bba8a39cf /include/acpi/actbl1.h
parent2e42005bcdb4f63bed1cea7f537a5534d4bd7a57 (diff)
ACPICA: Implement simplified Table Manager
The Table Manager component has been completely redesigned and reimplemented. The new design is much simpler, and reduces the overall code and data size of the kernel-resident ACPICA by approximately 5%. Also, it is now possible to obtain the ACPI tables very early during kernel initialization, even before dynamic memory management is initialized. Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'include/acpi/actbl1.h')
-rw-r--r--include/acpi/actbl1.h472
1 files changed, 230 insertions, 242 deletions
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 745a6445a4f9..8ae30b7ed652 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -73,12 +73,6 @@
73#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ 73#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */
74#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ 74#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */
75 75
76/* Legacy names */
77
78#define APIC_SIG "APIC" /* Multiple APIC Description Table */
79#define BOOT_SIG "BOOT" /* Simple Boot Flag Table */
80#define SBST_SIG "SBST" /* Smart Battery Specification Table */
81
82/* 76/*
83 * All tables must be byte-packed to match the ACPI specification, since 77 * All tables must be byte-packed to match the ACPI specification, since
84 * the tables are provided by the system BIOS. 78 * the tables are provided by the system BIOS.
@@ -91,6 +85,13 @@
91 * portable, so do not use any other bitfield types. 85 * portable, so do not use any other bitfield types.
92 */ 86 */
93 87
88/* Common Sub-table header (used in MADT, SRAT, etc.) */
89
90struct acpi_subtable_header {
91 u8 type;
92 u8 length;
93};
94
94/******************************************************************************* 95/*******************************************************************************
95 * 96 *
96 * ASF - Alert Standard Format table (Signature "ASF!") 97 * ASF - Alert Standard Format table (Signature "ASF!")
@@ -98,24 +99,27 @@
98 ******************************************************************************/ 99 ******************************************************************************/
99 100
100struct acpi_table_asf { 101struct acpi_table_asf {
101ACPI_TABLE_HEADER_DEF}; 102 struct acpi_table_header header; /* Common ACPI table header */
103};
102 104
103#define ACPI_ASF_HEADER_DEF \ 105/* ASF subtable header */
104 u8 type; \
105 u8 reserved; \
106 u16 length;
107 106
108struct acpi_asf_header { 107struct acpi_asf_header {
109ACPI_ASF_HEADER_DEF}; 108 u8 type;
109 u8 reserved;
110 u16 length;
111};
110 112
111/* Values for Type field */ 113/* Values for Type field above */
112 114
113#define ASF_INFO 0 115enum acpi_asf_type {
114#define ASF_ALERT 1 116 ACPI_ASF_TYPE_INFO = 0,
115#define ASF_CONTROL 2 117 ACPI_ASF_TYPE_ALERT = 1,
116#define ASF_BOOT 3 118 ACPI_ASF_TYPE_CONTROL = 2,
117#define ASF_ADDRESS 4 119 ACPI_ASF_TYPE_BOOT = 3,
118#define ASF_RESERVED 5 120 ACPI_ASF_TYPE_ADDRESS = 4,
121 ACPI_ASF_TYPE_RESERVED = 5
122};
119 123
120/* 124/*
121 * ASF subtables 125 * ASF subtables
@@ -124,7 +128,8 @@ ACPI_ASF_HEADER_DEF};
124/* 0: ASF Information */ 128/* 0: ASF Information */
125 129
126struct acpi_asf_info { 130struct acpi_asf_info {
127 ACPI_ASF_HEADER_DEF u8 min_reset_value; 131 struct acpi_asf_header header;
132 u8 min_reset_value;
128 u8 min_poll_interval; 133 u8 min_poll_interval;
129 u16 system_id; 134 u16 system_id;
130 u32 mfg_id; 135 u32 mfg_id;
@@ -135,7 +140,8 @@ struct acpi_asf_info {
135/* 1: ASF Alerts */ 140/* 1: ASF Alerts */
136 141
137struct acpi_asf_alert { 142struct acpi_asf_alert {
138 ACPI_ASF_HEADER_DEF u8 assert_mask; 143 struct acpi_asf_header header;
144 u8 assert_mask;
139 u8 deassert_mask; 145 u8 deassert_mask;
140 u8 alerts; 146 u8 alerts;
141 u8 data_length; 147 u8 data_length;
@@ -145,7 +151,8 @@ struct acpi_asf_alert {
145/* 2: ASF Remote Control */ 151/* 2: ASF Remote Control */
146 152
147struct acpi_asf_remote { 153struct acpi_asf_remote {
148 ACPI_ASF_HEADER_DEF u8 controls; 154 struct acpi_asf_header header;
155 u8 controls;
149 u8 data_length; 156 u8 data_length;
150 u16 reserved2; 157 u16 reserved2;
151 u8 array[1]; 158 u8 array[1];
@@ -154,7 +161,8 @@ struct acpi_asf_remote {
154/* 3: ASF RMCP Boot Options */ 161/* 3: ASF RMCP Boot Options */
155 162
156struct acpi_asf_rmcp { 163struct acpi_asf_rmcp {
157 ACPI_ASF_HEADER_DEF u8 capabilities[7]; 164 struct acpi_asf_header header;
165 u8 capabilities[7];
158 u8 completion_code; 166 u8 completion_code;
159 u32 enterprise_id; 167 u32 enterprise_id;
160 u8 command; 168 u8 command;
@@ -166,7 +174,8 @@ struct acpi_asf_rmcp {
166/* 4: ASF Address */ 174/* 4: ASF Address */
167 175
168struct acpi_asf_address { 176struct acpi_asf_address {
169 ACPI_ASF_HEADER_DEF u8 eprom_address; 177 struct acpi_asf_header header;
178 u8 eprom_address;
170 u8 devices; 179 u8 devices;
171 u8 smbus_addresses[1]; 180 u8 smbus_addresses[1];
172}; 181};
@@ -178,7 +187,8 @@ struct acpi_asf_address {
178 ******************************************************************************/ 187 ******************************************************************************/
179 188
180struct acpi_table_boot { 189struct acpi_table_boot {
181 ACPI_TABLE_HEADER_DEF u8 cmos_index; /* Index in CMOS RAM for the boot register */ 190 struct acpi_table_header header; /* Common ACPI table header */
191 u8 cmos_index; /* Index in CMOS RAM for the boot register */
182 u8 reserved[3]; 192 u8 reserved[3];
183}; 193};
184 194
@@ -189,7 +199,8 @@ struct acpi_table_boot {
189 ******************************************************************************/ 199 ******************************************************************************/
190 200
191struct acpi_table_cpep { 201struct acpi_table_cpep {
192 ACPI_TABLE_HEADER_DEF u64 reserved; 202 struct acpi_table_header header; /* Common ACPI table header */
203 u64 reserved;
193}; 204};
194 205
195/* Subtable */ 206/* Subtable */
@@ -197,9 +208,9 @@ struct acpi_table_cpep {
197struct acpi_cpep_polling { 208struct acpi_cpep_polling {
198 u8 type; 209 u8 type;
199 u8 length; 210 u8 length;
200 u8 processor_id; /* Processor ID */ 211 u8 id; /* Processor ID */
201 u8 processor_eid; /* Processor EID */ 212 u8 eid; /* Processor EID */
202 u32 polling_interval; /* Polling interval (msec) */ 213 u32 interval; /* Polling interval (msec) */
203}; 214};
204 215
205/******************************************************************************* 216/*******************************************************************************
@@ -209,7 +220,8 @@ struct acpi_cpep_polling {
209 ******************************************************************************/ 220 ******************************************************************************/
210 221
211struct acpi_table_dbgp { 222struct acpi_table_dbgp {
212 ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ 223 struct acpi_table_header header; /* Common ACPI table header */
224 u8 type; /* 0=full 16550, 1=subset of 16550 */
213 u8 reserved[3]; 225 u8 reserved[3];
214 struct acpi_generic_address debug_port; 226 struct acpi_generic_address debug_port;
215}; 227};
@@ -220,12 +232,13 @@ struct acpi_table_dbgp {
220 * 232 *
221 ******************************************************************************/ 233 ******************************************************************************/
222 234
223struct ec_boot_resources { 235struct acpi_table_ecdt {
224 ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */ 236 struct acpi_table_header header; /* Common ACPI table header */
225 struct acpi_generic_address ec_data; /* Address of EC data register */ 237 struct acpi_generic_address control; /* Address of EC command/status register */
238 struct acpi_generic_address data; /* Address of EC data register */
226 u32 uid; /* Unique ID - must be same as the EC _UID method */ 239 u32 uid; /* Unique ID - must be same as the EC _UID method */
227 u8 gpe_bit; /* The GPE for the EC */ 240 u8 gpe; /* The GPE for the EC */
228 u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */ 241 u8 id[1]; /* Full namepath of the EC in the ACPI namespace */
229}; 242};
230 243
231/******************************************************************************* 244/*******************************************************************************
@@ -234,22 +247,22 @@ struct ec_boot_resources {
234 * 247 *
235 ******************************************************************************/ 248 ******************************************************************************/
236 249
237struct acpi_hpet_table { 250struct acpi_table_hpet {
238 ACPI_TABLE_HEADER_DEF u32 hardware_id; /* Hardware ID of event timer block */ 251 struct acpi_table_header header; /* Common ACPI table header */
239 struct acpi_generic_address base_address; /* Address of event timer block */ 252 u32 id; /* Hardware ID of event timer block */
240 u8 hpet_number; /* HPET sequence number */ 253 struct acpi_generic_address address; /* Address of event timer block */
241 u16 clock_tick; /* Main counter min tick, periodic mode */ 254 u8 sequence; /* HPET sequence number */
242 u8 attributes; 255 u16 minimum_tick; /* Main counter min tick, periodic mode */
256 u8 flags;
243}; 257};
244 258
245#if 0 /* HPET flags to be converted to macros */ 259/*! Flags */
246struct { /* Flags (8 bits) */ 260
247 u8 page_protect:1; /* 00: No page protection */ 261#define ACPI_HPET_PAGE_PROTECT (1) /* 00: No page protection */
248 u8 page_protect4:1; /* 01: 4_kB page protected */ 262#define ACPI_HPET_PAGE_PROTECT_4 (1<<1) /* 01: 4KB page protected */
249 u8 page_protect64:1; /* 02: 64_kB page protected */ 263#define ACPI_HPET_PAGE_PROTECT_64 (1<<2) /* 02: 64KB page protected */
250 u8:5; /* 03-07: Reserved, must be zero */ 264
251} flags; 265/*! [End] no source code translation !*/
252#endif
253 266
254/******************************************************************************* 267/*******************************************************************************
255 * 268 *
@@ -257,148 +270,159 @@ struct { /* Flags (8 bits) */
257 * 270 *
258 ******************************************************************************/ 271 ******************************************************************************/
259 272
260struct multiple_apic_table { 273struct acpi_table_madt {
261 ACPI_TABLE_HEADER_DEF u32 local_apic_address; /* Physical address of local APIC */ 274 struct acpi_table_header header; /* Common ACPI table header */
262 275 u32 address; /* Physical address of local APIC */
263 /* Flags (32 bits) */ 276 u32 flags;
264
265 u8 PCATcompat:1; /* 00: System also has dual 8259s */
266 u8:7; /* 01-07: Reserved, must be zero */
267 u8 reserved1[3]; /* 08-31: Reserved, must be zero */
268}; 277};
269 278
270/* Values for MADT PCATCompat */ 279/* Flags */
271
272#define DUAL_PIC 0
273#define MULTIPLE_APIC 1
274
275/* Common MADT Sub-table header */
276
277#define APIC_HEADER_DEF \
278 u8 type; \
279 u8 length;
280
281struct apic_header {
282APIC_HEADER_DEF};
283
284/* Values for Type in struct apic_header */
285 280
286#define APIC_PROCESSOR 0 281#define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */
287#define APIC_IO 1
288#define APIC_XRUPT_OVERRIDE 2
289#define APIC_NMI 3
290#define APIC_LOCAL_NMI 4
291#define APIC_ADDRESS_OVERRIDE 5
292#define APIC_IO_SAPIC 6
293#define APIC_LOCAL_SAPIC 7
294#define APIC_XRUPT_SOURCE 8
295#define APIC_RESERVED 9 /* 9 and greater are reserved */
296 282
297/* Flag definitions for MADT sub-tables */ 283/* Values for PCATCompat flag */
298 284
299#define ACPI_MADT_IFLAGS /* INTI flags (16 bits) */ \ 285#define ACPI_MADT_DUAL_PIC 0
300 u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\ 286#define ACPI_MADT_MULTIPLE_APIC 1
301 u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\
302 u8 : 4; /* 04-07: Reserved, must be zero */\
303 u8 reserved1; /* 08-15: Reserved, must be zero */
304 287
305#define ACPI_MADT_LFLAGS /* Local Sapic flags (32 bits) */ \ 288/* Values for subtable type in struct acpi_subtable_header */
306 u8 processor_enabled: 1; /* 00: Processor is usable if set */\
307 u8 : 7; /* 01-07: Reserved, must be zero */\
308 u8 reserved2[3]; /* 08-31: Reserved, must be zero */
309 289
310/* Values for MPS INTI flags */ 290enum acpi_madt_type {
311 291 ACPI_MADT_TYPE_LOCAL_APIC = 0,
312#define POLARITY_CONFORMS 0 292 ACPI_MADT_TYPE_IO_APIC = 1,
313#define POLARITY_ACTIVE_HIGH 1 293 ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2,
314#define POLARITY_RESERVED 2 294 ACPI_MADT_TYPE_NMI_SOURCE = 3,
315#define POLARITY_ACTIVE_LOW 3 295 ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4,
316 296 ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5,
317#define TRIGGER_CONFORMS 0 297 ACPI_MADT_TYPE_IO_SAPIC = 6,
318#define TRIGGER_EDGE 1 298 ACPI_MADT_TYPE_LOCAL_SAPIC = 7,
319#define TRIGGER_RESERVED 2 299 ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
320#define TRIGGER_LEVEL 3 300 ACPI_MADT_TYPE_RESERVED = 9 /* 9 and greater are reserved */
301};
321 302
322/* 303/*
323 * MADT Sub-tables, correspond to Type in struct apic_header 304 * MADT Sub-tables, correspond to Type in struct acpi_subtable_header
324 */ 305 */
325 306
326/* 0: processor APIC */ 307/* 0: Processor Local APIC */
327 308
328struct madt_processor_apic { 309struct acpi_madt_local_apic {
329 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ 310 struct acpi_subtable_header header;
330 u8 local_apic_id; /* Processor's local APIC id */ 311 u8 processor_id; /* ACPI processor id */
331 ACPI_MADT_LFLAGS}; 312 u8 id; /* Processor's local APIC id */
313 u32 lapic_flags;
314};
332 315
333/* 1: IO APIC */ 316/* 1: IO APIC */
334 317
335struct madt_io_apic { 318struct acpi_madt_io_apic {
336 APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */ 319 struct acpi_subtable_header header;
320 u8 id; /* I/O APIC ID */
337 u8 reserved; /* Reserved - must be zero */ 321 u8 reserved; /* Reserved - must be zero */
338 u32 address; /* APIC physical address */ 322 u32 address; /* APIC physical address */
339 u32 interrupt; /* Global system interrupt where INTI lines start */ 323 u32 global_irq_base; /* Global system interrupt where INTI lines start */
340}; 324};
341 325
342/* 2: Interrupt Override */ 326/* 2: Interrupt Override */
343 327
344struct madt_interrupt_override { 328struct acpi_madt_interrupt_override {
345 APIC_HEADER_DEF u8 bus; /* 0 - ISA */ 329 struct acpi_subtable_header header;
346 u8 source; /* Interrupt source (IRQ) */ 330 u8 bus; /* 0 - ISA */
347 u32 interrupt; /* Global system interrupt */ 331 u8 source_irq; /* Interrupt source (IRQ) */
348 ACPI_MADT_IFLAGS}; 332 u32 global_irq; /* Global system interrupt */
333 u16 inti_flags;
334};
349 335
350/* 3: NMI Sources */ 336/* 3: NMI Source */
351 337
352struct madt_nmi_source { 338struct acpi_madt_nmi_source {
353 APIC_HEADER_DEF ACPI_MADT_IFLAGS u32 interrupt; /* Global system interrupt */ 339 struct acpi_subtable_header header;
340 u16 inti_flags;
341 u32 global_irq; /* Global system interrupt */
354}; 342};
355 343
356/* 4: Local APIC NMI */ 344/* 4: Local APIC NMI */
357 345
358struct madt_local_apic_nmi { 346struct acpi_madt_local_apic_nmi {
359 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ 347 struct acpi_subtable_header header;
360 ACPI_MADT_IFLAGS u8 lint; /* LINTn to which NMI is connected */ 348 u8 processor_id; /* ACPI processor id */
349 u16 inti_flags;
350 u8 lint; /* LINTn to which NMI is connected */
361}; 351};
362 352
363/* 5: Address Override */ 353/* 5: Address Override */
364 354
365struct madt_address_override { 355struct acpi_madt_local_apic_override {
366 APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */ 356 struct acpi_subtable_header header;
357 u16 reserved; /* Reserved, must be zero */
367 u64 address; /* APIC physical address */ 358 u64 address; /* APIC physical address */
368}; 359};
369 360
370/* 6: I/O Sapic */ 361/* 6: I/O Sapic */
371 362
372struct madt_io_sapic { 363struct acpi_madt_io_sapic {
373 APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */ 364 struct acpi_subtable_header header;
365 u8 id; /* I/O SAPIC ID */
374 u8 reserved; /* Reserved, must be zero */ 366 u8 reserved; /* Reserved, must be zero */
375 u32 interrupt_base; /* Glocal interrupt for SAPIC start */ 367 u32 global_irq_base; /* Global interrupt for SAPIC start */
376 u64 address; /* SAPIC physical address */ 368 u64 address; /* SAPIC physical address */
377}; 369};
378 370
379/* 7: Local Sapic */ 371/* 7: Local Sapic */
380 372
381struct madt_local_sapic { 373struct acpi_madt_local_sapic {
382 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ 374 struct acpi_subtable_header header;
383 u8 local_sapic_id; /* SAPIC ID */ 375 u8 processor_id; /* ACPI processor id */
384 u8 local_sapic_eid; /* SAPIC EID */ 376 u8 id; /* SAPIC ID */
377 u8 eid; /* SAPIC EID */
385 u8 reserved[3]; /* Reserved, must be zero */ 378 u8 reserved[3]; /* Reserved, must be zero */
386 ACPI_MADT_LFLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */ 379 u32 lapic_flags;
387 char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ 380 u32 uid; /* Numeric UID - ACPI 3.0 */
381 char uid_string[1]; /* String UID - ACPI 3.0 */
388}; 382};
389 383
390/* 8: Platform Interrupt Source */ 384/* 8: Platform Interrupt Source */
391 385
392struct madt_interrupt_source { 386struct acpi_madt_interrupt_source {
393 APIC_HEADER_DEF ACPI_MADT_IFLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */ 387 struct acpi_subtable_header header;
394 u8 processor_id; /* Processor ID */ 388 u16 inti_flags;
395 u8 processor_eid; /* Processor EID */ 389 u8 type; /* 1=PMI, 2=INIT, 3=corrected */
390 u8 id; /* Processor ID */
391 u8 eid; /* Processor EID */
396 u8 io_sapic_vector; /* Vector value for PMI interrupts */ 392 u8 io_sapic_vector; /* Vector value for PMI interrupts */
397 u32 interrupt; /* Global system interrupt */ 393 u32 global_irq; /* Global system interrupt */
398 u32 flags; /* Interrupt Source Flags */ 394 u32 flags; /* Interrupt Source Flags */
399}; 395};
400 396
401#ifdef DUPLICATE_DEFINITION_WITH_LINUX_ACPI_H 397/* Flags field above */
398
399#define ACPI_MADT_CPEI_OVERRIDE (1)
400
401/*
402 * Common flags fields for MADT subtables
403 */
404
405/* MADT Local APIC flags (lapic_flags) */
406
407#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */
408
409/* MADT MPS INTI flags (inti_flags) */
410
411#define ACPI_MADT_POLARITY_MASK (3) /* 00-01: Polarity of APIC I/O input signals */
412#define ACPI_MADT_TRIGGER_MASK (3<<2) /* 02-03: Trigger mode of APIC input signals */
413
414/* Values for MPS INTI flags */
415
416#define ACPI_MADT_POLARITY_CONFORMS 0
417#define ACPI_MADT_POLARITY_ACTIVE_HIGH 1
418#define ACPI_MADT_POLARITY_RESERVED 2
419#define ACPI_MADT_POLARITY_ACTIVE_LOW 3
420
421#define ACPI_MADT_TRIGGER_CONFORMS (0)
422#define ACPI_MADT_TRIGGER_EDGE (1<<2)
423#define ACPI_MADT_TRIGGER_RESERVED (2<<2)
424#define ACPI_MADT_TRIGGER_LEVEL (3<<2)
425
402/******************************************************************************* 426/*******************************************************************************
403 * 427 *
404 * MCFG - PCI Memory Mapped Configuration table and sub-table 428 * MCFG - PCI Memory Mapped Configuration table and sub-table
@@ -406,17 +430,19 @@ struct madt_interrupt_source {
406 ******************************************************************************/ 430 ******************************************************************************/
407 431
408struct acpi_table_mcfg { 432struct acpi_table_mcfg {
409 ACPI_TABLE_HEADER_DEF u8 reserved[8]; 433 struct acpi_table_header header; /* Common ACPI table header */
434 u8 reserved[8];
410}; 435};
411 436
437/* Subtable */
438
412struct acpi_mcfg_allocation { 439struct acpi_mcfg_allocation {
413 u64 base_address; /* Base address, processor-relative */ 440 u64 address; /* Base address, processor-relative */
414 u16 pci_segment; /* PCI segment group number */ 441 u16 pci_segment; /* PCI segment group number */
415 u8 start_bus_number; /* Starting PCI Bus number */ 442 u8 start_bus_number; /* Starting PCI Bus number */
416 u8 end_bus_number; /* Final PCI Bus number */ 443 u8 end_bus_number; /* Final PCI Bus number */
417 u32 reserved; 444 u32 reserved;
418}; 445};
419#endif
420 446
421/******************************************************************************* 447/*******************************************************************************
422 * 448 *
@@ -424,8 +450,9 @@ struct acpi_mcfg_allocation {
424 * 450 *
425 ******************************************************************************/ 451 ******************************************************************************/
426 452
427struct smart_battery_table { 453struct acpi_table_sbst {
428 ACPI_TABLE_HEADER_DEF u32 warning_level; 454 struct acpi_table_header header; /* Common ACPI table header */
455 u32 warning_level;
429 u32 low_level; 456 u32 low_level;
430 u32 critical_level; 457 u32 critical_level;
431}; 458};
@@ -436,9 +463,10 @@ struct smart_battery_table {
436 * 463 *
437 ******************************************************************************/ 464 ******************************************************************************/
438 465
439struct system_locality_info { 466struct acpi_table_slit {
440 ACPI_TABLE_HEADER_DEF u64 locality_count; 467 struct acpi_table_header header; /* Common ACPI table header */
441 u8 entry[1][1]; 468 u64 locality_count;
469 u8 entry[1]; /* Real size = localities^2 */
442}; 470};
443 471
444/******************************************************************************* 472/*******************************************************************************
@@ -448,7 +476,8 @@ struct system_locality_info {
448 ******************************************************************************/ 476 ******************************************************************************/
449 477
450struct acpi_table_spcr { 478struct acpi_table_spcr {
451 ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ 479 struct acpi_table_header header; /* Common ACPI table header */
480 u8 interface_type; /* 0=full 16550, 1=subset of 16550 */
452 u8 reserved[3]; 481 u8 reserved[3];
453 struct acpi_generic_address serial_port; 482 struct acpi_generic_address serial_port;
454 u8 interrupt_type; 483 u8 interrupt_type;
@@ -459,7 +488,7 @@ struct acpi_table_spcr {
459 u8 stop_bits; 488 u8 stop_bits;
460 u8 flow_control; 489 u8 flow_control;
461 u8 terminal_type; 490 u8 terminal_type;
462 u8 reserved2; 491 u8 reserved1;
463 u16 pci_device_id; 492 u16 pci_device_id;
464 u16 pci_vendor_id; 493 u16 pci_vendor_id;
465 u8 pci_bus; 494 u8 pci_bus;
@@ -467,7 +496,7 @@ struct acpi_table_spcr {
467 u8 pci_function; 496 u8 pci_function;
468 u32 pci_flags; 497 u32 pci_flags;
469 u8 pci_segment; 498 u8 pci_segment;
470 u32 reserved3; 499 u32 reserved2;
471}; 500};
472 501
473/******************************************************************************* 502/*******************************************************************************
@@ -477,12 +506,13 @@ struct acpi_table_spcr {
477 ******************************************************************************/ 506 ******************************************************************************/
478 507
479struct acpi_table_spmi { 508struct acpi_table_spmi {
480 ACPI_TABLE_HEADER_DEF u8 reserved; 509 struct acpi_table_header header; /* Common ACPI table header */
510 u8 reserved;
481 u8 interface_type; 511 u8 interface_type;
482 u16 spec_revision; /* Version of IPMI */ 512 u16 spec_revision; /* Version of IPMI */
483 u8 interrupt_type; 513 u8 interrupt_type;
484 u8 gpe_number; /* GPE assigned */ 514 u8 gpe_number; /* GPE assigned */
485 u8 reserved2; 515 u8 reserved1;
486 u8 pci_device_flag; 516 u8 pci_device_flag;
487 u32 interrupt; 517 u32 interrupt;
488 struct acpi_generic_address ipmi_register; 518 struct acpi_generic_address ipmi_register;
@@ -498,56 +528,61 @@ struct acpi_table_spmi {
498 * 528 *
499 ******************************************************************************/ 529 ******************************************************************************/
500 530
501struct system_resource_affinity { 531struct acpi_table_srat {
502 ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */ 532 struct acpi_table_header header; /* Common ACPI table header */
503 u64 reserved2; /* Reserved, must be zero */ 533 u32 table_revision; /* Must be value '1' */
534 u64 reserved; /* Reserved, must be zero */
504}; 535};
505 536
506/* SRAT common sub-table header */ 537/* Values for subtable type in struct acpi_subtable_header */
507
508#define SRAT_SUBTABLE_HEADER \
509 u8 type; \
510 u8 length;
511
512/* Values for Type above */
513 538
514#define SRAT_CPU_AFFINITY 0 539enum acpi_srat_type {
515#define SRAT_MEMORY_AFFINITY 1 540 ACPI_SRAT_TYPE_CPU_AFFINITY = 0,
516#define SRAT_RESERVED 2 541 ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1,
542 ACPI_SRAT_TYPE_RESERVED = 2
543};
517 544
518/* SRAT sub-tables */ 545/* SRAT sub-tables */
519 546
520struct static_resource_alloc { 547struct acpi_srat_cpu_affinity {
521 SRAT_SUBTABLE_HEADER u8 proximity_domain_lo; 548 struct acpi_subtable_header header;
549 u8 proximity_domain_lo;
522 u8 apic_id; 550 u8 apic_id;
523 551 u32 flags;
524 /* Flags (32 bits) */
525
526 u8 enabled:1; /* 00: Use affinity structure */
527 u8:7; /* 01-07: Reserved, must be zero */
528 u8 reserved3[3]; /* 08-31: Reserved, must be zero */
529
530 u8 local_sapic_eid; 552 u8 local_sapic_eid;
531 u8 proximity_domain_hi[3]; 553 u8 proximity_domain_hi[3];
532 u32 reserved4; /* Reserved, must be zero */ 554 u32 reserved; /* Reserved, must be zero */
533}; 555};
534 556
535struct memory_affinity { 557/* Flags */
536 SRAT_SUBTABLE_HEADER u32 proximity_domain; 558
537 u16 reserved3; 559#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */
560
561struct acpi_srat_mem_affinity {
562 struct acpi_subtable_header header;
563 u32 proximity_domain;
564 u16 reserved; /* Reserved, must be zero */
538 u64 base_address; 565 u64 base_address;
539 u64 address_length; 566 u64 length;
540 u32 reserved4; 567 u32 memory_type; /* See acpi_address_range_id */
568 u32 flags;
569 u64 reserved1; /* Reserved, must be zero */
570};
571
572/* Flags */
541 573
542 /* Flags (32 bits) */ 574#define ACPI_SRAT_MEM_ENABLED (1) /* 00: Use affinity structure */
575#define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */
576#define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */
543 577
544 u8 enabled:1; /* 00: Use affinity structure */ 578/* Memory types */
545 u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */
546 u8 non_volatile:1; /* 02: Memory is non-volatile */
547 u8:5; /* 03-07: Reserved, must be zero */
548 u8 reserved5[3]; /* 08-31: Reserved, must be zero */
549 579
550 u64 reserved6; /* Reserved, must be zero */ 580enum acpi_address_range_id {
581 ACPI_ADDRESS_RANGE_MEMORY = 1,
582 ACPI_ADDRESS_RANGE_RESERVED = 2,
583 ACPI_ADDRESS_RANGE_ACPI = 3,
584 ACPI_ADDRESS_RANGE_NVS = 4,
585 ACPI_ADDRESS_RANGE_COUNT = 5
551}; 586};
552 587
553/******************************************************************************* 588/*******************************************************************************
@@ -557,7 +592,8 @@ struct memory_affinity {
557 ******************************************************************************/ 592 ******************************************************************************/
558 593
559struct acpi_table_tcpa { 594struct acpi_table_tcpa {
560 ACPI_TABLE_HEADER_DEF u16 reserved; 595 struct acpi_table_header header; /* Common ACPI table header */
596 u16 reserved;
561 u32 max_log_length; /* Maximum length for the event log area */ 597 u32 max_log_length; /* Maximum length for the event log area */
562 u64 log_address; /* Address of the event log area */ 598 u64 log_address; /* Address of the event log area */
563}; 599};
@@ -569,7 +605,8 @@ struct acpi_table_tcpa {
569 ******************************************************************************/ 605 ******************************************************************************/
570 606
571struct acpi_table_wdrt { 607struct acpi_table_wdrt {
572 ACPI_TABLE_HEADER_DEF u32 header_length; /* Watchdog Header Length */ 608 struct acpi_table_header header; /* Common ACPI table header */
609 u32 header_length; /* Watchdog Header Length */
573 u8 pci_segment; /* PCI Segment number */ 610 u8 pci_segment; /* PCI Segment number */
574 u8 pci_bus; /* PCI Bus number */ 611 u8 pci_bus; /* PCI Bus number */
575 u8 pci_device; /* PCI Device number */ 612 u8 pci_device; /* PCI Device number */
@@ -582,58 +619,9 @@ struct acpi_table_wdrt {
582 u32 entries; /* Number of watchdog entries that follow */ 619 u32 entries; /* Number of watchdog entries that follow */
583}; 620};
584 621
585#if 0 /* Flags, will be converted to macros */ 622/* Flags */
586u8 enabled:1; /* 00: Timer enabled */ 623
587u8:6; /* 01-06: Reserved */ 624#define ACPI_WDRT_TIMER_ENABLED (1) /* 00: Timer enabled */
588u8 sleep_stop:1; /* 07: Timer stopped in sleep state */
589#endif
590
591/* Macros used to generate offsets to specific table fields */
592
593#define ACPI_ASF0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_info,f)
594#define ACPI_ASF1_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_alert,f)
595#define ACPI_ASF2_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_remote,f)
596#define ACPI_ASF3_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_rmcp,f)
597#define ACPI_ASF4_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_address,f)
598#define ACPI_BOOT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_boot,f)
599#define ACPI_CPEP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_cpep,f)
600#define ACPI_CPEP0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_cpep_polling,f)
601#define ACPI_DBGP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_dbgp,f)
602#define ACPI_ECDT_OFFSET(f) (u8) ACPI_OFFSET (struct ec_boot_resources,f)
603#define ACPI_HPET_OFFSET(f) (u8) ACPI_OFFSET (struct hpet_table,f)
604#define ACPI_MADT_OFFSET(f) (u8) ACPI_OFFSET (struct multiple_apic_table,f)
605#define ACPI_MADT0_OFFSET(f) (u8) ACPI_OFFSET (struct madt_processor_apic,f)
606#define ACPI_MADT1_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_apic,f)
607#define ACPI_MADT2_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_override,f)
608#define ACPI_MADT3_OFFSET(f) (u8) ACPI_OFFSET (struct madt_nmi_source,f)
609#define ACPI_MADT4_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_apic_nmi,f)
610#define ACPI_MADT5_OFFSET(f) (u8) ACPI_OFFSET (struct madt_address_override,f)
611#define ACPI_MADT6_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_sapic,f)
612#define ACPI_MADT7_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_sapic,f)
613#define ACPI_MADT8_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_source,f)
614#define ACPI_MADTH_OFFSET(f) (u8) ACPI_OFFSET (struct apic_header,f)
615#define ACPI_MCFG_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_mcfg,f)
616#define ACPI_MCFG0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_mcfg_allocation,f)
617#define ACPI_SBST_OFFSET(f) (u8) ACPI_OFFSET (struct smart_battery_table,f)
618#define ACPI_SLIT_OFFSET(f) (u8) ACPI_OFFSET (struct system_locality_info,f)
619#define ACPI_SPCR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spcr,f)
620#define ACPI_SPMI_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spmi,f)
621#define ACPI_SRAT_OFFSET(f) (u8) ACPI_OFFSET (struct system_resource_affinity,f)
622#define ACPI_SRAT0_OFFSET(f) (u8) ACPI_OFFSET (struct static_resource_alloc,f)
623#define ACPI_SRAT1_OFFSET(f) (u8) ACPI_OFFSET (struct memory_affinity,f)
624#define ACPI_TCPA_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_tcpa,f)
625#define ACPI_WDRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_wdrt,f)
626
627#define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct hpet_table,f,o)
628#define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct static_resource_alloc,f,o)
629#define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct memory_affinity,f,o)
630#define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct multiple_apic_table,f,o)
631#define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_processor_apic,f,o)
632#define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_override,f,o)
633#define ACPI_MADT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_nmi_source,f,o)
634#define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_apic_nmi,f,o)
635#define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_sapic,f,o)
636#define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_source,f,o)
637 625
638/* Reset to default packing */ 626/* Reset to default packing */
639 627