4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
24 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
28 #pragma ident "%Z%%M% %I% %E% SMI"
30 #include <mcamd_api.h>
31 #include <mcamd_err.h>
32 #include <mcamd_rowcol_impl.h>
35 * =========== Chip-Select Bank Address Mode Encodings =======================
38 /* Individual table declarations */
39 static const struct rct_bnkaddrmode bnkaddr_tbls_pre_d
[];
40 static const struct rct_bnkaddrmode bnkaddr_tbls_d_e
[];
41 static const struct rct_bnkaddrmode bnkaddr_tbls_f
[];
43 /* Managing bank address mode tables */
44 static const struct _bnkaddrmode_tbldesc
{
47 const struct rct_bnkaddrmode
*modetbl
;
49 { MC_F_REVS_BC
, 7, bnkaddr_tbls_pre_d
},
50 { MC_F_REVS_DE
, 11, bnkaddr_tbls_d_e
},
51 { MC_F_REVS_FG
, 12, bnkaddr_tbls_f
},
55 * =========== DRAM Address Mappings for bank/row/column =====================
59 /* Individual table declarations */
61 uint_t mt_revmask
; /* revision to which this applies */
62 int mt_width
; /* MC mode (64 or 128) */
63 const struct rct_rcbmap mt_csmap
[MC_RC_CSMODES
];
66 static const struct _rcbmap_tbl dram_addrmap_pre_d_64
;
67 static const struct _rcbmap_tbl dram_addrmap_pre_d_128
;
68 static const struct _rcbmap_tbl dram_addrmap_d_e_64
;
69 static const struct _rcbmap_tbl dram_addrmap_d_e_128
;
70 static const struct _rcbmap_tbl dram_addrmap_f_64
;
71 static const struct _rcbmap_tbl dram_addrmap_f_128
;
73 /* Managing row/column/bank tables */
74 static const struct _rcbmap_tbldesc
{
76 const struct _rcbmap_tbl
*rcbmap
;
78 { 7, &dram_addrmap_pre_d_64
},
79 { 7, &dram_addrmap_pre_d_128
},
80 { 11, &dram_addrmap_d_e_64
},
81 { 11, &dram_addrmap_d_e_128
},
82 { 12, &dram_addrmap_f_64
},
83 { 12, &dram_addrmap_f_128
},
87 * =========== Bank swizzling information ====================================
90 /* Individual table declarations */
92 uint_t swzt_revmask
; /* revision to which this applies */
93 int swzt_width
; /* MC mode (64 or 128) */
94 const struct rct_bnkswzlinfo swzt_bits
;
97 static const struct _bnkswzl_tbl bnswzl_info_e_64
;
98 static const struct _bnkswzl_tbl bnswzl_info_e_128
;
99 static const struct _bnkswzl_tbl bnswzl_info_f_64
;
100 static const struct _bnkswzl_tbl bnswzl_info_f_128
;
102 /* Managing bank swizzle tables */
103 static const struct _bnkswzl_tbl
*bnkswzl_tbls
[] = {
111 * ======================================================================
112 * | Tables reflecting those in the BKDG |
113 * ======================================================================
117 * DRAM Address Mapping in Interleaving Mode
119 * Chip-select interleave is performed by addressing across the columns
120 * of the first row of internal bank-select 0 on a chip-select, then the
121 * next row on internal bank-select 1, then 2 then 3; instead of then
122 * moving on to the next row of this chip-select we then rotate across
123 * other chip-selects in the interleave. The row/column/bank mappings
124 * described elsewhere in this file show that a DRAM InputAddr breaks down
125 * as follows, using an example for CS Mode 0000 revision CG and earlier 64-bit
126 * mode; the cs size is 32MB, requiring 25 bits to address all of it.
128 * chip-selection bits | offset within chip-select bits |
129 * | row bits | bank bits | column bits | - |
130 * 24 13 12 11 10 3 2 0
132 * The high-order chip-selection bits select the chip-select and the
133 * offset bits offset within the chosen chip-select.
135 * To establish say a 2-way interleave in which we consume all of one
136 * row number and all internal bank numbers on one cs before moving on
137 * to the next to do the same we will target the first row bit - bit 13;
138 * a 4-way interleave would use bits 14 and 13, and an 8-way interleave
139 * bits 15, 14 and 13. We swap the chosen bits with the least significant
140 * high order chip-selection bits.
142 * The BKDG interleave tables really just describe the above. Working
143 * out the high-order bits to swap is easy since that is derived directly
144 * from the chip-select size. The low-order bits depend on the device
145 * parameters since we need to target the least significant row address bits -
146 * but we have that information from the rcbmap_tbls since the first row bit
147 * simply follows the last bank address bit.
151 * General notes for CS Bank Address Mode Encoding tables.
153 * These are indexed by chip-select mode. Where the numbers of rows and
154 * columns is ambiguous (as it is for a number of rev CG and earlier cases)
155 * the bam_config should be initialized to 1 and the numbers of rows
156 * and columns should be the maximums.
160 * Chip Select Bank Address Mode Encoding for rev CG and earlier.
162 static const struct rct_bnkaddrmode bnkaddr_tbls_pre_d
[] = {
170 128, 13, 10, 1 /* AMBIG */
173 256, 13, 11, 1 /* AMBIG */
176 512, 14, 11, 1 /* AMBIG */
179 1024, 14, 12, 1 /* AMBIG */
187 * Chip Select Bank Address Mode Encoding for revs D and E.
189 static const struct rct_bnkaddrmode bnkaddr_tbls_d_e
[] = {
226 * Chip Select Bank Address Mode Encoding for rev F
228 static const struct rct_bnkaddrmode bnkaddr_tbls_f
[] = {
269 * General notes on Row/Column/Bank table initialisation.
271 * These are the tables 7, 8, 9, 10, 11 and 12 of BKDG 3.29 section 3.5.6.1.
272 * They apply in non-interleave (node or cs) mode and describe how for
273 * a given revision, access width, bank-swizzle mode, and current chip-select
274 * mode the row, column and internal sdram bank are derived from the
275 * normalizied InputAddr presented to the DRAM controller.
277 * The mt_csmap array is indexed by chip-select mode. Within it the
278 * bankargs, rowbits and colbits arrays are indexed by bit number, so
279 * match the BKDG tables if the latter are read right-to-left.
281 * The bankargs list up to three bit numbers per bank bit. For revisions
282 * CG and earlier there is no bank swizzling, so just a single number
283 * should be listed. Revisions D and E have the same row/column/bank mapping,
284 * but rev E has the additional feature of being able to xor two row bits
285 * into each bank bit. The consumer will know whether they are using bank
286 * swizzling - if so then they should xor the bankargs bits together.
287 * The first argument must be the bit number not already used in forming
288 * part of the row address - eg in table 12 for csmode 0000b bank address
289 * bit 0 is bit 12 xor bit 18 xor bit 21, and 18 and 21 are also mentioned in
290 * the row address (bits 10 and 1) so we must list bit 12 first. We will
291 * use this information in chip-select interleave decoding in which we need
292 * to know which is the first bit after column and bank address bits.
294 * Column address A10 is always used for the Precharge All signal. Where
295 * "PC" appears in the BKDG tables we will include MC_PC_ALL in the
296 * corresponding bit position.
298 * For some rev CG and earlier chipselect modes the number of rows and columns
299 * is ambiguous. This is reflected in these tables by some bit being
300 * duplicated between row and column address. In practice we will follow
301 * the convention of always assigning the floating bit to the row address.
305 * Row/Column/Bank address mappings for rev CG in 64-bit mode, no interleave.
306 * See BKDG 3.29 3.5.6 Table 7.
308 static const struct _rcbmap_tbl dram_addrmap_pre_d_64
= {
314 { 19, 20, 21, 22, 23, 24, 13, 14, 15, 16, 17, 18 },
315 { 3, 4, 5, 6, 7, 8, 9, 10 }
319 { 19, 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18 },
320 { 3, 4, 5, 6, 7, 8, 9, 10, 11 }
324 { 19, 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18, 26 },
325 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 26 }
329 { 19, 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 27 },
330 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL
, 27 }
334 { 19, 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 27, 28 },
335 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL
, 28 }
339 { 19, 20, 21, 22, 23, 24, 25, 26, 29, 16, 17, 18, 27, 28 },
340 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL
, 13, 28 }
344 { 19, 20, 21, 22, 23, 24, 25, 26, 29, 16, 17, 18, 27, 28 },
345 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL
, 13, 30 }
355 * Row/Column/Bank address mappings for rev CG in 128-bit mode, no interleave.
356 * See BKDG 3.29 3.5.6 Table 8.
358 static const struct _rcbmap_tbl dram_addrmap_pre_d_128
= {
364 { 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18, 19 },
365 { 4, 5, 6, 7, 8, 9, 10, 11 }
369 { 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 19 },
370 { 4, 5, 6, 7, 8, 9, 10, 11, 12 }
374 { 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 19, 27 },
375 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 27 }
379 { 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 19, 28 },
380 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL
, 28 }
384 { 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 19, 28, 29 },
385 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL
, 29 }
389 { 20, 21, 22, 23, 24, 25, 26, 27, 30, 17, 18, 19, 28, 29 },
390 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL
, 14, 29 }
394 { 20, 21, 22, 23, 24, 25, 26, 27, 30, 17, 18, 19, 28, 29 },
395 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL
, 14, 31 }
404 * Row/Column/Bank address mappings for rev D/E in 64-bit mode, no interleave.
405 * See BKDG 3.29 3.5.6 Table 9.
407 static const struct _rcbmap_tbl dram_addrmap_d_e_64
= {
413 { 19, 20, 21, 22, 23, 24, 13, 14, 15, 16, 17, 18 },
414 { 3, 4, 5, 6, 7, 8, 9, 10 }
418 { 19, 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18, 26 },
419 { 3, 4, 5, 6, 7, 8, 9, 10, 11 }
423 { 19, 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18, 26 },
424 { 3, 4, 5, 6, 7, 8, 9, 10, 11 }
428 { 19, 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 27, 28 },
429 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }
433 { 19, 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 27, 28 },
434 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }
438 { 19, 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 27, 28 },
439 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }
443 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 28, 29 },
444 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL
, 13 }
448 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 28, 29 },
449 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL
, 13 }
453 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 28, 29 },
454 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL
, 13 }
458 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 17, 18, 29, 30 },
459 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL
, 13, 14 }
463 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 17, 18, 29, 30 },
464 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL
, 13, 14 }
473 * Row/Column/Bank address mappings for rev D/E in 128-bit mode, no interleave.
474 * See BKDG 3.29 3.5.6 Table 9.
476 static const struct _rcbmap_tbl dram_addrmap_d_e_128
= {
482 { 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18, 19 },
483 { 4, 5, 6, 7, 8, 9, 10, 11 }
487 { 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 19, 27 },
488 { 4, 5, 6, 7, 8, 9, 10, 11, 12 }
492 { 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 19, 27 },
493 { 4, 5, 6, 7, 8, 9, 10, 11, 12 }
497 { 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 19, 28, 29 },
498 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }
502 { 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 19, 28, 29 },
503 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }
507 { 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 19, 28, 29 },
508 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }
512 { 20, 21, 22, 23, 24, 25, 26, 27, 28, 17, 18, 19, 29, 30 },
513 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL
, 14 }
517 { 20, 21, 22, 23, 24, 25, 26, 27, 28, 17, 18, 19, 29, 30 },
518 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL
, 14 }
522 { 20, 21, 22, 23, 24, 25, 26, 27, 28, 17, 18, 19, 29, 30 },
523 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL
, 14 }
527 { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 18, 19, 30, 31 },
528 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL
, 14, 15 }
532 { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 18, 19, 30, 31 },
533 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL
, 14, 15 }
542 * Row/Column/Bank address mappings for revs F/G in 64-bit mode, no interleave.
544 static const struct _rcbmap_tbl dram_addrmap_f_64
= {
550 { 18, 19, 20, 21, 22, 23, 24, 25, 26, 14, 15, 16, 17 },
551 { 3, 4, 5, 6, 7, 8, 9, 10, 11 },
555 { 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 15, 16, 17 },
556 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 },
560 { 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 15, 16, 17 },
561 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 },
565 { 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 16, 17 },
566 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL
, 13 },
570 { 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 16, 17 },
571 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL
, 13 },
575 { 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 16, 17 },
576 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }
580 { 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 16, 17 },
581 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL
, 13 },
585 { 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 16, 17 },
586 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }
590 { 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 17 },
591 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL
, 13 },
595 { 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 17 },
596 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL
, 13 },
600 { 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
602 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }
606 { 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
608 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL
, 13 },
617 * Row/Column/Bank address mappings for revs F/G in 128-bit mode, no interleave.
619 static const struct _rcbmap_tbl dram_addrmap_f_128
= {
625 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 15, 16, 17, 18 },
626 { 4, 5, 6, 7, 8, 9, 10, 11, 12 },
630 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 16, 17, 18 },
631 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 },
635 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 16, 17, 18 },
636 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 },
640 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 17, 18 },
641 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL
, 14 },
645 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 17, 18 },
646 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 },
650 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 17, 18 },
651 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 },
655 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 17, 18 },
656 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL
, 14 },
660 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
662 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 },
666 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
668 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL
, 14 },
672 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
674 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL
, 14 },
678 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
680 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 },
684 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
686 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL
, 14 },
695 * Bank swizzling is an option in revisions E and later. Each internal-bank-
696 * select address bit is xor'd with two row address bits. Which row
697 * address bits to use is not dependent on bank address mode but on
698 * revision and dram controller width alone.
700 * While rev E only supports 2 bank address bits, rev F supports 3 but not
701 * all chip-select bank address modes use all 3. These tables will list
702 * the row bits to use in swizzling for the maximum number of supported
703 * bank address bits - the consumer musr determine how many should be
704 * applied (listed in the above row/col/bank tables).
707 static const struct _bnkswzl_tbl bnswzl_info_e_64
= {
712 { 17, 20 }, /* rows bits to swizzle with BA0 */
713 { 18, 21 }, /* rows bits to swizzle with BA1 */
714 /* only 2 bankaddr bits on rev E */
719 static const struct _bnkswzl_tbl bnswzl_info_e_128
= {
724 { 18, 21 }, /* rows bits to swizzle with BA0 */
725 { 19, 22 }, /* rows bits to swizzle with BA1 */
726 /* only 2 bankaddr bits on rev E */
731 static const struct _bnkswzl_tbl bnswzl_info_f_64
= {
736 { 17, 22 }, /* rows bits to swizzle with BA0 */
737 { 18, 23 }, /* rows bits to swizzle with BA1 */
738 { 19, 24 }, /* rows bits to swizzle with BA2 */
743 static const struct _bnkswzl_tbl bnswzl_info_f_128
= {
748 { 18, 23 }, /* rows bits to swizzle with BA0 */
749 { 19, 24 }, /* rows bits to swizzle with BA1 */
750 { 20, 25 }, /* rows bits to swizzle with BA2 */
756 * Yet another highbit function. This really needs to go to common source.
757 * Returns range 0 to 64 inclusive;
767 if (i
& 0xffffffff00000000ULL
) {
772 if (i
& 0xffff0000) {
799 * Lookup the Chip-Select Bank Address Mode Encoding table for a given
800 * chip revision and chip-select mode.
802 const struct rct_bnkaddrmode
*
803 rct_bnkaddrmode(uint_t mcrev
, uint_t csmode
)
806 const struct _bnkaddrmode_tbldesc
*bdp
= bnkaddr_tbls
;
808 for (i
= 0; i
< sizeof (bnkaddr_tbls
) /
809 sizeof (struct _bnkaddrmode_tbldesc
);
811 if (MC_REV_MATCH(mcrev
, bdp
->revmask
) && csmode
< bdp
->nmodes
)
812 return (&bdp
->modetbl
[csmode
]);
820 * Lookup the DRAM Address Mapping table for a given chip revision, access
821 * width, bank-swizzle and chip-select mode.
823 const struct rct_rcbmap
*
824 rct_rcbmap(uint_t mcrev
, int width
, uint_t csmode
)
826 const struct _rcbmap_tbl
*rcbm
;
829 for (i
= 0; i
< sizeof (rcbmap_tbls
) /
830 sizeof (struct _rcbmap_tbldesc
); i
++) {
831 rcbm
= rcbmap_tbls
[i
].rcbmap
;
832 if (MC_REV_MATCH(mcrev
, rcbm
->mt_revmask
) &&
833 rcbm
->mt_width
== width
&& csmode
< rcbmap_tbls
[i
].nmodes
)
834 return (&rcbm
->mt_csmap
[csmode
]);
841 * Lookup the bank swizzling information for a given chip revision and
844 const struct rct_bnkswzlinfo
*
845 rct_bnkswzlinfo(uint_t mcrev
, int width
)
848 const struct _bnkswzl_tbl
*swztp
;
850 for (i
= 0; i
< sizeof (bnkswzl_tbls
) /
851 sizeof (struct rcb_bnkswzl_tbl
*); i
++) {
852 swztp
= bnkswzl_tbls
[i
];
853 if (MC_REV_MATCH(mcrev
, swztp
->swzt_revmask
) &&
854 swztp
->swzt_width
== width
)
855 return (&swztp
->swzt_bits
);
862 rct_csintlv_bits(uint_t mcrev
, int width
, uint_t csmode
, int factor
,
863 struct rct_csintlv
*csid
)
867 const struct rct_bnkaddrmode
*bam
;
868 const struct rct_rcbmap
*rcm
;
871 * 8-way cs interleave for some large cs sizes in 128-bit mode is
872 * not implemented prior to rev F.
874 if (factor
== 8 && width
== 128 &&
875 ((MC_REV_MATCH(mcrev
, MC_F_REVS_BC
) && csmode
== 0x6) ||
876 (MC_REV_MATCH(mcrev
, MC_F_REVS_DE
) &&
877 (csmode
== 0x9 || csmode
== 0xa)))) {
878 csid
->csi_factor
= 0;
882 if ((bam
= rct_bnkaddrmode(mcrev
, csmode
)) == NULL
||
883 (rcm
= rct_rcbmap(mcrev
, width
, csmode
)) == NULL
) {
884 csid
->csi_factor
= 0;
888 csz
= MC_CS_SIZE(bam
, width
);
901 csid
->csi_factor
= 0;
905 csid
->csi_hibit
= topbit(csz
) - 1;
908 * The first row bit is immediately after the last bank bit.
911 for (i
= 0; i
< rcm
->rcb_nbankbits
; i
++)
912 if (rcm
->rcb_bankbit
[i
] > lstbnkbit
)
913 lstbnkbit
= rcm
->rcb_bankbit
[i
];
915 csid
->csi_lobit
= lstbnkbit
+ 1;
917 csid
->csi_factor
= factor
;