diff options
-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; |