From 6eea191511ad63017eafa22d5363a39ac99ab1db Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Fri, 3 Jul 2020 14:14:30 +0200 Subject: [PATCH] haswell: Make `copy_spd` a weak function Instead of using function pointers, we can use weak functions. So, drop the pointer from `romstage_params`, leaving `pei_data` as the only remaining member. This will be cleaned up in a follow-up commit. Change-Id: I3b17d21ea7a650734119a5cab4892fcb158b589d Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/43105 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/mainboard/google/slippy/variants/falco/romstage.c | 4 +--- src/mainboard/google/slippy/variants/leon/romstage.c | 4 +--- src/mainboard/google/slippy/variants/peppy/romstage.c | 4 +--- src/mainboard/google/slippy/variants/wolf/romstage.c | 4 +--- src/mainboard/intel/baskingridge/romstage.c | 1 - src/northbridge/intel/haswell/haswell.h | 1 - src/northbridge/intel/haswell/raminit.h | 3 +++ src/northbridge/intel/haswell/romstage.c | 8 ++++++-- 8 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/mainboard/google/slippy/variants/falco/romstage.c b/src/mainboard/google/slippy/variants/falco/romstage.c index 96fbbab8b6..901c70e5ae 100644 --- a/src/mainboard/google/slippy/variants/falco/romstage.c +++ b/src/mainboard/google/slippy/variants/falco/romstage.c @@ -13,7 +13,7 @@ #include "../../variant.h" /* Copy SPD data for on-board memory */ -static void copy_spd(struct pei_data *peid) +void copy_spd(struct pei_data *peid) { const int gpio_vector[] = {13, 9, 47, -1}; int spd_index = get_gpios(gpio_vector); @@ -84,6 +84,4 @@ void variant_romstage_entry(struct romstage_params *rp) memcpy(rp->pei_data->usb2_ports, usb2_ports, sizeof(usb2_ports)); memcpy(rp->pei_data->usb3_ports, usb3_ports, sizeof(usb3_ports)); - - rp->copy_spd = copy_spd; } diff --git a/src/mainboard/google/slippy/variants/leon/romstage.c b/src/mainboard/google/slippy/variants/leon/romstage.c index 35c5ef50c7..78c46dc3cc 100644 --- a/src/mainboard/google/slippy/variants/leon/romstage.c +++ b/src/mainboard/google/slippy/variants/leon/romstage.c @@ -12,7 +12,7 @@ #include "../../variant.h" /* Copy SPD data for on-board memory */ -static void copy_spd(struct pei_data *peid) +void copy_spd(struct pei_data *peid) { const int gpio_vector[] = {13, 9, 47, -1}; int spd_index = get_gpios(gpio_vector); @@ -78,6 +78,4 @@ void variant_romstage_entry(struct romstage_params *rp) memcpy(rp->pei_data->usb2_ports, usb2_ports, sizeof(usb2_ports)); memcpy(rp->pei_data->usb3_ports, usb3_ports, sizeof(usb3_ports)); - - rp->copy_spd = copy_spd; } diff --git a/src/mainboard/google/slippy/variants/peppy/romstage.c b/src/mainboard/google/slippy/variants/peppy/romstage.c index b7daf89527..c962fe0f9c 100644 --- a/src/mainboard/google/slippy/variants/peppy/romstage.c +++ b/src/mainboard/google/slippy/variants/peppy/romstage.c @@ -14,7 +14,7 @@ #include "../../variant.h" /* Copy SPD data for on-board memory */ -static void copy_spd(struct pei_data *peid) +void copy_spd(struct pei_data *peid) { const int gpio_vector[] = {13, 9, 47, -1}; int spd_index = get_gpios(gpio_vector); @@ -95,6 +95,4 @@ void variant_romstage_entry(struct romstage_params *rp) memcpy(rp->pei_data->usb2_ports, usb2_ports, sizeof(usb2_ports)); memcpy(rp->pei_data->usb3_ports, usb3_ports, sizeof(usb3_ports)); - - rp->copy_spd = copy_spd; } diff --git a/src/mainboard/google/slippy/variants/wolf/romstage.c b/src/mainboard/google/slippy/variants/wolf/romstage.c index b35160f628..c3c01a3838 100644 --- a/src/mainboard/google/slippy/variants/wolf/romstage.c +++ b/src/mainboard/google/slippy/variants/wolf/romstage.c @@ -13,7 +13,7 @@ #include "../../variant.h" /* Copy SPD data for on-board memory */ -static void copy_spd(struct pei_data *peid) +void copy_spd(struct pei_data *peid) { const int gpio_vector[] = {13, 9, 47, -1}; int spd_index = get_gpios(gpio_vector); @@ -82,6 +82,4 @@ void variant_romstage_entry(struct romstage_params *rp) memcpy(rp->pei_data->usb2_ports, usb2_ports, sizeof(usb2_ports)); memcpy(rp->pei_data->usb3_ports, usb3_ports, sizeof(usb3_ports)); - - rp->copy_spd = copy_spd; } diff --git a/src/mainboard/intel/baskingridge/romstage.c b/src/mainboard/intel/baskingridge/romstage.c index abbd8521cb..3a8a03bfa6 100644 --- a/src/mainboard/intel/baskingridge/romstage.c +++ b/src/mainboard/intel/baskingridge/romstage.c @@ -114,7 +114,6 @@ void mainboard_romstage_entry(void) struct romstage_params romstage_params = { .pei_data = &pei_data, - .copy_spd = NULL, }; /* Call into the real romstage main with this board's attributes. */ diff --git a/src/northbridge/intel/haswell/haswell.h b/src/northbridge/intel/haswell/haswell.h index 7fb24c8935..24d773f368 100644 --- a/src/northbridge/intel/haswell/haswell.h +++ b/src/northbridge/intel/haswell/haswell.h @@ -192,7 +192,6 @@ void intel_northbridge_haswell_finalize_smm(void); struct pei_data; struct romstage_params { struct pei_data *pei_data; - void (*copy_spd)(struct pei_data *peid); }; void romstage_common(const struct romstage_params *params); void mb_late_romstage_setup(void); /* optional */ diff --git a/src/northbridge/intel/haswell/raminit.h b/src/northbridge/intel/haswell/raminit.h index 562c24d5b6..920ee0fabd 100644 --- a/src/northbridge/intel/haswell/raminit.h +++ b/src/northbridge/intel/haswell/raminit.h @@ -5,6 +5,9 @@ #include "pei_data.h" +/* Optional function to copy SPD data for on-board memory */ +void copy_spd(struct pei_data *peid); + void sdram_initialize(struct pei_data *pei_data); void setup_sdram_meminfo(struct pei_data *pei_data); int fixup_haswell_errata(void); diff --git a/src/northbridge/intel/haswell/romstage.c b/src/northbridge/intel/haswell/romstage.c index ae9d707d90..00f5f47938 100644 --- a/src/northbridge/intel/haswell/romstage.c +++ b/src/northbridge/intel/haswell/romstage.c @@ -13,6 +13,11 @@ #include #include +/* Copy SPD data for on-board memory */ +void __weak copy_spd(struct pei_data *peid) +{ +} + void __weak mb_late_romstage_setup(void) { } @@ -53,8 +58,7 @@ void romstage_common(const struct romstage_params *params) report_platform_info(); - if (params->copy_spd != NULL) - params->copy_spd(params->pei_data); + copy_spd(params->pei_data); sdram_initialize(params->pei_data);