mcamd_rowcol_impl.h (7aec1d6e) | mcamd_rowcol_impl.h (8a40a695) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the | 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, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. | 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. |
8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. --- 34 unchanged lines hidden (view full) --- 50 51#define BITS(val, high, low) \ 52 ((val) & (((2ULL << (high)) - 1) & ~((1ULL << (low)) - 1))) 53 54#define SETBIT(var, num) (var |= (1ULL << (num))) 55 56#define BITVAL(var, num) ((BIT(var, num) >> (num)) & 1ULL) 57 | 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. --- 34 unchanged lines hidden (view full) --- 49 50#define BITS(val, high, low) \ 51 ((val) & (((2ULL << (high)) - 1) & ~((1ULL << (low)) - 1))) 52 53#define SETBIT(var, num) (var |= (1ULL << (num))) 54 55#define BITVAL(var, num) ((BIT(var, num) >> (num)) & 1ULL) 56 |
58#define MC_RC_ROW_MAX 14 /* maximum number of row address bits */ 59#define MC_RC_COL_MAX 12 /* maximum number of col address bits */ 60#define MC_RC_BANKBITS 2 /* number of internal banksel bits */ 61#define MC_RC_BANKARGS 3 /* bits used for 1 banksel bit */ 62#define MC_RC_CSMODES 16 /* max number of cs bankaddr modes */ | 57#define MC_RC_ROW_MAX 16 /* maximum number of row address bits */ 58#define MC_RC_COL_MAX 12 /* maximum number of col address bits */ 59#define MC_RC_BANKBITS_MAX 3 /* number of internal banksel bits */ 60#define MC_RC_CSMODES 16 /* max number of cs bankaddr modes */ 61#define MC_RC_SWZLBITS 2 /* number of row bits in swizzle */ |
63 | 62 |
64/* 65 * Row, column and bank mapping is derived after allowing for interleave 66 * from the normalized dram address through the tables of BKDG 3.29 67 * section 3.5.6.1. We have tables for: 68 * 69 * . rev CG and earlier, 64-bit MC mode 70 * . rev CG and earlier, 128-bit MC mode 71 * . rev D and later, 64-bit MC mode (no bank swizzling if rev E) 72 * . rev D and later, 128-bit MC mode (no bank swizzling if rev E) 73 * . rev E and later, 64-bit MC mode with bank swizzling 74 * . rev E and later, 128-bit MC mode with bank swizzling 75 * 76 * Each table is indexed by CS Mode (equivalently, CS size) and tells us 77 * which bits of the normalized dram address (i.e., the address modified for 78 * the local MC base address and with node interleave selection bits removed) 79 * to use in forming the column address, row address and internal bank 80 * selection. 81 * 82 * Note that for rev CG and earlier there is some overloading of CS mode 83 * encoding such that we do not know the number of row and column address 84 * bits from the CS mode alone, e.g., for 128MB DIMM modules we may have 85 * 13 row bits and 9 column, or 12 row and 10 column. In these case the 86 * tables held in the structures defined below will have a duplicated bit 87 * number in the row and column bits. In these ambiguous cases cm_rc_ambig 88 * should be set in the table. 89 */ 90 91struct bankaddr_mode { | 63struct rct_bnkaddrmode { |
92 int bam_sizemb; /* DIMM size in MB */ 93 int bam_nrows; /* number of row address bits */ 94 int bam_ncols; /* number of column address bits */ 95 int bam_ambig; /* numbers are maximums; keep last */ 96}; 97 | 64 int bam_sizemb; /* DIMM size in MB */ 65 int bam_nrows; /* number of row address bits */ 66 int bam_ncols; /* number of column address bits */ 67 int bam_ambig; /* numbers are maximums; keep last */ 68}; 69 |
98struct csrcb_map { 99 int csrcb_bankargs[MC_RC_BANKBITS][MC_RC_BANKARGS]; 100 int csrcb_rowbits[MC_RC_ROW_MAX]; 101 int csrcb_colbits[MC_RC_COL_MAX + 1]; /* one for MC_PC_ALL */ | 70struct rct_rcbmap { 71 int rcb_nbankbits; /* # of bank address bits */ 72 int rcb_bankbit[MC_RC_BANKBITS_MAX]; /* bank address bits */ 73 int rcb_rowbit[MC_RC_ROW_MAX]; 74 int rcb_colbit[MC_RC_COL_MAX + 1]; /* one for MC_PC_ALL */ |
102}; 103 | 75}; 76 |
104struct csrcb_map_tbl { 105 int mt_rev; /* revision to which this applies */ 106 int mt_width; /* MC mode (64 or 128) */ 107 struct csrcb_map mt_csmap[MC_RC_CSMODES]; | 77struct rct_bnkswzlinfo { 78 int bswz_rowbits[MC_RC_BANKBITS_MAX][MC_RC_SWZLBITS]; |
108}; 109 | 79}; 80 |
110struct csintlv_desc { | 81struct rct_csintlv { |
111 int csi_factor; /* cs interleave factor */ 112 int csi_hibit; /* first non-offset bit in addr */ 113 int csi_lobit; /* first row bit in addr */ 114 int csi_nbits; /* number of bits to swap in mask */ 115}; 116 117#define MC_RC_CSI_SWAPPED_BIT(csidp, n) \ 118 (csidp->csi_factor && n >= csidp->csi_lobit && \ 119 n <= csidp->csi_lobit + csidp->csi_nbits - 1) 120 121#define MC_RC_CSI_BITSWAP(csidp, n) \ 122 (csidp->csi_hibit + n - csidp->csi_lobit) 123 | 82 int csi_factor; /* cs interleave factor */ 83 int csi_hibit; /* first non-offset bit in addr */ 84 int csi_lobit; /* first row bit in addr */ 85 int csi_nbits; /* number of bits to swap in mask */ 86}; 87 88#define MC_RC_CSI_SWAPPED_BIT(csidp, n) \ 89 (csidp->csi_factor && n >= csidp->csi_lobit && \ 90 n <= csidp->csi_lobit + csidp->csi_nbits - 1) 91 92#define MC_RC_CSI_BITSWAP(csidp, n) \ 93 (csidp->csi_hibit + n - csidp->csi_lobit) 94 |
124extern const struct bankaddr_mode *rct_bankaddr_mode(uint_t, uint_t); 125extern const struct csrcb_map *rct_rcbmap(uint_t, int, uint_t); 126extern void rct_csintlv_bits(uint_t, int, uint_t, int, struct csintlv_desc *); | 95extern const struct rct_bnkaddrmode *rct_bnkaddrmode(uint_t, uint_t); 96extern const struct rct_rcbmap *rct_rcbmap(uint_t, int, uint_t); 97extern const struct rct_bnkswzlinfo *rct_bnkswzlinfo(uint_t, int); 98extern void rct_csintlv_bits(uint_t, int, uint_t, int, struct rct_csintlv *); |
127 128#ifdef __cplusplus 129} 130#endif 131 132#endif /* _MCAMD_ROWCOL_IMPL_H */ | 99 100#ifdef __cplusplus 101} 102#endif 103 104#endif /* _MCAMD_ROWCOL_IMPL_H */ |