PERFORCE change 152854 for review
Oleksandr Tymoshenko
gonzo at FreeBSD.org
Tue Nov 11 22:46:40 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=152854
Change 152854 by gonzo at gonzo_jeeves on 2008/11/12 06:46:12
- Move some info bits printed in verbose mode from siba.c to siba_cc.c
- Improve resource handling for ChipCommon driver
- Print selected info about ChipCommon capabilities
Affected files ...
.. //depot/projects/mips2/src/sys/dev/siba/siba.c#8 edit
.. //depot/projects/mips2/src/sys/dev/siba/siba_cc.c#5 edit
Differences ...
==== //depot/projects/mips2/src/sys/dev/siba/siba.c#8 (text+ko) ====
@@ -219,7 +219,6 @@
if (siba_debug) {
device_printf(dev, "idlo = %08x\n", idlo);
device_printf(dev, "idhi = %08x\n", idhi);
- device_printf(dev, " chipcore id = %08x\n", ccid);
}
/*
@@ -259,11 +258,6 @@
ccidreg = siba_read_4(sc, 0, SIBA_CC_CCID);
cc_id = (ccidreg & SIBA_CC_IDMASK);
cc_rev = (ccidreg & SIBA_CC_REVMASK) >> SIBA_CC_REVSHIFT;
- if (siba_debug) {
- device_printf(dev, "ccid = %08x, cc_id = %04x, cc_rev = %04x\n",
- ccidreg, cc_id, cc_rev);
- }
-
sc->sc_ncores = siba_getncores(cc_id);
if (siba_debug) {
device_printf(dev, "%d cores detected.\n", sc->sc_ncores);
==== //depot/projects/mips2/src/sys/dev/siba/siba_cc.c#5 (text+ko) ====
@@ -77,15 +77,15 @@
}
struct siba_cc_softc {
- void *notused;
+ struct resource *sc_mem; /* Memory window on siba0 */
+ struct resource *sc_irq;
};
static int
siba_cc_attach(device_t dev)
{
- //struct siba_cc_softc *sc = device_get_softc(dev);
- struct resource *mem;
- struct resource *irq;
+ struct siba_cc_softc *sc = device_get_softc(dev);
+ uint32_t cc_caps, cc_id;
int rid;
/*
@@ -95,15 +95,16 @@
*/
#define MIPS_MEM_RID 0x20
rid = MIPS_MEM_RID;
- mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
- if (mem == NULL) {
+ sc->sc_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
+ RF_ACTIVE);
+ if (sc->sc_mem == NULL) {
device_printf(dev, "unable to allocate memory\n");
return (ENXIO);
}
rid = 0;
- irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, 0);
- if (irq == NULL) {
+ sc->sc_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, 0);
+ if (sc->sc_irq == NULL) {
device_printf(dev, "unable to allocate irq\n");
return (ENXIO);
}
@@ -118,13 +119,29 @@
*/
int err;
void *cookie;
- err = bus_setup_intr(dev, irq, INTR_TYPE_TTY, NULL, siba_cc_intr, NULL,
- &cookie);
+ err = bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_TTY, NULL,
+ siba_cc_intr, NULL, &cookie);
if (err != 0) {
device_printf(dev, "unable to setup intr\n");
return (ENXIO);
}
+ if (bootverbose) {
+ cc_id = bus_read_4(sc->sc_mem, SIBA_CC_CCID);
+ cc_caps = bus_read_4(sc->sc_mem, SIBA_CC_CAPABILITIES);
+ device_printf(dev, "ChipCommon (id 0x%02x, rev. %d):\n",
+ (cc_id & SIBA_CC_IDMASK),
+ ((cc_id & SIBA_CC_REVMASK) >> SIBA_CC_REVSHIFT));
+ device_printf(dev, " # of UARTS : %d\n",
+ (cc_caps & SIBA_CC_CAP_UARTN_MASK));
+ device_printf(dev, " MIPS BigEndian : %s\n",
+ (cc_caps & SIBA_CC_CAP_MIPS_BE_MASK) ? "yes" : "no");
+ device_printf(dev, " External buses : %s\n",
+ (cc_caps & SIBA_CC_CAP_EXT_BUS_MASK) ? "yes" : "no");
+ device_printf(dev, " JTAG present : %s\n",
+ (cc_caps & SIBA_CC_CAP_JTAG_MASK) ? "yes" : "no");
+ }
+
/* TODO: attach uart child */
return (0);
More information about the p4-projects
mailing list