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>
This commit is contained in:
Felix Held 2023-06-23 18:49:26 +02:00
parent 634c7a4450
commit 50cbb933a3
1 changed files with 4 additions and 6 deletions

View File

@ -200,11 +200,10 @@ static unsigned long acpi_ivhd_misc(unsigned long current, struct device *dev)
static unsigned long acpi_fill_ivrs40(unsigned long current, acpi_ivrs_ivhd_t *ivhd, static unsigned long acpi_fill_ivrs40(unsigned long current, acpi_ivrs_ivhd_t *ivhd,
struct device *nb_dev, struct device *iommu_dev) 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; unsigned long current_backup;
memset((void *)current, 0, sizeof(acpi_ivrs_ivhd40_t)); memset(ivhd_40, 0, sizeof(acpi_ivrs_ivhd40_t));
ivhd_40 = (acpi_ivrs_ivhd40_t *)current;
/* Enable EFR */ /* Enable EFR */
ivhd_40->type = IVHD_BLOCK_TYPE_FULL__ACPI_HID; ivhd_40->type = IVHD_BLOCK_TYPE_FULL__ACPI_HID;
@ -253,7 +252,7 @@ static unsigned long acpi_fill_ivrs40(unsigned long current, acpi_ivrs_ivhd_t *i
static unsigned long acpi_fill_ivrs11(unsigned long current, acpi_ivrs_ivhd_t *ivhd, static unsigned long acpi_fill_ivrs11(unsigned long current, acpi_ivrs_ivhd_t *ivhd,
struct device *nb_dev, struct device *iommu_dev) 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; ivhd11_iommu_attr_t *ivhd11_attr_ptr;
unsigned long current_backup; unsigned long current_backup;
@ -261,8 +260,7 @@ static unsigned long acpi_fill_ivrs11(unsigned long current, acpi_ivrs_ivhd_t *i
* In order to utilize all features, firmware should expose type 11h * In order to utilize all features, firmware should expose type 11h
* IVHD which supersedes the type 10h. * IVHD which supersedes the type 10h.
*/ */
memset((void *)current, 0, sizeof(acpi_ivrs_ivhd11_t)); memset(ivhd_11, 0, sizeof(acpi_ivrs_ivhd11_t));
ivhd_11 = (acpi_ivrs_ivhd11_t *)current;
/* Enable EFR */ /* Enable EFR */
ivhd_11->type = IVHD_BLOCK_TYPE_FULL__FIXED; ivhd_11->type = IVHD_BLOCK_TYPE_FULL__FIXED;