vc/amd/opensil/genoa_poc: move configure_mpio call to setup_opensil
Instead of calling configure_mpio from the init function of the MPIO
chip struct for the first device that has this struct as chip_ops, call
if from setup_opensil. This will allow to do the calls into openSIL from
the SoC's chip_ops init function instead of having to rely on boot state
hooks. configure_mpio needs to be called after the xSimAssignMemoryTp1
call which sets up the openSIL data structures, but before the
opensil_entry(SIL_TP1) call for which the MPIO data structures need to
be filled for it to be able to initialize the hardware accordingly.
Since the vendorcode_amd_opensil_genoa_poc_mpio_ops struct now no longer
assigns configure_mpio to the init function pointer, we have to check
if the device's chip_ops pointer points to
vendorcode_amd_opensil_genoa_poc_mpio_ops instead of checking if the
chip_ops' init function is configure_mpio to match for the devices below
the MPIO chips in the devicetree.
TEST=Onyx still boots to the payload and the MPIO configuration reported
from the openSIL code is still the same
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: If37077c879e266763fd2748a1a8d71c63c94729b
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80148
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.c b/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.c
index 49a8934..28e529d 100644
--- a/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.c
+++ b/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.c
@@ -7,6 +7,11 @@
#include <device/device.h>
#include <device/pci_def.h>
#include "chip.h"
+#include "../opensil.h"
+
+struct chip_operations vendorcode_amd_opensil_genoa_poc_mpio_ops = {
+ CHIP_NAME("AMD GENOA MPIO")
+};
static void nbio_config(void)
{
@@ -175,7 +180,7 @@
mpio_port++;
}
-static void configure_mpio(void *const config)
+void configure_mpio(void)
{
MPIOCLASS_INPUT_BLK *mpio_data = SilFindStructure(SilId_MpioClass, 0);
mpio_global_config(mpio_data);
@@ -183,11 +188,6 @@
/* Find all devices with this chip */
for (struct device *dev = &dev_root; dev; dev = dev->next)
- if (dev->chip_ops->init == configure_mpio)
+ if (dev->chip_ops == &vendorcode_amd_opensil_genoa_poc_mpio_ops)
per_device_config(mpio_data, dev->bus->dev, dev->chip_info);
}
-
-struct chip_operations vendorcode_amd_opensil_genoa_poc_mpio_ops = {
- CHIP_NAME("AMD GENOA MPIO")
- .init = configure_mpio,
-};
diff --git a/src/vendorcode/amd/opensil/genoa_poc/opensil.h b/src/vendorcode/amd/opensil/genoa_poc/opensil.h
index b9caf73..fbf46b3 100644
--- a/src/vendorcode/amd/opensil/genoa_poc/opensil.h
+++ b/src/vendorcode/amd/opensil/genoa_poc/opensil.h
@@ -11,4 +11,6 @@
// Fill in FADT from openSIL
void opensil_fill_fadt_io_ports(acpi_fadt_t *fadt);
+void configure_mpio(void);
+
#endif
diff --git a/src/vendorcode/amd/opensil/genoa_poc/ramstage.c b/src/vendorcode/amd/opensil/genoa_poc/ramstage.c
index 7c0bc5b..7d03b32 100644
--- a/src/vendorcode/amd/opensil/genoa_poc/ramstage.c
+++ b/src/vendorcode/amd/opensil/genoa_poc/ramstage.c
@@ -126,6 +126,7 @@
setup_rc_manager_default();
configure_usb();
configure_sata();
+ configure_mpio();
}
BOOT_STATE_INIT_ENTRY(BS_DEV_INIT_CHIPS, BS_ON_ENTRY, setup_opensil, NULL);