Nick Vaccaro has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/45636 )
Change subject: vendorcode/google: consolidate strong mainboard_get_dram_part_num routines ......................................................................
vendorcode/google: consolidate strong mainboard_get_dram_part_num routines
Move mainboard_get_dram_part_num() into src/vendor/google/chromeos to allow mainboards to use it without having to duplicate that code.
BUG=b:168724473 TEST="emerge-volteer coreboot chromeos-bootimage", flash and boot volteer to kernel and verify that the BIOS log shows a part name when logging SPD information:
SPD: module part number is K4U6E3S4AA-MGCL
I also built coreboot for hatch, dedede, and deltaur and verified that the build succeeds without error.
Change-Id: I49b7b2be7b46b5ffd6377d6caabd5e3e6c0a8d61 Signed-off-by: Nick Vaccaro nvaccaro@google.com --- M src/mainboard/google/volteer/romstage.c M src/soc/intel/elkhartlake/romstage/romstage.c M src/vendorcode/google/chromeos/Makefile.inc A src/vendorcode/google/chromeos/spd_part_num_override.c 4 files changed, 25 insertions(+), 20 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/36/45636/1
diff --git a/src/mainboard/google/volteer/romstage.c b/src/mainboard/google/volteer/romstage.c index 552648b..720ab7f 100644 --- a/src/mainboard/google/volteer/romstage.c +++ b/src/mainboard/google/volteer/romstage.c @@ -28,17 +28,3 @@
meminit_ddr(mem_cfg, board_cfg, &spd_info, half_populated); } - -bool mainboard_get_dram_part_num(const char **part_num, size_t *len) -{ - static char part_num_store[DIMM_INFO_PART_NUMBER_SIZE]; - - if (google_chromeec_cbi_get_dram_part_num(part_num_store, - sizeof(part_num_store)) < 0) { - printk(BIOS_ERR, "ERROR: Couldn't obtain DRAM part number from CBI\n"); - return false; - } - *part_num = part_num_store; - *len = strlen(part_num_store); - return true; -} diff --git a/src/soc/intel/elkhartlake/romstage/romstage.c b/src/soc/intel/elkhartlake/romstage/romstage.c index d68d2da..913237b 100644 --- a/src/soc/intel/elkhartlake/romstage/romstage.c +++ b/src/soc/intel/elkhartlake/romstage/romstage.c @@ -21,12 +21,6 @@ 0x8d, 0x09, 0x11, 0xcf, 0x8b, 0x9f, 0x03, 0x23 \ }
-bool mainboard_get_dram_part_num(const char **part_num, size_t *len) -{ - /* Default implementation, no need to override part number. */ - return false; -} - /* Save the DIMM information for SMBIOS table 17 */ static void save_dimm_info(void) { diff --git a/src/vendorcode/google/chromeos/Makefile.inc b/src/vendorcode/google/chromeos/Makefile.inc index e17236d..67e7b28 100644 --- a/src/vendorcode/google/chromeos/Makefile.inc +++ b/src/vendorcode/google/chromeos/Makefile.inc @@ -16,3 +16,5 @@ verstage-y += watchdog.c romstage-y += watchdog.c ramstage-y += watchdog.c + +romstage-$(CONFIG_CHROMEOS_DRAM_PART_NUMBER_IN_CBI) += spd_part_num_override.c diff --git a/src/vendorcode/google/chromeos/spd_part_num_override.c b/src/vendorcode/google/chromeos/spd_part_num_override.c new file mode 100644 index 0000000..b4782ae --- /dev/null +++ b/src/vendorcode/google/chromeos/spd_part_num_override.c @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <console/console.h> +#include <ec/google/chromeec/ec.h> +#include <spd_bin.h> +#include <string.h> + +bool mainboard_get_dram_part_num(const char **part_num, size_t *len) +{ + static char part_num_store[DIMM_INFO_PART_NUMBER_SIZE]; + + /* If we already have the string, return a pointer to it */ + if (!strlen(part_num_store) && + google_chromeec_cbi_get_dram_part_num(part_num_store, + sizeof(part_num_store)) < 0) { + printk(BIOS_ERR, "ERROR: Couldn't obtain DRAM part number" + "from CBI\n"); + return false; + } + *part_num = part_num_store; + *len = strlen(part_num_store); + return true; +}