Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sandpoint/sandpoint Disable interrupts during autoc...



details:   https://anonhg.NetBSD.org/src/rev/a328bbaf952e
branches:  trunk
changeset: 506851:a328bbaf952e
user:      briggs <briggs%NetBSD.org@localhost>
date:      Tue Mar 06 20:10:20 2001 +0000

description:
Disable interrupts during autoconf.
Move identifycpu() from machdep.c to autoconf.c, make it table-driven, and
add a few more models to it.

diffstat:

 sys/arch/sandpoint/sandpoint/autoconf.c |  73 ++++++++++++++++++++++++++++++++-
 sys/arch/sandpoint/sandpoint/machdep.c  |  55 +------------------------
 2 files changed, 73 insertions(+), 55 deletions(-)

diffs (174 lines):

diff -r f552e9bb21d9 -r a328bbaf952e sys/arch/sandpoint/sandpoint/autoconf.c
--- a/sys/arch/sandpoint/sandpoint/autoconf.c   Tue Mar 06 19:20:51 2001 +0000
+++ b/sys/arch/sandpoint/sandpoint/autoconf.c   Tue Mar 06 20:10:20 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.1 2001/02/04 18:32:17 briggs Exp $      */
+/*     $NetBSD: autoconf.c,v 1.2 2001/03/06 20:10:20 briggs Exp $      */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -62,6 +62,10 @@
 int booted_partition;
 
 void findroot __P((void));
+void disable_intr(void);
+void enable_intr(void);
+
+void identifycpu(void);
 
 /*
  * Determine i/o configuration for a machine.
@@ -71,6 +75,8 @@
 {
        /* startrtclock(); */
 
+       disable_intr();
+
        if (config_rootfound("mainbus", NULL) == NULL)
                panic("configure: mainbus not configured");
 
@@ -78,6 +84,8 @@
            (u_short)imask[IPL_BIO], (u_short)imask[IPL_NET],
            (u_short)imask[IPL_TTY]);
 
+       enable_intr();
+
        spl0();
 }
 
@@ -133,3 +141,66 @@
                }
        }
 }
+
+#define MPC601         0x01
+#define MPC603         0x03
+#define MPC604         0x04
+#define MPC602         0x05
+#define MPC603e                0x06
+#define MPC603ev       0x07
+#define MPC750         0x08
+#define MPC604ev       0x09
+#define MPC7400                0x0c
+#define MPC620         0x14
+#define MPC8240                0x81
+
+int cpu;
+char cpu_model[80];
+char cpu_name[] = "PowerPC";   /* cpu architecture */
+
+struct cputab {
+       int     version;
+       char    *name;
+};
+static struct cputab models[] = {
+       { MPC601,     "601" },
+       { MPC603,     "603" },
+       { MPC604,     "604" },
+       { MPC602,     "602" },
+       { MPC603e,   "603e" },
+       { MPC603ev, "603ev" },
+       { MPC750,     "750" },
+       { MPC604ev, "604ev" },
+       { MPC7400,   "7400" },
+       { MPC620,     "620" },
+       { MPC8240,   "8240" },
+       { 0, NULL }
+};
+
+void
+identifycpu()
+{
+       int pvr;
+       struct cputab *cp = models;
+
+       /*
+        * Find cpu type
+        */
+       asm ("mfpvr %0" : "=r"(pvr));
+       cpu = pvr >> 16;
+       while (cp->name) {
+               if (cp->version == cpu)
+                       break;
+               cp++;
+       }
+       if (cp->name)
+               strcpy(cpu_model, cp->name);
+       else
+               sprintf(cpu_model, "Version 0x%x", cpu);
+
+       sprintf(cpu_model + strlen(cpu_model), " (Revision %d.%d)",
+               (pvr >> 8) & 0xff, pvr & 0xff);
+
+       printf("CPU: %s %s\n", cpu_name, cpu_model);
+}
+
diff -r f552e9bb21d9 -r a328bbaf952e sys/arch/sandpoint/sandpoint/machdep.c
--- a/sys/arch/sandpoint/sandpoint/machdep.c    Tue Mar 06 19:20:51 2001 +0000
+++ b/sys/arch/sandpoint/sandpoint/machdep.c    Tue Mar 06 20:10:20 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.6 2001/02/26 14:55:05 briggs Exp $       */
+/*     $NetBSD: machdep.c,v 1.7 2001/03/06 20:10:20 briggs Exp $       */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -371,59 +371,6 @@
        *avail = availmemr;
 }
 
-/*
- * This should probably be in autoconf!                                XXX
- */
-int cpu;
-char cpu_model[80];
-char cpu_name[] = "PowerPC";   /* cpu architecture */
-
-void
-identifycpu()
-{
-       int pvr;
-
-       /*
-        * Find cpu type
-        */
-       asm ("mfpvr %0" : "=r"(pvr));
-       cpu = pvr >> 16;
-       switch (cpu) {
-       case 1:
-               sprintf(cpu_model, "601");
-               break;
-       case 3:
-               sprintf(cpu_model, "603");
-               break;
-       case 4:
-               sprintf(cpu_model, "604");
-               break;
-       case 5:
-               sprintf(cpu_model, "602");
-               break;
-       case 6:
-               sprintf(cpu_model, "603e");
-               break;
-       case 7:
-               sprintf(cpu_model, "603ev");
-               break;
-       case 9:
-               sprintf(cpu_model, "604ev");
-               break;
-       case 20:
-               sprintf(cpu_model, "620");
-               break;
-       case 0x81:
-               sprintf(cpu_model, "8240");
-               break;
-       default:
-               sprintf(cpu_model, "Version %x", cpu);
-               break;
-       }
-       sprintf(cpu_model + strlen(cpu_model), " (Revision %x)", pvr & 0xffff);
-       printf("CPU: %s %s\n", cpu_name, cpu_model);
-}
-
 void
 install_extint(handler)
        void (*handler) __P((void));



Home | Main Index | Thread Index | Old Index