[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 33/57] acpi: build_waet: use acpi_table_begin()/acpi_table_end() i
From: |
Michael S. Tsirkin |
Subject: |
[PULL 33/57] acpi: build_waet: use acpi_table_begin()/acpi_table_end() instead of build_header() |
Date: |
Tue, 5 Oct 2021 12:03:10 -0400 |
From: Igor Mammedov <imammedo@redhat.com>
it replaces error-prone pointer arithmetic for build_header() API,
with 2 calls to start and finish table creation,
which hides offsets magic from API user.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-Id: <20210924122802.1455362-20-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/i386/acpi-build.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index c65ab1d6a5..e5cc4f7daa 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -2223,10 +2223,10 @@ static void
build_waet(GArray *table_data, BIOSLinker *linker, const char *oem_id,
const char *oem_table_id)
{
- int waet_start = table_data->len;
+ AcpiTable table = { .sig = "WAET", .rev = 1, .oem_id = oem_id,
+ .oem_table_id = oem_table_id };
- /* WAET header */
- acpi_data_push(table_data, sizeof(AcpiTableHeader));
+ acpi_table_begin(&table, table_data);
/*
* Set "ACPI PM timer good" flag.
*
@@ -2235,9 +2235,7 @@ build_waet(GArray *table_data, BIOSLinker *linker, const
char *oem_id,
* Which avoids costly VMExits caused by guest re-reading it unnecessarily.
*/
build_append_int_noprefix(table_data, 1 << 1 /* ACPI PM timer good */, 4);
-
- build_header(linker, table_data, (void *)(table_data->data + waet_start),
- "WAET", table_data->len - waet_start, 1, oem_id,
oem_table_id);
+ acpi_table_end(linker, &table);
}
/*
--
MST
- [PULL 49/57] acpi: AcpiGenericAddress no longer used to map/access fields of MMIO, drop packed attribute, (continued)
- [PULL 49/57] acpi: AcpiGenericAddress no longer used to map/access fields of MMIO, drop packed attribute, Michael S. Tsirkin, 2021/10/05
- [PULL 51/57] hw/i386/acpi: fix conflicting IO address range for acpi pci hotplug in q35, Michael S. Tsirkin, 2021/10/05
- [PULL 56/57] hw/i386/amd_iommu: Rename SysBus specific functions as amdvi_sysbus_X(), Michael S. Tsirkin, 2021/10/05
- [PULL 22/57] acpi: build_mcfg: use acpi_table_begin()/acpi_table_end() instead of build_header(), Michael S. Tsirkin, 2021/10/05
- [PULL 55/57] hw/i386/amd_iommu: Rename amdviPCI TypeInfo, Michael S. Tsirkin, 2021/10/05
- [PULL 53/57] virtio-balloon: Fix page-poison subsection name, Michael S. Tsirkin, 2021/10/05
- [PULL 54/57] nvdimm: release the correct device list, Michael S. Tsirkin, 2021/10/05
- [PULL 52/57] bios-tables-test: Update ACPI DSDT table golden blobs for q35, Michael S. Tsirkin, 2021/10/05
- [PULL 57/57] hw/i386/amd_iommu: Add description/category to TYPE_AMD_IOMMU_PCI, Michael S. Tsirkin, 2021/10/05
- [PULL 27/57] acpi: x86: build_dsdt: use acpi_table_begin()/acpi_table_end() instead of build_header(), Michael S. Tsirkin, 2021/10/05
- [PULL 33/57] acpi: build_waet: use acpi_table_begin()/acpi_table_end() instead of build_header(),
Michael S. Tsirkin <=
- Re: [PULL 00/57] pc,pci,virtio: features, fixes, Richard Henderson, 2021/10/05
- Re: [PULL 00/57] pc,pci,virtio: features, fixes, Michael S. Tsirkin, 2021/10/05
- Re: [PULL 00/57] pc,pci,virtio: features, fixes, Richard Henderson, 2021/10/05
- Re: [PULL 00/57] pc,pci,virtio: features, fixes, Jason Wang, 2021/10/10