From owner-svn-src-all@FreeBSD.ORG Fri May 4 15:38:47 2012 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 C2FC9106566C; Fri, 4 May 2012 15:38:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 928DE8FC20; Fri, 4 May 2012 15:38:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q44FclYY010549; Fri, 4 May 2012 15:38:47 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q44FclqK010547; Fri, 4 May 2012 15:38:47 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201205041538.q44FclqK010547@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 4 May 2012 15:38:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235007 - stable/9/sys/dev/pci 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: Fri, 04 May 2012 15:38:47 -0000 Author: hselasky Date: Fri May 4 15:38:47 2012 New Revision: 235007 URL: http://svn.freebsd.org/changeset/base/235007 Log: MFC r233662, r233677 and r233678: Writing zero to BAR actually does not disable it and it is even harmful as hselasky found out. Historically, this code was originated from (OLDCARD) CardBus driver and later leaked into PCI driver when CardBus was newbus'ified and refactored with PCI driver. However, it is not really necessary even for CardBus. Modified: stable/9/sys/dev/pci/pci.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/pci/pci.c ============================================================================== --- stable/9/sys/dev/pci/pci.c Fri May 4 15:36:51 2012 (r235006) +++ stable/9/sys/dev/pci/pci.c Fri May 4 15:38:47 2012 (r235007) @@ -2746,16 +2746,15 @@ pci_add_map(device_t bus, device_t dev, prefetch ? RF_PREFETCHABLE : 0); if (res == NULL) { /* - * If the allocation fails, clear the BAR and delete - * the resource list entry to force - * pci_alloc_resource() to allocate resources from the - * parent. + * If the allocation fails, delete the resource list entry + * to force pci_alloc_resource() to allocate resources + * from the parent. */ resource_list_delete(rl, type, reg); - start = 0; - } else + } else { start = rman_get_start(res); - pci_write_bar(dev, pm, start); + pci_write_bar(dev, pm, start); + } return (barlen); } @@ -3824,7 +3823,7 @@ pci_describe_device(device_t dev) if ((desc = malloc(strlen(vp) + strlen(dp) + 3, M_DEVBUF, M_NOWAIT)) != NULL) sprintf(desc, "%s, %s", vp, dp); - out: +out: if (vp != NULL) free(vp, M_DEVBUF); if (dp != NULL) @@ -4100,7 +4099,7 @@ pci_reserve_map(device_t dev, device_t c count, *rid, type, rman_get_start(res)); map = rman_get_start(res); pci_write_bar(child, pm, map); -out:; +out: return (res); } @@ -4289,19 +4288,6 @@ pci_delete_resource(device_t dev, device type, rid, rman_get_start(rle->res)); return; } - -#ifndef __PCI_BAR_ZERO_VALID - /* - * If this is a BAR, clear the BAR so it stops - * decoding before releasing the resource. - */ - switch (type) { - case SYS_RES_IOPORT: - case SYS_RES_MEMORY: - pci_write_bar(child, pci_find_bar(child, rid), 0); - break; - } -#endif resource_list_unreserve(rl, dev, child, type, rid); } resource_list_delete(rl, type, rid);