mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
pcihp: make bridge describe itself using AcpiDevAmlIfClass:build_dev_aml
simplify build_append_pci_bus_devices() a bit by handling bridge specific logic in bridge dedicated AcpiDevAmlIfClass::build_dev_aml callback. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <20230112140312.3096331-30-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
d78644c781
commit
6c36ec46b0
8 changed files with 70 additions and 16 deletions
|
@ -58,6 +58,7 @@ config PC_ACPI
|
|||
select ACPI_X86
|
||||
select ACPI_CPU_HOTPLUG
|
||||
select ACPI_MEMORY_HOTPLUG
|
||||
select ACPI_PCI_BRIDGE
|
||||
select ACPI_VIOT
|
||||
select SMBUS_EEPROM
|
||||
select PFLASH_CFI01
|
||||
|
|
|
@ -383,8 +383,7 @@ static void build_append_pcihp_notify_entry(Aml *method, int slot)
|
|||
aml_append(method, if_ctx);
|
||||
}
|
||||
|
||||
static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
|
||||
bool pcihp_bridge_en)
|
||||
void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus)
|
||||
{
|
||||
Aml *dev, *notify_method = NULL, *method;
|
||||
QObject *bsel;
|
||||
|
@ -406,7 +405,6 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
|
|||
/* ACPI spec: 1.0b: Table 6-2 _ADR Object Bus Types, PCI type */
|
||||
int adr = slot << 16 | func;
|
||||
bool hotpluggbale_slot = false;
|
||||
bool bridge_in_acpi = false;
|
||||
bool cold_plugged_bridge = false;
|
||||
|
||||
if (pdev) {
|
||||
|
@ -418,7 +416,6 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
|
|||
*/
|
||||
cold_plugged_bridge = IS_PCI_BRIDGE(pdev) &&
|
||||
!DEVICE(pdev)->hotplugged;
|
||||
bridge_in_acpi = cold_plugged_bridge && pcihp_bridge_en;
|
||||
|
||||
hotpluggbale_slot = bsel && dc->hotpluggable &&
|
||||
!cold_plugged_bridge;
|
||||
|
@ -471,16 +468,6 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
|
|||
|
||||
call_dev_aml_func(DEVICE(pdev), dev);
|
||||
|
||||
if (bridge_in_acpi) {
|
||||
/*
|
||||
* device is coldplugged bridge,
|
||||
* add child device descriptions into its scope
|
||||
*/
|
||||
PCIBus *sec_bus = pci_bridge_get_sec_bus(PCI_BRIDGE(pdev));
|
||||
|
||||
build_append_pci_bus_devices(dev, sec_bus, pcihp_bridge_en);
|
||||
}
|
||||
|
||||
if (hotpluggbale_slot) {
|
||||
aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
|
||||
/* add _EJ0 to make slot hotpluggable */
|
||||
|
@ -1704,7 +1691,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
|||
PCIBus *bus = PCI_HOST_BRIDGE(pci_host)->bus;
|
||||
Aml *scope = aml_scope("PCI0");
|
||||
/* Scan all PCI buses. Generate tables to support hotplug. */
|
||||
build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
|
||||
build_append_pci_bus_devices(scope, bus);
|
||||
aml_append(sb_scope, scope);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue