diff --git a/sys/dev/mca/com_mca.c b/sys/dev/mca/com_mca.c index 8bbc6300a014..bb9f83c8286e 100644 --- a/sys/dev/mca/com_mca.c +++ b/sys/dev/mca/com_mca.c @@ -1,4 +1,4 @@ -/* $NetBSD: com_mca.c,v 1.2 2001/03/31 09:50:14 jdolecek Exp $ */ +/* $NetBSD: com_mca.c,v 1.3 2001/04/20 10:03:35 jdolecek Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -108,7 +108,9 @@ struct com_mca_softc { int com_mca_probe __P((struct device *, struct cfdata *, void *)); void com_mca_attach __P((struct device *, struct device *, void *)); void com_mca_cleanup __P((void *)); + static int ibm_modem_getcfg __P((struct mca_attach_args *, int *, int *)); +static int neocom1_getcfg __P((struct mca_attach_args *, int *, int *)); struct cfattach com_mca_ca = { sizeof(struct com_mca_softc), com_mca_probe, com_mca_attach @@ -121,6 +123,8 @@ static const struct com_mca_product { /* get device i/o base and irq */ } com_mca_products[] = { { MCA_PRODUCT_IBM_MOD, "IBM Internal Modem", ibm_modem_getcfg }, + { MCA_PRODUCT_NEOCOM1, "NeoTecH Single RS-232 Async. Adapter, SM110", + neocom1_getcfg }, { 0, NULL, NULL }, }; @@ -172,12 +176,6 @@ com_mca_attach(parent, self, aux) return; } - printf(" slot %d i/o %#x-%#x irq %d: %s\n", ma->ma_slot + 1, - iobase, iobase + COM_NPORTS - 1, - irq, cpp->cp_name); - - printf("%s", sc->sc_dev.dv_xname); - if (bus_space_map(ma->ma_iot, iobase, COM_NPORTS, 0, &sc->sc_ioh)) { printf(": can't map i/o space\n"); return; @@ -187,8 +185,13 @@ com_mca_attach(parent, self, aux) sc->sc_iot = ma->ma_iot; sc->sc_iobase = iobase; + printf(" slot %d i/o %#x-%#x irq %d", ma->ma_slot + 1, + iobase, iobase + COM_NPORTS - 1, irq); + com_attach_subr(sc); + printf("%s: %s\n", sc->sc_dev.dv_xname, cpp->cp_name); + isc->sc_ih = mca_intr_establish(ma->ma_mc, irq, IPL_SERIAL, comintr, sc); if (isc->sc_ih == NULL) { @@ -260,3 +263,41 @@ ibm_modem_getcfg(ma, iobasep, irqp) return (0); } + +/* + * Get configuration for NeoTecH Single RS-232 Async. Adapter, SM110. + */ +static int +neocom1_getcfg(ma, iobasep, irqp) + struct mca_attach_args *ma; + int *iobasep, *irqp; +{ + int pos2, pos3, pos4; + static const int neotech_irq[] = { 12, 9, 4, 3 }; + + pos2 = mca_conf_read(ma->ma_mc, ma->ma_slot, 2); + pos3 = mca_conf_read(ma->ma_mc, ma->ma_slot, 3); + pos4 = mca_conf_read(ma->ma_mc, ma->ma_slot, 4); + + /* + * POS register 2: (adf pos0) + * 7 6 5 4 3 2 1 0 + * 1 \_/ \__ enable: 0=adapter disabled, 1=adapter enabled + * \____ IRQ: 11=3 10=4 01=9 00=12 + * + * POS register 3: (adf pos1) + * 7 6 5 4 3 2 1 0 + * \______/ + * \_________ I/O Address: bits 7-3 + * + * POS register 4: (adf pos2) + * 7 6 5 4 3 2 1 0 + * \_____________/ + * \__ I/O Address: bits 15-8 + */ + + *iobasep = (pos4 << 8) | (pos3 & 0xf8); + *irqp = neotech_irq[(pos2 & 0x06) >> 1]; + + return (0); +} diff --git a/sys/dev/mca/mcadevs b/sys/dev/mca/mcadevs index 5c569c8f30bb..20f9aa569530 100644 --- a/sys/dev/mca/mcadevs +++ b/sys/dev/mca/mcadevs @@ -1,4 +1,4 @@ -$NetBSD: mcadevs,v 1.11 2001/04/20 07:37:42 jdolecek Exp $ +$NetBSD: mcadevs,v 1.12 2001/04/20 10:03:35 jdolecek Exp $ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -188,7 +188,7 @@ product 0x678B "NeoTecH Dual RS-232 Async. Adapter" [6] product 0x678C "NeoTecH S2M100 Dual RS-232 Async. Adapter" [6] product 0x678D "NeoTecH MSP/4 4-Channel Serial/Parallel Adapter" [6] product 0x678F "BBS GPIB-3000 IEEE-488 Adapter" [5] -product 0x6781 "NeoTecH Single RS-232 Async. Adapter, SM110" [10] +product 0x6791 NEOCOM1 "NeoTecH Single RS-232 Async. Adapter, SM110" [10] product 0x6792 "NeoTecH SPM121/SPM321 Serial/Parallel Adapter" [6] product 0x6795 "NeoTecH S1M200 Single RS-422/485 Async. Adapter" [6] product 0x6796 "NeoTecH PM101 Single Bidirectional Parallel Adapter" [6]