Better machine type identification from Mike Smith
authordownsj <downsj@openbsd.org>
Thu, 17 Apr 1997 10:28:35 +0000 (10:28 +0000)
committerdownsj <downsj@openbsd.org>
Thu, 17 Apr 1997 10:28:35 +0000 (10:28 +0000)
(<miff@spam.frisbee.net.au>).

sys/arch/hp300/hp300/genassym.cf
sys/arch/hp300/hp300/hpux_machdep.c
sys/arch/hp300/hp300/locore.s
sys/arch/hp300/hp300/machdep.c
sys/arch/hp300/include/cpu.h

index 989c92b..28b9c3e 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: genassym.cf,v 1.2 1997/03/29 05:18:10 downsj Exp $
+#      $OpenBSD: genassym.cf,v 1.3 1997/04/17 10:28:35 downsj Exp $
 #      $NetBSD: genassym.cf,v 1.5 1997/03/16 09:40:01 thorpej Exp $
 
 #
@@ -100,6 +100,7 @@ define      HP_370                  HP_370
 define HP_340                  HP_340
 define HP_375                  HP_375
 define HP_380                  HP_380
+define HP_425                  HP_425
 define HP_433                  HP_433
 
 # values for ectype
index 360b58f..712fc4d 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: hpux_machdep.c,v 1.5 1997/04/16 11:56:23 downsj Exp $ */
+/*     $OpenBSD: hpux_machdep.c,v 1.6 1997/04/17 10:28:36 downsj Exp $ */
 /*     $NetBSD: hpux_machdep.c,v 1.12 1997/04/02 22:41:34 scottr Exp $ */
 
 /*
@@ -122,7 +122,8 @@ static struct valtostr machine_table[] = {
        { HP_360,       "360" },
        { HP_370,       "370" },
        { HP_375,       "375" },        /* includes 345 and 400 */
-       { HP_380,       "380" },        /* includes 425 */
+       { HP_380,       "380" },
+       { HP_425,       "425" },
        { HP_433,       "433" },
        {     -1,       "3?0" },        /* unknown system (???) */
 };
@@ -268,6 +269,7 @@ hpux_cpu_sysconf_arch()
                return (HPUX_SYSCONF_CPUM030);
 
        case HP_380:
+       case HP_425:
        case HP_433:
                return (HPUX_SYSCONF_CPUM040);
 
index d3a0736..898cc7a 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: locore.s,v 1.14 1997/04/16 11:56:27 downsj Exp $      */
+/*     $OpenBSD: locore.s,v 1.15 1997/04/17 10:28:38 downsj Exp $      */
 /*     $NetBSD: locore.s,v 1.67 1997/03/16 10:49:43 thorpej Exp $      */
 
 /*
@@ -191,6 +191,9 @@ Lnot370:
        btst    #16,d0                  | still on?
        jeq     Lstart1                 | no, must be a 360
        movl    #HP_375,a0@             | yes, must be a 345/375
+       RELOC(_mmuid, a0)
+       lsrl    #8,d0                   | get apparent ID
+       movl    d0,a0@                  | save MMU ID
        jra     Lhaspac
 Lisa370:
        movl    #HP_370,a0@             | set to 370
@@ -214,14 +217,25 @@ Lnot68030:
        movl    #FPU_68040,a0@          | ...and FPU
        RELOC(_ectype, a0)
        movl    #EC_NONE,a0@            | and no cache (for now XXX)
-       RELOC(_machineid, a0)
+       RELOC(_mmuid, a0)
        movl    a1@(MMUCMD),d0          | read MMU register
        lsrl    #8,d0                   | get apparent ID
+       movl    d0,a0@                  | save MMU ID
+       RELOC(_machineid, a0)
+       cmpb    #7,d0                   | id == 7?
+       jeq     Lis433                  | XXX 433 underclocked?
        cmpb    #6,d0                   | id == 6?
-       jeq     Lis33mhz                | yes, we have a 433s
-       movl    #HP_380,a0@             | no, we have a 380/425t
+       jeq     Lis433                  | yes, we have a 433s
+       cmpb    #5,d0                   | id == 5?
+       jeq     Lis425                  | yes, we have a 425t
+       cmpb    #4,d0                   | id == 4?
+       jeq     Lis425                  | Heh, 425t overclocked
+       movl    #HP_380,a0@             | no, we have a 380
+       jra     Lstart1
+Lis425:
+       movl    #HP_425,a0@             | 425t
        jra     Lstart1
-Lis33mhz:
+Lis433:
        movl    #HP_433,a0@             | 433s (XXX 425s returns same ID, ugh!)
        jra     Lstart1
 Lis68020:
@@ -2042,10 +2056,12 @@ Lebootcode:
 #undef DOREBOOT
 
        .data
-       .globl  _machineid,_mmutype,_cputype,_ectype,_fputype
+       .globl  _machineid,_mmuid,_mmutype,_cputype,_ectype,_fputype
        .globl  _protorp,_prototc
 _machineid:
        .long   HP_320          | default to 320
+_mmuid:
+       .long   0               | default to nothing
 _mmutype:
        .long   MMU_HP          | default to HP MMU
 _cputype:
index 86258f2..8f52ae4 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: machdep.c,v 1.22 1997/04/16 11:56:28 downsj Exp $     */
+/*     $OpenBSD: machdep.c,v 1.23 1997/04/17 10:28:39 downsj Exp $     */
 /*     $NetBSD: machdep.c,v 1.89 1997/04/09 20:05:20 thorpej Exp $     */
 
 /*
@@ -508,10 +508,21 @@ identifycpu()
                t = "345/375 (50MHz";
                break;
        case HP_380:
-               t = "380/425 (25MHz";
+               t = "380 (25MHz";
+               break;
+       case HP_425:
+               if (mmuid == 5) {
+                   t = "425 (25MHz";
+               } else {        /* == 4 */
+                   t = "425 (33MHz";
+               }
                break;
        case HP_433:
-               t = "433 (33MHz";
+               if (mmuid == 6) {
+                   t = "433 (33MHz";
+               } else {        /* == 7 ??? what is this? */
+                   t = "433 (25MHz";
+               }
                break;
        default:
                printf("\nunknown machine type %d\n", machineid);
@@ -559,7 +570,8 @@ identifycpu()
        }
        strcat(cpu_model, ")");
        printf("%s\n", cpu_model);
-       printf("delay constant for this cpu: %d\n", delay_divisor);
+       printf("delay constant for this cpu: %d  MMU ID: %d\n", 
+              delay_divisor, mmuid & 0xff);
        /*
         * Now that we have told the user what they have,
         * let them know if that machine type isn't configured.
@@ -581,6 +593,7 @@ identifycpu()
 #endif
 #if !defined(HP380)
        case HP_380:
+       case HP_425:
        case HP_433:
 #endif
                panic("CPU type not configured");
index d8217c9..51db1f3 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: cpu.h,v 1.6 1997/04/16 11:56:34 downsj Exp $  */
+/*     $OpenBSD: cpu.h,v 1.7 1997/04/17 10:28:40 downsj Exp $  */
 /*     $NetBSD: cpu.h,v 1.24 1997/04/14 02:28:50 thorpej Exp $ */
 
 /*
@@ -192,10 +192,12 @@ int       want_resched;           /* resched() was called */
 #define        HP_340          5       /* 16Mhz 68030 */
 #define        HP_375          6       /* 50Mhz 68030+32K external cache */
 #define        HP_380          7       /* 25Mhz 68040 */
-#define HP_433         8       /* 33Mhz 68040 */
+#define HP_425         8       /* 25/33Mhz 68040 */
+#define HP_433         9       /* 33Mhz 68040 (maybe also 25MHz?) */
 
 #ifdef _KERNEL
 extern int machineid;          /* CPU model */
+extern int mmuid;              /* MMU model */
 extern int cpuspeed;           /* CPU speed, in MHz */
 
 extern char *intiobase, *intiolimit;