Skip to contentSkip to conversation

hw/acpi: some cosmetic improvements to existing code

PATCH In review Ani Sinha 1 participant 2 messages Jul 21, 2021

lore
Share & tools
lore

Ani Sinha

author
#0 lore raw

PATCH 1/1 hw/acpi: some cosmetic improvements to existing code

From: Ani Sinha <[email protected]>

All existing code using acpi_get_i386_pci_host() checks for a non-null return from this function call. This change brings the same check to acpi_pcihp_disable_root_bus() function. Also adds a comment describing why we unconditionally pass a truth value to the last argument when calling acpi_pcihp_reset() from ich9 platform.

Fixes c0e427d6eb5fef ("hw/acpi/ich9: Enable ACPI PCI hot-plug")
---
 hw/acpi/ich9.c  | 1 +
 hw/acpi/pcihp.c | 5 +++++
 2 files changed, 6 insertions(+)
hw/acpi/ich9.c +1 -0
index 778e27b659..58d8430eb9 100644
@@ -281,6 +281,7 @@ static void pm_reset(void *opaque)
     pm->smi_en_wmask = ~0;
 
     if (pm->use_acpi_hotplug_bridge) {
+        /* on root PCIE bus, we always use native or SHPC based hotplug */
         acpi_pcihp_reset(&pm->acpi_pci_hotplug, true);
     }
 
hw/acpi/pcihp.c +5 -0
index f4d706e47d..856c6e1b47 100644
@@ -136,6 +136,11 @@ static void acpi_pcihp_disable_root_bus(void)
         return;
     }
 
+    if (!host) {
+        root_hp_disabled = true;
+        return;
+    }
+
     bus = PCI_HOST_BRIDGE(host)->bus;
     if (bus) {
         /* setting the hotplug handler to NULL makes the bus non-hotpluggable */
Signature · 1 line
2.25.1
author
#1 lore raw

Please scratch this. I will resend with my nokia email removed. This work does not involve Nokia.

Ani

Quoted 48 lines · Ani Sinha

From: Ani Sinha <[email protected]>

All existing code using acpi_get_i386_pci_host() checks for a non-null return from this function call. This change brings the same check to acpi_pcihp_disable_root_bus() function. Also adds a comment describing why we unconditionally pass a truth value to the last argument when calling acpi_pcihp_reset() from ich9 platform.

Fixes c0e427d6eb5fef ("hw/acpi/ich9: Enable ACPI PCI hot-plug")
---
 hw/acpi/ich9.c  | 1 +
 hw/acpi/pcihp.c | 5 +++++
 2 files changed, 6 insertions(+)
hw/acpi/ich9.c +1 -0
index 778e27b659..58d8430eb9 100644
@@ -281,6 +281,7 @@ static void pm_reset(void *opaque)
     pm->smi_en_wmask = ~0;
 
     if (pm->use_acpi_hotplug_bridge) {
+        /* on root PCIE bus, we always use native or SHPC based hotplug */
         acpi_pcihp_reset(&pm->acpi_pci_hotplug, true);
     }
 
hw/acpi/pcihp.c +5 -1
index f4d706e47d..856c6e1b47 100644
@@ -136,6 +136,11 @@ static void acpi_pcihp_disable_root_bus(void)
         return;
     }
 
+    if (!host) {
+        root_hp_disabled = true;
+        return;
+    }
+
     bus = PCI_HOST_BRIDGE(host)->bus;
     if (bus) {
         /* setting the hotplug handler to NULL makes the bus non-hotpluggable */
--

2.25.1