diff options
author | Furquan Shaikh <furquan@google.com> | 2018-03-02 14:36:56 -0800 |
---|---|---|
committer | Furquan Shaikh <furquan@google.com> | 2018-03-05 17:56:08 +0000 |
commit | 908ea9132b2a53470292ac1a346a28a1453f4d7c (patch) | |
tree | 7ef504e4ac6c7aaa92af4c39701e1baf63dc22e1 | |
parent | 39d3021b164429da00f4c4c79b2eccb42f416382 (diff) |
mb/google/poppy: Allow use of optional secondary SPD
This change adds support for variants to use secondary SPD if
required. This enables a variant to have different types of memory
supported using the same image.
BUG=b:73514687
Change-Id: I3add65ead99c510f2d6ec899fbf2cb9a06c79b0c
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/24972
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r-- | src/mainboard/google/poppy/romstage.c | 9 | ||||
-rw-r--r-- | src/mainboard/google/poppy/spd/Makefile.inc | 38 | ||||
-rw-r--r-- | src/mainboard/google/poppy/variants/baseboard/include/baseboard/variants.h | 1 |
3 files changed, 35 insertions, 13 deletions
diff --git a/src/mainboard/google/poppy/romstage.c b/src/mainboard/google/poppy/romstage.c index 6bb4076d0d..f9b23e501a 100644 --- a/src/mainboard/google/poppy/romstage.c +++ b/src/mainboard/google/poppy/romstage.c @@ -110,20 +110,21 @@ static void mainboard_print_spd_info(const uint8_t *spd, enum memory_type type) } } -static uintptr_t mainboard_get_spd_data(enum memory_type type) +static uintptr_t mainboard_get_spd_data(enum memory_type type, bool use_sec_spd) { char *spd_file; size_t spd_file_len; int spd_index; const size_t spd_len = spd_info[type].len; + const char *spd_bin = use_sec_spd ? "sec-spd.bin" : "spd.bin"; spd_index = variant_memory_sku(); assert(spd_index >= 0); printk(BIOS_INFO, "SPD index %d\n", spd_index); /* Load SPD data from CBFS */ - spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD, - &spd_file_len); + spd_file = cbfs_boot_map_with_leak(spd_bin, CBFS_TYPE_SPD, + &spd_file_len); if (!spd_file) die("SPD data not found."); @@ -160,7 +161,7 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) p.rcomp_resistor_size); memcpy(&mem_cfg->RcompTarget, p.rcomp_target, p.rcomp_target_size); - mem_cfg->MemorySpdPtr00 = mainboard_get_spd_data(p.type); + mem_cfg->MemorySpdPtr00 = mainboard_get_spd_data(p.type, p.use_sec_spd); mem_cfg->MemorySpdPtr10 = mem_cfg->MemorySpdPtr00; mem_cfg->MemorySpdDataLen = spd_info[p.type].len; } diff --git a/src/mainboard/google/poppy/spd/Makefile.inc b/src/mainboard/google/poppy/spd/Makefile.inc index 30e632ded0..444ac00b92 100644 --- a/src/mainboard/google/poppy/spd/Makefile.inc +++ b/src/mainboard/google/poppy/spd/Makefile.inc @@ -1,5 +1,19 @@ SPD_BIN = $(obj)/spd.bin +SEC_SPD_BIN = $(obj)/sec-spd.bin + +define gen_spd_bin + for f in $2; \ + do for c in $$(cat $$f | grep -v ^#); \ + do printf $$(printf '\%o' 0x$$c); \ + done; \ + done > $1 +endef + +add_spd_to_cbfs= \ + $(eval cbfs-files-y += $1) \ + $(eval $1-file := $2) \ + $(eval $1-type := spd) ifeq ($(SPD_SOURCES),) SPD_DEPS := $(error SPD_SOURCES is not set. Variant must provide this) @@ -7,14 +21,20 @@ else SPD_DEPS := $(foreach f, $(SPD_SOURCES), src/mainboard/$(MAINBOARDDIR)/spd/$(f).spd.hex) endif -# Include spd ROM data +# Include SPD ROM data $(SPD_BIN): $(SPD_DEPS) - for f in $+; \ - do for c in $$(cat $$f | grep -v ^#); \ - do printf $$(printf '\%o' 0x$$c); \ - done; \ - done > $@ + $(call gen_spd_bin, $@, $+) + +$(call add_spd_to_cbfs, spd.bin, $(SPD_BIN)) + +# Add optional secondary SPD ROM data if present +ifneq ($(SEC_SPD_SOURCES),) + +SEC_SPD_DEPS := $(foreach f, $(SEC_SPD_SOURCES), src/mainboard/$(MAINBOARDDIR)/spd/$(f).spd.hex) -cbfs-files-y += spd.bin -spd.bin-file := $(SPD_BIN) -spd.bin-type := spd +$(SEC_SPD_BIN): $(SEC_SPD_DEPS) + $(call gen_spd_bin, $@, $+) + +$(call add_spd_to_cbfs, sec-spd.bin, $(SEC_SPD_BIN)) + +endif diff --git a/src/mainboard/google/poppy/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/poppy/variants/baseboard/include/baseboard/variants.h index c88b99a7bd..3cf11f637b 100644 --- a/src/mainboard/google/poppy/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/poppy/variants/baseboard/include/baseboard/variants.h @@ -45,6 +45,7 @@ struct memory_params { size_t rcomp_resistor_size; const void *rcomp_target; size_t rcomp_target_size; + bool use_sec_spd; }; void variant_memory_params(struct memory_params *p); |