From owner-svn-src-projects@FreeBSD.ORG Tue Nov 5 05:02:09 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3D4CFAFB; Tue, 5 Nov 2013 05:02:09 +0000 (UTC) (envelope-from marcel@FreeBSD.org) 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 2B3C12B93; Tue, 5 Nov 2013 05:02:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA5529jZ006247; Tue, 5 Nov 2013 05:02:09 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA5528iF006245; Tue, 5 Nov 2013 05:02:08 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201311050502.rA5528iF006245@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 5 Nov 2013 05:02:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r257677 - projects/altix2/sys/ia64/sgisn X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Nov 2013 05:02:09 -0000 Author: marcel Date: Tue Nov 5 05:02:08 2013 New Revision: 257677 URL: http://svnweb.freebsd.org/changeset/base/257677 Log: Implement SHub2 & TIOCP bridge address translations. With this change, mpt(4) seems to work. Modified: projects/altix2/sys/ia64/sgisn/sgisn_pcib.c projects/altix2/sys/ia64/sgisn/sgisn_shub.c Modified: projects/altix2/sys/ia64/sgisn/sgisn_pcib.c ============================================================================== --- projects/altix2/sys/ia64/sgisn/sgisn_pcib.c Tue Nov 5 05:01:46 2013 (r257676) +++ projects/altix2/sys/ia64/sgisn/sgisn_pcib.c Tue Nov 5 05:02:08 2013 (r257677) @@ -637,7 +637,7 @@ sgisn_pcib_iommu_map(device_t bus, devic struct sgisn_pcib_softc *sc = device_get_softc(bus); busdma_tag_t tag; bus_addr_t maxaddr = 0x80000000UL; - bus_addr_t ba, size; + bus_addr_t addr, ba, size; uint64_t bits; u_int ate, bitshft, count, entry, flags; @@ -645,15 +645,24 @@ sgisn_pcib_iommu_map(device_t bus, devic flags = busdma_md_get_flags(md); if ((flags & BUSDMA_MD_IA64_DIRECT32) && ba < maxaddr) { - *ba_p = ba | maxaddr; + addr = ba | maxaddr; + *ba_p = addr; return (0); } tag = busdma_md_get_tag(md); maxaddr = busdma_tag_get_maxaddr(tag); if (maxaddr == BUS_SPACE_MAXADDR) { - *ba_p = ba | ((u_long)sc->sc_fwbus->fw_hub_xid << 60) | - (1UL << ((flags & BUSDMA_ALLOC_CONSISTENT) ? 56 : 59)); + addr = ba; + if (flags & BUSDMA_ALLOC_CONSISTENT) + addr |= 1UL << 56; /* bar */ + if ((sc->sc_fwbus->fw_mode & 1) == 0) + addr |= 1UL << 59; /* prefetch */ + if (sc->sc_fwbus->fw_common.bus_asic == SGISN_PCIB_PIC) + addr |= (u_long)sc->sc_fwbus->fw_hub_xid << 60; + else + addr |= 1UL << 60; /* memory */ + *ba_p = addr; return (0); } @@ -732,9 +741,13 @@ sgisn_pcib_iommu_map(device_t bus, devic (SGISN_PCIB_PAGE_SIZE * entry); ba &= ~SGISN_PCIB_PAGE_MASK; - ba |= 1 << 0; /* valid */ - ba |= 1 << ((flags & BUSDMA_ALLOC_CONSISTENT) ? 4 : 3); - ba |= (u_long)sc->sc_fwbus->fw_hub_xid << 8; + ba |= 1 << 0; /* valid */ + if ((sc->sc_fwbus->fw_mode & 1) == 0) + ba |= 1 << 3; /* prefetch */ + if (flags & BUSDMA_ALLOC_CONSISTENT) + ba |= 1 << 4; /* bar */ + if (sc->sc_fwbus->fw_common.bus_asic == SGISN_PCIB_PIC) + ba |= (u_long)sc->sc_fwbus->fw_hub_xid << 8; while (count > 0) { bus_space_write_8(sc->sc_tag, sc->sc_hndl, PCIB_REG_ATE(entry), ba); Modified: projects/altix2/sys/ia64/sgisn/sgisn_shub.c ============================================================================== --- projects/altix2/sys/ia64/sgisn/sgisn_shub.c Tue Nov 5 05:01:46 2013 (r257676) +++ projects/altix2/sys/ia64/sgisn/sgisn_shub.c Tue Nov 5 05:02:08 2013 (r257677) @@ -557,7 +557,7 @@ sgisn_shub_iommu_map(device_t bus, devic bus_addr_t *ba_p) { struct sgisn_shub_softc *sc; - bus_addr_t ba, mask; + bus_addr_t addr, ba, mask; u_int flags; sc = device_get_softc(bus); @@ -579,8 +579,17 @@ sgisn_shub_iommu_map(device_t bus, devic * For all other memory addresses, map to a fully qualified bus * address. */ - mask = (1UL << (sc->sc_nasid_shft - 2)) - 1; - *ba_p = ((ba >> 2) & ~mask) | (ba & mask); + if (sc->sc_hubtype == 0) { + /* XXX assumes a PIC bridge. */ + mask = (1UL << (sc->sc_nasid_shft - 2)) - 1; + addr = ((ba >> 2) & ~mask) | (ba & mask); + } else { + /* XXX assumes TIOCP bridge. */ + addr = (ba >> sc->sc_nasid_shft) << 40; + addr |= ((ba >> (sc->sc_nasid_shft - 4)) & 0x3UL) << 36; + addr |= ba & ((1UL << (sc->sc_nasid_shft - 4)) - 1); + } + *ba_p = addr; return (0); }