1/* 2 * CDDL HEADER START 3 * 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. 7 * 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. 12 * 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] 18 * 19 * CDDL HEADER END 20 */ 21 22/* 23 * 24 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 25 * Use is subject to license terms. 26 */ 27 28#pragma ident "%Z%%M% %I% %E% SMI" 29 30#include <mcamd_api.h> 31#include <mcamd_err.h> 32#include <mcamd_rowcol_impl.h> 33 34/*
| 1/* 2 * CDDL HEADER START 3 * 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. 7 * 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. 12 * 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] 18 * 19 * CDDL HEADER END 20 */ 21 22/* 23 * 24 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 25 * Use is subject to license terms. 26 */ 27 28#pragma ident "%Z%%M% %I% %E% SMI" 29 30#include <mcamd_api.h> 31#include <mcamd_err.h> 32#include <mcamd_rowcol_impl.h> 33 34/*
|
35 * Chip-Select Bank Address Mode Encodings - BKDG 3.29 3.5.6
| 35 * =========== Chip-Select Bank Address Mode Encodings =======================
|
36 */
| 36 */
|
37static const struct bankaddr_mode bankaddr_modes_pre_d[]; 38static const struct bankaddr_mode bankaddr_modes_d_e[];
| |
39
| 37
|
40static const struct bam_desc { 41 int rev;
| 38/* Individual table declarations */ 39static const struct rct_bnkaddrmode bnkaddr_tbls_pre_d[]; 40static const struct rct_bnkaddrmode bnkaddr_tbls_d_e[]; 41static const struct rct_bnkaddrmode bnkaddr_tbls_f[]; 42 43/* Managing bank address mode tables */ 44static const struct _bnkaddrmode_tbldesc { 45 uint_t revmask;
|
42 int nmodes;
| 46 int nmodes;
|
43 const struct bankaddr_mode *modetbl; 44} bankaddr_modes[] = { 45 { MC_REV_PRE_D, 7, bankaddr_modes_pre_d }, 46 { MC_REV_D_E, 11, bankaddr_modes_d_e },
| 47 const struct rct_bnkaddrmode *modetbl; 48} bnkaddr_tbls[] = { 49 { MC_REVS_BC, 7, bnkaddr_tbls_pre_d }, 50 { MC_REVS_DE, 11, bnkaddr_tbls_d_e }, 51 { MC_REVS_FG, 12, bnkaddr_tbls_f },
|
47}; 48 49/*
| 52}; 53 54/*
|
50 * DRAM Address Mappings for bank/row/column - BKDG 3.29 3.5.6.1
| 55 * =========== DRAM Address Mappings for bank/row/column =====================
|
51 */
| 56 */
|
52static const struct csrcb_map_tbl dram_addrmap_pre_d_128; 53static const struct csrcb_map_tbl dram_addrmap_pre_d_64; 54static const struct csrcb_map_tbl dram_addrmap_d_e_64; 55static const struct csrcb_map_tbl dram_addrmap_d_e_128;
| |
56
| 57
|
57static const struct rcbmap_desc {
| 58 59/* Individual table declarations */ 60struct _rcbmap_tbl { 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]; 64}; 65 66static const struct _rcbmap_tbl dram_addrmap_pre_d_64; 67static const struct _rcbmap_tbl dram_addrmap_pre_d_128; 68static const struct _rcbmap_tbl dram_addrmap_d_e_64; 69static const struct _rcbmap_tbl dram_addrmap_d_e_128; 70static const struct _rcbmap_tbl dram_addrmap_f_64; 71static const struct _rcbmap_tbl dram_addrmap_f_128; 72 73/* Managing row/column/bank tables */ 74static const struct _rcbmap_tbldesc {
|
58 int nmodes;
| 75 int nmodes;
|
59 const struct csrcb_map_tbl *rcbmap; 60} rcbmaps[] = {
| 76 const struct _rcbmap_tbl *rcbmap; 77} rcbmap_tbls[] = {
|
61 { 7, &dram_addrmap_pre_d_64 }, 62 { 7, &dram_addrmap_pre_d_128 }, 63 { 11, &dram_addrmap_d_e_64 }, 64 { 11, &dram_addrmap_d_e_128 },
| 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 },
|
65}; 66 67/*
| 84}; 85 86/*
|
68 * Lookup the Chip-Select Bank Address Mode Encoding table for a given 69 * chip revision and chip-select mode.
| 87 * =========== Bank swizzling information ====================================
|
70 */
| 88 */
|
71const struct bankaddr_mode * 72rct_bankaddr_mode(uint_t mcrev, uint_t csmode) 73{ 74 int i; 75 const struct bam_desc *bdp = bankaddr_modes;
| |
76
| 89
|
77 for (i = 0; i < sizeof (bankaddr_modes) / sizeof (struct bam_desc); 78 i++, bdp++) { 79 if (bdp->rev == mcrev && csmode < bdp->nmodes) 80 return (&bdp->modetbl[csmode]);
| 90/* Individual table declarations */ 91struct _bnkswzl_tbl { 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; 95};
|
81
| 96
|
82 }
| 97static const struct _bnkswzl_tbl bnswzl_info_e_64; 98static const struct _bnkswzl_tbl bnswzl_info_e_128; 99static const struct _bnkswzl_tbl bnswzl_info_f_64; 100static const struct _bnkswzl_tbl bnswzl_info_f_128;
|
83
| 101
|
84 return (NULL); 85}
| 102/* Managing bank swizzle tables */ 103static const struct _bnkswzl_tbl *bnkswzl_tbls[] = { 104 &bnswzl_info_e_64, 105 &bnswzl_info_e_128, 106 &bnswzl_info_f_64, 107 &bnswzl_info_f_128, 108};
|
86 87/*
| 109 110/*
|
88 * Lookup the DRAM Address Mapping table for a given chip revision, access 89 * width, bank-swizzle and chip-select mode.
| 111 * ====================================================================== 112 * | Tables reflecting those in the BKDG | 113 * ======================================================================
|
90 */
| 114 */
|
91const struct csrcb_map * 92rct_rcbmap(uint_t mcrev, int width, uint_t csmode) 93{ 94 const struct csrcb_map_tbl *rcbm; 95 int i;
| |
96
| 115
|
97 for (i = 0; i < sizeof (rcbmaps) / sizeof (struct rcbmap_desc); i++) { 98 rcbm = rcbmaps[i].rcbmap; 99 if (rcbm->mt_rev == mcrev && rcbm->mt_width == width && 100 csmode < rcbmaps[i].nmodes) 101 return (&rcbm->mt_csmap[csmode]); 102 } 103 104 return (NULL); 105} 106
| |
107/*
| 116/*
|
108 * DRAM Address Mapping in Interleaving Mode - BKDG 3.29 section 3.5.6.2.
| 117 * DRAM Address Mapping in Interleaving Mode
|
109 * 110 * Chip-select interleave is performed by addressing across the columns 111 * of the first row of internal bank-select 0 on a chip-select, then the 112 * next row on internal bank-select 1, then 2 then 3; instead of then 113 * moving on to the next row of this chip-select we then rotate across 114 * other chip-selects in the interleave. The row/column/bank mappings 115 * described elsewhere in this file show that a DRAM InputAddr breaks down
| 118 * 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
|
116 * as follows (example is the first line of table 7 which is for a 32MB 117 * chip-select requiring 25 bits to address all of it) for the non-interleaved 118 * case:
| 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.
|
119 * 120 * chip-selection bits | offset within chip-select bits | 121 * | row bits | bank bits | column bits | - | 122 * 24 13 12 11 10 3 2 0 123 * 124 * The high-order chip-selection bits select the chip-select and the 125 * offset bits offset within the chosen chip-select. 126 * 127 * To establish say a 2-way interleave in which we consume all of one 128 * row number and all internal bank numbers on one cs before moving on 129 * to the next to do the same we will target the first row bit - bit 13; 130 * a 4-way interleave would use bits 14 and 13, and an 8-way interleave 131 * bits 15, 14 and 13. We swap the chosen bits with the least significant 132 * high order chip-selection bits. 133 *
| 127 * 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 131 * 132 * The high-order chip-selection bits select the chip-select and the 133 * offset bits offset within the chosen chip-select. 134 * 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. 141 *
|
134 * Tables 13-16 of BKDG 3.5.6.2 really just describe the above. Working
| 142 * The BKDG interleave tables really just describe the above. Working
|
135 * out the high-order bits to swap is easy since that is derived directly 136 * from the chip-select size. The low-order bits depend on the device 137 * parameters since we need to target the least significant row address bits -
| 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 -
|
138 * but we have that information from the rcbmaps since the first row bit
| 146 * but we have that information from the rcbmap_tbls since the first row bit
|
139 * simply follows the last bank address bit.
| 147 * simply follows the last bank address bit.
|
140 * 141 * Short version: we will do tables 13 to 16 programatically rather than 142 * replicating those tables.
| |
143 */ 144 145/*
| 148 */ 149 150/*
|
146 * Yet another highbit function. This really needs to go to common source. 147 * Returns range 0 to 64 inclusive; 148 */ 149static int 150topbit(uint64_t i) 151{ 152 int h = 1; 153 154 if (i == 0) 155 return (0); 156 157 if (i & 0xffffffff00000000ULL) { 158 h += 32; 159 i >>= 32; 160 } 161 162 if (i & 0xffff0000) { 163 h += 16; 164 i >>= 16; 165 } 166 167 if (i & 0xff00) { 168 h += 8; 169 i >>= 8; 170 } 171 172 if (i & 0xf0) { 173 h += 4; 174 i >>= 4; 175 } 176 177 if (i & 0xc) { 178 h += 2; 179 i >>= 2; 180 } 181 182 if (i & 0x2) 183 h += 1; 184 185 return (h); 186} 187 188void 189rct_csintlv_bits(uint_t mcrev, int width, uint_t csmode, int factor, 190 struct csintlv_desc *csid) 191{ 192 int i, lstbnkbit; 193 size_t csz; 194 const struct bankaddr_mode *bam; 195 const struct csrcb_map *rcm; 196 197 /* 198 * 8-way cs interleave for some large cs sizes in 128-bit mode is 199 * not implemented. 200 */ 201 if (factor == 8 && width == 128 && 202 ((mcrev == MC_REV_PRE_D && csmode == 0x6) || 203 (mcrev == MC_REV_D_E && (csmode == 0x9 || csmode == 0xa)))) { 204 csid->csi_factor = 0; 205 return; 206 } 207 208 if ((bam = rct_bankaddr_mode(mcrev, csmode)) == NULL || 209 (rcm = rct_rcbmap(mcrev, width, csmode)) == NULL) { 210 csid->csi_factor = 0; 211 return; 212 } 213 214 csz = MC_CS_SIZE(bam, width); 215 216 switch (factor) { 217 case 2: 218 csid->csi_nbits = 1; 219 break; 220 case 4: 221 csid->csi_nbits = 2; 222 break; 223 case 8: 224 csid->csi_nbits = 3; 225 break; 226 default: 227 csid->csi_factor = 0; 228 return; 229 } 230 231 csid->csi_hibit = topbit(csz) - 1; 232 233 lstbnkbit = 0; 234 for (i = 0; i < MC_RC_BANKBITS; i++) { 235 /* first bank arg for a bit is "real" bank bit */ 236 if (rcm->csrcb_bankargs[i][0] > lstbnkbit) 237 lstbnkbit = rcm->csrcb_bankargs[i][0]; 238 } 239 240 /* first row bit is immediately after last bank bit */ 241 csid->csi_lobit = lstbnkbit + 1; 242 243 csid->csi_factor = factor; 244} 245 246 247/*
| |
248 * General notes for CS Bank Address Mode Encoding tables. 249 *
| 151 * General notes for CS Bank Address Mode Encoding tables. 152 *
|
250 * These are the tables of BKDG 3.29 section 3.5.6. They are indexed 251 * by chip-select mode. Where the numbers of rows and columns is 252 * ambiguous (as it is for a number of rev CG and earlier cases)
| 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)
|
253 * the bam_config should be initialized to 1 and the numbers of rows 254 * and columns should be the maximums. 255 */ 256 257/* 258 * Chip Select Bank Address Mode Encoding for rev CG and earlier. 259 */
| 155 * the bam_config should be initialized to 1 and the numbers of rows 156 * and columns should be the maximums. 157 */ 158 159/* 160 * Chip Select Bank Address Mode Encoding for rev CG and earlier. 161 */
|
260static const struct bankaddr_mode bankaddr_modes_pre_d[] = {
| 162static const struct rct_bnkaddrmode bnkaddr_tbls_pre_d[] = {
|
261 { /* 000 */ 262 32, 12, 8 263 }, 264 { /* 001 */ 265 64, 12, 9 266 }, 267 { /* 010 */
| 163 { /* 000 */ 164 32, 12, 8 165 }, 166 { /* 001 */ 167 64, 12, 9 168 }, 169 { /* 010 */
|
268 128, 13, 10, 1
| 170 128, 13, 10, 1 /* AMBIG */
|
269 }, 270 { /* 011 */
| 171 }, 172 { /* 011 */
|
271 256, 13, 11, 1
| 173 256, 13, 11, 1 /* AMBIG */
|
272 }, 273 { /* 100 */
| 174 }, 175 { /* 100 */
|
274 512, 14, 11, 1
| 176 512, 14, 11, 1 /* AMBIG */
|
275 }, 276 { /* 101 */
| 177 }, 178 { /* 101 */
|
277 1024, 14, 12, 1
| 179 1024, 14, 12, 1 /* AMBIG */
|
278 }, 279 { /* 110 */ 280 2048, 14, 12 281 } 282}; 283 284/* 285 * Chip Select Bank Address Mode Encoding for revs D and E. 286 */
| 180 }, 181 { /* 110 */ 182 2048, 14, 12 183 } 184}; 185 186/* 187 * Chip Select Bank Address Mode Encoding for revs D and E. 188 */
|
287static const struct bankaddr_mode bankaddr_modes_d_e[] = {
| 189static const struct rct_bnkaddrmode bnkaddr_tbls_d_e[] = {
|
288 { /* 0000 */ 289 32, 12, 8 290 }, 291 { /* 0001 */ 292 64, 12, 9 293 }, 294 { /* 0010 */ 295 128, 13, 9 296 }, 297 { /* 0011 */ 298 128, 12, 10 299 }, 300 { /* 0100 */ 301 256, 13, 10 302 }, 303 { /* 0101 */ 304 512, 14, 10 305 }, 306 { /* 0110 */ 307 256, 12, 11 308 }, 309 { /* 0111 */ 310 512, 13, 11 311 }, 312 { /* 1000 */ 313 1024, 14, 11 314 }, 315 { /* 1001 */ 316 1024, 13, 12 317 }, 318 { /* 1010 */ 319 2048, 14, 12 320 } 321}; 322 323/*
| 190 { /* 0000 */ 191 32, 12, 8 192 }, 193 { /* 0001 */ 194 64, 12, 9 195 }, 196 { /* 0010 */ 197 128, 13, 9 198 }, 199 { /* 0011 */ 200 128, 12, 10 201 }, 202 { /* 0100 */ 203 256, 13, 10 204 }, 205 { /* 0101 */ 206 512, 14, 10 207 }, 208 { /* 0110 */ 209 256, 12, 11 210 }, 211 { /* 0111 */ 212 512, 13, 11 213 }, 214 { /* 1000 */ 215 1024, 14, 11 216 }, 217 { /* 1001 */ 218 1024, 13, 12 219 }, 220 { /* 1010 */ 221 2048, 14, 12 222 } 223}; 224 225/*
|
| 226 * Chip Select Bank Address Mode Encoding for rev F 227 */ 228static const struct rct_bnkaddrmode bnkaddr_tbls_f[] = { 229 { /* 0000 */ 230 128, 13, 9 231 }, 232 { /* 0001 */ 233 256, 13, 10 234 }, 235 { /* 0010 */ 236 512, 14, 10 237 }, 238 { /* 0011 */ 239 512, 13, 11 240 }, 241 { /* 0100 */ 242 512, 13, 10 243 }, 244 { /* 0101 */ 245 1024, 14, 10 246 }, 247 { /* 0110 */ 248 1024, 14, 11 249 }, 250 { /* 0111 */ 251 2048, 15, 10 252 }, 253 { /* 1000 */ 254 2048, 14, 11 255 }, 256 { /* 1001 */ 257 4096, 15, 11 258 }, 259 { /* 1010 */ 260 4096, 16, 10 261 }, 262 { /* 1011 */ 263 8192, 16, 11 264 } 265 266}; 267 268/*
|
324 * General notes on Row/Column/Bank table initialisation. 325 * 326 * These are the tables 7, 8, 9, 10, 11 and 12 of BKDG 3.29 section 3.5.6.1. 327 * They apply in non-interleave (node or cs) mode and describe how for 328 * a given revision, access width, bank-swizzle mode, and current chip-select 329 * mode the row, column and internal sdram bank are derived from the 330 * normalizied InputAddr presented to the DRAM controller. 331 * 332 * The mt_csmap array is indexed by chip-select mode. Within it the 333 * bankargs, rowbits and colbits arrays are indexed by bit number, so 334 * match the BKDG tables if the latter are read right-to-left. 335 * 336 * The bankargs list up to three bit numbers per bank bit. For revisions 337 * CG and earlier there is no bank swizzling, so just a single number 338 * should be listed. Revisions D and E have the same row/column/bank mapping, 339 * but rev E has the additional feature of being able to xor two row bits 340 * into each bank bit. The consumer will know whether they are using bank 341 * swizzling - if so then they should xor the bankargs bits together. 342 * The first argument must be the bit number not already used in forming 343 * part of the row address - eg in table 12 for csmode 0000b bank address 344 * bit 0 is bit 12 xor bit 18 xor bit 21, and 18 and 21 are also mentioned in 345 * the row address (bits 10 and 1) so we must list bit 12 first. We will 346 * use this information in chip-select interleave decoding in which we need 347 * to know which is the first bit after column and bank address bits. 348 * 349 * Column address A10 is always used for the Precharge All signal. Where 350 * "PC" appears in the BKDG tables we will include MC_PC_ALL in the 351 * corresponding bit position. 352 * 353 * For some rev CG and earlier chipselect modes the number of rows and columns 354 * is ambiguous. This is reflected in these tables by some bit being 355 * duplicated between row and column address. In practice we will follow 356 * the convention of always assigning the floating bit to the row address. 357 */ 358 359/* 360 * Row/Column/Bank address mappings for rev CG in 64-bit mode, no interleave. 361 * See BKDG 3.29 3.5.6 Table 7. 362 */
| 269 * General notes on Row/Column/Bank table initialisation. 270 * 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. 276 * 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. 280 * 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. 293 * 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. 297 * 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. 302 */ 303 304/* 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. 307 */
|
363static const struct csrcb_map_tbl dram_addrmap_pre_d_64 = { 364 MC_REV_PRE_D,
| 308static const struct _rcbmap_tbl dram_addrmap_pre_d_64 = { 309 MC_REVS_BC,
|
365 64, 366 { 367 { /* 000 */
| 310 64, 311 { 312 { /* 000 */
|
368 { { 11 }, { 12 } },
| 313 2, { 11, 12 },
|
369 { 19, 20, 21, 22, 23, 24, 13, 14, 15, 16, 17, 18 }, 370 { 3, 4, 5, 6, 7, 8, 9, 10 } 371 }, 372 { /* 001 */
| 314 { 19, 20, 21, 22, 23, 24, 13, 14, 15, 16, 17, 18 }, 315 { 3, 4, 5, 6, 7, 8, 9, 10 } 316 }, 317 { /* 001 */
|
373 { { 13 }, { 12 } },
| 318 2, { 13, 12 },
|
374 { 19, 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18 }, 375 { 3, 4, 5, 6, 7, 8, 9, 10, 11 } 376 }, 377 { /* 010 */
| 319 { 19, 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18 }, 320 { 3, 4, 5, 6, 7, 8, 9, 10, 11 } 321 }, 322 { /* 010 */
|
378 { { 13 }, { 12 } },
| 323 2, { 13, 12 },
|
379 { 19, 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18, 26 }, 380 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 26 } 381 }, 382 { /* 011 */
| 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 } 326 }, 327 { /* 011 */
|
383 { { 13 }, { 14 } },
| 328 2, { 13, 14 },
|
384 { 19, 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 27 }, 385 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL, 27 } 386 }, 387 { /* 100 */
| 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 } 331 }, 332 { /* 100 */
|
388 { { 13 }, { 14 } },
| 333 2, { 13, 14 },
|
389 { 19, 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 27, 28 }, 390 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL, 28 } 391 }, 392 { /* 101 */
| 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 } 336 }, 337 { /* 101 */
|
393 { { 15 }, { 14 } },
| 338 2, { 15, 14 },
|
394 { 19, 20, 21, 22, 23, 24, 25, 26, 29, 16, 17, 18, 27, 28 }, 395 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL, 13, 28 } 396 }, 397 { /* 110 */
| 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 } 341 }, 342 { /* 110 */
|
398 { { 15 }, { 14 } },
| 343 2, { 15, 14 },
|
399 { 19, 20, 21, 22, 23, 24, 25, 26, 29, 16, 17, 18, 27, 28 }, 400 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL, 13, 30 } 401 }, 402 /* 403 * remainder unused 404 */ 405 } 406 407}; 408 409/* 410 * Row/Column/Bank address mappings for rev CG in 128-bit mode, no interleave. 411 * See BKDG 3.29 3.5.6 Table 8. 412 */
| 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 } 346 }, 347 /* 348 * remainder unused 349 */ 350 } 351 352}; 353 354/* 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. 357 */
|
413static const struct csrcb_map_tbl dram_addrmap_pre_d_128 = { 414 MC_REV_PRE_D,
| 358static const struct _rcbmap_tbl dram_addrmap_pre_d_128 = { 359 MC_REVS_BC,
|
415 128, 416 { 417 { /* 000 */
| 360 128, 361 { 362 { /* 000 */
|
418 { { 12 }, { 13 } },
| 363 2, { 12, 13 },
|
419 { 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18, 19 }, 420 { 4, 5, 6, 7, 8, 9, 10, 11 } 421 }, 422 { /* 001 */
| 364 { 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18, 19 }, 365 { 4, 5, 6, 7, 8, 9, 10, 11 } 366 }, 367 { /* 001 */
|
423 { { 14 }, { 13 } },
| 368 2, { 14, 13 },
|
424 { 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 19 }, 425 { 4, 5, 6, 7, 8, 9, 10, 11, 12 } 426 }, 427 { /* 010 */
| 369 { 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 19 }, 370 { 4, 5, 6, 7, 8, 9, 10, 11, 12 } 371 }, 372 { /* 010 */
|
428 { { 14 }, { 13 } },
| 373 2, { 14, 13 },
|
429 { 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 19, 27 }, 430 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 27 } 431 }, 432 { /* 011 */
| 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 } 376 }, 377 { /* 011 */
|
433 { { 14 }, { 15 } },
| 378 2, { 14, 15 },
|
434 { 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 19, 28 }, 435 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL, 28 } 436 }, 437 { /* 100 */
| 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 } 381 }, 382 { /* 100 */
|
438 { { 14 }, { 15 } },
| 383 2, { 14, 15 },
|
439 { 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 19, 28, 29 }, 440 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL, 29 } 441 }, 442 { /* 101 */
| 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 } 386 }, 387 { /* 101 */
|
443 { { 16 }, { 15 } },
| 388 2, { 16, 15 },
|
444 { 20, 21, 22, 23, 24, 25, 26, 27, 30, 17, 18, 19, 28, 29 }, 445 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL, 14, 29 } 446 }, 447 { /* 110 */
| 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 } 391 }, 392 { /* 110 */
|
448 { { 16 }, { 15 } },
| 393 2, { 16, 15 },
|
449 { 20, 21, 22, 23, 24, 25, 26, 27, 30, 17, 18, 19, 28, 29 }, 450 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL, 14, 31 } 451 }, 452 /* 453 * remainder unused 454 */ 455 } 456}; 457 458/* 459 * Row/Column/Bank address mappings for rev D/E in 64-bit mode, no interleave. 460 * See BKDG 3.29 3.5.6 Table 9. 461 */
| 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 } 396 }, 397 /* 398 * remainder unused 399 */ 400 } 401}; 402 403/* 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. 406 */
|
462static const struct csrcb_map_tbl dram_addrmap_d_e_64 = { 463 MC_REV_D_E,
| 407static const struct _rcbmap_tbl dram_addrmap_d_e_64 = { 408 MC_REVS_DE,
|
464 64, 465 { 466 { /* 0000 */
| 409 64, 410 { 411 { /* 0000 */
|
467 { { 11, 17, 20 }, { 12, 18, 21 } },
| 412 2, { 11, 12 },
|
468 { 19, 20, 21, 22, 23, 24, 13, 14, 15, 16, 17, 18 }, 469 { 3, 4, 5, 6, 7, 8, 9, 10 } 470 }, 471 { /* 0001 */
| 413 { 19, 20, 21, 22, 23, 24, 13, 14, 15, 16, 17, 18 }, 414 { 3, 4, 5, 6, 7, 8, 9, 10 } 415 }, 416 { /* 0001 */
|
472 { { 12, 17, 20 }, { 13, 18, 21 } },
| 417 2, { 12, 13 },
|
473 { 19, 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18, 26 }, 474 { 3, 4, 5, 6, 7, 8, 9, 10, 11 } 475 }, 476 { /* 0010 */
| 418 { 19, 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18, 26 }, 419 { 3, 4, 5, 6, 7, 8, 9, 10, 11 } 420 }, 421 { /* 0010 */
|
477 { { 12, 17, 20 }, { 13, 18, 21 } },
| 422 2, { 12, 13 },
|
478 { 19, 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18, 26 }, 479 { 3, 4, 5, 6, 7, 8, 9, 10, 11 } 480 }, 481 { /* 0011 */
| 423 { 19, 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18, 26 }, 424 { 3, 4, 5, 6, 7, 8, 9, 10, 11 } 425 }, 426 { /* 0011 */
|
482 { { 13, 17, 20 }, { 14, 18, 21 } },
| 427 2, { 13, 14 },
|
483 { 19, 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 27, 28 }, 484 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 } 485 }, 486 { /* 0100 */
| 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 } 430 }, 431 { /* 0100 */
|
487 { { 13, 17, 20 }, { 14, 18, 21 } },
| 432 2, { 13, 14 },
|
488 { 19, 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 27, 28 }, 489 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 } 490 }, 491 { /* 0101 */
| 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 } 435 }, 436 { /* 0101 */
|
492 { { 13, 17, 20 }, { 14, 18, 21 } },
| 437 2, { 13, 14 },
|
493 { 19, 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 27, 28 }, 494 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 } 495 }, 496 { /* 0110 */
| 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 } 440 }, 441 { /* 0110 */
|
497 { { 14, 17, 20 }, { 15, 18, 21 } },
| 442 2, { 14, 15 },
|
498 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 28, 29 }, 499 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL, 13 } 500 }, 501 { /* 0111 */
| 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 } 445 }, 446 { /* 0111 */
|
502 { { 14, 17, 20 }, { 15, 18, 21 } },
| 447 2, { 14, 15 },
|
503 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 28, 29 }, 504 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL, 13 } 505 }, 506 { /* 1000 */
| 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 } 450 }, 451 { /* 1000 */
|
507 { { 14, 17, 20 }, { 15, 18, 21 } },
| 452 2, { 14, 15 },
|
508 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 28, 29 }, 509 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL, 13 } 510 }, 511 { /* 1001 */
| 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 } 455 }, 456 { /* 1001 */
|
512 { { 15, 17, 20 }, { 16, 18, 21 } },
| 457 2, { 15, 16 },
|
513 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 17, 18, 29, 30 }, 514 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL, 13, 14 } 515 }, 516 { /* 1010 */
| 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 } 460 }, 461 { /* 1010 */
|
517 { { 15, 17, 20 }, { 16, 18, 21 } },
| 462 2, { 15, 16 },
|
518 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 17, 18, 29, 30 }, 519 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL, 13, 14 } 520 }, 521 /* 522 * remainder unused 523 */ 524 } 525}; 526 527/* 528 * Row/Column/Bank address mappings for rev D/E in 128-bit mode, no interleave. 529 * See BKDG 3.29 3.5.6 Table 9. 530 */
| 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 } 465 }, 466 /* 467 * remainder unused 468 */ 469 } 470}; 471 472/* 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. 475 */
|
531static const struct csrcb_map_tbl dram_addrmap_d_e_128 = { 532 MC_REV_D_E,
| 476static const struct _rcbmap_tbl dram_addrmap_d_e_128 = { 477 MC_REVS_DE,
|
533 128, 534 { 535 { /* 0000 */
| 478 128, 479 { 480 { /* 0000 */
|
536 { { 12, 18, 21 }, { 13, 19, 22 } },
| 481 2, { 12, 13 },
|
537 { 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18, 19 }, 538 { 4, 5, 6, 7, 8, 9, 10, 11 } 539 }, 540 { /* 0001 */
| 482 { 20, 21, 22, 23, 24, 25, 14, 15, 16, 17, 18, 19 }, 483 { 4, 5, 6, 7, 8, 9, 10, 11 } 484 }, 485 { /* 0001 */
|
541 { { 13, 18, 21 }, { 14, 19, 22 } },
| 486 2, { 13, 14 },
|
542 { 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 19, 27 }, 543 { 4, 5, 6, 7, 8, 9, 10, 11, 12 } 544 }, 545 { /* 0010 */
| 487 { 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 19, 27 }, 488 { 4, 5, 6, 7, 8, 9, 10, 11, 12 } 489 }, 490 { /* 0010 */
|
546 { { 13, 18, 21 }, { 14, 19, 22 } },
| 491 2, { 13, 14 },
|
547 { 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 19, 27 }, 548 { 4, 5, 6, 7, 8, 9, 10, 11, 12 } 549 }, 550 { /* 0011 */
| 492 { 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 19, 27 }, 493 { 4, 5, 6, 7, 8, 9, 10, 11, 12 } 494 }, 495 { /* 0011 */
|
551 { { 14, 18, 21 }, { 15, 19, 22 } },
| 496 2, { 14, 15 },
|
552 { 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 19, 28, 29 }, 553 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 } 554 }, 555 { /* 0100 */
| 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 } 499 }, 500 { /* 0100 */
|
556 { { 14, 18, 21 }, { 15, 19, 22 } },
| 501 2, { 14, 15 },
|
557 { 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 19, 28, 29 }, 558 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 } 559 }, 560 { /* 0101 */
| 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 } 504 }, 505 { /* 0101 */
|
561 { { 14, 18, 21 }, { 15, 19, 22 } },
| 506 2, { 14, 15 },
|
562 { 20, 21, 22, 23, 24, 25, 26, 27, 16, 17, 18, 19, 28, 29 }, 563 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 } 564 }, 565 { /* 0110 */
| 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 } 509 }, 510 { /* 0110 */
|
566 { { 15, 18, 21 }, { 16, 19, 22 } },
| 511 2, { 15, 16 },
|
567 { 20, 21, 22, 23, 24, 25, 26, 27, 28, 17, 18, 19, 29, 30 }, 568 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL, 14 } 569 }, 570 { /* 0111 */
| 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 } 514 }, 515 { /* 0111 */
|
571 { { 15, 18, 21 }, { 16, 19, 22 } },
| 516 2, { 15, 16 },
|
572 { 20, 21, 22, 23, 24, 25, 26, 27, 28, 17, 18, 19, 29, 30 }, 573 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL, 14 } 574 }, 575 { /* 1000 */
| 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 } 519 }, 520 { /* 1000 */
|
576 { { 15, 18, 21 }, { 16, 19, 22 } },
| 521 2, { 15, 16 },
|
577 { 20, 21, 22, 23, 24, 25, 26, 27, 28, 17, 18, 19, 29, 30 }, 578 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL, 14 } 579 }, 580 { /* 1001 */
| 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 } 524 }, 525 { /* 1001 */
|
581 { { 16, 18, 21 }, { 17, 19, 22 } },
| 526 2, { 16, 17 },
|
582 { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 18, 19, 30, 31 }, 583 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL, 14, 15 } 584 }, 585 { /* 1010 */
| 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 } 529 }, 530 { /* 1010 */
|
586 { { 16, 18, 21 }, { 17, 19, 22 } },
| 531 2, { 16, 17 },
|
587 { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 18, 19, 30, 31 }, 588 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL, 14, 15 } 589 }, 590 /* 591 * remainder unused 592 */ 593 } 594};
| 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 } 534 }, 535 /* 536 * remainder unused 537 */ 538 } 539};
|
| 540 541/* 542 * Row/Column/Bank address mappings for revs F/G in 64-bit mode, no interleave. 543 */ 544static const struct _rcbmap_tbl dram_addrmap_f_64 = { 545 MC_REVS_FG, 546 64, 547 { 548 { /* 0000 */ 549 2, { 12, 13 }, 550 { 18, 19, 20, 21, 22, 23, 24, 25, 26, 14, 15, 16, 17 }, 551 { 3, 4, 5, 6, 7, 8, 9, 10, 11 }, 552 }, 553 { /* 0001 */ 554 2, { 13, 14 }, 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 }, 557 }, 558 { /* 0010 */ 559 2, { 13, 14 }, 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 }, 562 }, 563 { /* 0011 */ 564 2, { 14, 15 }, 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 }, 567 }, 568 { /* 0100 */ 569 3, { 13, 14, 15 }, 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 }, 572 }, 573 { /* 0101 */ 574 3, { 13, 14, 15 }, 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 } 577 }, 578 { /* 0110 */ 579 2, { 14, 15 }, 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 }, 582 }, 583 { /* 0111 */ 584 3, { 13, 14, 15 }, 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 } 587 }, 588 { /* 1000 */ 589 3, { 14, 15, 16 }, 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 }, 592 }, 593 { /* 1001 */ 594 3, { 14, 15, 16 }, 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 }, 597 }, 598 { /* 1010 */ 599 3, { 13, 14, 15 }, 600 { 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 601 16, 17 }, 602 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 } 603 }, 604 { /* 1011 */ 605 3, { 14, 15, 16 }, 606 { 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 607 17 }, 608 { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, MC_PC_ALL, 13 }, 609 }, 610 /* 611 * remainder unused 612 */ 613 } 614}; 615 616/* 617 * Row/Column/Bank address mappings for revs F/G in 128-bit mode, no interleave. 618 */ 619static const struct _rcbmap_tbl dram_addrmap_f_128 = { 620 MC_REVS_FG, 621 128, 622 { 623 { /* 0000 */ 624 2, { 13, 14 }, 625 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 15, 16, 17, 18 }, 626 { 4, 5, 6, 7, 8, 9, 10, 11, 12 }, 627 }, 628 { /* 0001 */ 629 2, { 14, 15 }, 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 }, 632 }, 633 { /* 0010 */ 634 2, { 14, 15 }, 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 }, 637 }, 638 { /* 0011 */ 639 2, { 15, 16 }, 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 }, 642 }, 643 { /* 0100 */ 644 3, { 14, 15, 16 }, 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 }, 647 }, 648 { /* 0101 */ 649 3, { 14, 15, 16 }, 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 }, 652 }, 653 { /* 0110 */ 654 2, { 15, 16 }, 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 }, 657 }, 658 { /* 0111 */ 659 3, { 14, 15, 16 }, 660 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 661 17, 18 }, 662 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }, 663 }, 664 { /* 1000 */ 665 3, { 15, 16, 17 }, 666 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 667 18 }, 668 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL, 14 }, 669 }, 670 { /* 1001 */ 671 3, { 15, 16, 17 }, 672 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 673 18 }, 674 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL, 14 }, 675 }, 676 { /* 1010 */ 677 3, { 14, 15, 16 }, 678 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 679 17, 18 }, 680 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }, 681 }, 682 { /* 1011 */ 683 3, { 15, 16, 17 }, 684 { 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 685 18 }, 686 { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, MC_PC_ALL, 14 }, 687 }, 688 /* 689 * remainder unused 690 */ 691 } 692}; 693 694/* 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. 699 * 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). 705 */ 706 707static const struct _bnkswzl_tbl bnswzl_info_e_64 = { 708 MC_REV_E, 709 64, 710 { 711 { 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 */ 715 } 716 } 717}; 718 719static const struct _bnkswzl_tbl bnswzl_info_e_128 = { 720 MC_REV_E, 721 128, 722 { 723 { 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 */ 727 } 728 } 729}; 730 731static const struct _bnkswzl_tbl bnswzl_info_f_64 = { 732 MC_REVS_FG, 733 64, 734 { 735 { 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 */ 739 } 740 } 741}; 742 743static const struct _bnkswzl_tbl bnswzl_info_f_128 = { 744 MC_REVS_FG, 745 128, 746 { 747 { 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 */ 751 } 752 } 753}; 754 755/* 756 * Yet another highbit function. This really needs to go to common source. 757 * Returns range 0 to 64 inclusive; 758 */ 759static int 760topbit(uint64_t i) 761{ 762 int h = 1; 763 764 if (i == 0) 765 return (0); 766 767 if (i & 0xffffffff00000000ULL) { 768 h += 32; 769 i >>= 32; 770 } 771 772 if (i & 0xffff0000) { 773 h += 16; 774 i >>= 16; 775 } 776 777 if (i & 0xff00) { 778 h += 8; 779 i >>= 8; 780 } 781 782 if (i & 0xf0) { 783 h += 4; 784 i >>= 4; 785 } 786 787 if (i & 0xc) { 788 h += 2; 789 i >>= 2; 790 } 791 792 if (i & 0x2) 793 h += 1; 794 795 return (h); 796} 797 798/* 799 * Lookup the Chip-Select Bank Address Mode Encoding table for a given 800 * chip revision and chip-select mode. 801 */ 802const struct rct_bnkaddrmode * 803rct_bnkaddrmode(uint_t mcrev, uint_t csmode) 804{ 805 int i; 806 const struct _bnkaddrmode_tbldesc *bdp = bnkaddr_tbls; 807 808 for (i = 0; i < sizeof (bnkaddr_tbls) / 809 sizeof (struct _bnkaddrmode_tbldesc); 810 i++, bdp++) { 811 if (MC_REV_MATCH(mcrev, bdp->revmask) && csmode < bdp->nmodes) 812 return (&bdp->modetbl[csmode]); 813 814 } 815 816 return (NULL); 817} 818 819/* 820 * Lookup the DRAM Address Mapping table for a given chip revision, access 821 * width, bank-swizzle and chip-select mode. 822 */ 823const struct rct_rcbmap * 824rct_rcbmap(uint_t mcrev, int width, uint_t csmode) 825{ 826 const struct _rcbmap_tbl *rcbm; 827 int i; 828 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]); 835 } 836 837 return (NULL); 838} 839 840/* 841 * Lookup the bank swizzling information for a given chip revision and 842 * access width. 843 */ 844const struct rct_bnkswzlinfo * 845rct_bnkswzlinfo(uint_t mcrev, int width) 846{ 847 int i; 848 const struct _bnkswzl_tbl *swztp; 849 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); 856 } 857 858 return (NULL); 859} 860 861void 862rct_csintlv_bits(uint_t mcrev, int width, uint_t csmode, int factor, 863 struct rct_csintlv *csid) 864{ 865 int i, lstbnkbit; 866 size_t csz; 867 const struct rct_bnkaddrmode *bam; 868 const struct rct_rcbmap *rcm; 869 870 /* 871 * 8-way cs interleave for some large cs sizes in 128-bit mode is 872 * not implemented prior to rev F. 873 */ 874 if (factor == 8 && width == 128 && 875 ((MC_REV_MATCH(mcrev, MC_REVS_BC) && csmode == 0x6) || 876 (MC_REV_MATCH(mcrev, MC_REVS_DE) && 877 (csmode == 0x9 || csmode == 0xa)))) { 878 csid->csi_factor = 0; 879 return; 880 } 881 882 if ((bam = rct_bnkaddrmode(mcrev, csmode)) == NULL || 883 (rcm = rct_rcbmap(mcrev, width, csmode)) == NULL) { 884 csid->csi_factor = 0; 885 return; 886 } 887 888 csz = MC_CS_SIZE(bam, width); 889 890 switch (factor) { 891 case 2: 892 csid->csi_nbits = 1; 893 break; 894 case 4: 895 csid->csi_nbits = 2; 896 break; 897 case 8: 898 csid->csi_nbits = 3; 899 break; 900 default: 901 csid->csi_factor = 0; 902 return; 903 } 904 905 csid->csi_hibit = topbit(csz) - 1; 906 907 /* 908 * The first row bit is immediately after the last bank bit. 909 */ 910 lstbnkbit = 0; 911 for (i = 0; i < rcm->rcb_nbankbits; i++) 912 if (rcm->rcb_bankbit[i] > lstbnkbit) 913 lstbnkbit = rcm->rcb_bankbit[i]; 914 915 csid->csi_lobit = lstbnkbit + 1; 916 917 csid->csi_factor = factor; 918}
|
| |