svn commit: r260314 - projects/altix2/sys/ia64/sgisn
Marcel Moolenaar
marcel at FreeBSD.org
Sun Jan 5 02:00:06 UTC 2014
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)
More information about the svn-src-projects
mailing list