diff options
author | Igor Mammedov <imammedo@redhat.com> | 2022-07-01 09:35:07 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2022-10-09 16:38:45 -0400 |
commit | 5840a16364b8d7b474b2730a4c73ffb4c1dbaf47 (patch) | |
tree | 0a1eda792a21abcdd31ea42d57d2ff59385e506b /hw/i386 | |
parent | 18a31b8d3e75f5bb727826dfe6a0c762536bf408 (diff) | |
download | qemu-5840a16364b8d7b474b2730a4c73ffb4c1dbaf47.zip qemu-5840a16364b8d7b474b2730a4c73ffb4c1dbaf47.tar.gz qemu-5840a16364b8d7b474b2730a4c73ffb4c1dbaf47.tar.bz2 |
x86: acpi: cleanup PCI device _DSM duplication
add ASUN variable to hotpluggable slots and use it
instead of _SUN which has the same value to reuse
_DMS code on both branches (hot- and non-hotpluggable).
No functional change.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20220701133515.137890-10-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/i386')
-rw-r--r-- | hw/i386/acpi-build.c | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index a19900c..eb92b05 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -374,6 +374,25 @@ build_facs(GArray *table_data) g_array_append_vals(table_data, reserved, 40); /* Reserved */ } +Aml *aml_pci_device_dsm(void) +{ + Aml *method; + + method = aml_method("_DSM", 4, AML_SERIALIZED); + { + Aml *params = aml_local(0); + Aml *pkg = aml_package(2); + aml_append(pkg, aml_name("BSEL")); + aml_append(pkg, aml_name("ASUN")); + aml_append(method, aml_store(pkg, params)); + aml_append(method, + aml_return(aml_call5("PDSM", aml_arg(0), aml_arg(1), + aml_arg(2), aml_arg(3), params)) + ); + } + return method; +} + static void build_append_pcihp_notify_entry(Aml *method, int slot) { Aml *if_ctx; @@ -423,26 +442,17 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus, break; } dev = aml_device("S%.02X", devfn); - aml_append(dev, aml_name_decl("_SUN", aml_int(slot))); + aml_append(dev, aml_name_decl("ASUN", aml_int(slot))); aml_append(dev, aml_name_decl("_ADR", aml_int(adr))); + aml_append(dev, aml_name_decl("_SUN", aml_int(slot))); method = aml_method("_EJ0", 1, AML_NOTSERIALIZED); aml_append(method, aml_call2("PCEJ", aml_name("BSEL"), aml_name("_SUN")) ); aml_append(dev, method); - method = aml_method("_DSM", 4, AML_SERIALIZED); - { - Aml *params = aml_local(0); - Aml *pkg = aml_package(2); - aml_append(pkg, aml_name("BSEL")); - aml_append(pkg, aml_name("_SUN")); - aml_append(method, aml_store(pkg, params)); - aml_append(method, - aml_return(aml_call5("PDSM", aml_arg(0), aml_arg(1), - aml_arg(2), aml_arg(3), params)) - ); - } - aml_append(dev, method); + + aml_append(dev, aml_pci_device_dsm()); + aml_append(parent_scope, dev); build_append_pcihp_notify_entry(notify_method, slot); @@ -485,19 +495,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus, * enumeration order in linux kernel, so use another variable for it */ aml_append(dev, aml_name_decl("ASUN", aml_int(slot))); - method = aml_method("_DSM", 4, AML_SERIALIZED); - { - Aml *params = aml_local(0); - Aml *pkg = aml_package(2); - aml_append(pkg, aml_name("BSEL")); - aml_append(pkg, aml_name("ASUN")); - aml_append(method, aml_store(pkg, params)); - aml_append(method, aml_return( - aml_call5("PDSM", aml_arg(0), aml_arg(1), aml_arg(2), - aml_arg(3), params) - )); - } - aml_append(dev, method); + aml_append(dev, aml_pci_device_dsm()); } if (pc->class_id == PCI_CLASS_DISPLAY_VGA) { @@ -585,7 +583,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus, qobject_unref(bsel); } -Aml *aml_pci_device_dsm(void) +static Aml *aml_pci_pdsm(void) { Aml *method, *UUID, *ifctx, *ifctx1; Aml *ret = aml_local(0); @@ -1368,7 +1366,7 @@ static void build_x86_acpi_pci_hotplug(Aml *table, uint64_t pcihp_addr) aml_append(method, aml_return(aml_local(0))); aml_append(scope, method); - aml_append(scope, aml_pci_device_dsm()); + aml_append(scope, aml_pci_pdsm()); aml_append(table, scope); } |