mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
hw/acpi: Move AML building code for Generic Initiators to aml_build.c
Rather than attempting to create a generic function with mess of the two different device handle types, use a PCI handle specific variant. If the ACPI handle form is needed then that can be introduced alongside this with little duplicated code. Drop the PCIDeviceHandle in favor of just passing the bus, devfn and segment directly. devfn kept as a single byte because ARI means that in this case it is just an 8 bit function number. Suggested-by: Igor Mammedov <imammedo@redhat.com> Link: https://lore.kernel.org/qemu-devel/20240618142333.102be976@imammedo.users.ipa.redhat.com/ Tested-by: "Huang, Ying" <ying.huang@intel.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Message-Id: <20240916171017.1841767-4-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
dc55a90e29
commit
d8a4b4c3b4
4 changed files with 51 additions and 59 deletions
|
@ -1937,6 +1937,50 @@ void build_srat_memory(GArray *table_data, uint64_t base,
|
|||
build_append_int_noprefix(table_data, 0, 8); /* Reserved */
|
||||
}
|
||||
|
||||
/*
|
||||
* ACPI Spec Revision 6.3
|
||||
* Table 5-80 Device Handle - PCI
|
||||
*/
|
||||
static void build_append_srat_pci_device_handle(GArray *table_data,
|
||||
uint16_t segment,
|
||||
uint8_t bus, uint8_t devfn)
|
||||
{
|
||||
/* PCI segment number */
|
||||
build_append_int_noprefix(table_data, segment, 2);
|
||||
/* PCI Bus Device Function */
|
||||
build_append_int_noprefix(table_data, bus, 1);
|
||||
build_append_int_noprefix(table_data, devfn, 1);
|
||||
/* Reserved */
|
||||
build_append_int_noprefix(table_data, 0, 12);
|
||||
}
|
||||
|
||||
/*
|
||||
* ACPI spec, Revision 6.3
|
||||
* 5.2.16.6 Generic Initiator Affinity Structure
|
||||
* With PCI Device Handle.
|
||||
*/
|
||||
void build_srat_pci_generic_initiator(GArray *table_data, int node,
|
||||
uint16_t segment, uint8_t bus,
|
||||
uint8_t devfn)
|
||||
{
|
||||
/* Type */
|
||||
build_append_int_noprefix(table_data, 5, 1);
|
||||
/* Length */
|
||||
build_append_int_noprefix(table_data, 32, 1);
|
||||
/* Reserved */
|
||||
build_append_int_noprefix(table_data, 0, 1);
|
||||
/* Device Handle Type: PCI */
|
||||
build_append_int_noprefix(table_data, 1, 1);
|
||||
/* Proximity Domain */
|
||||
build_append_int_noprefix(table_data, node, 4);
|
||||
/* Device Handle */
|
||||
build_append_srat_pci_device_handle(table_data, segment, bus, devfn);
|
||||
/* Flags - GI Enabled */
|
||||
build_append_int_noprefix(table_data, 1, 4);
|
||||
/* Reserved */
|
||||
build_append_int_noprefix(table_data, 0, 4);
|
||||
}
|
||||
|
||||
/*
|
||||
* ACPI spec 5.2.17 System Locality Distance Information Table
|
||||
* (Revision 2.0 or later)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue