Furquan Shaikh has uploaded this change for review. ( https://review.coreboot.org/24972
Change subject: mb/google/poppy: Allow use of optional secondary SPD ......................................................................
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 --- M src/mainboard/google/poppy/romstage.c M src/mainboard/google/poppy/spd/Makefile.inc M src/mainboard/google/poppy/variants/baseboard/include/baseboard/variants.h 3 files changed, 36 insertions(+), 13 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/72/24972/1
diff --git a/src/mainboard/google/poppy/romstage.c b/src/mainboard/google/poppy/romstage.c index 6bb4076..f9b23e5 100644 --- a/src/mainboard/google/poppy/romstage.c +++ b/src/mainboard/google/poppy/romstage.c @@ -110,20 +110,21 @@ } }
-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 @@ 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 30e632d..1aaa6eb 100644 --- a/src/mainboard/google/poppy/spd/Makefile.inc +++ b/src/mainboard/google/poppy/spd/Makefile.inc @@ -1,5 +1,20 @@
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 + +define add_spd_to_cbfs + $(eval cbfs-files-y += $1) + $(eval $1-file := $2) + $(eval $1-type := spd) +endef
ifeq ($(SPD_SOURCES),) SPD_DEPS := $(error SPD_SOURCES is not set. Variant must provide this) @@ -7,14 +22,20 @@ 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, $@, $+)
-cbfs-files-y += spd.bin -spd.bin-file := $(SPD_BIN) -spd.bin-type := spd +$(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) + +$(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 c88b99a..3cf11f6 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 @@ 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);