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>
This commit is contained in:
parent
3ac92e972d
commit
a4a2a4f033
|
@ -10,8 +10,6 @@
|
||||||
uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current,
|
uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current,
|
||||||
acpi_rsdp_t *rsdp)
|
acpi_rsdp_t *rsdp)
|
||||||
{
|
{
|
||||||
acpi_ivrs_t *ivrs;
|
|
||||||
|
|
||||||
/* TODO: look into adding CRAT */
|
/* TODO: look into adding CRAT */
|
||||||
|
|
||||||
/* add ALIB SSDT from HOB */
|
/* add ALIB SSDT from HOB */
|
||||||
|
@ -19,11 +17,7 @@ uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current
|
||||||
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
|
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
|
||||||
|
|
||||||
/* IVRS */
|
/* IVRS */
|
||||||
current = acpi_align_current(current);
|
current = acpi_add_ivrs_table(current, rsdp);
|
||||||
ivrs = (acpi_ivrs_t *)current;
|
|
||||||
acpi_create_ivrs(ivrs, acpi_fill_ivrs);
|
|
||||||
current += ivrs->header.length;
|
|
||||||
acpi_add_table(rsdp, ivrs);
|
|
||||||
|
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
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;
|
unsigned long current_backup;
|
||||||
uint64_t mmio_x30_value;
|
uint64_t mmio_x30_value;
|
||||||
|
@ -433,3 +433,16 @@ unsigned long acpi_fill_ivrs(acpi_ivrs_t *ivrs, unsigned long current)
|
||||||
|
|
||||||
return 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;
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,6 @@ uintptr_t add_agesa_fsp_acpi_table(guid_t guid, const char *name, acpi_rsdp_t *r
|
||||||
uintptr_t current);
|
uintptr_t current);
|
||||||
|
|
||||||
void acpi_log_events(const struct chipset_power_state *ps);
|
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 */
|
#endif /* AMD_BLOCK_ACPI_H */
|
||||||
|
|
|
@ -42,12 +42,7 @@ unsigned long soc_acpi_write_tables(const struct device *device, unsigned long c
|
||||||
struct acpi_rsdp *rsdp)
|
struct acpi_rsdp *rsdp)
|
||||||
{
|
{
|
||||||
/* IVRS */
|
/* IVRS */
|
||||||
acpi_ivrs_t *ivrs;
|
current = acpi_add_ivrs_table(current, rsdp);
|
||||||
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;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current,
|
uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current,
|
||||||
acpi_rsdp_t *rsdp)
|
acpi_rsdp_t *rsdp)
|
||||||
{
|
{
|
||||||
acpi_ivrs_t *ivrs;
|
|
||||||
|
|
||||||
/* TODO: look into adding CRAT */
|
/* TODO: look into adding CRAT */
|
||||||
|
|
||||||
/* add ALIB SSDT from HOB */
|
/* add ALIB SSDT from HOB */
|
||||||
|
@ -21,11 +19,7 @@ uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current
|
||||||
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
|
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
|
||||||
|
|
||||||
/* IVRS */
|
/* IVRS */
|
||||||
current = acpi_align_current(current);
|
current = acpi_add_ivrs_table(current, rsdp);
|
||||||
ivrs = (acpi_ivrs_t *)current;
|
|
||||||
acpi_create_ivrs(ivrs, acpi_fill_ivrs);
|
|
||||||
current += ivrs->header.length;
|
|
||||||
acpi_add_table(rsdp, ivrs);
|
|
||||||
|
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current,
|
uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current,
|
||||||
acpi_rsdp_t *rsdp)
|
acpi_rsdp_t *rsdp)
|
||||||
{
|
{
|
||||||
acpi_ivrs_t *ivrs;
|
|
||||||
|
|
||||||
/* TODO: look into adding CRAT */
|
/* TODO: look into adding CRAT */
|
||||||
|
|
||||||
/* add ALIB SSDT from HOB */
|
/* add ALIB SSDT from HOB */
|
||||||
|
@ -21,11 +19,7 @@ uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current
|
||||||
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
|
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
|
||||||
|
|
||||||
/* IVRS */
|
/* IVRS */
|
||||||
current = acpi_align_current(current);
|
current = acpi_add_ivrs_table(current, rsdp);
|
||||||
ivrs = (acpi_ivrs_t *)current;
|
|
||||||
acpi_create_ivrs(ivrs, acpi_fill_ivrs);
|
|
||||||
current += ivrs->header.length;
|
|
||||||
acpi_add_table(rsdp, ivrs);
|
|
||||||
|
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current,
|
uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current,
|
||||||
acpi_rsdp_t *rsdp)
|
acpi_rsdp_t *rsdp)
|
||||||
{
|
{
|
||||||
acpi_ivrs_t *ivrs;
|
|
||||||
|
|
||||||
/* TODO: look into adding CRAT */
|
/* TODO: look into adding CRAT */
|
||||||
|
|
||||||
/* add ALIB SSDT from HOB */
|
/* add ALIB SSDT from HOB */
|
||||||
|
@ -22,11 +20,7 @@ uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current
|
||||||
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
|
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
|
||||||
|
|
||||||
/* IVRS */
|
/* IVRS */
|
||||||
current = acpi_align_current(current);
|
current = acpi_add_ivrs_table(current, rsdp);
|
||||||
ivrs = (acpi_ivrs_t *)current;
|
|
||||||
acpi_create_ivrs(ivrs, acpi_fill_ivrs);
|
|
||||||
current += ivrs->header.length;
|
|
||||||
acpi_add_table(rsdp, ivrs);
|
|
||||||
|
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
|
@ -542,7 +542,6 @@ static unsigned long acpi_fill_crat(struct acpi_crat_header *crat, unsigned long
|
||||||
uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current,
|
uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current,
|
||||||
acpi_rsdp_t *rsdp)
|
acpi_rsdp_t *rsdp)
|
||||||
{
|
{
|
||||||
acpi_ivrs_t *ivrs;
|
|
||||||
struct acpi_crat_header *crat;
|
struct acpi_crat_header *crat;
|
||||||
|
|
||||||
/* CRAT */
|
/* CRAT */
|
||||||
|
@ -557,11 +556,7 @@ uintptr_t agesa_write_acpi_tables(const struct device *device, uintptr_t current
|
||||||
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
|
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current);
|
||||||
|
|
||||||
/* IVRS */
|
/* IVRS */
|
||||||
current = acpi_align_current(current);
|
current = acpi_add_ivrs_table(current, rsdp);
|
||||||
ivrs = (acpi_ivrs_t *)current;
|
|
||||||
acpi_create_ivrs(ivrs, acpi_fill_ivrs);
|
|
||||||
current += ivrs->header.length;
|
|
||||||
acpi_add_table(rsdp, ivrs);
|
|
||||||
|
|
||||||
/* Add SRAT, MSCT, SLIT if needed in the future */
|
/* Add SRAT, MSCT, SLIT if needed in the future */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue