From owner-svn-src-projects@FreeBSD.ORG Sun Jan 5 02:00:06 2014 Return-Path: Delivered-To: svn-src-projects@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 5063C512; Sun, 5 Jan 2014 02:00:06 +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 235971519; Sun, 5 Jan 2014 02:00:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s05206TC018706; Sun, 5 Jan 2014 02:00:06 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s05205Pk018705; Sun, 5 Jan 2014 02:00:05 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201401050200.s05205Pk018705@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 5 Jan 2014 02:00:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r260314 - 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.17 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: Sun, 05 Jan 2014 02:00:06 -0000 Author: marcel Date: Sun Jan 5 02:00:05 2014 New Revision: 260314 URL: http://svnweb.freebsd.org/changeset/base/260314 Log: Eliminate the global shub_dev variable and instead obtain the device_t of the SHub to which the CPU is connected by using the nasid of the SHub from the PCPU structure. This way, we always communicate with our local SHub, as is required. For this to work, the nasid must correspind to the unit number of the SHub device driver instance. Assert that this is indeed the case. Modified: projects/altix2/sys/ia64/sgisn/sgisn_shub.c Modified: projects/altix2/sys/ia64/sgisn/sgisn_shub.c ============================================================================== --- projects/altix2/sys/ia64/sgisn/sgisn_shub.c Sun Jan 5 01:07:14 2014 (r260313) +++ projects/altix2/sys/ia64/sgisn/sgisn_shub.c Sun Jan 5 02:00:05 2014 (r260314) @@ -128,8 +128,6 @@ static device_method_t sgisn_shub_method static devclass_t sgisn_shub_devclass; static char sgisn_shub_name[] = "shub"; -static device_t shub_dev; - static driver_t sgisn_shub_driver = { sgisn_shub_name, sgisn_shub_methods, @@ -385,9 +383,6 @@ sgisn_shub_attach(device_t dev) sc->sc_dev = dev; sc->sc_domain = device_get_unit(dev); - if (sc->sc_domain == 0) - shub_dev = dev; - /* * Get the physical memory region that is connected to the MD I/F * of this SHub. It allows us to allocate memory that's close to @@ -417,6 +412,10 @@ sgisn_shub_attach(device_t dev) sc->sc_nasid = (sc->sc_membase >> sc->sc_nasid_shft) & sc->sc_nasid_mask; + KASSERT(sc->sc_nasid == (sc->sc_domain << 1), + ("%s: NASID (=%x) doesn't match device unit (=%x)", + __func__, sc->sc_nasid, sc->sc_domain)); + sc->sc_mmraddr = ((vm_paddr_t)sc->sc_nasid << sc->sc_nasid_shft) | (((sc->sc_hubtype == 0) ? 9UL : 3UL) << 32); sc->sc_tag = IA64_BUS_SPACE_MEM; @@ -596,9 +595,10 @@ sgisn_shub_iommu_map(device_t bus, devic void shub_iack(const char *f, u_int xiv) { - struct sgisn_shub_softc *sc = device_get_softc(shub_dev); + struct sgisn_shub_softc *sc; uint64_t ev; + sc = devclass_get_softc(sgisn_shub_devclass, PCPU_GET(md.sgisn_nasid)); ev = bus_space_read_8(sc->sc_tag, sc->sc_hndl, SHUB_MMR_EVENT); ev &= (xiv == 0xe9) ? SHUB_EVENT_CONSOLE : (0x3UL << 33); if (!ev)