lib/spd_bin: make SMBus SPD addresses an input

Instead of assuming the mapping of dimm number to SPD SMBus address,
allow the mainboard to provide its own mapping. That way, global
resources of empty SPD contents aren't wasted in order to address
a dimm on a mainboard that doesn't meet the current assumption.

Change-Id: Id0e79231dc2303373badaae003038a1ac06a5635
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/19915
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Naresh Solanki <naresh.solanki@intel.com>
This commit is contained in:
Aaron Durbin 2017-05-25 09:36:06 -05:00 committed by Martin Roth
parent c96f757af1
commit dd82edc388
4 changed files with 8 additions and 3 deletions

View File

@ -43,6 +43,7 @@
#define LPDDR4_SPD_PART_LEN 20 #define LPDDR4_SPD_PART_LEN 20
struct spd_block { struct spd_block {
u8 addr_map[CONFIG_DIMM_MAX];
u8 *spd_array[CONFIG_DIMM_MAX]; u8 *spd_array[CONFIG_DIMM_MAX];
/* Length of each dimm */ /* Length of each dimm */
u16 len; u16 len;

View File

@ -159,7 +159,7 @@ void get_spd_smbus(struct spd_block *blk)
for (i = 0 ; i < CONFIG_DIMM_MAX; i++) { for (i = 0 ; i < CONFIG_DIMM_MAX; i++) {
get_spd(spd_data_ptr + i * CONFIG_DIMM_SPD_SIZE, get_spd(spd_data_ptr + i * CONFIG_DIMM_SPD_SIZE,
0xA0 + (i << 1)); blk->addr_map[i]);
blk->spd_array[i] = spd_data_ptr + i * CONFIG_DIMM_SPD_SIZE; blk->spd_array[i] = spd_data_ptr + i * CONFIG_DIMM_SPD_SIZE;
} }

View File

@ -31,7 +31,9 @@ void mainboard_memory_init_params(FSPM_UPD *mupd)
memcpy(&mem_cfg->RcompTarget, rcomp_target, sizeof(rcomp_target)); memcpy(&mem_cfg->RcompTarget, rcomp_target, sizeof(rcomp_target));
/* Read spd block to get memory config */ /* Read spd block to get memory config */
struct spd_block blk; struct spd_block blk = {
.addr_map = { 0xa0, 0xa4, },
};
mem_cfg->DqPinsInterleaved = 1; mem_cfg->DqPinsInterleaved = 1;
get_spd_smbus(&blk); get_spd_smbus(&blk);
mem_cfg->MemorySpdDataLen = blk.len; mem_cfg->MemorySpdDataLen = blk.len;

View File

@ -50,7 +50,9 @@ void mainboard_memory_init_params(FSPM_UPD *mupd)
/* Memory leak is ok since we have memory mapped boot media */ /* Memory leak is ok since we have memory mapped boot media */
mem_cfg->MemorySpdPtr00 = (uintptr_t)rdev_mmap_full(&spd_rdev); mem_cfg->MemorySpdPtr00 = (uintptr_t)rdev_mmap_full(&spd_rdev);
} else { /* for CONFIG_BOARD_INTEL_KBLRVP7 */ } else { /* for CONFIG_BOARD_INTEL_KBLRVP7 */
struct spd_block blk; struct spd_block blk = {
.addr_map = { 0xa0, 0xa2, 0xa4, 0xa6, },
};
mem_cfg->DqPinsInterleaved = 1; mem_cfg->DqPinsInterleaved = 1;
get_spd_smbus(&blk); get_spd_smbus(&blk);