From owner-svn-src-all@FreeBSD.ORG Fri Oct 1 19:02:32 2010 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 1C450106566B; Fri, 1 Oct 2010 19:02:32 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E55CB8FC13; Fri, 1 Oct 2010 19:02:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o91J2VLI014957; Fri, 1 Oct 2010 19:02:31 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o91J2VZk014955; Fri, 1 Oct 2010 19:02:31 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010011902.o91J2VZk014955@svn.freebsd.org> From: Nathan Whitehorn Date: Fri, 1 Oct 2010 19:02:31 +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: r213336 - head/sys/powerpc/ofw 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, 01 Oct 2010 19:02:32 -0000 Author: nwhitehorn Date: Fri Oct 1 19:02:31 2010 New Revision: 213336 URL: http://svn.freebsd.org/changeset/base/213336 Log: Map the Open Firmware framebuffer console with write combining turned on, and set memory attributes appropriately for mmap() calls on /dev/console. Xorg no longer uses /dev/console to mmap the framebuffer, so framebuffer write combining support in X will arrive in the next patch. Modified: head/sys/powerpc/ofw/ofw_syscons.c Modified: head/sys/powerpc/ofw/ofw_syscons.c ============================================================================== --- head/sys/powerpc/ofw/ofw_syscons.c Fri Oct 1 18:59:30 2010 (r213335) +++ head/sys/powerpc/ofw/ofw_syscons.c Fri Oct 1 19:02:31 2010 (r213336) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include @@ -280,7 +281,7 @@ ofwfb_configure(int flags) OF_getprop(node, "address", &fb_phys, sizeof(fb_phys)); bus_space_map(&bs_be_tag, fb_phys, sc->sc_height * sc->sc_stride, - 0, &sc->sc_addr); + BUS_SPACE_MAP_PREFETCHABLE, &sc->sc_addr); /* * Get the PCI addresses of the adapter. The node may be the @@ -632,8 +633,25 @@ ofwfb_mmap(video_adapter_t *adp, vm_ooff sc = (struct ofwfb_softc *)adp; - if (sc->sc_num_pciaddrs == 0) - return (ENOMEM); + /* + * Make sure the requested address lies within the PCI device's + * assigned addrs + */ + for (i = 0; i < sc->sc_num_pciaddrs; i++) + if (offset >= sc->sc_pciaddrs[i].phys_lo && + offset < (sc->sc_pciaddrs[i].phys_lo + sc->sc_pciaddrs[i].size_lo)) + { + /* + * If this is a prefetchable BAR, we can (and should) + * enable write-combining. + */ + if (sc->sc_pciaddrs[i].phys_hi & + OFW_PCI_PHYS_HI_PREFETCHABLE) + *memattr = VM_MEMATTR_WRITE_COMBINING; + + *paddr = offset; + return (0); + } /* * Hack for Radeon... @@ -644,16 +662,6 @@ ofwfb_mmap(video_adapter_t *adp, vm_ooff } /* - * Make sure the requested address lies within the PCI device's assigned addrs - */ - for (i = 0; i < sc->sc_num_pciaddrs; i++) - if (offset >= sc->sc_pciaddrs[i].phys_lo && - offset < (sc->sc_pciaddrs[i].phys_lo + sc->sc_pciaddrs[i].size_lo)) { - *paddr = offset; - return (0); - } - - /* * This might be a legacy VGA mem request: if so, just point it at the * framebuffer, since it shouldn't be touched */ @@ -662,6 +670,12 @@ ofwfb_mmap(video_adapter_t *adp, vm_ooff return (0); } + /* + * Error if we didn't have a better idea. + */ + if (sc->sc_num_pciaddrs == 0) + return (ENOMEM); + return (EINVAL); }