Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hp700 restructure autoconf for [ABCDJK]-class machi...



details:   https://anonhg.NetBSD.org/src/rev/d38556624ab7
branches:  trunk
changeset: 555461:d38556624ab7
user:      chs <chs%NetBSD.org@localhost>
date:      Tue Nov 18 04:04:42 2003 +0000

description:
restructure autoconf for [ABCDJK]-class machines.  add phantomas bus.
adapted from OpenBSD by Jochen Kunz.

diffstat:

 sys/arch/hp700/conf/GENERIC       |    6 +-
 sys/arch/hp700/conf/files.hp700   |   10 ++-
 sys/arch/hp700/dev/lasi.c         |    9 +-
 sys/arch/hp700/dev/mem.c          |  105 +++++++++++++++++++++++++++------
 sys/arch/hp700/dev/phantomas.c    |   80 ++++++++++++++++++++++++++
 sys/arch/hp700/gsc/gscbus.c       |    6 +-
 sys/arch/hp700/hp700/autoconf.c   |  116 +++++++++++++++++++++++++++++++------
 sys/arch/hp700/hp700/mainbus.c    |   98 +++++++++++++++++++++++++++----
 sys/arch/hp700/include/autoconf.h |   20 +++++-
 sys/arch/hp700/include/pdc.h      |   23 ++++++-
 10 files changed, 402 insertions(+), 71 deletions(-)

diffs (truncated from 790 to 300 lines):

diff -r 9a5884df49e4 -r d38556624ab7 sys/arch/hp700/conf/GENERIC
--- a/sys/arch/hp700/conf/GENERIC       Tue Nov 18 04:03:32 2003 +0000
+++ b/sys/arch/hp700/conf/GENERIC       Tue Nov 18 04:04:42 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.16 2003/08/31 01:27:18 chs Exp $
+# $NetBSD: GENERIC,v 1.17 2003/11/18 04:04:42 chs Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.16 $"
+#ident                 "GENERIC-$Revision: 1.17 $"
 
 maxusers       32              # estimated number of users
 
@@ -200,6 +200,8 @@
 #vmeb* at mainbus0 irq ?       # VME bus adapter
 #dino* at mainbus0 irq ?       # PCI bus bridge
 pdc0   at mainbus0             # PDC/IODC wrapper for boot console
+phantomas0     at mainbus0     # Phantom PseudoBC GSC+ Port
+lasi*  at phantomas0           # LASI on [ABCJ?]*
 
 # GSC bus support
 gsc*   at lasi?                # 712
diff -r 9a5884df49e4 -r d38556624ab7 sys/arch/hp700/conf/files.hp700
--- a/sys/arch/hp700/conf/files.hp700   Tue Nov 18 04:03:32 2003 +0000
+++ b/sys/arch/hp700/conf/files.hp700   Tue Nov 18 04:04:42 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.hp700,v 1.6 2003/08/31 01:55:27 chs Exp $
+#      $NetBSD: files.hp700,v 1.7 2003/11/18 04:04:42 chs Exp $
 #
 #      $OpenBSD: files.hp700,v 1.31 2001/06/26 02:41:25 mickey Exp $
 #
@@ -79,10 +79,16 @@
 attach fpu at mainbus
 file   arch/hp700/dev/fpu.c            fpu
 
+# Phantom PseudoBC GSC+ Port
+device phantomas {}
+attach phantomas at mainbus
+file   arch/hp700/dev/phantomas.c      phantomas
+
 # 1FT1-0002, 1FU2-0002
 # as goes w/ 7100LC, 7300LC, 7200, 8000, 8200, 8500
 device lasi: gscbus
-attach lasi at mainbus
+attach lasi at mainbus with lasi_mainbus
+attach lasi at phantomas with lasi_phantomas
 file   arch/hp700/dev/lasi.c           lasi
 
 # all the older systems
diff -r 9a5884df49e4 -r d38556624ab7 sys/arch/hp700/dev/lasi.c
--- a/sys/arch/hp700/dev/lasi.c Tue Nov 18 04:03:32 2003 +0000
+++ b/sys/arch/hp700/dev/lasi.c Tue Nov 18 04:04:42 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lasi.c,v 1.6 2003/07/15 02:29:24 lukem Exp $   */
+/*     $NetBSD: lasi.c,v 1.7 2003/11/18 04:04:42 chs Exp $     */
 
 /*     $OpenBSD: lasi.c,v 1.4 2001/06/09 03:57:19 mickey Exp $ */
 
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lasi.c,v 1.6 2003/07/15 02:29:24 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lasi.c,v 1.7 2003/11/18 04:04:42 chs Exp $");
 
 #undef LASIDEBUG
 
@@ -82,7 +82,10 @@
 int    lasimatch __P((struct device *, struct cfdata *, void *));
 void   lasiattach __P((struct device *, struct device *, void *));
 
-CFATTACH_DECL(lasi, sizeof(struct lasi_softc),
+CFATTACH_DECL(lasi_mainbus, sizeof(struct lasi_softc),
+    lasimatch, lasiattach, NULL, NULL);
+
+CFATTACH_DECL(lasi_phantomas, sizeof(struct lasi_softc),
     lasimatch, lasiattach, NULL, NULL);
 
 /*
diff -r 9a5884df49e4 -r d38556624ab7 sys/arch/hp700/dev/mem.c
--- a/sys/arch/hp700/dev/mem.c  Tue Nov 18 04:03:32 2003 +0000
+++ b/sys/arch/hp700/dev/mem.c  Tue Nov 18 04:04:42 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mem.c,v 1.7 2003/11/01 18:23:37 matt Exp $     */
+/*     $NetBSD: mem.c,v 1.8 2003/11/18 04:04:42 chs Exp $      */
 
 /*     $OpenBSD: mem.c,v 1.5 2001/05/05 20:56:36 art Exp $     */
 
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.7 2003/11/01 18:23:37 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.8 2003/11/18 04:04:42 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -104,10 +104,50 @@
 #include <hp700/dev/cpudevs.h>
 #include <hp700/dev/viper.h>
 
+/* registers on the PCXL2 MIOC */
+struct l2_mioc {
+       uint32_t        pad[0x20];      /* 0x000 */
+       uint32_t        mioc_control;   /* 0x080 MIOC control bits */
+       uint32_t        mioc_status;    /* 0x084 MIOC status bits */
+       uint32_t        pad1[6];        /* 0x088 */
+       uint32_t        sltcv;          /* 0x0a0 L2 cache control */
+#define SLTCV_AVWL     0x00002000      /* extra cycle for addr valid write low */
+#define SLTCV_UP4COUT  0x00001000      /* update cache on CPU castouts */
+#define SLTCV_EDCEN    0x08000000      /* enable error correction */
+#define SLTCV_EDTAG    0x10000000      /* enable diagtag */
+#define SLTCV_CHKTP    0x20000000      /* enable parity checking */
+#define SLTCV_LOWPWR   0x40000000      /* low power mode */
+#define SLTCV_ENABLE   0x80000000      /* enable L2 cache */
+#define SLTCV_BITS     "\020\15avwl\16up4cout\24edcen\25edtag\26chktp\27lowpwr\30l2ena"
+       uint32_t        tagmask;        /* 0x0a4 L2 cache tag mask */
+       uint32_t        diagtag;        /* 0x0a8 L2 invalidates tag */
+       uint32_t        sltestat;       /* 0x0ac L2 last logged tag read */
+       uint32_t        slteadd;        /* 0x0b0 L2 pa of -- " -- */
+       uint32_t        pad2[3];        /* 0x0b4 */
+       uint32_t        mtcv;           /* 0x0c0 MIOC timings */
+       uint32_t        ref;            /* 0x0cc MIOC refresh timings */
+       uint32_t        pad3[4];        /* 0x0d0 */
+       uint32_t        mderradd;       /* 0x0e0 addr of most evil mem error */
+       uint32_t        pad4;           /* 0x0e4 */
+       uint32_t        dmaerr;         /* 0x0e8 addr of most evil dma error */
+       uint32_t        dioerr;         /* 0x0ec addr of most evil dio error */
+       uint32_t        gsc_timeout;    /* 0x0f0 1-compl of GSC timeout delay */
+       uint32_t        hidmamem;       /* 0x0f4 amount of phys mem installed */
+       uint32_t        pad5[2];        /* 0x0f8 */
+       uint32_t        memcomp[16];    /* 0x100 memory address comparators */
+       uint32_t        memmask[16];    /* 0x140 masks for -- " -- */
+       uint32_t        memtest;        /* 0x180 test address decoding */
+       uint32_t        pad6[0xf];      /* 0x184 */
+       uint32_t        outchk;         /* 0x1c0 address decoding output */
+       uint32_t        pad7[0x168];    /* 0x200 */
+       uint32_t        gsc15x_config;  /* 0x7a0 writev enable */
+};
+
 struct mem_softc {
        struct device sc_dev;
 
        volatile struct vi_trs *sc_vp;
+       volatile struct l2_mioc *sc_l2;
 };
 
 int    memmatch __P((struct device *, struct cfdata *, void *));
@@ -164,29 +204,36 @@
 
        /* XXX check if we are dealing w/ Viper */
        if (ca->ca_hpa == (hppa_hpa_t)VIPER_HPA) {
-               int s;
-               char bits[128];
 
                sc->sc_vp = (struct vi_trs *)
-                       &((struct iomod *)ca->ca_hpa)->priv_trs;
+                   &((struct iomod *)ca->ca_hpa)->priv_trs;
 
-               bitmask_snprintf(VI_CTRL, VIPER_BITS, bits, sizeof(bits));
-               printf (" viper rev %x, ctrl %s",
-                       sc->sc_vp->vi_status.hw_rev,
-                       bits);
+               /* XXX other values seem to blow it up */
+               if (sc->sc_vp->vi_status.hw_rev == 0) {
+                       int s;
+                       char bits[128];
+
+                       bitmask_snprintf(VI_CTRL, VIPER_BITS, bits, 
+                           sizeof(bits));
+                       printf (" viper rev %x, ctrl %s",
+                           sc->sc_vp->vi_status.hw_rev,
+                           bits);
 
-               s = splhigh();
-               VI_CTRL |= VI_CTRL_ANYDEN;
-               ((struct vi_ctrl *)&VI_CTRL)->core_den = 0;
-               ((struct vi_ctrl *)&VI_CTRL)->sgc0_den = 0;
-               ((struct vi_ctrl *)&VI_CTRL)->sgc1_den = 0;
-               ((struct vi_ctrl *)&VI_CTRL)->core_prf = 1;
-               sc->sc_vp->vi_control = VI_CTRL;
-               splx(s);
+                       s = splhigh();
+                       VI_CTRL |= VI_CTRL_ANYDEN;
+                       ((struct vi_ctrl *)&VI_CTRL)->core_den = 0;
+                       ((struct vi_ctrl *)&VI_CTRL)->sgc0_den = 0;
+                       ((struct vi_ctrl *)&VI_CTRL)->sgc1_den = 0;
+                       ((struct vi_ctrl *)&VI_CTRL)->core_prf = 1;
+                       sc->sc_vp->vi_control = VI_CTRL;
+                       splx(s);
 #ifdef DEBUG
-               bitmask_snprintf(VI_CTRL, VIPER_BITS, bits, sizeof(bits));
-               printf (" >> %s", bits);
+                       bitmask_snprintf(VI_CTRL, VIPER_BITS, bits, 
+                           sizeof(bits));
+                       printf (" >> %s", bits);
 #endif
+               } else
+                       sc->sc_vp = NULL;
        } else
                sc->sc_vp = NULL;
 
@@ -199,12 +246,28 @@
        printf (" size %d", pdc_minit.max_spa / (1024*1024));
        if (pdc_minit.max_spa % (1024*1024))
                printf (".%d", pdc_minit.max_spa % (1024*1024));
-       printf ("MB\n");
+       printf ("MB");
+
+       /* L2 cache controller is a part of the memory controller on PCXL2 */
+       if (HPPA_PA_SPEC_MAJOR(hppa_cpu_info->hppa_cpu_info_pa_spec) == 1 &&
+           HPPA_PA_SPEC_MINOR(hppa_cpu_info->hppa_cpu_info_pa_spec) == 1 &&
+           HPPA_PA_SPEC_LETTER(hppa_cpu_info->hppa_cpu_info_pa_spec) == 'e') {
+               sc->sc_l2 = (struct l2_mioc *)ca->ca_hpa;
+#ifdef DEBUG
+               printf(", sltcv %b", sc->sc_l2->sltcv, SLTCV_BITS);
+#endif
+               /* sc->sc_l2->sltcv |= SLTCV_UP4COUT; */
+               if (sc->sc_l2->sltcv & SLTCV_ENABLE) {
+                       uint32_t tagmask = sc->sc_l2->tagmask >> 20;
+                       printf(", %dMB L2 cache", tagmask + 1);
+               }
+       }
+       printf("\n");
 }
 
 void
 viper_setintrwnd(mask)
-       u_int32_t mask;
+       uint32_t mask;
 {
        register struct mem_softc *sc;
 
diff -r 9a5884df49e4 -r d38556624ab7 sys/arch/hp700/dev/phantomas.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/hp700/dev/phantomas.c    Tue Nov 18 04:04:42 2003 +0000
@@ -0,0 +1,80 @@
+/*     $NetBSD: phantomas.c,v 1.1 2003/11/18 04:04:42 chs Exp $        */
+/*     $OpenBSD: phantomas.c,v 1.1 2002/12/18 23:52:45 mickey Exp $    */
+
+/*
+ * Copyright (c) 2002 Michael Shalayeff
+ * 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 Michael Shalayeff.
+ * 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 OR HIS RELATIVES 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 MIND, 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/autoconf.h>
+
+#include <hp700/dev/cpudevs.h>
+
+struct phantomas_softc {
+       struct device sc_dev;
+};
+
+int    phantomasmatch(struct device *, struct cfdata *, void *);
+void   phantomasattach(struct device *, struct device *, void *);
+static void phantomas_callback(struct device *self, struct confargs *ca);
+
+CFATTACH_DECL(phantomas, sizeof(struct phantomas_softc),
+    phantomasmatch, phantomasattach, NULL, NULL);
+
+int
+phantomasmatch(struct device *parent, struct cfdata *cfdata, void *aux)
+{
+       struct confargs *ca = aux;
+



Home | Main Index | Thread Index | Old Index