From owner-svn-src-head@FreeBSD.ORG Mon Feb 6 17:07:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C646E1065672; Mon, 6 Feb 2012 17:07:24 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from adsum.doit.wisc.edu (adsum.doit.wisc.edu [144.92.197.210]) by mx1.freebsd.org (Postfix) with ESMTP id 946638FC08; Mon, 6 Feb 2012 17:07:24 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth1.wiscmail.wisc.edu by smtpauth1.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0LYZ0021SE8BI100@smtpauth1.wiscmail.wisc.edu>; Mon, 06 Feb 2012 11:07:24 -0600 (CST) Received: from comporellon.tachypleus.net (adsl-76-208-68-223.dsl.mdsnwi.sbcglobal.net [76.208.68.223]) by smtpauth1.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0LYZ00C08E866Y30@smtpauth1.wiscmail.wisc.edu>; Mon, 06 Feb 2012 11:07:19 -0600 (CST) Date: Mon, 06 Feb 2012 11:07:17 -0600 From: Nathan Whitehorn In-reply-to: <201202061106.59098.jhb@freebsd.org> To: John Baldwin Message-id: <4F3008C5.8020104@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=76.208.68.223 X-Spam-PmxInfo: Server=avs-13, Version=5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.2.6.170027, SenderIP=76.208.68.223 References: <201202051654.q15GsQcc092137@svn.freebsd.org> <201202060753.43627.jhb@freebsd.org> <4F2FF486.5090507@freebsd.org> <201202061106.59098.jhb@freebsd.org> User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20120107 Thunderbird/9.0 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r231026 - head/sys/powerpc/ofw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Feb 2012 17:07:25 -0000 On 02/06/12 10:06, John Baldwin wrote: > On Monday, February 06, 2012 10:40:54 am Nathan Whitehorn wrote: >> On 02/06/12 06:53, John Baldwin wrote: >>> On Sunday, February 05, 2012 11:54:26 am Nathan Whitehorn wrote: >>>> Author: nwhitehorn >>>> Date: Sun Feb 5 16:54:26 2012 >>>> New Revision: 231026 >>>> URL: http://svn.freebsd.org/changeset/base/231026 >>>> >>>> Log: >>>> Make sure to remap adjusted resources. >>> Hmm, I had considered remapping adjusted resources an invalid operation (i.e. >>> should fail with EINVAL). I believe that the NEW_PCIB code should only apply >>> this API to resources backing the resource windows in PCI-PCI bridges and that >>> those resources should never have RF_ACTIVE set. Are you seeing calls of it >>> for active resources? >>> >> No, I was just trying to be safe here, since it wasn't clear that that >> was invalid. I'm happy to replace the contents of the if with return >> EINVAL or something. > Yeah, I would do that, perhaps with a KASSERT() as well so it panics in HEAD. > How does this look? I've kept both the EINVAL and the KASSERT. -Nathan Index: ofw_pci.c =================================================================== --- ofw_pci.c (revision 231026) +++ ofw_pci.c (working copy) @@ -431,8 +431,12 @@ { 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: rm = &sc->sc_mem_rman; @@ -447,21 +451,7 @@ 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)); }