soc/amd: move acpi_add_fsp_tables implementation to common FSP code

Since the acpi_add_fsp_tables implementation is identical for all SoCs,
factor it out and move it to the common AMD FSP code. Also guard the
acpi_add_fsp_tables call in soc_acpi_write_tables with
if (CONFIG(PLATFORM_USES_FSP2_0)) to properly handle the FSP dependency.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I8917a346f586e77b3b3278c73aed8cf61f3c9e6a
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80225
Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Felix Held 2024-01-26 15:33:59 +01:00
parent 26577d2ecb
commit 112c2277f5
17 changed files with 22 additions and 97 deletions

View File

@ -19,7 +19,6 @@ bootblock-y += espi_util.c
romstage-y += fsp_m_params.c
ramstage-y += acpi.c
ramstage-y += agesa_acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
ramstage-y += fch.c

View File

@ -63,7 +63,8 @@ unsigned long soc_acpi_write_tables(const struct device *device, unsigned long c
/* IVRS */
current = acpi_add_ivrs_table(current, rsdp);
current = acpi_add_fsp_tables(current, rsdp);
if (CONFIG(PLATFORM_USES_FSP2_0))
current = acpi_add_fsp_tables(current, rsdp);
return current;
}

View File

@ -1,15 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi.h>
#include <amdblocks/acpi.h>
#include <FspGuids.h>
#include <types.h>
unsigned long acpi_add_fsp_tables(unsigned long current, acpi_rsdp_t *rsdp)
{
/* add ALIB SSDT from HOB */
current = acpi_align_current(current);
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
return current;
}

View File

@ -60,9 +60,6 @@ unsigned long acpi_add_fsp_tables(unsigned long current, acpi_rsdp_t *rsdp);
unsigned long southbridge_write_acpi_tables(const struct device *device, unsigned long current,
struct acpi_rsdp *rsdp);
unsigned long add_agesa_fsp_acpi_table(guid_t guid, const char *name, acpi_rsdp_t *rsdp,
unsigned long current);
void acpi_log_events(const struct chipset_power_state *ps);
unsigned long acpi_add_crat_table(unsigned long current, acpi_rsdp_t *rsdp);

View File

@ -4,6 +4,7 @@
#include <amdblocks/acpi.h>
#include <console/console.h>
#include <fsp/util.h>
#include <FspGuids.h>
#include <string.h>
#include <types.h>
@ -15,8 +16,8 @@ struct amd_fsp_acpi_hob_info {
uint16_t hob_payload[0xffc8]; /* maximum payload size */
} __packed;
unsigned long add_agesa_fsp_acpi_table(guid_t guid, const char *name, acpi_rsdp_t *rsdp,
unsigned long current)
static unsigned long add_agesa_fsp_acpi_table(guid_t guid, const char *name, acpi_rsdp_t *rsdp,
unsigned long current)
{
const struct amd_fsp_acpi_hob_info *data;
void *table = (void *)current;
@ -44,3 +45,12 @@ unsigned long add_agesa_fsp_acpi_table(guid_t guid, const char *name, acpi_rsdp_
return current;
}
unsigned long acpi_add_fsp_tables(unsigned long current, acpi_rsdp_t *rsdp)
{
/* add ALIB SSDT from HOB */
current = acpi_align_current(current);
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
return current;
}

View File

@ -24,7 +24,6 @@ verstage-y += espi_util.c
romstage-y += fsp_m_params.c
ramstage-y += acpi.c
ramstage-y += agesa_acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
ramstage-y += fch.c

View File

@ -66,7 +66,8 @@ unsigned long soc_acpi_write_tables(const struct device *device, unsigned long c
/* IVRS */
current = acpi_add_ivrs_table(current, rsdp);
current = acpi_add_fsp_tables(current, rsdp);
if (CONFIG(PLATFORM_USES_FSP2_0))
current = acpi_add_fsp_tables(current, rsdp);
return current;
}

View File

@ -1,17 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* TODO: Make common? */
#include <acpi/acpi.h>
#include <amdblocks/acpi.h>
#include <FspGuids.h>
#include <types.h>
unsigned long acpi_add_fsp_tables(unsigned long current, acpi_rsdp_t *rsdp)
{
/* add ALIB SSDT from HOB */
current = acpi_align_current(current);
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
return current;
}

View File

@ -21,7 +21,6 @@ verstage-y += espi_util.c
romstage-y += fsp_m_params.c
ramstage-y += acpi.c
ramstage-y += agesa_acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
ramstage-y += fch.c

View File

@ -65,7 +65,8 @@ unsigned long soc_acpi_write_tables(const struct device *device, unsigned long c
/* IVRS */
current = acpi_add_ivrs_table(current, rsdp);
current = acpi_add_fsp_tables(current, rsdp);
if (CONFIG(PLATFORM_USES_FSP2_0))
current = acpi_add_fsp_tables(current, rsdp);
return current;
}

View File

@ -1,17 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* TODO: Check if this is still correct */
#include <acpi/acpi.h>
#include <amdblocks/acpi.h>
#include <FspGuids.h>
#include <types.h>
unsigned long acpi_add_fsp_tables(unsigned long current, acpi_rsdp_t *rsdp)
{
/* add ALIB SSDT from HOB */
current = acpi_align_current(current);
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
return current;
}

View File

@ -25,7 +25,6 @@ romstage-$(CONFIG_SOC_AMD_PHOENIX_FSP) += fsp_m_params.c
romstage-y += soc_util.c
ramstage-y += acpi.c
ramstage-y += agesa_acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
ramstage-y += fch.c

View File

@ -66,7 +66,8 @@ unsigned long soc_acpi_write_tables(const struct device *device, unsigned long c
/* IVRS */
current = acpi_add_ivrs_table(current, rsdp);
current = acpi_add_fsp_tables(current, rsdp);
if (CONFIG(PLATFORM_USES_FSP2_0))
current = acpi_add_fsp_tables(current, rsdp);
return current;
}

View File

@ -1,18 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* TODO: Make common? */
#include <acpi/acpi.h>
#include <amdblocks/acpi.h>
#include <commonlib/bsd/helpers.h>
#include <FspGuids.h>
#include <types.h>
unsigned long acpi_add_fsp_tables(unsigned long current, acpi_rsdp_t *rsdp)
{
/* add ALIB SSDT from HOB */
current = acpi_align_current(current);
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
return current;
}

View File

@ -20,7 +20,6 @@ romstage-y += fsp_m_params.c
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi.c
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi_crat.c
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += agesa_acpi.c
ramstage-y += chip.c
ramstage-y += cpu.c
ramstage-y += fch.c

View File

@ -70,7 +70,8 @@ unsigned long soc_acpi_write_tables(const struct device *device, unsigned long c
/* Add SRAT, MSCT, SLIT if needed in the future */
current = acpi_add_fsp_tables(current, rsdp);
if (CONFIG(PLATFORM_USES_FSP2_0))
current = acpi_add_fsp_tables(current, rsdp);
return current;
}

View File

@ -1,15 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi.h>
#include <amdblocks/acpi.h>
#include <FspGuids.h>
#include <types.h>
unsigned long acpi_add_fsp_tables(unsigned long current, acpi_rsdp_t *rsdp)
{
/* add ALIB SSDT from HOB */
current = acpi_align_current(current);
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
return current;
}