Felix Held submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Matt DeVillier: Looks good to me, approved
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>
---
M src/soc/amd/cezanne/Makefile.mk
M src/soc/amd/cezanne/acpi.c
D src/soc/amd/cezanne/agesa_acpi.c
M src/soc/amd/common/block/include/amdblocks/acpi.h
M src/soc/amd/common/fsp/fsp-acpi.c
M src/soc/amd/glinda/Makefile.mk
M src/soc/amd/glinda/acpi.c
D src/soc/amd/glinda/agesa_acpi.c
M src/soc/amd/mendocino/Makefile.mk
M src/soc/amd/mendocino/acpi.c
D src/soc/amd/mendocino/agesa_acpi.c
M src/soc/amd/phoenix/Makefile.mk
M src/soc/amd/phoenix/acpi.c
D src/soc/amd/phoenix/agesa_acpi.c
M src/soc/amd/picasso/Makefile.mk
M src/soc/amd/picasso/acpi.c
D src/soc/amd/picasso/agesa_acpi.c
17 files changed, 22 insertions(+), 97 deletions(-)

diff --git a/src/soc/amd/cezanne/Makefile.mk b/src/soc/amd/cezanne/Makefile.mk
index dedf98c..163f777 100644
--- a/src/soc/amd/cezanne/Makefile.mk
+++ b/src/soc/amd/cezanne/Makefile.mk
@@ -19,7 +19,6 @@
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
diff --git a/src/soc/amd/cezanne/acpi.c b/src/soc/amd/cezanne/acpi.c
index 417d5f9..c99159a 100644
--- a/src/soc/amd/cezanne/acpi.c
+++ b/src/soc/amd/cezanne/acpi.c
@@ -63,7 +63,8 @@
/* 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;
}
diff --git a/src/soc/amd/cezanne/agesa_acpi.c b/src/soc/amd/cezanne/agesa_acpi.c
deleted file mode 100644
index a5057bf..0000000
--- a/src/soc/amd/cezanne/agesa_acpi.c
+++ /dev/null
@@ -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;
-}
diff --git a/src/soc/amd/common/block/include/amdblocks/acpi.h b/src/soc/amd/common/block/include/amdblocks/acpi.h
index 4db0776..e2d1c32 100644
--- a/src/soc/amd/common/block/include/amdblocks/acpi.h
+++ b/src/soc/amd/common/block/include/amdblocks/acpi.h
@@ -60,9 +60,6 @@
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);
diff --git a/src/soc/amd/common/fsp/fsp-acpi.c b/src/soc/amd/common/fsp/fsp-acpi.c
index 6c65b3e..d30456d 100644
--- a/src/soc/amd/common/fsp/fsp-acpi.c
+++ b/src/soc/amd/common/fsp/fsp-acpi.c
@@ -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 @@
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 @@

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;
+}
diff --git a/src/soc/amd/glinda/Makefile.mk b/src/soc/amd/glinda/Makefile.mk
index bc217d3..4570e07 100644
--- a/src/soc/amd/glinda/Makefile.mk
+++ b/src/soc/amd/glinda/Makefile.mk
@@ -24,7 +24,6 @@
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
diff --git a/src/soc/amd/glinda/acpi.c b/src/soc/amd/glinda/acpi.c
index 86e9aec..8b6031c 100644
--- a/src/soc/amd/glinda/acpi.c
+++ b/src/soc/amd/glinda/acpi.c
@@ -66,7 +66,8 @@
/* 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;
}
diff --git a/src/soc/amd/glinda/agesa_acpi.c b/src/soc/amd/glinda/agesa_acpi.c
deleted file mode 100644
index 114fdd8..0000000
--- a/src/soc/amd/glinda/agesa_acpi.c
+++ /dev/null
@@ -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;
-}
diff --git a/src/soc/amd/mendocino/Makefile.mk b/src/soc/amd/mendocino/Makefile.mk
index 5b9216e..cc44358 100644
--- a/src/soc/amd/mendocino/Makefile.mk
+++ b/src/soc/amd/mendocino/Makefile.mk
@@ -21,7 +21,6 @@
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
diff --git a/src/soc/amd/mendocino/acpi.c b/src/soc/amd/mendocino/acpi.c
index 328a2f9..898e75e 100644
--- a/src/soc/amd/mendocino/acpi.c
+++ b/src/soc/amd/mendocino/acpi.c
@@ -65,7 +65,8 @@
/* 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;
}
diff --git a/src/soc/amd/mendocino/agesa_acpi.c b/src/soc/amd/mendocino/agesa_acpi.c
deleted file mode 100644
index da0f9a1..0000000
--- a/src/soc/amd/mendocino/agesa_acpi.c
+++ /dev/null
@@ -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;
-}
diff --git a/src/soc/amd/phoenix/Makefile.mk b/src/soc/amd/phoenix/Makefile.mk
index 82ce54d..26e9102 100644
--- a/src/soc/amd/phoenix/Makefile.mk
+++ b/src/soc/amd/phoenix/Makefile.mk
@@ -25,7 +25,6 @@
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
diff --git a/src/soc/amd/phoenix/acpi.c b/src/soc/amd/phoenix/acpi.c
index 663a322..a8be10e 100644
--- a/src/soc/amd/phoenix/acpi.c
+++ b/src/soc/amd/phoenix/acpi.c
@@ -66,7 +66,8 @@
/* 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;
}
diff --git a/src/soc/amd/phoenix/agesa_acpi.c b/src/soc/amd/phoenix/agesa_acpi.c
deleted file mode 100644
index 67a112e..0000000
--- a/src/soc/amd/phoenix/agesa_acpi.c
+++ /dev/null
@@ -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;
-}
diff --git a/src/soc/amd/picasso/Makefile.mk b/src/soc/amd/picasso/Makefile.mk
index 52f1ab0..94d7f7bb 100644
--- a/src/soc/amd/picasso/Makefile.mk
+++ b/src/soc/amd/picasso/Makefile.mk
@@ -20,7 +20,6 @@

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
diff --git a/src/soc/amd/picasso/acpi.c b/src/soc/amd/picasso/acpi.c
index 9472107..b95db5d 100644
--- a/src/soc/amd/picasso/acpi.c
+++ b/src/soc/amd/picasso/acpi.c
@@ -70,7 +70,8 @@

/* 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;
}
diff --git a/src/soc/amd/picasso/agesa_acpi.c b/src/soc/amd/picasso/agesa_acpi.c
deleted file mode 100644
index a5057bf..0000000
--- a/src/soc/amd/picasso/agesa_acpi.c
+++ /dev/null
@@ -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;
-}

To view, visit change 80225. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I8917a346f586e77b3b3278c73aed8cf61f3c9e6a
Gerrit-Change-Number: 80225
Gerrit-PatchSet: 4
Gerrit-Owner: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Fred Reitberger <reitbergerfred@gmail.com>
Gerrit-Reviewer: Jason Glenesk <jason.glenesk@gmail.com>
Gerrit-Reviewer: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged