From 1e6969793b0726bb8fbba26771e95f3b8e8adcf9 Mon Sep 17 00:00:00 2001 From: downsj Date: Thu, 17 Apr 1997 10:28:35 +0000 Subject: [PATCH] Better machine type identification from Mike Smith (). --- sys/arch/hp300/hp300/genassym.cf | 3 ++- sys/arch/hp300/hp300/hpux_machdep.c | 6 ++++-- sys/arch/hp300/hp300/locore.s | 28 ++++++++++++++++++++++------ sys/arch/hp300/hp300/machdep.c | 21 +++++++++++++++++---- sys/arch/hp300/include/cpu.h | 6 ++++-- 5 files changed, 49 insertions(+), 15 deletions(-) diff --git a/sys/arch/hp300/hp300/genassym.cf b/sys/arch/hp300/hp300/genassym.cf index 989c92b5f20..28b9c3e3dfa 100644 --- a/sys/arch/hp300/hp300/genassym.cf +++ b/sys/arch/hp300/hp300/genassym.cf @@ -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 diff --git a/sys/arch/hp300/hp300/hpux_machdep.c b/sys/arch/hp300/hp300/hpux_machdep.c index 360b58fb6ce..712fc4d25fa 100644 --- a/sys/arch/hp300/hp300/hpux_machdep.c +++ b/sys/arch/hp300/hp300/hpux_machdep.c @@ -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); diff --git a/sys/arch/hp300/hp300/locore.s b/sys/arch/hp300/hp300/locore.s index d3a0736a552..898cc7aba90 100644 --- a/sys/arch/hp300/hp300/locore.s +++ b/sys/arch/hp300/hp300/locore.s @@ -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: diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c index 86258f2d5cf..8f52ae476c3 100644 --- a/sys/arch/hp300/hp300/machdep.c +++ b/sys/arch/hp300/hp300/machdep.c @@ -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"); diff --git a/sys/arch/hp300/include/cpu.h b/sys/arch/hp300/include/cpu.h index d8217c91a33..51db1f37cbd 100644 --- a/sys/arch/hp300/include/cpu.h +++ b/sys/arch/hp300/include/cpu.h @@ -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; -- 2.20.1