mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
acpi: use build_append_int_noprefix() API to compose SRAT table
Drop usage of packed structures and explicit endian conversions when building SRAT tables for arm/x86 and use endian agnostic build_append_int_noprefix() API to build it. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Message-Id: <20210924122802.1455362-18-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
255bf20f2e
commit
e5b6d55a6e
6 changed files with 80 additions and 106 deletions
|
@ -1940,15 +1940,25 @@ build_xsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets,
|
|||
acpi_table_end(linker, &table);
|
||||
}
|
||||
|
||||
void build_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base,
|
||||
/*
|
||||
* ACPI spec, Revision 4.0
|
||||
* 5.2.16.2 Memory Affinity Structure
|
||||
*/
|
||||
void build_srat_memory(GArray *table_data, uint64_t base,
|
||||
uint64_t len, int node, MemoryAffinityFlags flags)
|
||||
{
|
||||
numamem->type = ACPI_SRAT_MEMORY;
|
||||
numamem->length = sizeof(*numamem);
|
||||
numamem->proximity = cpu_to_le32(node);
|
||||
numamem->flags = cpu_to_le32(flags);
|
||||
numamem->base_addr = cpu_to_le64(base);
|
||||
numamem->range_length = cpu_to_le64(len);
|
||||
build_append_int_noprefix(table_data, 1, 1); /* Type */
|
||||
build_append_int_noprefix(table_data, 40, 1); /* Length */
|
||||
build_append_int_noprefix(table_data, node, 4); /* Proximity Domain */
|
||||
build_append_int_noprefix(table_data, 0, 2); /* Reserved */
|
||||
build_append_int_noprefix(table_data, base, 4); /* Base Address Low */
|
||||
/* Base Address High */
|
||||
build_append_int_noprefix(table_data, base >> 32, 4);
|
||||
build_append_int_noprefix(table_data, len, 4); /* Length Low */
|
||||
build_append_int_noprefix(table_data, len >> 32, 4); /* Length High */
|
||||
build_append_int_noprefix(table_data, 0, 4); /* Reserved */
|
||||
build_append_int_noprefix(table_data, flags, 4); /* Flags */
|
||||
build_append_int_noprefix(table_data, 0, 8); /* Reserved */
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue