From 92991e8f8d319981c7f9b0ad1fc3855b6dfdfe3a Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Sat, 25 Nov 2023 10:32:19 -0800 Subject: [PATCH] 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 (cherry picked from commit ed88eef140a1c3d57d546f409c216806dd3da809) --- 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 4d21382f2de..040b3556d15 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));