From owner-svn-src-all@FreeBSD.ORG Tue Mar 10 13:13:46 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B2A4106566B; Tue, 10 Mar 2009 13:13:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 1B5158FC1D; Tue, 10 Mar 2009 13:13:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id 88F6D46B58; Tue, 10 Mar 2009 09:13:45 -0400 (EDT) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n2ADDdl1026220; Tue, 10 Mar 2009 09:13:39 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Warner Losh Date: Tue, 10 Mar 2009 09:04:38 -0400 User-Agent: KMail/1.9.7 References: <200903101210.n2ACApQ0061838@svn.freebsd.org> In-Reply-To: <200903101210.n2ACApQ0061838@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903100904.38679.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Tue, 10 Mar 2009 09:13:39 -0400 (EDT) X-Virus-Scanned: ClamAV 0.94.2/9084/Tue Mar 10 03:11:13 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r189619 - head/sys/dev/cardbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Mar 2009 13:13:46 -0000 On Tuesday 10 March 2009 8:10:50 am Warner Losh wrote: > Author: imp > Date: Tue Mar 10 12:10:50 2009 > New Revision: 189619 > URL: http://svn.freebsd.org/changeset/base/189619 > > Log: > When freeing all the resources of the card, it is better to turn off > the PORTEN and MEMEN bits in the command register than to zero the > bars. > > Modified: > head/sys/dev/cardbus/cardbus.c > > Modified: head/sys/dev/cardbus/cardbus.c > ============================================================================== > --- head/sys/dev/cardbus/cardbus.c Tue Mar 10 11:46:41 2009 (r189618) > +++ head/sys/dev/cardbus/cardbus.c Tue Mar 10 12:10:50 2009 (r189619) > @@ -287,6 +289,7 @@ static void > cardbus_release_all_resources(device_t cbdev, struct cardbus_devinfo *dinfo) > { > struct resource_list_entry *rle; > + device_t dev; > > /* Free all allocated resources */ > STAILQ_FOREACH(rle, &dinfo->pci.resources, link) { > @@ -294,15 +297,14 @@ cardbus_release_all_resources(device_t c > BUS_RELEASE_RESOURCE(device_get_parent(cbdev), > cbdev, rle->type, rle->rid, rle->res); > rle->res = NULL; > - /* > - * zero out config so the card won't acknowledge > - * access to the space anymore. XXX doesn't handle > - * 64-bit bars. > - */ > - pci_write_config(dinfo->pci.cfg.dev, rle->rid, 0, 4); > } > } > resource_list_free(&dinfo->pci.resources); > + /* turn off the card's decoding now that the resources are done */ > + dev = dinfo->pci.cfg.dev; > + pci_write_config(dev, PCIR_COMMAND, > + pci_read_config(dev, PCIR_COMMAND, 2) & > + ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN), 2); > } It might be best to do this before releasing the resources rather than afterwards. -- John Baldwin