diff options
author | Damien Zammit <damien@zamaudio.com> | 2016-06-03 15:39:30 +1000 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2016-06-04 23:46:05 +0200 |
commit | 68e1dcfdd940db05c282c601b58dd86f97b44767 (patch) | |
tree | c0659b2ad303d501932fb5a757fc0bb75dadf74b /src | |
parent | 062ef1cca6c1cd70828288181129ba0d0addd4ab (diff) | |
download | coreboot-68e1dcfdd940db05c282c601b58dd86f97b44767.tar.xz |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/northbridge/intel/x4x/raminit.c | 4 | ||||
-rw-r--r-- | src/northbridge/intel/x4x/raminit_ddr2.c | 4 | ||||
-rw-r--r-- | src/northbridge/intel/x4x/x4x.h | 19 |
3 files changed, 14 insertions, 13 deletions
diff --git a/src/northbridge/intel/x4x/raminit.c b/src/northbridge/intel/x4x/raminit.c index 6efdcd3bb3..4f5575ceae 100644 --- a/src/northbridge/intel/x4x/raminit.c +++ b/src/northbridge/intel/x4x/raminit.c @@ -41,14 +41,14 @@ static void sdram_read_spds(struct sysinfo *s) FOR_EACH_DIMM(i) { if (s->spd_map[i] == 0) { /* Non-existent SPD address */ - s->dimms[i].card_type = 0; + s->dimms[i].card_type = RAW_CARD_UNPOPULATED; continue; } for (j = 0; j < 64; j++) { status = spd_read_byte(s->spd_map[i], j); if (status < 0) { /* No SPD here */ - s->dimms[i].card_type = 0; + s->dimms[i].card_type = RAW_CARD_UNPOPULATED; break; } s->dimms[i].spd_data[j] = (u8) status; diff --git a/src/northbridge/intel/x4x/raminit_ddr2.c b/src/northbridge/intel/x4x/raminit_ddr2.c index 3dd00fb2b6..5acb12736b 100644 --- a/src/northbridge/intel/x4x/raminit_ddr2.c +++ b/src/northbridge/intel/x4x/raminit_ddr2.c @@ -1506,7 +1506,7 @@ static void dradrb_ddr2(struct sysinfo *s) rankpop0 = 0; rankpop1 = 0; 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; } else { i = (ch << 1) + 1; @@ -1541,7 +1541,7 @@ static void dradrb_ddr2(struct sysinfo *s) // DRB 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; } else { i = (ch << 1) + 1; diff --git a/src/northbridge/intel/x4x/x4x.h b/src/northbridge/intel/x4x/x4x.h index 17810aa3cb..e02ee02627 100644 --- a/src/northbridge/intel/x4x/x4x.h +++ b/src/northbridge/intel/x4x/x4x.h @@ -144,9 +144,10 @@ #define TOTAL_CHANNELS 2 #define TOTAL_DIMMS 4 +#define RAW_CARD_UNPOPULATED 0xff -#define DIMM_IS_POPULATED(dimms, idx) (dimms[idx].card_type != 0) -#define IF_DIMM_POPULATED(dimms, idx) if (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 != RAW_CARD_UNPOPULATED) #define ONLY_DIMMA_IS_POPULATED(dimms, ch) ( \ (DIMM_IS_POPULATED(dimms, (ch == 0) ? 0 : 2) && \ !DIMM_IS_POPULATED(dimms, (ch == 0) ? 1 : 3))) @@ -160,9 +161,9 @@ for (idx = 0; idx < TOTAL_DIMMS; ++idx) #define FOR_EACH_POPULATED_DIMM(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 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) \ for (idx = 0; idx < TOTAL_CHANNELS; ++idx) #define FOR_EACH_POPULATED_CHANNEL(dimms, idx) \ @@ -170,11 +171,11 @@ #define RANKS_PER_CHANNEL 4 #define RANK_IS_POPULATED(dimms, ch, r) \ - ((dimms[ch<<1].card_type && ((r) < dimms[ch<<1].ranks)) || \ - (dimms[(ch<<1) + 1].card_type && ((r) >= 2) && ((r) < (dimms[(ch<<1) + 1].ranks + 2)))) + (((dimms[ch<<1].card_type != RAW_CARD_UNPOPULATED) && ((r) < dimms[ch<<1].ranks)) || \ + ((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) \ - if ((dimms[ch<<1].card_type && ((r) < dimms[ch<<1].ranks)) || \ - (dimms[(ch<<1) + 1].card_type && ((r) >= 2) && ((r) < (dimms[(ch<<1) + 1].ranks + 2)))) + if (((dimms[ch<<1].card_type != RAW_CARD_UNPOPULATED) && ((r) < dimms[ch<<1].ranks)) || \ + ((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) \ for (r = 0; r < RANKS_PER_CHANNEL; ++r) #define FOR_EACH_POPULATED_RANK_IN_CHANNEL(dimms, ch, r) \ @@ -243,7 +244,7 @@ struct timings { }; struct dimminfo { - unsigned int card_type; /* 0x0: unpopulated, + unsigned int card_type; /* 0xff: unpopulated, 0xa - 0xf: raw card type A - F */ enum chip_width width; enum chip_cap chip_capacity; |