EricR Lai has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/40558 )
Change subject: soc/intel/common/block/smbus: Set SPD array NULL if no DIMM present ......................................................................
soc/intel/common/block/smbus: Set SPD array NULL if no DIMM present
Set SPD array NULL if no DIMM present. do_smbus_read_byte return int need to mask the reset bits for the statement.
BUG=b:154445630 TEST=Check SPD is NULL if no DIMM in the slot.
Signed-off-by: Eric Lai ericr_lai@compal.corp-partner.google.com Change-Id: Ie81adbfab5bb1d5c557fe549a158cb68e26b1162 --- M src/soc/intel/common/block/smbus/smbuslib.c 1 file changed, 5 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/58/40558/1
diff --git a/src/soc/intel/common/block/smbus/smbuslib.c b/src/soc/intel/common/block/smbus/smbuslib.c index 4db2c6e..705a636 100644 --- a/src/soc/intel/common/block/smbus/smbuslib.c +++ b/src/soc/intel/common/block/smbus/smbuslib.c @@ -40,7 +40,7 @@
static void get_spd(u8 *spd, u8 addr) { - if (do_smbus_read_byte(SMBUS_IO_BASE, addr, 0) == 0xff) { + if ((do_smbus_read_byte(SMBUS_IO_BASE, addr, 0) & 0xff) == 0xff) { printk(BIOS_INFO, "No memory dimm at address %02X\n", addr << 1); /* Make sure spd is zeroed if dimm doesn't exist. */ @@ -68,7 +68,10 @@ for (i = 0 ; i < CONFIG_DIMM_MAX; i++) { get_spd(&spd_data[i * CONFIG_DIMM_SPD_SIZE], blk->addr_map[i]); - blk->spd_array[i] = &spd_data[i * CONFIG_DIMM_SPD_SIZE]; + if (spd_data[i * CONFIG_DIMM_SPD_SIZE] != 0) + blk->spd_array[i] = &spd_data[i * CONFIG_DIMM_SPD_SIZE]; + else + blk->spd_array[i] = NULL; }
update_spd_len(blk);