summaryrefslogtreecommitdiff
path: root/drivers/ras/amd/atl/reg_fields.h
blob: 9dcdf6e4a856b21c9d3d6dcc9f708dfba4c69f89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * AMD Address Translation Library
 *
 * reg_fields.h : Register field definitions
 *
 * Copyright (c) 2023, Advanced Micro Devices, Inc.
 * All Rights Reserved.
 *
 * Author: Yazen Ghannam <Yazen.Ghannam@amd.com>
 */

/*
 * Notes on naming:
 * 1) Use "DF_" prefix for fields that are the same for all revisions.
 * 2) Use "DFx_" prefix for fields that differ between revisions.
 *	a) "x" is the first major revision where the new field appears.
 *	b) E.g., if DF2 and DF3 have the same field, then call it DF2.
 *	c) E.g., if DF3p5 and DF4 have the same field, then call it DF4.
 */

/*
 * Coherent Station Fabric ID
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	D18F0x50 [Fabric Block Instance Information 3]
 *	DF2	BlockFabricId	[19:8]
 *	DF3	BlockFabricId	[19:8]
 *	DF3p5	BlockFabricId	[19:8]
 *	DF4	BlockFabricId	[19:8]
 *	DF4p5	BlockFabricId	[15:8]
 */
#define DF2_COH_ST_FABRIC_ID	GENMASK(19, 8)
#define DF4p5_COH_ST_FABRIC_ID	GENMASK(15, 8)

/*
 * Component ID Mask
 *
 * Access type: Broadcast
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	DF2	N/A
 *
 *	D18F1x208 [System Fabric ID Mask 0]
 *	DF3	ComponentIdMask	[9:0]
 *
 *	D18F1x150 [System Fabric ID Mask 0]
 *	DF3p5	ComponentIdMask	[15:0]
 *
 *	D18F4x1B0 [System Fabric ID Mask 0]
 *	DF4	ComponentIdMask	[15:0]
 *	DF4p5	ComponentIdMask	[15:0]
 */
#define DF3_COMPONENT_ID_MASK	GENMASK(9, 0)
#define DF4_COMPONENT_ID_MASK	GENMASK(15, 0)

/*
 * Destination Fabric ID
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	D18F0x114 [DRAM Limit Address]
 *	DF2	DstFabricID	[7:0]
 *	DF3	DstFabricID	[9:0]
 *	DF3	DstFabricID	[11:0]
 *
 *	D18F7xE08 [DRAM Address Control]
 *	DF4	DstFabricID	[27:16]
 *
 *	D18F7x208 [DRAM Address Control]
 *	DF4p5	DstFabricID	[23:16]
 */
#define DF2_DST_FABRIC_ID	GENMASK(7, 0)
#define DF3_DST_FABRIC_ID	GENMASK(9, 0)
#define DF3p5_DST_FABRIC_ID	GENMASK(11, 0)
#define DF4_DST_FABRIC_ID	GENMASK(27, 16)
#define DF4p5_DST_FABRIC_ID	GENMASK(23, 16)

/*
 * Die ID Mask
 *
 * Access type: Broadcast
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	D18F1x208 [System Fabric ID Mask]
 *	DF2	DieIdMask	[15:8]
 *
 *	D18F1x20C [System Fabric ID Mask 1]
 *	DF3	DieIdMask	[18:16]
 *
 *	D18F1x158 [System Fabric ID Mask 2]
 *	DF3p5	DieIdMask	[15:0]
 *
 *	D18F4x1B8 [System Fabric ID Mask 2]
 *	DF4	DieIdMask	[15:0]
 *	DF4p5	DieIdMask	[15:0]
 */
#define DF2_DIE_ID_MASK		GENMASK(15, 8)
#define DF3_DIE_ID_MASK		GENMASK(18, 16)
#define DF4_DIE_ID_MASK		GENMASK(15, 0)

/*
 * Die ID Shift
 *
 * Access type: Broadcast
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	D18F1x208 [System Fabric ID Mask]
 *	DF2	DieIdShift	[27:24]
 *
 *	DF3	N/A
 *	DF3p5	N/A
 *	DF4	N/A
 *	DF4p5	N/A
 */
#define DF2_DIE_ID_SHIFT	GENMASK(27, 24)

/*
 * DRAM Address Range Valid
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	D18F0x110 [DRAM Base Address]
 *	DF2	AddrRngVal	[0]
 *	DF3	AddrRngVal	[0]
 *	DF3p5	AddrRngVal	[0]
 *
 *	D18F7xE08 [DRAM Address Control]
 *	DF4	AddrRngVal	[0]
 *
 *	D18F7x208 [DRAM Address Control]
 *	DF4p5	AddrRngVal	[0]
 */
#define DF_ADDR_RANGE_VAL	BIT(0)

/*
 * DRAM Base Address
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	D18F0x110 [DRAM Base Address]
 *	DF2	DramBaseAddr	[31:12]
 *	DF3	DramBaseAddr	[31:12]
 *	DF3p5	DramBaseAddr	[31:12]
 *
 *	D18F7xE00 [DRAM Base Address]
 *	DF4	DramBaseAddr	[27:0]
 *
 *	D18F7x200 [DRAM Base Address]
 *	DF4p5	DramBaseAddr	[27:0]
 */
#define DF2_BASE_ADDR		GENMASK(31, 12)
#define DF4_BASE_ADDR		GENMASK(27, 0)

/*
 * DRAM Hole Base
 *
 * Access type: Broadcast
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	D18F0x104 [DRAM Hole Control]
 *	DF2	DramHoleBase	[31:24]
 *	DF3	DramHoleBase	[31:24]
 *	DF3p5	DramHoleBase	[31:24]
 *
 *	D18F7x104 [DRAM Hole Control]
 *	DF4	DramHoleBase	[31:24]
 *	DF4p5	DramHoleBase	[31:24]
 */
#define DF_DRAM_HOLE_BASE_MASK	GENMASK(31, 24)

/*
 * DRAM Limit Address
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	D18F0x114 [DRAM Limit Address]
 *	DF2	DramLimitAddr	[31:12]
 *	DF3	DramLimitAddr	[31:12]
 *	DF3p5	DramLimitAddr	[31:12]
 *
 *	D18F7xE04 [DRAM Limit Address]
 *	DF4	DramLimitAddr	[27:0]
 *
 *	D18F7x204 [DRAM Limit Address]
 *	DF4p5	DramLimitAddr	[27:0]
 */
#define DF2_DRAM_LIMIT_ADDR	GENMASK(31, 12)
#define DF4_DRAM_LIMIT_ADDR	GENMASK(27, 0)

/*
 * Hash Interleave Controls
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	DF2	N/A
 *
 *	D18F0x3F8 [DF Global Control]
 *	DF3	GlbHashIntlvCtl64K	[20]
 *		GlbHashIntlvCtl2M	[21]
 *		GlbHashIntlvCtl1G	[22]
 *
 *	DF3p5	GlbHashIntlvCtl64K	[20]
 *		GlbHashIntlvCtl2M	[21]
 *		GlbHashIntlvCtl1G	[22]
 *
 *	D18F7xE08 [DRAM Address Control]
 *	DF4	HashIntlvCtl64K		[8]
 *		HashIntlvCtl2M		[9]
 *		HashIntlvCtl1G		[10]
 *
 *	D18F7x208 [DRAM Address Control]
 *	DF4p5	HashIntlvCtl4K		[7]
 *		HashIntlvCtl64K		[8]
 *		HashIntlvCtl2M		[9]
 *		HashIntlvCtl1G		[10]
 *		HashIntlvCtl1T		[15]
 */
#define DF3_HASH_CTL_64K		BIT(20)
#define DF3_HASH_CTL_2M			BIT(21)
#define DF3_HASH_CTL_1G			BIT(22)
#define DF4_HASH_CTL_64K		BIT(8)
#define DF4_HASH_CTL_2M			BIT(9)
#define DF4_HASH_CTL_1G			BIT(10)
#define DF4p5_HASH_CTL_4K		BIT(7)
#define DF4p5_HASH_CTL_1T		BIT(15)

/*
 * High Address Offset
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	D18F0x1B4 [DRAM Offset]
 *	DF2	HiAddrOffset	[31:20]
 *	DF3	HiAddrOffset	[31:12]
 *	DF3p5	HiAddrOffset	[31:12]
 *
 *	D18F7x140 [DRAM Offset]
 *	DF4	HiAddrOffset	[24:1]
 *	DF4p5	HiAddrOffset	[24:1]
 *	MI300	HiAddrOffset	[31:1]
 */
#define DF2_HI_ADDR_OFFSET	GENMASK(31, 20)
#define DF3_HI_ADDR_OFFSET	GENMASK(31, 12)

/* Follow reference code by including reserved bits for simplicity. */
#define DF4_HI_ADDR_OFFSET	GENMASK(31, 1)

/*
 * High Address Offset Enable
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	D18F0x1B4 [DRAM Offset]
 *	DF2	HiAddrOffsetEn	[0]
 *	DF3	HiAddrOffsetEn	[0]
 *	DF3p5	HiAddrOffsetEn	[0]
 *
 *	D18F7x140 [DRAM Offset]
 *	DF4	HiAddrOffsetEn	[0]
 *	DF4p5	HiAddrOffsetEn	[0]
 */
#define DF_HI_ADDR_OFFSET_EN	BIT(0)

/*
 * Interleave Address Select
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	D18F0x110 [DRAM Base Address]
 *	DF2	IntLvAddrSel	[10:8]
 *	DF3	IntLvAddrSel	[11:9]
 *	DF3p5	IntLvAddrSel	[11:9]
 *
 *	D18F7xE0C [DRAM Address Interleave]
 *	DF4	IntLvAddrSel	[2:0]
 *
 *	D18F7x20C [DRAM Address Interleave]
 *	DF4p5	IntLvAddrSel	[2:0]
 */
#define DF2_INTLV_ADDR_SEL	GENMASK(10, 8)
#define DF3_INTLV_ADDR_SEL	GENMASK(11, 9)
#define DF4_INTLV_ADDR_SEL	GENMASK(2, 0)

/*
 * Interleave Number of Channels
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	D18F0x110 [DRAM Base Address]
 *	DF2	IntLvNumChan	[7:4]
 *	DF3	IntLvNumChan	[5:2]
 *	DF3p5	IntLvNumChan	[6:2]
 *
 *	D18F7xE0C [DRAM Address Interleave]
 *	DF4	IntLvNumChan	[8:4]
 *
 *	D18F7x20C [DRAM Address Interleave]
 *	DF4p5	IntLvNumChan	[9:4]
 */
#define DF2_INTLV_NUM_CHAN	GENMASK(7, 4)
#define DF3_INTLV_NUM_CHAN	GENMASK(5, 2)
#define DF3p5_INTLV_NUM_CHAN	GENMASK(6, 2)
#define DF4_INTLV_NUM_CHAN	GENMASK(8, 4)
#define DF4p5_INTLV_NUM_CHAN	GENMASK(9, 4)

/*
 * Interleave Number of Dies
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	D18F0x114 [DRAM Limit Address]
 *	DF2	IntLvNumDies	[11:10]
 *
 *	D18F0x110 [DRAM Base Address]
 *	DF3	IntLvNumDies	[7:6]
 *	DF3p5	IntLvNumDies	[7]
 *
 *	D18F7xE0C [DRAM Address Interleave]
 *	DF4	IntLvNumDies	[13:12]
 *
 *	D18F7x20C [DRAM Address Interleave]
 *	DF4p5	IntLvNumDies	[13:12]
 */
#define DF2_INTLV_NUM_DIES	GENMASK(11, 10)
#define DF3_INTLV_NUM_DIES	GENMASK(7, 6)
#define DF3p5_INTLV_NUM_DIES	BIT(7)
#define DF4_INTLV_NUM_DIES	GENMASK(13, 12)

/*
 * Interleave Number of Sockets
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	D18F0x114 [DRAM Limit Address]
 *	DF2	IntLvNumSockets	[8]
 *
 *	D18F0x110 [DRAM Base Address]
 *	DF3	IntLvNumSockets	[8]
 *	DF3p5	IntLvNumSockets	[8]
 *
 *	D18F7xE0C [DRAM Address Interleave]
 *	DF4	IntLvNumSockets	[18]
 *
 *	D18F7x20C [DRAM Address Interleave]
 *	DF4p5	IntLvNumSockets	[18]
 */
#define DF2_INTLV_NUM_SOCKETS	BIT(8)
#define DF4_INTLV_NUM_SOCKETS	BIT(18)

/*
 * Legacy MMIO Hole Enable
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	D18F0x110 [DRAM Base Address]
 *	DF2	LgcyMmioHoleEn	[1]
 *	DF3	LgcyMmioHoleEn	[1]
 *	DF3p5	LgcyMmioHoleEn	[1]
 *
 *	D18F7xE08 [DRAM Address Control]
 *	DF4	LgcyMmioHoleEn	[1]
 *
 *	D18F7x208 [DRAM Address Control]
 *	DF4p5	LgcyMmioHoleEn	[1]
 */
#define DF_LEGACY_MMIO_HOLE_EN	BIT(1)

/*
 * Log2 Address 64K Space 0
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname		Bits
 *
 *	DF2	N/A
 *
 *	D18F2x90 [Non-power-of-2 channel Configuration Register for COH_ST DRAM Address Maps]
 *	DF3	Log2Addr64KSpace0	[5:0]
 *
 *	DF3p5	N/A
 *	DF4	N/A
 *	DF4p5	N/A
 */
#define DF_LOG2_ADDR_64K_SPACE0		GENMASK(5, 0)

/*
 * Major Revision
 *
 * Access type: Broadcast
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	DF2	N/A
 *	DF3	N/A
 *	DF3p5	N/A
 *
 *	D18F0x040 [Fabric Block Instance Count]
 *	DF4	MajorRevision	[27:24]
 *	DF4p5	MajorRevision	[27:24]
 */
#define DF_MAJOR_REVISION	GENMASK(27, 24)

/*
 * Minor Revision
 *
 * Access type: Broadcast
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	DF2	N/A
 *	DF3	N/A
 *	DF3p5	N/A
 *
 *	D18F0x040 [Fabric Block Instance Count]
 *	DF4	MinorRevision	[23:16]
 *	DF4p5	MinorRevision	[23:16]
 */
#define DF_MINOR_REVISION	GENMASK(23, 16)

/*
 * Node ID Mask
 *
 * Access type: Broadcast
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	DF2	N/A
 *
 *	D18F1x208 [System Fabric ID Mask 0]
 *	DF3	NodeIdMask	[25:16]
 *
 *	D18F1x150 [System Fabric ID Mask 0]
 *	DF3p5	NodeIdMask	[31:16]
 *
 *	D18F4x1B0 [System Fabric ID Mask 0]
 *	DF4	NodeIdMask	[31:16]
 *	DF4p5	NodeIdMask	[31:16]
 */
#define DF3_NODE_ID_MASK	GENMASK(25, 16)
#define DF4_NODE_ID_MASK	GENMASK(31, 16)

/*
 * Node ID Shift
 *
 * Access type: Broadcast
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	DF2	N/A
 *
 *	D18F1x20C [System Fabric ID Mask 1]
 *	DF3	NodeIdShift	[3:0]
 *
 *	D18F1x154 [System Fabric ID Mask 1]
 *	DF3p5	NodeIdShift	[3:0]
 *
 *	D18F4x1B4 [System Fabric ID Mask 1]
 *	DF4	NodeIdShift	[3:0]
 *	DF4p5	NodeIdShift	[3:0]
 */
#define DF3_NODE_ID_SHIFT	GENMASK(3, 0)

/*
 * Remap Enable
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	DF2	N/A
 *	DF3	N/A
 *	DF3p5	N/A
 *
 *	D18F7xE08 [DRAM Address Control]
 *	DF4	RemapEn		[4]
 *
 *	D18F7x208 [DRAM Address Control]
 *	DF4p5	RemapEn		[4]
 */
#define DF4_REMAP_EN		BIT(4)

/*
 * Remap Select
 *
 * Access type: Instance
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 *	DF2	N/A
 *	DF3	N/A
 *	DF3p5	N/A
 *
 *	D18F7xE08 [DRAM Address Control]
 *	DF4	RemapSel	[7:5]
 *
 *	D18F7x208 [DRAM Address Control]
 *	DF4p5	RemapSel	[6:5]
 */
#define DF4_REMAP_SEL		GENMASK(7, 5)
#define DF4p5_REMAP_SEL		GENMASK(6, 5)

/*
 * Socket ID Mask
 *
 * Access type: Broadcast
 *
 * Register
 *	Rev	Fieldname	Bits
 *
 * D18F1x208 [System Fabric ID Mask]
 *	DF2	SocketIdMask	[23:16]
 *
 * D18F1x20C [System Fabric ID Mask 1]
 *	DF3	SocketIdMask	[26:24]
 *
 * D18F1x158 [System Fabric ID Mask 2]
 *	DF3p5	SocketIdMask	[31:16]
 *
 * D18F4x1B8 [System Fabric ID Mask 2]
 *	DF4	SocketIdMask	[31:16]
 *	DF4p5	SocketIdMask	[31:16]
 */
#define DF2_SOCKET_ID_MASK	GENMASK(23, 16)
#define DF3_SOCKET_ID_MASK	GENMASK(26, 24)
#define DF4_SOCKET_ID_MASK	GENMASK(31, 16)

/*
 * Socket ID Shift
 *
 * Access type: Broadcast
 *
 * Register
 *		Rev	Fieldname	Bits
 *
 * D18F1x208 [System Fabric ID Mask]
 *	DF2	SocketIdShift	[31:28]
 *
 * D18F1x20C [System Fabric ID Mask 1]
 *	DF3	SocketIdShift	[9:8]
 *
 * D18F1x158 [System Fabric ID Mask 2]
 *	DF3p5	SocketIdShift	[11:8]
 *
 * D18F4x1B4 [System Fabric ID Mask 1]
 *	DF4	SocketIdShift	[11:8]
 *	DF4p5	SocketIdShift	[11:8]
 */
#define DF2_SOCKET_ID_SHIFT	GENMASK(31, 28)
#define DF3_SOCKET_ID_SHIFT	GENMASK(9, 8)
#define DF4_SOCKET_ID_SHIFT	GENMASK(11, 8)