SgiAcpiHeader.h 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. /** @file
  2. *
  3. * Copyright (c) 2018 - 2022, Arm Limited. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause-Patent
  6. *
  7. **/
  8. #ifndef __SGI_ACPI_HEADER__
  9. #define __SGI_ACPI_HEADER__
  10. #include <IndustryStandard/Acpi.h>
  11. //
  12. // ACPI table information used to initialize tables.
  13. //
  14. #define EFI_ACPI_ARM_OEM_ID 'A','R','M','L','T','D' // OEMID 6 bytes long
  15. #define EFI_ACPI_ARM_OEM_TABLE_ID SIGNATURE_64 ('A','R','M','S','G','I',' ',' ') // OEM table id 8 bytes long
  16. #define EFI_ACPI_ARM_OEM_REVISION 0x20140727
  17. #define EFI_ACPI_ARM_CREATOR_ID SIGNATURE_32('A','R','M',' ')
  18. #define EFI_ACPI_ARM_CREATOR_REVISION 0x00000099
  19. #define CORE_COUNT FixedPcdGet32 (PcdCoreCount)
  20. #define CLUSTER_COUNT FixedPcdGet32 (PcdClusterCount)
  21. // ACPI OSC Status bits
  22. #define OSC_STS_BIT0_RES (1U << 0)
  23. #define OSC_STS_FAILURE (1U << 1)
  24. #define OSC_STS_UNRECOGNIZED_UUID (1U << 2)
  25. #define OSC_STS_UNRECOGNIZED_REV (1U << 3)
  26. #define OSC_STS_CAPABILITY_MASKED (1U << 4)
  27. #define OSC_STS_MASK (OSC_STS_BIT0_RES | \
  28. OSC_STS_FAILURE | \
  29. OSC_STS_UNRECOGNIZED_UUID | \
  30. OSC_STS_UNRECOGNIZED_REV | \
  31. OSC_STS_CAPABILITY_MASKED)
  32. // ACPI OSC for Platform-Wide Capability
  33. #define OSC_CAP_CPPC_SUPPORT (1U << 5)
  34. #define OSC_CAP_CPPC2_SUPPORT (1U << 6)
  35. #define OSC_CAP_PLAT_COORDINATED_LPI (1U << 7)
  36. #define OSC_CAP_OS_INITIATED_LPI (1U << 8)
  37. // Cache type identifier used to calculate unique cache ID for PPTT
  38. typedef enum {
  39. L1DataCache = 1,
  40. L1InstructionCache,
  41. L2Cache,
  42. L3Cache,
  43. } RD_PPTT_CACHE_TYPE;
  44. #pragma pack(1)
  45. // PPTT processor core structure
  46. typedef struct {
  47. EFI_ACPI_6_4_PPTT_STRUCTURE_PROCESSOR Core;
  48. UINT32 ResourceOffset[2];
  49. EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE DCache;
  50. EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE ICache;
  51. EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE L2Cache;
  52. } RD_PPTT_CORE;
  53. // PPTT processor cluster structure
  54. typedef struct {
  55. EFI_ACPI_6_4_PPTT_STRUCTURE_PROCESSOR Cluster;
  56. UINT32 ResourceOffset;
  57. EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE L3Cache;
  58. RD_PPTT_CORE Core[CORE_COUNT];
  59. } RD_PPTT_CLUSTER;
  60. // PPTT processor cluster structure without cache
  61. typedef struct {
  62. EFI_ACPI_6_4_PPTT_STRUCTURE_PROCESSOR Cluster;
  63. RD_PPTT_CORE Core[CORE_COUNT];
  64. } RD_PPTT_MINIMAL_CLUSTER;
  65. // PPTT processor package structure
  66. typedef struct {
  67. EFI_ACPI_6_4_PPTT_STRUCTURE_PROCESSOR Package;
  68. RD_PPTT_MINIMAL_CLUSTER Cluster[CLUSTER_COUNT];
  69. } RD_PPTT_PACKAGE;
  70. #pragma pack ()
  71. //
  72. // PPTT processor structure flags for different SoC components as defined in
  73. // ACPI 6.4 specification
  74. //
  75. // Processor structure flags for SoC package
  76. #define PPTT_PROCESSOR_PACKAGE_FLAGS \
  77. { \
  78. EFI_ACPI_6_4_PPTT_PACKAGE_PHYSICAL, \
  79. EFI_ACPI_6_4_PPTT_PROCESSOR_ID_INVALID, \
  80. EFI_ACPI_6_4_PPTT_PROCESSOR_IS_NOT_THREAD, \
  81. EFI_ACPI_6_4_PPTT_NODE_IS_NOT_LEAF, \
  82. EFI_ACPI_6_4_PPTT_IMPLEMENTATION_IDENTICAL \
  83. }
  84. // Processor structure flags for cluster
  85. #define PPTT_PROCESSOR_CLUSTER_FLAGS \
  86. { \
  87. EFI_ACPI_6_4_PPTT_PACKAGE_NOT_PHYSICAL, \
  88. EFI_ACPI_6_4_PPTT_PROCESSOR_ID_VALID, \
  89. EFI_ACPI_6_4_PPTT_PROCESSOR_IS_NOT_THREAD, \
  90. EFI_ACPI_6_4_PPTT_NODE_IS_NOT_LEAF, \
  91. EFI_ACPI_6_4_PPTT_IMPLEMENTATION_IDENTICAL \
  92. }
  93. // Processor structure flags for cluster with multi-thread core
  94. #define PPTT_PROCESSOR_CLUSTER_THREADED_FLAGS \
  95. { \
  96. EFI_ACPI_6_4_PPTT_PACKAGE_NOT_PHYSICAL, \
  97. EFI_ACPI_6_4_PPTT_PROCESSOR_ID_INVALID, \
  98. EFI_ACPI_6_4_PPTT_PROCESSOR_IS_NOT_THREAD, \
  99. EFI_ACPI_6_4_PPTT_NODE_IS_NOT_LEAF, \
  100. EFI_ACPI_6_4_PPTT_IMPLEMENTATION_IDENTICAL \
  101. }
  102. // Processor structure flags for single-thread core
  103. #define PPTT_PROCESSOR_CORE_FLAGS \
  104. { \
  105. EFI_ACPI_6_4_PPTT_PACKAGE_NOT_PHYSICAL, \
  106. EFI_ACPI_6_4_PPTT_PROCESSOR_ID_VALID, \
  107. EFI_ACPI_6_4_PPTT_PROCESSOR_IS_NOT_THREAD, \
  108. EFI_ACPI_6_4_PPTT_NODE_IS_LEAF \
  109. }
  110. // Processor structure flags for multi-thread core
  111. #define PPTT_PROCESSOR_CORE_THREADED_FLAGS \
  112. { \
  113. EFI_ACPI_6_4_PPTT_PACKAGE_NOT_PHYSICAL, \
  114. EFI_ACPI_6_4_PPTT_PROCESSOR_ID_INVALID, \
  115. EFI_ACPI_6_4_PPTT_PROCESSOR_IS_NOT_THREAD, \
  116. EFI_ACPI_6_4_PPTT_NODE_IS_NOT_LEAF, \
  117. EFI_ACPI_6_4_PPTT_IMPLEMENTATION_IDENTICAL \
  118. }
  119. // Processor structure flags for CPU thread
  120. #define PPTT_PROCESSOR_THREAD_FLAGS \
  121. { \
  122. EFI_ACPI_6_4_PPTT_PACKAGE_NOT_PHYSICAL, \
  123. EFI_ACPI_6_4_PPTT_PROCESSOR_ID_VALID, \
  124. EFI_ACPI_6_4_PPTT_PROCESSOR_IS_THREAD, \
  125. EFI_ACPI_6_4_PPTT_NODE_IS_LEAF \
  126. }
  127. // PPTT cache structure flags as defined in ACPI 6.4 Specification
  128. #define PPTT_CACHE_STRUCTURE_FLAGS \
  129. { \
  130. EFI_ACPI_6_4_PPTT_CACHE_SIZE_VALID, \
  131. EFI_ACPI_6_4_PPTT_NUMBER_OF_SETS_VALID, \
  132. EFI_ACPI_6_4_PPTT_ASSOCIATIVITY_VALID, \
  133. EFI_ACPI_6_4_PPTT_ALLOCATION_TYPE_VALID, \
  134. EFI_ACPI_6_4_PPTT_CACHE_TYPE_VALID, \
  135. EFI_ACPI_6_4_PPTT_WRITE_POLICY_VALID, \
  136. EFI_ACPI_6_4_PPTT_LINE_SIZE_VALID, \
  137. EFI_ACPI_6_4_PPTT_CACHE_ID_VALID \
  138. }
  139. // PPTT cache attributes for data cache
  140. #define PPTT_DATA_CACHE_ATTR \
  141. { \
  142. EFI_ACPI_6_4_CACHE_ATTRIBUTES_ALLOCATION_READ_WRITE, \
  143. EFI_ACPI_6_4_CACHE_ATTRIBUTES_CACHE_TYPE_DATA, \
  144. EFI_ACPI_6_4_CACHE_ATTRIBUTES_WRITE_POLICY_WRITE_BACK \
  145. }
  146. // PPTT cache attributes for instruction cache
  147. #define PPTT_INST_CACHE_ATTR \
  148. { \
  149. EFI_ACPI_6_4_CACHE_ATTRIBUTES_ALLOCATION_READ, \
  150. EFI_ACPI_6_4_CACHE_ATTRIBUTES_CACHE_TYPE_INSTRUCTION, \
  151. EFI_ACPI_6_4_CACHE_ATTRIBUTES_WRITE_POLICY_WRITE_BACK \
  152. }
  153. // PPTT cache attributes for unified cache
  154. #define PPTT_UNIFIED_CACHE_ATTR \
  155. { \
  156. EFI_ACPI_6_4_CACHE_ATTRIBUTES_ALLOCATION_READ_WRITE, \
  157. EFI_ACPI_6_4_CACHE_ATTRIBUTES_CACHE_TYPE_UNIFIED, \
  158. EFI_ACPI_6_4_CACHE_ATTRIBUTES_WRITE_POLICY_WRITE_BACK \
  159. }
  160. /** Helper macro to calculate a unique cache ID
  161. Macro to calculate a unique 32 bit cache ID. The 32-bit encoding format of the
  162. cache ID is
  163. * Bits[31:24]: Unused
  164. * Bits[23:20]: Package number the cache belongs to
  165. * Bits[19:12]: Cluster number the cache belongs to (0, if not a cluster cache)
  166. * Bits[11:4] : Core number the cache belongs to (0, if not a CPU cache)
  167. * Bits[3:0] : Cache Type (as defined by RD_PPTT_CACHE_TYPE)
  168. Note: Cache ID zero is invalid as per ACPI 6.4 specification. Also this
  169. calculation is not based on any specification.
  170. @param [in] PackageId Package instance number.
  171. @param [in] ClusterId Cluster instance number (for Cluster cache, 0 otherwise)
  172. @param [in] CpuId CPU instance number (for CPU cache, 0 otherwise).
  173. @param [in] CacheType Identifier for cache type as defined by
  174. RD_PPTT_CACHE_TYPE.
  175. **/
  176. #define RD_PPTT_CACHE_ID(PackageId, ClusterId, CoreId, CacheType) \
  177. ( \
  178. (((PackageId) & 0xF) << 20) | (((ClusterId) & 0xFF) << 12) | \
  179. (((CoreId) & 0xFF) << 4) | ((CacheType) & 0xF) \
  180. )
  181. // A macro to initialise the common header part of EFI ACPI tables as defined by
  182. // EFI_ACPI_DESCRIPTION_HEADER structure.
  183. #define ARM_ACPI_HEADER(Signature, Type, Revision) { \
  184. Signature, /* UINT32 Signature */ \
  185. sizeof (Type), /* UINT32 Length */ \
  186. Revision, /* UINT8 Revision */ \
  187. 0, /* UINT8 Checksum */ \
  188. { EFI_ACPI_ARM_OEM_ID }, /* UINT8 OemId[6] */ \
  189. EFI_ACPI_ARM_OEM_TABLE_ID, /* UINT64 OemTableId */ \
  190. EFI_ACPI_ARM_OEM_REVISION, /* UINT32 OemRevision */ \
  191. EFI_ACPI_ARM_CREATOR_ID, /* UINT32 CreatorId */ \
  192. EFI_ACPI_ARM_CREATOR_REVISION /* UINT32 CreatorRevision */ \
  193. }
  194. // EFI_ACPI_6_4_GIC_STRUCTURE
  195. #define EFI_ACPI_6_4_GICC_STRUCTURE_INIT(GicId, AcpiCpuUid, Mpidr, Flags, \
  196. PmuIrq, GicBase, GicVBase, GicHBase, GsivId, GicRBase, Efficiency, \
  197. SpeOverflowInterrupt) \
  198. { \
  199. EFI_ACPI_6_4_GIC, /* Type */ \
  200. sizeof (EFI_ACPI_6_4_GIC_STRUCTURE), /* Length */ \
  201. EFI_ACPI_RESERVED_WORD, /* Reserved */ \
  202. GicId, /* CPUInterfaceNumber */ \
  203. AcpiCpuUid, /* AcpiProcessorUid */ \
  204. Flags, /* Flags */ \
  205. 0, /* ParkingProtocolVersion */ \
  206. PmuIrq, /* PerformanceInterruptGsiv */ \
  207. 0, /* ParkedAddress */ \
  208. GicBase, /* PhysicalBaseAddress */ \
  209. GicVBase, /* GICV */ \
  210. GicHBase, /* GICH */ \
  211. GsivId, /* VGICMaintenanceInterrupt */ \
  212. GicRBase, /* GICRBaseAddress */ \
  213. Mpidr, /* MPIDR */ \
  214. Efficiency, /* ProcessorPowerEfficiencyClass */ \
  215. EFI_ACPI_RESERVED_BYTE, /* Reserved2 */ \
  216. SpeOverflowInterrupt /* SpeOverflowInterrupt */ \
  217. }
  218. // EFI_ACPI_6_4_GIC_DISTRIBUTOR_STRUCTURE
  219. #define EFI_ACPI_6_4_GIC_DISTRIBUTOR_INIT(GicDistHwId, GicDistBase, \
  220. GicDistVector, GicVersion) \
  221. { \
  222. EFI_ACPI_6_4_GICD, /* Type */ \
  223. sizeof (EFI_ACPI_6_4_GIC_DISTRIBUTOR_STRUCTURE), \
  224. EFI_ACPI_RESERVED_WORD, /* Reserved1 */ \
  225. GicDistHwId, /* GicId */ \
  226. GicDistBase, /* PhysicalBaseAddress */ \
  227. GicDistVector, /* SystemVectorBase */ \
  228. GicVersion, /* GicVersion */ \
  229. { \
  230. EFI_ACPI_RESERVED_BYTE, /* Reserved2[0] */ \
  231. EFI_ACPI_RESERVED_BYTE, /* Reserved2[1] */ \
  232. EFI_ACPI_RESERVED_BYTE /* Reserved2[2] */ \
  233. } \
  234. }
  235. // EFI_ACPI_6_4_GICR_STRUCTURE
  236. #define EFI_ACPI_6_4_GIC_REDISTRIBUTOR_INIT(RedisRegionAddr, RedisDiscLength) \
  237. { \
  238. EFI_ACPI_6_4_GICR, /* Type */ \
  239. sizeof (EFI_ACPI_6_4_GICR_STRUCTURE), /* Length */ \
  240. EFI_ACPI_RESERVED_WORD, /* Reserved */ \
  241. RedisRegionAddr, /* DiscoveryRangeBaseAddress */ \
  242. RedisDiscLength /* DiscoveryRangeLength */ \
  243. }
  244. // EFI_ACPI_6_4_GIC_ITS_STRUCTURE
  245. #define EFI_ACPI_6_4_GIC_ITS_INIT(GicItsId, GicItsBase) \
  246. { \
  247. EFI_ACPI_6_4_GIC_ITS, /* Type */ \
  248. sizeof (EFI_ACPI_6_4_GIC_ITS_STRUCTURE), \
  249. EFI_ACPI_RESERVED_WORD, /* Reserved */ \
  250. GicItsId, /* GicItsId */ \
  251. GicItsBase, /* PhysicalBaseAddress */ \
  252. EFI_ACPI_RESERVED_DWORD /* DiscoveryRangeLength */ \
  253. }
  254. // EFI_ACPI_6_4_MEMORY_AFFINITY_STRUCTURE
  255. #define EFI_ACPI_6_4_MEMORY_AFFINITY_STRUCTURE_INIT( \
  256. ProximityDomain, Base, Length, Flags) \
  257. { \
  258. 1, sizeof (EFI_ACPI_6_4_MEMORY_AFFINITY_STRUCTURE), ProximityDomain, \
  259. EFI_ACPI_RESERVED_WORD, (Base) & 0xffffffff, \
  260. (Base) >> 32, (Length) & 0xffffffff, \
  261. (Length) >> 32, EFI_ACPI_RESERVED_DWORD, Flags, \
  262. EFI_ACPI_RESERVED_QWORD \
  263. }
  264. // EFI_ACPI_6_4_GICC_AFFINITY_STRUCTURE
  265. #define EFI_ACPI_6_4_GICC_AFFINITY_STRUCTURE_INIT( \
  266. ProximityDomain, ACPIProcessorUID, Flags, ClockDomain) \
  267. { \
  268. 3, sizeof (EFI_ACPI_6_4_GICC_AFFINITY_STRUCTURE), ProximityDomain, \
  269. ACPIProcessorUID, Flags, ClockDomain \
  270. }
  271. //
  272. // HMAT related structures
  273. //
  274. // Memory Proximity Domain Attributes Structure
  275. // Refer Section 5.2.27.3 in ACPI Specification, Version 6.4
  276. #define EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES_INIT( \
  277. Flags, ProximityDomainForAttachedIntiator, ProximityDomainForMemory) \
  278. { \
  279. EFI_ACPI_6_4_HMAT_TYPE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES, \
  280. { \
  281. EFI_ACPI_RESERVED_BYTE, \
  282. EFI_ACPI_RESERVED_BYTE \
  283. }, \
  284. sizeof (EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES), \
  285. { \
  286. Flags, \
  287. 0 \
  288. }, \
  289. { \
  290. EFI_ACPI_RESERVED_BYTE, \
  291. EFI_ACPI_RESERVED_BYTE \
  292. }, \
  293. ProximityDomainForAttachedIntiator, \
  294. ProximityDomainForMemory, \
  295. { \
  296. EFI_ACPI_RESERVED_BYTE, \
  297. EFI_ACPI_RESERVED_BYTE, \
  298. EFI_ACPI_RESERVED_BYTE, \
  299. EFI_ACPI_RESERVED_BYTE, \
  300. EFI_ACPI_RESERVED_BYTE, \
  301. EFI_ACPI_RESERVED_BYTE, \
  302. EFI_ACPI_RESERVED_BYTE, \
  303. EFI_ACPI_RESERVED_BYTE, \
  304. EFI_ACPI_RESERVED_BYTE, \
  305. EFI_ACPI_RESERVED_BYTE, \
  306. EFI_ACPI_RESERVED_BYTE, \
  307. EFI_ACPI_RESERVED_BYTE, \
  308. EFI_ACPI_RESERVED_BYTE, \
  309. EFI_ACPI_RESERVED_BYTE, \
  310. EFI_ACPI_RESERVED_BYTE, \
  311. EFI_ACPI_RESERVED_BYTE, \
  312. EFI_ACPI_RESERVED_BYTE, \
  313. EFI_ACPI_RESERVED_BYTE, \
  314. EFI_ACPI_RESERVED_BYTE, \
  315. EFI_ACPI_RESERVED_BYTE \
  316. } \
  317. }
  318. // System Locality Latency and Bandwidth Information Structure
  319. // Refer Section 5.2.27.4 in ACPI Specification, Version 6.4
  320. #define EFI_ACPI_6_4_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO_INIT( \
  321. Flags, DataType, MinTransferSize, NumInitiatorProximityDomains, \
  322. NumTargetProximityDomains, EntryBaseUnit) \
  323. { \
  324. EFI_ACPI_6_4_HMAT_TYPE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO, \
  325. { \
  326. EFI_ACPI_RESERVED_BYTE, \
  327. EFI_ACPI_RESERVED_BYTE \
  328. }, \
  329. sizeof (EFI_ACPI_6_4_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO) + \
  330. (4 * NumInitiatorProximityDomains) + (4 * NumTargetProximityDomains) + \
  331. (2 * NumInitiatorProximityDomains * NumTargetProximityDomains), \
  332. { \
  333. Flags, \
  334. 0, \
  335. 0 \
  336. }, \
  337. MinTransferSize, \
  338. DataType, \
  339. EFI_ACPI_RESERVED_BYTE, \
  340. NumInitiatorProximityDomains, \
  341. NumTargetProximityDomains, \
  342. { \
  343. EFI_ACPI_RESERVED_BYTE, \
  344. EFI_ACPI_RESERVED_BYTE, \
  345. EFI_ACPI_RESERVED_BYTE, \
  346. EFI_ACPI_RESERVED_BYTE \
  347. }, \
  348. EntryBaseUnit \
  349. }
  350. // Memory Side Cache Information Structure
  351. // Refer Section 5.2.27.5 in ACPI Specification, Version 6.4
  352. #define EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_INIT( \
  353. MemoryProximityDomain, MemorySideCacheSize, CacheAttributes, \
  354. NumberOfSmbiosHandles) \
  355. { \
  356. EFI_ACPI_6_4_HMAT_TYPE_MEMORY_SIDE_CACHE_INFO, \
  357. { \
  358. EFI_ACPI_RESERVED_BYTE, \
  359. EFI_ACPI_RESERVED_BYTE \
  360. }, \
  361. sizeof (EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO) + \
  362. (NumberOfSmbiosHandles * 2), \
  363. MemoryProximityDomain, \
  364. { \
  365. EFI_ACPI_RESERVED_BYTE, \
  366. EFI_ACPI_RESERVED_BYTE, \
  367. EFI_ACPI_RESERVED_BYTE, \
  368. EFI_ACPI_RESERVED_BYTE \
  369. }, \
  370. MemorySideCacheSize, \
  371. CacheAttributes, \
  372. { \
  373. EFI_ACPI_RESERVED_BYTE, \
  374. EFI_ACPI_RESERVED_BYTE \
  375. }, \
  376. NumberOfSmbiosHandles \
  377. }
  378. /** A macro to initialise the Memory Side Cache Information Attributes.
  379. See Table 5.130 in ACPI Specification, Version 6.4
  380. @param [in] TotalCacheLevels Total Cache Levels for this Memory Proximity.
  381. @param [in] CacheLevel Cache Level described in this structure.
  382. @param [in] CacheAssociativity Cache Associativity.
  383. @param [in] WritePolicy Write Policy.
  384. @param [in] CacheLineSize Cache Line size in bytes.
  385. **/
  386. #define HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES_INIT( \
  387. TotalCacheLevels, CacheLevel, CacheAssociativity, WritePolicy, CacheLineSize \
  388. ) \
  389. { \
  390. TotalCacheLevels, CacheLevel, CacheAssociativity, WritePolicy, CacheLineSize \
  391. }
  392. // EFI_ACPI_6_4_PPTT_STRUCTURE_PROCESSOR
  393. #define EFI_ACPI_6_4_PPTT_STRUCTURE_PROCESSOR_INIT(Length, Flag, Parent, \
  394. ACPIProcessorID, NumberOfPrivateResource) \
  395. { \
  396. EFI_ACPI_6_4_PPTT_TYPE_PROCESSOR, /* Type 0 */ \
  397. Length, /* Length */ \
  398. { \
  399. EFI_ACPI_RESERVED_BYTE, \
  400. EFI_ACPI_RESERVED_BYTE, \
  401. }, \
  402. Flag, /* Processor flags */ \
  403. Parent, /* Ref to parent node */ \
  404. ACPIProcessorID, /* UID, as per MADT */ \
  405. NumberOfPrivateResource /* Resource count */ \
  406. }
  407. // EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE
  408. #define EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE_INIT(Flag, NextLevelCache, Size, \
  409. NoOfSets, Associativity, Attributes, LineSize, CacheId) \
  410. { \
  411. EFI_ACPI_6_4_PPTT_TYPE_CACHE, /* Type 1 */ \
  412. sizeof (EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE), /* Length */ \
  413. { \
  414. EFI_ACPI_RESERVED_BYTE, \
  415. EFI_ACPI_RESERVED_BYTE, \
  416. }, \
  417. Flag, /* Cache flags */ \
  418. NextLevelCache, /* Ref to next level */ \
  419. Size, /* Size in bytes */ \
  420. NoOfSets, /* Num of sets */ \
  421. Associativity, /* Num of ways */ \
  422. Attributes, /* Cache attributes */ \
  423. LineSize, /* Line size in bytes */ \
  424. CacheId /* Cache id */ \
  425. }
  426. /** Helper macro for CPPC _CPC object initialization. Use of this macro is
  427. restricted to ASL file and not to TDL file.
  428. @param [in] DesiredPerfReg Fastchannel address for desired performance
  429. register.
  430. @param [in] PerfLimitedReg Fastchannel address for performance limited
  431. register.
  432. @param [in] GranularityMHz Granularity of the performance scale.
  433. @param [in] HighestPerf Highest performance in linear scale.
  434. @param [in] NominalPerf Nominal performance in linear scale.
  435. @param [in] LowestNonlinearPerf Lowest non-linear performnce in linear
  436. scale.
  437. @param [in] LowestPerf Lowest performance in linear scale.
  438. @param [in] RefPerf Reference performance in linear scale.
  439. **/
  440. #define CPPC_PACKAGE_INIT(DesiredPerfReg, PerfLimitedReg, GranularityMHz, \
  441. HighestPerf, NominalPerf, LowestNonlinearPerf, LowestPerf, RefPerf) \
  442. { \
  443. 23, /* NumEntries */ \
  444. 3, /* Revision */ \
  445. HighestPerf, /* Highest Performance */ \
  446. NominalPerf, /* Nominal Performance */ \
  447. LowestNonlinearPerf, /* Lowest Nonlinear Performance */ \
  448. LowestPerf, /* Lowest Performance */ \
  449. /* Guaranteed Performance Register */ \
  450. ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, \
  451. /* Desired Performance Register */ \
  452. ResourceTemplate () { Register (SystemMemory, 32, 0, DesiredPerfReg, 3) }, \
  453. /* Minimum Performance Register */ \
  454. ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, \
  455. /* Maximum Performance Register */ \
  456. ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, \
  457. /* Performance Reduction Tolerance Register */ \
  458. ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, \
  459. /* Time Window Register */ \
  460. ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, \
  461. /* Counter Wraparound Time */ \
  462. ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, \
  463. /* Reference Performance Counter Register */ \
  464. ResourceTemplate () { Register (FFixedHW, 64, 0, 1, 4) }, \
  465. /* Delivered Performance Counter Register */ \
  466. ResourceTemplate () { Register (FFixedHW, 64, 0, 0, 4) }, \
  467. /* Performance Limited Register */ \
  468. ResourceTemplate () { Register (SystemMemory, 32, 0, PerfLimitedReg, 3) }, \
  469. /* CPPC Enable Register */ \
  470. ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, \
  471. /* Autonomous Selection Enable Register */ \
  472. ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, \
  473. /* Autonomous Activity Window Register */ \
  474. ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, \
  475. /* Energy Performance Preference Register */ \
  476. ResourceTemplate () { Register (SystemMemory, 0, 0, 0, 0) }, \
  477. RefPerf, /* Reference Performance */ \
  478. (LowestPerf * GranularityMHz), /* Lowest Frequency */ \
  479. (NominalPerf * GranularityMHz), /* Nominal Frequency */ \
  480. }
  481. // Power state dependancy (_PSD) for CPPC
  482. /** Helper macro to initialize Power state dependancy (_PSD) object required
  483. for CPPC. Use of this macro is restricted to ASL file and not to TDL file.
  484. @param [in] Domain The dependency domain number to which this
  485. P-state entry belongs.
  486. **/
  487. #define PSD_INIT(Domain) \
  488. { \
  489. 5, /* Entries */ \
  490. 0, /* Revision */ \
  491. Domain, /* Domain */ \
  492. 0xFD, /* Coord Type- SW_ANY */ \
  493. 1 /* Processors */ \
  494. }
  495. #endif /* __SGI_ACPI_HEADER__ */