actbl.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. /******************************************************************************
  2. *
  3. * Name: actbl.h - Table data structures defined in ACPI specification
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2006, R. Byron Moore
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions, and the following disclaimer,
  15. * without modification.
  16. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  17. * substantially similar to the "NO WARRANTY" disclaimer below
  18. * ("Disclaimer") and any redistribution must be conditioned upon
  19. * including a substantially similar Disclaimer requirement for further
  20. * binary redistribution.
  21. * 3. Neither the names of the above-listed copyright holders nor the names
  22. * of any contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * Alternatively, this software may be distributed under the terms of the
  26. * GNU General Public License ("GPL") version 2 as published by the Free
  27. * Software Foundation.
  28. *
  29. * NO WARRANTY
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  31. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  32. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  33. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  34. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  36. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  38. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  39. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGES.
  41. */
  42. #ifndef __ACTBL_H__
  43. #define __ACTBL_H__
  44. /*
  45. * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
  46. * This is the only type that is even remotely portable. Anything else is not
  47. * portable, so do not use any other bitfield types.
  48. */
  49. /*
  50. * Values for description table header signatures
  51. */
  52. #define RSDP_NAME "RSDP"
  53. #define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */
  54. #define APIC_SIG "APIC" /* Multiple APIC Description Table */
  55. #define DSDT_SIG "DSDT" /* Differentiated System Description Table */
  56. #define FADT_SIG "FACP" /* Fixed ACPI Description Table */
  57. #define FACS_SIG "FACS" /* Firmware ACPI Control Structure */
  58. #define PSDT_SIG "PSDT" /* Persistent System Description Table */
  59. #define RSDT_SIG "RSDT" /* Root System Description Table */
  60. #define XSDT_SIG "XSDT" /* Extended System Description Table */
  61. #define SSDT_SIG "SSDT" /* Secondary System Description Table */
  62. #define SBST_SIG "SBST" /* Smart Battery Specification Table */
  63. #define SPIC_SIG "SPIC" /* IOSAPIC table */
  64. #define BOOT_SIG "BOOT" /* Boot table */
  65. #define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */
  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. #pragma pack(1)
  75. /*
  76. * ACPI Version-independent tables
  77. *
  78. * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.)
  79. * are in separate files.
  80. */
  81. struct rsdp_descriptor { /* Root System Descriptor Pointer */
  82. char signature[8]; /* ACPI signature, contains "RSD PTR " */
  83. u8 checksum; /* ACPI 1.0 checksum */
  84. char oem_id[6]; /* OEM identification */
  85. u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
  86. u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */
  87. u32 length; /* XSDT Length in bytes, including header */
  88. u64 xsdt_physical_address; /* 64-bit physical address of the XSDT */
  89. u8 extended_checksum; /* Checksum of entire table (ACPI 2.0) */
  90. char reserved[3]; /* Reserved, must be zero */
  91. };
  92. struct acpi_common_facs { /* Common FACS for internal use */
  93. u32 *global_lock;
  94. u64 *firmware_waking_vector;
  95. u8 vector_width;
  96. };
  97. #define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \
  98. char signature[4]; /* ASCII table signature */\
  99. u32 length; /* Length of table in bytes, including this header */\
  100. u8 revision; /* ACPI Specification minor version # */\
  101. u8 checksum; /* To make sum of entire table == 0 */\
  102. char oem_id[6]; /* ASCII OEM identification */\
  103. char oem_table_id[8]; /* ASCII OEM table identification */\
  104. u32 oem_revision; /* OEM revision number */\
  105. char asl_compiler_id [4]; /* ASCII ASL compiler vendor ID */\
  106. u32 asl_compiler_revision; /* ASL compiler version */
  107. struct acpi_table_header { /* ACPI common table header */
  108. ACPI_TABLE_HEADER_DEF};
  109. /*
  110. * MADT values and structures
  111. */
  112. /* Values for MADT PCATCompat */
  113. #define DUAL_PIC 0
  114. #define MULTIPLE_APIC 1
  115. /* Master MADT */
  116. struct multiple_apic_table {
  117. ACPI_TABLE_HEADER_DEF /* ACPI common table header */
  118. u32 local_apic_address; /* Physical address of local APIC */
  119. /* Flags (32 bits) */
  120. u8 PCATcompat:1; /* 00: System also has dual 8259s */
  121. u8:7; /* 01-07: Reserved, must be zero */
  122. u8 reserved1[3]; /* 08-31: Reserved, must be zero */
  123. };
  124. /* Values for Type in APIC_HEADER_DEF */
  125. #define APIC_PROCESSOR 0
  126. #define APIC_IO 1
  127. #define APIC_XRUPT_OVERRIDE 2
  128. #define APIC_NMI 3
  129. #define APIC_LOCAL_NMI 4
  130. #define APIC_ADDRESS_OVERRIDE 5
  131. #define APIC_IO_SAPIC 6
  132. #define APIC_LOCAL_SAPIC 7
  133. #define APIC_XRUPT_SOURCE 8
  134. #define APIC_RESERVED 9 /* 9 and greater are reserved */
  135. /*
  136. * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
  137. */
  138. #define APIC_HEADER_DEF /* Common APIC sub-structure header */\
  139. u8 type; \
  140. u8 length;
  141. struct apic_header {
  142. APIC_HEADER_DEF};
  143. /* Values for MPS INTI flags */
  144. #define POLARITY_CONFORMS 0
  145. #define POLARITY_ACTIVE_HIGH 1
  146. #define POLARITY_RESERVED 2
  147. #define POLARITY_ACTIVE_LOW 3
  148. #define TRIGGER_CONFORMS 0
  149. #define TRIGGER_EDGE 1
  150. #define TRIGGER_RESERVED 2
  151. #define TRIGGER_LEVEL 3
  152. /* Common flag definitions (16 bits each) */
  153. #define MPS_INTI_FLAGS \
  154. u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\
  155. u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\
  156. u8 : 4; /* 04-07: Reserved, must be zero */\
  157. u8 reserved1; /* 08-15: Reserved, must be zero */
  158. #define LOCAL_APIC_FLAGS \
  159. u8 processor_enabled: 1; /* 00: Processor is usable if set */\
  160. u8 : 7; /* 01-07: Reserved, must be zero */\
  161. u8 reserved2; /* 08-15: Reserved, must be zero */
  162. /* Sub-structures for MADT */
  163. struct madt_processor_apic {
  164. APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
  165. u8 local_apic_id; /* Processor's local APIC id */
  166. LOCAL_APIC_FLAGS};
  167. struct madt_io_apic {
  168. APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */
  169. u8 reserved; /* Reserved - must be zero */
  170. u32 address; /* APIC physical address */
  171. u32 interrupt; /* Global system interrupt where INTI
  172. * lines start */
  173. };
  174. struct madt_interrupt_override {
  175. APIC_HEADER_DEF u8 bus; /* 0 - ISA */
  176. u8 source; /* Interrupt source (IRQ) */
  177. u32 interrupt; /* Global system interrupt */
  178. MPS_INTI_FLAGS};
  179. struct madt_nmi_source {
  180. APIC_HEADER_DEF MPS_INTI_FLAGS u32 interrupt; /* Global system interrupt */
  181. };
  182. struct madt_local_apic_nmi {
  183. APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
  184. MPS_INTI_FLAGS u8 lint; /* LINTn to which NMI is connected */
  185. };
  186. struct madt_address_override {
  187. APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */
  188. u64 address; /* APIC physical address */
  189. };
  190. struct madt_io_sapic {
  191. APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */
  192. u8 reserved; /* Reserved, must be zero */
  193. u32 interrupt_base; /* Glocal interrupt for SAPIC start */
  194. u64 address; /* SAPIC physical address */
  195. };
  196. struct madt_local_sapic {
  197. APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */
  198. u8 local_sapic_id; /* SAPIC ID */
  199. u8 local_sapic_eid; /* SAPIC EID */
  200. u8 reserved[3]; /* Reserved, must be zero */
  201. LOCAL_APIC_FLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */
  202. char processor_uIDstring[1]; /* String UID - ACPI 3.0 */
  203. };
  204. struct madt_interrupt_source {
  205. APIC_HEADER_DEF MPS_INTI_FLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */
  206. u8 processor_id; /* Processor ID */
  207. u8 processor_eid; /* Processor EID */
  208. u8 io_sapic_vector; /* Vector value for PMI interrupts */
  209. u32 interrupt; /* Global system interrupt */
  210. u32 flags; /* Interrupt Source Flags */
  211. };
  212. /*
  213. * Smart Battery
  214. */
  215. struct smart_battery_table {
  216. ACPI_TABLE_HEADER_DEF u32 warning_level;
  217. u32 low_level;
  218. u32 critical_level;
  219. };
  220. #pragma pack()
  221. /*
  222. * ACPI Table information. We save the table address, length,
  223. * and type of memory allocation (mapped or allocated) for each
  224. * table for 1) when we exit, and 2) if a new table is installed
  225. */
  226. #define ACPI_MEM_NOT_ALLOCATED 0
  227. #define ACPI_MEM_ALLOCATED 1
  228. #define ACPI_MEM_MAPPED 2
  229. /* Definitions for the Flags bitfield member of struct acpi_table_support */
  230. #define ACPI_TABLE_SINGLE 0x00
  231. #define ACPI_TABLE_MULTIPLE 0x01
  232. #define ACPI_TABLE_EXECUTABLE 0x02
  233. #define ACPI_TABLE_ROOT 0x00
  234. #define ACPI_TABLE_PRIMARY 0x10
  235. #define ACPI_TABLE_SECONDARY 0x20
  236. #define ACPI_TABLE_ALL 0x30
  237. #define ACPI_TABLE_TYPE_MASK 0x30
  238. /* Data about each known table type */
  239. struct acpi_table_support {
  240. char *name;
  241. char *signature;
  242. void **global_ptr;
  243. u8 sig_length;
  244. u8 flags;
  245. };
  246. /*
  247. * Get the ACPI version-specific tables
  248. */
  249. #include "actbl1.h" /* Acpi 1.0 table definitions */
  250. #include "actbl2.h" /* Acpi 2.0 table definitions */
  251. extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1,
  252. * needed for certain workarounds */
  253. #pragma pack(1)
  254. /*
  255. * High performance timer
  256. */
  257. struct hpet_table {
  258. ACPI_TABLE_HEADER_DEF u32 hardware_id;
  259. struct acpi_generic_address base_address;
  260. u8 hpet_number;
  261. u16 clock_tick;
  262. u8 attributes;
  263. };
  264. #pragma pack()
  265. #endif /* __ACTBL_H__ */