From owner-svn-src-stable@FreeBSD.ORG Sun Aug 15 21:46:23 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2C021065672; Sun, 15 Aug 2010 21:46:23 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A6C2A8FC08; Sun, 15 Aug 2010 21:46:23 +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 o7FLkNRx072916; Sun, 15 Aug 2010 21:46:23 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7FLkNGB072914; Sun, 15 Aug 2010 21:46:23 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008152146.o7FLkNGB072914@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 15 Aug 2010 21:46:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211358 - stable/7/sys/dev/ste X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Aug 2010 21:46:24 -0000 Author: yongari Date: Sun Aug 15 21:46:23 2010 New Revision: 211358 URL: http://svn.freebsd.org/changeset/base/211358 Log: MFC r211089: It seems some old Sundace(now IC Plus Corp.) controllers do not like memory mapped register access. Typical problem from the issue was MII access returned unreliable values. I'm not sure this comes from lack of register flushing in MII access after accessing STE_PHYCTL register though. To address the issue, read hints data that controls which type of memory mapping should be used in driver. ste(4) still prefers memory mapping to io mapping but honor hints entered by user except for controllers that have problems with memory mapping. The hint to use iomapping could be given by adding the following line to /boot/device.hints file. hint.ste.0.prefer_iomap="1" PR: kern/149285 Modified: stable/7/sys/dev/ste/if_ste.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ste/if_ste.c ============================================================================== --- stable/7/sys/dev/ste/if_ste.c Sun Aug 15 21:43:51 2010 (r211357) +++ stable/7/sys/dev/ste/if_ste.c Sun Aug 15 21:46:23 2010 (r211358) @@ -1053,7 +1053,7 @@ ste_attach(device_t dev) struct ste_softc *sc; struct ifnet *ifp; uint16_t eaddr[ETHER_ADDR_LEN / 2]; - int error = 0, pmc, rid; + int error = 0, pmc, prefer_iomap, rid; sc = device_get_softc(dev); sc->ste_dev = dev; @@ -1075,12 +1075,25 @@ ste_attach(device_t dev) */ pci_enable_busmaster(dev); - /* Prefer memory space register mapping over IO space. */ - sc->ste_res_id = PCIR_BAR(1); - sc->ste_res_type = SYS_RES_MEMORY; - sc->ste_res = bus_alloc_resource_any(dev, sc->ste_res_type, - &sc->ste_res_id, RF_ACTIVE); - if (sc->ste_res == NULL) { + /* + * Prefer memory space register mapping over IO space but use + * IO space for a device that is known to have issues on memory + * mapping. + */ + prefer_iomap = 0; + if (pci_get_device(dev) == ST_DEVICEID_ST201_1) + prefer_iomap = 1; + else + resource_int_value(device_get_name(sc->ste_dev), + device_get_unit(sc->ste_dev), "prefer_iomap", + &prefer_iomap); + if (prefer_iomap == 0) { + sc->ste_res_id = PCIR_BAR(1); + sc->ste_res_type = SYS_RES_MEMORY; + sc->ste_res = bus_alloc_resource_any(dev, sc->ste_res_type, + &sc->ste_res_id, RF_ACTIVE); + } + if (prefer_iomap || sc->ste_res == NULL) { sc->ste_res_id = PCIR_BAR(0); sc->ste_res_type = SYS_RES_IOPORT; sc->ste_res = bus_alloc_resource_any(dev, sc->ste_res_type,