actbl.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. /******************************************************************************
  2. *
  3. * Name: actbl.h - Basic ACPI Table Definitions
  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. * Values for description table header signatures. Useful because they make
  46. * it more difficult to inadvertently type in the wrong signature.
  47. */
  48. #define DSDT_SIG "DSDT" /* Differentiated System Description Table */
  49. #define FADT_SIG "FACP" /* Fixed ACPI Description Table */
  50. #define FACS_SIG "FACS" /* Firmware ACPI Control Structure */
  51. #define PSDT_SIG "PSDT" /* Persistent System Description Table */
  52. #define RSDP_SIG "RSD PTR " /* Root System Description Pointer */
  53. #define RSDT_SIG "RSDT" /* Root System Description Table */
  54. #define XSDT_SIG "XSDT" /* Extended System Description Table */
  55. #define SSDT_SIG "SSDT" /* Secondary System Description Table */
  56. #define RSDP_NAME "RSDP"
  57. /*
  58. * All tables and structures must be byte-packed to match the ACPI
  59. * specification, since the tables are provided by the system BIOS
  60. */
  61. #pragma pack(1)
  62. /*
  63. * These are the ACPI tables that are directly consumed by the subsystem.
  64. *
  65. * The RSDP and FACS do not use the common ACPI table header. All other ACPI
  66. * tables use the header.
  67. *
  68. * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
  69. * This is the only type that is even remotely portable. Anything else is not
  70. * portable, so do not use any other bitfield types.
  71. */
  72. /*******************************************************************************
  73. *
  74. * ACPI Table Header. This common header is used by all tables except the
  75. * RSDP and FACS. The define is used for direct inclusion of header into
  76. * other ACPI tables
  77. *
  78. ******************************************************************************/
  79. #define ACPI_TABLE_HEADER_DEF \
  80. char signature[4]; /* ASCII table signature */\
  81. u32 length; /* Length of table in bytes, including this header */\
  82. u8 revision; /* ACPI Specification minor version # */\
  83. u8 checksum; /* To make sum of entire table == 0 */\
  84. char oem_id[6]; /* ASCII OEM identification */\
  85. char oem_table_id[8]; /* ASCII OEM table identification */\
  86. u32 oem_revision; /* OEM revision number */\
  87. char asl_compiler_id[4]; /* ASCII ASL compiler vendor ID */\
  88. u32 asl_compiler_revision; /* ASL compiler version */
  89. struct acpi_table_header {
  90. ACPI_TABLE_HEADER_DEF};
  91. /*
  92. * GAS - Generic Address Structure (ACPI 2.0+)
  93. */
  94. struct acpi_generic_address {
  95. u8 address_space_id; /* Address space where struct or register exists */
  96. u8 register_bit_width; /* Size in bits of given register */
  97. u8 register_bit_offset; /* Bit offset within the register */
  98. u8 access_width; /* Minimum Access size (ACPI 3.0) */
  99. u64 address; /* 64-bit address of struct or register */
  100. };
  101. /*******************************************************************************
  102. *
  103. * RSDP - Root System Description Pointer (Signature is "RSD PTR ")
  104. *
  105. ******************************************************************************/
  106. struct rsdp_descriptor {
  107. char signature[8]; /* ACPI signature, contains "RSD PTR " */
  108. u8 checksum; /* ACPI 1.0 checksum */
  109. char oem_id[6]; /* OEM identification */
  110. u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
  111. u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */
  112. u32 length; /* Table length in bytes, including header (ACPI 2.0+) */
  113. u64 xsdt_physical_address; /* 64-bit physical address of the XSDT (ACPI 2.0+) */
  114. u8 extended_checksum; /* Checksum of entire table (ACPI 2.0+) */
  115. u8 reserved[3]; /* Reserved, must be zero */
  116. };
  117. #define ACPI_RSDP_REV0_SIZE 20 /* Size of original ACPI 1.0 RSDP */
  118. /*******************************************************************************
  119. *
  120. * RSDT/XSDT - Root System Description Tables
  121. *
  122. ******************************************************************************/
  123. struct rsdt_descriptor {
  124. ACPI_TABLE_HEADER_DEF u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */
  125. };
  126. struct xsdt_descriptor {
  127. ACPI_TABLE_HEADER_DEF u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */
  128. };
  129. /*******************************************************************************
  130. *
  131. * FACS - Firmware ACPI Control Structure (FACS)
  132. *
  133. ******************************************************************************/
  134. struct facs_descriptor {
  135. char signature[4]; /* ASCII table signature */
  136. u32 length; /* Length of structure, in bytes */
  137. u32 hardware_signature; /* Hardware configuration signature */
  138. u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector */
  139. u32 global_lock; /* Global Lock for shared hardware resources */
  140. /* Flags (32 bits) */
  141. u8 S4bios_f:1; /* 00: S4BIOS support is present */
  142. u8:7; /* 01-07: Reserved, must be zero */
  143. u8 reserved1[3]; /* 08-31: Reserved, must be zero */
  144. u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */
  145. u8 version; /* Version of this table (ACPI 2.0+) */
  146. u8 reserved[31]; /* Reserved, must be zero */
  147. };
  148. #define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */
  149. #define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */
  150. /*
  151. * Common FACS - This is a version-independent FACS structure used for internal use only
  152. */
  153. struct acpi_common_facs {
  154. u32 *global_lock;
  155. u64 *firmware_waking_vector;
  156. u8 vector_width;
  157. };
  158. /*******************************************************************************
  159. *
  160. * FADT - Fixed ACPI Description Table (Signature "FACP")
  161. *
  162. ******************************************************************************/
  163. /* Fields common to all versions of the FADT */
  164. #define ACPI_FADT_COMMON \
  165. ACPI_TABLE_HEADER_DEF \
  166. u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \
  167. u32 V1_dsdt; /* 32-bit physical address of DSDT */ \
  168. u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \
  169. u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \
  170. u16 sci_int; /* System vector of SCI interrupt */ \
  171. u32 smi_cmd; /* Port address of SMI command port */ \
  172. u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \
  173. u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \
  174. u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \
  175. u8 pstate_cnt; /* Processor performance state control*/ \
  176. u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a Event Reg Blk */ \
  177. u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b Event Reg Blk */ \
  178. u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \
  179. u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \
  180. u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \
  181. u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \
  182. u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \
  183. u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \
  184. u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */ \
  185. u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */ \
  186. u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \
  187. u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \
  188. u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \
  189. u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \
  190. u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ \
  191. u8 cst_cnt; /* Support for the _CST object and C States change notification.*/ \
  192. u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \
  193. u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \
  194. u16 flush_size; /* Processor's memory cache line width, in bytes */ \
  195. u16 flush_stride; /* Number of flush strides that need to be read */ \
  196. u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \
  197. u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \
  198. u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \
  199. u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \
  200. u8 century; /* Index to century in RTC CMOS RAM */ \
  201. u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ \
  202. u8 reserved2; /* Reserved, must be zero */
  203. /*
  204. * ACPI 2.0+ FADT
  205. */
  206. struct fadt_descriptor {
  207. ACPI_FADT_COMMON
  208. /* Flags (32 bits) */
  209. u8 wb_invd:1; /* 00: The wbinvd instruction works properly */
  210. u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */
  211. u8 proc_c1:1; /* 02: All processors support C1 state */
  212. u8 plvl2_up:1; /* 03: C2 state works on MP system */
  213. u8 pwr_button:1; /* 04: Power button is handled as a generic feature */
  214. u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */
  215. u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */
  216. u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */
  217. u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */
  218. u8 dock_cap:1; /* 09: Docking supported */
  219. u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */
  220. u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */
  221. u8 headless:1; /* 12: No local video capabilities or local input devices */
  222. u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */
  223. u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
  224. u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
  225. u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
  226. u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */
  227. u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */
  228. u8 force_apic_physical_destination_mode:1; /* 19: All local x_aPICs must use physical dest mode (ACPI 3.0) */
  229. u8:4; /* 20-23: Reserved, must be zero */
  230. u8 reserved3; /* 24-31: Reserved, must be zero */
  231. struct acpi_generic_address reset_register; /* Reset register address in GAS format */
  232. u8 reset_value; /* Value to write to the reset_register port to reset the system */
  233. u8 reserved4[3]; /* These three bytes must be zero */
  234. u64 xfirmware_ctrl; /* 64-bit physical address of FACS */
  235. u64 Xdsdt; /* 64-bit physical address of DSDT */
  236. struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */
  237. struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */
  238. struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */
  239. struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */
  240. struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */
  241. struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */
  242. struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */
  243. struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */
  244. };
  245. /*
  246. * "Down-revved" ACPI 2.0 FADT descriptor
  247. * Defined here to allow compiler to generate the length of the struct
  248. */
  249. struct fadt_descriptor_rev2_minus {
  250. ACPI_FADT_COMMON u32 flags;
  251. struct acpi_generic_address reset_register; /* Reset register address in GAS format */
  252. u8 reset_value; /* Value to write to the reset_register port to reset the system. */
  253. u8 reserved7[3]; /* Reserved, must be zero */
  254. };
  255. /*
  256. * ACPI 1.0 FADT
  257. * Defined here to allow compiler to generate the length of the struct
  258. */
  259. struct fadt_descriptor_rev1 {
  260. ACPI_FADT_COMMON u32 flags;
  261. };
  262. /* FADT: Prefered Power Management Profiles */
  263. #define PM_UNSPECIFIED 0
  264. #define PM_DESKTOP 1
  265. #define PM_MOBILE 2
  266. #define PM_WORKSTATION 3
  267. #define PM_ENTERPRISE_SERVER 4
  268. #define PM_SOHO_SERVER 5
  269. #define PM_APPLIANCE_PC 6
  270. /* FADT: Boot Arch Flags */
  271. #define BAF_LEGACY_DEVICES 0x0001
  272. #define BAF_8042_KEYBOARD_CONTROLLER 0x0002
  273. #define FADT2_REVISION_ID 3
  274. #define FADT2_MINUS_REVISION_ID 2
  275. /* Reset to default packing */
  276. #pragma pack()
  277. /*
  278. * This macro is temporary until the table bitfield flag definitions
  279. * are removed and replaced by a Flags field.
  280. */
  281. #define ACPI_FLAG_OFFSET(d,f,o) (u8) (ACPI_OFFSET (d,f) + \
  282. sizeof(((d *)0)->f) + o)
  283. /*
  284. * Get the remaining ACPI tables
  285. */
  286. #include "actbl1.h"
  287. /*
  288. * ACPI Table information. We save the table address, length,
  289. * and type of memory allocation (mapped or allocated) for each
  290. * table for 1) when we exit, and 2) if a new table is installed
  291. */
  292. #define ACPI_MEM_NOT_ALLOCATED 0
  293. #define ACPI_MEM_ALLOCATED 1
  294. #define ACPI_MEM_MAPPED 2
  295. /* Definitions for the Flags bitfield member of struct acpi_table_support */
  296. #define ACPI_TABLE_SINGLE 0x00
  297. #define ACPI_TABLE_MULTIPLE 0x01
  298. #define ACPI_TABLE_EXECUTABLE 0x02
  299. #define ACPI_TABLE_ROOT 0x00
  300. #define ACPI_TABLE_PRIMARY 0x10
  301. #define ACPI_TABLE_SECONDARY 0x20
  302. #define ACPI_TABLE_ALL 0x30
  303. #define ACPI_TABLE_TYPE_MASK 0x30
  304. /* Data about each known table type */
  305. struct acpi_table_support {
  306. char *name;
  307. char *signature;
  308. void **global_ptr;
  309. u8 sig_length;
  310. u8 flags;
  311. };
  312. extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1,
  313. * needed for certain workarounds */
  314. /* Macros used to generate offsets to specific table fields */
  315. #define ACPI_FACS_OFFSET(f) (u8) ACPI_OFFSET (struct facs_descriptor,f)
  316. #define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct fadt_descriptor, f)
  317. #define ACPI_GAS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_generic_address,f)
  318. #define ACPI_HDR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_header,f)
  319. #define ACPI_RSDP_OFFSET(f) (u8) ACPI_OFFSET (struct rsdp_descriptor,f)
  320. #define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct fadt_descriptor,f,o)
  321. #define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct facs_descriptor,f,o)
  322. #endif /* __ACTBL_H__ */