[ACPI] handle const char * __FUNCTION__ in debug code
[pandora-kernel.git] / include / acpi / actbl.h
1 /******************************************************************************
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
47
48 /*
49  *  Values for description table header signatures
50  */
51 #define RSDP_NAME               "RSDP"
52 #define RSDP_SIG                "RSD PTR "  /* RSDT Pointer signature */
53 #define APIC_SIG                "APIC"      /* Multiple APIC Description Table */
54 #define DSDT_SIG                "DSDT"      /* Differentiated System Description Table */
55 #define FADT_SIG                "FACP"      /* Fixed ACPI Description Table */
56 #define FACS_SIG                "FACS"      /* Firmware ACPI Control Structure */
57 #define PSDT_SIG                "PSDT"      /* Persistent System Description Table */
58 #define RSDT_SIG                "RSDT"      /* Root System Description Table */
59 #define XSDT_SIG                "XSDT"      /* Extended  System Description Table */
60 #define SSDT_SIG                "SSDT"      /* Secondary System Description Table */
61 #define SBST_SIG                "SBST"      /* Smart Battery Specification Table */
62 #define SPIC_SIG                "SPIC"      /* IOSAPIC table */
63 #define BOOT_SIG                "BOOT"      /* Boot table */
64
65
66 #define GL_OWNED                0x02        /* Ownership of global lock is bit 1 */
67
68
69 /*
70  * Common table types.  The base code can remain
71  * constant if the underlying tables are changed
72  */
73 #define RSDT_DESCRIPTOR         struct rsdt_descriptor_rev2
74 #define XSDT_DESCRIPTOR         struct xsdt_descriptor_rev2
75 #define FACS_DESCRIPTOR         struct facs_descriptor_rev2
76 #define FADT_DESCRIPTOR         struct fadt_descriptor_rev2
77
78
79 #pragma pack(1)
80
81 /*
82  * ACPI Version-independent tables
83  *
84  * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.)
85  * are in separate files.
86  */
87 struct rsdp_descriptor         /* Root System Descriptor Pointer */
88 {
89         char                            signature[8];           /* ACPI signature, contains "RSD PTR " */
90         u8                              checksum;               /* ACPI 1.0 checksum */
91         char                            oem_id[6];              /* OEM identification */
92         u8                              revision;               /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
93         u32                             rsdt_physical_address;  /* 32-bit physical address of the RSDT */
94         u32                             length;                 /* XSDT Length in bytes, including header */
95         u64                             xsdt_physical_address;  /* 64-bit physical address of the XSDT */
96         u8                              extended_checksum;      /* Checksum of entire table (ACPI 2.0) */
97         char                            reserved[3];            /* Reserved, must be zero */
98 };
99
100
101 struct acpi_common_facs          /* Common FACS for internal use */
102 {
103         u32                             *global_lock;
104         u64                             *firmware_waking_vector;
105         u8                              vector_width;
106 };
107
108
109 #define ACPI_TABLE_HEADER_DEF   /* ACPI common table header */ \
110         char                            signature[4];           /* ASCII table signature */\
111         u32                             length;                 /* Length of table in bytes, including this header */\
112         u8                              revision;               /* ACPI Specification minor version # */\
113         u8                              checksum;               /* To make sum of entire table == 0 */\
114         char                            oem_id[6];              /* ASCII OEM identification */\
115         char                            oem_table_id[8];        /* ASCII OEM table identification */\
116         u32                             oem_revision;           /* OEM revision number */\
117         char                            asl_compiler_id [4];    /* ASCII ASL compiler vendor ID */\
118         u32                             asl_compiler_revision;  /* ASL compiler version */
119
120
121 struct acpi_table_header         /* ACPI common table header */
122 {
123         ACPI_TABLE_HEADER_DEF
124 };
125
126
127 /*
128  * MADT values and structures
129  */
130
131 /* Values for MADT PCATCompat */
132
133 #define DUAL_PIC                0
134 #define MULTIPLE_APIC           1
135
136 /* Master MADT */
137
138 struct multiple_apic_table
139 {
140         ACPI_TABLE_HEADER_DEF                           /* ACPI common table header */
141         u32                             local_apic_address;     /* Physical address of local APIC */
142
143         /* Flags (32 bits) */
144
145         u8                              PCATcompat      : 1;    /* 00:    System also has dual 8259s */
146         u8                                              : 7;    /* 01-07: Reserved, must be zero */
147         u8                              reserved1[3];           /* 08-31: Reserved, must be zero */
148 };
149
150 /* Values for Type in APIC_HEADER_DEF */
151
152 #define APIC_PROCESSOR          0
153 #define APIC_IO                 1
154 #define APIC_XRUPT_OVERRIDE     2
155 #define APIC_NMI                3
156 #define APIC_LOCAL_NMI          4
157 #define APIC_ADDRESS_OVERRIDE   5
158 #define APIC_IO_SAPIC           6
159 #define APIC_LOCAL_SAPIC        7
160 #define APIC_XRUPT_SOURCE       8
161 #define APIC_RESERVED           9           /* 9 and greater are reserved */
162
163 /*
164  * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
165  */
166 #define APIC_HEADER_DEF                     /* Common APIC sub-structure header */\
167         u8                              type; \
168         u8                              length;
169
170 struct apic_header
171 {
172         APIC_HEADER_DEF
173 };
174
175 /* Values for MPS INTI flags */
176
177 #define POLARITY_CONFORMS       0
178 #define POLARITY_ACTIVE_HIGH    1
179 #define POLARITY_RESERVED       2
180 #define POLARITY_ACTIVE_LOW     3
181
182 #define TRIGGER_CONFORMS        0
183 #define TRIGGER_EDGE            1
184 #define TRIGGER_RESERVED        2
185 #define TRIGGER_LEVEL           3
186
187 /* Common flag definitions (16 bits each) */
188
189 #define MPS_INTI_FLAGS \
190         u8                              polarity        : 2;    /* 00-01: Polarity of APIC I/O input signals */\
191         u8                              trigger_mode    : 2;    /* 02-03: Trigger mode of APIC input signals */\
192         u8                                              : 4;    /* 04-07: Reserved, must be zero */\
193         u8                              reserved1;              /* 08-15: Reserved, must be zero */
194
195 #define LOCAL_APIC_FLAGS \
196         u8                              processor_enabled: 1;   /* 00:    Processor is usable if set */\
197         u8                                              : 7;    /* 01-07: Reserved, must be zero */\
198         u8                              reserved2;              /* 08-15: Reserved, must be zero */
199
200 /* Sub-structures for MADT */
201
202 struct madt_processor_apic
203 {
204         APIC_HEADER_DEF
205         u8                              processor_id;           /* ACPI processor id */
206         u8                              local_apic_id;          /* Processor's local APIC id */
207         LOCAL_APIC_FLAGS
208 };
209
210 struct madt_io_apic
211 {
212         APIC_HEADER_DEF
213         u8                              io_apic_id;             /* I/O APIC ID */
214         u8                              reserved;               /* Reserved - must be zero */
215         u32                             address;                /* APIC physical address */
216         u32                             interrupt;              /* Global system interrupt where INTI
217                           * lines start */
218 };
219
220 struct madt_interrupt_override
221 {
222         APIC_HEADER_DEF
223         u8                              bus;                    /* 0 - ISA */
224         u8                              source;                 /* Interrupt source (IRQ) */
225         u32                             interrupt;              /* Global system interrupt */
226         MPS_INTI_FLAGS
227 };
228
229 struct madt_nmi_source
230 {
231         APIC_HEADER_DEF
232         MPS_INTI_FLAGS
233         u32                             interrupt;              /* Global system interrupt */
234 };
235
236 struct madt_local_apic_nmi
237 {
238         APIC_HEADER_DEF
239         u8                              processor_id;           /* ACPI processor id */
240         MPS_INTI_FLAGS
241         u8                              lint;                   /* LINTn to which NMI is connected */
242 };
243
244 struct madt_address_override
245 {
246         APIC_HEADER_DEF
247         u16                             reserved;               /* Reserved, must be zero */
248         u64                             address;                /* APIC physical address */
249 };
250
251 struct madt_io_sapic
252 {
253         APIC_HEADER_DEF
254         u8                              io_sapic_id;            /* I/O SAPIC ID */
255         u8                              reserved;               /* Reserved, must be zero */
256         u32                             interrupt_base;         /* Glocal interrupt for SAPIC start */
257         u64                             address;                /* SAPIC physical address */
258 };
259
260 struct madt_local_sapic
261 {
262         APIC_HEADER_DEF
263         u8                              processor_id;           /* ACPI processor id */
264         u8                              local_sapic_id;         /* SAPIC ID */
265         u8                              local_sapic_eid;        /* SAPIC EID */
266         u8                              reserved[3];            /* Reserved, must be zero */
267         LOCAL_APIC_FLAGS
268         u32                             processor_uID;          /* Numeric UID - ACPI 3.0 */
269         char                            processor_uIDstring[1]; /* String UID  - ACPI 3.0 */
270 };
271
272 struct madt_interrupt_source
273 {
274         APIC_HEADER_DEF
275         MPS_INTI_FLAGS
276         u8                              interrupt_type;         /* 1=PMI, 2=INIT, 3=corrected */
277         u8                              processor_id;           /* Processor ID */
278         u8                              processor_eid;          /* Processor EID */
279         u8                              io_sapic_vector;        /* Vector value for PMI interrupts */
280         u32                             interrupt;              /* Global system interrupt */
281         u32                             flags;                  /* Interrupt Source Flags */
282 };
283
284
285 /*
286  * Smart Battery
287  */
288 struct smart_battery_table
289 {
290         ACPI_TABLE_HEADER_DEF
291         u32                             warning_level;
292         u32                             low_level;
293         u32                             critical_level;
294 };
295
296
297 #pragma pack()
298
299
300 /*
301  * ACPI Table information.  We save the table address, length,
302  * and type of memory allocation (mapped or allocated) for each
303  * table for 1) when we exit, and 2) if a new table is installed
304  */
305 #define ACPI_MEM_NOT_ALLOCATED  0
306 #define ACPI_MEM_ALLOCATED      1
307 #define ACPI_MEM_MAPPED         2
308
309 /* Definitions for the Flags bitfield member of struct acpi_table_support */
310
311 #define ACPI_TABLE_SINGLE       0x00
312 #define ACPI_TABLE_MULTIPLE     0x01
313 #define ACPI_TABLE_EXECUTABLE   0x02
314
315 #define ACPI_TABLE_ROOT         0x00
316 #define ACPI_TABLE_PRIMARY      0x10
317 #define ACPI_TABLE_SECONDARY    0x20
318 #define ACPI_TABLE_ALL          0x30
319 #define ACPI_TABLE_TYPE_MASK    0x30
320
321 /* Data about each known table type */
322
323 struct acpi_table_support
324 {
325         char                            *name;
326         char                            *signature;
327         void                            **global_ptr;
328         u8                              sig_length;
329         u8                              flags;
330 };
331
332
333 /*
334  * Get the ACPI version-specific tables
335  */
336 #include "actbl1.h"   /* Acpi 1.0 table definitions */
337 #include "actbl2.h"   /* Acpi 2.0 table definitions */
338
339 extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1,
340                             * needed for certain workarounds */
341
342 #pragma pack(1)
343 /*
344  * High performance timer
345  */
346 struct hpet_table
347 {
348         ACPI_TABLE_HEADER_DEF
349         u32                             hardware_id;
350         struct acpi_generic_address     base_address;
351         u8                              hpet_number;
352         u16                             clock_tick;
353         u8                              attributes;
354 };
355
356 #pragma pack()
357
358 #endif /* __ACTBL_H__ */