acpi_table.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Helpers for ACPI table generation
  4. *
  5. * Based on acpi.c from coreboot
  6. *
  7. * Copyright 2019 Google LLC
  8. *
  9. * Copyright (C) 2015, Saket Sinha <saket.sinha89@gmail.com>
  10. * Copyright (C) 2016, Bin Meng <bmeng.cn@gmail.com>
  11. */
  12. #ifndef __ACPI_TABLE_H__
  13. #define __ACPI_TABLE_H__
  14. #include <linux/bitops.h>
  15. #define RSDP_SIG "RSD PTR " /* RSDP pointer signature */
  16. #define OEM_ID "U-BOOT" /* U-Boot */
  17. #define OEM_TABLE_ID "U-BOOTBL" /* U-Boot Table */
  18. #define ASLC_ID "INTL" /* Intel ASL Compiler */
  19. /* TODO(sjg@chromium.org): Figure out how to get compiler revision */
  20. #define ASL_REVISION 0
  21. #define ACPI_RSDP_REV_ACPI_1_0 0
  22. #define ACPI_RSDP_REV_ACPI_2_0 2
  23. #if !defined(__ACPI__)
  24. struct acpi_ctx;
  25. /*
  26. * RSDP (Root System Description Pointer)
  27. * Note: ACPI 1.0 didn't have length, xsdt_address, and ext_checksum
  28. */
  29. struct acpi_rsdp {
  30. char signature[8]; /* RSDP signature */
  31. u8 checksum; /* Checksum of the first 20 bytes */
  32. char oem_id[6]; /* OEM ID */
  33. u8 revision; /* 0 for ACPI 1.0, others 2 */
  34. u32 rsdt_address; /* Physical address of RSDT (32 bits) */
  35. u32 length; /* Total RSDP length (incl. extended part) */
  36. u64 xsdt_address; /* Physical address of XSDT (64 bits) */
  37. u8 ext_checksum; /* Checksum of the whole table */
  38. u8 reserved[3];
  39. };
  40. /* Generic ACPI header, provided by (almost) all tables */
  41. struct __packed acpi_table_header {
  42. char signature[4]; /* ACPI signature (4 ASCII characters) */
  43. u32 length; /* Table length in bytes (incl. header) */
  44. u8 revision; /* Table version (not ACPI version!) */
  45. volatile u8 checksum; /* To make sum of entire table == 0 */
  46. char oem_id[6]; /* OEM identification */
  47. char oem_table_id[8]; /* OEM table identification */
  48. u32 oem_revision; /* OEM revision number */
  49. char aslc_id[4]; /* ASL compiler vendor ID */
  50. u32 aslc_revision; /* ASL compiler revision number */
  51. };
  52. struct acpi_gen_regaddr {
  53. u8 space_id; /* Address space ID */
  54. u8 bit_width; /* Register size in bits */
  55. u8 bit_offset; /* Register bit offset */
  56. u8 access_size; /* Access size */
  57. u32 addrl; /* Register address, low 32 bits */
  58. u32 addrh; /* Register address, high 32 bits */
  59. };
  60. /* A maximum number of 32 ACPI tables ought to be enough for now */
  61. #define MAX_ACPI_TABLES 32
  62. /* RSDT (Root System Description Table) */
  63. struct acpi_rsdt {
  64. struct acpi_table_header header;
  65. u32 entry[MAX_ACPI_TABLES];
  66. };
  67. /* XSDT (Extended System Description Table) */
  68. struct acpi_xsdt {
  69. struct acpi_table_header header;
  70. u64 entry[MAX_ACPI_TABLES];
  71. };
  72. /* HPET timers */
  73. struct __packed acpi_hpet {
  74. struct acpi_table_header header;
  75. u32 id;
  76. struct acpi_gen_regaddr addr;
  77. u8 number;
  78. u16 min_tick;
  79. u8 attributes;
  80. };
  81. struct __packed acpi_tpm2 {
  82. struct acpi_table_header header;
  83. u16 platform_class;
  84. u8 reserved[2];
  85. u64 control_area;
  86. u32 start_method;
  87. u8 msp[12];
  88. u32 laml;
  89. u64 lasa;
  90. };
  91. struct __packed acpi_tcpa {
  92. struct acpi_table_header header;
  93. u16 platform_class;
  94. u32 laml;
  95. u64 lasa;
  96. };
  97. /* FADT Preferred Power Management Profile */
  98. enum acpi_pm_profile {
  99. ACPI_PM_UNSPECIFIED = 0,
  100. ACPI_PM_DESKTOP,
  101. ACPI_PM_MOBILE,
  102. ACPI_PM_WORKSTATION,
  103. ACPI_PM_ENTERPRISE_SERVER,
  104. ACPI_PM_SOHO_SERVER,
  105. ACPI_PM_APPLIANCE_PC,
  106. ACPI_PM_PERFORMANCE_SERVER,
  107. ACPI_PM_TABLET
  108. };
  109. /* FADT flags for p_lvl2_lat and p_lvl3_lat */
  110. #define ACPI_FADT_C2_NOT_SUPPORTED 101
  111. #define ACPI_FADT_C3_NOT_SUPPORTED 1001
  112. /* FADT Boot Architecture Flags */
  113. #define ACPI_FADT_LEGACY_FREE 0x00
  114. #define ACPI_FADT_LEGACY_DEVICES BIT(0)
  115. #define ACPI_FADT_8042 BIT(1)
  116. #define ACPI_FADT_VGA_NOT_PRESENT BIT(2)
  117. #define ACPI_FADT_MSI_NOT_SUPPORTED BIT(3)
  118. #define ACPI_FADT_NO_PCIE_ASPM_CONTROL BIT(4)
  119. /* FADT Feature Flags */
  120. #define ACPI_FADT_WBINVD BIT(0)
  121. #define ACPI_FADT_WBINVD_FLUSH BIT(1)
  122. #define ACPI_FADT_C1_SUPPORTED BIT(2)
  123. #define ACPI_FADT_C2_MP_SUPPORTED BIT(3)
  124. #define ACPI_FADT_POWER_BUTTON BIT(4)
  125. #define ACPI_FADT_SLEEP_BUTTON BIT(5)
  126. #define ACPI_FADT_FIXED_RTC BIT(6)
  127. #define ACPI_FADT_S4_RTC_WAKE BIT(7)
  128. #define ACPI_FADT_32BIT_TIMER BIT(8)
  129. #define ACPI_FADT_DOCKING_SUPPORTED BIT(9)
  130. #define ACPI_FADT_RESET_REGISTER BIT(10)
  131. #define ACPI_FADT_SEALED_CASE BIT(11)
  132. #define ACPI_FADT_HEADLESS BIT(12)
  133. #define ACPI_FADT_SLEEP_TYPE BIT(13)
  134. #define ACPI_FADT_PCI_EXPRESS_WAKE BIT(14)
  135. #define ACPI_FADT_PLATFORM_CLOCK BIT(15)
  136. #define ACPI_FADT_S4_RTC_VALID BIT(16)
  137. #define ACPI_FADT_REMOTE_POWER_ON BIT(17)
  138. #define ACPI_FADT_APIC_CLUSTER BIT(18)
  139. #define ACPI_FADT_APIC_PHYSICAL BIT(19)
  140. #define ACPI_FADT_HW_REDUCED_ACPI BIT(20)
  141. #define ACPI_FADT_LOW_PWR_IDLE_S0 BIT(21)
  142. enum acpi_address_space_type {
  143. ACPI_ADDRESS_SPACE_MEMORY = 0, /* System memory */
  144. ACPI_ADDRESS_SPACE_IO, /* System I/O */
  145. ACPI_ADDRESS_SPACE_PCI, /* PCI config space */
  146. ACPI_ADDRESS_SPACE_EC, /* Embedded controller */
  147. ACPI_ADDRESS_SPACE_SMBUS, /* SMBus */
  148. ACPI_ADDRESS_SPACE_PCC = 0x0a, /* Platform Comm. Channel */
  149. ACPI_ADDRESS_SPACE_FIXED = 0x7f /* Functional fixed hardware */
  150. };
  151. enum acpi_address_space_size {
  152. ACPI_ACCESS_SIZE_UNDEFINED = 0,
  153. ACPI_ACCESS_SIZE_BYTE_ACCESS,
  154. ACPI_ACCESS_SIZE_WORD_ACCESS,
  155. ACPI_ACCESS_SIZE_DWORD_ACCESS,
  156. ACPI_ACCESS_SIZE_QWORD_ACCESS
  157. };
  158. /* FADT (Fixed ACPI Description Table) */
  159. struct __packed acpi_fadt {
  160. struct acpi_table_header header;
  161. u32 firmware_ctrl;
  162. u32 dsdt;
  163. u8 res1;
  164. u8 preferred_pm_profile;
  165. u16 sci_int;
  166. u32 smi_cmd;
  167. u8 acpi_enable;
  168. u8 acpi_disable;
  169. u8 s4bios_req;
  170. u8 pstate_cnt;
  171. u32 pm1a_evt_blk;
  172. u32 pm1b_evt_blk;
  173. u32 pm1a_cnt_blk;
  174. u32 pm1b_cnt_blk;
  175. u32 pm2_cnt_blk;
  176. u32 pm_tmr_blk;
  177. u32 gpe0_blk;
  178. u32 gpe1_blk;
  179. u8 pm1_evt_len;
  180. u8 pm1_cnt_len;
  181. u8 pm2_cnt_len;
  182. u8 pm_tmr_len;
  183. u8 gpe0_blk_len;
  184. u8 gpe1_blk_len;
  185. u8 gpe1_base;
  186. u8 cst_cnt;
  187. u16 p_lvl2_lat;
  188. u16 p_lvl3_lat;
  189. u16 flush_size;
  190. u16 flush_stride;
  191. u8 duty_offset;
  192. u8 duty_width;
  193. u8 day_alrm;
  194. u8 mon_alrm;
  195. u8 century;
  196. u16 iapc_boot_arch;
  197. u8 res2;
  198. u32 flags;
  199. struct acpi_gen_regaddr reset_reg;
  200. u8 reset_value;
  201. u16 arm_boot_arch;
  202. u8 minor_revision;
  203. u32 x_firmware_ctl_l;
  204. u32 x_firmware_ctl_h;
  205. u32 x_dsdt_l;
  206. u32 x_dsdt_h;
  207. struct acpi_gen_regaddr x_pm1a_evt_blk;
  208. struct acpi_gen_regaddr x_pm1b_evt_blk;
  209. struct acpi_gen_regaddr x_pm1a_cnt_blk;
  210. struct acpi_gen_regaddr x_pm1b_cnt_blk;
  211. struct acpi_gen_regaddr x_pm2_cnt_blk;
  212. struct acpi_gen_regaddr x_pm_tmr_blk;
  213. struct acpi_gen_regaddr x_gpe0_blk;
  214. struct acpi_gen_regaddr x_gpe1_blk;
  215. };
  216. /* FADT TABLE Revision values - note these do not match the ACPI revision */
  217. #define ACPI_FADT_REV_ACPI_1_0 1
  218. #define ACPI_FADT_REV_ACPI_2_0 3
  219. #define ACPI_FADT_REV_ACPI_3_0 4
  220. #define ACPI_FADT_REV_ACPI_4_0 4
  221. #define ACPI_FADT_REV_ACPI_5_0 5
  222. #define ACPI_FADT_REV_ACPI_6_0 6
  223. /* MADT TABLE Revision values - note these do not match the ACPI revision */
  224. #define ACPI_MADT_REV_ACPI_3_0 2
  225. #define ACPI_MADT_REV_ACPI_4_0 3
  226. #define ACPI_MADT_REV_ACPI_5_0 3
  227. #define ACPI_MADT_REV_ACPI_6_0 5
  228. #define ACPI_MCFG_REV_ACPI_3_0 1
  229. /* IVRS Revision Field */
  230. #define IVRS_FORMAT_FIXED 0x01 /* Type 10h & 11h only */
  231. #define IVRS_FORMAT_MIXED 0x02 /* Type 10h, 11h, & 40h */
  232. /* FACS flags */
  233. #define ACPI_FACS_S4BIOS_F BIT(0)
  234. #define ACPI_FACS_64BIT_WAKE_F BIT(1)
  235. /* FACS (Firmware ACPI Control Structure) */
  236. struct acpi_facs {
  237. char signature[4]; /* "FACS" */
  238. u32 length; /* Length in bytes (>= 64) */
  239. u32 hardware_signature; /* Hardware signature */
  240. u32 firmware_waking_vector; /* Firmware waking vector */
  241. u32 global_lock; /* Global lock */
  242. u32 flags; /* FACS flags */
  243. u32 x_firmware_waking_vector_l; /* X FW waking vector, low */
  244. u32 x_firmware_waking_vector_h; /* X FW waking vector, high */
  245. u8 version; /* Version 2 */
  246. u8 res1[3];
  247. u32 ospm_flags; /* OSPM enabled flags */
  248. u8 res2[24];
  249. };
  250. /* MADT flags */
  251. #define ACPI_MADT_PCAT_COMPAT BIT(0)
  252. /* MADT (Multiple APIC Description Table) */
  253. struct acpi_madt {
  254. struct acpi_table_header header;
  255. u32 lapic_addr; /* Local APIC address */
  256. u32 flags; /* Multiple APIC flags */
  257. };
  258. /* MADT: APIC Structure Type*/
  259. enum acpi_apic_types {
  260. ACPI_APIC_LAPIC = 0, /* Processor local APIC */
  261. ACPI_APIC_IOAPIC, /* I/O APIC */
  262. ACPI_APIC_IRQ_SRC_OVERRIDE, /* Interrupt source override */
  263. ACPI_APIC_NMI_SRC, /* NMI source */
  264. ACPI_APIC_LAPIC_NMI, /* Local APIC NMI */
  265. ACPI_APIC_LAPIC_ADDR_OVERRIDE, /* Local APIC address override */
  266. ACPI_APIC_IOSAPIC, /* I/O SAPIC */
  267. ACPI_APIC_LSAPIC, /* Local SAPIC */
  268. ACPI_APIC_PLATFORM_IRQ_SRC, /* Platform interrupt sources */
  269. ACPI_APIC_LX2APIC, /* Processor local x2APIC */
  270. ACPI_APIC_LX2APIC_NMI, /* Local x2APIC NMI */
  271. };
  272. /* MADT: Processor Local APIC Structure */
  273. #define LOCAL_APIC_FLAG_ENABLED BIT(0)
  274. struct acpi_madt_lapic {
  275. u8 type; /* Type (0) */
  276. u8 length; /* Length in bytes (8) */
  277. u8 processor_id; /* ACPI processor ID */
  278. u8 apic_id; /* Local APIC ID */
  279. u32 flags; /* Local APIC flags */
  280. };
  281. /* MADT: I/O APIC Structure */
  282. struct acpi_madt_ioapic {
  283. u8 type; /* Type (1) */
  284. u8 length; /* Length in bytes (12) */
  285. u8 ioapic_id; /* I/O APIC ID */
  286. u8 reserved;
  287. u32 ioapic_addr; /* I/O APIC address */
  288. u32 gsi_base; /* Global system interrupt base */
  289. };
  290. /* MADT: Interrupt Source Override Structure */
  291. struct __packed acpi_madt_irqoverride {
  292. u8 type; /* Type (2) */
  293. u8 length; /* Length in bytes (10) */
  294. u8 bus; /* ISA (0) */
  295. u8 source; /* Bus-relative int. source (IRQ) */
  296. u32 gsirq; /* Global system interrupt */
  297. u16 flags; /* MPS INTI flags */
  298. };
  299. /* MADT: Local APIC NMI Structure */
  300. struct __packed acpi_madt_lapic_nmi {
  301. u8 type; /* Type (4) */
  302. u8 length; /* Length in bytes (6) */
  303. u8 processor_id; /* ACPI processor ID */
  304. u16 flags; /* MPS INTI flags */
  305. u8 lint; /* Local APIC LINT# */
  306. };
  307. /* MCFG (PCI Express MMIO config space BAR description table) */
  308. struct acpi_mcfg {
  309. struct acpi_table_header header;
  310. u8 reserved[8];
  311. };
  312. struct acpi_mcfg_mmconfig {
  313. u32 base_address_l;
  314. u32 base_address_h;
  315. u16 pci_segment_group_number;
  316. u8 start_bus_number;
  317. u8 end_bus_number;
  318. u8 reserved[4];
  319. };
  320. /* PM1_CNT bit defines */
  321. #define PM1_CNT_SCI_EN BIT(0)
  322. /* ACPI global NVS structure */
  323. struct acpi_global_nvs;
  324. /* CSRT (Core System Resource Table) */
  325. struct acpi_csrt {
  326. struct acpi_table_header header;
  327. };
  328. struct acpi_csrt_group {
  329. u32 length;
  330. u32 vendor_id;
  331. u32 subvendor_id;
  332. u16 device_id;
  333. u16 subdevice_id;
  334. u16 revision;
  335. u16 reserved;
  336. u32 shared_info_length;
  337. };
  338. struct acpi_csrt_shared_info {
  339. u16 major_version;
  340. u16 minor_version;
  341. u32 mmio_base_low;
  342. u32 mmio_base_high;
  343. u32 gsi_interrupt;
  344. u8 interrupt_polarity;
  345. u8 interrupt_mode;
  346. u8 num_channels;
  347. u8 dma_address_width;
  348. u16 base_request_line;
  349. u16 num_handshake_signals;
  350. u32 max_block_size;
  351. };
  352. /* Port types for ACPI _UPC object */
  353. enum acpi_upc_type {
  354. UPC_TYPE_A,
  355. UPC_TYPE_MINI_AB,
  356. UPC_TYPE_EXPRESSCARD,
  357. UPC_TYPE_USB3_A,
  358. UPC_TYPE_USB3_B,
  359. UPC_TYPE_USB3_MICRO_B,
  360. UPC_TYPE_USB3_MICRO_AB,
  361. UPC_TYPE_USB3_POWER_B,
  362. UPC_TYPE_C_USB2_ONLY,
  363. UPC_TYPE_C_USB2_SS_SWITCH,
  364. UPC_TYPE_C_USB2_SS,
  365. UPC_TYPE_PROPRIETARY = 0xff,
  366. /*
  367. * The following types are not directly defined in the ACPI
  368. * spec but are used by coreboot to identify a USB device type.
  369. */
  370. UPC_TYPE_INTERNAL = 0xff,
  371. UPC_TYPE_UNUSED,
  372. UPC_TYPE_HUB
  373. };
  374. enum dev_scope_type {
  375. SCOPE_PCI_ENDPOINT = 1,
  376. SCOPE_PCI_SUB = 2,
  377. SCOPE_IOAPIC = 3,
  378. SCOPE_MSI_HPET = 4,
  379. SCOPE_ACPI_NAMESPACE_DEVICE = 5
  380. };
  381. struct __packed dev_scope {
  382. u8 type;
  383. u8 length;
  384. u8 reserved[2];
  385. u8 enumeration;
  386. u8 start_bus;
  387. struct {
  388. u8 dev;
  389. u8 fn;
  390. } __packed path[0];
  391. };
  392. enum dmar_type {
  393. DMAR_DRHD = 0,
  394. DMAR_RMRR = 1,
  395. DMAR_ATSR = 2,
  396. DMAR_RHSA = 3,
  397. DMAR_ANDD = 4
  398. };
  399. enum {
  400. DRHD_INCLUDE_PCI_ALL = BIT(0)
  401. };
  402. enum dmar_flags {
  403. DMAR_INTR_REMAP = BIT(0),
  404. DMAR_X2APIC_OPT_OUT = BIT(1),
  405. DMAR_CTRL_PLATFORM_OPT_IN_FLAG = BIT(2),
  406. };
  407. struct dmar_entry {
  408. u16 type;
  409. u16 length;
  410. u8 flags;
  411. u8 reserved;
  412. u16 segment;
  413. u64 bar;
  414. };
  415. struct dmar_rmrr_entry {
  416. u16 type;
  417. u16 length;
  418. u16 reserved;
  419. u16 segment;
  420. u64 bar;
  421. u64 limit;
  422. };
  423. /* DMAR (DMA Remapping Reporting Structure) */
  424. struct __packed acpi_dmar {
  425. struct acpi_table_header header;
  426. u8 host_address_width;
  427. u8 flags;
  428. u8 reserved[10];
  429. struct dmar_entry structure[0];
  430. };
  431. /* DBG2 definitions are partially used for SPCR interface_type */
  432. /* Types for port_type field */
  433. #define ACPI_DBG2_SERIAL_PORT 0x8000
  434. #define ACPI_DBG2_1394_PORT 0x8001
  435. #define ACPI_DBG2_USB_PORT 0x8002
  436. #define ACPI_DBG2_NET_PORT 0x8003
  437. /* Subtypes for port_subtype field */
  438. #define ACPI_DBG2_16550_COMPATIBLE 0x0000
  439. #define ACPI_DBG2_16550_SUBSET 0x0001
  440. #define ACPI_DBG2_ARM_PL011 0x0003
  441. #define ACPI_DBG2_ARM_SBSA_32BIT 0x000D
  442. #define ACPI_DBG2_ARM_SBSA_GENERIC 0x000E
  443. #define ACPI_DBG2_ARM_DCC 0x000F
  444. #define ACPI_DBG2_BCM2835 0x0010
  445. #define ACPI_DBG2_1394_STANDARD 0x0000
  446. #define ACPI_DBG2_USB_XHCI 0x0000
  447. #define ACPI_DBG2_USB_EHCI 0x0001
  448. #define ACPI_DBG2_UNKNOWN 0x00FF
  449. /* DBG2: Microsoft Debug Port Table 2 header */
  450. struct __packed acpi_dbg2_header {
  451. struct acpi_table_header header;
  452. u32 devices_offset;
  453. u32 devices_count;
  454. };
  455. /* DBG2: Microsoft Debug Port Table 2 device entry */
  456. struct __packed acpi_dbg2_device {
  457. u8 revision;
  458. u16 length;
  459. u8 address_count;
  460. u16 namespace_string_length;
  461. u16 namespace_string_offset;
  462. u16 oem_data_length;
  463. u16 oem_data_offset;
  464. u16 port_type;
  465. u16 port_subtype;
  466. u8 reserved[2];
  467. u16 base_address_offset;
  468. u16 address_size_offset;
  469. };
  470. /* SPCR (Serial Port Console Redirection table) */
  471. struct __packed acpi_spcr {
  472. struct acpi_table_header header;
  473. u8 interface_type;
  474. u8 reserved[3];
  475. struct acpi_gen_regaddr serial_port;
  476. u8 interrupt_type;
  477. u8 pc_interrupt;
  478. u32 interrupt; /* Global system interrupt */
  479. u8 baud_rate;
  480. u8 parity;
  481. u8 stop_bits;
  482. u8 flow_control;
  483. u8 terminal_type;
  484. u8 reserved1;
  485. u16 pci_device_id; /* Must be 0xffff if not PCI device */
  486. u16 pci_vendor_id; /* Must be 0xffff if not PCI device */
  487. u8 pci_bus;
  488. u8 pci_device;
  489. u8 pci_function;
  490. u32 pci_flags;
  491. u8 pci_segment;
  492. u32 reserved2;
  493. };
  494. /* Tables defined/reserved by ACPI and generated by U-Boot */
  495. enum acpi_tables {
  496. ACPITAB_BERT,
  497. ACPITAB_DBG2,
  498. ACPITAB_DMAR,
  499. ACPITAB_DSDT,
  500. ACPITAB_ECDT,
  501. ACPITAB_FACS,
  502. ACPITAB_FADT,
  503. ACPITAB_HEST,
  504. ACPITAB_HPET,
  505. ACPITAB_IVRS,
  506. ACPITAB_MADT,
  507. ACPITAB_MCFG,
  508. ACPITAB_NHLT,
  509. ACPITAB_RSDP,
  510. ACPITAB_RSDT,
  511. ACPITAB_SLIT,
  512. ACPITAB_SPCR,
  513. ACPITAB_SPMI,
  514. ACPITAB_SRAT,
  515. ACPITAB_SSDT,
  516. ACPITAB_TCPA,
  517. ACPITAB_TPM2,
  518. ACPITAB_VFCT,
  519. ACPITAB_XSDT,
  520. ACPITAB_COUNT,
  521. };
  522. /**
  523. * acpi_get_table_revision() - Get the revision number generated for a table
  524. *
  525. * This keeps the version-number information in one place
  526. *
  527. * @table: ACPI table to check
  528. * @return version number that U-Boot generates
  529. */
  530. int acpi_get_table_revision(enum acpi_tables table);
  531. /**
  532. * acpi_create_dmar() - Create a DMA Remapping Reporting (DMAR) table
  533. *
  534. * @dmar: Place to put the table
  535. * @flags: DMAR flags to use
  536. * @return 0 if OK, -ve on error
  537. */
  538. int acpi_create_dmar(struct acpi_dmar *dmar, enum dmar_flags flags);
  539. /**
  540. * acpi_create_dbg2() - Create a DBG2 table
  541. *
  542. * This table describes how to access the debug UART
  543. *
  544. * @dbg2: Place to put information
  545. * @port_type: Serial port type (see ACPI_DBG2_...)
  546. * @port_subtype: Serial port sub-type (see ACPI_DBG2_...)
  547. * @address: ACPI address of port
  548. * @address_size: Size of address space
  549. * @device_path: Path of device (created using acpi_device_path())
  550. */
  551. void acpi_create_dbg2(struct acpi_dbg2_header *dbg2,
  552. int port_type, int port_subtype,
  553. struct acpi_gen_regaddr *address, uint32_t address_size,
  554. const char *device_path);
  555. /**
  556. * acpi_fill_header() - Set up a new table header
  557. *
  558. * This sets all fields except length, revision, checksum and aslc_revision
  559. *
  560. * @header: ACPI header to update
  561. * @signature: Table signature to use (4 characters)
  562. */
  563. void acpi_fill_header(struct acpi_table_header *header, char *signature);
  564. /**
  565. * acpi_align() - Align the ACPI output pointer to a 16-byte boundary
  566. *
  567. * @ctx: ACPI context
  568. */
  569. void acpi_align(struct acpi_ctx *ctx);
  570. /**
  571. * acpi_align64() - Align the ACPI output pointer to a 64-byte boundary
  572. *
  573. * @ctx: ACPI context
  574. */
  575. void acpi_align64(struct acpi_ctx *ctx);
  576. /**
  577. * acpi_inc() - Increment the ACPI output pointer by a bit
  578. *
  579. * The pointer is NOT aligned afterwards.
  580. *
  581. * @ctx: ACPI context
  582. * @amount: Amount to increment by
  583. */
  584. void acpi_inc(struct acpi_ctx *ctx, uint amount);
  585. /**
  586. * acpi_inc_align() - Increment the ACPI output pointer by a bit and align
  587. *
  588. * The pointer is aligned afterwards to a 16-byte boundary
  589. *
  590. * @ctx: ACPI context
  591. * @amount: Amount to increment by
  592. */
  593. void acpi_inc_align(struct acpi_ctx *ctx, uint amount);
  594. /**
  595. * acpi_add_table() - Add a new table to the RSDP and XSDT
  596. *
  597. * @ctx: ACPI context
  598. * @table: Table to add
  599. * @return 0 if OK, -E2BIG if too many tables
  600. */
  601. int acpi_add_table(struct acpi_ctx *ctx, void *table);
  602. /**
  603. * acpi_setup_base_tables() - Set up context along with RSDP, RSDT and XSDT
  604. *
  605. * Set up the context with the given start position. Some basic tables are
  606. * always needed, so set them up as well.
  607. *
  608. * @ctx: Context to set up
  609. */
  610. void acpi_setup_base_tables(struct acpi_ctx *ctx, void *start);
  611. #endif /* !__ACPI__*/
  612. #include <asm/acpi_table.h>
  613. #endif /* __ACPI_TABLE_H__ */