git: ed88eef140a1 - main - new-bus: Disable assertions for rman mismatches for activate/deactivate

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Sat, 25 Nov 2023 18:39:39 UTC
The branch main has been updated by jhb:

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

commit ed88eef140a1c3d57d546f409c216806dd3da809
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-11-25 18:32:19 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-11-25 18:32:19 +0000

    new-bus: Disable assertions for rman mismatches for activate/deactivate
    
    Bus drivers which use an rman to sub-divide a resource allocated from
    a parent bus should handle mapping requests (and activate/deactivate
    requests) for those sub-allocated resources by doing a subset mapping
    of the resource allocated from the parent (and then using this to
    handle activate/deactivate requests).
    
    However, not all bus drivers which use internal rmans (such as acpi(4)
    and pci_pci(4)) do that since not all nexus drivers support
    bus_map/unmap.  Eventually bus drivers should be updated to do this
    properly at which point these assertions can be reenabled.
    
    Reported by:    delphij, kib
---
 sys/kern/subr_bus.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 8da99e158f1c..4f7053cc2613 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -4305,12 +4305,12 @@ bus_generic_rman_activate_resource(device_t dev, device_t child, int type,
     int rid, struct resource *r)
 {
 	struct resource_map map;
-#ifdef INVARIANTS
+#ifdef INVARIANTS_XXX
 	struct rman *rm;
 #endif
 	int error;
 
-#ifdef INVARIANTS
+#ifdef INVARIANTS_XXX
 	rm = BUS_GET_RMAN(dev, type, rman_get_flags(r));
 	KASSERT(rman_is_region_manager(r, rm),
 	    ("%s: rman %p doesn't match for resource %p", __func__, rm, r));
@@ -4344,12 +4344,12 @@ bus_generic_rman_deactivate_resource(device_t dev, device_t child, int type,
     int rid, struct resource *r)
 {
 	struct resource_map map;
-#ifdef INVARIANTS
+#ifdef INVARIANTS_XXX
 	struct rman *rm;
 #endif
 	int error;
 
-#ifdef INVARIANTS
+#ifdef INVARIANTS_XXX
 	rm = BUS_GET_RMAN(dev, type, rman_get_flags(r));
 	KASSERT(rman_is_region_manager(r, rm),
 	    ("%s: rman %p doesn't match for resource %p", __func__, rm, r));