Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/newsmips First cut of news5000 support.



details:   https://anonhg.NetBSD.org/src/rev/c7766628dd14
branches:  trunk
changeset: 479816:c7766628dd14
user:      tsubai <tsubai%NetBSD.org@localhost>
date:      Wed Dec 22 05:55:24 1999 +0000

description:
First cut of news5000 support.
Mostly from SHIMIZU Ryo <dejiko%di.gi.charat.org@localhost>.

diffstat:

 sys/arch/newsmips/apbus/apbus.c             |   253 +++++
 sys/arch/newsmips/apbus/apbus_subr.c        |   119 ++
 sys/arch/newsmips/apbus/apbusvar.h          |    50 +
 sys/arch/newsmips/apbus/clock_ap.c          |   155 +++
 sys/arch/newsmips/apbus/if_sn.c             |  1190 +++++++++++++++++++++++++++
 sys/arch/newsmips/apbus/if_sn_ap.c          |   181 ++++
 sys/arch/newsmips/apbus/if_snreg.h          |   264 +++++
 sys/arch/newsmips/apbus/if_snvar.h          |   206 ++++
 sys/arch/newsmips/apbus/zs_ap.c             |   514 +++++++++++
 sys/arch/newsmips/conf/DEJIKO               |    51 +
 sys/arch/newsmips/conf/GENERIC              |    31 +-
 sys/arch/newsmips/conf/files.newsmips       |    57 +-
 sys/arch/newsmips/dev/clock_hb.c            |   147 +++
 sys/arch/newsmips/dev/fb_sub.c              |     3 +-
 sys/arch/newsmips/dev/zs.c                  |   446 +---------
 sys/arch/newsmips/dev/zs_hb.c               |   488 +++++++++++
 sys/arch/newsmips/include/Makefile          |    17 +-
 sys/arch/newsmips/include/adrsmap.h         |   162 +++-
 sys/arch/newsmips/include/cpu.h             |    19 +-
 sys/arch/newsmips/include/intr.h            |     6 +-
 sys/arch/newsmips/newsmips/autoconf.c       |    13 +-
 sys/arch/newsmips/newsmips/clock.c          |   106 +-
 sys/arch/newsmips/newsmips/clockvar.h       |    35 +
 sys/arch/newsmips/newsmips/conf.c           |     5 +-
 sys/arch/newsmips/newsmips/cpu_cons.c       |    61 +-
 sys/arch/newsmips/newsmips/locore_machdep.S |   225 +----
 sys/arch/newsmips/newsmips/machdep.c        |   235 +---
 sys/arch/newsmips/newsmips/machid.h         |     4 +-
 sys/arch/newsmips/newsmips/mainbus.c        |    19 +-
 29 files changed, 4129 insertions(+), 933 deletions(-)

diffs (truncated from 5716 to 300 lines):

diff -r d8744cd89c7d -r c7766628dd14 sys/arch/newsmips/apbus/apbus.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/newsmips/apbus/apbus.c   Wed Dec 22 05:55:24 1999 +0000
@@ -0,0 +1,253 @@
+/*     $NetBSD: apbus.c,v 1.1 1999/12/22 05:55:24 tsubai Exp $ */
+
+/*-
+ * Copyright (C) 1999 SHIMIZU Ryo.  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. 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.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/adrsmap.h>
+#include <machine/autoconf.h>
+#include <newsmips/apbus/apbusvar.h>
+
+static int  apbusmatch __P((struct device *, struct cfdata *, void *));
+static void apbusattach __P((struct device *, struct device *, void *));
+static int apbusprint __P((void *, const char *));
+/* static void *aptokseg0 __P((void *)); */
+
+#define        MAXAPDEVNUM     32
+
+struct apbus_softc {
+       struct device apbs_dev;
+};
+
+struct cfattach ap_ca = {
+       sizeof(struct apbus_softc), apbusmatch, apbusattach
+};
+
+#define        APBUS_DEVNAMELEN        16
+
+struct ap_intrhand {
+       int ai_mask;
+       int ai_priority;
+       void (*ai_func) __P((void*));   /* function */
+       void *ai_aux;                   /* softc */
+       char ai_name[APBUS_DEVNAMELEN];
+       int ai_ctlno;
+};
+
+#define        NLEVEL  2
+#define        NBIT    16
+
+static struct ap_intrhand apintr[NLEVEL][NBIT];
+
+static int
+apbusmatch(parent, cfdata, aux)
+        struct device *parent;
+        struct cfdata *cfdata;
+        void *aux;
+{
+       struct confargs *ca = aux;
+
+       if (strcmp(ca->ca_name, "ap") != 0)
+               return 0;
+
+       return 1;
+}
+
+
+static void
+apbusattach(parent, self, aux)
+        struct device *parent;
+        struct device *self;
+        void *aux;
+{
+       struct apbus_attach_args child;
+       struct apbus_device *apdev;
+       struct apbus_ctl *apctl;
+
+       *(volatile u_int*)(NEWS5000_APBUS_INTSTAT) = 0xffffffff;
+       *(volatile u_int*)(NEWS5000_APBUS_INTMASK) = NEWS5000_INTAPBUS_ALL;
+
+       *(volatile u_int*)(NEWS5000_APBUS_CONFIG) = 0x04;
+       *(volatile u_int *)(NEWS5000_APBUS_DUMCOH) =
+                                      NEWS5000_APBUS_DEVICE_DMAC3 |
+                                      NEWS5000_APBUS_DEVICE_SONIC |
+                                      NEWS5000_APBUS_DEVICE_ALLSLOT;
+
+       *(volatile u_int*)NEWS5000_INTMASK0 = NEWS5000_INT0_ALL;
+       *(volatile u_int*)NEWS5000_INTMASK1 = NEWS5000_INT1_ALL;
+
+       printf("\n");
+
+       /*
+        * get first ap-device
+        */
+       apdev = apbus_lookupdev(NULL);
+
+       /*
+        * trace device chain
+        */
+       while (apdev) {
+               apctl = apdev->apbd_ctl;
+
+               /*
+                * probe physical device only
+                * (no pseudo device)
+                */
+               if (apctl && apctl->apbc_hwbase) {
+                       /*
+                        * ... and, all units
+                        */
+                       while (apctl) {
+                               /* make apbus_attach_args for devices */
+                               child.apa_name = apdev->apbd_name;
+                               child.apa_ctlnum = apctl->apbc_ctlno;
+                               child.apa_slotno = apctl->apbc_sl;
+                               child.apa_hwbase = apctl->apbc_hwbase;
+
+#if 0
+printf("config_found: name = %s\n", child.apa_name);
+printf("            : unit = %d\n", child.apa_ctlnum);
+printf("            : slot = %d\n", child.apa_slotno);
+printf("            : unit = 0x%08lx\n", child.apa_hwbase);
+#endif
+
+                               config_found(self, &child, apbusprint);
+
+                               apctl = apctl->apbc_link;
+                       }
+               }
+
+               apdev = apdev->apbd_link;
+       }
+}
+
+int
+apbusprint(aux, pnp)
+       void *aux;
+       const char *pnp;
+{
+       struct apbus_attach_args *a = aux;
+
+       if (pnp)
+               printf("%s at %s slot%d addr 0x%lx",
+                       a->apa_name, pnp, a->apa_slotno, a->apa_hwbase);
+
+       return UNCONF;
+}
+
+#if 0
+void *
+aptokseg0(va)
+       void *va;
+{
+       vaddr_t addr = (vaddr_t)va;
+
+       if (addr >= 0xfff00000) {
+               addr -= 0xfff00000;
+               addr += physmem << PGSHIFT;
+               addr += 0x80000000;
+               va = (void *)addr;
+       }
+       return va;
+}
+#endif
+
+void
+apbus_wbflush()
+{
+       volatile int *wbflush = (int *)NEWS5000_WB;
+
+       (void)*wbflush;
+}
+
+void
+apbus_intr_init()
+{
+       bzero(&apintr[0][0],sizeof(apintr));
+}
+
+/*
+ * called by hardware interrupt routine
+ */
+int
+apbus_intr_call(level, stat)
+       int level;
+       int stat;
+{
+       int i;
+       int nintr = 0;
+       struct ap_intrhand *aip = &apintr[level][0];
+
+       for(i = 0; i < NBIT; i++) {
+               if (aip->ai_mask & stat) {
+                       (*aip->ai_func)(aip->ai_aux);
+                       nintr++;
+               }
+               aip++;
+       }
+       return nintr;
+}
+
+/*
+ * register device interrupt routine
+ */
+void *
+apbus_intr_establish(level, mask, priority, func, aux, name, ctlno)
+       int level;
+       int mask;
+       int priority;
+       void (*func) __P((void *));
+       void *aux;
+       char *name;
+       int ctlno;
+{
+       int i;
+       int nbit = -1;
+       struct ap_intrhand *aip;
+
+       for (i = 0; i < NBIT; i++) {
+               if (mask & (1 << i)) {
+                       nbit = i;
+                       break;
+               }
+       }
+
+       if (nbit == -1)
+               panic("apbus_intr_establish");
+
+       aip = &apintr[level][nbit];
+       aip->ai_mask = 1 << nbit;
+       aip->ai_priority = priority;
+       aip->ai_func = func;
+       aip->ai_aux = aux;
+       strncpy(aip->ai_name, name, APBUS_DEVNAMELEN-1);
+       aip->ai_ctlno = ctlno;
+
+       return (void *)aip;
+}
diff -r d8744cd89c7d -r c7766628dd14 sys/arch/newsmips/apbus/apbus_subr.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/newsmips/apbus/apbus_subr.c      Wed Dec 22 05:55:24 1999 +0000
@@ -0,0 +1,119 @@
+/*     $NetBSD: apbus_subr.c,v 1.1 1999/12/22 05:55:24 tsubai Exp $    */
+
+/*-
+ * Copyright (C) 1999 SHIMIZU Ryo.  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. 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.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+
+#include <newsmips/apbus/apbusvar.h>
+
+void *
+apbus_device_to_hwaddr(apbus_dev)
+       struct apbus_device *apbus_dev;
+{
+       struct apbus_ctl *ctl;
+



Home | Main Index | Thread Index | Old Index