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>
This commit is contained in:
Felix Held 2024-01-22 18:17:57 +01:00
parent 632568732b
commit e5197e1778
3 changed files with 10 additions and 7 deletions

View File

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

View File

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

View File

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