summaryrefslogtreecommitdiff
path: root/sys/arch/i386/isa/pccom.c
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1997-12-21 14:44:35 +0000
committerJason Downs <downsj@cvs.openbsd.org>1997-12-21 14:44:35 +0000
commit938534dec0b3e31a45f59774cefa271e95a0d5c9 (patch)
tree58dcb5ecbc530a2dd5bd7dcbde638ef22680fc3d /sys/arch/i386/isa/pccom.c
parent7e6d3badae322b7db18165c8e8372043086045d5 (diff)
ISA PnP supporting code from NetBSD, and a pccom driver that supports ISA PnP.
Diffstat (limited to 'sys/arch/i386/isa/pccom.c')
-rw-r--r--sys/arch/i386/isa/pccom.c76
1 files changed, 63 insertions, 13 deletions
diff --git a/sys/arch/i386/isa/pccom.c b/sys/arch/i386/isa/pccom.c
index 2b400d5b69f..3ab89444bea 100644
--- a/sys/arch/i386/isa/pccom.c
+++ b/sys/arch/i386/isa/pccom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pccom.c,v 1.13 1997/10/07 06:49:49 mickey Exp $ */
+/* $OpenBSD: pccom.c,v 1.14 1997/12/21 14:44:34 downsj Exp $ */
/* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */
/*-
@@ -59,7 +59,10 @@
#include <machine/bus.h>
#include <machine/intr.h>
+#include <dev/cons.h>
#include <dev/isa/isavar.h>
+#include <dev/isa/isapnpreg.h>
+#include <dev/isa/isapnpvar.h>
#include <dev/ic/comreg.h>
#include <dev/ic/ns16550reg.h>
#ifdef COM_HAYESP
@@ -91,6 +94,12 @@ struct cfattach pccom_isa_ca = {
};
#endif
+#if NPCCOM_ISAPNP
+struct cfattach pccom_isapnp_ca = {
+ sizeof(struct com_softc), comprobe, comattach
+};
+#endif
+
#if NPCCOM_COMMULTI
struct cfattach pccom_commulti_ca = {
sizeof(struct com_softc), comprobe, comattach
@@ -138,6 +147,23 @@ extern int kgdb_debug_init;
#define CLR(t, f) (t) &= ~(f)
#define ISSET(t, f) ((t) & (f))
+/* Macros for determining bus type. */
+#if NPCCOM_ISA || NPCCOM_PCMCIA
+#define IS_ISA(parent) \
+ (!strcmp((parent)->dv_cfdata->cf_driver->cd_name, "isa") || \
+ !strcmp((parent)->dv_cfdata->cf_driver->cd_name, "pcmcia"))
+#elif NPCCOM_ISA
+#define IS_ISA(parent) \
+ !strcmp((parent)->dv_cfdata->cf_driver->cd_name, "isa")
+#endif
+
+#if NPCCOM_ISAPNP
+#define IS_ISAPNP(parent) \
+ !strcmp((parent)->dv_cfdata->cf_driver->cd_name, "isapnp")
+#else
+#define IS_ISAPNP(parent) 0
+#endif
+
#if NPCCOM_PCMCIA
#include <dev/pcmcia/pcmciavar.h>
@@ -454,14 +480,6 @@ comprobe(parent, match, aux)
int iobase, needioh;
int rv = 1;
-#if NPCCOM_ISA || NPCCOM_PCMCIA
-#define IS_ISA(parent) \
- (!strcmp((parent)->dv_cfdata->cf_driver->cd_name, "isa") || \
- !strcmp((parent)->dv_cfdata->cf_driver->cd_name, "pcmcia"))
-#elif NPCCOM_ISA
-#define IS_ISA(parent) \
- !strcmp((parent)->dv_cfdata->cf_driver->cd_name, "isa")
-#endif
/*
* XXX should be broken out into functions for isa probe and
* XXX for commulti probe, with a helper function that contains
@@ -476,6 +494,17 @@ comprobe(parent, match, aux)
needioh = 1;
} else
#endif
+#if NPCCOM_ISAPNP
+ if (IS_ISAPNP(parent)) {
+ struct isapnp_attach_args *ipa = aux;
+
+ /* XXX: is the modem always on region 0? */
+ iot = ipa->ipa_iot;
+ iobase = ipa->ipa_io[0].base;
+ ioh = ipa->ipa_io[0].h;
+ needioh = 0;
+ } else
+#endif
#if NPCCOM_COMMULTI
if (1) {
struct cfdata *cf = match;
@@ -552,14 +581,27 @@ comattach(parent, self, aux)
*/
iobase = ia->ia_iobase;
iot = ia->ia_iot;
- if (iobase != comconsaddr) {
- if (bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh))
+ if (iobase != comconsaddr) {
+ if (bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh))
panic("comattach: io mapping failed");
} else
- ioh = comconsioh;
+ ioh = comconsioh;
irq = ia->ia_irq;
} else
#endif
+#if NPCCOM_ISAPNP
+ if (IS_ISAPNP(parent)) {
+ struct isapnp_attach_args *ipa = aux;
+
+ /*
+ * We're living on ISA PnP. No console support.
+ */
+ iobase = ipa->ipa_io[0].base;
+ iot = ipa->ipa_iot;
+ ioh = ipa->ipa_io[0].h;
+ irq = ipa->ipa_irq[0].num;
+ } else
+#endif
#if NPCCOM_COMMULTI
if (1) {
struct commulti_attach_args *ca = aux;
@@ -650,6 +692,15 @@ comattach(parent, self, aux)
sc->sc_dev.dv_xname);
} else
#endif
+#if NPCCOM_ISAPNP
+ if (IS_ISAPNP(parent)) {
+ struct isapnp_attach_args *ipa = aux;
+
+ sc->sc_ih = isa_intr_establish(ipa->ipa_ic, irq,
+ IST_EDGE, IPL_HIGH, comintr, sc,
+ sc->sc_dev.dv_xname);
+ } else
+#endif
panic("comattach: IRQ but can't have one");
}
@@ -1598,7 +1649,6 @@ comintr(arg)
/*
* Following are all routines needed for PCCOM to act as console
*/
-#include <dev/cons.h>
void
comcnprobe(cp)