From ce3853023fa4b55c09720d55e4dcb93561f9c33c Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Sat, 23 Jan 2010 21:33:33 +0000 Subject: [PATCH] Fix breakage introduced to the tnt4882 driver in r202870. This PCI frontend uses the same uPD7210 backend as the pcii ISA frontend, so the backend has to cope with both situations. Also, hide the first printf in pcii_probe (address mismatch) behind bootverbose as the ISA bus parent tries to probe all configured ISA devices against each driver, so a the console has been cluttered with this message for a bunch of unrelated driver probes. MFC after: 3 days --- sys/dev/ieee488/pcii.c | 8 +++++--- sys/dev/ieee488/tnt4882.c | 3 +++ sys/dev/ieee488/upd7210.c | 7 ++++--- sys/dev/ieee488/upd7210.h | 1 + 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/sys/dev/ieee488/pcii.c b/sys/dev/ieee488/pcii.c index fdff61ea0da8..7e924328ba67 100644 --- a/sys/dev/ieee488/pcii.c +++ b/sys/dev/ieee488/pcii.c @@ -138,9 +138,10 @@ pcii_probe(device_t dev) * 1989 Edition, National Instruments.) */ if ((start & 0x3ff) != 0x2e1) { - printf("pcii_probe: PCIIA base address 0x%lx not " - "0x2e1/0x22e1/0x42e1/0x62e1\n", - start); + if (bootverbose) + printf("pcii_probe: PCIIA base address 0x%lx not " + "0x2e1/0x22e1/0x42e1/0x62e1\n", + start); return (ENXIO); } @@ -234,6 +235,7 @@ pcii_attach(device_t dev) for (rid = 0; rid < 8; rid++) { sc->upd7210.reg_res[rid] = sc->res[2 + rid]; + sc->upd7210.reg_offset[rid] = 0; } sc->upd7210.irq_clear_res = sc->res[10]; diff --git a/sys/dev/ieee488/tnt4882.c b/sys/dev/ieee488/tnt4882.c index 1f21731809c7..a4222a671eb0 100644 --- a/sys/dev/ieee488/tnt4882.c +++ b/sys/dev/ieee488/tnt4882.c @@ -309,6 +309,9 @@ tnt_attach(device_t dev) /* No DMA help */ sc->upd7210.dmachan = -1; + /* No "special interrupt handling" needed here. */ + sc->upd7210.irq_clear_res = NULL; + upd7210attach(&sc->upd7210); return (0); diff --git a/sys/dev/ieee488/upd7210.c b/sys/dev/ieee488/upd7210.c index 2c63f2f1534f..b245a650a910 100644 --- a/sys/dev/ieee488/upd7210.c +++ b/sys/dev/ieee488/upd7210.c @@ -72,7 +72,7 @@ upd7210_rd(struct upd7210 *u, enum upd7210_rreg reg) { u_int r; - r = bus_read_1(u->reg_res[reg], 0); + r = bus_read_1(u->reg_res[reg], u->reg_offset[reg]); u->rreg[reg] = r; return (r); } @@ -81,7 +81,7 @@ void upd7210_wr(struct upd7210 *u, enum upd7210_wreg reg, u_int val) { - bus_write_1(u->reg_res[reg], 0, val); + bus_write_1(u->reg_res[reg], u->reg_offset[reg], val); u->wreg[reg] = val; if (reg == AUXMR) u->wreg[8 + (val >> 5)] = val & 0x1f; @@ -125,7 +125,8 @@ upd7210intr(void *arg) * Some clones apparently don't implement this * feature, but National Instrument cards do. */ - bus_write_1(u->irq_clear_res, 0, 42); + if (u->irq_clear_res != NULL) + bus_write_1(u->irq_clear_res, 0, 42); } mtx_unlock(&u->mutex); } diff --git a/sys/dev/ieee488/upd7210.h b/sys/dev/ieee488/upd7210.h index fccb13e38db4..9d619b789311 100644 --- a/sys/dev/ieee488/upd7210.h +++ b/sys/dev/ieee488/upd7210.h @@ -50,6 +50,7 @@ typedef int upd7210_irq_t(struct upd7210 *, int); struct upd7210 { struct resource *reg_res[8]; struct resource *irq_clear_res; + u_int reg_offset[8]; int dmachan; int unit;