Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Feb 2025 14:16:32 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: d65f66c98337 - stable/14 - hyperv vmbus_pcib: Use pci_domain_*_bus for PCI_RES_BUS resources
Message-ID:  <202502271416.51REGW0o015649@gitrepo.freebsd.org>

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

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

commit d65f66c983376223b2a832e0cae71b7ec4dd38d5
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-01-23 17:35:58 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-02-27 13:09:20 +0000

    hyperv vmbus_pcib: Use pci_domain_*_bus for PCI_RES_BUS resources
    
    Specifically for bus_activate/adjust/deactivate_bus methods.
    
    Differential Revision:  https://reviews.freebsd.org/D43431
    
    (cherry picked from commit 9c4effb1063d49748b4b7da4cc54f508ccad41fc)
---
 sys/dev/hyperv/pcib/vmbus_pcib.c | 41 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)

diff --git a/sys/dev/hyperv/pcib/vmbus_pcib.c b/sys/dev/hyperv/pcib/vmbus_pcib.c
index be66393a7ab4..03fc5f09be6c 100644
--- a/sys/dev/hyperv/pcib/vmbus_pcib.c
+++ b/sys/dev/hyperv/pcib/vmbus_pcib.c
@@ -1712,6 +1712,18 @@ vmbus_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
 	return (res);
 }
 
+static int
+vmbus_pcib_adjust_resource(device_t dev, device_t child, int type,
+    struct resource *r, rman_res_t start, rman_res_t end)
+{
+	struct vmbus_pcib_softc *sc = device_get_softc(dev);
+
+	if (type == PCI_RES_BUS)
+		return (pci_domain_adjust_bus(sc->hbus->pci_domain, child, r,
+		    start, end));
+	return (bus_generic_adjust_resource(dev, child, type, r, start, end));
+}
+
 static int
 vmbus_pcib_release_resource(device_t dev, device_t child, int type, int rid,
     struct resource *r)
@@ -1728,6 +1740,30 @@ vmbus_pcib_release_resource(device_t dev, device_t child, int type, int rid,
 	return (bus_generic_release_resource(dev, child, type, rid, r));
 }
 
+static int
+vmbus_pcib_activate_resource(device_t dev, device_t child, int type, int rid,
+    struct resource *r)
+{
+	struct vmbus_pcib_softc *sc = device_get_softc(dev);
+
+	if (type == PCI_RES_BUS)
+		return (pci_domain_activate_bus(sc->hbus->pci_domain, child,
+		    rid, r));
+	return (bus_generic_activate_resource(dev, child, type, rid, r));
+}
+
+static int
+vmbus_pcib_deactivate_resource(device_t dev, device_t child, int type, int rid,
+    struct resource *r)
+{
+	struct vmbus_pcib_softc *sc = device_get_softc(dev);
+
+	if (type == PCI_RES_BUS)
+		return (pci_domain_deactivate_bus(sc->hbus->pci_domain, child,
+		    rid, r));
+	return (bus_generic_deactivate_resource(dev, child, type, rid, r));
+}
+
 static int
 vmbus_pcib_get_cpus(device_t pcib, device_t dev, enum cpu_sets op,
     size_t setsize, cpuset_t *cpuset)
@@ -1981,9 +2017,10 @@ static device_method_t vmbus_pcib_methods[] = {
 	DEVMETHOD(bus_read_ivar,		vmbus_pcib_read_ivar),
 	DEVMETHOD(bus_write_ivar,		vmbus_pcib_write_ivar),
 	DEVMETHOD(bus_alloc_resource,		vmbus_pcib_alloc_resource),
+	DEVMETHOD(bus_adjust_resource,		vmbus_pcib_adjust_resource),
 	DEVMETHOD(bus_release_resource,		vmbus_pcib_release_resource),
-	DEVMETHOD(bus_activate_resource,   bus_generic_activate_resource),
-	DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
+	DEVMETHOD(bus_activate_resource,   	vmbus_pcib_activate_resource),
+	DEVMETHOD(bus_deactivate_resource, 	vmbus_pcib_deactivate_resource),
 	DEVMETHOD(bus_setup_intr,	   bus_generic_setup_intr),
 	DEVMETHOD(bus_teardown_intr,	   bus_generic_teardown_intr),
 	DEVMETHOD(bus_get_cpus,			vmbus_pcib_get_cpus),



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