Felix Held has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/80208?usp=email )
Change subject: soc/amd: factor out common acpi_add_ivrs_table implementation ......................................................................
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 --- M src/soc/amd/cezanne/agesa_acpi.c M src/soc/amd/common/block/acpi/ivrs.c M src/soc/amd/common/block/include/amdblocks/acpi.h M src/soc/amd/genoa_poc/acpi.c M src/soc/amd/glinda/agesa_acpi.c M src/soc/amd/mendocino/agesa_acpi.c M src/soc/amd/phoenix/agesa_acpi.c M src/soc/amd/picasso/agesa_acpi.c 8 files changed, 21 insertions(+), 42 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/08/80208/1
diff --git a/src/soc/amd/cezanne/agesa_acpi.c b/src/soc/amd/cezanne/agesa_acpi.c index fdfe3eb..e6ccd9c 100644 --- a/src/soc/amd/cezanne/agesa_acpi.c +++ b/src/soc/amd/cezanne/agesa_acpi.c @@ -10,8 +10,6 @@ uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current, acpi_rsdp_t *rsdp) { - acpi_ivrs_t *ivrs; - /* TODO: look into adding CRAT */
/* add ALIB SSDT from HOB */ @@ -19,11 +17,7 @@ current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
/* 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); + current = acpi_add_ivrs_table(current, rsdp);
return current; } diff --git a/src/soc/amd/common/block/acpi/ivrs.c b/src/soc/amd/common/block/acpi/ivrs.c index 605c4f5..547163c 100644 --- a/src/soc/amd/common/block/acpi/ivrs.c +++ b/src/soc/amd/common/block/acpi/ivrs.c @@ -297,7 +297,7 @@ 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 @@
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 9c70864..a195371 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 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 */ diff --git a/src/soc/amd/genoa_poc/acpi.c b/src/soc/amd/genoa_poc/acpi.c index 7762e9d..cadf8db 100644 --- a/src/soc/amd/genoa_poc/acpi.c +++ b/src/soc/amd/genoa_poc/acpi.c @@ -42,12 +42,7 @@ struct acpi_rsdp *rsdp) { /* IVRS */ - 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); + current = acpi_add_ivrs_table(current, rsdp);
return current; } diff --git a/src/soc/amd/glinda/agesa_acpi.c b/src/soc/amd/glinda/agesa_acpi.c index 7ac19c7..f6c3c98 100644 --- a/src/soc/amd/glinda/agesa_acpi.c +++ b/src/soc/amd/glinda/agesa_acpi.c @@ -12,8 +12,6 @@ uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current, acpi_rsdp_t *rsdp) { - acpi_ivrs_t *ivrs; - /* TODO: look into adding CRAT */
/* add ALIB SSDT from HOB */ @@ -21,11 +19,7 @@ current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
/* 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); + current = acpi_add_ivrs_table(current, rsdp);
return current; } diff --git a/src/soc/amd/mendocino/agesa_acpi.c b/src/soc/amd/mendocino/agesa_acpi.c index d60a79d..1e4d600 100644 --- a/src/soc/amd/mendocino/agesa_acpi.c +++ b/src/soc/amd/mendocino/agesa_acpi.c @@ -12,8 +12,6 @@ uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current, acpi_rsdp_t *rsdp) { - acpi_ivrs_t *ivrs; - /* TODO: look into adding CRAT */
/* add ALIB SSDT from HOB */ @@ -21,11 +19,7 @@ current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
/* 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); + current = acpi_add_ivrs_table(current, rsdp);
return current; } diff --git a/src/soc/amd/phoenix/agesa_acpi.c b/src/soc/amd/phoenix/agesa_acpi.c index 251acc6..598ae81 100644 --- a/src/soc/amd/phoenix/agesa_acpi.c +++ b/src/soc/amd/phoenix/agesa_acpi.c @@ -13,8 +13,6 @@ uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current, acpi_rsdp_t *rsdp) { - acpi_ivrs_t *ivrs; - /* TODO: look into adding CRAT */
/* add ALIB SSDT from HOB */ @@ -22,11 +20,7 @@ current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
/* 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); + current = acpi_add_ivrs_table(current, rsdp);
return current; } diff --git a/src/soc/amd/picasso/agesa_acpi.c b/src/soc/amd/picasso/agesa_acpi.c index 9ee977f..7a32779 100644 --- a/src/soc/amd/picasso/agesa_acpi.c +++ b/src/soc/amd/picasso/agesa_acpi.c @@ -542,7 +542,6 @@ uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current, acpi_rsdp_t *rsdp) { - acpi_ivrs_t *ivrs; struct acpi_crat_header *crat;
/* CRAT */ @@ -557,11 +556,7 @@ current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
/* 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); + current = acpi_add_ivrs_table(current, rsdp);
/* Add SRAT, MSCT, SLIT if needed in the future */