actbl.h 13 KB

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