From owner-svn-src-all@FreeBSD.ORG Wed Feb 19 18:35:22 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EE2AD8AE; Wed, 19 Feb 2014 18:35:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BFCA915B4; Wed, 19 Feb 2014 18:35:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1JIZM5S004836; Wed, 19 Feb 2014 18:35:22 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1JIZMRo004835; Wed, 19 Feb 2014 18:35:22 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201402191835.s1JIZMRo004835@svn.freebsd.org> From: John Baldwin Date: Wed, 19 Feb 2014 18:35:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r262226 - stable/8/sys/dev/pci X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 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: Wed, 19 Feb 2014 18:35:23 -0000 Author: jhb Date: Wed Feb 19 18:35:22 2014 New Revision: 262226 URL: http://svnweb.freebsd.org/changeset/base/262226 Log: MFC 261524: Properly set the alignment flags when allocating the initial range for a BAR. This only really matters when pci_do_realloc_bars is enabled and the initial allocation of a specific range fails. Modified: stable/8/sys/dev/pci/pci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/pci/ (props changed) Modified: stable/8/sys/dev/pci/pci.c ============================================================================== --- stable/8/sys/dev/pci/pci.c Wed Feb 19 18:34:47 2014 (r262225) +++ stable/8/sys/dev/pci/pci.c Wed Feb 19 18:35:22 2014 (r262226) @@ -2637,7 +2637,7 @@ pci_add_map(device_t bus, device_t dev, struct pci_map *pm; pci_addr_t base, map, testval; pci_addr_t start, end, count; - int barlen, basezero, maprange, mapsize, type; + int barlen, basezero, flags, maprange, mapsize, type; uint16_t cmd; struct resource *res; @@ -2743,6 +2743,9 @@ pci_add_map(device_t bus, device_t dev, } count = (pci_addr_t)1 << mapsize; + flags = RF_ALIGNMENT_LOG2(mapsize); + if (prefetch) + flags |= RF_PREFETCHABLE; if (basezero || base == pci_mapbase(testval)) { start = 0; /* Let the parent decide. */ end = ~0ul; @@ -2759,7 +2762,7 @@ pci_add_map(device_t bus, device_t dev, * pci_alloc_resource(). */ res = resource_list_alloc(rl, bus, dev, type, ®, start, end, count, - prefetch ? RF_PREFETCHABLE : 0); + flags); if (pci_do_realloc_bars && res == NULL && (start != 0 || end != ~0ul)) { /* * If the allocation fails, try to allocate a resource for @@ -2770,7 +2773,7 @@ pci_add_map(device_t bus, device_t dev, resource_list_delete(rl, type, reg); resource_list_add(rl, type, reg, 0, ~0ul, count); res = resource_list_alloc(rl, bus, dev, type, ®, 0, ~0ul, - count, prefetch ? RF_PREFETCHABLE : 0); + count, flags); } if (res == NULL) { /*