Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/xmi Initial support for the XMI bus on VAX, MIPS and...



details:   https://anonhg.NetBSD.org/src/rev/217118d4db48
branches:  trunk
changeset: 494471:217118d4db48
user:      ragge <ragge%NetBSD.org@localhost>
date:      Thu Jul 06 17:45:52 2000 +0000

description:
Initial support for the XMI bus on VAX, MIPS and Alpha systems.
Not completely finished yet.

diffstat:

 sys/dev/xmi/bi_xmi.c |   86 ++++++++++++++++++++++++++++++++++++
 sys/dev/xmi/xmi.c    |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++
 sys/dev/xmi/xmireg.h |   56 ++++++++++++++++++++++++
 sys/dev/xmi/xmivar.h |   71 ++++++++++++++++++++++++++++++
 4 files changed, 332 insertions(+), 0 deletions(-)

diffs (truncated from 348 to 300 lines):

diff -r 8437410059d1 -r 217118d4db48 sys/dev/xmi/bi_xmi.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/xmi/bi_xmi.c      Thu Jul 06 17:45:52 2000 +0000
@@ -0,0 +1,86 @@
+/*     $NetBSD: bi_xmi.c,v 1.1 2000/07/06 17:45:52 ragge Exp $ */
+
+/*
+ * Copyright (c) 2000 Ludd, University of Lule}, Sweden. 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 at Ludd, University of
+ *      Lule}, Sweden and its contributors.
+ * 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.
+ */
+
+
+/*
+ * DWMBA XMI-BI adapter.
+ */
+
+#include <sys/param.h>
+#include <sys/device.h>
+
+#include <machine/bus.h>
+
+#include <dev/xmi/xmireg.h>
+#include <dev/xmi/xmivar.h>
+
+#include <dev/bi/bireg.h>
+#include <dev/bi/bivar.h>
+
+#include "locators.h"
+
+static int
+bi_xmi_match(struct device *parent, struct cfdata *cf, void *aux)
+{
+       struct xmi_attach_args *xa = aux;
+
+       if (bus_space_read_2(xa->xa_iot, xa->xa_ioh, XMI_TYPE) != XMIDT_DWMBA)
+               return 0;
+
+       if (cf->cf_loc[XMICF_NODE] != XMICF_NODE_DEFAULT &&
+           cf->cf_loc[XMICF_NODE] != xa->xa_nodenr)
+               return 0;
+
+       return 1;
+}
+
+static void
+bi_xmi_attach(struct device *parent, struct device *self, void *aux)
+{
+       struct bi_softc *sc = (void *)self;
+       struct xmi_attach_args *xa = aux;
+
+       /*
+        * Fill in bus specific data.
+        */
+       sc->sc_addr = (bus_addr_t)BI_BASE(xa->xa_nodenr, 0);
+       sc->sc_iot = xa->xa_iot; /* No special I/O handling */
+       sc->sc_dmat = xa->xa_dmat; /* No special DMA handling either */
+       sc->sc_intcpu = xa->xa_intcpu;
+
+       bi_attach(sc);
+}
+
+struct cfattach bi_xmi_ca = {
+       sizeof(struct bi_softc), bi_xmi_match, bi_xmi_attach
+};
+
diff -r 8437410059d1 -r 217118d4db48 sys/dev/xmi/xmi.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/xmi/xmi.c Thu Jul 06 17:45:52 2000 +0000
@@ -0,0 +1,119 @@
+/*     $NetBSD: xmi.c,v 1.1 2000/07/06 17:45:52 ragge Exp $    */
+
+/*
+ * Copyright (c) 2000 Ludd, University of Lule}, Sweden. 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 at Ludd, University of
+ *      Lule}, Sweden and its contributors.
+ * 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.
+ */
+
+/*
+ * XMI specific routines.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/bus.h>
+#include <machine/cpu.h>
+
+#include <dev/xmi/xmireg.h>
+#include <dev/xmi/xmivar.h>
+
+static int xmi_print(void *, const char *);
+
+struct xmi_list xmi_list[] = {
+       {XMIDT_KA62, 0, "ka6200"},
+       {XMIDT_KA64, 1, "ka6400"},
+       {XMIDT_KA65, 0, "ka6500"},
+       {XMIDT_KA66, 0, "ka6600"},
+       {XMIDT_MS62, 1, "ms62"},
+       {XMIDT_DWMBA, 1, "dwmba"},
+       {0,0,0}
+};
+
+int
+xmi_print(void *aux, const char *name)
+{
+       struct xmi_attach_args *xa = aux;
+       struct xmi_list *xl;
+
+       for (xl = &xmi_list[0]; xl->xl_nr; xl++)
+               if (xl->xl_nr == bus_space_read_2(xa->xa_iot, xa->xa_ioh, 0))
+                       break;
+
+       if (name) {
+               if (xl->xl_nr == 0)
+                       printf("unknown device 0x%x",
+                           bus_space_read_2(xa->xa_iot, xa->xa_ioh, 0));
+               else
+                       printf(xl->xl_name);
+               printf(" at %s", name);
+       }
+       printf(" node %d", xa->xa_nodenr);
+       return xl->xl_havedriver ? UNCONF : UNSUPP;
+}
+
+static int lastiv = 0;
+
+void
+xmi_attach(struct xmi_softc *sc)
+{
+       struct xmi_attach_args xa;
+       int nodenr;
+
+       printf("\n");
+
+       xa.xa_iot = sc->sc_iot;
+       xa.xa_busnr = sc->sc_busnr;
+       xa.xa_dmat = sc->sc_dmat;
+       xa.xa_intcpu = sc->sc_intcpu;
+       /*
+        * Interrupt numbers. All vectors from 256-512 are free, use
+        * them for XMI devices and just count them up.
+        * Above 512 are only interrupt vectors for unibus devices.
+        *
+        * The XMI nodespace is giant in size. Only map in the first
+        * page here and map more (if needed) in the device itself.
+        */
+       for (nodenr = 0; nodenr < NNODEXMI; nodenr++) {
+               if (bus_space_map(sc->sc_iot, sc->sc_addr + XMI_NODE(nodenr),
+                   NBPG, 0, &xa.xa_ioh)) {
+                       printf("xmi_attach: bus_space_map failed, node %d\n", 
+                           nodenr);
+                       return;
+               }
+               if (badaddr((caddr_t)xa.xa_ioh, 4)) {
+                       bus_space_unmap(sc->sc_iot, xa.xa_ioh, NBPG);
+                       continue;
+               }
+               xa.xa_nodenr = nodenr;
+               xa.xa_ivec = 256 + lastiv;
+               lastiv += 4;
+               config_found(&sc->sc_dev, &xa, xmi_print);
+       }
+}
diff -r 8437410059d1 -r 217118d4db48 sys/dev/xmi/xmireg.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/xmi/xmireg.h      Thu Jul 06 17:45:52 2000 +0000
@@ -0,0 +1,56 @@
+/*     $NetBSD: xmireg.h,v 1.1 2000/07/06 17:45:53 ragge Exp $ */
+
+/*
+ * Copyright (c) 2000 Ludd, University of Lule}, Sweden. 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 at Ludd, University of
+ *      Lule}, Sweden and its contributors.
+ * 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.
+ */
+
+/*
+ * XMI node definitions.
+ */
+
+/*
+ * XMI node addresses
+ */
+#define        XMI_NODESIZE    0x80000         /* Size of one XMI node (512k) */
+#define        XMI_NODE(node)  (XMI_NODESIZE * (node))
+#define        NNODEXMI        16      /* 16 nodes per BI */
+
+/* XMI generic register offsets */
+#define        XMI_TYPE        0
+#define        XMI_BUSERR      4
+#define        XMI_FAIL        8
+
+/* Types of devices that may exist */
+#define        XMIDT_KA62      0x8001          /* VAX 6200 CPU */
+#define        XMIDT_KA64      0x8082          /* VAX 6400 CPU */
+#define        XMIDT_KA65      0x8080          /* VAX 6500 CPU */
+#define        XMIDT_KA66      0x8083          /* VAX 6600 CPU */
+#define        XMIDT_ISIS      0x8081          /* MIPS R3000 CPU */
+#define        XMIDT_MS62      0x4001          /* Memory */
+#define        XMIDT_DWMBA     0x2001          /* XMI to BI adapter */
diff -r 8437410059d1 -r 217118d4db48 sys/dev/xmi/xmivar.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/xmi/xmivar.h      Thu Jul 06 17:45:52 2000 +0000
@@ -0,0 +1,71 @@
+/*     $NetBSD: xmivar.h,v 1.1 2000/07/06 17:45:52 ragge Exp $ */
+
+/*
+ * Copyright (c) 2000 Ludd, University of Lule}, Sweden. 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 at Ludd, University of
+ *      Lule}, Sweden and its contributors.
+ * 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.



Home | Main Index | Thread Index | Old Index