actbl2.h 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729
  1. /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
  2. /******************************************************************************
  3. *
  4. * Name: actbl2.h - ACPI Table Definitions (tables not in ACPI spec)
  5. *
  6. * Copyright (C) 2000 - 2018, Intel Corp.
  7. *
  8. *****************************************************************************/
  9. #ifndef __ACTBL2_H__
  10. #define __ACTBL2_H__
  11. /*******************************************************************************
  12. *
  13. * Additional ACPI Tables (2)
  14. *
  15. * These tables are not consumed directly by the ACPICA subsystem, but are
  16. * included here to support device drivers and the AML disassembler.
  17. *
  18. ******************************************************************************/
  19. /*
  20. * Values for description table header signatures for tables defined in this
  21. * file. Useful because they make it more difficult to inadvertently type in
  22. * the wrong signature.
  23. */
  24. #define ACPI_SIG_IORT "IORT" /* IO Remapping Table */
  25. #define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */
  26. #define ACPI_SIG_LPIT "LPIT" /* Low Power Idle Table */
  27. #define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */
  28. #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
  29. #define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */
  30. #define ACPI_SIG_MPST "MPST" /* Memory Power State Table */
  31. #define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */
  32. #define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */
  33. #define ACPI_SIG_MTMR "MTMR" /* MID Timer table */
  34. #define ACPI_SIG_NFIT "NFIT" /* NVDIMM Firmware Interface Table */
  35. #define ACPI_SIG_PCCT "PCCT" /* Platform Communications Channel Table */
  36. #define ACPI_SIG_PDTT "PDTT" /* Platform Debug Trigger Table */
  37. #define ACPI_SIG_PMTT "PMTT" /* Platform Memory Topology Table */
  38. #define ACPI_SIG_PPTT "PPTT" /* Processor Properties Topology Table */
  39. #define ACPI_SIG_RASF "RASF" /* RAS Feature table */
  40. #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */
  41. #define ACPI_SIG_SDEI "SDEI" /* Software Delegated Exception Interface Table */
  42. #define ACPI_SIG_SDEV "SDEV" /* Secure Devices table */
  43. /*
  44. * All tables must be byte-packed to match the ACPI specification, since
  45. * the tables are provided by the system BIOS.
  46. */
  47. #pragma pack(1)
  48. /*
  49. * Note: C bitfields are not used for this reason:
  50. *
  51. * "Bitfields are great and easy to read, but unfortunately the C language
  52. * does not specify the layout of bitfields in memory, which means they are
  53. * essentially useless for dealing with packed data in on-disk formats or
  54. * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
  55. * this decision was a design error in C. Ritchie could have picked an order
  56. * and stuck with it." Norman Ramsey.
  57. * See http://stackoverflow.com/a/1053662/41661
  58. */
  59. /*******************************************************************************
  60. *
  61. * IORT - IO Remapping Table
  62. *
  63. * Conforms to "IO Remapping Table System Software on ARM Platforms",
  64. * Document number: ARM DEN 0049D, March 2018
  65. *
  66. ******************************************************************************/
  67. struct acpi_table_iort {
  68. struct acpi_table_header header;
  69. u32 node_count;
  70. u32 node_offset;
  71. u32 reserved;
  72. };
  73. /*
  74. * IORT subtables
  75. */
  76. struct acpi_iort_node {
  77. u8 type;
  78. u16 length;
  79. u8 revision;
  80. u32 reserved;
  81. u32 mapping_count;
  82. u32 mapping_offset;
  83. char node_data[1];
  84. };
  85. /* Values for subtable Type above */
  86. enum acpi_iort_node_type {
  87. ACPI_IORT_NODE_ITS_GROUP = 0x00,
  88. ACPI_IORT_NODE_NAMED_COMPONENT = 0x01,
  89. ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02,
  90. ACPI_IORT_NODE_SMMU = 0x03,
  91. ACPI_IORT_NODE_SMMU_V3 = 0x04,
  92. ACPI_IORT_NODE_PMCG = 0x05
  93. };
  94. struct acpi_iort_id_mapping {
  95. u32 input_base; /* Lowest value in input range */
  96. u32 id_count; /* Number of IDs */
  97. u32 output_base; /* Lowest value in output range */
  98. u32 output_reference; /* A reference to the output node */
  99. u32 flags;
  100. };
  101. /* Masks for Flags field above for IORT subtable */
  102. #define ACPI_IORT_ID_SINGLE_MAPPING (1)
  103. struct acpi_iort_memory_access {
  104. u32 cache_coherency;
  105. u8 hints;
  106. u16 reserved;
  107. u8 memory_flags;
  108. };
  109. /* Values for cache_coherency field above */
  110. #define ACPI_IORT_NODE_COHERENT 0x00000001 /* The device node is fully coherent */
  111. #define ACPI_IORT_NODE_NOT_COHERENT 0x00000000 /* The device node is not coherent */
  112. /* Masks for Hints field above */
  113. #define ACPI_IORT_HT_TRANSIENT (1)
  114. #define ACPI_IORT_HT_WRITE (1<<1)
  115. #define ACPI_IORT_HT_READ (1<<2)
  116. #define ACPI_IORT_HT_OVERRIDE (1<<3)
  117. /* Masks for memory_flags field above */
  118. #define ACPI_IORT_MF_COHERENCY (1)
  119. #define ACPI_IORT_MF_ATTRIBUTES (1<<1)
  120. /*
  121. * IORT node specific subtables
  122. */
  123. struct acpi_iort_its_group {
  124. u32 its_count;
  125. u32 identifiers[1]; /* GIC ITS identifier arrary */
  126. };
  127. struct acpi_iort_named_component {
  128. u32 node_flags;
  129. u64 memory_properties; /* Memory access properties */
  130. u8 memory_address_limit; /* Memory address size limit */
  131. char device_name[1]; /* Path of namespace object */
  132. };
  133. /* Masks for Flags field above */
  134. #define ACPI_IORT_NC_STALL_SUPPORTED (1)
  135. #define ACPI_IORT_NC_PASID_BITS (31<<1)
  136. struct acpi_iort_root_complex {
  137. u64 memory_properties; /* Memory access properties */
  138. u32 ats_attribute;
  139. u32 pci_segment_number;
  140. u8 memory_address_limit; /* Memory address size limit */
  141. u8 reserved[3]; /* Reserved, must be zero */
  142. };
  143. /* Values for ats_attribute field above */
  144. #define ACPI_IORT_ATS_SUPPORTED 0x00000001 /* The root complex supports ATS */
  145. #define ACPI_IORT_ATS_UNSUPPORTED 0x00000000 /* The root complex doesn't support ATS */
  146. struct acpi_iort_smmu {
  147. u64 base_address; /* SMMU base address */
  148. u64 span; /* Length of memory range */
  149. u32 model;
  150. u32 flags;
  151. u32 global_interrupt_offset;
  152. u32 context_interrupt_count;
  153. u32 context_interrupt_offset;
  154. u32 pmu_interrupt_count;
  155. u32 pmu_interrupt_offset;
  156. u64 interrupts[1]; /* Interrupt array */
  157. };
  158. /* Values for Model field above */
  159. #define ACPI_IORT_SMMU_V1 0x00000000 /* Generic SMMUv1 */
  160. #define ACPI_IORT_SMMU_V2 0x00000001 /* Generic SMMUv2 */
  161. #define ACPI_IORT_SMMU_CORELINK_MMU400 0x00000002 /* ARM Corelink MMU-400 */
  162. #define ACPI_IORT_SMMU_CORELINK_MMU500 0x00000003 /* ARM Corelink MMU-500 */
  163. #define ACPI_IORT_SMMU_CORELINK_MMU401 0x00000004 /* ARM Corelink MMU-401 */
  164. #define ACPI_IORT_SMMU_CAVIUM_THUNDERX 0x00000005 /* Cavium thunder_x SMMUv2 */
  165. /* Masks for Flags field above */
  166. #define ACPI_IORT_SMMU_DVM_SUPPORTED (1)
  167. #define ACPI_IORT_SMMU_COHERENT_WALK (1<<1)
  168. /* Global interrupt format */
  169. struct acpi_iort_smmu_gsi {
  170. u32 nsg_irpt;
  171. u32 nsg_irpt_flags;
  172. u32 nsg_cfg_irpt;
  173. u32 nsg_cfg_irpt_flags;
  174. };
  175. struct acpi_iort_smmu_v3 {
  176. u64 base_address; /* SMMUv3 base address */
  177. u32 flags;
  178. u32 reserved;
  179. u64 vatos_address;
  180. u32 model;
  181. u32 event_gsiv;
  182. u32 pri_gsiv;
  183. u32 gerr_gsiv;
  184. u32 sync_gsiv;
  185. u32 pxm;
  186. u32 id_mapping_index;
  187. };
  188. /* Values for Model field above */
  189. #define ACPI_IORT_SMMU_V3_GENERIC 0x00000000 /* Generic SMMUv3 */
  190. #define ACPI_IORT_SMMU_V3_HISILICON_HI161X 0x00000001 /* hi_silicon Hi161x SMMUv3 */
  191. #define ACPI_IORT_SMMU_V3_CAVIUM_CN99XX 0x00000002 /* Cavium CN99xx SMMUv3 */
  192. /* Masks for Flags field above */
  193. #define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE (1)
  194. #define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE (3<<1)
  195. #define ACPI_IORT_SMMU_V3_PXM_VALID (1<<3)
  196. struct acpi_iort_pmcg {
  197. u64 page0_base_address;
  198. u32 overflow_gsiv;
  199. u32 node_reference;
  200. u64 page1_base_address;
  201. };
  202. /*******************************************************************************
  203. *
  204. * IVRS - I/O Virtualization Reporting Structure
  205. * Version 1
  206. *
  207. * Conforms to "AMD I/O Virtualization Technology (IOMMU) Specification",
  208. * Revision 1.26, February 2009.
  209. *
  210. ******************************************************************************/
  211. struct acpi_table_ivrs {
  212. struct acpi_table_header header; /* Common ACPI table header */
  213. u32 info; /* Common virtualization info */
  214. u64 reserved;
  215. };
  216. /* Values for Info field above */
  217. #define ACPI_IVRS_PHYSICAL_SIZE 0x00007F00 /* 7 bits, physical address size */
  218. #define ACPI_IVRS_VIRTUAL_SIZE 0x003F8000 /* 7 bits, virtual address size */
  219. #define ACPI_IVRS_ATS_RESERVED 0x00400000 /* ATS address translation range reserved */
  220. /* IVRS subtable header */
  221. struct acpi_ivrs_header {
  222. u8 type; /* Subtable type */
  223. u8 flags;
  224. u16 length; /* Subtable length */
  225. u16 device_id; /* ID of IOMMU */
  226. };
  227. /* Values for subtable Type above */
  228. enum acpi_ivrs_type {
  229. ACPI_IVRS_TYPE_HARDWARE = 0x10,
  230. ACPI_IVRS_TYPE_MEMORY1 = 0x20,
  231. ACPI_IVRS_TYPE_MEMORY2 = 0x21,
  232. ACPI_IVRS_TYPE_MEMORY3 = 0x22
  233. };
  234. /* Masks for Flags field above for IVHD subtable */
  235. #define ACPI_IVHD_TT_ENABLE (1)
  236. #define ACPI_IVHD_PASS_PW (1<<1)
  237. #define ACPI_IVHD_RES_PASS_PW (1<<2)
  238. #define ACPI_IVHD_ISOC (1<<3)
  239. #define ACPI_IVHD_IOTLB (1<<4)
  240. /* Masks for Flags field above for IVMD subtable */
  241. #define ACPI_IVMD_UNITY (1)
  242. #define ACPI_IVMD_READ (1<<1)
  243. #define ACPI_IVMD_WRITE (1<<2)
  244. #define ACPI_IVMD_EXCLUSION_RANGE (1<<3)
  245. /*
  246. * IVRS subtables, correspond to Type in struct acpi_ivrs_header
  247. */
  248. /* 0x10: I/O Virtualization Hardware Definition Block (IVHD) */
  249. struct acpi_ivrs_hardware {
  250. struct acpi_ivrs_header header;
  251. u16 capability_offset; /* Offset for IOMMU control fields */
  252. u64 base_address; /* IOMMU control registers */
  253. u16 pci_segment_group;
  254. u16 info; /* MSI number and unit ID */
  255. u32 reserved;
  256. };
  257. /* Masks for Info field above */
  258. #define ACPI_IVHD_MSI_NUMBER_MASK 0x001F /* 5 bits, MSI message number */
  259. #define ACPI_IVHD_UNIT_ID_MASK 0x1F00 /* 5 bits, unit_ID */
  260. /*
  261. * Device Entries for IVHD subtable, appear after struct acpi_ivrs_hardware structure.
  262. * Upper two bits of the Type field are the (encoded) length of the structure.
  263. * Currently, only 4 and 8 byte entries are defined. 16 and 32 byte entries
  264. * are reserved for future use but not defined.
  265. */
  266. struct acpi_ivrs_de_header {
  267. u8 type;
  268. u16 id;
  269. u8 data_setting;
  270. };
  271. /* Length of device entry is in the top two bits of Type field above */
  272. #define ACPI_IVHD_ENTRY_LENGTH 0xC0
  273. /* Values for device entry Type field above */
  274. enum acpi_ivrs_device_entry_type {
  275. /* 4-byte device entries, all use struct acpi_ivrs_device4 */
  276. ACPI_IVRS_TYPE_PAD4 = 0,
  277. ACPI_IVRS_TYPE_ALL = 1,
  278. ACPI_IVRS_TYPE_SELECT = 2,
  279. ACPI_IVRS_TYPE_START = 3,
  280. ACPI_IVRS_TYPE_END = 4,
  281. /* 8-byte device entries */
  282. ACPI_IVRS_TYPE_PAD8 = 64,
  283. ACPI_IVRS_TYPE_NOT_USED = 65,
  284. ACPI_IVRS_TYPE_ALIAS_SELECT = 66, /* Uses struct acpi_ivrs_device8a */
  285. ACPI_IVRS_TYPE_ALIAS_START = 67, /* Uses struct acpi_ivrs_device8a */
  286. ACPI_IVRS_TYPE_EXT_SELECT = 70, /* Uses struct acpi_ivrs_device8b */
  287. ACPI_IVRS_TYPE_EXT_START = 71, /* Uses struct acpi_ivrs_device8b */
  288. ACPI_IVRS_TYPE_SPECIAL = 72 /* Uses struct acpi_ivrs_device8c */
  289. };
  290. /* Values for Data field above */
  291. #define ACPI_IVHD_INIT_PASS (1)
  292. #define ACPI_IVHD_EINT_PASS (1<<1)
  293. #define ACPI_IVHD_NMI_PASS (1<<2)
  294. #define ACPI_IVHD_SYSTEM_MGMT (3<<4)
  295. #define ACPI_IVHD_LINT0_PASS (1<<6)
  296. #define ACPI_IVHD_LINT1_PASS (1<<7)
  297. /* Types 0-4: 4-byte device entry */
  298. struct acpi_ivrs_device4 {
  299. struct acpi_ivrs_de_header header;
  300. };
  301. /* Types 66-67: 8-byte device entry */
  302. struct acpi_ivrs_device8a {
  303. struct acpi_ivrs_de_header header;
  304. u8 reserved1;
  305. u16 used_id;
  306. u8 reserved2;
  307. };
  308. /* Types 70-71: 8-byte device entry */
  309. struct acpi_ivrs_device8b {
  310. struct acpi_ivrs_de_header header;
  311. u32 extended_data;
  312. };
  313. /* Values for extended_data above */
  314. #define ACPI_IVHD_ATS_DISABLED (1<<31)
  315. /* Type 72: 8-byte device entry */
  316. struct acpi_ivrs_device8c {
  317. struct acpi_ivrs_de_header header;
  318. u8 handle;
  319. u16 used_id;
  320. u8 variety;
  321. };
  322. /* Values for Variety field above */
  323. #define ACPI_IVHD_IOAPIC 1
  324. #define ACPI_IVHD_HPET 2
  325. /* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition Block (IVMD) */
  326. struct acpi_ivrs_memory {
  327. struct acpi_ivrs_header header;
  328. u16 aux_data;
  329. u64 reserved;
  330. u64 start_address;
  331. u64 memory_length;
  332. };
  333. /*******************************************************************************
  334. *
  335. * LPIT - Low Power Idle Table
  336. *
  337. * Conforms to "ACPI Low Power Idle Table (LPIT)" July 2014.
  338. *
  339. ******************************************************************************/
  340. struct acpi_table_lpit {
  341. struct acpi_table_header header; /* Common ACPI table header */
  342. };
  343. /* LPIT subtable header */
  344. struct acpi_lpit_header {
  345. u32 type; /* Subtable type */
  346. u32 length; /* Subtable length */
  347. u16 unique_id;
  348. u16 reserved;
  349. u32 flags;
  350. };
  351. /* Values for subtable Type above */
  352. enum acpi_lpit_type {
  353. ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00,
  354. ACPI_LPIT_TYPE_RESERVED = 0x01 /* 1 and above are reserved */
  355. };
  356. /* Masks for Flags field above */
  357. #define ACPI_LPIT_STATE_DISABLED (1)
  358. #define ACPI_LPIT_NO_COUNTER (1<<1)
  359. /*
  360. * LPIT subtables, correspond to Type in struct acpi_lpit_header
  361. */
  362. /* 0x00: Native C-state instruction based LPI structure */
  363. struct acpi_lpit_native {
  364. struct acpi_lpit_header header;
  365. struct acpi_generic_address entry_trigger;
  366. u32 residency;
  367. u32 latency;
  368. struct acpi_generic_address residency_counter;
  369. u64 counter_frequency;
  370. };
  371. /*******************************************************************************
  372. *
  373. * MADT - Multiple APIC Description Table
  374. * Version 3
  375. *
  376. ******************************************************************************/
  377. struct acpi_table_madt {
  378. struct acpi_table_header header; /* Common ACPI table header */
  379. u32 address; /* Physical address of local APIC */
  380. u32 flags;
  381. };
  382. /* Masks for Flags field above */
  383. #define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */
  384. /* Values for PCATCompat flag */
  385. #define ACPI_MADT_DUAL_PIC 1
  386. #define ACPI_MADT_MULTIPLE_APIC 0
  387. /* Values for MADT subtable type in struct acpi_subtable_header */
  388. enum acpi_madt_type {
  389. ACPI_MADT_TYPE_LOCAL_APIC = 0,
  390. ACPI_MADT_TYPE_IO_APIC = 1,
  391. ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2,
  392. ACPI_MADT_TYPE_NMI_SOURCE = 3,
  393. ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4,
  394. ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5,
  395. ACPI_MADT_TYPE_IO_SAPIC = 6,
  396. ACPI_MADT_TYPE_LOCAL_SAPIC = 7,
  397. ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
  398. ACPI_MADT_TYPE_LOCAL_X2APIC = 9,
  399. ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10,
  400. ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11,
  401. ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12,
  402. ACPI_MADT_TYPE_GENERIC_MSI_FRAME = 13,
  403. ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR = 14,
  404. ACPI_MADT_TYPE_GENERIC_TRANSLATOR = 15,
  405. ACPI_MADT_TYPE_RESERVED = 16,
  406. ACPI_MADT_TYPE_PHYTIUM_2500 = 128
  407. };
  408. /*
  409. * MADT Subtables, correspond to Type in struct acpi_subtable_header
  410. */
  411. /* 0: Processor Local APIC */
  412. struct acpi_madt_local_apic {
  413. struct acpi_subtable_header header;
  414. u8 processor_id; /* ACPI processor id */
  415. u8 id; /* Processor's local APIC id */
  416. u32 lapic_flags;
  417. };
  418. /* 1: IO APIC */
  419. struct acpi_madt_io_apic {
  420. struct acpi_subtable_header header;
  421. u8 id; /* I/O APIC ID */
  422. u8 reserved; /* reserved - must be zero */
  423. u32 address; /* APIC physical address */
  424. u32 global_irq_base; /* Global system interrupt where INTI lines start */
  425. };
  426. /* 2: Interrupt Override */
  427. struct acpi_madt_interrupt_override {
  428. struct acpi_subtable_header header;
  429. u8 bus; /* 0 - ISA */
  430. u8 source_irq; /* Interrupt source (IRQ) */
  431. u32 global_irq; /* Global system interrupt */
  432. u16 inti_flags;
  433. };
  434. /* 3: NMI Source */
  435. struct acpi_madt_nmi_source {
  436. struct acpi_subtable_header header;
  437. u16 inti_flags;
  438. u32 global_irq; /* Global system interrupt */
  439. };
  440. /* 4: Local APIC NMI */
  441. struct acpi_madt_local_apic_nmi {
  442. struct acpi_subtable_header header;
  443. u8 processor_id; /* ACPI processor id */
  444. u16 inti_flags;
  445. u8 lint; /* LINTn to which NMI is connected */
  446. };
  447. /* 5: Address Override */
  448. struct acpi_madt_local_apic_override {
  449. struct acpi_subtable_header header;
  450. u16 reserved; /* Reserved, must be zero */
  451. u64 address; /* APIC physical address */
  452. };
  453. /* 6: I/O Sapic */
  454. struct acpi_madt_io_sapic {
  455. struct acpi_subtable_header header;
  456. u8 id; /* I/O SAPIC ID */
  457. u8 reserved; /* Reserved, must be zero */
  458. u32 global_irq_base; /* Global interrupt for SAPIC start */
  459. u64 address; /* SAPIC physical address */
  460. };
  461. /* 7: Local Sapic */
  462. struct acpi_madt_local_sapic {
  463. struct acpi_subtable_header header;
  464. u8 processor_id; /* ACPI processor id */
  465. u8 id; /* SAPIC ID */
  466. u8 eid; /* SAPIC EID */
  467. u8 reserved[3]; /* Reserved, must be zero */
  468. u32 lapic_flags;
  469. u32 uid; /* Numeric UID - ACPI 3.0 */
  470. char uid_string[1]; /* String UID - ACPI 3.0 */
  471. };
  472. /* 8: Platform Interrupt Source */
  473. struct acpi_madt_interrupt_source {
  474. struct acpi_subtable_header header;
  475. u16 inti_flags;
  476. u8 type; /* 1=PMI, 2=INIT, 3=corrected */
  477. u8 id; /* Processor ID */
  478. u8 eid; /* Processor EID */
  479. u8 io_sapic_vector; /* Vector value for PMI interrupts */
  480. u32 global_irq; /* Global system interrupt */
  481. u32 flags; /* Interrupt Source Flags */
  482. };
  483. /* Masks for Flags field above */
  484. #define ACPI_MADT_CPEI_OVERRIDE (1)
  485. /* 9: Processor Local X2APIC (ACPI 4.0) */
  486. struct acpi_madt_local_x2apic {
  487. struct acpi_subtable_header header;
  488. u16 reserved; /* reserved - must be zero */
  489. u32 local_apic_id; /* Processor x2APIC ID */
  490. u32 lapic_flags;
  491. u32 uid; /* ACPI processor UID */
  492. };
  493. /* 10: Local X2APIC NMI (ACPI 4.0) */
  494. struct acpi_madt_local_x2apic_nmi {
  495. struct acpi_subtable_header header;
  496. u16 inti_flags;
  497. u32 uid; /* ACPI processor UID */
  498. u8 lint; /* LINTn to which NMI is connected */
  499. u8 reserved[3]; /* reserved - must be zero */
  500. };
  501. /* 11: Generic Interrupt (ACPI 5.0 + ACPI 6.0 changes) */
  502. struct acpi_madt_generic_interrupt {
  503. struct acpi_subtable_header header;
  504. u16 reserved; /* reserved - must be zero */
  505. u32 cpu_interface_number;
  506. u32 uid;
  507. u32 flags;
  508. u32 parking_version;
  509. u32 performance_interrupt;
  510. u64 parked_address;
  511. u64 base_address;
  512. u64 gicv_base_address;
  513. u64 gich_base_address;
  514. u32 vgic_interrupt;
  515. u64 gicr_base_address;
  516. u64 arm_mpidr;
  517. u8 efficiency_class;
  518. u8 reserved2[3];
  519. };
  520. /* Masks for Flags field above */
  521. /* ACPI_MADT_ENABLED (1) Processor is usable if set */
  522. #define ACPI_MADT_PERFORMANCE_IRQ_MODE (1<<1) /* 01: Performance Interrupt Mode */
  523. #define ACPI_MADT_VGIC_IRQ_MODE (1<<2) /* 02: VGIC Maintenance Interrupt mode */
  524. /* 12: Generic Distributor (ACPI 5.0 + ACPI 6.0 changes) */
  525. struct acpi_madt_generic_distributor {
  526. struct acpi_subtable_header header;
  527. u16 reserved; /* reserved - must be zero */
  528. u32 gic_id;
  529. u64 base_address;
  530. u32 global_irq_base;
  531. u8 version;
  532. u8 reserved2[3]; /* reserved - must be zero */
  533. };
  534. /* Values for Version field above */
  535. enum acpi_madt_gic_version {
  536. ACPI_MADT_GIC_VERSION_NONE = 0,
  537. ACPI_MADT_GIC_VERSION_V1 = 1,
  538. ACPI_MADT_GIC_VERSION_V2 = 2,
  539. ACPI_MADT_GIC_VERSION_V3 = 3,
  540. ACPI_MADT_GIC_VERSION_V4 = 4,
  541. ACPI_MADT_GIC_VERSION_RESERVED = 5 /* 5 and greater are reserved */
  542. };
  543. /* 13: Generic MSI Frame (ACPI 5.1) */
  544. struct acpi_madt_generic_msi_frame {
  545. struct acpi_subtable_header header;
  546. u16 reserved; /* reserved - must be zero */
  547. u32 msi_frame_id;
  548. u64 base_address;
  549. u32 flags;
  550. u16 spi_count;
  551. u16 spi_base;
  552. };
  553. /* Masks for Flags field above */
  554. #define ACPI_MADT_OVERRIDE_SPI_VALUES (1)
  555. /* 14: Generic Redistributor (ACPI 5.1) */
  556. struct acpi_madt_generic_redistributor {
  557. struct acpi_subtable_header header;
  558. u16 reserved; /* reserved - must be zero */
  559. u64 base_address;
  560. u32 length;
  561. };
  562. /* 15: Generic Translator (ACPI 6.0) */
  563. struct acpi_madt_generic_translator {
  564. struct acpi_subtable_header header;
  565. u16 reserved; /* reserved - must be zero */
  566. u32 translation_id;
  567. u64 base_address;
  568. u32 reserved2;
  569. };
  570. /*
  571. * Common flags fields for MADT subtables
  572. */
  573. /* MADT Local APIC flags */
  574. #define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */
  575. /* MADT MPS INTI flags (inti_flags) */
  576. #define ACPI_MADT_POLARITY_MASK (3) /* 00-01: Polarity of APIC I/O input signals */
  577. #define ACPI_MADT_TRIGGER_MASK (3<<2) /* 02-03: Trigger mode of APIC input signals */
  578. /* Values for MPS INTI flags */
  579. #define ACPI_MADT_POLARITY_CONFORMS 0
  580. #define ACPI_MADT_POLARITY_ACTIVE_HIGH 1
  581. #define ACPI_MADT_POLARITY_RESERVED 2
  582. #define ACPI_MADT_POLARITY_ACTIVE_LOW 3
  583. #define ACPI_MADT_TRIGGER_CONFORMS (0)
  584. #define ACPI_MADT_TRIGGER_EDGE (1<<2)
  585. #define ACPI_MADT_TRIGGER_RESERVED (2<<2)
  586. #define ACPI_MADT_TRIGGER_LEVEL (3<<2)
  587. /*******************************************************************************
  588. *
  589. * MCFG - PCI Memory Mapped Configuration table and subtable
  590. * Version 1
  591. *
  592. * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005
  593. *
  594. ******************************************************************************/
  595. struct acpi_table_mcfg {
  596. struct acpi_table_header header; /* Common ACPI table header */
  597. u8 reserved[8];
  598. };
  599. /* Subtable */
  600. struct acpi_mcfg_allocation {
  601. u64 address; /* Base address, processor-relative */
  602. u16 pci_segment; /* PCI segment group number */
  603. u8 start_bus_number; /* Starting PCI Bus number */
  604. u8 end_bus_number; /* Final PCI Bus number */
  605. u32 reserved;
  606. };
  607. /*******************************************************************************
  608. *
  609. * MCHI - Management Controller Host Interface Table
  610. * Version 1
  611. *
  612. * Conforms to "Management Component Transport Protocol (MCTP) Host
  613. * Interface Specification", Revision 1.0.0a, October 13, 2009
  614. *
  615. ******************************************************************************/
  616. struct acpi_table_mchi {
  617. struct acpi_table_header header; /* Common ACPI table header */
  618. u8 interface_type;
  619. u8 protocol;
  620. u64 protocol_data;
  621. u8 interrupt_type;
  622. u8 gpe;
  623. u8 pci_device_flag;
  624. u32 global_interrupt;
  625. struct acpi_generic_address control_register;
  626. u8 pci_segment;
  627. u8 pci_bus;
  628. u8 pci_device;
  629. u8 pci_function;
  630. };
  631. /*******************************************************************************
  632. *
  633. * MPST - Memory Power State Table (ACPI 5.0)
  634. * Version 1
  635. *
  636. ******************************************************************************/
  637. #define ACPI_MPST_CHANNEL_INFO \
  638. u8 channel_id; \
  639. u8 reserved1[3]; \
  640. u16 power_node_count; \
  641. u16 reserved2;
  642. /* Main table */
  643. struct acpi_table_mpst {
  644. struct acpi_table_header header; /* Common ACPI table header */
  645. ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */
  646. };
  647. /* Memory Platform Communication Channel Info */
  648. struct acpi_mpst_channel {
  649. ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */
  650. };
  651. /* Memory Power Node Structure */
  652. struct acpi_mpst_power_node {
  653. u8 flags;
  654. u8 reserved1;
  655. u16 node_id;
  656. u32 length;
  657. u64 range_address;
  658. u64 range_length;
  659. u32 num_power_states;
  660. u32 num_physical_components;
  661. };
  662. /* Values for Flags field above */
  663. #define ACPI_MPST_ENABLED 1
  664. #define ACPI_MPST_POWER_MANAGED 2
  665. #define ACPI_MPST_HOT_PLUG_CAPABLE 4
  666. /* Memory Power State Structure (follows POWER_NODE above) */
  667. struct acpi_mpst_power_state {
  668. u8 power_state;
  669. u8 info_index;
  670. };
  671. /* Physical Component ID Structure (follows POWER_STATE above) */
  672. struct acpi_mpst_component {
  673. u16 component_id;
  674. };
  675. /* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
  676. struct acpi_mpst_data_hdr {
  677. u16 characteristics_count;
  678. u16 reserved;
  679. };
  680. struct acpi_mpst_power_data {
  681. u8 structure_id;
  682. u8 flags;
  683. u16 reserved1;
  684. u32 average_power;
  685. u32 power_saving;
  686. u64 exit_latency;
  687. u64 reserved2;
  688. };
  689. /* Values for Flags field above */
  690. #define ACPI_MPST_PRESERVE 1
  691. #define ACPI_MPST_AUTOENTRY 2
  692. #define ACPI_MPST_AUTOEXIT 4
  693. /* Shared Memory Region (not part of an ACPI table) */
  694. struct acpi_mpst_shared {
  695. u32 signature;
  696. u16 pcc_command;
  697. u16 pcc_status;
  698. u32 command_register;
  699. u32 status_register;
  700. u32 power_state_id;
  701. u32 power_node_id;
  702. u64 energy_consumed;
  703. u64 average_power;
  704. };
  705. /*******************************************************************************
  706. *
  707. * MSCT - Maximum System Characteristics Table (ACPI 4.0)
  708. * Version 1
  709. *
  710. ******************************************************************************/
  711. struct acpi_table_msct {
  712. struct acpi_table_header header; /* Common ACPI table header */
  713. u32 proximity_offset; /* Location of proximity info struct(s) */
  714. u32 max_proximity_domains; /* Max number of proximity domains */
  715. u32 max_clock_domains; /* Max number of clock domains */
  716. u64 max_address; /* Max physical address in system */
  717. };
  718. /* subtable - Maximum Proximity Domain Information. Version 1 */
  719. struct acpi_msct_proximity {
  720. u8 revision;
  721. u8 length;
  722. u32 range_start; /* Start of domain range */
  723. u32 range_end; /* End of domain range */
  724. u32 processor_capacity;
  725. u64 memory_capacity; /* In bytes */
  726. };
  727. /*******************************************************************************
  728. *
  729. * MSDM - Microsoft Data Management table
  730. *
  731. * Conforms to "Microsoft Software Licensing Tables (SLIC and MSDM)",
  732. * November 29, 2011. Copyright 2011 Microsoft
  733. *
  734. ******************************************************************************/
  735. /* Basic MSDM table is only the common ACPI header */
  736. struct acpi_table_msdm {
  737. struct acpi_table_header header; /* Common ACPI table header */
  738. };
  739. /*******************************************************************************
  740. *
  741. * MTMR - MID Timer Table
  742. * Version 1
  743. *
  744. * Conforms to "Simple Firmware Interface Specification",
  745. * Draft 0.8.2, Oct 19, 2010
  746. * NOTE: The ACPI MTMR is equivalent to the SFI MTMR table.
  747. *
  748. ******************************************************************************/
  749. struct acpi_table_mtmr {
  750. struct acpi_table_header header; /* Common ACPI table header */
  751. };
  752. /* MTMR entry */
  753. struct acpi_mtmr_entry {
  754. struct acpi_generic_address physical_address;
  755. u32 frequency;
  756. u32 irq;
  757. };
  758. /*******************************************************************************
  759. *
  760. * NFIT - NVDIMM Interface Table (ACPI 6.0+)
  761. * Version 1
  762. *
  763. ******************************************************************************/
  764. struct acpi_table_nfit {
  765. struct acpi_table_header header; /* Common ACPI table header */
  766. u32 reserved; /* Reserved, must be zero */
  767. };
  768. /* Subtable header for NFIT */
  769. struct acpi_nfit_header {
  770. u16 type;
  771. u16 length;
  772. };
  773. /* Values for subtable type in struct acpi_nfit_header */
  774. enum acpi_nfit_type {
  775. ACPI_NFIT_TYPE_SYSTEM_ADDRESS = 0,
  776. ACPI_NFIT_TYPE_MEMORY_MAP = 1,
  777. ACPI_NFIT_TYPE_INTERLEAVE = 2,
  778. ACPI_NFIT_TYPE_SMBIOS = 3,
  779. ACPI_NFIT_TYPE_CONTROL_REGION = 4,
  780. ACPI_NFIT_TYPE_DATA_REGION = 5,
  781. ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6,
  782. ACPI_NFIT_TYPE_CAPABILITIES = 7,
  783. ACPI_NFIT_TYPE_RESERVED = 8 /* 8 and greater are reserved */
  784. };
  785. /*
  786. * NFIT Subtables
  787. */
  788. /* 0: System Physical Address Range Structure */
  789. struct acpi_nfit_system_address {
  790. struct acpi_nfit_header header;
  791. u16 range_index;
  792. u16 flags;
  793. u32 reserved; /* Reserved, must be zero */
  794. u32 proximity_domain;
  795. u8 range_guid[16];
  796. u64 address;
  797. u64 length;
  798. u64 memory_mapping;
  799. };
  800. /* Flags */
  801. #define ACPI_NFIT_ADD_ONLINE_ONLY (1) /* 00: Add/Online Operation Only */
  802. #define ACPI_NFIT_PROXIMITY_VALID (1<<1) /* 01: Proximity Domain Valid */
  803. /* Range Type GUIDs appear in the include/acuuid.h file */
  804. /* 1: Memory Device to System Address Range Map Structure */
  805. struct acpi_nfit_memory_map {
  806. struct acpi_nfit_header header;
  807. u32 device_handle;
  808. u16 physical_id;
  809. u16 region_id;
  810. u16 range_index;
  811. u16 region_index;
  812. u64 region_size;
  813. u64 region_offset;
  814. u64 address;
  815. u16 interleave_index;
  816. u16 interleave_ways;
  817. u16 flags;
  818. u16 reserved; /* Reserved, must be zero */
  819. };
  820. /* Flags */
  821. #define ACPI_NFIT_MEM_SAVE_FAILED (1) /* 00: Last SAVE to Memory Device failed */
  822. #define ACPI_NFIT_MEM_RESTORE_FAILED (1<<1) /* 01: Last RESTORE from Memory Device failed */
  823. #define ACPI_NFIT_MEM_FLUSH_FAILED (1<<2) /* 02: Platform flush failed */
  824. #define ACPI_NFIT_MEM_NOT_ARMED (1<<3) /* 03: Memory Device is not armed */
  825. #define ACPI_NFIT_MEM_HEALTH_OBSERVED (1<<4) /* 04: Memory Device observed SMART/health events */
  826. #define ACPI_NFIT_MEM_HEALTH_ENABLED (1<<5) /* 05: SMART/health events enabled */
  827. #define ACPI_NFIT_MEM_MAP_FAILED (1<<6) /* 06: Mapping to SPA failed */
  828. /* 2: Interleave Structure */
  829. struct acpi_nfit_interleave {
  830. struct acpi_nfit_header header;
  831. u16 interleave_index;
  832. u16 reserved; /* Reserved, must be zero */
  833. u32 line_count;
  834. u32 line_size;
  835. u32 line_offset[1]; /* Variable length */
  836. };
  837. /* 3: SMBIOS Management Information Structure */
  838. struct acpi_nfit_smbios {
  839. struct acpi_nfit_header header;
  840. u32 reserved; /* Reserved, must be zero */
  841. u8 data[1]; /* Variable length */
  842. };
  843. /* 4: NVDIMM Control Region Structure */
  844. struct acpi_nfit_control_region {
  845. struct acpi_nfit_header header;
  846. u16 region_index;
  847. u16 vendor_id;
  848. u16 device_id;
  849. u16 revision_id;
  850. u16 subsystem_vendor_id;
  851. u16 subsystem_device_id;
  852. u16 subsystem_revision_id;
  853. u8 valid_fields;
  854. u8 manufacturing_location;
  855. u16 manufacturing_date;
  856. u8 reserved[2]; /* Reserved, must be zero */
  857. u32 serial_number;
  858. u16 code;
  859. u16 windows;
  860. u64 window_size;
  861. u64 command_offset;
  862. u64 command_size;
  863. u64 status_offset;
  864. u64 status_size;
  865. u16 flags;
  866. u8 reserved1[6]; /* Reserved, must be zero */
  867. };
  868. /* Flags */
  869. #define ACPI_NFIT_CONTROL_BUFFERED (1) /* Block Data Windows implementation is buffered */
  870. /* valid_fields bits */
  871. #define ACPI_NFIT_CONTROL_MFG_INFO_VALID (1) /* Manufacturing fields are valid */
  872. /* 5: NVDIMM Block Data Window Region Structure */
  873. struct acpi_nfit_data_region {
  874. struct acpi_nfit_header header;
  875. u16 region_index;
  876. u16 windows;
  877. u64 offset;
  878. u64 size;
  879. u64 capacity;
  880. u64 start_address;
  881. };
  882. /* 6: Flush Hint Address Structure */
  883. struct acpi_nfit_flush_address {
  884. struct acpi_nfit_header header;
  885. u32 device_handle;
  886. u16 hint_count;
  887. u8 reserved[6]; /* Reserved, must be zero */
  888. u64 hint_address[1]; /* Variable length */
  889. };
  890. /* 7: Platform Capabilities Structure */
  891. struct acpi_nfit_capabilities {
  892. struct acpi_nfit_header header;
  893. u8 highest_capability;
  894. u8 reserved[3]; /* Reserved, must be zero */
  895. u32 capabilities;
  896. u32 reserved2;
  897. };
  898. /* Capabilities Flags */
  899. #define ACPI_NFIT_CAPABILITY_CACHE_FLUSH (1) /* 00: Cache Flush to NVDIMM capable */
  900. #define ACPI_NFIT_CAPABILITY_MEM_FLUSH (1<<1) /* 01: Memory Flush to NVDIMM capable */
  901. #define ACPI_NFIT_CAPABILITY_MEM_MIRRORING (1<<2) /* 02: Memory Mirroring capable */
  902. /*
  903. * NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM
  904. */
  905. struct nfit_device_handle {
  906. u32 handle;
  907. };
  908. /* Device handle construction and extraction macros */
  909. #define ACPI_NFIT_DIMM_NUMBER_MASK 0x0000000F
  910. #define ACPI_NFIT_CHANNEL_NUMBER_MASK 0x000000F0
  911. #define ACPI_NFIT_MEMORY_ID_MASK 0x00000F00
  912. #define ACPI_NFIT_SOCKET_ID_MASK 0x0000F000
  913. #define ACPI_NFIT_NODE_ID_MASK 0x0FFF0000
  914. #define ACPI_NFIT_DIMM_NUMBER_OFFSET 0
  915. #define ACPI_NFIT_CHANNEL_NUMBER_OFFSET 4
  916. #define ACPI_NFIT_MEMORY_ID_OFFSET 8
  917. #define ACPI_NFIT_SOCKET_ID_OFFSET 12
  918. #define ACPI_NFIT_NODE_ID_OFFSET 16
  919. /* Macro to construct a NFIT/NVDIMM device handle */
  920. #define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \
  921. ((dimm) | \
  922. ((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET) | \
  923. ((memory) << ACPI_NFIT_MEMORY_ID_OFFSET) | \
  924. ((socket) << ACPI_NFIT_SOCKET_ID_OFFSET) | \
  925. ((node) << ACPI_NFIT_NODE_ID_OFFSET))
  926. /* Macros to extract individual fields from a NFIT/NVDIMM device handle */
  927. #define ACPI_NFIT_GET_DIMM_NUMBER(handle) \
  928. ((handle) & ACPI_NFIT_DIMM_NUMBER_MASK)
  929. #define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \
  930. (((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET)
  931. #define ACPI_NFIT_GET_MEMORY_ID(handle) \
  932. (((handle) & ACPI_NFIT_MEMORY_ID_MASK) >> ACPI_NFIT_MEMORY_ID_OFFSET)
  933. #define ACPI_NFIT_GET_SOCKET_ID(handle) \
  934. (((handle) & ACPI_NFIT_SOCKET_ID_MASK) >> ACPI_NFIT_SOCKET_ID_OFFSET)
  935. #define ACPI_NFIT_GET_NODE_ID(handle) \
  936. (((handle) & ACPI_NFIT_NODE_ID_MASK) >> ACPI_NFIT_NODE_ID_OFFSET)
  937. /*******************************************************************************
  938. *
  939. * PCCT - Platform Communications Channel Table (ACPI 5.0)
  940. * Version 2 (ACPI 6.2)
  941. *
  942. ******************************************************************************/
  943. struct acpi_table_pcct {
  944. struct acpi_table_header header; /* Common ACPI table header */
  945. u32 flags;
  946. u64 reserved;
  947. };
  948. /* Values for Flags field above */
  949. #define ACPI_PCCT_DOORBELL 1
  950. /* Values for subtable type in struct acpi_subtable_header */
  951. enum acpi_pcct_type {
  952. ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0,
  953. ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1,
  954. ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 = 2, /* ACPI 6.1 */
  955. ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE = 3, /* ACPI 6.2 */
  956. ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE = 4, /* ACPI 6.2 */
  957. ACPI_PCCT_TYPE_RESERVED = 5 /* 5 and greater are reserved */
  958. };
  959. /*
  960. * PCCT Subtables, correspond to Type in struct acpi_subtable_header
  961. */
  962. /* 0: Generic Communications Subspace */
  963. struct acpi_pcct_subspace {
  964. struct acpi_subtable_header header;
  965. u8 reserved[6];
  966. u64 base_address;
  967. u64 length;
  968. struct acpi_generic_address doorbell_register;
  969. u64 preserve_mask;
  970. u64 write_mask;
  971. u32 latency;
  972. u32 max_access_rate;
  973. u16 min_turnaround_time;
  974. };
  975. /* 1: HW-reduced Communications Subspace (ACPI 5.1) */
  976. struct acpi_pcct_hw_reduced {
  977. struct acpi_subtable_header header;
  978. u32 platform_interrupt;
  979. u8 flags;
  980. u8 reserved;
  981. u64 base_address;
  982. u64 length;
  983. struct acpi_generic_address doorbell_register;
  984. u64 preserve_mask;
  985. u64 write_mask;
  986. u32 latency;
  987. u32 max_access_rate;
  988. u16 min_turnaround_time;
  989. };
  990. /* 2: HW-reduced Communications Subspace Type 2 (ACPI 6.1) */
  991. struct acpi_pcct_hw_reduced_type2 {
  992. struct acpi_subtable_header header;
  993. u32 platform_interrupt;
  994. u8 flags;
  995. u8 reserved;
  996. u64 base_address;
  997. u64 length;
  998. struct acpi_generic_address doorbell_register;
  999. u64 preserve_mask;
  1000. u64 write_mask;
  1001. u32 latency;
  1002. u32 max_access_rate;
  1003. u16 min_turnaround_time;
  1004. struct acpi_generic_address platform_ack_register;
  1005. u64 ack_preserve_mask;
  1006. u64 ack_write_mask;
  1007. };
  1008. /* 3: Extended PCC Master Subspace Type 3 (ACPI 6.2) */
  1009. struct acpi_pcct_ext_pcc_master {
  1010. struct acpi_subtable_header header;
  1011. u32 platform_interrupt;
  1012. u8 flags;
  1013. u8 reserved1;
  1014. u64 base_address;
  1015. u32 length;
  1016. struct acpi_generic_address doorbell_register;
  1017. u64 preserve_mask;
  1018. u64 write_mask;
  1019. u32 latency;
  1020. u32 max_access_rate;
  1021. u32 min_turnaround_time;
  1022. struct acpi_generic_address platform_ack_register;
  1023. u64 ack_preserve_mask;
  1024. u64 ack_set_mask;
  1025. u64 reserved2;
  1026. struct acpi_generic_address cmd_complete_register;
  1027. u64 cmd_complete_mask;
  1028. struct acpi_generic_address cmd_update_register;
  1029. u64 cmd_update_preserve_mask;
  1030. u64 cmd_update_set_mask;
  1031. struct acpi_generic_address error_status_register;
  1032. u64 error_status_mask;
  1033. };
  1034. /* 4: Extended PCC Slave Subspace Type 4 (ACPI 6.2) */
  1035. struct acpi_pcct_ext_pcc_slave {
  1036. struct acpi_subtable_header header;
  1037. u32 platform_interrupt;
  1038. u8 flags;
  1039. u8 reserved1;
  1040. u64 base_address;
  1041. u32 length;
  1042. struct acpi_generic_address doorbell_register;
  1043. u64 preserve_mask;
  1044. u64 write_mask;
  1045. u32 latency;
  1046. u32 max_access_rate;
  1047. u32 min_turnaround_time;
  1048. struct acpi_generic_address platform_ack_register;
  1049. u64 ack_preserve_mask;
  1050. u64 ack_set_mask;
  1051. u64 reserved2;
  1052. struct acpi_generic_address cmd_complete_register;
  1053. u64 cmd_complete_mask;
  1054. struct acpi_generic_address cmd_update_register;
  1055. u64 cmd_update_preserve_mask;
  1056. u64 cmd_update_set_mask;
  1057. struct acpi_generic_address error_status_register;
  1058. u64 error_status_mask;
  1059. };
  1060. /* Values for doorbell flags above */
  1061. #define ACPI_PCCT_INTERRUPT_POLARITY (1)
  1062. #define ACPI_PCCT_INTERRUPT_MODE (1<<1)
  1063. /*
  1064. * PCC memory structures (not part of the ACPI table)
  1065. */
  1066. /* Shared Memory Region */
  1067. struct acpi_pcct_shared_memory {
  1068. u32 signature;
  1069. u16 command;
  1070. u16 status;
  1071. };
  1072. /* Extended PCC Subspace Shared Memory Region (ACPI 6.2) */
  1073. struct acpi_pcct_ext_pcc_shared_memory {
  1074. u32 signature;
  1075. u32 flags;
  1076. u32 length;
  1077. u32 command;
  1078. };
  1079. /*******************************************************************************
  1080. *
  1081. * PDTT - Platform Debug Trigger Table (ACPI 6.2)
  1082. * Version 0
  1083. *
  1084. ******************************************************************************/
  1085. struct acpi_table_pdtt {
  1086. struct acpi_table_header header; /* Common ACPI table header */
  1087. u8 trigger_count;
  1088. u8 reserved[3];
  1089. u32 array_offset;
  1090. };
  1091. /*
  1092. * PDTT Communication Channel Identifier Structure.
  1093. * The number of these structures is defined by trigger_count above,
  1094. * starting at array_offset.
  1095. */
  1096. struct acpi_pdtt_channel {
  1097. u8 subchannel_id;
  1098. u8 flags;
  1099. };
  1100. /* Flags for above */
  1101. #define ACPI_PDTT_RUNTIME_TRIGGER (1)
  1102. #define ACPI_PDTT_WAIT_COMPLETION (1<<1)
  1103. /*******************************************************************************
  1104. *
  1105. * PMTT - Platform Memory Topology Table (ACPI 5.0)
  1106. * Version 1
  1107. *
  1108. ******************************************************************************/
  1109. struct acpi_table_pmtt {
  1110. struct acpi_table_header header; /* Common ACPI table header */
  1111. u32 reserved;
  1112. };
  1113. /* Common header for PMTT subtables that follow main table */
  1114. struct acpi_pmtt_header {
  1115. u8 type;
  1116. u8 reserved1;
  1117. u16 length;
  1118. u16 flags;
  1119. u16 reserved2;
  1120. };
  1121. /* Values for Type field above */
  1122. #define ACPI_PMTT_TYPE_SOCKET 0
  1123. #define ACPI_PMTT_TYPE_CONTROLLER 1
  1124. #define ACPI_PMTT_TYPE_DIMM 2
  1125. #define ACPI_PMTT_TYPE_RESERVED 3 /* 0x03-0xFF are reserved */
  1126. /* Values for Flags field above */
  1127. #define ACPI_PMTT_TOP_LEVEL 0x0001
  1128. #define ACPI_PMTT_PHYSICAL 0x0002
  1129. #define ACPI_PMTT_MEMORY_TYPE 0x000C
  1130. /*
  1131. * PMTT subtables, correspond to Type in struct acpi_pmtt_header
  1132. */
  1133. /* 0: Socket Structure */
  1134. struct acpi_pmtt_socket {
  1135. struct acpi_pmtt_header header;
  1136. u16 socket_id;
  1137. u16 reserved;
  1138. };
  1139. /* 1: Memory Controller subtable */
  1140. struct acpi_pmtt_controller {
  1141. struct acpi_pmtt_header header;
  1142. u32 read_latency;
  1143. u32 write_latency;
  1144. u32 read_bandwidth;
  1145. u32 write_bandwidth;
  1146. u16 access_width;
  1147. u16 alignment;
  1148. u16 reserved;
  1149. u16 domain_count;
  1150. };
  1151. /* 1a: Proximity Domain substructure */
  1152. struct acpi_pmtt_domain {
  1153. u32 proximity_domain;
  1154. };
  1155. /* 2: Physical Component Identifier (DIMM) */
  1156. struct acpi_pmtt_physical_component {
  1157. struct acpi_pmtt_header header;
  1158. u16 component_id;
  1159. u16 reserved;
  1160. u32 memory_size;
  1161. u32 bios_handle;
  1162. };
  1163. /*******************************************************************************
  1164. *
  1165. * PPTT - Processor Properties Topology Table (ACPI 6.2)
  1166. * Version 1
  1167. *
  1168. ******************************************************************************/
  1169. struct acpi_table_pptt {
  1170. struct acpi_table_header header; /* Common ACPI table header */
  1171. };
  1172. /* Values for Type field above */
  1173. enum acpi_pptt_type {
  1174. ACPI_PPTT_TYPE_PROCESSOR = 0,
  1175. ACPI_PPTT_TYPE_CACHE = 1,
  1176. ACPI_PPTT_TYPE_ID = 2,
  1177. ACPI_PPTT_TYPE_RESERVED = 3
  1178. };
  1179. /* 0: Processor Hierarchy Node Structure */
  1180. struct acpi_pptt_processor {
  1181. struct acpi_subtable_header header;
  1182. u16 reserved;
  1183. u32 flags;
  1184. u32 parent;
  1185. u32 acpi_processor_id;
  1186. u32 number_of_priv_resources;
  1187. };
  1188. /* Flags */
  1189. #define ACPI_PPTT_PHYSICAL_PACKAGE (1)
  1190. #define ACPI_PPTT_ACPI_PROCESSOR_ID_VALID (1<<1)
  1191. #define ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD (1<<2) /* ACPI 6.3 */
  1192. #define ACPI_PPTT_ACPI_LEAF_NODE (1<<3) /* ACPI 6.3 */
  1193. #define ACPI_PPTT_ACPI_IDENTICAL (1<<4) /* ACPI 6.3 */
  1194. /* 1: Cache Type Structure */
  1195. struct acpi_pptt_cache {
  1196. struct acpi_subtable_header header;
  1197. u16 reserved;
  1198. u32 flags;
  1199. u32 next_level_of_cache;
  1200. u32 size;
  1201. u32 number_of_sets;
  1202. u8 associativity;
  1203. u8 attributes;
  1204. u16 line_size;
  1205. };
  1206. /* Flags */
  1207. #define ACPI_PPTT_SIZE_PROPERTY_VALID (1) /* Physical property valid */
  1208. #define ACPI_PPTT_NUMBER_OF_SETS_VALID (1<<1) /* Number of sets valid */
  1209. #define ACPI_PPTT_ASSOCIATIVITY_VALID (1<<2) /* Associativity valid */
  1210. #define ACPI_PPTT_ALLOCATION_TYPE_VALID (1<<3) /* Allocation type valid */
  1211. #define ACPI_PPTT_CACHE_TYPE_VALID (1<<4) /* Cache type valid */
  1212. #define ACPI_PPTT_WRITE_POLICY_VALID (1<<5) /* Write policy valid */
  1213. #define ACPI_PPTT_LINE_SIZE_VALID (1<<6) /* Line size valid */
  1214. /* Masks for Attributes */
  1215. #define ACPI_PPTT_MASK_ALLOCATION_TYPE (0x03) /* Allocation type */
  1216. #define ACPI_PPTT_MASK_CACHE_TYPE (0x0C) /* Cache type */
  1217. #define ACPI_PPTT_MASK_WRITE_POLICY (0x10) /* Write policy */
  1218. /* Attributes describing cache */
  1219. #define ACPI_PPTT_CACHE_READ_ALLOCATE (0x0) /* Cache line is allocated on read */
  1220. #define ACPI_PPTT_CACHE_WRITE_ALLOCATE (0x01) /* Cache line is allocated on write */
  1221. #define ACPI_PPTT_CACHE_RW_ALLOCATE (0x02) /* Cache line is allocated on read and write */
  1222. #define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT (0x03) /* Alternate representation of above */
  1223. #define ACPI_PPTT_CACHE_TYPE_DATA (0x0) /* Data cache */
  1224. #define ACPI_PPTT_CACHE_TYPE_INSTR (1<<2) /* Instruction cache */
  1225. #define ACPI_PPTT_CACHE_TYPE_UNIFIED (2<<2) /* Unified I & D cache */
  1226. #define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT (3<<2) /* Alternate representation of above */
  1227. #define ACPI_PPTT_CACHE_POLICY_WB (0x0) /* Cache is write back */
  1228. #define ACPI_PPTT_CACHE_POLICY_WT (1<<4) /* Cache is write through */
  1229. /* 2: ID Structure */
  1230. struct acpi_pptt_id {
  1231. struct acpi_subtable_header header;
  1232. u16 reserved;
  1233. u32 vendor_id;
  1234. u64 level1_id;
  1235. u64 level2_id;
  1236. u16 major_rev;
  1237. u16 minor_rev;
  1238. u16 spin_rev;
  1239. };
  1240. /*******************************************************************************
  1241. *
  1242. * RASF - RAS Feature Table (ACPI 5.0)
  1243. * Version 1
  1244. *
  1245. ******************************************************************************/
  1246. struct acpi_table_rasf {
  1247. struct acpi_table_header header; /* Common ACPI table header */
  1248. u8 channel_id[12];
  1249. };
  1250. /* RASF Platform Communication Channel Shared Memory Region */
  1251. struct acpi_rasf_shared_memory {
  1252. u32 signature;
  1253. u16 command;
  1254. u16 status;
  1255. u16 version;
  1256. u8 capabilities[16];
  1257. u8 set_capabilities[16];
  1258. u16 num_parameter_blocks;
  1259. u32 set_capabilities_status;
  1260. };
  1261. /* RASF Parameter Block Structure Header */
  1262. struct acpi_rasf_parameter_block {
  1263. u16 type;
  1264. u16 version;
  1265. u16 length;
  1266. };
  1267. /* RASF Parameter Block Structure for PATROL_SCRUB */
  1268. struct acpi_rasf_patrol_scrub_parameter {
  1269. struct acpi_rasf_parameter_block header;
  1270. u16 patrol_scrub_command;
  1271. u64 requested_address_range[2];
  1272. u64 actual_address_range[2];
  1273. u16 flags;
  1274. u8 requested_speed;
  1275. };
  1276. /* Masks for Flags and Speed fields above */
  1277. #define ACPI_RASF_SCRUBBER_RUNNING 1
  1278. #define ACPI_RASF_SPEED (7<<1)
  1279. #define ACPI_RASF_SPEED_SLOW (0<<1)
  1280. #define ACPI_RASF_SPEED_MEDIUM (4<<1)
  1281. #define ACPI_RASF_SPEED_FAST (7<<1)
  1282. /* Channel Commands */
  1283. enum acpi_rasf_commands {
  1284. ACPI_RASF_EXECUTE_RASF_COMMAND = 1
  1285. };
  1286. /* Platform RAS Capabilities */
  1287. enum acpi_rasf_capabiliities {
  1288. ACPI_HW_PATROL_SCRUB_SUPPORTED = 0,
  1289. ACPI_SW_PATROL_SCRUB_EXPOSED = 1
  1290. };
  1291. /* Patrol Scrub Commands */
  1292. enum acpi_rasf_patrol_scrub_commands {
  1293. ACPI_RASF_GET_PATROL_PARAMETERS = 1,
  1294. ACPI_RASF_START_PATROL_SCRUBBER = 2,
  1295. ACPI_RASF_STOP_PATROL_SCRUBBER = 3
  1296. };
  1297. /* Channel Command flags */
  1298. #define ACPI_RASF_GENERATE_SCI (1<<15)
  1299. /* Status values */
  1300. enum acpi_rasf_status {
  1301. ACPI_RASF_SUCCESS = 0,
  1302. ACPI_RASF_NOT_VALID = 1,
  1303. ACPI_RASF_NOT_SUPPORTED = 2,
  1304. ACPI_RASF_BUSY = 3,
  1305. ACPI_RASF_FAILED = 4,
  1306. ACPI_RASF_ABORTED = 5,
  1307. ACPI_RASF_INVALID_DATA = 6
  1308. };
  1309. /* Status flags */
  1310. #define ACPI_RASF_COMMAND_COMPLETE (1)
  1311. #define ACPI_RASF_SCI_DOORBELL (1<<1)
  1312. #define ACPI_RASF_ERROR (1<<2)
  1313. #define ACPI_RASF_STATUS (0x1F<<3)
  1314. /*******************************************************************************
  1315. *
  1316. * SBST - Smart Battery Specification Table
  1317. * Version 1
  1318. *
  1319. ******************************************************************************/
  1320. struct acpi_table_sbst {
  1321. struct acpi_table_header header; /* Common ACPI table header */
  1322. u32 warning_level;
  1323. u32 low_level;
  1324. u32 critical_level;
  1325. };
  1326. /*******************************************************************************
  1327. *
  1328. * SDEI - Software Delegated Exception Interface Descriptor Table
  1329. *
  1330. * Conforms to "Software Delegated Exception Interface (SDEI)" ARM DEN0054A,
  1331. * May 8th, 2017. Copyright 2017 ARM Ltd.
  1332. *
  1333. ******************************************************************************/
  1334. struct acpi_table_sdei {
  1335. struct acpi_table_header header; /* Common ACPI table header */
  1336. };
  1337. /*******************************************************************************
  1338. *
  1339. * SDEV - Secure Devices Table (ACPI 6.2)
  1340. * Version 1
  1341. *
  1342. ******************************************************************************/
  1343. struct acpi_table_sdev {
  1344. struct acpi_table_header header; /* Common ACPI table header */
  1345. };
  1346. struct acpi_sdev_header {
  1347. u8 type;
  1348. u8 flags;
  1349. u16 length;
  1350. };
  1351. /* Values for subtable type above */
  1352. enum acpi_sdev_type {
  1353. ACPI_SDEV_TYPE_NAMESPACE_DEVICE = 0,
  1354. ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1,
  1355. ACPI_SDEV_TYPE_RESERVED = 2 /* 2 and greater are reserved */
  1356. };
  1357. /* Values for flags above */
  1358. #define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS (1)
  1359. /*
  1360. * SDEV subtables
  1361. */
  1362. /* 0: Namespace Device Based Secure Device Structure */
  1363. struct acpi_sdev_namespace {
  1364. struct acpi_sdev_header header;
  1365. u16 device_id_offset;
  1366. u16 device_id_length;
  1367. u16 vendor_data_offset;
  1368. u16 vendor_data_length;
  1369. };
  1370. /* 1: PCIe Endpoint Device Based Device Structure */
  1371. struct acpi_sdev_pcie {
  1372. struct acpi_sdev_header header;
  1373. u16 segment;
  1374. u16 start_bus;
  1375. u16 path_offset;
  1376. u16 path_length;
  1377. u16 vendor_data_offset;
  1378. u16 vendor_data_length;
  1379. };
  1380. /* 1a: PCIe Endpoint path entry */
  1381. struct acpi_sdev_pcie_path {
  1382. u8 device;
  1383. u8 function;
  1384. };
  1385. /* Reset to default packing */
  1386. #pragma pack()
  1387. #endif /* __ACTBL2_H__ */