summaryrefslogtreecommitdiffstats
path: root/sys/dev/ppbus
diff options
context:
space:
mode:
authorn_hibma <n_hibma@FreeBSD.org>2000-05-07 20:46:49 +0000
committern_hibma <n_hibma@FreeBSD.org>2000-05-07 20:46:49 +0000
commit75d4fd98068b71eee0e5f685a96d5f964d6c79f7 (patch)
tree4803fab399f2de1ee982ae584f7b4c2007cc55e5 /sys/dev/ppbus
parentc5cb9b7f77ae483646529350284c050ea7b481aa (diff)
downloadFreeBSD-src-75d4fd98068b71eee0e5f685a96d5f964d6c79f7.zip
FreeBSD-src-75d4fd98068b71eee0e5f685a96d5f964d6c79f7.tar.gz
If PERIPH_1284 is not defined, don't even bother calling the BUS_*_INTR
functions. If it is defined, check whether bus_alloc_resource has succeeded. If it hasn't, it is in polled mode. Mike Nowlin reports that this change makes the geek port (whatever _that_ is :-) work again on his machine. Submitted by: Mike Nowlin <mike@argos.org>
Diffstat (limited to 'sys/dev/ppbus')
-rw-r--r--sys/dev/ppbus/ppi.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/dev/ppbus/ppi.c b/sys/dev/ppbus/ppi.c
index 971d317..62c4e32 100644
--- a/sys/dev/ppbus/ppi.c
+++ b/sys/dev/ppbus/ppi.c
@@ -68,8 +68,10 @@ struct ppi_data {
int ppi_mode; /* IEEE1284 mode */
char ppi_buffer[BUFSIZE];
+#ifdef PERIPH_1284
struct resource *intr_resource; /* interrupt resource */
void *intr_cookie; /* interrupt registration cookie */
+#endif /* PERIPH_1284 */
};
#define DEVTOSOFTC(dev) \
@@ -163,20 +165,20 @@ ppi_probe(device_t dev)
static int
ppi_attach(device_t dev)
{
+#ifdef PERIPH_1284
uintptr_t irq;
int zero = 0;
+#endif /* PERIPH_1284 */
struct ppi_data *ppi = DEVTOSOFTC(dev);
+#ifdef PERIPH_1284
/* retrive the irq */
BUS_READ_IVAR(device_get_parent(dev), dev, PPBUS_IVAR_IRQ, &irq);
/* declare our interrupt handler */
ppi->intr_resource = bus_alloc_resource(dev, SYS_RES_IRQ,
&zero, irq, irq, 1, RF_ACTIVE);
- if (ppi->intr_resource == NULL) {
- device_printf(dev, "can't allocate irq\n");
- return (ENOMEM);
- }
+#endif /* PERIPH_1284 */
make_dev(&ppi_cdevsw, device_get_unit(dev), /* XXX cleanup */
UID_ROOT, GID_WHEEL,
@@ -185,6 +187,7 @@ ppi_attach(device_t dev)
return (0);
}
+#ifdef PERIPH_1284
/*
* Cable
* -----
@@ -200,7 +203,6 @@ ppi_attach(device_t dev)
static void
ppiintr(void *arg)
{
-#ifdef PERIPH_1284
device_t ppidev = (device_t)arg;
device_t ppbus = device_get_parent(ppidev);
struct ppi_data *ppi = DEVTOSOFTC(ppidev);
@@ -251,10 +253,10 @@ ppiintr(void *arg)
}
ppi_enable_intr(ppidev);
-#endif /* PERIPH_1284 */
return;
}
+#endif /* PERIPH_1284 */
static int
ppiopen(dev_t dev, int flags, int fmt, struct proc *p)
@@ -276,9 +278,13 @@ ppiopen(dev_t dev, int flags, int fmt, struct proc *p)
ppi->ppi_flags |= HAVE_PPBUS;
- /* register our interrupt handler */
- BUS_SETUP_INTR(device_get_parent(ppidev), ppidev, ppi->intr_resource,
- INTR_TYPE_TTY, ppiintr, dev, &ppi->intr_cookie);
+#ifdef PERIPH_1284
+ if (ppi->intr_resource) {
+ /* register our interrupt handler */
+ BUS_SETUP_INTR(device_get_parent(ppidev), ppidev, ppi->intr_resource,
+ INTR_TYPE_TTY, ppiintr, dev, &ppi->intr_cookie);
+ }
+#endif /* PERIPH_1284 */
}
ppi->ppi_count += 1;
OpenPOWER on IntegriCloud