Date: Tue, 7 Feb 2012 19:14:13 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r231149 - head/sys/powerpc/ofw Message-ID: <201202071914.q17JEDBK003449@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Tue Feb 7 19:14:13 2012 New Revision: 231149 URL: http://svn.freebsd.org/changeset/base/231149 Log: 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 Modified: head/sys/powerpc/ofw/ofw_pci.c Modified: head/sys/powerpc/ofw/ofw_pci.c ============================================================================== --- head/sys/powerpc/ofw/ofw_pci.c Tue Feb 7 19:13:47 2012 (r231148) +++ head/sys/powerpc/ofw/ofw_pci.c Tue Feb 7 19:14:13 2012 (r231149) @@ -431,7 +431,11 @@ ofw_pci_adjust_resource(device_t bus, de { 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, de 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)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202071914.q17JEDBK003449>