Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/76077?usp=email )
Change subject: soc/amd/common/block/acpi/ivrs: use memset on ivhd_[11,40] ......................................................................
soc/amd/common/block/acpi/ivrs: use memset on ivhd_[11,40]
Assign the current address casted to acpi_ivrs_ivhd[11,40]_t pointer to *ivhd_[11,40] at the beginning of acpi_fill_ivrs[11,40] and then use memset on *ivhd_[11,40] to zero-initialize the structs.
Signed-off-by: Felix Held felix-coreboot@felixheld.de Change-Id: I70b12fee99d6c71318189ac35e615589a4c8c629 Reviewed-on: https://review.coreboot.org/c/coreboot/+/76077 Reviewed-by: Fred Reitberger reitbergerfred@gmail.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/soc/amd/common/block/acpi/ivrs.c 1 file changed, 4 insertions(+), 6 deletions(-)
Approvals: Fred Reitberger: Looks good to me, approved build bot (Jenkins): Verified
diff --git a/src/soc/amd/common/block/acpi/ivrs.c b/src/soc/amd/common/block/acpi/ivrs.c index d2080e9..d5a409f 100644 --- a/src/soc/amd/common/block/acpi/ivrs.c +++ b/src/soc/amd/common/block/acpi/ivrs.c @@ -200,11 +200,10 @@ static unsigned long acpi_fill_ivrs40(unsigned long current, acpi_ivrs_ivhd_t *ivhd, struct device *nb_dev, struct device *iommu_dev) { - acpi_ivrs_ivhd40_t *ivhd_40; + acpi_ivrs_ivhd40_t *ivhd_40 = (acpi_ivrs_ivhd40_t *)current; unsigned long current_backup;
- memset((void *)current, 0, sizeof(acpi_ivrs_ivhd40_t)); - ivhd_40 = (acpi_ivrs_ivhd40_t *)current; + memset(ivhd_40, 0, sizeof(acpi_ivrs_ivhd40_t));
/* Enable EFR */ ivhd_40->type = IVHD_BLOCK_TYPE_FULL__ACPI_HID; @@ -253,7 +252,7 @@ static unsigned long acpi_fill_ivrs11(unsigned long current, acpi_ivrs_ivhd_t *ivhd, struct device *nb_dev, struct device *iommu_dev) { - acpi_ivrs_ivhd11_t *ivhd_11; + acpi_ivrs_ivhd11_t *ivhd_11 = (acpi_ivrs_ivhd11_t *)current; ivhd11_iommu_attr_t *ivhd11_attr_ptr; unsigned long current_backup;
@@ -261,8 +260,7 @@ * In order to utilize all features, firmware should expose type 11h * IVHD which supersedes the type 10h. */ - memset((void *)current, 0, sizeof(acpi_ivrs_ivhd11_t)); - ivhd_11 = (acpi_ivrs_ivhd11_t *)current; + memset(ivhd_11, 0, sizeof(acpi_ivrs_ivhd11_t));
/* Enable EFR */ ivhd_11->type = IVHD_BLOCK_TYPE_FULL__FIXED;