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 <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/43105
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Angel Pons 2020-07-03 14:14:30 +02:00
parent 517bc99db1
commit 6eea191511
8 changed files with 13 additions and 16 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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. */

View File

@ -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 */

View File

@ -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);

View File

@ -13,6 +13,11 @@
#include <southbridge/intel/lynxpoint/pch.h>
#include <southbridge/intel/lynxpoint/me.h>
/* 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);