From 908ea9132b2a53470292ac1a346a28a1453f4d7c Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Fri, 2 Mar 2018 14:36:56 -0800 Subject: 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 Reviewed-on: https://review.coreboot.org/24972 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/mainboard/google/poppy/spd/Makefile.inc | 38 ++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'src/mainboard/google/poppy/spd/Makefile.inc') 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 -- cgit v1.2.3