Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/mca Add support for IBM Multi-Protocol Communication...



details:   https://anonhg.NetBSD.org/src/rev/2cd9948835d3
branches:  trunk
changeset: 508811:2cd9948835d3
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Fri Apr 20 11:19:27 2001 +0000

description:
Add support for IBM Multi-Protocol Communications Adapter. Card provided
by Hans Hubner <hans%huebner.org@localhost>.
We only support the card in "serial" mode. BISYNC nor SDLC modes are
not supported.

diffstat:

 sys/dev/mca/com_mca.c |  44 ++++++++++++++++++++++++++++++++++++++++----
 sys/dev/mca/mcadevs   |   4 ++--
 2 files changed, 42 insertions(+), 6 deletions(-)

diffs (95 lines):

diff -r fd08d95b2b63 -r 2cd9948835d3 sys/dev/mca/com_mca.c
--- a/sys/dev/mca/com_mca.c     Fri Apr 20 11:19:16 2001 +0000
+++ b/sys/dev/mca/com_mca.c     Fri Apr 20 11:19:27 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: com_mca.c,v 1.3 2001/04/20 10:03:35 jdolecek Exp $     */
+/*     $NetBSD: com_mca.c,v 1.4 2001/04/20 11:19:27 jdolecek Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -111,6 +111,7 @@
 
 static int ibm_modem_getcfg __P((struct mca_attach_args *, int *, int *));
 static int neocom1_getcfg __P((struct mca_attach_args *, int *, int *));
+static int ibm_mpcom_getcfg __P((struct mca_attach_args *, int *, int *));
 
 struct cfattach com_mca_ca = {
        sizeof(struct com_mca_softc), com_mca_probe, com_mca_attach
@@ -125,6 +126,8 @@
        { MCA_PRODUCT_IBM_MOD,  "IBM Internal Modem",   ibm_modem_getcfg },
        { MCA_PRODUCT_NEOCOM1,  "NeoTecH Single RS-232 Async. Adapter, SM110",
                neocom1_getcfg },
+       { MCA_PRODUCT_IBM_MPCOM,"IBM Multi-Protocol Communications Adapter",
+               ibm_mpcom_getcfg },
        { 0,                    NULL,                   NULL },
 };
 
@@ -171,10 +174,8 @@
        cpp = com_mca_lookup(ma->ma_id);
 
        /* get iobase and irq */
-       if ((*cpp->cp_getcfg)(ma, &iobase, &irq)) {
-               printf(": com_mca_attach: could not get config\n");
+       if ((*cpp->cp_getcfg)(ma, &iobase, &irq))
                return;
-       }       
 
        if (bus_space_map(ma->ma_iot, iobase, COM_NPORTS, 0, &sc->sc_ioh)) {
                printf(": can't map i/o space\n");
@@ -301,3 +302,38 @@
 
        return (0);
 }
+
+/*
+ * Get configuration for IBM Multi-Protocol Communications Adapter.
+ * We only support SERIAL mode, bail out if set to SDLC or BISYNC.
+ */
+static int
+ibm_mpcom_getcfg(ma, iobasep, irqp)
+       struct mca_attach_args *ma;
+       int *iobasep, *irqp;
+{
+       int snum, pos2;
+
+       pos2 = mca_conf_read(ma->ma_mc, ma->ma_slot, 2);
+
+       /*
+        * For SERIAL mode, bit 4 has to be 0.
+        *
+        * POS register 2: (adf pos0)
+        * 7 6 5 4 3 2 1 0
+        *       0 \__/  \__ enable: 0=adapter disabled, 1=adapter enabled
+        *            \_____ Serial Configuration: XX=SERIAL_XX 
+        */ 
+       
+       if (pos2 & 0x10) {
+               printf(": not set to SERIAL mode, ignored\n");
+               return (1);
+       }
+
+       snum = (pos2 & 0x0e) >> 1;
+
+       *iobasep = MCA_SERIAL[snum].iobase;
+       *irqp = MCA_SERIAL[snum].irq;
+
+       return (0);
+}
diff -r fd08d95b2b63 -r 2cd9948835d3 sys/dev/mca/mcadevs
--- a/sys/dev/mca/mcadevs       Fri Apr 20 11:19:16 2001 +0000
+++ b/sys/dev/mca/mcadevs       Fri Apr 20 11:19:27 2001 +0000
@@ -1,4 +1,4 @@
-$NetBSD: mcadevs,v 1.12 2001/04/20 10:03:35 jdolecek Exp $
+$NetBSD: mcadevs,v 1.13 2001/04/20 11:19:27 jdolecek Exp $
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -349,7 +349,7 @@
 product 0x8FDA "IBM XGA/XGA-2 Display Adapter"                         [2]
 product 0x8FDB "IBM XGA/XGA-2 Display Adapter"                         [2]
 product 0xDDFF IBM_ESDIC "IBM ESDI Fixed Disk Controller"              [3]
-product 0xDEFF "IBM Multi-Protocol Communications Adapter"             [3]
+product 0xDEFF IBM_MPCOM "IBM Multi-Protocol Communications Adapter"   [3]
 product 0xDF7F "IBM 3363 Optical Disk Adapter"                         [5]
 product 0xDF9F IBM_ESDIC_IG "IBM Integ. ESDI Fixed Disk & Controller"  [3]
 product 0xDFBF "IBM 6157 Streaming Tape Adapter"                       [5]



Home | Main Index | Thread Index | Old Index