nb/intel/x4x: Fix unpopulated value
Previously, 0x0 was the value being used for an unpopulated dimm on spd[62], however some DDR2 dimms have 0x0 as a valid value. Now use 0xff which is an unused value even on DDR2/DDR3. Change-Id: I55a91a6c3fe3733a7bb2abc45ca352c955c07c99 Signed-off-by: Damien Zammit <damien@zamaudio.com> Reviewed-on: https://review.coreboot.org/15058 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
parent
062ef1cca6
commit
68e1dcfdd9
|
@ -41,14 +41,14 @@ static void sdram_read_spds(struct sysinfo *s)
|
||||||
FOR_EACH_DIMM(i) {
|
FOR_EACH_DIMM(i) {
|
||||||
if (s->spd_map[i] == 0) {
|
if (s->spd_map[i] == 0) {
|
||||||
/* Non-existent SPD address */
|
/* Non-existent SPD address */
|
||||||
s->dimms[i].card_type = 0;
|
s->dimms[i].card_type = RAW_CARD_UNPOPULATED;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (j = 0; j < 64; j++) {
|
for (j = 0; j < 64; j++) {
|
||||||
status = spd_read_byte(s->spd_map[i], j);
|
status = spd_read_byte(s->spd_map[i], j);
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
/* No SPD here */
|
/* No SPD here */
|
||||||
s->dimms[i].card_type = 0;
|
s->dimms[i].card_type = RAW_CARD_UNPOPULATED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
s->dimms[i].spd_data[j] = (u8) status;
|
s->dimms[i].spd_data[j] = (u8) status;
|
||||||
|
|
|
@ -1506,7 +1506,7 @@ static void dradrb_ddr2(struct sysinfo *s)
|
||||||
rankpop0 = 0;
|
rankpop0 = 0;
|
||||||
rankpop1 = 0;
|
rankpop1 = 0;
|
||||||
FOR_EACH_POPULATED_RANK(s->dimms, ch, r) {
|
FOR_EACH_POPULATED_RANK(s->dimms, ch, r) {
|
||||||
if ((s->dimms[ch<<1].card_type && ((r) < s->dimms[ch<<1].ranks))) {
|
if (((s->dimms[ch<<1].card_type != RAW_CARD_UNPOPULATED) && ((r) < s->dimms[ch<<1].ranks))) {
|
||||||
i = ch << 1;
|
i = ch << 1;
|
||||||
} else {
|
} else {
|
||||||
i = (ch << 1) + 1;
|
i = (ch << 1) + 1;
|
||||||
|
@ -1541,7 +1541,7 @@ static void dradrb_ddr2(struct sysinfo *s)
|
||||||
|
|
||||||
// DRB
|
// DRB
|
||||||
FOR_EACH_POPULATED_RANK(s->dimms, ch, r) {
|
FOR_EACH_POPULATED_RANK(s->dimms, ch, r) {
|
||||||
if ((s->dimms[ch<<1].card_type && ((r) < s->dimms[ch<<1].ranks))) {
|
if (((s->dimms[ch<<1].card_type != RAW_CARD_UNPOPULATED) && ((r) < s->dimms[ch<<1].ranks))) {
|
||||||
i = ch << 1;
|
i = ch << 1;
|
||||||
} else {
|
} else {
|
||||||
i = (ch << 1) + 1;
|
i = (ch << 1) + 1;
|
||||||
|
|
|
@ -144,9 +144,10 @@
|
||||||
|
|
||||||
#define TOTAL_CHANNELS 2
|
#define TOTAL_CHANNELS 2
|
||||||
#define TOTAL_DIMMS 4
|
#define TOTAL_DIMMS 4
|
||||||
|
#define RAW_CARD_UNPOPULATED 0xff
|
||||||
|
|
||||||
#define DIMM_IS_POPULATED(dimms, idx) (dimms[idx].card_type != 0)
|
#define DIMM_IS_POPULATED(dimms, idx) (dimms[idx].card_type != RAW_CARD_UNPOPULATED)
|
||||||
#define IF_DIMM_POPULATED(dimms, idx) if (dimms[idx].card_type != 0)
|
#define IF_DIMM_POPULATED(dimms, idx) if (dimms[idx].card_type != RAW_CARD_UNPOPULATED)
|
||||||
#define ONLY_DIMMA_IS_POPULATED(dimms, ch) ( \
|
#define ONLY_DIMMA_IS_POPULATED(dimms, ch) ( \
|
||||||
(DIMM_IS_POPULATED(dimms, (ch == 0) ? 0 : 2) && \
|
(DIMM_IS_POPULATED(dimms, (ch == 0) ? 0 : 2) && \
|
||||||
!DIMM_IS_POPULATED(dimms, (ch == 0) ? 1 : 3)))
|
!DIMM_IS_POPULATED(dimms, (ch == 0) ? 1 : 3)))
|
||||||
|
@ -160,9 +161,9 @@
|
||||||
for (idx = 0; idx < TOTAL_DIMMS; ++idx)
|
for (idx = 0; idx < TOTAL_DIMMS; ++idx)
|
||||||
#define FOR_EACH_POPULATED_DIMM(dimms, idx) \
|
#define FOR_EACH_POPULATED_DIMM(dimms, idx) \
|
||||||
FOR_EACH_DIMM(idx) IF_DIMM_POPULATED(dimms, idx)
|
FOR_EACH_DIMM(idx) IF_DIMM_POPULATED(dimms, idx)
|
||||||
#define CHANNEL_IS_POPULATED(dimms, idx) ((dimms[idx<<1].card_type != 0) || (dimms[(idx<<1) + 1].card_type != 0))
|
#define CHANNEL_IS_POPULATED(dimms, idx) ((dimms[idx<<1].card_type != RAW_CARD_UNPOPULATED) || (dimms[(idx<<1) + 1].card_type != RAW_CARD_UNPOPULATED))
|
||||||
#define CHANNEL_IS_CARDF(dimms, idx) ((dimms[idx<<1].card_type == 0xf) || (dimms[(idx<<1) + 1].card_type == 0xf))
|
#define CHANNEL_IS_CARDF(dimms, idx) ((dimms[idx<<1].card_type == 0xf) || (dimms[(idx<<1) + 1].card_type == 0xf))
|
||||||
#define IF_CHANNEL_POPULATED(dimms, idx) if ((dimms[idx<<1].card_type != 0) || (dimms[(idx<<1) + 1].card_type != 0))
|
#define IF_CHANNEL_POPULATED(dimms, idx) if ((dimms[idx<<1].card_type != RAW_CARD_UNPOPULATED) || (dimms[(idx<<1) + 1].card_type != RAW_CARD_UNPOPULATED))
|
||||||
#define FOR_EACH_CHANNEL(idx) \
|
#define FOR_EACH_CHANNEL(idx) \
|
||||||
for (idx = 0; idx < TOTAL_CHANNELS; ++idx)
|
for (idx = 0; idx < TOTAL_CHANNELS; ++idx)
|
||||||
#define FOR_EACH_POPULATED_CHANNEL(dimms, idx) \
|
#define FOR_EACH_POPULATED_CHANNEL(dimms, idx) \
|
||||||
|
@ -170,11 +171,11 @@
|
||||||
|
|
||||||
#define RANKS_PER_CHANNEL 4
|
#define RANKS_PER_CHANNEL 4
|
||||||
#define RANK_IS_POPULATED(dimms, ch, r) \
|
#define RANK_IS_POPULATED(dimms, ch, r) \
|
||||||
((dimms[ch<<1].card_type && ((r) < dimms[ch<<1].ranks)) || \
|
(((dimms[ch<<1].card_type != RAW_CARD_UNPOPULATED) && ((r) < dimms[ch<<1].ranks)) || \
|
||||||
(dimms[(ch<<1) + 1].card_type && ((r) >= 2) && ((r) < (dimms[(ch<<1) + 1].ranks + 2))))
|
((dimms[(ch<<1) + 1].card_type != RAW_CARD_UNPOPULATED) && ((r) >= 2) && ((r) < (dimms[(ch<<1) + 1].ranks + 2))))
|
||||||
#define IF_RANK_POPULATED(dimms, ch, r) \
|
#define IF_RANK_POPULATED(dimms, ch, r) \
|
||||||
if ((dimms[ch<<1].card_type && ((r) < dimms[ch<<1].ranks)) || \
|
if (((dimms[ch<<1].card_type != RAW_CARD_UNPOPULATED) && ((r) < dimms[ch<<1].ranks)) || \
|
||||||
(dimms[(ch<<1) + 1].card_type && ((r) >= 2) && ((r) < (dimms[(ch<<1) + 1].ranks + 2))))
|
((dimms[(ch<<1) + 1].card_type != RAW_CARD_UNPOPULATED) && ((r) >= 2) && ((r) < (dimms[(ch<<1) + 1].ranks + 2))))
|
||||||
#define FOR_EACH_RANK_IN_CHANNEL(r) \
|
#define FOR_EACH_RANK_IN_CHANNEL(r) \
|
||||||
for (r = 0; r < RANKS_PER_CHANNEL; ++r)
|
for (r = 0; r < RANKS_PER_CHANNEL; ++r)
|
||||||
#define FOR_EACH_POPULATED_RANK_IN_CHANNEL(dimms, ch, r) \
|
#define FOR_EACH_POPULATED_RANK_IN_CHANNEL(dimms, ch, r) \
|
||||||
|
@ -243,7 +244,7 @@ struct timings {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dimminfo {
|
struct dimminfo {
|
||||||
unsigned int card_type; /* 0x0: unpopulated,
|
unsigned int card_type; /* 0xff: unpopulated,
|
||||||
0xa - 0xf: raw card type A - F */
|
0xa - 0xf: raw card type A - F */
|
||||||
enum chip_width width;
|
enum chip_width width;
|
||||||
enum chip_cap chip_capacity;
|
enum chip_cap chip_capacity;
|
||||||
|
|
Loading…
Reference in New Issue