[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 08/35] acpi: build_mcfg: use acpi_table_begin()/acpi_table
From: |
Eric Auger |
Subject: |
Re: [PATCH v3 08/35] acpi: build_mcfg: use acpi_table_begin()/acpi_table_end() instead of build_header() |
Date: |
Mon, 20 Sep 2021 18:28:10 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 |
On 9/7/21 4:47 PM, Igor Mammedov wrote:
> 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>
Eric
> ---
> v3:
> * s/acpi_init_table|acpi_table_composed/acpi_table_begin|acpi_table_end/
> ---
> hw/acpi/pci.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/hw/acpi/pci.c b/hw/acpi/pci.c
> index 75b1103ec4..20b70dcd81 100644
> --- a/hw/acpi/pci.c
> +++ b/hw/acpi/pci.c
> @@ -28,19 +28,20 @@
> #include "hw/acpi/pci.h"
> #include "hw/pci/pcie_host.h"
>
> +/*
> + * PCI Firmware Specification, Revision 3.0
> + * 4.1.2 MCFG Table Description.
> + */
> void build_mcfg(GArray *table_data, BIOSLinker *linker, AcpiMcfgInfo *info,
> const char *oem_id, const char *oem_table_id)
> {
> - int mcfg_start = table_data->len;
> + AcpiTable table = { .sig = "MCFG", .rev = 1,
> + .oem_id = oem_id, .oem_table_id = oem_table_id };
> +
> + acpi_table_begin(&table, table_data);
>
> - /*
> - * PCI Firmware Specification, Revision 3.0
> - * 4.1.2 MCFG Table Description.
> - */
> - acpi_data_push(table_data, sizeof(AcpiTableHeader));
> /* Reserved */
> build_append_int_noprefix(table_data, 0, 8);
> -
> /*
> * Memory Mapped Enhanced Configuration Space Base Address Allocation
> * Structure
> @@ -56,6 +57,5 @@ void build_mcfg(GArray *table_data, BIOSLinker *linker,
> AcpiMcfgInfo *info,
> /* Reserved */
> build_append_int_noprefix(table_data, 0, 4);
>
> - build_header(linker, table_data, (void *)(table_data->data + mcfg_start),
> - "MCFG", table_data->len - mcfg_start, 1, oem_id,
> oem_table_id);
> + acpi_table_end(linker, &table);
> }
>
- [PATCH v3 04/35] acpi: build_slit: use acpi_table_begin()/acpi_table_end() instead of build_header(), (continued)
- [PATCH v3 04/35] acpi: build_slit: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 03/35] acpi: build_xsdt: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 06/35] acpi: build_tpm2: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 05/35] acpi: build_fadt: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 07/35] acpi: acpi_build_hest: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 08/35] acpi: build_mcfg: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- Re: [PATCH v3 08/35] acpi: build_mcfg: use acpi_table_begin()/acpi_table_end() instead of build_header(),
Eric Auger <=
- [PATCH v3 09/35] acpi: build_hmat: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 10/35] acpi: nvdimm_build_nfit: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 11/35] acpi: nvdimm_build_ssdt: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07
- [PATCH v3 12/35] acpi: vmgenid_build_acpi: use acpi_table_begin()/acpi_table_end() instead of build_header(), Igor Mammedov, 2021/09/07