Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/vax Better and more understandable way to find out ...



details:   https://anonhg.NetBSD.org/src/rev/f1dc46c7ee68
branches:  trunk
changeset: 473185:f1dc46c7ee68
user:      ragge <ragge%NetBSD.org@localhost>
date:      Sun May 23 22:56:53 1999 +0000

description:
Better and more understandable way to find out CPU type.

diffstat:

 sys/arch/vax/conf/files.vax  |    3 +-
 sys/arch/vax/include/cpu.h   |    3 +-
 sys/arch/vax/include/nexus.h |    7 +-
 sys/arch/vax/vax/findcpu.c   |    4 +-
 sys/arch/vax/vax/locore.c    |  216 ++++++++++++------------------------------
 5 files changed, 75 insertions(+), 158 deletions(-)

diffs (truncated from 361 to 300 lines):

diff -r 614602fe1aa8 -r f1dc46c7ee68 sys/arch/vax/conf/files.vax
--- a/sys/arch/vax/conf/files.vax       Sun May 23 22:37:02 1999 +0000
+++ b/sys/arch/vax/conf/files.vax       Sun May 23 22:56:53 1999 +0000
@@ -1,4 +1,4 @@
-#       $NetBSD: files.vax,v 1.49 1999/04/14 23:14:45 ragge Exp $
+#       $NetBSD: files.vax,v 1.50 1999/05/23 22:56:53 ragge Exp $
 #
 # new style config file for vax architecture
 #
@@ -336,6 +336,7 @@
 file   arch/vax/vax/bus_dma.c
 
 file   arch/vax/vax/vm_machdep.c
+file   arch/vax/vax/findcpu.c
 file   arch/vax/vax/autoconf.c
 file   arch/vax/vax/in_cksum.c         inet
 file   arch/vax/vax/ns_cksum.c         ns
diff -r 614602fe1aa8 -r f1dc46c7ee68 sys/arch/vax/include/cpu.h
--- a/sys/arch/vax/include/cpu.h        Sun May 23 22:37:02 1999 +0000
+++ b/sys/arch/vax/include/cpu.h        Sun May 23 22:56:53 1999 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: cpu.h,v 1.36 1999/05/01 16:13:43 ragge Exp $      */
+/*      $NetBSD: cpu.h,v 1.37 1999/05/23 22:56:54 ragge Exp $      */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden
@@ -126,6 +126,7 @@
 void   vax_unmap_physmem __P((vaddr_t, int));
 void   ioaccess __P((vaddr_t, paddr_t, int));
 void   iounaccess __P((vaddr_t, int));
+void   findcpu(void);
 #ifdef DDB
 int    kdbrint __P((int));
 #endif
diff -r 614602fe1aa8 -r f1dc46c7ee68 sys/arch/vax/include/nexus.h
--- a/sys/arch/vax/include/nexus.h      Sun May 23 22:37:02 1999 +0000
+++ b/sys/arch/vax/include/nexus.h      Sun May 23 22:56:53 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nexus.h,v 1.13 1999/02/02 18:37:22 ragge Exp $ */
+/*     $NetBSD: nexus.h,v 1.14 1999/05/23 22:56:54 ragge Exp $ */
 
 /*-
  * Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -47,6 +47,7 @@
 #define VAX_VSBUS       16      /* VAXstation board */
 #define VAX_BIBUS       32      /* BI bus expansions: 8200/8800 */ 
 #define VAX_CMIBUS     64      /* CMI backplane (750) */
+#define VAX_XMIBUS     128     /* XMI backplane 6000/xxx */
 
 /*
  * Information about nexus's.
@@ -82,9 +83,7 @@
 #define        MAXNNEXUS NNEXSBI
 #endif
 
-#ifndef _LOCORE
-
-#include <sys/types.h>
+#ifdef _KERNEL
 
 struct nexus {
        union nexcsr {
diff -r 614602fe1aa8 -r f1dc46c7ee68 sys/arch/vax/vax/findcpu.c
--- a/sys/arch/vax/vax/findcpu.c        Sun May 23 22:37:02 1999 +0000
+++ b/sys/arch/vax/vax/findcpu.c        Sun May 23 22:56:53 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: findcpu.c,v 1.1 1999/05/23 22:00:43 ragge Exp $        */
+/*     $NetBSD: findcpu.c,v 1.2 1999/05/23 22:56:54 ragge Exp $        */
 /*
  * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -31,10 +31,12 @@
 
 
 #include <sys/param.h>
+#include <sys/device.h>
 
 #include <machine/sid.h>
 #include <machine/nexus.h>
 #include <machine/mtpr.h>
+#include <machine/cpu.h>
 
 /* 
  * We set up some information about the machine we're
diff -r 614602fe1aa8 -r f1dc46c7ee68 sys/arch/vax/vax/locore.c
--- a/sys/arch/vax/vax/locore.c Sun May 23 22:37:02 1999 +0000
+++ b/sys/arch/vax/vax/locore.c Sun May 23 22:56:53 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.c,v 1.36 1999/05/02 17:28:43 ragge Exp $        */
+/*     $NetBSD: locore.c,v 1.37 1999/05/23 22:56:54 ragge Exp $        */
 /*
  * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -56,22 +56,8 @@
 paddr_t        esym;
 u_int  proc0paddr;
 
-/* 
- * We set up some information about the machine we're
- * running on and thus initializes/uses vax_cputype and vax_boardtype.
- * There should be no need to change/reinitialize these variables
- * outside of this routine, they should be read only!
- */
-int vax_cputype;       /* highest byte of SID register */
-int vax_bustype;       /* holds/defines all busses on this machine */
-int vax_boardtype;     /* machine dependend, combination of SID and SIE */
-int vax_systype;       /* machine dependend identification of the system */
- 
-int vax_cpudata;       /* contents of the SID register */
-int vax_siedata;       /* contents of the SIE register */
-int vax_confdata;      /* machine dependend, configuration/setup data */
 /*
- * Also; the strict cpu-dependent information is set up here, in
+ * The strict cpu-dependent information is set up here, in
  * form of a pointer to a struct that is specific for each cpu.
  */
 extern struct cpu_dep ka780_calls;
@@ -100,180 +86,108 @@
 
        mtpr(AST_NO, PR_ASTLVL); /* Turn off ASTs */
 
-       /* Count up memory etc... early machine dependent routines */
-       vax_cputype = ((vax_cpudata = mfpr(PR_SID)) >> 24);
+       findcpu(); /* Set up the CPU identifying variables */
 
-       switch (vax_cputype) {
+       if (vax_confdata & 0x80)
+               strcpy(cpu_model, "MicroVAX ");
+       else
+               strcpy(cpu_model, "VAXstation ");
+
+       switch (vax_boardtype) {
 #if VAX780
-       case VAX_TYP_780:
-               vax_bustype = VAX_SBIBUS | VAX_CPUBUS;
-               vax_boardtype = VAX_BTYP_780;
+       case VAX_BTYP_780:
                dep_call = &ka780_calls;
                break;
 #endif
 #if VAX750
-       case VAX_TYP_750:
-               vax_bustype = VAX_CMIBUS | VAX_CPUBUS;
-               vax_boardtype = VAX_BTYP_750;
+       case VAX_BTYP_750:
                dep_call = &ka750_calls;
                strcpy(cpu_model, "VAX 11/750");
                break;
 #endif
 #if VAX8600
-       case VAX_TYP_790:
-               vax_bustype = VAX_CPUBUS | VAX_MEMBUS;
-               vax_boardtype = VAX_BTYP_790;
+       case VAX_BTYP_790:
                dep_call = &ka860_calls;
                strcpy(cpu_model,"VAX 8600");
                if (vax_cpudata & 0x100)
                        cpu_model[6] = '5';
                break;
 #endif
-#if VAX630 || VAX650 || VAX410 || VAX43 || VAX46 || VAX48
-       case VAX_TYP_UV2:
-       case VAX_TYP_CVAX:
-       case VAX_TYP_RIGEL:
-       case VAX_TYP_MARIAH:
-       case VAX_TYP_SOC:
-               vax_siedata = *(int *)(0x20040004);     /* SIE address */
-               vax_boardtype = (vax_cputype<<24) | ((vax_siedata>>24)&0xFF);
+#if VAX410
+       case VAX_BTYP_420: /* They are very similar */
+               dep_call = &ka410_calls;
+               if (((vax_siedata >> 8) & 0xff) == 1)
+                       strcat(cpu_model, "/m{38,48}");
+               else if (((vax_siedata >> 8) & 0xff) == 0)
+                       strcat(cpu_model, "/m{30,40}");
+               break;
 
-               switch (vax_boardtype) {
-#if VAX410 || VAX43 || VAX46 || VAX48 || VAX49
-               case VAX_BTYP_420: /* They are very similar */
-               case VAX_BTYP_410:
-               case VAX_BTYP_43:
-               case VAX_BTYP_46:
-               case VAX_BTYP_48:
-               case VAX_BTYP_49:
-                       vax_confdata = *(int *)(0x20020000);
-                       vax_bustype = VAX_VSBUS | VAX_CPUBUS;
-#if VAX410
-                       if (vax_boardtype == VAX_BTYP_410 || 
-                           vax_boardtype == VAX_BTYP_420)
-                               dep_call = &ka410_calls;
+       case VAX_BTYP_410:
+               dep_call = &ka410_calls;
+               strcat(cpu_model, "2000");
+               break;
 #endif
 #if VAX43
-                       if (vax_boardtype == VAX_BTYP_43)
-                               dep_call = &ka43_calls;
+       case VAX_BTYP_43:
+               dep_call = &ka43_calls;
+               strcat(cpu_model, "3100/m76");
+               break;
 #endif
 #if VAX46
-                       if (vax_boardtype == VAX_BTYP_46)
-                               dep_call = &ka46_calls;
+       case VAX_BTYP_46:
+               dep_call = &ka46_calls;
+               strcat(cpu_model, "4000/60");
+               break;
 #endif
 #if VAX48
-                       if (vax_boardtype == VAX_BTYP_48)
-                               dep_call = &ka48_calls;
-#endif
-#if VAX49
-                       if (vax_boardtype == VAX_BTYP_49)
-                               dep_call = &ka48_calls;
-#endif
-                       if ((dep_call == &ka410_calls ||
-                           dep_call == &ka43_calls) &&
-                           (vax_confdata & 0x80))
-                               strcpy(cpu_model, "MicroVAX ");
-                       else
-                               strcpy(cpu_model, "VAXstation ");
-
-                       switch (vax_boardtype) {
-#if VAX410
-                       case VAX_BTYP_410:
-                               strcat(cpu_model, "2000");
-                               break;
-#endif
-#if VAX43
-                       case VAX_BTYP_43:
-                               strcat(cpu_model, "3100/m76");
-                               break;
-#endif
-#if VAX46
-                       case VAX_BTYP_46:
-                               strcat(cpu_model, "4000/60");
-                               break;
-#endif
-#if VAX48
-                       case VAX_BTYP_48:
-                               strcat(cpu_model, "4000 VLC");
-                               break;
+       case VAX_BTYP_48:
+               dep_call = &ka48_calls;
+               strcat(cpu_model, "4000 VLC");
+               break;
 #endif
 #if VAX49
-                       case VAX_BTYP_49:
-                               strcat(cpu_model, "4000/90");
-                               break;
-#endif
-                       default:
-#if VAX410
-                       case VAX_BTYP_420:
-                               strcat(cpu_model, "3100");
-                               switch ((vax_siedata >> 8) & 0xff) {
-                               case 0:
-                                       strcat(cpu_model, "/m{30,40}");
-                                       break;
-
-                               case 1:
-                                       strcat(cpu_model, "/m{38,48}");
-                                       break;
-
-                               case 2:
-                                       break;
-
-                               default:
-                                       strcat(cpu_model, " unknown model");
-                                       break;
-                               }
-#endif
-                               break;
-                       }
-                       break;
+       case VAX_BTYP_49:
+               dep_call = &ka48_calls;
+               strcat(cpu_model, "4000/90");
+               break;
 #endif
 #if VAX630
-               case VAX_BTYP_630:
-                       dep_call = &ka630_calls;
-                       vax_bustype = VAX_UNIBUS | VAX_CPUBUS;
-                       strcpy(cpu_model,"MicroVAX II");
-                       break;
+       case VAX_BTYP_630:
+               dep_call = &ka630_calls;
+               strcpy(cpu_model,"MicroVAX II");
+               break;
 #endif
 #if VAX650
-               case VAX_BTYP_650:
-                       vax_bustype = VAX_UNIBUS | VAX_CPUBUS;



Home | Main Index | Thread Index | Old Index