diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2012-02-07 19:14:13 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2012-02-07 19:14:13 +0000 |
commit | b81e3d3b8f6d65694c34ab99aadc729ded54b290 (patch) | |
tree | c98c7fd1930101364b9b27bd41f4fbd24c17d9c9 /sys/powerpc/ofw | |
parent | e0ebe286fb1dd1b309522abaf8600941a3f1ae41 (diff) | |
download | FreeBSD-src-b81e3d3b8f6d65694c34ab99aadc729ded54b290.zip FreeBSD-src-b81e3d3b8f6d65694c34ab99aadc729ded54b290.tar.gz |
The bus resource adjustment API is not meant to work on active resources.
Return an error if a driver attempts this, and, if INVARIANTS is on,
panic.
Reviewed by: jhb
Diffstat (limited to 'sys/powerpc/ofw')
-rw-r--r-- | sys/powerpc/ofw/ofw_pci.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/sys/powerpc/ofw/ofw_pci.c b/sys/powerpc/ofw/ofw_pci.c index 7580749..46d483d 100644 --- a/sys/powerpc/ofw/ofw_pci.c +++ b/sys/powerpc/ofw/ofw_pci.c @@ -431,7 +431,11 @@ ofw_pci_adjust_resource(device_t bus, device_t child, int type, { struct rman *rm = NULL; struct ofw_pci_softc *sc = device_get_softc(bus); - int error; + + KASSERT(!(rman_get_flags(res) & RF_ACTIVE), + ("active resources cannot be adjusted")); + if (rman_get_flags(res) & RF_ACTIVE) + return (EINVAL); switch (type) { case SYS_RES_MEMORY: @@ -447,21 +451,7 @@ ofw_pci_adjust_resource(device_t bus, device_t child, int type, if (!rman_is_region_manager(res, rm)) return (EINVAL); - error = rman_adjust_resource(res, start, end); - if (error) - return (error); - - if (rman_get_flags(res) & RF_ACTIVE) { - /* Remap memory resources */ - error = ofw_pci_deactivate_resource(bus, child, type, - rman_get_rid(res), res); - if (error) - return (error); - error = ofw_pci_activate_resource(bus, child, type, - rman_get_rid(res), res); - } - - return (error); + return (rman_adjust_resource(res, start, end)); } |