summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2024-01-22 18:17:57 +0100
committerFelix Held <felix-coreboot@felixheld.de>2024-01-25 22:50:57 +0000
commite5197e17786a5ebf231e1fd93e45b22fb753df6e (patch)
treed443daa9c76db37d7c4b489b0f6e1f1041667cb5
parent632568732b0f2cd47f87337410ee90899ed298ca (diff)
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>
-rw-r--r--src/vendorcode/amd/opensil/genoa_poc/mpio/chip.c14
-rw-r--r--src/vendorcode/amd/opensil/genoa_poc/opensil.h2
-rw-r--r--src/vendorcode/amd/opensil/genoa_poc/ramstage.c1
3 files changed, 10 insertions, 7 deletions
diff --git a/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.c b/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.c
index 49a8934d8a..28e529dc3e 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 @@ static void per_device_config(MPIOCLASS_INPUT_BLK *mpio_data, struct device *dev
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 @@ static void configure_mpio(void *const config)
/* 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 b9caf73279..fbf46b3b8c 100644
--- a/src/vendorcode/amd/opensil/genoa_poc/opensil.h
+++ b/src/vendorcode/amd/opensil/genoa_poc/opensil.h
@@ -11,4 +11,6 @@ int add_opensil_memmap(struct device *dev, int idx);
// 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 7c0bc5b355..7d03b32aec 100644
--- a/src/vendorcode/amd/opensil/genoa_poc/ramstage.c
+++ b/src/vendorcode/amd/opensil/genoa_poc/ramstage.c
@@ -126,6 +126,7 @@ static void setup_opensil(void *unused)
setup_rc_manager_default();
configure_usb();
configure_sata();
+ configure_mpio();
}
BOOT_STATE_INIT_ENTRY(BS_DEV_INIT_CHIPS, BS_ON_ENTRY, setup_opensil, NULL);