Source-Changes-HG archive

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

[src/trunk]: src/sys/dev MI part of MicroChannel Architecture bus support



details:   https://anonhg.NetBSD.org/src/rev/141aac1ade8b
branches:  trunk
changeset: 486029:141aac1ade8b
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Thu May 11 15:42:00 2000 +0000

description:
MI part of MicroChannel Architecture bus support

This work is based on code written by Scott D. Telford, the IBM
Token Ring card attachment was written by Gregory McGarry.

XXX this is still very experimental and development version; use at your
XXX own risk

diffstat:

 sys/dev/isa/fd.c             |   31 +++-
 sys/dev/mca/LINKS            |    2 +
 sys/dev/mca/Makefile.mcadevs |   15 +
 sys/dev/mca/TODO             |   15 +
 sys/dev/mca/aha_mca.c        |  150 +++++++++++++++++
 sys/dev/mca/devlist2h.awk    |  113 ++++++++++++
 sys/dev/mca/files.mca        |   33 +++
 sys/dev/mca/if_tr_mca.c      |  212 ++++++++++++++++++++++++
 sys/dev/mca/mca.c            |  168 +++++++++++++++++++
 sys/dev/mca/mca_subr.c       |  107 ++++++++++++
 sys/dev/mca/mcadevs          |  374 +++++++++++++++++++++++++++++++++++++++++++
 sys/dev/mca/mcadevs.h        |   42 ++++
 sys/dev/mca/mcadevs_data.h   |  358 +++++++++++++++++++++++++++++++++++++++++
 sys/dev/mca/mcareg.h         |   55 ++++++
 sys/dev/mca/mcavar.h         |   82 +++++++++
 15 files changed, 1754 insertions(+), 3 deletions(-)

diffs (truncated from 1846 to 300 lines):

diff -r 73dfb695e3c3 -r 141aac1ade8b sys/dev/isa/fd.c
--- a/sys/dev/isa/fd.c  Thu May 11 15:26:23 2000 +0000
+++ b/sys/dev/isa/fd.c  Thu May 11 15:42:00 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.4 2000/05/02 03:32:09 thorpej Exp $   */
+/*     $NetBSD: fd.c,v 1.5 2000/05/11 15:42:00 jdolecek Exp $  */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -141,8 +141,15 @@
 #include <dev/isa/fdcvar.h>
 
 #if defined(__i386__)
+
 #include <dev/ic/mc146818reg.h>                        /* for NVRAM access */
 #include <i386/isa/nvram.h>
+
+#include "mca.h"
+#if NMCA > 0
+#include <machine/mca_machdep.h>               /* for MCA_system */
+#endif
+
 #endif /* __i386__ */
 
 #define FDUNIT(dev)    (minor(dev) / 8)
@@ -176,6 +183,14 @@
        char    *name;
 };
 
+#if NMCA > 0
+/* MCA - specific entries */
+struct fd_type mca_fd_types[] = {
+       { 18,2,36,2,0xff,0x0f,0x1b,0x6c,80,2880,1,FDC_500KBPS,0xf6,1, "1.44MB"    }, /* 1.44MB diskette - XXX try 16ms step rate */
+       {  9,2,18,2,0xff,0x4f,0x2a,0x50,80,1440,1,FDC_250KBPS,0xf6,1, "720KB"    }, /* 3.5 inch 720kB diskette - XXX try 24ms step rate */
+};
+#endif /* NMCA > 0 */
+
 /* The order of entries in the following table is important -- BEWARE! */
 struct fd_type fd_types[] = {
        { 18,2,36,2,0xff,0xcf,0x1b,0x6c,80,2880,1,FDC_500KBPS,0xf6,1, "1.44MB"    }, /* 1.44MB diskette */
@@ -472,11 +487,21 @@
        case NVRAM_DISKETTE_TYPE6:
                /* XXX We really ought to handle 2.88MB format. */
        case NVRAM_DISKETTE_144M:
-               return &fd_types[0];
+#if NMCA > 0
+               if (MCA_system)
+                       return &mca_fd_types[0];
+               else
+#endif /* NMCA > 0 */
+                       return &fd_types[0];
        case NVRAM_DISKETTE_360K:
                return &fd_types[3];
        case NVRAM_DISKETTE_720K:
-               return &fd_types[4];
+#if NMCA > 0
+               if (MCA_system)
+                       return &mca_fd_types[1];
+               else
+#endif /* NMCA > 0 */
+                       return &fd_types[4];
        default:
                printf("%s: drive %d: unknown device type 0x%x\n",
                    fdc, drive, type);
diff -r 73dfb695e3c3 -r 141aac1ade8b sys/dev/mca/LINKS
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/mca/LINKS Thu May 11 15:42:00 2000 +0000
@@ -0,0 +1,2 @@
+IBM - PS/2 MicroChannel POSID - ADF files
+http://servicepac.mainz.ibm.com/eprmhtml/epradf/adf0_4.htm
diff -r 73dfb695e3c3 -r 141aac1ade8b sys/dev/mca/Makefile.mcadevs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/mca/Makefile.mcadevs      Thu May 11 15:42:00 2000 +0000
@@ -0,0 +1,15 @@
+#      $NetBSD: Makefile.mcadevs,v 1.1 2000/05/11 15:42:02 jdolecek Exp $
+#
+# The proper procedure is
+#
+# 1.) Change "src/sys/dev/mca/mcadevs".
+# 2.) Commit "src/sys/dev/mca/mcadevs".
+# 3.) Execute "make -f Makefile.mcadevs" in "src/sys/dev/mca".
+# 4.) Commit "src/sys/dev/mca/mcadevs.h" and "src/sys/dev/mca/mcadevs_data.h".
+
+
+AWK?=  awk
+
+mcadevs.h mcadevs_data.h: mcadevs devlist2h.awk
+       /bin/rm -f mcadevs.h mcadevs_data.h
+       ${AWK} -f devlist2h.awk mcadevs
diff -r 73dfb695e3c3 -r 141aac1ade8b sys/dev/mca/TODO
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/mca/TODO  Thu May 11 15:42:00 2000 +0000
@@ -0,0 +1,15 @@
+# $NetBSD: TODO,v 1.1 2000/05/11 15:42:03 jdolecek Exp $
+
+Bugs:
+* i386: detect the existence of MCA bus by BIOS call
+* i386: make isa/clock.c parse PS/2 CMOS correctly
+* i386: keyboard freezes when booting from floppy in fd_mountroothook
+       (timing issue ? works OK if I break to ddb before the mountroot hook
+       is executed)
+
+Projects:
+* bus_dma(8) support (primarily for AHA-1650)
+* 3Com 3c507 driver (prolly port of ef driver - originally, 1.3 ie driver
+       has been ported in MCA release 2.1 by Scott Telford, the ISA
+       attachment was then (after 1.3) split into ex, ef, ai)
+* ESDI support
diff -r 73dfb695e3c3 -r 141aac1ade8b sys/dev/mca/aha_mca.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/mca/aha_mca.c     Thu May 11 15:42:00 2000 +0000
@@ -0,0 +1,150 @@
+/*     $NetBSD: aha_mca.c,v 1.1 2000/05/11 15:42:04 jdolecek Exp $     */
+
+/*
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-1999 Scott D. Telford.
+ * Copyright (c) 1994, 1996 Charles M. Hannum.  All rights reserved.
+ * Portions:
+ *
+ * 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 product includes software developed by Charles M. Hannum.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+/*
+ * Originally written by Julian Elischer (julian%tfs.com@localhost)
+ * for TRW Financial Systems for use under the MACH(2.5) operating system.
+ *
+ * TRW Financial Systems, in accordance with their agreement with Carnegie
+ * Mellon University, makes this software available to CMU to distribute
+ * or use in any manner that they see fit as long as this message is kept with
+ * the software. For this reason TFS also grants any other persons or
+ * organisations permission to use or modify this software.
+ *
+ * TFS supplies this software to be publicly redistributed
+ * on the understanding that TFS is not responsible for the correct
+ * functioning of this software in any circumstances.
+ */
+
+/*
+ * AHA-1640 MCA bus code by Scott Telford
+ */
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/bus.h>
+#include <machine/intr.h>
+
+#include <dev/scsipi/scsi_all.h>
+#include <dev/scsipi/scsipi_all.h>
+#include <dev/scsipi/scsiconf.h>
+
+#include <dev/isa/isavar.h>
+#include <dev/isa/isadmavar.h>
+
+#include <dev/ic/ahareg.h>
+#include <dev/ic/ahavar.h>
+
+#include <dev/mca/mcareg.h>
+#include <dev/mca/mcavar.h>
+#include <dev/mca/mcadevs.h>
+
+#define        AHA_ISA_IOSIZE  4
+
+int    aha_mca_probe __P((struct device *, struct cfdata *, void *));
+void   aha_mca_attach __P((struct device *, struct device *, void *));
+
+struct cfattach aha_mca_ca = {
+       sizeof(struct aha_softc), aha_mca_probe, aha_mca_attach
+};
+
+
+int
+aha_mca_probe(parent, match, aux)
+       struct device *parent;
+       struct cfdata *match;
+       void *aux;
+{
+       register struct mca_attach_args *ma = aux;
+
+       switch(ma->ma_id) {
+       case MCA_PRODUCT_AHA1640:
+               return 1;
+       }
+
+       return 0;
+}
+
+
+/*
+ * Attach all the sub-devices we can find
+ */
+void
+aha_mca_attach(parent, self, aux)
+       struct device *parent, *self;
+       void *aux;
+{
+       struct mca_attach_args *ma = aux;
+       struct aha_softc *sc = (void *)self;
+       bus_space_tag_t iot = ma->ma_iot;
+       bus_space_handle_t ioh;
+       struct aha_probe_data apd;
+       mca_chipset_tag_t mc = ma->ma_mc;
+       bus_addr_t iobase;
+
+       printf("\n");
+
+       iobase=((ma->ma_pos[3] & 0x03) << 8) + 0x30 +
+               ((ma->ma_pos[3] & 0x40) >> 4);
+
+       if (bus_space_map(iot, iobase, AHA_ISA_IOSIZE, 0, &ioh)) {
+               printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname);
+               return;
+       }
+
+       sc->sc_iot = iot;
+       sc->sc_ioh = ioh;
+       sc->sc_dmat = ma->ma_dmat;
+
+       apd.sc_irq=(ma->ma_pos[4] & 0x7) + 8;
+       apd.sc_drq=ma->ma_pos[5] & 0xf;
+       apd.sc_scsi_dev=(ma->ma_pos[4] & 0xe0) >> 5;
+
+#ifdef notyet
+       if (apd.sc_drq != -1)
+               isa_dmacascade(mc, apd.sc_drq);
+#endif
+
+       sc->sc_ih = mca_intr_establish(mc, apd.sc_irq, IPL_BIO, aha_intr, sc);
+       if (sc->sc_ih == NULL) {
+               printf("%s: couldn't establish interrupt\n",
+                   sc->sc_dev.dv_xname);
+               return;
+       }
+
+       aha_attach(sc, &apd);
+}
diff -r 73dfb695e3c3 -r 141aac1ade8b sys/dev/mca/devlist2h.awk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/mca/devlist2h.awk Thu May 11 15:42:00 2000 +0000
@@ -0,0 +1,113 @@
+#! /usr/bin/awk -f
+#      $NetBSD: devlist2h.awk,v 1.1 2000/05/11 15:42:04 jdolecek Exp $
+#
+# Copyright (c) 1995, 1996 Christopher G. Demetriou
+# 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 product includes software developed by Christopher G. Demetriou.
+# 4. The name of the author may not be used to endorse or promote products
+#    derived from this software without specific prior written permission
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+#
+
+# Adapted for MCA needs by Jaromir Dolecek.
+



Home | Main Index | Thread Index | Old Index