Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36250 )
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
mainboard/google: Rework Hatch so that SPD in CBFS is optional
All Hatch variants so far embed static SPD data encoded within the firmware image. However we wish the flexibility for romstage implementations that allow for reading the SPD data dynamically over SMBus.
BRANCH=none BUG=b:143134702 TEST=./util/abuild/abuild -p none -t google/hatch -x -a
Change-Id: Ie1637d08cdd85bc8d7c3b6f2d6f386d0e0c6589b Signed-off-by: Edward O'Callaghan quasisec@chromium.org --- M src/mainboard/google/hatch/Kconfig M src/mainboard/google/hatch/Kconfig.name M src/mainboard/google/hatch/Makefile.inc R src/mainboard/google/hatch/romstage_spd_cbfs.c 4 files changed, 11 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/36250/1
diff --git a/src/mainboard/google/hatch/Kconfig b/src/mainboard/google/hatch/Kconfig index 004cc28..278d009 100644 --- a/src/mainboard/google/hatch/Kconfig +++ b/src/mainboard/google/hatch/Kconfig @@ -58,6 +58,10 @@ int default 512
+config ROMSTAGE_SPD_CBFS + bool + default n + config DRIVER_TPM_SPI_BUS default 0x1
diff --git a/src/mainboard/google/hatch/Kconfig.name b/src/mainboard/google/hatch/Kconfig.name index fbc4c15..a2fea9f 100644 --- a/src/mainboard/google/hatch/Kconfig.name +++ b/src/mainboard/google/hatch/Kconfig.name @@ -4,29 +4,35 @@ bool "-> Akemi" select BOARD_GOOGLE_BASEBOARD_HATCH select BOARD_ROMSIZE_KB_16384 + select ROMSTAGE_SPD_CBFS
config BOARD_GOOGLE_DRATINI bool "-> Dratini" select BOARD_GOOGLE_BASEBOARD_HATCH select BOARD_ROMSIZE_KB_16384 + select ROMSTAGE_SPD_CBFS
config BOARD_GOOGLE_HATCH bool "-> Hatch" select BOARD_GOOGLE_BASEBOARD_HATCH select BOARD_ROMSIZE_KB_32768 + select ROMSTAGE_SPD_CBFS
config BOARD_GOOGLE_KOHAKU bool "-> Kohaku" select BOARD_GOOGLE_BASEBOARD_HATCH select BOARD_ROMSIZE_KB_16384 + select ROMSTAGE_SPD_CBFS
config BOARD_GOOGLE_KINDRED bool "-> Kindred" select BOARD_GOOGLE_BASEBOARD_HATCH select BOARD_ROMSIZE_KB_16384 select SOC_INTEL_COMMON_MMC_OVERRIDE + select ROMSTAGE_SPD_CBFS
config BOARD_GOOGLE_HELIOS bool "-> Helios" select BOARD_GOOGLE_BASEBOARD_HATCH select BOARD_ROMSIZE_KB_16384 + select ROMSTAGE_SPD_CBFS diff --git a/src/mainboard/google/hatch/Makefile.inc b/src/mainboard/google/hatch/Makefile.inc index 01a1eb8..3ed82e7 100644 --- a/src/mainboard/google/hatch/Makefile.inc +++ b/src/mainboard/google/hatch/Makefile.inc @@ -20,7 +20,7 @@ ramstage-$(CONFIG_CHROMEOS) += chromeos.c ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC) += ec.c
-romstage-y += romstage.c +romstage-$(CONFIG_ROMSTAGE_SPD_CBFS) += romstage_spd_cbfs.c romstage-$(CONFIG_CHROMEOS) += chromeos.c
verstage-$(CONFIG_CHROMEOS) += chromeos.c diff --git a/src/mainboard/google/hatch/romstage.c b/src/mainboard/google/hatch/romstage_spd_cbfs.c similarity index 100% rename from src/mainboard/google/hatch/romstage.c rename to src/mainboard/google/hatch/romstage_spd_cbfs.c
Kangheui Won has uploaded a new patch set (#2) to the change originally created by Edward O'Callaghan. ( https://review.coreboot.org/c/coreboot/+/36250 )
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
mainboard/google: Rework Hatch so that SPD in CBFS is optional
All Hatch variants so far embed static SPD data encoded within the firmware image. However we wish the flexibility for romstage implementations that allow for reading the SPD data dynamically over SMBus.
BRANCH=none BUG=b:143134702 TEST=./util/abuild/abuild -p none -t google/hatch -x -a Also confirmed that it boots to kernel on hatch, kohaku and kindred.
Change-Id: Ie1637d08cdd85bc8d7c3b6f2d6f386d0e0c6589b Signed-off-by: Edward O'Callaghan quasisec@chromium.org --- M src/mainboard/google/hatch/Kconfig M src/mainboard/google/hatch/Kconfig.name M src/mainboard/google/hatch/Makefile.inc R src/mainboard/google/hatch/romstage_spd_cbfs.c 4 files changed, 11 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/36250/2
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36250 )
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
Patch Set 2:
There is also this change to make SPDs optional in CBFS: https://review.coreboot.org/c/coreboot/+/36068
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36250 )
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
Patch Set 2:
Patch Set 2:
There is also this change to make SPDs optional in CBFS: https://review.coreboot.org/c/coreboot/+/36068
From inspection I don't think that is actually workable in its current form. variant boards are assumed to define GPIO straps that wouldn't exist for a smbus romstage type board. Frankly there is too much love of pre-processor going on and it makes a tangled mess for no apparent value. The weak symbols only make it worse by making runtime fragile as well as compile time.
I would strongly suggest we make a split between romstages that are appropriate for each path instead of trying to conflate them and hack around with ifdefs. The former solution is simple and robust.
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36250 )
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
Patch Set 2:
(4 comments)
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... File src/mainboard/google/hatch/Kconfig:
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... PS2, Line 61: ROMSTAGE_SPD_CBFS Wouldn't it be easier to add a Kconfig ROMSTAGE_SPD_SMBUS instead of ROMSTAGE_SPD_CBFS. Then this can be set only by boards that obtain SPD using SMBus and you also don't need to compile out the romstage.c file.
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... File src/mainboard/google/hatch/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... PS2, Line 23: CONFIG_ROMSTAGE_SPD_CBFS I think including this file can be helpful even without SPD being in CBFS. See comments on file.
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... File src/mainboard/google/hatch/romstage_spd_cbfs.c:
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... PS2, Line 44: mainboard_memory_init_params This function will have to be re-organized a little bit.
1. Call variant_memory_params()
2. Get single channel info using GPIO_MEM_CH_SEL
3. If ROMSTAGE_SPD_SMBUS is set, call memory_init_spd_smbus() which will set read_type to READ_SPD_SMBUS and set the addresses as required.
4. If #3 is not true, call memory_init_spd_cbfs() which will set read_type to READ_SPD_CBFS and get the mem_sku using variant_memory_sku().
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... PS2, Line 81: This function can just return early if ROMSTAGE_SPD_SMBUS is set.
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36250 )
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
Patch Set 2:
Patch Set 2:
Patch Set 2:
There is also this change to make SPDs optional in CBFS: https://review.coreboot.org/c/coreboot/+/36068
From inspection I don't think that is actually workable in its current form. variant boards are assumed to define GPIO straps that wouldn't exist for a smbus romstage type board. Frankly there is too much love of pre-processor going on and it makes a tangled mess for no apparent value. The weak symbols only make it worse by making runtime fragile as well as compile time.
I would strongly suggest we make a split between romstages that are appropriate for each path instead of trying to conflate them and hack around with ifdefs. The former solution is simple and robust.
In order to handle the GPIO straps problem, variant_memory_sku() just needs to move into variants/baseboard/ which provides default GPIO straps. Also, check my latest comment about dealing with read_type differently. In that case, variant_memory_sku() will not even get compiled in and will get dropped by the linker.
You can use runtime "if CONFIG(...)" without having to use #ifdefs. Splitting romstage file is just going to end up duplicating most of the code in that file. Any ways, if that seems cleaner, feel free to go ahead. Please ensure that you add Shelley and Tim on the CLs you are pushing.
Hello build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/36250
to look at the new patch set (#3).
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
mainboard/google: Rework Hatch so that SPD in CBFS is optional
All Hatch variants so far embed static SPD data encoded within the firmware image. However we wish the flexibility for romstage implementations that allow for reading the SPD data dynamically over SMBus.
BRANCH=none BUG=b:143134702 TEST=./util/abuild/abuild -p none -t google/hatch -x -a
Change-Id: Ie1637d08cdd85bc8d7c3b6f2d6f386d0e0c6589b Signed-off-by: Edward O'Callaghan quasisec@chromium.org --- M src/mainboard/google/hatch/Kconfig M src/mainboard/google/hatch/Makefile.inc R src/mainboard/google/hatch/romstage_spd_cbfs.c 3 files changed, 5 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/36250/3
Daniel Kurtz has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36250 )
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
Patch Set 3:
Patch Set 2:
Patch Set 2:
Patch Set 2:
There is also this change to make SPDs optional in CBFS: https://review.coreboot.org/c/coreboot/+/36068
From inspection I don't think that is actually workable in its current form. variant boards are assumed to define GPIO straps that wouldn't exist for a smbus romstage type board. Frankly there is too much love of pre-processor going on and it makes a tangled mess for no apparent value. The weak symbols only make it worse by making runtime fragile as well as compile time.
I would strongly suggest we make a split between romstages that are appropriate for each path instead of trying to conflate them and hack around with ifdefs. The former solution is simple and robust.
In order to handle the GPIO straps problem, variant_memory_sku() just needs to move into variants/baseboard/ which provides default GPIO straps. Also, check my latest comment about dealing with read_type differently. In that case, variant_memory_sku() will not even get compiled in and will get dropped by the linker.
You can use runtime "if CONFIG(...)" without having to use #ifdefs. Splitting romstage file is just going to end up duplicating most of the code in that file. Any ways, if that seems cleaner, feel free to go ahead. Please ensure that you add Shelley and Tim on the CLs you are pushing.
I agree with furquan here that we should avoid the code duplication inherent in forking romstage.c. Comparing this CL with CL:36449 shows there is much overlap between the two.
Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36250 )
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... File src/mainboard/google/hatch/Kconfig:
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... PS2, Line 61: ROMSTAGE_SPD_CBFS
Wouldn't it be easier to add a Kconfig ROMSTAGE_SPD_SMBUS instead of ROMSTAGE_SPD_CBFS. […]
+1 to Kconfig
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36250 )
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
Patch Set 3:
Patch Set 3:
(1 comment)
This was resolved from patch 2, if you see its now the positive case instead of the anti-positive. That is to say, it defaults to having SPD in CBFS so this patch is a nop for variants Kconfigs as per required.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36250 )
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
Patch Set 3:
Patch Set 3:
Patch Set 2:
Patch Set 2:
Patch Set 2:
There is also this change to make SPDs optional in CBFS: https://review.coreboot.org/c/coreboot/+/36068
From inspection I don't think that is actually workable in its current form. variant boards are assumed to define GPIO straps that wouldn't exist for a smbus romstage type board. Frankly there is too much love of pre-processor going on and it makes a tangled mess for no apparent value. The weak symbols only make it worse by making runtime fragile as well as compile time.
I would strongly suggest we make a split between romstages that are appropriate for each path instead of trying to conflate them and hack around with ifdefs. The former solution is simple and robust.
In order to handle the GPIO straps problem, variant_memory_sku() just needs to move into variants/baseboard/ which provides default GPIO straps. Also, check my latest comment about dealing with read_type differently. In that case, variant_memory_sku() will not even get compiled in and will get dropped by the linker.
You can use runtime "if CONFIG(...)" without having to use #ifdefs. Splitting romstage file is just going to end up duplicating most of the code in that file. Any ways, if that seems cleaner, feel free to go ahead. Please ensure that you add Shelley and Tim on the CLs you are pushing.
I agree with furquan here that we should avoid the code duplication inherent in forking romstage.c. Comparing this CL with CL:36449 shows there is much overlap between the two.
Are you sure there is overlap? The functions are actually very different.
Hello build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/36250
to look at the new patch set (#4).
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
mainboard/google: Rework Hatch so that SPD in CBFS is optional
All Hatch variants so far embed static SPD data encoded within the firmware image. However we wish the flexibility for romstage implementations that allow for reading the SPD data dynamically over SMBus.
BRANCH=none BUG=b:143134702 TEST=./util/abuild/abuild -p none -t google/hatch -x -a
Change-Id: Ie1637d08cdd85bc8d7c3b6f2d6f386d0e0c6589b Signed-off-by: Edward O'Callaghan quasisec@chromium.org --- M src/mainboard/google/hatch/Kconfig M src/mainboard/google/hatch/Makefile.inc R src/mainboard/google/hatch/romstage_spd_cbfs.c 3 files changed, 6 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/36250/4
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36250 )
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
Patch Set 4: Code-Review+2
Change looks okay to me.
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36250 )
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
Patch Set 4: Code-Review+2
Martin Roth has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36250 )
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... File src/mainboard/google/hatch/Kconfig:
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... PS2, Line 61: ROMSTAGE_SPD_CBFS
+1 to Kconfig
If this patch is ready, please mark all comments as resolved so it can be merged.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36250 )
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
Patch Set 5:
(4 comments)
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... File src/mainboard/google/hatch/Kconfig:
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... PS2, Line 61: ROMSTAGE_SPD_CBFS
If this patch is ready, please mark all comments as resolved so it can be merged.
Done
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... File src/mainboard/google/hatch/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... PS2, Line 23: CONFIG_ROMSTAGE_SPD_CBFS
I think including this file can be helpful even without SPD being in CBFS. See comments on file.
Ack
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... File src/mainboard/google/hatch/romstage_spd_cbfs.c:
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... PS2, Line 44: mainboard_memory_init_params
This function will have to be re-organized a little bit. […]
Ack
https://review.coreboot.org/c/coreboot/+/36250/2/src/mainboard/google/hatch/... PS2, Line 81:
This function can just return early if ROMSTAGE_SPD_SMBUS is set.
Ack
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/36250 )
Change subject: mainboard/google: Rework Hatch so that SPD in CBFS is optional ......................................................................
mainboard/google: Rework Hatch so that SPD in CBFS is optional
All Hatch variants so far embed static SPD data encoded within the firmware image. However we wish the flexibility for romstage implementations that allow for reading the SPD data dynamically over SMBus.
BRANCH=none BUG=b:143134702 TEST=./util/abuild/abuild -p none -t google/hatch -x -a
Change-Id: Ie1637d08cdd85bc8d7c3b6f2d6f386d0e0c6589b Signed-off-by: Edward O'Callaghan quasisec@chromium.org Reviewed-on: https://review.coreboot.org/c/coreboot/+/36250 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Furquan Shaikh furquan@google.com Reviewed-by: Aaron Durbin adurbin@chromium.org --- M src/mainboard/google/hatch/Kconfig M src/mainboard/google/hatch/Makefile.inc R src/mainboard/google/hatch/romstage_spd_cbfs.c 3 files changed, 6 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Aaron Durbin: Looks good to me, approved Furquan Shaikh: Looks good to me, approved
diff --git a/src/mainboard/google/hatch/Kconfig b/src/mainboard/google/hatch/Kconfig index 004cc28..219be22 100644 --- a/src/mainboard/google/hatch/Kconfig +++ b/src/mainboard/google/hatch/Kconfig @@ -58,6 +58,10 @@ int default 512
+config ROMSTAGE_SPD_CBFS + bool + default y + config DRIVER_TPM_SPI_BUS default 0x1
diff --git a/src/mainboard/google/hatch/Makefile.inc b/src/mainboard/google/hatch/Makefile.inc index 01a1eb8..a226bd6 100644 --- a/src/mainboard/google/hatch/Makefile.inc +++ b/src/mainboard/google/hatch/Makefile.inc @@ -20,7 +20,7 @@ ramstage-$(CONFIG_CHROMEOS) += chromeos.c ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC) += ec.c
-romstage-y += romstage.c +romstage-$(CONFIG_ROMSTAGE_SPD_CBFS) += romstage_spd_cbfs.c romstage-$(CONFIG_CHROMEOS) += chromeos.c
verstage-$(CONFIG_CHROMEOS) += chromeos.c @@ -33,4 +33,4 @@ subdirs-y += variants/$(VARIANT_DIR) CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include
-subdirs-y += spd +subdirs-$(CONFIG_ROMSTAGE_SPD_CBFS) += spd diff --git a/src/mainboard/google/hatch/romstage.c b/src/mainboard/google/hatch/romstage_spd_cbfs.c similarity index 100% rename from src/mainboard/google/hatch/romstage.c rename to src/mainboard/google/hatch/romstage_spd_cbfs.c