summaryrefslogtreecommitdiff
path: root/src/soc/amd/common
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2024-01-25 18:53:54 +0100
committerFelix Held <felix-coreboot@felixheld.de>2024-01-26 18:12:11 +0000
commita4a2a4f033dc48a0a24d54f34364dd2ded627699 (patch)
tree267bf0d3f47cbd01cb884718a18e9532e0328c0d /src/soc/amd/common
parent3ac92e972d9c9c2ee113ea60eb1c3c5b0a61175a (diff)
soc/amd: factor out common acpi_add_ivrs_table implementation
Instead of open-coding this functionality in all AMD SoCs, factor it out into a common implementation. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: Idb65c398b747e70ec67107e0a1d4bd6551501347 Reviewed-on: https://review.coreboot.org/c/coreboot/+/80208 Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Varshit Pandya <pandyavarshit@gmail.com> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Diffstat (limited to 'src/soc/amd/common')
-rw-r--r--src/soc/amd/common/block/acpi/ivrs.c15
-rw-r--r--src/soc/amd/common/block/include/amdblocks/acpi.h2
2 files changed, 15 insertions, 2 deletions
diff --git a/src/soc/amd/common/block/acpi/ivrs.c b/src/soc/amd/common/block/acpi/ivrs.c
index 605c4f56b3..547163c6ff 100644
--- a/src/soc/amd/common/block/acpi/ivrs.c
+++ b/src/soc/amd/common/block/acpi/ivrs.c
@@ -297,7 +297,7 @@ static unsigned long acpi_fill_ivrs11(unsigned long current, acpi_ivrs_ivhd_t *i
return acpi_fill_ivrs40(current, ivhd, nb_dev, iommu_dev);
}
-unsigned long acpi_fill_ivrs(acpi_ivrs_t *ivrs, unsigned long current)
+static unsigned long acpi_fill_ivrs(acpi_ivrs_t *ivrs, unsigned long current)
{
unsigned long current_backup;
uint64_t mmio_x30_value;
@@ -433,3 +433,16 @@ unsigned long acpi_fill_ivrs(acpi_ivrs_t *ivrs, unsigned long current)
return current;
}
+
+unsigned long acpi_add_ivrs_table(unsigned long current, acpi_rsdp_t *rsdp)
+{
+ acpi_ivrs_t *ivrs;
+
+ current = acpi_align_current(current);
+ ivrs = (acpi_ivrs_t *)current;
+ acpi_create_ivrs(ivrs, acpi_fill_ivrs);
+ current += ivrs->header.length;
+ acpi_add_table(rsdp, ivrs);
+
+ 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 9c70864988..a195371cb9 100644
--- a/src/soc/amd/common/block/include/amdblocks/acpi.h
+++ b/src/soc/amd/common/block/include/amdblocks/acpi.h
@@ -56,6 +56,6 @@ uintptr_t add_agesa_fsp_acpi_table(guid_t guid, const char *name, acpi_rsdp_t *r
uintptr_t current);
void acpi_log_events(const struct chipset_power_state *ps);
-unsigned long acpi_fill_ivrs(acpi_ivrs_t *ivrs, unsigned long current);
+unsigned long acpi_add_ivrs_table(unsigned long current, acpi_rsdp_t *rsdp);
#endif /* AMD_BLOCK_ACPI_H */