reg_fields.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * AMD Address Translation Library
  4. *
  5. * reg_fields.h : Register field definitions
  6. *
  7. * Copyright (c) 2023, Advanced Micro Devices, Inc.
  8. * All Rights Reserved.
  9. *
  10. * Author: Yazen Ghannam <Yazen.Ghannam@amd.com>
  11. */
  12. /*
  13. * Notes on naming:
  14. * 1) Use "DF_" prefix for fields that are the same for all revisions.
  15. * 2) Use "DFx_" prefix for fields that differ between revisions.
  16. * a) "x" is the first major revision where the new field appears.
  17. * b) E.g., if DF2 and DF3 have the same field, then call it DF2.
  18. * c) E.g., if DF3p5 and DF4 have the same field, then call it DF4.
  19. */
  20. /*
  21. * Coherent Station Fabric ID
  22. *
  23. * Access type: Instance
  24. *
  25. * Register
  26. * Rev Fieldname Bits
  27. *
  28. * D18F0x50 [Fabric Block Instance Information 3]
  29. * DF2 BlockFabricId [19:8]
  30. * DF3 BlockFabricId [19:8]
  31. * DF3p5 BlockFabricId [19:8]
  32. * DF4 BlockFabricId [19:8]
  33. * DF4p5 BlockFabricId [15:8]
  34. */
  35. #define DF2_COH_ST_FABRIC_ID GENMASK(19, 8)
  36. #define DF4p5_COH_ST_FABRIC_ID GENMASK(15, 8)
  37. /*
  38. * Component ID Mask
  39. *
  40. * Access type: Broadcast
  41. *
  42. * Register
  43. * Rev Fieldname Bits
  44. *
  45. * DF2 N/A
  46. *
  47. * D18F1x208 [System Fabric ID Mask 0]
  48. * DF3 ComponentIdMask [9:0]
  49. *
  50. * D18F1x150 [System Fabric ID Mask 0]
  51. * DF3p5 ComponentIdMask [15:0]
  52. *
  53. * D18F4x1B0 [System Fabric ID Mask 0]
  54. * DF4 ComponentIdMask [15:0]
  55. * DF4p5 ComponentIdMask [15:0]
  56. */
  57. #define DF3_COMPONENT_ID_MASK GENMASK(9, 0)
  58. #define DF4_COMPONENT_ID_MASK GENMASK(15, 0)
  59. /*
  60. * Destination Fabric ID
  61. *
  62. * Access type: Instance
  63. *
  64. * Register
  65. * Rev Fieldname Bits
  66. *
  67. * D18F0x114 [DRAM Limit Address]
  68. * DF2 DstFabricID [7:0]
  69. * DF3 DstFabricID [9:0]
  70. * DF3 DstFabricID [11:0]
  71. *
  72. * D18F7xE08 [DRAM Address Control]
  73. * DF4 DstFabricID [27:16]
  74. *
  75. * D18F7x208 [DRAM Address Control]
  76. * DF4p5 DstFabricID [23:16]
  77. */
  78. #define DF2_DST_FABRIC_ID GENMASK(7, 0)
  79. #define DF3_DST_FABRIC_ID GENMASK(9, 0)
  80. #define DF3p5_DST_FABRIC_ID GENMASK(11, 0)
  81. #define DF4_DST_FABRIC_ID GENMASK(27, 16)
  82. #define DF4p5_DST_FABRIC_ID GENMASK(23, 16)
  83. /*
  84. * Die ID Mask
  85. *
  86. * Access type: Broadcast
  87. *
  88. * Register
  89. * Rev Fieldname Bits
  90. *
  91. * D18F1x208 [System Fabric ID Mask]
  92. * DF2 DieIdMask [15:8]
  93. *
  94. * D18F1x20C [System Fabric ID Mask 1]
  95. * DF3 DieIdMask [18:16]
  96. *
  97. * D18F1x158 [System Fabric ID Mask 2]
  98. * DF3p5 DieIdMask [15:0]
  99. *
  100. * D18F4x1B8 [System Fabric ID Mask 2]
  101. * DF4 DieIdMask [15:0]
  102. * DF4p5 DieIdMask [15:0]
  103. */
  104. #define DF2_DIE_ID_MASK GENMASK(15, 8)
  105. #define DF3_DIE_ID_MASK GENMASK(18, 16)
  106. #define DF4_DIE_ID_MASK GENMASK(15, 0)
  107. /*
  108. * Die ID Shift
  109. *
  110. * Access type: Broadcast
  111. *
  112. * Register
  113. * Rev Fieldname Bits
  114. *
  115. * D18F1x208 [System Fabric ID Mask]
  116. * DF2 DieIdShift [27:24]
  117. *
  118. * DF3 N/A
  119. * DF3p5 N/A
  120. * DF4 N/A
  121. * DF4p5 N/A
  122. */
  123. #define DF2_DIE_ID_SHIFT GENMASK(27, 24)
  124. /*
  125. * DRAM Address Range Valid
  126. *
  127. * Access type: Instance
  128. *
  129. * Register
  130. * Rev Fieldname Bits
  131. *
  132. * D18F0x110 [DRAM Base Address]
  133. * DF2 AddrRngVal [0]
  134. * DF3 AddrRngVal [0]
  135. * DF3p5 AddrRngVal [0]
  136. *
  137. * D18F7xE08 [DRAM Address Control]
  138. * DF4 AddrRngVal [0]
  139. *
  140. * D18F7x208 [DRAM Address Control]
  141. * DF4p5 AddrRngVal [0]
  142. */
  143. #define DF_ADDR_RANGE_VAL BIT(0)
  144. /*
  145. * DRAM Base Address
  146. *
  147. * Access type: Instance
  148. *
  149. * Register
  150. * Rev Fieldname Bits
  151. *
  152. * D18F0x110 [DRAM Base Address]
  153. * DF2 DramBaseAddr [31:12]
  154. * DF3 DramBaseAddr [31:12]
  155. * DF3p5 DramBaseAddr [31:12]
  156. *
  157. * D18F7xE00 [DRAM Base Address]
  158. * DF4 DramBaseAddr [27:0]
  159. *
  160. * D18F7x200 [DRAM Base Address]
  161. * DF4p5 DramBaseAddr [27:0]
  162. */
  163. #define DF2_BASE_ADDR GENMASK(31, 12)
  164. #define DF4_BASE_ADDR GENMASK(27, 0)
  165. /*
  166. * DRAM Hole Base
  167. *
  168. * Access type: Broadcast
  169. *
  170. * Register
  171. * Rev Fieldname Bits
  172. *
  173. * D18F0x104 [DRAM Hole Control]
  174. * DF2 DramHoleBase [31:24]
  175. * DF3 DramHoleBase [31:24]
  176. * DF3p5 DramHoleBase [31:24]
  177. *
  178. * D18F7x104 [DRAM Hole Control]
  179. * DF4 DramHoleBase [31:24]
  180. * DF4p5 DramHoleBase [31:24]
  181. */
  182. #define DF_DRAM_HOLE_BASE_MASK GENMASK(31, 24)
  183. /*
  184. * DRAM Limit Address
  185. *
  186. * Access type: Instance
  187. *
  188. * Register
  189. * Rev Fieldname Bits
  190. *
  191. * D18F0x114 [DRAM Limit Address]
  192. * DF2 DramLimitAddr [31:12]
  193. * DF3 DramLimitAddr [31:12]
  194. * DF3p5 DramLimitAddr [31:12]
  195. *
  196. * D18F7xE04 [DRAM Limit Address]
  197. * DF4 DramLimitAddr [27:0]
  198. *
  199. * D18F7x204 [DRAM Limit Address]
  200. * DF4p5 DramLimitAddr [27:0]
  201. */
  202. #define DF2_DRAM_LIMIT_ADDR GENMASK(31, 12)
  203. #define DF4_DRAM_LIMIT_ADDR GENMASK(27, 0)
  204. /*
  205. * Hash Interleave Controls
  206. *
  207. * Access type: Instance
  208. *
  209. * Register
  210. * Rev Fieldname Bits
  211. *
  212. * DF2 N/A
  213. *
  214. * D18F0x3F8 [DF Global Control]
  215. * DF3 GlbHashIntlvCtl64K [20]
  216. * GlbHashIntlvCtl2M [21]
  217. * GlbHashIntlvCtl1G [22]
  218. *
  219. * DF3p5 GlbHashIntlvCtl64K [20]
  220. * GlbHashIntlvCtl2M [21]
  221. * GlbHashIntlvCtl1G [22]
  222. *
  223. * D18F7xE08 [DRAM Address Control]
  224. * DF4 HashIntlvCtl64K [8]
  225. * HashIntlvCtl2M [9]
  226. * HashIntlvCtl1G [10]
  227. *
  228. * D18F7x208 [DRAM Address Control]
  229. * DF4p5 HashIntlvCtl4K [7]
  230. * HashIntlvCtl64K [8]
  231. * HashIntlvCtl2M [9]
  232. * HashIntlvCtl1G [10]
  233. * HashIntlvCtl1T [15]
  234. */
  235. #define DF3_HASH_CTL_64K BIT(20)
  236. #define DF3_HASH_CTL_2M BIT(21)
  237. #define DF3_HASH_CTL_1G BIT(22)
  238. #define DF4_HASH_CTL_64K BIT(8)
  239. #define DF4_HASH_CTL_2M BIT(9)
  240. #define DF4_HASH_CTL_1G BIT(10)
  241. #define DF4p5_HASH_CTL_4K BIT(7)
  242. #define DF4p5_HASH_CTL_1T BIT(15)
  243. /*
  244. * High Address Offset
  245. *
  246. * Access type: Instance
  247. *
  248. * Register
  249. * Rev Fieldname Bits
  250. *
  251. * D18F0x1B4 [DRAM Offset]
  252. * DF2 HiAddrOffset [31:20]
  253. * DF3 HiAddrOffset [31:12]
  254. * DF3p5 HiAddrOffset [31:12]
  255. *
  256. * D18F7x140 [DRAM Offset]
  257. * DF4 HiAddrOffset [24:1]
  258. * DF4p5 HiAddrOffset [24:1]
  259. * MI300 HiAddrOffset [31:1]
  260. */
  261. #define DF2_HI_ADDR_OFFSET GENMASK(31, 20)
  262. #define DF3_HI_ADDR_OFFSET GENMASK(31, 12)
  263. /* Follow reference code by including reserved bits for simplicity. */
  264. #define DF4_HI_ADDR_OFFSET GENMASK(31, 1)
  265. /*
  266. * High Address Offset Enable
  267. *
  268. * Access type: Instance
  269. *
  270. * Register
  271. * Rev Fieldname Bits
  272. *
  273. * D18F0x1B4 [DRAM Offset]
  274. * DF2 HiAddrOffsetEn [0]
  275. * DF3 HiAddrOffsetEn [0]
  276. * DF3p5 HiAddrOffsetEn [0]
  277. *
  278. * D18F7x140 [DRAM Offset]
  279. * DF4 HiAddrOffsetEn [0]
  280. * DF4p5 HiAddrOffsetEn [0]
  281. */
  282. #define DF_HI_ADDR_OFFSET_EN BIT(0)
  283. /*
  284. * Interleave Address Select
  285. *
  286. * Access type: Instance
  287. *
  288. * Register
  289. * Rev Fieldname Bits
  290. *
  291. * D18F0x110 [DRAM Base Address]
  292. * DF2 IntLvAddrSel [10:8]
  293. * DF3 IntLvAddrSel [11:9]
  294. * DF3p5 IntLvAddrSel [11:9]
  295. *
  296. * D18F7xE0C [DRAM Address Interleave]
  297. * DF4 IntLvAddrSel [2:0]
  298. *
  299. * D18F7x20C [DRAM Address Interleave]
  300. * DF4p5 IntLvAddrSel [2:0]
  301. */
  302. #define DF2_INTLV_ADDR_SEL GENMASK(10, 8)
  303. #define DF3_INTLV_ADDR_SEL GENMASK(11, 9)
  304. #define DF4_INTLV_ADDR_SEL GENMASK(2, 0)
  305. /*
  306. * Interleave Number of Channels
  307. *
  308. * Access type: Instance
  309. *
  310. * Register
  311. * Rev Fieldname Bits
  312. *
  313. * D18F0x110 [DRAM Base Address]
  314. * DF2 IntLvNumChan [7:4]
  315. * DF3 IntLvNumChan [5:2]
  316. * DF3p5 IntLvNumChan [6:2]
  317. *
  318. * D18F7xE0C [DRAM Address Interleave]
  319. * DF4 IntLvNumChan [8:4]
  320. *
  321. * D18F7x20C [DRAM Address Interleave]
  322. * DF4p5 IntLvNumChan [9:4]
  323. */
  324. #define DF2_INTLV_NUM_CHAN GENMASK(7, 4)
  325. #define DF3_INTLV_NUM_CHAN GENMASK(5, 2)
  326. #define DF3p5_INTLV_NUM_CHAN GENMASK(6, 2)
  327. #define DF4_INTLV_NUM_CHAN GENMASK(8, 4)
  328. #define DF4p5_INTLV_NUM_CHAN GENMASK(9, 4)
  329. /*
  330. * Interleave Number of Dies
  331. *
  332. * Access type: Instance
  333. *
  334. * Register
  335. * Rev Fieldname Bits
  336. *
  337. * D18F0x114 [DRAM Limit Address]
  338. * DF2 IntLvNumDies [11:10]
  339. *
  340. * D18F0x110 [DRAM Base Address]
  341. * DF3 IntLvNumDies [7:6]
  342. * DF3p5 IntLvNumDies [7]
  343. *
  344. * D18F7xE0C [DRAM Address Interleave]
  345. * DF4 IntLvNumDies [13:12]
  346. *
  347. * D18F7x20C [DRAM Address Interleave]
  348. * DF4p5 IntLvNumDies [13:12]
  349. */
  350. #define DF2_INTLV_NUM_DIES GENMASK(11, 10)
  351. #define DF3_INTLV_NUM_DIES GENMASK(7, 6)
  352. #define DF3p5_INTLV_NUM_DIES BIT(7)
  353. #define DF4_INTLV_NUM_DIES GENMASK(13, 12)
  354. /*
  355. * Interleave Number of Sockets
  356. *
  357. * Access type: Instance
  358. *
  359. * Register
  360. * Rev Fieldname Bits
  361. *
  362. * D18F0x114 [DRAM Limit Address]
  363. * DF2 IntLvNumSockets [8]
  364. *
  365. * D18F0x110 [DRAM Base Address]
  366. * DF3 IntLvNumSockets [8]
  367. * DF3p5 IntLvNumSockets [8]
  368. *
  369. * D18F7xE0C [DRAM Address Interleave]
  370. * DF4 IntLvNumSockets [18]
  371. *
  372. * D18F7x20C [DRAM Address Interleave]
  373. * DF4p5 IntLvNumSockets [18]
  374. */
  375. #define DF2_INTLV_NUM_SOCKETS BIT(8)
  376. #define DF4_INTLV_NUM_SOCKETS BIT(18)
  377. /*
  378. * Legacy MMIO Hole Enable
  379. *
  380. * Access type: Instance
  381. *
  382. * Register
  383. * Rev Fieldname Bits
  384. *
  385. * D18F0x110 [DRAM Base Address]
  386. * DF2 LgcyMmioHoleEn [1]
  387. * DF3 LgcyMmioHoleEn [1]
  388. * DF3p5 LgcyMmioHoleEn [1]
  389. *
  390. * D18F7xE08 [DRAM Address Control]
  391. * DF4 LgcyMmioHoleEn [1]
  392. *
  393. * D18F7x208 [DRAM Address Control]
  394. * DF4p5 LgcyMmioHoleEn [1]
  395. */
  396. #define DF_LEGACY_MMIO_HOLE_EN BIT(1)
  397. /*
  398. * Log2 Address 64K Space 0
  399. *
  400. * Access type: Instance
  401. *
  402. * Register
  403. * Rev Fieldname Bits
  404. *
  405. * DF2 N/A
  406. *
  407. * D18F2x90 [Non-power-of-2 channel Configuration Register for COH_ST DRAM Address Maps]
  408. * DF3 Log2Addr64KSpace0 [5:0]
  409. *
  410. * DF3p5 N/A
  411. * DF4 N/A
  412. * DF4p5 N/A
  413. */
  414. #define DF_LOG2_ADDR_64K_SPACE0 GENMASK(5, 0)
  415. /*
  416. * Major Revision
  417. *
  418. * Access type: Broadcast
  419. *
  420. * Register
  421. * Rev Fieldname Bits
  422. *
  423. * DF2 N/A
  424. * DF3 N/A
  425. * DF3p5 N/A
  426. *
  427. * D18F0x040 [Fabric Block Instance Count]
  428. * DF4 MajorRevision [27:24]
  429. * DF4p5 MajorRevision [27:24]
  430. */
  431. #define DF_MAJOR_REVISION GENMASK(27, 24)
  432. /*
  433. * Minor Revision
  434. *
  435. * Access type: Broadcast
  436. *
  437. * Register
  438. * Rev Fieldname Bits
  439. *
  440. * DF2 N/A
  441. * DF3 N/A
  442. * DF3p5 N/A
  443. *
  444. * D18F0x040 [Fabric Block Instance Count]
  445. * DF4 MinorRevision [23:16]
  446. * DF4p5 MinorRevision [23:16]
  447. */
  448. #define DF_MINOR_REVISION GENMASK(23, 16)
  449. /*
  450. * Node ID Mask
  451. *
  452. * Access type: Broadcast
  453. *
  454. * Register
  455. * Rev Fieldname Bits
  456. *
  457. * DF2 N/A
  458. *
  459. * D18F1x208 [System Fabric ID Mask 0]
  460. * DF3 NodeIdMask [25:16]
  461. *
  462. * D18F1x150 [System Fabric ID Mask 0]
  463. * DF3p5 NodeIdMask [31:16]
  464. *
  465. * D18F4x1B0 [System Fabric ID Mask 0]
  466. * DF4 NodeIdMask [31:16]
  467. * DF4p5 NodeIdMask [31:16]
  468. */
  469. #define DF3_NODE_ID_MASK GENMASK(25, 16)
  470. #define DF4_NODE_ID_MASK GENMASK(31, 16)
  471. /*
  472. * Node ID Shift
  473. *
  474. * Access type: Broadcast
  475. *
  476. * Register
  477. * Rev Fieldname Bits
  478. *
  479. * DF2 N/A
  480. *
  481. * D18F1x20C [System Fabric ID Mask 1]
  482. * DF3 NodeIdShift [3:0]
  483. *
  484. * D18F1x154 [System Fabric ID Mask 1]
  485. * DF3p5 NodeIdShift [3:0]
  486. *
  487. * D18F4x1B4 [System Fabric ID Mask 1]
  488. * DF4 NodeIdShift [3:0]
  489. * DF4p5 NodeIdShift [3:0]
  490. */
  491. #define DF3_NODE_ID_SHIFT GENMASK(3, 0)
  492. /*
  493. * Remap Enable
  494. *
  495. * Access type: Instance
  496. *
  497. * Register
  498. * Rev Fieldname Bits
  499. *
  500. * DF2 N/A
  501. * DF3 N/A
  502. * DF3p5 N/A
  503. *
  504. * D18F7xE08 [DRAM Address Control]
  505. * DF4 RemapEn [4]
  506. *
  507. * D18F7x208 [DRAM Address Control]
  508. * DF4p5 RemapEn [4]
  509. */
  510. #define DF4_REMAP_EN BIT(4)
  511. /*
  512. * Remap Select
  513. *
  514. * Access type: Instance
  515. *
  516. * Register
  517. * Rev Fieldname Bits
  518. *
  519. * DF2 N/A
  520. * DF3 N/A
  521. * DF3p5 N/A
  522. *
  523. * D18F7xE08 [DRAM Address Control]
  524. * DF4 RemapSel [7:5]
  525. *
  526. * D18F7x208 [DRAM Address Control]
  527. * DF4p5 RemapSel [6:5]
  528. */
  529. #define DF4_REMAP_SEL GENMASK(7, 5)
  530. #define DF4p5_REMAP_SEL GENMASK(6, 5)
  531. /*
  532. * Socket ID Mask
  533. *
  534. * Access type: Broadcast
  535. *
  536. * Register
  537. * Rev Fieldname Bits
  538. *
  539. * D18F1x208 [System Fabric ID Mask]
  540. * DF2 SocketIdMask [23:16]
  541. *
  542. * D18F1x20C [System Fabric ID Mask 1]
  543. * DF3 SocketIdMask [26:24]
  544. *
  545. * D18F1x158 [System Fabric ID Mask 2]
  546. * DF3p5 SocketIdMask [31:16]
  547. *
  548. * D18F4x1B8 [System Fabric ID Mask 2]
  549. * DF4 SocketIdMask [31:16]
  550. * DF4p5 SocketIdMask [31:16]
  551. */
  552. #define DF2_SOCKET_ID_MASK GENMASK(23, 16)
  553. #define DF3_SOCKET_ID_MASK GENMASK(26, 24)
  554. #define DF4_SOCKET_ID_MASK GENMASK(31, 16)
  555. /*
  556. * Socket ID Shift
  557. *
  558. * Access type: Broadcast
  559. *
  560. * Register
  561. * Rev Fieldname Bits
  562. *
  563. * D18F1x208 [System Fabric ID Mask]
  564. * DF2 SocketIdShift [31:28]
  565. *
  566. * D18F1x20C [System Fabric ID Mask 1]
  567. * DF3 SocketIdShift [9:8]
  568. *
  569. * D18F1x158 [System Fabric ID Mask 2]
  570. * DF3p5 SocketIdShift [11:8]
  571. *
  572. * D18F4x1B4 [System Fabric ID Mask 1]
  573. * DF4 SocketIdShift [11:8]
  574. * DF4p5 SocketIdShift [11:8]
  575. */
  576. #define DF2_SOCKET_ID_SHIFT GENMASK(31, 28)
  577. #define DF3_SOCKET_ID_SHIFT GENMASK(9, 8)
  578. #define DF4_SOCKET_ID_SHIFT GENMASK(11, 8)