git: c2d4fef658e0 - main - acpi_pcib: Use pci_domain_[de]activate_bus for PCI_RES_BUS resources

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 23 Jan 2024 17:45:49 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=c2d4fef658e0dfd998115f1395cd8705b432e3c8

commit c2d4fef658e0dfd998115f1395cd8705b432e3c8
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-01-23 17:35:22 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-01-23 17:35:22 +0000

    acpi_pcib: Use pci_domain_[de]activate_bus for PCI_RES_BUS resources
    
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D43428
---
 sys/dev/acpica/acpi_pcib_acpi.c | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c
index 06e6bc233720..451a8d8b736d 100644
--- a/sys/dev/acpica/acpi_pcib_acpi.c
+++ b/sys/dev/acpica/acpi_pcib_acpi.c
@@ -103,6 +103,12 @@ static int		acpi_pcib_acpi_adjust_resource(device_t dev,
 static int		acpi_pcib_acpi_release_resource(device_t dev,
 			    device_t child, int type, int rid,
 			    struct resource *r);
+static int		acpi_pcib_acpi_activate_resource(device_t dev,
+			    device_t child, int type, int rid,
+			    struct resource *r);
+static int		acpi_pcib_acpi_deactivate_resource(device_t dev,
+			    device_t child, int type, int rid,
+			    struct resource *r);
 #endif
 #endif
 static int		acpi_pcib_request_feature(device_t pcib, device_t dev,
@@ -128,11 +134,13 @@ static device_method_t acpi_pcib_acpi_methods[] = {
 #endif
 #if defined(NEW_PCIB) && defined(PCI_RES_BUS)
     DEVMETHOD(bus_release_resource,	acpi_pcib_acpi_release_resource),
+    DEVMETHOD(bus_activate_resource,	acpi_pcib_acpi_activate_resource),
+    DEVMETHOD(bus_deactivate_resource,	acpi_pcib_acpi_deactivate_resource),
 #else
     DEVMETHOD(bus_release_resource,	bus_generic_release_resource),
-#endif
     DEVMETHOD(bus_activate_resource,	bus_generic_activate_resource),
     DEVMETHOD(bus_deactivate_resource,	bus_generic_deactivate_resource),
+#endif
     DEVMETHOD(bus_setup_intr,		bus_generic_setup_intr),
     DEVMETHOD(bus_teardown_intr,	bus_generic_teardown_intr),
     DEVMETHOD(bus_get_cpus,		acpi_pcib_get_cpus),
@@ -764,6 +772,31 @@ acpi_pcib_acpi_release_resource(device_t dev, device_t child, int type, int rid,
 		return (pci_domain_release_bus(sc->ap_segment, child, rid, r));
 	return (bus_generic_release_resource(dev, child, type, rid, r));
 }
+
+int
+acpi_pcib_acpi_activate_resource(device_t dev, device_t child, int type, int rid,
+    struct resource *r)
+{
+	struct acpi_hpcib_softc *sc;
+
+	sc = device_get_softc(dev);
+	if (type == PCI_RES_BUS)
+		return (pci_domain_activate_bus(sc->ap_segment, child, rid, r));
+	return (bus_generic_activate_resource(dev, child, type, rid, r));
+}
+
+int
+acpi_pcib_acpi_deactivate_resource(device_t dev, device_t child, int type,
+    int rid, struct resource *r)
+{
+	struct acpi_hpcib_softc *sc;
+
+	sc = device_get_softc(dev);
+	if (type == PCI_RES_BUS)
+		return (pci_domain_deactivate_bus(sc->ap_segment, child, rid,
+		    r));
+	return (bus_generic_deactivate_resource(dev, child, type, rid, r));
+}
 #endif
 #endif