Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/85633?usp=email )
Change subject: drivers/amd/opensil/acpi.c: Factor common ACPI calls to openSIL driver ......................................................................
drivers/amd/opensil/acpi.c: Factor common ACPI calls to openSIL driver
Refactor to factor out and route ACPI calls through the openSIL driver interface to separate main SoC code from vendorcode.
Change-Id: I9fa4f60164333ec7a268702fa3e94979a1b83594 Signed-off-by: Nicolas Kochlowski nickkochlowski@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/85633 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Felix Held felix-coreboot@felixheld.de --- M src/drivers/amd/opensil/Makefile.mk A src/drivers/amd/opensil/acpi.c M src/drivers/amd/opensil/opensil.h M src/soc/amd/genoa_poc/acpi.c M src/soc/amd/phoenix/acpi.c M src/vendorcode/amd/opensil/genoa_poc/acpi.c M src/vendorcode/amd/opensil/opensil.h M src/vendorcode/amd/opensil/stub/ramstage.c 8 files changed, 38 insertions(+), 10 deletions(-)
Approvals: build bot (Jenkins): Verified Felix Held: Looks good to me, approved
diff --git a/src/drivers/amd/opensil/Makefile.mk b/src/drivers/amd/opensil/Makefile.mk index 1d20936..82e025b 100644 --- a/src/drivers/amd/opensil/Makefile.mk +++ b/src/drivers/amd/opensil/Makefile.mk @@ -4,6 +4,7 @@
subdirs-y += mpio
+ramstage-y += acpi.c ramstage-y += ramstage.c
endif diff --git a/src/drivers/amd/opensil/acpi.c b/src/drivers/amd/opensil/acpi.c new file mode 100644 index 0000000..042ee67 --- /dev/null +++ b/src/drivers/amd/opensil/acpi.c @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <amdblocks/acpi.h> +#include <vendorcode/amd/opensil/opensil.h> + +#include "opensil.h" + +void amd_opensil_fill_fadt_io_ports(acpi_fadt_t *fadt) +{ + opensil_fill_fadt(fadt); +} + +unsigned long acpi_add_opensil_tables(unsigned long current, acpi_rsdp_t *rsdp) +{ + return add_opensil_acpi_table(current, rsdp); +} diff --git a/src/drivers/amd/opensil/opensil.h b/src/drivers/amd/opensil/opensil.h index 0046876..f2bcd6b 100644 --- a/src/drivers/amd/opensil/opensil.h +++ b/src/drivers/amd/opensil/opensil.h @@ -3,9 +3,13 @@ #ifndef OPENSIL_DRIVER_H #define OPENSIL_DRIVER_H
+#include <acpi/acpi.h> + /* Set up openSIL env and call TP1 */ void amd_opensil_silicon_init(void); /* Set global and per-device MPIO configurations */ void configure_mpio(void); +/* Fill in FADT from openSIL */ +void amd_opensil_fill_fadt_io_ports(acpi_fadt_t *fadt);
#endif /* OPENSIL_DRIVER_H */ diff --git a/src/soc/amd/genoa_poc/acpi.c b/src/soc/amd/genoa_poc/acpi.c index 9b8011d..9091050 100644 --- a/src/soc/amd/genoa_poc/acpi.c +++ b/src/soc/amd/genoa_poc/acpi.c @@ -8,12 +8,12 @@ #include <amdblocks/cpu.h> #include <arch/ioapic.h> #include <device/device.h> -#include <vendorcode/amd/opensil/opensil.h> +#include <drivers/amd/opensil/opensil.h>
void acpi_fill_fadt(acpi_fadt_t *fadt) { /* Fill in pm1_evt, pm1_cnt, pm_tmr, gpe0_blk from openSIL input structure */ - opensil_fill_fadt_io_ports(fadt); + amd_opensil_fill_fadt_io_ports(fadt);
fadt->pm1_evt_len = 4; /* 32 bits */ fadt->pm1_cnt_len = 2; /* 16 bits */ diff --git a/src/soc/amd/phoenix/acpi.c b/src/soc/amd/phoenix/acpi.c index a182dfbb..1475b61 100644 --- a/src/soc/amd/phoenix/acpi.c +++ b/src/soc/amd/phoenix/acpi.c @@ -17,10 +17,10 @@ #include <console/console.h> #include <cpu/amd/cpuid.h> #include <device/device.h> +#include <drivers/amd/opensil/opensil.h> #include <soc/iomap.h> #include <static.h> #include <types.h> -#include <vendorcode/amd/opensil/opensil.h> #include "chip.h"
/* @@ -40,7 +40,7 @@ fadt->gpe0_blk = ACPI_GPE0_BLK; } else { /* Fill in pm1_evt, pm1_cnt, pm_tmr, gpe0_blk from openSIL input structure */ - opensil_fill_fadt_io_ports(fadt); + amd_opensil_fill_fadt_io_ports(fadt); }
fadt->pm1_evt_len = 4; /* 32 bits */ diff --git a/src/vendorcode/amd/opensil/genoa_poc/acpi.c b/src/vendorcode/amd/opensil/genoa_poc/acpi.c index f539798..fcdf167 100644 --- a/src/vendorcode/amd/opensil/genoa_poc/acpi.c +++ b/src/vendorcode/amd/opensil/genoa_poc/acpi.c @@ -5,9 +5,10 @@ #include <SilCommon.h> #include <xSIM-api.h> #include <FCH/Common/FchCommonCfg.h> + #include "../opensil.h"
-void opensil_fill_fadt_io_ports(acpi_fadt_t *fadt) +void opensil_fill_fadt(acpi_fadt_t *fadt) { FCHHWACPI_INPUT_BLK *blk = SilFindStructure(SilId_FchHwAcpiP, 0);
@@ -16,3 +17,8 @@ fadt->pm_tmr_blk = blk->AcpiPmTmrBlkAddr; fadt->gpe0_blk = blk->AcpiGpe0BlkAddr; } + +unsigned long add_opensil_acpi_table(unsigned long current, acpi_rsdp_t *rsdp) +{ + return current; +} diff --git a/src/vendorcode/amd/opensil/opensil.h b/src/vendorcode/amd/opensil/opensil.h index 9123125..cd71dfc 100644 --- a/src/vendorcode/amd/opensil/opensil.h +++ b/src/vendorcode/amd/opensil/opensil.h @@ -9,8 +9,9 @@ void SIL_STATUS_report(const char *function, const int status); // Add the memory map to dev, starting at index idx, returns last use idx void add_opensil_memmap(struct device *dev, unsigned long *idx); -// Fill in FADT from openSIL -void opensil_fill_fadt_io_ports(acpi_fadt_t *fadt); + +void opensil_fill_fadt(acpi_fadt_t *fadt); +unsigned long add_opensil_acpi_table(unsigned long current, acpi_rsdp_t *rsdp);
void setup_opensil(void); void opensil_xSIM_timepoint_1(void); diff --git a/src/vendorcode/amd/opensil/stub/ramstage.c b/src/vendorcode/amd/opensil/stub/ramstage.c index 0674140..5da6134 100644 --- a/src/vendorcode/amd/opensil/stub/ramstage.c +++ b/src/vendorcode/amd/opensil/stub/ramstage.c @@ -1,8 +1,8 @@ /* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi.h> -#include <amdblocks/acpi.h> #include <device/device.h> + #include "../opensil.h"
void add_opensil_memmap(struct device *dev, unsigned long *idx) @@ -10,12 +10,12 @@ printk(BIOS_NOTICE, "openSIL stub: %s\n", __func__); }
-void opensil_fill_fadt_io_ports(acpi_fadt_t *fadt) +void opensil_fill_fadt(acpi_fadt_t *fadt) { printk(BIOS_NOTICE, "openSIL stub: %s\n", __func__); }
-unsigned long acpi_add_opensil_tables(unsigned long current, acpi_rsdp_t *rsdp) +unsigned long add_opensil_acpi_table(unsigned long current, acpi_rsdp_t *rsdp) { printk(BIOS_NOTICE, "openSIL stub: %s\n", __func__); return current;