actbl2.h 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727
  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 /* 16 and greater are reserved */
  406. };
  407. /*
  408. * MADT Subtables, correspond to Type in struct acpi_subtable_header
  409. */
  410. /* 0: Processor Local APIC */
  411. struct acpi_madt_local_apic {
  412. struct acpi_subtable_header header;
  413. u8 processor_id; /* ACPI processor id */
  414. u8 id; /* Processor's local APIC id */
  415. u32 lapic_flags;
  416. };
  417. /* 1: IO APIC */
  418. struct acpi_madt_io_apic {
  419. struct acpi_subtable_header header;
  420. u8 id; /* I/O APIC ID */
  421. u8 reserved; /* reserved - must be zero */
  422. u32 address; /* APIC physical address */
  423. u32 global_irq_base; /* Global system interrupt where INTI lines start */
  424. };
  425. /* 2: Interrupt Override */
  426. struct acpi_madt_interrupt_override {
  427. struct acpi_subtable_header header;
  428. u8 bus; /* 0 - ISA */
  429. u8 source_irq; /* Interrupt source (IRQ) */
  430. u32 global_irq; /* Global system interrupt */
  431. u16 inti_flags;
  432. };
  433. /* 3: NMI Source */
  434. struct acpi_madt_nmi_source {
  435. struct acpi_subtable_header header;
  436. u16 inti_flags;
  437. u32 global_irq; /* Global system interrupt */
  438. };
  439. /* 4: Local APIC NMI */
  440. struct acpi_madt_local_apic_nmi {
  441. struct acpi_subtable_header header;
  442. u8 processor_id; /* ACPI processor id */
  443. u16 inti_flags;
  444. u8 lint; /* LINTn to which NMI is connected */
  445. };
  446. /* 5: Address Override */
  447. struct acpi_madt_local_apic_override {
  448. struct acpi_subtable_header header;
  449. u16 reserved; /* Reserved, must be zero */
  450. u64 address; /* APIC physical address */
  451. };
  452. /* 6: I/O Sapic */
  453. struct acpi_madt_io_sapic {
  454. struct acpi_subtable_header header;
  455. u8 id; /* I/O SAPIC ID */
  456. u8 reserved; /* Reserved, must be zero */
  457. u32 global_irq_base; /* Global interrupt for SAPIC start */
  458. u64 address; /* SAPIC physical address */
  459. };
  460. /* 7: Local Sapic */
  461. struct acpi_madt_local_sapic {
  462. struct acpi_subtable_header header;
  463. u8 processor_id; /* ACPI processor id */
  464. u8 id; /* SAPIC ID */
  465. u8 eid; /* SAPIC EID */
  466. u8 reserved[3]; /* Reserved, must be zero */
  467. u32 lapic_flags;
  468. u32 uid; /* Numeric UID - ACPI 3.0 */
  469. char uid_string[1]; /* String UID - ACPI 3.0 */
  470. };
  471. /* 8: Platform Interrupt Source */
  472. struct acpi_madt_interrupt_source {
  473. struct acpi_subtable_header header;
  474. u16 inti_flags;
  475. u8 type; /* 1=PMI, 2=INIT, 3=corrected */
  476. u8 id; /* Processor ID */
  477. u8 eid; /* Processor EID */
  478. u8 io_sapic_vector; /* Vector value for PMI interrupts */
  479. u32 global_irq; /* Global system interrupt */
  480. u32 flags; /* Interrupt Source Flags */
  481. };
  482. /* Masks for Flags field above */
  483. #define ACPI_MADT_CPEI_OVERRIDE (1)
  484. /* 9: Processor Local X2APIC (ACPI 4.0) */
  485. struct acpi_madt_local_x2apic {
  486. struct acpi_subtable_header header;
  487. u16 reserved; /* reserved - must be zero */
  488. u32 local_apic_id; /* Processor x2APIC ID */
  489. u32 lapic_flags;
  490. u32 uid; /* ACPI processor UID */
  491. };
  492. /* 10: Local X2APIC NMI (ACPI 4.0) */
  493. struct acpi_madt_local_x2apic_nmi {
  494. struct acpi_subtable_header header;
  495. u16 inti_flags;
  496. u32 uid; /* ACPI processor UID */
  497. u8 lint; /* LINTn to which NMI is connected */
  498. u8 reserved[3]; /* reserved - must be zero */
  499. };
  500. /* 11: Generic Interrupt (ACPI 5.0 + ACPI 6.0 changes) */
  501. struct acpi_madt_generic_interrupt {
  502. struct acpi_subtable_header header;
  503. u16 reserved; /* reserved - must be zero */
  504. u32 cpu_interface_number;
  505. u32 uid;
  506. u32 flags;
  507. u32 parking_version;
  508. u32 performance_interrupt;
  509. u64 parked_address;
  510. u64 base_address;
  511. u64 gicv_base_address;
  512. u64 gich_base_address;
  513. u32 vgic_interrupt;
  514. u64 gicr_base_address;
  515. u64 arm_mpidr;
  516. u8 efficiency_class;
  517. u8 reserved2[3];
  518. };
  519. /* Masks for Flags field above */
  520. /* ACPI_MADT_ENABLED (1) Processor is usable if set */
  521. #define ACPI_MADT_PERFORMANCE_IRQ_MODE (1<<1) /* 01: Performance Interrupt Mode */
  522. #define ACPI_MADT_VGIC_IRQ_MODE (1<<2) /* 02: VGIC Maintenance Interrupt mode */
  523. /* 12: Generic Distributor (ACPI 5.0 + ACPI 6.0 changes) */
  524. struct acpi_madt_generic_distributor {
  525. struct acpi_subtable_header header;
  526. u16 reserved; /* reserved - must be zero */
  527. u32 gic_id;
  528. u64 base_address;
  529. u32 global_irq_base;
  530. u8 version;
  531. u8 reserved2[3]; /* reserved - must be zero */
  532. };
  533. /* Values for Version field above */
  534. enum acpi_madt_gic_version {
  535. ACPI_MADT_GIC_VERSION_NONE = 0,
  536. ACPI_MADT_GIC_VERSION_V1 = 1,
  537. ACPI_MADT_GIC_VERSION_V2 = 2,
  538. ACPI_MADT_GIC_VERSION_V3 = 3,
  539. ACPI_MADT_GIC_VERSION_V4 = 4,
  540. ACPI_MADT_GIC_VERSION_RESERVED = 5 /* 5 and greater are reserved */
  541. };
  542. /* 13: Generic MSI Frame (ACPI 5.1) */
  543. struct acpi_madt_generic_msi_frame {
  544. struct acpi_subtable_header header;
  545. u16 reserved; /* reserved - must be zero */
  546. u32 msi_frame_id;
  547. u64 base_address;
  548. u32 flags;
  549. u16 spi_count;
  550. u16 spi_base;
  551. };
  552. /* Masks for Flags field above */
  553. #define ACPI_MADT_OVERRIDE_SPI_VALUES (1)
  554. /* 14: Generic Redistributor (ACPI 5.1) */
  555. struct acpi_madt_generic_redistributor {
  556. struct acpi_subtable_header header;
  557. u16 reserved; /* reserved - must be zero */
  558. u64 base_address;
  559. u32 length;
  560. };
  561. /* 15: Generic Translator (ACPI 6.0) */
  562. struct acpi_madt_generic_translator {
  563. struct acpi_subtable_header header;
  564. u16 reserved; /* reserved - must be zero */
  565. u32 translation_id;
  566. u64 base_address;
  567. u32 reserved2;
  568. };
  569. /*
  570. * Common flags fields for MADT subtables
  571. */
  572. /* MADT Local APIC flags */
  573. #define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */
  574. /* MADT MPS INTI flags (inti_flags) */
  575. #define ACPI_MADT_POLARITY_MASK (3) /* 00-01: Polarity of APIC I/O input signals */
  576. #define ACPI_MADT_TRIGGER_MASK (3<<2) /* 02-03: Trigger mode of APIC input signals */
  577. /* Values for MPS INTI flags */
  578. #define ACPI_MADT_POLARITY_CONFORMS 0
  579. #define ACPI_MADT_POLARITY_ACTIVE_HIGH 1
  580. #define ACPI_MADT_POLARITY_RESERVED 2
  581. #define ACPI_MADT_POLARITY_ACTIVE_LOW 3
  582. #define ACPI_MADT_TRIGGER_CONFORMS (0)
  583. #define ACPI_MADT_TRIGGER_EDGE (1<<2)
  584. #define ACPI_MADT_TRIGGER_RESERVED (2<<2)
  585. #define ACPI_MADT_TRIGGER_LEVEL (3<<2)
  586. /*******************************************************************************
  587. *
  588. * MCFG - PCI Memory Mapped Configuration table and subtable
  589. * Version 1
  590. *
  591. * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005
  592. *
  593. ******************************************************************************/
  594. struct acpi_table_mcfg {
  595. struct acpi_table_header header; /* Common ACPI table header */
  596. u8 reserved[8];
  597. };
  598. /* Subtable */
  599. struct acpi_mcfg_allocation {
  600. u64 address; /* Base address, processor-relative */
  601. u16 pci_segment; /* PCI segment group number */
  602. u8 start_bus_number; /* Starting PCI Bus number */
  603. u8 end_bus_number; /* Final PCI Bus number */
  604. u32 reserved;
  605. };
  606. /*******************************************************************************
  607. *
  608. * MCHI - Management Controller Host Interface Table
  609. * Version 1
  610. *
  611. * Conforms to "Management Component Transport Protocol (MCTP) Host
  612. * Interface Specification", Revision 1.0.0a, October 13, 2009
  613. *
  614. ******************************************************************************/
  615. struct acpi_table_mchi {
  616. struct acpi_table_header header; /* Common ACPI table header */
  617. u8 interface_type;
  618. u8 protocol;
  619. u64 protocol_data;
  620. u8 interrupt_type;
  621. u8 gpe;
  622. u8 pci_device_flag;
  623. u32 global_interrupt;
  624. struct acpi_generic_address control_register;
  625. u8 pci_segment;
  626. u8 pci_bus;
  627. u8 pci_device;
  628. u8 pci_function;
  629. };
  630. /*******************************************************************************
  631. *
  632. * MPST - Memory Power State Table (ACPI 5.0)
  633. * Version 1
  634. *
  635. ******************************************************************************/
  636. #define ACPI_MPST_CHANNEL_INFO \
  637. u8 channel_id; \
  638. u8 reserved1[3]; \
  639. u16 power_node_count; \
  640. u16 reserved2;
  641. /* Main table */
  642. struct acpi_table_mpst {
  643. struct acpi_table_header header; /* Common ACPI table header */
  644. ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */
  645. };
  646. /* Memory Platform Communication Channel Info */
  647. struct acpi_mpst_channel {
  648. ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */
  649. };
  650. /* Memory Power Node Structure */
  651. struct acpi_mpst_power_node {
  652. u8 flags;
  653. u8 reserved1;
  654. u16 node_id;
  655. u32 length;
  656. u64 range_address;
  657. u64 range_length;
  658. u32 num_power_states;
  659. u32 num_physical_components;
  660. };
  661. /* Values for Flags field above */
  662. #define ACPI_MPST_ENABLED 1
  663. #define ACPI_MPST_POWER_MANAGED 2
  664. #define ACPI_MPST_HOT_PLUG_CAPABLE 4
  665. /* Memory Power State Structure (follows POWER_NODE above) */
  666. struct acpi_mpst_power_state {
  667. u8 power_state;
  668. u8 info_index;
  669. };
  670. /* Physical Component ID Structure (follows POWER_STATE above) */
  671. struct acpi_mpst_component {
  672. u16 component_id;
  673. };
  674. /* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
  675. struct acpi_mpst_data_hdr {
  676. u16 characteristics_count;
  677. u16 reserved;
  678. };
  679. struct acpi_mpst_power_data {
  680. u8 structure_id;
  681. u8 flags;
  682. u16 reserved1;
  683. u32 average_power;
  684. u32 power_saving;
  685. u64 exit_latency;
  686. u64 reserved2;
  687. };
  688. /* Values for Flags field above */
  689. #define ACPI_MPST_PRESERVE 1
  690. #define ACPI_MPST_AUTOENTRY 2
  691. #define ACPI_MPST_AUTOEXIT 4
  692. /* Shared Memory Region (not part of an ACPI table) */
  693. struct acpi_mpst_shared {
  694. u32 signature;
  695. u16 pcc_command;
  696. u16 pcc_status;
  697. u32 command_register;
  698. u32 status_register;
  699. u32 power_state_id;
  700. u32 power_node_id;
  701. u64 energy_consumed;
  702. u64 average_power;
  703. };
  704. /*******************************************************************************
  705. *
  706. * MSCT - Maximum System Characteristics Table (ACPI 4.0)
  707. * Version 1
  708. *
  709. ******************************************************************************/
  710. struct acpi_table_msct {
  711. struct acpi_table_header header; /* Common ACPI table header */
  712. u32 proximity_offset; /* Location of proximity info struct(s) */
  713. u32 max_proximity_domains; /* Max number of proximity domains */
  714. u32 max_clock_domains; /* Max number of clock domains */
  715. u64 max_address; /* Max physical address in system */
  716. };
  717. /* subtable - Maximum Proximity Domain Information. Version 1 */
  718. struct acpi_msct_proximity {
  719. u8 revision;
  720. u8 length;
  721. u32 range_start; /* Start of domain range */
  722. u32 range_end; /* End of domain range */
  723. u32 processor_capacity;
  724. u64 memory_capacity; /* In bytes */
  725. };
  726. /*******************************************************************************
  727. *
  728. * MSDM - Microsoft Data Management table
  729. *
  730. * Conforms to "Microsoft Software Licensing Tables (SLIC and MSDM)",
  731. * November 29, 2011. Copyright 2011 Microsoft
  732. *
  733. ******************************************************************************/
  734. /* Basic MSDM table is only the common ACPI header */
  735. struct acpi_table_msdm {
  736. struct acpi_table_header header; /* Common ACPI table header */
  737. };
  738. /*******************************************************************************
  739. *
  740. * MTMR - MID Timer Table
  741. * Version 1
  742. *
  743. * Conforms to "Simple Firmware Interface Specification",
  744. * Draft 0.8.2, Oct 19, 2010
  745. * NOTE: The ACPI MTMR is equivalent to the SFI MTMR table.
  746. *
  747. ******************************************************************************/
  748. struct acpi_table_mtmr {
  749. struct acpi_table_header header; /* Common ACPI table header */
  750. };
  751. /* MTMR entry */
  752. struct acpi_mtmr_entry {
  753. struct acpi_generic_address physical_address;
  754. u32 frequency;
  755. u32 irq;
  756. };
  757. /*******************************************************************************
  758. *
  759. * NFIT - NVDIMM Interface Table (ACPI 6.0+)
  760. * Version 1
  761. *
  762. ******************************************************************************/
  763. struct acpi_table_nfit {
  764. struct acpi_table_header header; /* Common ACPI table header */
  765. u32 reserved; /* Reserved, must be zero */
  766. };
  767. /* Subtable header for NFIT */
  768. struct acpi_nfit_header {
  769. u16 type;
  770. u16 length;
  771. };
  772. /* Values for subtable type in struct acpi_nfit_header */
  773. enum acpi_nfit_type {
  774. ACPI_NFIT_TYPE_SYSTEM_ADDRESS = 0,
  775. ACPI_NFIT_TYPE_MEMORY_MAP = 1,
  776. ACPI_NFIT_TYPE_INTERLEAVE = 2,
  777. ACPI_NFIT_TYPE_SMBIOS = 3,
  778. ACPI_NFIT_TYPE_CONTROL_REGION = 4,
  779. ACPI_NFIT_TYPE_DATA_REGION = 5,
  780. ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6,
  781. ACPI_NFIT_TYPE_CAPABILITIES = 7,
  782. ACPI_NFIT_TYPE_RESERVED = 8 /* 8 and greater are reserved */
  783. };
  784. /*
  785. * NFIT Subtables
  786. */
  787. /* 0: System Physical Address Range Structure */
  788. struct acpi_nfit_system_address {
  789. struct acpi_nfit_header header;
  790. u16 range_index;
  791. u16 flags;
  792. u32 reserved; /* Reserved, must be zero */
  793. u32 proximity_domain;
  794. u8 range_guid[16];
  795. u64 address;
  796. u64 length;
  797. u64 memory_mapping;
  798. };
  799. /* Flags */
  800. #define ACPI_NFIT_ADD_ONLINE_ONLY (1) /* 00: Add/Online Operation Only */
  801. #define ACPI_NFIT_PROXIMITY_VALID (1<<1) /* 01: Proximity Domain Valid */
  802. /* Range Type GUIDs appear in the include/acuuid.h file */
  803. /* 1: Memory Device to System Address Range Map Structure */
  804. struct acpi_nfit_memory_map {
  805. struct acpi_nfit_header header;
  806. u32 device_handle;
  807. u16 physical_id;
  808. u16 region_id;
  809. u16 range_index;
  810. u16 region_index;
  811. u64 region_size;
  812. u64 region_offset;
  813. u64 address;
  814. u16 interleave_index;
  815. u16 interleave_ways;
  816. u16 flags;
  817. u16 reserved; /* Reserved, must be zero */
  818. };
  819. /* Flags */
  820. #define ACPI_NFIT_MEM_SAVE_FAILED (1) /* 00: Last SAVE to Memory Device failed */
  821. #define ACPI_NFIT_MEM_RESTORE_FAILED (1<<1) /* 01: Last RESTORE from Memory Device failed */
  822. #define ACPI_NFIT_MEM_FLUSH_FAILED (1<<2) /* 02: Platform flush failed */
  823. #define ACPI_NFIT_MEM_NOT_ARMED (1<<3) /* 03: Memory Device is not armed */
  824. #define ACPI_NFIT_MEM_HEALTH_OBSERVED (1<<4) /* 04: Memory Device observed SMART/health events */
  825. #define ACPI_NFIT_MEM_HEALTH_ENABLED (1<<5) /* 05: SMART/health events enabled */
  826. #define ACPI_NFIT_MEM_MAP_FAILED (1<<6) /* 06: Mapping to SPA failed */
  827. /* 2: Interleave Structure */
  828. struct acpi_nfit_interleave {
  829. struct acpi_nfit_header header;
  830. u16 interleave_index;
  831. u16 reserved; /* Reserved, must be zero */
  832. u32 line_count;
  833. u32 line_size;
  834. u32 line_offset[1]; /* Variable length */
  835. };
  836. /* 3: SMBIOS Management Information Structure */
  837. struct acpi_nfit_smbios {
  838. struct acpi_nfit_header header;
  839. u32 reserved; /* Reserved, must be zero */
  840. u8 data[1]; /* Variable length */
  841. };
  842. /* 4: NVDIMM Control Region Structure */
  843. struct acpi_nfit_control_region {
  844. struct acpi_nfit_header header;
  845. u16 region_index;
  846. u16 vendor_id;
  847. u16 device_id;
  848. u16 revision_id;
  849. u16 subsystem_vendor_id;
  850. u16 subsystem_device_id;
  851. u16 subsystem_revision_id;
  852. u8 valid_fields;
  853. u8 manufacturing_location;
  854. u16 manufacturing_date;
  855. u8 reserved[2]; /* Reserved, must be zero */
  856. u32 serial_number;
  857. u16 code;
  858. u16 windows;
  859. u64 window_size;
  860. u64 command_offset;
  861. u64 command_size;
  862. u64 status_offset;
  863. u64 status_size;
  864. u16 flags;
  865. u8 reserved1[6]; /* Reserved, must be zero */
  866. };
  867. /* Flags */
  868. #define ACPI_NFIT_CONTROL_BUFFERED (1) /* Block Data Windows implementation is buffered */
  869. /* valid_fields bits */
  870. #define ACPI_NFIT_CONTROL_MFG_INFO_VALID (1) /* Manufacturing fields are valid */
  871. /* 5: NVDIMM Block Data Window Region Structure */
  872. struct acpi_nfit_data_region {
  873. struct acpi_nfit_header header;
  874. u16 region_index;
  875. u16 windows;
  876. u64 offset;
  877. u64 size;
  878. u64 capacity;
  879. u64 start_address;
  880. };
  881. /* 6: Flush Hint Address Structure */
  882. struct acpi_nfit_flush_address {
  883. struct acpi_nfit_header header;
  884. u32 device_handle;
  885. u16 hint_count;
  886. u8 reserved[6]; /* Reserved, must be zero */
  887. u64 hint_address[1]; /* Variable length */
  888. };
  889. /* 7: Platform Capabilities Structure */
  890. struct acpi_nfit_capabilities {
  891. struct acpi_nfit_header header;
  892. u8 highest_capability;
  893. u8 reserved[3]; /* Reserved, must be zero */
  894. u32 capabilities;
  895. u32 reserved2;
  896. };
  897. /* Capabilities Flags */
  898. #define ACPI_NFIT_CAPABILITY_CACHE_FLUSH (1) /* 00: Cache Flush to NVDIMM capable */
  899. #define ACPI_NFIT_CAPABILITY_MEM_FLUSH (1<<1) /* 01: Memory Flush to NVDIMM capable */
  900. #define ACPI_NFIT_CAPABILITY_MEM_MIRRORING (1<<2) /* 02: Memory Mirroring capable */
  901. /*
  902. * NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM
  903. */
  904. struct nfit_device_handle {
  905. u32 handle;
  906. };
  907. /* Device handle construction and extraction macros */
  908. #define ACPI_NFIT_DIMM_NUMBER_MASK 0x0000000F
  909. #define ACPI_NFIT_CHANNEL_NUMBER_MASK 0x000000F0
  910. #define ACPI_NFIT_MEMORY_ID_MASK 0x00000F00
  911. #define ACPI_NFIT_SOCKET_ID_MASK 0x0000F000
  912. #define ACPI_NFIT_NODE_ID_MASK 0x0FFF0000
  913. #define ACPI_NFIT_DIMM_NUMBER_OFFSET 0
  914. #define ACPI_NFIT_CHANNEL_NUMBER_OFFSET 4
  915. #define ACPI_NFIT_MEMORY_ID_OFFSET 8
  916. #define ACPI_NFIT_SOCKET_ID_OFFSET 12
  917. #define ACPI_NFIT_NODE_ID_OFFSET 16
  918. /* Macro to construct a NFIT/NVDIMM device handle */
  919. #define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \
  920. ((dimm) | \
  921. ((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET) | \
  922. ((memory) << ACPI_NFIT_MEMORY_ID_OFFSET) | \
  923. ((socket) << ACPI_NFIT_SOCKET_ID_OFFSET) | \
  924. ((node) << ACPI_NFIT_NODE_ID_OFFSET))
  925. /* Macros to extract individual fields from a NFIT/NVDIMM device handle */
  926. #define ACPI_NFIT_GET_DIMM_NUMBER(handle) \
  927. ((handle) & ACPI_NFIT_DIMM_NUMBER_MASK)
  928. #define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \
  929. (((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET)
  930. #define ACPI_NFIT_GET_MEMORY_ID(handle) \
  931. (((handle) & ACPI_NFIT_MEMORY_ID_MASK) >> ACPI_NFIT_MEMORY_ID_OFFSET)
  932. #define ACPI_NFIT_GET_SOCKET_ID(handle) \
  933. (((handle) & ACPI_NFIT_SOCKET_ID_MASK) >> ACPI_NFIT_SOCKET_ID_OFFSET)
  934. #define ACPI_NFIT_GET_NODE_ID(handle) \
  935. (((handle) & ACPI_NFIT_NODE_ID_MASK) >> ACPI_NFIT_NODE_ID_OFFSET)
  936. /*******************************************************************************
  937. *
  938. * PCCT - Platform Communications Channel Table (ACPI 5.0)
  939. * Version 2 (ACPI 6.2)
  940. *
  941. ******************************************************************************/
  942. struct acpi_table_pcct {
  943. struct acpi_table_header header; /* Common ACPI table header */
  944. u32 flags;
  945. u64 reserved;
  946. };
  947. /* Values for Flags field above */
  948. #define ACPI_PCCT_DOORBELL 1
  949. /* Values for subtable type in struct acpi_subtable_header */
  950. enum acpi_pcct_type {
  951. ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0,
  952. ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1,
  953. ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 = 2, /* ACPI 6.1 */
  954. ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE = 3, /* ACPI 6.2 */
  955. ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE = 4, /* ACPI 6.2 */
  956. ACPI_PCCT_TYPE_RESERVED = 5 /* 5 and greater are reserved */
  957. };
  958. /*
  959. * PCCT Subtables, correspond to Type in struct acpi_subtable_header
  960. */
  961. /* 0: Generic Communications Subspace */
  962. struct acpi_pcct_subspace {
  963. struct acpi_subtable_header header;
  964. u8 reserved[6];
  965. u64 base_address;
  966. u64 length;
  967. struct acpi_generic_address doorbell_register;
  968. u64 preserve_mask;
  969. u64 write_mask;
  970. u32 latency;
  971. u32 max_access_rate;
  972. u16 min_turnaround_time;
  973. };
  974. /* 1: HW-reduced Communications Subspace (ACPI 5.1) */
  975. struct acpi_pcct_hw_reduced {
  976. struct acpi_subtable_header header;
  977. u32 platform_interrupt;
  978. u8 flags;
  979. u8 reserved;
  980. u64 base_address;
  981. u64 length;
  982. struct acpi_generic_address doorbell_register;
  983. u64 preserve_mask;
  984. u64 write_mask;
  985. u32 latency;
  986. u32 max_access_rate;
  987. u16 min_turnaround_time;
  988. };
  989. /* 2: HW-reduced Communications Subspace Type 2 (ACPI 6.1) */
  990. struct acpi_pcct_hw_reduced_type2 {
  991. struct acpi_subtable_header header;
  992. u32 platform_interrupt;
  993. u8 flags;
  994. u8 reserved;
  995. u64 base_address;
  996. u64 length;
  997. struct acpi_generic_address doorbell_register;
  998. u64 preserve_mask;
  999. u64 write_mask;
  1000. u32 latency;
  1001. u32 max_access_rate;
  1002. u16 min_turnaround_time;
  1003. struct acpi_generic_address platform_ack_register;
  1004. u64 ack_preserve_mask;
  1005. u64 ack_write_mask;
  1006. };
  1007. /* 3: Extended PCC Master Subspace Type 3 (ACPI 6.2) */
  1008. struct acpi_pcct_ext_pcc_master {
  1009. struct acpi_subtable_header header;
  1010. u32 platform_interrupt;
  1011. u8 flags;
  1012. u8 reserved1;
  1013. u64 base_address;
  1014. u32 length;
  1015. struct acpi_generic_address doorbell_register;
  1016. u64 preserve_mask;
  1017. u64 write_mask;
  1018. u32 latency;
  1019. u32 max_access_rate;
  1020. u32 min_turnaround_time;
  1021. struct acpi_generic_address platform_ack_register;
  1022. u64 ack_preserve_mask;
  1023. u64 ack_set_mask;
  1024. u64 reserved2;
  1025. struct acpi_generic_address cmd_complete_register;
  1026. u64 cmd_complete_mask;
  1027. struct acpi_generic_address cmd_update_register;
  1028. u64 cmd_update_preserve_mask;
  1029. u64 cmd_update_set_mask;
  1030. struct acpi_generic_address error_status_register;
  1031. u64 error_status_mask;
  1032. };
  1033. /* 4: Extended PCC Slave Subspace Type 4 (ACPI 6.2) */
  1034. struct acpi_pcct_ext_pcc_slave {
  1035. struct acpi_subtable_header header;
  1036. u32 platform_interrupt;
  1037. u8 flags;
  1038. u8 reserved1;
  1039. u64 base_address;
  1040. u32 length;
  1041. struct acpi_generic_address doorbell_register;
  1042. u64 preserve_mask;
  1043. u64 write_mask;
  1044. u32 latency;
  1045. u32 max_access_rate;
  1046. u32 min_turnaround_time;
  1047. struct acpi_generic_address platform_ack_register;
  1048. u64 ack_preserve_mask;
  1049. u64 ack_set_mask;
  1050. u64 reserved2;
  1051. struct acpi_generic_address cmd_complete_register;
  1052. u64 cmd_complete_mask;
  1053. struct acpi_generic_address cmd_update_register;
  1054. u64 cmd_update_preserve_mask;
  1055. u64 cmd_update_set_mask;
  1056. struct acpi_generic_address error_status_register;
  1057. u64 error_status_mask;
  1058. };
  1059. /* Values for doorbell flags above */
  1060. #define ACPI_PCCT_INTERRUPT_POLARITY (1)
  1061. #define ACPI_PCCT_INTERRUPT_MODE (1<<1)
  1062. /*
  1063. * PCC memory structures (not part of the ACPI table)
  1064. */
  1065. /* Shared Memory Region */
  1066. struct acpi_pcct_shared_memory {
  1067. u32 signature;
  1068. u16 command;
  1069. u16 status;
  1070. };
  1071. /* Extended PCC Subspace Shared Memory Region (ACPI 6.2) */
  1072. struct acpi_pcct_ext_pcc_shared_memory {
  1073. u32 signature;
  1074. u32 flags;
  1075. u32 length;
  1076. u32 command;
  1077. };
  1078. /*******************************************************************************
  1079. *
  1080. * PDTT - Platform Debug Trigger Table (ACPI 6.2)
  1081. * Version 0
  1082. *
  1083. ******************************************************************************/
  1084. struct acpi_table_pdtt {
  1085. struct acpi_table_header header; /* Common ACPI table header */
  1086. u8 trigger_count;
  1087. u8 reserved[3];
  1088. u32 array_offset;
  1089. };
  1090. /*
  1091. * PDTT Communication Channel Identifier Structure.
  1092. * The number of these structures is defined by trigger_count above,
  1093. * starting at array_offset.
  1094. */
  1095. struct acpi_pdtt_channel {
  1096. u8 subchannel_id;
  1097. u8 flags;
  1098. };
  1099. /* Flags for above */
  1100. #define ACPI_PDTT_RUNTIME_TRIGGER (1)
  1101. #define ACPI_PDTT_WAIT_COMPLETION (1<<1)
  1102. /*******************************************************************************
  1103. *
  1104. * PMTT - Platform Memory Topology Table (ACPI 5.0)
  1105. * Version 1
  1106. *
  1107. ******************************************************************************/
  1108. struct acpi_table_pmtt {
  1109. struct acpi_table_header header; /* Common ACPI table header */
  1110. u32 reserved;
  1111. };
  1112. /* Common header for PMTT subtables that follow main table */
  1113. struct acpi_pmtt_header {
  1114. u8 type;
  1115. u8 reserved1;
  1116. u16 length;
  1117. u16 flags;
  1118. u16 reserved2;
  1119. };
  1120. /* Values for Type field above */
  1121. #define ACPI_PMTT_TYPE_SOCKET 0
  1122. #define ACPI_PMTT_TYPE_CONTROLLER 1
  1123. #define ACPI_PMTT_TYPE_DIMM 2
  1124. #define ACPI_PMTT_TYPE_RESERVED 3 /* 0x03-0xFF are reserved */
  1125. /* Values for Flags field above */
  1126. #define ACPI_PMTT_TOP_LEVEL 0x0001
  1127. #define ACPI_PMTT_PHYSICAL 0x0002
  1128. #define ACPI_PMTT_MEMORY_TYPE 0x000C
  1129. /*
  1130. * PMTT subtables, correspond to Type in struct acpi_pmtt_header
  1131. */
  1132. /* 0: Socket Structure */
  1133. struct acpi_pmtt_socket {
  1134. struct acpi_pmtt_header header;
  1135. u16 socket_id;
  1136. u16 reserved;
  1137. };
  1138. /* 1: Memory Controller subtable */
  1139. struct acpi_pmtt_controller {
  1140. struct acpi_pmtt_header header;
  1141. u32 read_latency;
  1142. u32 write_latency;
  1143. u32 read_bandwidth;
  1144. u32 write_bandwidth;
  1145. u16 access_width;
  1146. u16 alignment;
  1147. u16 reserved;
  1148. u16 domain_count;
  1149. };
  1150. /* 1a: Proximity Domain substructure */
  1151. struct acpi_pmtt_domain {
  1152. u32 proximity_domain;
  1153. };
  1154. /* 2: Physical Component Identifier (DIMM) */
  1155. struct acpi_pmtt_physical_component {
  1156. struct acpi_pmtt_header header;
  1157. u16 component_id;
  1158. u16 reserved;
  1159. u32 memory_size;
  1160. u32 bios_handle;
  1161. };
  1162. /*******************************************************************************
  1163. *
  1164. * PPTT - Processor Properties Topology Table (ACPI 6.2)
  1165. * Version 1
  1166. *
  1167. ******************************************************************************/
  1168. struct acpi_table_pptt {
  1169. struct acpi_table_header header; /* Common ACPI table header */
  1170. };
  1171. /* Values for Type field above */
  1172. enum acpi_pptt_type {
  1173. ACPI_PPTT_TYPE_PROCESSOR = 0,
  1174. ACPI_PPTT_TYPE_CACHE = 1,
  1175. ACPI_PPTT_TYPE_ID = 2,
  1176. ACPI_PPTT_TYPE_RESERVED = 3
  1177. };
  1178. /* 0: Processor Hierarchy Node Structure */
  1179. struct acpi_pptt_processor {
  1180. struct acpi_subtable_header header;
  1181. u16 reserved;
  1182. u32 flags;
  1183. u32 parent;
  1184. u32 acpi_processor_id;
  1185. u32 number_of_priv_resources;
  1186. };
  1187. /* Flags */
  1188. #define ACPI_PPTT_PHYSICAL_PACKAGE (1)
  1189. #define ACPI_PPTT_ACPI_PROCESSOR_ID_VALID (1<<1)
  1190. #define ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD (1<<2) /* ACPI 6.3 */
  1191. #define ACPI_PPTT_ACPI_LEAF_NODE (1<<3) /* ACPI 6.3 */
  1192. #define ACPI_PPTT_ACPI_IDENTICAL (1<<4) /* ACPI 6.3 */
  1193. /* 1: Cache Type Structure */
  1194. struct acpi_pptt_cache {
  1195. struct acpi_subtable_header header;
  1196. u16 reserved;
  1197. u32 flags;
  1198. u32 next_level_of_cache;
  1199. u32 size;
  1200. u32 number_of_sets;
  1201. u8 associativity;
  1202. u8 attributes;
  1203. u16 line_size;
  1204. };
  1205. /* Flags */
  1206. #define ACPI_PPTT_SIZE_PROPERTY_VALID (1) /* Physical property valid */
  1207. #define ACPI_PPTT_NUMBER_OF_SETS_VALID (1<<1) /* Number of sets valid */
  1208. #define ACPI_PPTT_ASSOCIATIVITY_VALID (1<<2) /* Associativity valid */
  1209. #define ACPI_PPTT_ALLOCATION_TYPE_VALID (1<<3) /* Allocation type valid */
  1210. #define ACPI_PPTT_CACHE_TYPE_VALID (1<<4) /* Cache type valid */
  1211. #define ACPI_PPTT_WRITE_POLICY_VALID (1<<5) /* Write policy valid */
  1212. #define ACPI_PPTT_LINE_SIZE_VALID (1<<6) /* Line size valid */
  1213. /* Masks for Attributes */
  1214. #define ACPI_PPTT_MASK_ALLOCATION_TYPE (0x03) /* Allocation type */
  1215. #define ACPI_PPTT_MASK_CACHE_TYPE (0x0C) /* Cache type */
  1216. #define ACPI_PPTT_MASK_WRITE_POLICY (0x10) /* Write policy */
  1217. /* Attributes describing cache */
  1218. #define ACPI_PPTT_CACHE_READ_ALLOCATE (0x0) /* Cache line is allocated on read */
  1219. #define ACPI_PPTT_CACHE_WRITE_ALLOCATE (0x01) /* Cache line is allocated on write */
  1220. #define ACPI_PPTT_CACHE_RW_ALLOCATE (0x02) /* Cache line is allocated on read and write */
  1221. #define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT (0x03) /* Alternate representation of above */
  1222. #define ACPI_PPTT_CACHE_TYPE_DATA (0x0) /* Data cache */
  1223. #define ACPI_PPTT_CACHE_TYPE_INSTR (1<<2) /* Instruction cache */
  1224. #define ACPI_PPTT_CACHE_TYPE_UNIFIED (2<<2) /* Unified I & D cache */
  1225. #define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT (3<<2) /* Alternate representation of above */
  1226. #define ACPI_PPTT_CACHE_POLICY_WB (0x0) /* Cache is write back */
  1227. #define ACPI_PPTT_CACHE_POLICY_WT (1<<4) /* Cache is write through */
  1228. /* 2: ID Structure */
  1229. struct acpi_pptt_id {
  1230. struct acpi_subtable_header header;
  1231. u16 reserved;
  1232. u32 vendor_id;
  1233. u64 level1_id;
  1234. u64 level2_id;
  1235. u16 major_rev;
  1236. u16 minor_rev;
  1237. u16 spin_rev;
  1238. };
  1239. /*******************************************************************************
  1240. *
  1241. * RASF - RAS Feature Table (ACPI 5.0)
  1242. * Version 1
  1243. *
  1244. ******************************************************************************/
  1245. struct acpi_table_rasf {
  1246. struct acpi_table_header header; /* Common ACPI table header */
  1247. u8 channel_id[12];
  1248. };
  1249. /* RASF Platform Communication Channel Shared Memory Region */
  1250. struct acpi_rasf_shared_memory {
  1251. u32 signature;
  1252. u16 command;
  1253. u16 status;
  1254. u16 version;
  1255. u8 capabilities[16];
  1256. u8 set_capabilities[16];
  1257. u16 num_parameter_blocks;
  1258. u32 set_capabilities_status;
  1259. };
  1260. /* RASF Parameter Block Structure Header */
  1261. struct acpi_rasf_parameter_block {
  1262. u16 type;
  1263. u16 version;
  1264. u16 length;
  1265. };
  1266. /* RASF Parameter Block Structure for PATROL_SCRUB */
  1267. struct acpi_rasf_patrol_scrub_parameter {
  1268. struct acpi_rasf_parameter_block header;
  1269. u16 patrol_scrub_command;
  1270. u64 requested_address_range[2];
  1271. u64 actual_address_range[2];
  1272. u16 flags;
  1273. u8 requested_speed;
  1274. };
  1275. /* Masks for Flags and Speed fields above */
  1276. #define ACPI_RASF_SCRUBBER_RUNNING 1
  1277. #define ACPI_RASF_SPEED (7<<1)
  1278. #define ACPI_RASF_SPEED_SLOW (0<<1)
  1279. #define ACPI_RASF_SPEED_MEDIUM (4<<1)
  1280. #define ACPI_RASF_SPEED_FAST (7<<1)
  1281. /* Channel Commands */
  1282. enum acpi_rasf_commands {
  1283. ACPI_RASF_EXECUTE_RASF_COMMAND = 1
  1284. };
  1285. /* Platform RAS Capabilities */
  1286. enum acpi_rasf_capabiliities {
  1287. ACPI_HW_PATROL_SCRUB_SUPPORTED = 0,
  1288. ACPI_SW_PATROL_SCRUB_EXPOSED = 1
  1289. };
  1290. /* Patrol Scrub Commands */
  1291. enum acpi_rasf_patrol_scrub_commands {
  1292. ACPI_RASF_GET_PATROL_PARAMETERS = 1,
  1293. ACPI_RASF_START_PATROL_SCRUBBER = 2,
  1294. ACPI_RASF_STOP_PATROL_SCRUBBER = 3
  1295. };
  1296. /* Channel Command flags */
  1297. #define ACPI_RASF_GENERATE_SCI (1<<15)
  1298. /* Status values */
  1299. enum acpi_rasf_status {
  1300. ACPI_RASF_SUCCESS = 0,
  1301. ACPI_RASF_NOT_VALID = 1,
  1302. ACPI_RASF_NOT_SUPPORTED = 2,
  1303. ACPI_RASF_BUSY = 3,
  1304. ACPI_RASF_FAILED = 4,
  1305. ACPI_RASF_ABORTED = 5,
  1306. ACPI_RASF_INVALID_DATA = 6
  1307. };
  1308. /* Status flags */
  1309. #define ACPI_RASF_COMMAND_COMPLETE (1)
  1310. #define ACPI_RASF_SCI_DOORBELL (1<<1)
  1311. #define ACPI_RASF_ERROR (1<<2)
  1312. #define ACPI_RASF_STATUS (0x1F<<3)
  1313. /*******************************************************************************
  1314. *
  1315. * SBST - Smart Battery Specification Table
  1316. * Version 1
  1317. *
  1318. ******************************************************************************/
  1319. struct acpi_table_sbst {
  1320. struct acpi_table_header header; /* Common ACPI table header */
  1321. u32 warning_level;
  1322. u32 low_level;
  1323. u32 critical_level;
  1324. };
  1325. /*******************************************************************************
  1326. *
  1327. * SDEI - Software Delegated Exception Interface Descriptor Table
  1328. *
  1329. * Conforms to "Software Delegated Exception Interface (SDEI)" ARM DEN0054A,
  1330. * May 8th, 2017. Copyright 2017 ARM Ltd.
  1331. *
  1332. ******************************************************************************/
  1333. struct acpi_table_sdei {
  1334. struct acpi_table_header header; /* Common ACPI table header */
  1335. };
  1336. /*******************************************************************************
  1337. *
  1338. * SDEV - Secure Devices Table (ACPI 6.2)
  1339. * Version 1
  1340. *
  1341. ******************************************************************************/
  1342. struct acpi_table_sdev {
  1343. struct acpi_table_header header; /* Common ACPI table header */
  1344. };
  1345. struct acpi_sdev_header {
  1346. u8 type;
  1347. u8 flags;
  1348. u16 length;
  1349. };
  1350. /* Values for subtable type above */
  1351. enum acpi_sdev_type {
  1352. ACPI_SDEV_TYPE_NAMESPACE_DEVICE = 0,
  1353. ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1,
  1354. ACPI_SDEV_TYPE_RESERVED = 2 /* 2 and greater are reserved */
  1355. };
  1356. /* Values for flags above */
  1357. #define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS (1)
  1358. /*
  1359. * SDEV subtables
  1360. */
  1361. /* 0: Namespace Device Based Secure Device Structure */
  1362. struct acpi_sdev_namespace {
  1363. struct acpi_sdev_header header;
  1364. u16 device_id_offset;
  1365. u16 device_id_length;
  1366. u16 vendor_data_offset;
  1367. u16 vendor_data_length;
  1368. };
  1369. /* 1: PCIe Endpoint Device Based Device Structure */
  1370. struct acpi_sdev_pcie {
  1371. struct acpi_sdev_header header;
  1372. u16 segment;
  1373. u16 start_bus;
  1374. u16 path_offset;
  1375. u16 path_length;
  1376. u16 vendor_data_offset;
  1377. u16 vendor_data_length;
  1378. };
  1379. /* 1a: PCIe Endpoint path entry */
  1380. struct acpi_sdev_pcie_path {
  1381. u8 device;
  1382. u8 function;
  1383. };
  1384. /* Reset to default packing */
  1385. #pragma pack()
  1386. #endif /* __ACTBL2_H__ */