summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/arc/pica/lpt_pica.c45
-rw-r--r--sys/conf/files8
-rw-r--r--sys/dev/ic/lpt.c (renamed from sys/dev/isa/lpt.c)207
-rw-r--r--sys/dev/ic/lptreg.h (renamed from sys/dev/isa/lptreg.h)0
-rw-r--r--sys/dev/ic/lptvar.h78
-rw-r--r--sys/dev/isa/files.isa4
-rw-r--r--sys/dev/isa/lpt_isa.c43
7 files changed, 153 insertions, 232 deletions
diff --git a/sys/arch/arc/pica/lpt_pica.c b/sys/arch/arc/pica/lpt_pica.c
index 9b30ed23c4d..e8edff1e2d8 100644
--- a/sys/arch/arc/pica/lpt_pica.c
+++ b/sys/arch/arc/pica/lpt_pica.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpt_pica.c,v 1.1 1996/11/28 23:35:44 niklas Exp $ */
+/* $OpenBSD: lpt_pica.c,v 1.2 1996/11/30 00:53:39 niklas Exp $ */
/*
* Copyright (c) 1993, 1994 Charles Hannum.
@@ -61,34 +61,8 @@
#include <machine/bus.h>
#include <machine/intr.h>
-#include <dev/isa/lptreg.h>
-
-/* XXX create ic/lptvar.h with this structure and prototypes in it. */
-struct lpt_softc {
- struct device sc_dev;
- void *sc_ih;
-
- size_t sc_count;
- struct buf *sc_inbuf;
- u_char *sc_cp;
- int sc_spinmax;
- int sc_iobase;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- int sc_irq;
- u_char sc_state;
-#define LPT_OPEN 0x01 /* device is open */
-#define LPT_OBUSY 0x02 /* printer is busy doing output */
-#define LPT_INIT 0x04 /* waiting to initialize for open */
- u_char sc_flags;
-#define LPT_AUTOLF 0x20 /* automatic LF on CR */
-#define LPT_NOPRIME 0x40 /* don't prime on open */
-#define LPT_NOINTR 0x80 /* do not use interrupt */
- u_char sc_control;
- u_char sc_laststatus;
-};
-
-int lptintr __P((void *));
+#include <dev/ic/lptreg.h>
+#include <dev/ic/lptvar.h>
int lpt_pica_probe __P((struct device *, void *, void *));
void lpt_pica_attach __P((struct device *, struct device *, void *));
@@ -105,8 +79,8 @@ lpt_pica_probe(parent, match, aux)
struct confargs *ca = aux;
bus_space_tag_t iot;
bus_space_handle_t ioh;
- u_long base;
- u_char mask, data;
+ bus_addr_t base;
+ u_int8_t mask, data;
int i;
#ifdef DEBUG
@@ -124,8 +98,8 @@ lpt_pica_probe(parent, match, aux)
return(0);
iot = 0;
- base = (int)BUS_CVTADDR(ca);
- ioh = base;
+ base = (bus_addr_t)BUS_CVTADDR(ca);
+ ioh = (bus_space_handle_t)base;
mask = 0xff;
@@ -167,12 +141,9 @@ lpt_pica_attach(parent, self, aux)
printf("\n");
- sc->sc_iobase = (int)BUS_CVTADDR(ca);
- sc->sc_irq = 0;
sc->sc_state = 0;
-
iot = sc->sc_iot = 0;
- sc->sc_ioh = sc->sc_iobase;
+ sc->sc_ioh = (bus_space_handle_t)BUS_CVTADDR(ca);
bus_space_write_1(iot, ioh, lpt_control, LPC_NINIT);
diff --git a/sys/conf/files b/sys/conf/files
index 03ca198cec5..5a0ae415d71 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.46 1996/11/28 23:10:28 niklas Exp $
+# $OpenBSD: files,v 1.47 1996/11/30 00:53:34 niklas Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -50,10 +50,14 @@ file dev/ic/elink3.c ep
device le: ether, ifnet
file dev/ic/am7990.c le
-# LANCE and PCnet Ethernet controllers
+# Cyclades Cyclom multiport serial cards
device cy: tty
file dev/ic/cy.c cy & (cy_isa | cy_pci) needs-flag
+# PC parallel ports (XXX what chip?)
+device lpt
+file dev/ic/lpt.c lpt & (lpt_isa | lpt_pica) needs-flag
+
# Attributes which machine-independent bus support can be attached to.
# These should be defined here, because some of these busses can have
# devices which provide these attributes, and we'd like to avoid hairy
diff --git a/sys/dev/isa/lpt.c b/sys/dev/ic/lpt.c
index de0bda2d16b..9dc974779f1 100644
--- a/sys/dev/isa/lpt.c
+++ b/sys/dev/ic/lpt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpt.c,v 1.20 1996/11/29 22:55:04 niklas Exp $ */
+/* $OpenBSD: lpt.c,v 1.1 1996/11/30 00:53:35 niklas Exp $ */
/* $NetBSD: lpt.c,v 1.42 1996/10/21 22:41:14 thorpej Exp $ */
/*
@@ -69,8 +69,8 @@
#include <machine/bus.h>
#include <machine/intr.h>
-#include <dev/isa/isavar.h>
-#include <dev/isa/lptreg.h>
+#include <dev/ic/lptreg.h>
+#include <dev/ic/lptvar.h>
#include "lpt.h"
@@ -87,43 +87,9 @@
int lptdebug = 1;
#endif
-struct lpt_softc {
- struct device sc_dev;
- void *sc_ih;
-
- size_t sc_count;
- struct buf *sc_inbuf;
- u_char *sc_cp;
- int sc_spinmax;
- int sc_iobase;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- int sc_irq;
- u_char sc_state;
-#define LPT_OPEN 0x01 /* device is open */
-#define LPT_OBUSY 0x02 /* printer is busy doing output */
-#define LPT_INIT 0x04 /* waiting to initialize for open */
- u_char sc_flags;
-#define LPT_AUTOLF 0x20 /* automatic LF on CR */
-#define LPT_NOPRIME 0x40 /* don't prime on open */
-#define LPT_NOINTR 0x80 /* do not use interrupt */
- u_char sc_control;
- u_char sc_laststatus;
-};
-
/* XXX does not belong here */
cdev_decl(lpt);
-int lptintr __P((void *));
-
-#if NLPT_ISA
-int lpt_isa_probe __P((struct device *, void *, void *));
-void lpt_isa_attach __P((struct device *, struct device *, void *));
-struct cfattach lpt_isa_ca = {
- sizeof(struct lpt_softc), lpt_isa_probe, lpt_isa_attach
-};
-#endif
-
struct cfdriver lpt_cd = {
NULL, "lpt", DV_TTY
};
@@ -133,15 +99,14 @@ struct cfdriver lpt_cd = {
#define LPS_INVERT (LPS_SELECT|LPS_NERR|LPS_NBSY|LPS_NACK)
#define LPS_MASK (LPS_SELECT|LPS_NERR|LPS_NBSY|LPS_NACK|LPS_NOPAPER)
-#define NOT_READY() ((bus_space_read_1(iot, ioh, lpt_status) ^ LPS_INVERT) & LPS_MASK)
-#define NOT_READY_ERR() not_ready(bus_space_read_1(iot, ioh, lpt_status), sc)
-static int not_ready __P((u_char, struct lpt_softc *));
-
-static void lptwakeup __P((void *arg));
-static int pushbytes __P((struct lpt_softc *));
+#define NOT_READY() \
+ ((bus_space_read_1(iot, ioh, lpt_status) ^ LPS_INVERT) & LPS_MASK)
+#define NOT_READY_ERR() \
+ lpt_not_ready(bus_space_read_1(iot, ioh, lpt_status), sc)
-int lpt_port_test __P((bus_space_tag_t, bus_space_handle_t, bus_addr_t,
- bus_size_t, u_char, u_char));
+int lpt_not_ready __P((u_int8_t, struct lpt_softc *));
+void lptwakeup __P((void *arg));
+int lptpushbytes __P((struct lpt_softc *));
/*
* Internal routine to lptprobe to do port tests of one byte value.
@@ -152,10 +117,10 @@ lpt_port_test(iot, ioh, base, off, data, mask)
bus_space_handle_t ioh;
bus_addr_t base;
bus_size_t off;
- u_char data, mask;
+ u_int8_t data, mask;
{
int timeout;
- u_char temp;
+ u_int8_t temp;
data &= mask;
bus_space_write_1(iot, ioh, off, data);
@@ -170,126 +135,6 @@ lpt_port_test(iot, ioh, base, off, data, mask)
}
/*
- * Logic:
- * 1) You should be able to write to and read back the same value
- * to the data port. Do an alternating zeros, alternating ones,
- * walking zero, and walking one test to check for stuck bits.
- *
- * 2) You should be able to write to and read back the same value
- * to the control port lower 5 bits, the upper 3 bits are reserved
- * per the IBM PC technical reference manauls and different boards
- * do different things with them. Do an alternating zeros, alternating
- * ones, walking zero, and walking one test to check for stuck bits.
- *
- * Some printers drag the strobe line down when the are powered off
- * so this bit has been masked out of the control port test.
- *
- * XXX Some printers may not like a fast pulse on init or strobe, I
- * don't know at this point, if that becomes a problem these bits
- * should be turned off in the mask byte for the control port test.
- *
- * 3) Set the data and control ports to a value of 0
- */
-#if NLPT_ISA
-int
-lpt_isa_probe(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct isa_attach_args *ia = aux;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- u_long base;
- u_char mask, data;
- int i, rv;
-
-#ifdef DEBUG
-#define ABORT \
- do { \
- printf("lpt_isa_probe: mask %x data %x failed\n", mask, \
- data); \
- goto out; \
- } while (0)
-#else
-#define ABORT goto out
-#endif
-
- iot = ia->ia_iot;
- base = ia->ia_iobase;
- if (bus_space_map(iot, base, LPT_NPORTS, 0, &ioh))
- return 0;
-
- rv = 0;
- mask = 0xff;
-
- data = 0x55; /* Alternating zeros */
- if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask))
- ABORT;
-
- data = 0xaa; /* Alternating ones */
- if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask))
- ABORT;
-
- for (i = 0; i < CHAR_BIT; i++) { /* Walking zero */
- data = ~(1 << i);
- if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask))
- ABORT;
- }
-
- for (i = 0; i < CHAR_BIT; i++) { /* Walking one */
- data = (1 << i);
- if (!lpt_port_test(iot, ioh, base, lpt_data, data, mask))
- ABORT;
- }
-
- bus_space_write_1(iot, ioh, lpt_data, 0);
- bus_space_write_1(iot, ioh, lpt_control, 0);
-
- ia->ia_iosize = LPT_NPORTS;
- ia->ia_msize = 0;
-
- rv = 1;
-
-out:
- bus_space_unmap(iot, ioh, LPT_NPORTS);
- return rv;
-}
-#endif
-
-#if NLPT_ISA
-void
-lpt_isa_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct lpt_softc *sc = (void *)self;
- struct isa_attach_args *ia = aux;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
-
- if (ia->ia_irq != IRQUNK)
- printf("\n");
- else
- printf(": polled\n");
-
- sc->sc_iobase = ia->ia_iobase;
- sc->sc_irq = ia->ia_irq;
- sc->sc_state = 0;
-
- iot = sc->sc_iot = ia->ia_iot;
- if (bus_space_map(iot, sc->sc_iobase, LPT_NPORTS, 0, &ioh))
- panic("lpt_isa_attach: couldn't map I/O ports");
- sc->sc_ioh = ioh;
-
- bus_space_write_1(iot, ioh, lpt_control, LPC_NINIT);
-
- if (ia->ia_irq != IRQUNK)
- sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
- IPL_TTY, lptintr, sc, sc->sc_dev.dv_xname);
-}
-#endif
-
-/*
* Reset the printer, then wait until it's selected and not busy.
*/
int
@@ -300,11 +145,11 @@ lptopen(dev, flag, mode, p)
struct proc *p;
{
int unit = LPTUNIT(dev);
- u_char flags = LPTFLAGS(dev);
+ u_int8_t flags = LPTFLAGS(dev);
struct lpt_softc *sc;
bus_space_tag_t iot;
bus_space_handle_t ioh;
- u_char control;
+ u_int8_t control;
int error;
int spin;
@@ -314,7 +159,7 @@ lptopen(dev, flag, mode, p)
if (!sc)
return ENXIO;
- if (sc->sc_irq == IRQUNK && (flags & LPT_NOINTR) == 0)
+ if ((sc->sc_flags & (LPT_POLLED|LPT_NOINTR)) == LPT_POLLED)
return ENXIO;
#ifdef DIAGNOSTIC
@@ -375,11 +220,11 @@ lptopen(dev, flag, mode, p)
}
int
-not_ready(status, sc)
- u_char status;
+lpt_not_ready(status, sc)
+ u_int8_t status;
struct lpt_softc *sc;
{
- u_char new;
+ u_int8_t new;
status = (status ^ LPS_INVERT) & LPS_MASK;
new = status & ~sc->sc_laststatus;
@@ -425,7 +270,7 @@ lptclose(dev, flag, mode, p)
bus_space_handle_t ioh = sc->sc_ioh;
if (sc->sc_count)
- (void) pushbytes(sc);
+ (void) lptpushbytes(sc);
if ((sc->sc_flags & LPT_NOINTR) == 0)
untimeout(lptwakeup, sc);
@@ -440,7 +285,7 @@ lptclose(dev, flag, mode, p)
}
int
-pushbytes(sc)
+lptpushbytes(sc)
struct lpt_softc *sc;
{
bus_space_tag_t iot = sc->sc_iot;
@@ -449,7 +294,7 @@ pushbytes(sc)
if (sc->sc_flags & LPT_NOINTR) {
int spin, tic;
- u_char control = sc->sc_control;
+ u_int8_t control = sc->sc_control;
while (sc->sc_count > 0) {
spin = 0;
@@ -473,7 +318,8 @@ pushbytes(sc)
}
bus_space_write_1(iot, ioh, lpt_data, *sc->sc_cp++);
- bus_space_write_1(iot, ioh, lpt_control, control | LPC_STROBE);
+ bus_space_write_1(iot, ioh, lpt_control,
+ control | LPC_STROBE);
sc->sc_count--;
bus_space_write_1(iot, ioh, lpt_control, control);
@@ -519,7 +365,7 @@ lptwrite(dev, uio, flags)
while ((n = min(LPT_BSIZE, uio->uio_resid)) != 0) {
uiomove(sc->sc_cp = sc->sc_inbuf->b_data, n, uio);
sc->sc_count = n;
- error = pushbytes(sc);
+ error = lptpushbytes(sc);
if (error) {
/*
* Return accurate residual if interrupted or timed
@@ -545,7 +391,8 @@ lptintr(arg)
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
- if (((sc->sc_state & LPT_OPEN) == 0 && sc->sc_count == 0) || (sc->sc_flags & LPT_NOINTR))
+ if (((sc->sc_state & LPT_OPEN) == 0 && sc->sc_count == 0) ||
+ (sc->sc_flags & LPT_NOINTR))
return 0;
/* is printer online and ready for output */
@@ -553,7 +400,7 @@ lptintr(arg)
return -1;
if (sc->sc_count) {
- u_char control = sc->sc_control;
+ u_int8_t control = sc->sc_control;
/* send char */
bus_space_write_1(iot, ioh, lpt_data, *sc->sc_cp++);
delay (50);
diff --git a/sys/dev/isa/lptreg.h b/sys/dev/ic/lptreg.h
index b308fe24625..b308fe24625 100644
--- a/sys/dev/isa/lptreg.h
+++ b/sys/dev/ic/lptreg.h
diff --git a/sys/dev/ic/lptvar.h b/sys/dev/ic/lptvar.h
new file mode 100644
index 00000000000..84596d6471d
--- /dev/null
+++ b/sys/dev/ic/lptvar.h
@@ -0,0 +1,78 @@
+/* $OpenBSD: lptvar.h,v 1.1 1996/11/30 00:53:36 niklas Exp $ */
+/* $NetBSD: lpt.c,v 1.42 1996/10/21 22:41:14 thorpej Exp $ */
+
+/*
+ * Copyright (c) 1993, 1994 Charles Hannum.
+ * Copyright (c) 1990 William F. Jolitz, TeleMuse
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This software is a component of "386BSD" developed by
+ * William F. Jolitz, TeleMuse.
+ * 4. Neither the name of the developer nor the name "386BSD"
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ
+ * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS
+ * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT.
+ * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT
+ * NOT MAKE USE OF THIS WORK.
+ *
+ * FOR USERS WHO WISH TO UNDERSTAND THE 386BSD SYSTEM DEVELOPED
+ * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN
+ * REFERENCES SUCH AS THE "PORTING UNIX TO THE 386" SERIES
+ * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING
+ * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND
+ * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE
+ * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS
+ * OF 386BSD ENTITLED "386BSD FROM THE INSIDE OUT" WILL BE AVAILABLE LATE 1992.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+struct lpt_softc {
+ struct device sc_dev;
+ void *sc_ih;
+
+ size_t sc_count;
+ struct buf *sc_inbuf;
+ u_int8_t *sc_cp;
+ int sc_spinmax;
+ bus_space_tag_t sc_iot; /* bus tag */
+ bus_space_handle_t sc_ioh; /* handle to the registers */
+ u_int8_t sc_state;
+#define LPT_OPEN 0x01 /* device is open */
+#define LPT_OBUSY 0x02 /* printer is busy doing output */
+#define LPT_INIT 0x04 /* waiting to initialize for open */
+ u_int8_t sc_flags;
+#define LPT_POLLED 0x10 /* configured for polling only */
+#define LPT_AUTOLF 0x20 /* automatic LF on CR */
+#define LPT_NOPRIME 0x40 /* don't prime on open */
+#define LPT_NOINTR 0x80 /* do not use interrupt */
+ u_int8_t sc_control;
+ u_int8_t sc_laststatus;
+};
+
+int lptintr __P((void *));
+int lpt_port_test __P((bus_space_tag_t, bus_space_handle_t, bus_addr_t,
+ bus_size_t, u_int8_t, u_int8_t));
diff --git a/sys/dev/isa/files.isa b/sys/dev/isa/files.isa
index 50d38eb8293..e33a52f4fdb 100644
--- a/sys/dev/isa/files.isa
+++ b/sys/dev/isa/files.isa
@@ -1,4 +1,4 @@
-# $OpenBSD: files.isa,v 1.28 1996/11/29 22:54:57 niklas Exp $
+# $OpenBSD: files.isa,v 1.29 1996/11/30 00:53:39 niklas Exp $
# $NetBSD: files.isa,v 1.21 1996/05/16 03:45:55 mycroft Exp $
#
# Config.new file and device description for machine-independent ISA code.
@@ -67,9 +67,7 @@ attach cy at isa with cy_isa
file dev/isa/cy_isa.c cy_isa
# PC parallel ports (XXX what chip?)
-device lpt
attach lpt at isa with lpt_isa
-file dev/isa/lpt.c lpt & (lpt_isa | lpt_pica) needs-flag
file dev/isa/lpt_isa.c lpt_isa needs-flag
#
diff --git a/sys/dev/isa/lpt_isa.c b/sys/dev/isa/lpt_isa.c
index 024627911ee..9094cfe8996 100644
--- a/sys/dev/isa/lpt_isa.c
+++ b/sys/dev/isa/lpt_isa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpt_isa.c,v 1.1 1996/11/29 23:51:13 niklas Exp $ */
+/* $OpenBSD: lpt_isa.c,v 1.2 1996/11/30 00:53:38 niklas Exp $ */
/*
* Copyright (c) 1993, 1994 Charles Hannum.
@@ -60,15 +60,38 @@
#include <machine/bus.h>
#include <machine/intr.h>
-#include <dev/isa/lptreg.h>
+#include <dev/isa/isavar.h>
+#include <dev/ic/lptreg.h>
+#include <dev/ic/lptvar.h>
-int lpt_isa_probe __P((struct device *, void *, void *));
-void lpt_isa_attach __P((struct device *, struct device *, void *));
+int lpt_isa_probe __P((struct device *, void *, void *));
+void lpt_isa_attach __P((struct device *, struct device *, void *));
struct cfattach lpt_isa_ca = {
sizeof(struct lpt_softc), lpt_isa_probe, lpt_isa_attach
};
+/*
+ * Logic:
+ * 1) You should be able to write to and read back the same value
+ * to the data port. Do an alternating zeros, alternating ones,
+ * walking zero, and walking one test to check for stuck bits.
+ *
+ * 2) You should be able to write to and read back the same value
+ * to the control port lower 5 bits, the upper 3 bits are reserved
+ * per the IBM PC technical reference manauls and different boards
+ * do different things with them. Do an alternating zeros, alternating
+ * ones, walking zero, and walking one test to check for stuck bits.
+ *
+ * Some printers drag the strobe line down when the are powered off
+ * so this bit has been masked out of the control port test.
+ *
+ * XXX Some printers may not like a fast pulse on init or strobe, I
+ * don't know at this point, if that becomes a problem these bits
+ * should be turned off in the mask byte for the control port test.
+ *
+ * 3) Set the data and control ports to a value of 0
+ */
int
lpt_isa_probe(parent, match, aux)
struct device *parent;
@@ -77,8 +100,8 @@ lpt_isa_probe(parent, match, aux)
struct isa_attach_args *ia = aux;
bus_space_tag_t iot;
bus_space_handle_t ioh;
- u_long base;
- u_char mask, data;
+ bus_addr_t base;
+ u_int8_t mask, data;
int i, rv;
#ifdef DEBUG
@@ -145,15 +168,15 @@ lpt_isa_attach(parent, self, aux)
if (ia->ia_irq != IRQUNK)
printf("\n");
- else
+ else {
+ sc->sc_flags |= LPT_POLLED;
printf(": polled\n");
+ }
- sc->sc_iobase = ia->ia_iobase;
- sc->sc_irq = ia->ia_irq;
sc->sc_state = 0;
iot = sc->sc_iot = ia->ia_iot;
- if (bus_space_map(iot, sc->sc_iobase, LPT_NPORTS, 0, &ioh))
+ if (bus_space_map(iot, ia->ia_iobase, LPT_NPORTS, 0, &ioh))
panic("lpt_isa_attach: couldn't map I/O ports");
sc->sc_ioh = ioh;