git: e9eb353b324a - main - pci_host_generic: 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:50 UTC
The branch main has been updated by jhb:

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

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

    pci_host_generic: Use pci_domain_[de]activate_bus for PCI_RES_BUS resources
    
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D43429
---
 sys/dev/pci/pci_host_generic.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c
index 90361a7258ed..43b6d26e9217 100644
--- a/sys/dev/pci/pci_host_generic.c
+++ b/sys/dev/pci/pci_host_generic.c
@@ -504,9 +504,19 @@ static int
 generic_pcie_activate_resource(device_t dev, device_t child, int type,
     int rid, struct resource *r)
 {
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+	struct generic_pcie_core_softc *sc;
+#endif
 	rman_res_t start, end;
 	int res;
 
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+	sc = device_get_softc(dev);
+	if (type == PCI_RES_BUS) {
+		return (pci_domain_activate_bus(sc->ecam, child, rid, r));
+	}
+#endif
+
 	if ((res = rman_activate_resource(r)) != 0)
 		return (res);
 
@@ -529,8 +539,17 @@ static int
 generic_pcie_deactivate_resource(device_t dev, device_t child, int type,
     int rid, struct resource *r)
 {
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+	struct generic_pcie_core_softc *sc;
+#endif
 	int res;
 
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+	sc = device_get_softc(dev);
+	if (type == PCI_RES_BUS) {
+		return (pci_domain_deactivate_bus(sc->ecam, child, rid, r));
+	}
+#endif
 	if ((res = rman_deactivate_resource(r)) != 0)
 		return (res);