Home | History | Annotate | Line # | Download | only in mca
com_mca.c revision 1.2.2.4
      1  1.2.2.4  nathanw /*	$NetBSD: com_mca.c,v 1.2.2.4 2001/11/14 19:14:59 nathanw Exp $	*/
      2  1.2.2.2  nathanw 
      3  1.2.2.2  nathanw /*-
      4  1.2.2.2  nathanw  * Copyright (c) 2001 The NetBSD Foundation, Inc.
      5  1.2.2.2  nathanw  * All rights reserved.
      6  1.2.2.2  nathanw  *
      7  1.2.2.2  nathanw  * This code is derived from software contributed to The NetBSD Foundation
      8  1.2.2.2  nathanw  * by Charles M. Hannum.
      9  1.2.2.2  nathanw  *
     10  1.2.2.2  nathanw  * Redistribution and use in source and binary forms, with or without
     11  1.2.2.2  nathanw  * modification, are permitted provided that the following conditions
     12  1.2.2.2  nathanw  * are met:
     13  1.2.2.2  nathanw  * 1. Redistributions of source code must retain the above copyright
     14  1.2.2.2  nathanw  *    notice, this list of conditions and the following disclaimer.
     15  1.2.2.2  nathanw  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.2.2.2  nathanw  *    notice, this list of conditions and the following disclaimer in the
     17  1.2.2.2  nathanw  *    documentation and/or other materials provided with the distribution.
     18  1.2.2.2  nathanw  * 3. All advertising materials mentioning features or use of this software
     19  1.2.2.2  nathanw  *    must display the following acknowledgement:
     20  1.2.2.2  nathanw  *        This product includes software developed by the NetBSD
     21  1.2.2.2  nathanw  *        Foundation, Inc. and its contributors.
     22  1.2.2.2  nathanw  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.2.2.2  nathanw  *    contributors may be used to endorse or promote products derived
     24  1.2.2.2  nathanw  *    from this software without specific prior written permission.
     25  1.2.2.2  nathanw  *
     26  1.2.2.2  nathanw  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.2.2.2  nathanw  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.2.2.2  nathanw  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.2.2.2  nathanw  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.2.2.2  nathanw  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.2.2.2  nathanw  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.2.2.2  nathanw  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.2.2.2  nathanw  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.2.2.2  nathanw  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.2.2.2  nathanw  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.2.2.2  nathanw  * POSSIBILITY OF SUCH DAMAGE.
     37  1.2.2.2  nathanw  */
     38  1.2.2.2  nathanw 
     39  1.2.2.2  nathanw /*-
     40  1.2.2.2  nathanw  * Copyright (c) 1991 The Regents of the University of California.
     41  1.2.2.2  nathanw  * All rights reserved.
     42  1.2.2.2  nathanw  *
     43  1.2.2.2  nathanw  * Redistribution and use in source and binary forms, with or without
     44  1.2.2.2  nathanw  * modification, are permitted provided that the following conditions
     45  1.2.2.2  nathanw  * are met:
     46  1.2.2.2  nathanw  * 1. Redistributions of source code must retain the above copyright
     47  1.2.2.2  nathanw  *    notice, this list of conditions and the following disclaimer.
     48  1.2.2.2  nathanw  * 2. Redistributions in binary form must reproduce the above copyright
     49  1.2.2.2  nathanw  *    notice, this list of conditions and the following disclaimer in the
     50  1.2.2.2  nathanw  *    documentation and/or other materials provided with the distribution.
     51  1.2.2.2  nathanw  * 3. All advertising materials mentioning features or use of this software
     52  1.2.2.2  nathanw  *    must display the following acknowledgement:
     53  1.2.2.2  nathanw  *	This product includes software developed by the University of
     54  1.2.2.2  nathanw  *	California, Berkeley and its contributors.
     55  1.2.2.2  nathanw  * 4. Neither the name of the University nor the names of its contributors
     56  1.2.2.2  nathanw  *    may be used to endorse or promote products derived from this software
     57  1.2.2.2  nathanw  *    without specific prior written permission.
     58  1.2.2.2  nathanw  *
     59  1.2.2.2  nathanw  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     60  1.2.2.2  nathanw  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     61  1.2.2.2  nathanw  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     62  1.2.2.2  nathanw  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     63  1.2.2.2  nathanw  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     64  1.2.2.2  nathanw  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     65  1.2.2.2  nathanw  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     66  1.2.2.2  nathanw  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     67  1.2.2.2  nathanw  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     68  1.2.2.2  nathanw  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     69  1.2.2.2  nathanw  * SUCH DAMAGE.
     70  1.2.2.2  nathanw  *
     71  1.2.2.2  nathanw  *	@(#)com.c	7.5 (Berkeley) 5/16/91
     72  1.2.2.2  nathanw  */
     73  1.2.2.2  nathanw 
     74  1.2.2.2  nathanw /*
     75  1.2.2.2  nathanw  * This driver attaches serial port boards and internal modems.
     76  1.2.2.2  nathanw  */
     77  1.2.2.2  nathanw 
     78  1.2.2.4  nathanw #include <sys/cdefs.h>
     79  1.2.2.4  nathanw __KERNEL_RCSID(0, "$NetBSD: com_mca.c,v 1.2.2.4 2001/11/14 19:14:59 nathanw Exp $");
     80  1.2.2.4  nathanw 
     81  1.2.2.2  nathanw #include <sys/param.h>
     82  1.2.2.2  nathanw #include <sys/systm.h>
     83  1.2.2.2  nathanw #include <sys/ioctl.h>
     84  1.2.2.2  nathanw #include <sys/select.h>
     85  1.2.2.2  nathanw #include <sys/tty.h>
     86  1.2.2.2  nathanw #include <sys/proc.h>
     87  1.2.2.2  nathanw #include <sys/user.h>
     88  1.2.2.2  nathanw #include <sys/file.h>
     89  1.2.2.2  nathanw #include <sys/uio.h>
     90  1.2.2.2  nathanw #include <sys/kernel.h>
     91  1.2.2.2  nathanw #include <sys/syslog.h>
     92  1.2.2.2  nathanw #include <sys/types.h>
     93  1.2.2.2  nathanw #include <sys/device.h>
     94  1.2.2.2  nathanw 
     95  1.2.2.2  nathanw #include <machine/intr.h>
     96  1.2.2.2  nathanw #include <machine/bus.h>
     97  1.2.2.2  nathanw 
     98  1.2.2.2  nathanw #include <dev/ic/comreg.h>
     99  1.2.2.2  nathanw #include <dev/ic/comvar.h>
    100  1.2.2.2  nathanw 
    101  1.2.2.2  nathanw #include <dev/mca/mcavar.h>
    102  1.2.2.2  nathanw #include <dev/mca/mcadevs.h>
    103  1.2.2.2  nathanw 
    104  1.2.2.2  nathanw struct com_mca_softc {
    105  1.2.2.2  nathanw 	struct	com_softc sc_com;	/* real "com" softc */
    106  1.2.2.2  nathanw 
    107  1.2.2.2  nathanw 	/* MCA-specific goo. */
    108  1.2.2.2  nathanw 	void	*sc_ih;			/* interrupt handler */
    109  1.2.2.2  nathanw };
    110  1.2.2.2  nathanw 
    111  1.2.2.2  nathanw int com_mca_probe __P((struct device *, struct cfdata *, void *));
    112  1.2.2.2  nathanw void com_mca_attach __P((struct device *, struct device *, void *));
    113  1.2.2.2  nathanw void com_mca_cleanup __P((void *));
    114  1.2.2.3  nathanw 
    115  1.2.2.2  nathanw static int ibm_modem_getcfg __P((struct mca_attach_args *, int *, int *));
    116  1.2.2.3  nathanw static int neocom1_getcfg __P((struct mca_attach_args *, int *, int *));
    117  1.2.2.3  nathanw static int ibm_mpcom_getcfg __P((struct mca_attach_args *, int *, int *));
    118  1.2.2.2  nathanw 
    119  1.2.2.2  nathanw struct cfattach com_mca_ca = {
    120  1.2.2.2  nathanw 	sizeof(struct com_mca_softc), com_mca_probe, com_mca_attach
    121  1.2.2.2  nathanw };
    122  1.2.2.2  nathanw 
    123  1.2.2.2  nathanw static const struct com_mca_product {
    124  1.2.2.2  nathanw 	u_int32_t	cp_prodid;	/* MCA product ID */
    125  1.2.2.2  nathanw 	const char	*cp_name;	/* device name */
    126  1.2.2.2  nathanw 	int (*cp_getcfg) __P((struct mca_attach_args *, int *iobase, int *irq));
    127  1.2.2.2  nathanw 					/* get device i/o base and irq */
    128  1.2.2.2  nathanw } com_mca_products[] = {
    129  1.2.2.2  nathanw 	{ MCA_PRODUCT_IBM_MOD,	"IBM Internal Modem",	ibm_modem_getcfg },
    130  1.2.2.3  nathanw 	{ MCA_PRODUCT_NEOCOM1,	"NeoTecH Single RS-232 Async. Adapter, SM110",
    131  1.2.2.3  nathanw 		neocom1_getcfg },
    132  1.2.2.3  nathanw 	{ MCA_PRODUCT_IBM_MPCOM,"IBM Multi-Protocol Communications Adapter",
    133  1.2.2.3  nathanw 		ibm_mpcom_getcfg },
    134  1.2.2.2  nathanw 	{ 0,			NULL,			NULL },
    135  1.2.2.2  nathanw };
    136  1.2.2.2  nathanw 
    137  1.2.2.2  nathanw static const struct com_mca_product *com_mca_lookup __P((int));
    138  1.2.2.2  nathanw 
    139  1.2.2.2  nathanw static const struct com_mca_product *
    140  1.2.2.2  nathanw com_mca_lookup(ma_id)
    141  1.2.2.2  nathanw 	int ma_id;
    142  1.2.2.2  nathanw {
    143  1.2.2.2  nathanw 	const struct com_mca_product *cpp;
    144  1.2.2.2  nathanw 
    145  1.2.2.2  nathanw 	for (cpp = com_mca_products; cpp->cp_name != NULL; cpp++)
    146  1.2.2.2  nathanw 		if (cpp->cp_prodid == ma_id)
    147  1.2.2.2  nathanw 			return (cpp);
    148  1.2.2.2  nathanw 
    149  1.2.2.2  nathanw 	return (NULL);
    150  1.2.2.2  nathanw }
    151  1.2.2.2  nathanw 
    152  1.2.2.2  nathanw int
    153  1.2.2.2  nathanw com_mca_probe(parent, match, aux)
    154  1.2.2.2  nathanw 	struct device *parent;
    155  1.2.2.2  nathanw 	struct cfdata *match;
    156  1.2.2.2  nathanw 	void *aux;
    157  1.2.2.2  nathanw {
    158  1.2.2.2  nathanw 	struct mca_attach_args *ma = aux;
    159  1.2.2.2  nathanw 
    160  1.2.2.2  nathanw 	if (com_mca_lookup(ma->ma_id))
    161  1.2.2.2  nathanw 		return (1);
    162  1.2.2.2  nathanw 
    163  1.2.2.2  nathanw 	return (0);
    164  1.2.2.2  nathanw }
    165  1.2.2.2  nathanw 
    166  1.2.2.2  nathanw void
    167  1.2.2.2  nathanw com_mca_attach(parent, self, aux)
    168  1.2.2.2  nathanw 	struct device *parent, *self;
    169  1.2.2.2  nathanw 	void *aux;
    170  1.2.2.2  nathanw {
    171  1.2.2.2  nathanw 	struct com_mca_softc *isc = (void *)self;
    172  1.2.2.2  nathanw 	struct com_softc *sc = &isc->sc_com;
    173  1.2.2.2  nathanw 	int iobase, irq;
    174  1.2.2.2  nathanw 	struct mca_attach_args *ma = aux;
    175  1.2.2.2  nathanw 	const struct com_mca_product *cpp;
    176  1.2.2.2  nathanw 
    177  1.2.2.2  nathanw 	cpp = com_mca_lookup(ma->ma_id);
    178  1.2.2.2  nathanw 
    179  1.2.2.2  nathanw 	/* get iobase and irq */
    180  1.2.2.3  nathanw 	if ((*cpp->cp_getcfg)(ma, &iobase, &irq))
    181  1.2.2.2  nathanw 		return;
    182  1.2.2.2  nathanw 
    183  1.2.2.2  nathanw 	if (bus_space_map(ma->ma_iot, iobase, COM_NPORTS, 0, &sc->sc_ioh)) {
    184  1.2.2.2  nathanw 		printf(": can't map i/o space\n");
    185  1.2.2.2  nathanw 		return;
    186  1.2.2.2  nathanw 	}
    187  1.2.2.2  nathanw 
    188  1.2.2.2  nathanw 	sc->sc_frequency = COM_FREQ;
    189  1.2.2.2  nathanw 	sc->sc_iot = ma->ma_iot;
    190  1.2.2.2  nathanw 	sc->sc_iobase = iobase;
    191  1.2.2.2  nathanw 
    192  1.2.2.3  nathanw 	printf(" slot %d i/o %#x-%#x irq %d", ma->ma_slot + 1,
    193  1.2.2.3  nathanw 		iobase, iobase + COM_NPORTS - 1, irq);
    194  1.2.2.3  nathanw 
    195  1.2.2.2  nathanw 	com_attach_subr(sc);
    196  1.2.2.2  nathanw 
    197  1.2.2.3  nathanw 	printf("%s: %s\n", sc->sc_dev.dv_xname, cpp->cp_name);
    198  1.2.2.3  nathanw 
    199  1.2.2.2  nathanw 	isc->sc_ih = mca_intr_establish(ma->ma_mc, irq, IPL_SERIAL,
    200  1.2.2.2  nathanw 			comintr, sc);
    201  1.2.2.2  nathanw 	if (isc->sc_ih == NULL) {
    202  1.2.2.2  nathanw                 printf("%s: couldn't establish interrupt handler\n",
    203  1.2.2.2  nathanw                     sc->sc_dev.dv_xname);
    204  1.2.2.2  nathanw                 return;
    205  1.2.2.2  nathanw         }
    206  1.2.2.2  nathanw 
    207  1.2.2.2  nathanw 	/*
    208  1.2.2.2  nathanw 	 * Shutdown hook for buggy BIOSs that don't recognize the UART
    209  1.2.2.2  nathanw 	 * without a disabled FIFO.
    210  1.2.2.2  nathanw 	 * XXX is this necessary on MCA ? --- jdolecek
    211  1.2.2.2  nathanw 	 */
    212  1.2.2.2  nathanw 	if (shutdownhook_establish(com_mca_cleanup, sc) == NULL)
    213  1.2.2.2  nathanw 		panic("com_mca_attach: could not establish shutdown hook");
    214  1.2.2.2  nathanw }
    215  1.2.2.2  nathanw 
    216  1.2.2.2  nathanw void
    217  1.2.2.2  nathanw com_mca_cleanup(arg)
    218  1.2.2.2  nathanw 	void *arg;
    219  1.2.2.2  nathanw {
    220  1.2.2.2  nathanw 	struct com_softc *sc = arg;
    221  1.2.2.2  nathanw 
    222  1.2.2.2  nathanw 	if (ISSET(sc->sc_hwflags, COM_HW_FIFO))
    223  1.2.2.2  nathanw 		bus_space_write_1(sc->sc_iot, sc->sc_ioh, com_fifo, 0);
    224  1.2.2.2  nathanw }
    225  1.2.2.2  nathanw 
    226  1.2.2.2  nathanw /* map serial_X to iobase and irq */
    227  1.2.2.2  nathanw static const struct {
    228  1.2.2.2  nathanw 	int iobase;
    229  1.2.2.2  nathanw 	int irq;
    230  1.2.2.2  nathanw } MCA_SERIAL[] = {
    231  1.2.2.2  nathanw 	{ 0x03f8,	4 },	/* SERIAL_1 */
    232  1.2.2.2  nathanw 	{ 0x02f8,	3 },	/* SERIAL_2 */
    233  1.2.2.2  nathanw 	{ 0x3220,	3 },	/* SERIAL_3 */
    234  1.2.2.2  nathanw 	{ 0x3228,	3 },	/* SERIAL_4 */
    235  1.2.2.2  nathanw 	{ 0x4220,	3 },	/* SERIAL_5 */
    236  1.2.2.2  nathanw 	{ 0x4228,	3 },	/* SERIAL_6 */
    237  1.2.2.2  nathanw 	{ 0x5220,	3 },	/* SERIAL_7 */
    238  1.2.2.2  nathanw 	{ 0x5228,	3 },	/* SERIAL_8 */
    239  1.2.2.2  nathanw };
    240  1.2.2.2  nathanw 
    241  1.2.2.2  nathanw /*
    242  1.2.2.2  nathanw  * Get config for IBM Internal Modem (ID 0xEDFF). This beast doesn't
    243  1.2.2.2  nathanw  * seem to support even AT commands, it's good as example for adding
    244  1.2.2.2  nathanw  * other stuff though.
    245  1.2.2.2  nathanw  */
    246  1.2.2.2  nathanw static int
    247  1.2.2.2  nathanw ibm_modem_getcfg(ma, iobasep, irqp)
    248  1.2.2.2  nathanw 	struct mca_attach_args *ma;
    249  1.2.2.2  nathanw 	int *iobasep, *irqp;
    250  1.2.2.2  nathanw {
    251  1.2.2.2  nathanw 	int pos2;
    252  1.2.2.2  nathanw 	int snum;
    253  1.2.2.2  nathanw 
    254  1.2.2.2  nathanw 	pos2 = mca_conf_read(ma->ma_mc, ma->ma_slot, 2);
    255  1.2.2.2  nathanw 
    256  1.2.2.2  nathanw 	/*
    257  1.2.2.2  nathanw 	 * POS register 2: (adf pos0)
    258  1.2.2.2  nathanw 	 * 7 6 5 4 3 2 1 0
    259  1.2.2.2  nathanw 	 *         \__/  \__ enable: 0=adapter disabled, 1=adapter enabled
    260  1.2.2.2  nathanw 	 *            \_____ Serial Configuration: XX=SERIAL_XX
    261  1.2.2.2  nathanw 	 */
    262  1.2.2.2  nathanw 
    263  1.2.2.2  nathanw 	snum = (pos2 & 0x0e) >> 1;
    264  1.2.2.2  nathanw 
    265  1.2.2.2  nathanw 	*iobasep = MCA_SERIAL[snum].iobase;
    266  1.2.2.2  nathanw 	*irqp = MCA_SERIAL[snum].irq;
    267  1.2.2.2  nathanw 
    268  1.2.2.2  nathanw 	return (0);
    269  1.2.2.2  nathanw }
    270  1.2.2.3  nathanw 
    271  1.2.2.3  nathanw /*
    272  1.2.2.3  nathanw  * Get configuration for NeoTecH Single RS-232 Async. Adapter, SM110.
    273  1.2.2.3  nathanw  */
    274  1.2.2.3  nathanw static int
    275  1.2.2.3  nathanw neocom1_getcfg(ma, iobasep, irqp)
    276  1.2.2.3  nathanw 	struct mca_attach_args *ma;
    277  1.2.2.3  nathanw 	int *iobasep, *irqp;
    278  1.2.2.3  nathanw {
    279  1.2.2.3  nathanw 	int pos2, pos3, pos4;
    280  1.2.2.3  nathanw 	static const int neotech_irq[] = { 12, 9, 4, 3 };
    281  1.2.2.3  nathanw 
    282  1.2.2.3  nathanw 	pos2 = mca_conf_read(ma->ma_mc, ma->ma_slot, 2);
    283  1.2.2.3  nathanw 	pos3 = mca_conf_read(ma->ma_mc, ma->ma_slot, 3);
    284  1.2.2.3  nathanw 	pos4 = mca_conf_read(ma->ma_mc, ma->ma_slot, 4);
    285  1.2.2.3  nathanw 
    286  1.2.2.3  nathanw 	/*
    287  1.2.2.3  nathanw 	 * POS register 2: (adf pos0)
    288  1.2.2.3  nathanw 	 * 7 6 5 4 3 2 1 0
    289  1.2.2.3  nathanw 	 *     1     \_/ \__ enable: 0=adapter disabled, 1=adapter enabled
    290  1.2.2.3  nathanw 	 *             \____ IRQ: 11=3 10=4 01=9 00=12
    291  1.2.2.3  nathanw 	 *
    292  1.2.2.3  nathanw 	 * POS register 3: (adf pos1)
    293  1.2.2.3  nathanw 	 * 7 6 5 4 3 2 1 0
    294  1.2.2.3  nathanw 	 * \______/
    295  1.2.2.3  nathanw 	 *        \_________ I/O Address: bits 7-3
    296  1.2.2.3  nathanw 	 *
    297  1.2.2.3  nathanw 	 * POS register 4: (adf pos2)
    298  1.2.2.3  nathanw 	 * 7 6 5 4 3 2 1 0
    299  1.2.2.3  nathanw 	 * \_____________/
    300  1.2.2.3  nathanw 	 *               \__ I/O Address: bits 15-8
    301  1.2.2.3  nathanw 	 */
    302  1.2.2.3  nathanw 
    303  1.2.2.3  nathanw 	*iobasep = (pos4 << 8) | (pos3 & 0xf8);
    304  1.2.2.3  nathanw 	*irqp = neotech_irq[(pos2 & 0x06) >> 1];
    305  1.2.2.3  nathanw 
    306  1.2.2.3  nathanw 	return (0);
    307  1.2.2.3  nathanw }
    308  1.2.2.3  nathanw 
    309  1.2.2.3  nathanw /*
    310  1.2.2.3  nathanw  * Get configuration for IBM Multi-Protocol Communications Adapter.
    311  1.2.2.3  nathanw  * We only support SERIAL mode, bail out if set to SDLC or BISYNC.
    312  1.2.2.3  nathanw  */
    313  1.2.2.3  nathanw static int
    314  1.2.2.3  nathanw ibm_mpcom_getcfg(ma, iobasep, irqp)
    315  1.2.2.3  nathanw 	struct mca_attach_args *ma;
    316  1.2.2.3  nathanw 	int *iobasep, *irqp;
    317  1.2.2.3  nathanw {
    318  1.2.2.3  nathanw 	int snum, pos2;
    319  1.2.2.3  nathanw 
    320  1.2.2.3  nathanw 	pos2 = mca_conf_read(ma->ma_mc, ma->ma_slot, 2);
    321  1.2.2.3  nathanw 
    322  1.2.2.3  nathanw 	/*
    323  1.2.2.3  nathanw 	 * For SERIAL mode, bit 4 has to be 0.
    324  1.2.2.3  nathanw 	 *
    325  1.2.2.3  nathanw 	 * POS register 2: (adf pos0)
    326  1.2.2.3  nathanw 	 * 7 6 5 4 3 2 1 0
    327  1.2.2.3  nathanw 	 *       0 \__/  \__ enable: 0=adapter disabled, 1=adapter enabled
    328  1.2.2.3  nathanw 	 *            \_____ Serial Configuration: XX=SERIAL_XX
    329  1.2.2.3  nathanw 	 */
    330  1.2.2.3  nathanw 
    331  1.2.2.3  nathanw 	if (pos2 & 0x10) {
    332  1.2.2.3  nathanw 		printf(": not set to SERIAL mode, ignored\n");
    333  1.2.2.3  nathanw 		return (1);
    334  1.2.2.3  nathanw 	}
    335  1.2.2.3  nathanw 
    336  1.2.2.3  nathanw 	snum = (pos2 & 0x0e) >> 1;
    337  1.2.2.3  nathanw 
    338  1.2.2.3  nathanw 	*iobasep = MCA_SERIAL[snum].iobase;
    339  1.2.2.3  nathanw 	*irqp = MCA_SERIAL[snum].irq;
    340  1.2.2.3  nathanw 
    341  1.2.2.3  nathanw 	return (0);
    342  1.2.2.3  nathanw }
    343