blob: a46f406e1c94528c79034886dc94c0c130535116 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/******************************************************************************
2 *
3 * Name: actbl.h - Table data structures defined in ACPI specification
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore
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 MERCHANTIBILITY 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 __ACTBL_H__
45#define __ACTBL_H__
46
Linus Torvalds1da177e2005-04-16 15:20:36 -070047/*
48 * Values for description table header signatures
49 */
50#define RSDP_NAME "RSDP"
Len Brown4be44fc2005-08-05 00:44:28 -040051#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */
52#define APIC_SIG "APIC" /* Multiple APIC Description Table */
53#define DSDT_SIG "DSDT" /* Differentiated System Description Table */
54#define FADT_SIG "FACP" /* Fixed ACPI Description Table */
55#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */
56#define PSDT_SIG "PSDT" /* Persistent System Description Table */
57#define RSDT_SIG "RSDT" /* Root System Description Table */
58#define XSDT_SIG "XSDT" /* Extended System Description Table */
59#define SSDT_SIG "SSDT" /* Secondary System Description Table */
60#define SBST_SIG "SBST" /* Smart Battery Specification Table */
61#define SPIC_SIG "SPIC" /* IOSAPIC table */
62#define BOOT_SIG "BOOT" /* Boot table */
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
Len Brown4be44fc2005-08-05 00:44:28 -040064#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070065
66/*
67 * Common table types. The base code can remain
68 * constant if the underlying tables are changed
69 */
70#define RSDT_DESCRIPTOR struct rsdt_descriptor_rev2
71#define XSDT_DESCRIPTOR struct xsdt_descriptor_rev2
72#define FACS_DESCRIPTOR struct facs_descriptor_rev2
73#define FADT_DESCRIPTOR struct fadt_descriptor_rev2
74
Linus Torvalds1da177e2005-04-16 15:20:36 -070075#pragma pack(1)
76
77/*
78 * ACPI Version-independent tables
79 *
80 * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.)
81 * are in separate files.
82 */
Len Brown4be44fc2005-08-05 00:44:28 -040083struct rsdp_descriptor { /* Root System Descriptor Pointer */
84 char signature[8]; /* ACPI signature, contains "RSD PTR " */
85 u8 checksum; /* ACPI 1.0 checksum */
86 char oem_id[6]; /* OEM identification */
87 u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
88 u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */
89 u32 length; /* XSDT Length in bytes, including header */
90 u64 xsdt_physical_address; /* 64-bit physical address of the XSDT */
91 u8 extended_checksum; /* Checksum of entire table (ACPI 2.0) */
92 char reserved[3]; /* Reserved, must be zero */
Linus Torvalds1da177e2005-04-16 15:20:36 -070093};
94
Len Brown4be44fc2005-08-05 00:44:28 -040095struct acpi_common_facs { /* Common FACS for internal use */
96 u32 *global_lock;
97 u64 *firmware_waking_vector;
98 u8 vector_width;
Linus Torvalds1da177e2005-04-16 15:20:36 -070099};
100
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \
Robert Mooref9f46012005-07-08 00:00:00 -0400102 char signature[4]; /* ASCII table signature */\
103 u32 length; /* Length of table in bytes, including this header */\
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104 u8 revision; /* ACPI Specification minor version # */\
105 u8 checksum; /* To make sum of entire table == 0 */\
Robert Mooref9f46012005-07-08 00:00:00 -0400106 char oem_id[6]; /* ASCII OEM identification */\
107 char oem_table_id[8]; /* ASCII OEM table identification */\
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 u32 oem_revision; /* OEM revision number */\
Robert Mooref9f46012005-07-08 00:00:00 -0400109 char asl_compiler_id [4]; /* ASCII ASL compiler vendor ID */\
Len Brown4be44fc2005-08-05 00:44:28 -0400110 u32 asl_compiler_revision; /* ASL compiler version */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111
Len Brown4be44fc2005-08-05 00:44:28 -0400112struct acpi_table_header { /* ACPI common table header */
113ACPI_TABLE_HEADER_DEF};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114
115/*
116 * MADT values and structures
117 */
118
119/* Values for MADT PCATCompat */
120
121#define DUAL_PIC 0
122#define MULTIPLE_APIC 1
123
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124/* Master MADT */
125
Len Brown4be44fc2005-08-05 00:44:28 -0400126struct multiple_apic_table {
127 ACPI_TABLE_HEADER_DEF /* ACPI common table header */
128 u32 local_apic_address; /* Physical address of local APIC */
Robert Mooref9f46012005-07-08 00:00:00 -0400129
130 /* Flags (32 bits) */
131
Len Brown4be44fc2005-08-05 00:44:28 -0400132 u8 PCATcompat:1; /* 00: System also has dual 8259s */
133 u8:7; /* 01-07: Reserved, must be zero */
134 u8 reserved1[3]; /* 08-31: Reserved, must be zero */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135};
136
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137/* Values for Type in APIC_HEADER_DEF */
138
139#define APIC_PROCESSOR 0
140#define APIC_IO 1
141#define APIC_XRUPT_OVERRIDE 2
142#define APIC_NMI 3
143#define APIC_LOCAL_NMI 4
144#define APIC_ADDRESS_OVERRIDE 5
145#define APIC_IO_SAPIC 6
146#define APIC_LOCAL_SAPIC 7
147#define APIC_XRUPT_SOURCE 8
Len Brown4be44fc2005-08-05 00:44:28 -0400148#define APIC_RESERVED 9 /* 9 and greater are reserved */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149
150/*
151 * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
152 */
153#define APIC_HEADER_DEF /* Common APIC sub-structure header */\
154 u8 type; \
155 u8 length;
156
Len Brown4be44fc2005-08-05 00:44:28 -0400157struct apic_header {
158APIC_HEADER_DEF};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159
160/* Values for MPS INTI flags */
161
162#define POLARITY_CONFORMS 0
163#define POLARITY_ACTIVE_HIGH 1
164#define POLARITY_RESERVED 2
165#define POLARITY_ACTIVE_LOW 3
166
167#define TRIGGER_CONFORMS 0
168#define TRIGGER_EDGE 1
169#define TRIGGER_RESERVED 2
170#define TRIGGER_LEVEL 3
171
Robert Mooref9f46012005-07-08 00:00:00 -0400172/* Common flag definitions (16 bits each) */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173
174#define MPS_INTI_FLAGS \
Robert Mooref9f46012005-07-08 00:00:00 -0400175 u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\
176 u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\
177 u8 : 4; /* 04-07: Reserved, must be zero */\
Len Brown4be44fc2005-08-05 00:44:28 -0400178 u8 reserved1; /* 08-15: Reserved, must be zero */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179
180#define LOCAL_APIC_FLAGS \
Robert Mooref9f46012005-07-08 00:00:00 -0400181 u8 processor_enabled: 1; /* 00: Processor is usable if set */\
182 u8 : 7; /* 01-07: Reserved, must be zero */\
Len Brown4be44fc2005-08-05 00:44:28 -0400183 u8 reserved2; /* 08-15: Reserved, must be zero */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184
185/* Sub-structures for MADT */
186
Len Brown4be44fc2005-08-05 00:44:28 -0400187struct madt_processor_apic {
188 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
189 u8 local_apic_id; /* Processor's local APIC id */
190 LOCAL_APIC_FLAGS};
191
192struct madt_io_apic {
193 APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */
194 u8 reserved; /* Reserved - must be zero */
195 u32 address; /* APIC physical address */
196 u32 interrupt; /* Global system interrupt where INTI
197 * lines start */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198};
199
Len Brown4be44fc2005-08-05 00:44:28 -0400200struct madt_interrupt_override {
201 APIC_HEADER_DEF u8 bus; /* 0 - ISA */
202 u8 source; /* Interrupt source (IRQ) */
203 u32 interrupt; /* Global system interrupt */
204 MPS_INTI_FLAGS};
205
206struct madt_nmi_source {
207 APIC_HEADER_DEF MPS_INTI_FLAGS u32 interrupt; /* Global system interrupt */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208};
209
Len Brown4be44fc2005-08-05 00:44:28 -0400210struct madt_local_apic_nmi {
211 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
212 MPS_INTI_FLAGS u8 lint; /* LINTn to which NMI is connected */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213};
214
Len Brown4be44fc2005-08-05 00:44:28 -0400215struct madt_address_override {
216 APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */
217 u64 address; /* APIC physical address */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218};
219
Len Brown4be44fc2005-08-05 00:44:28 -0400220struct madt_io_sapic {
221 APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */
222 u8 reserved; /* Reserved, must be zero */
223 u32 interrupt_base; /* Glocal interrupt for SAPIC start */
224 u64 address; /* SAPIC physical address */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225};
226
Len Brown4be44fc2005-08-05 00:44:28 -0400227struct madt_local_sapic {
228 APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
229 u8 local_sapic_id; /* SAPIC ID */
230 u8 local_sapic_eid; /* SAPIC EID */
231 u8 reserved[3]; /* Reserved, must be zero */
232 LOCAL_APIC_FLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */
233 char processor_uIDstring[1]; /* String UID - ACPI 3.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234};
235
Len Brown4be44fc2005-08-05 00:44:28 -0400236struct madt_interrupt_source {
237 APIC_HEADER_DEF MPS_INTI_FLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */
238 u8 processor_id; /* Processor ID */
239 u8 processor_eid; /* Processor EID */
240 u8 io_sapic_vector; /* Vector value for PMI interrupts */
241 u32 interrupt; /* Global system interrupt */
242 u32 flags; /* Interrupt Source Flags */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243};
244
Linus Torvalds1da177e2005-04-16 15:20:36 -0700245/*
246 * Smart Battery
247 */
Len Brown4be44fc2005-08-05 00:44:28 -0400248struct smart_battery_table {
249 ACPI_TABLE_HEADER_DEF u32 warning_level;
250 u32 low_level;
251 u32 critical_level;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252};
253
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254#pragma pack()
255
Linus Torvalds1da177e2005-04-16 15:20:36 -0700256/*
257 * ACPI Table information. We save the table address, length,
258 * and type of memory allocation (mapped or allocated) for each
259 * table for 1) when we exit, and 2) if a new table is installed
260 */
261#define ACPI_MEM_NOT_ALLOCATED 0
262#define ACPI_MEM_ALLOCATED 1
263#define ACPI_MEM_MAPPED 2
264
265/* Definitions for the Flags bitfield member of struct acpi_table_support */
266
267#define ACPI_TABLE_SINGLE 0x00
268#define ACPI_TABLE_MULTIPLE 0x01
269#define ACPI_TABLE_EXECUTABLE 0x02
270
271#define ACPI_TABLE_ROOT 0x00
272#define ACPI_TABLE_PRIMARY 0x10
273#define ACPI_TABLE_SECONDARY 0x20
274#define ACPI_TABLE_ALL 0x30
275#define ACPI_TABLE_TYPE_MASK 0x30
276
277/* Data about each known table type */
278
Len Brown4be44fc2005-08-05 00:44:28 -0400279struct acpi_table_support {
280 char *name;
281 char *signature;
282 void **global_ptr;
283 u8 sig_length;
284 u8 flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285};
286
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287/*
288 * Get the ACPI version-specific tables
289 */
Len Brown4be44fc2005-08-05 00:44:28 -0400290#include "actbl1.h" /* Acpi 1.0 table definitions */
291#include "actbl2.h" /* Acpi 2.0 table definitions */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292
Len Brown4be44fc2005-08-05 00:44:28 -0400293extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1,
294 * needed for certain workarounds */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295
296#pragma pack(1)
297/*
298 * High performance timer
299 */
Len Brown4be44fc2005-08-05 00:44:28 -0400300struct hpet_table {
301 ACPI_TABLE_HEADER_DEF u32 hardware_id;
302 struct acpi_generic_address base_address;
303 u8 hpet_number;
304 u16 clock_tick;
305 u8 attributes;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306};
307
308#pragma pack()
309
Len Brown4be44fc2005-08-05 00:44:28 -0400310#endif /* __ACTBL_H__ */