From owner-svn-src-all@FreeBSD.ORG Thu Mar 5 15:28: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 EAB1B106564A; Thu, 5 Mar 2009 15:28:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D93188FC0C; Thu, 5 Mar 2009 15:28:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n25FSksO084891; Thu, 5 Mar 2009 15:28:46 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n25FSkrJ084890; Thu, 5 Mar 2009 15:28:46 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903051528.n25FSkrJ084890@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Mar 2009 15:28:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189400 - head/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: Thu, 05 Mar 2009 15:28:47 -0000 Author: jhb Date: Thu Mar 5 15:28:46 2009 New Revision: 189400 URL: http://svn.freebsd.org/changeset/base/189400 Log: Honor the prefetchable flag in memory BARs by setting the RF_PREFETCHABLE flag when calling bus_alloc_resource() to allocate resources from a parent PCI bridge. For PCI-PCI bridges this asks the bridge to satisfy the request using the prefetchable memory range rather than the normal memory range. Reviewed by: imp Reported by: scottl MFC after: 1 week Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Thu Mar 5 12:04:42 2009 (r189399) +++ head/sys/dev/pci/pci.c Thu Mar 5 15:28:46 2009 (r189400) @@ -2313,9 +2313,11 @@ pci_add_map(device_t pcib, device_t bus, PCIB_WRITE_CONFIG(pcib, b, s, f, reg, map, 4); PCIB_WRITE_CONFIG(pcib, b, s, f, PCIR_COMMAND, cmd, 2); - if (PCI_BAR_MEM(map)) + if (PCI_BAR_MEM(map)) { type = SYS_RES_MEMORY; - else + if (map & PCIM_BAR_MEM_PREFETCH) + prefetch = 1; + } else type = SYS_RES_IOPORT; ln2size = pci_mapsize(testval); ln2range = pci_maprange(testval); @@ -3488,6 +3490,8 @@ pci_alloc_map(device_t dev, device_t chi count = 1UL << mapsize; if (RF_ALIGNMENT(flags) < mapsize) flags = (flags & ~RF_ALIGNMENT_MASK) | RF_ALIGNMENT_LOG2(mapsize); + if (PCI_BAR_MEM(testval) && (testval & PCIM_BAR_MEM_PREFETCH)) + flags |= RF_PREFETCHABLE; /* * Allocate enough resource, and then write back the