Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Feb 2024 01:56:36 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: feefc3c71e33 - main - pci_host_generic: Properly handle bus_release_resource of IRQ resources
Message-ID:  <202402160156.41G1uanE006452@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb:

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

commit feefc3c71e33d8f97879c4889d5cf1ec82e98cd9
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-02-16 01:56:01 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-02-16 01:56:01 +0000

    pci_host_generic: Properly handle bus_release_resource of IRQ resources
    
    Unlike other bus methods updated to use bus_generic_rman_* in commit
    d79b6b8ec267, the bus_release_resource method was using
    bus_generic_rman_release_resource for all types other than
    PCI_RES_BUS.  Instead, bus_generic_rman_* should only be used for
    memory and I/O port resources for this driver.
    
    Tested by:      cperciva
    Reviewed by:    cperciva
    Fixes:          d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation
    Differential Revision:  https://reviews.freebsd.org/D43925
---
 sys/dev/pci/pci_host_generic.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c
index ca384d9a1483..386b8411d29a 100644
--- a/sys/dev/pci/pci_host_generic.c
+++ b/sys/dev/pci/pci_host_generic.c
@@ -431,16 +431,24 @@ int
 pci_host_generic_core_release_resource(device_t dev, device_t child, int type,
     int rid, struct resource *res)
 {
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
 	struct generic_pcie_core_softc *sc;
 
 	sc = device_get_softc(dev);
-
+#endif
+	switch (type) {
 #if defined(NEW_PCIB) && defined(PCI_RES_BUS)
-	if (type == PCI_RES_BUS) {
+	case PCI_RES_BUS:
 		return (pci_domain_release_bus(sc->ecam, child, rid, res));
-	}
 #endif
-	return (bus_generic_rman_release_resource(dev, child, type, rid, res));
+	case SYS_RES_IOPORT:
+	case SYS_RES_MEMORY:
+		return (bus_generic_rman_release_resource(dev, child, type, rid,
+		    res));
+	default:
+		return (bus_generic_release_resource(dev, child, type, rid,
+		    res));
+	}
 }
 
 static struct pcie_range *



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402160156.41G1uanE006452>