diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-02-11 19:42:12 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-02-11 19:42:12 +0000 |
commit | 51e75b4009685ca51dfde55c04d18be84d2738ac (patch) | |
tree | 79919a61e6b976a7aa0c46819ce2805e5ba93ca2 /sys/arch | |
parent | 52ae2ae6835b700b45ed531d6bf43760a29f2115 (diff) |
disable fpu on csw, print fpu version on cpu line, if present
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/hppa/dev/cpu.c | 36 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/locore.S | 12 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/machdep.c | 5 | ||||
-rw-r--r-- | sys/arch/hppa/include/cpu.h | 3 |
4 files changed, 39 insertions, 17 deletions
diff --git a/sys/arch/hppa/dev/cpu.c b/sys/arch/hppa/dev/cpu.c index 67b394d769e..606980d77ca 100644 --- a/sys/arch/hppa/dev/cpu.c +++ b/sys/arch/hppa/dev/cpu.c @@ -1,7 +1,7 @@ -/* $OpenBSD: cpu.c,v 1.8 2000/08/15 20:38:24 mickey Exp $ */ +/* $OpenBSD: cpu.c,v 1.9 2002/02/11 19:42:11 mickey Exp $ */ /* - * Copyright (c) 1998,1999 Michael Shalayeff + * Copyright (c) 1998-2002 Michael Shalayeff * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -89,6 +89,7 @@ cpuattach(parent, self, aux) extern struct pdc_cache pdc_cache; extern struct pdc_btlb pdc_btlb; extern u_int cpu_ticksnum, cpu_ticksdenom; + extern u_int fpu_enable; struct pdc_model pdc_model PDC_ALIGNMENT; struct pdc_cpuid pdc_cpuid PDC_ALIGNMENT; @@ -116,7 +117,26 @@ cpuattach(parent, self, aux) /* XXX p = hppa_mod_info(HPPA_TYPE_CPU,pdc_cversion[0]); */ } - printf (": %s rev %d, ", p? p : cpu_typename, (*cpu_desidhash)()); + printf (": %s rev %d %d", + p? p : cpu_typename, (*cpu_desidhash)(), mhz / 100); + if (mhz % 100 > 9) + printf(".%02d", mhz % 100); + + printf("MHz, "); + + if (fpu_enable) { + u_int ver; + mtctl(fpu_enable, CR_CCR); + __asm volatile( + "copr,0,0\n\t" + "fstws %%fr0,0(%0)" + :: "r" (&ver) : "memory"); + mtctl(0, CR_CCR); + ver = HPPA_FPUVER(ver); + printf("FPU v%d.%02d", ver / 100, ver %100); + } + + printf("\n%s: ", self->dv_xname); if ((err = pdc_call((iodcio_t)pdc, 0, PDC_MODEL, PDC_MODEL_INFO, &pdc_model)) < 0) { @@ -126,16 +146,12 @@ cpuattach(parent, self, aux) } else { static const char lvls[4][4] = { "0", "1", "1.5", "2" }; - printf("lev %s, cat %c, ", + printf("L %s-%c, ", lvls[pdc_model.pa_lvl], "AB"[pdc_model.mc]); } - printf ("%d", mhz / 100); - if (mhz % 100 > 9) - printf(".%02d", mhz % 100); - - printf(" MHz clk\n%s: %s", self->dv_xname, - pdc_model.sh? "shadows, ": ""); + if (pdc_model.sh) + printf("shadows, "); if (pdc_cache.dc_conf.cc_sh) printf("%uK cache", pdc_cache.dc_size / 1024); diff --git a/sys/arch/hppa/hppa/locore.S b/sys/arch/hppa/hppa/locore.S index 9f84b0ad326..82f133b2575 100644 --- a/sys/arch/hppa/hppa/locore.S +++ b/sys/arch/hppa/hppa/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.50 2002/02/06 19:37:02 mickey Exp $ */ +/* $OpenBSD: locore.S,v 1.51 2002/02/11 19:42:11 mickey Exp $ */ /* * Copyright (c) 1998-2001 Michael Shalayeff @@ -114,7 +114,8 @@ fpu_csw .export fpu_curpcb, data fpu_curpcb .comm 4 - +fpu_enable + .comm 4 .text /* @@ -1059,7 +1060,9 @@ LEAF_ENTRY(TLABEL(emu)) comb,=,n t1, t2, $fpusw_done comb,=,n r0, t1, $fpusw_nosave - /* ldo PCB_FPREGS+U_PCB(t1), t1 */ +#if PCB_FPREGS != 0 || U_PCB != 0 + ldo PCB_FPREGS+U_PCB(t1), t1 +#endif fstds,ma fr0 , 8(t3) /* fr0 must be saved first */ fstds,ma fr1 , 8(t3) @@ -2533,6 +2536,7 @@ switch_exited * * arg1: new proc */ + mtctl r0, ccr /* disable FPU */ ldw P_MD(arg1), t1 ldw TF_CR30(t1), t2 ldw TF_R30(t1), sp @@ -2544,7 +2548,7 @@ switch_exited ldw HPPA_FRAME_PSP(sp), t2 stw t3, TF_R30(t1) fdc r0(t1) - ldw HPPA_FRAME_ARG(1)(sp), t3 /* in case we're in trampoline */ + ldw HPPA_FRAME_ARG(1)(sp), t3 /* in case we're on trampoline */ ldw HPPA_FRAME_ARG(2)(sp), arg0 ldw 0*4(t2), r3 ldw 1*4(t2), r4 diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index 339fde8a828..7e39aa3d9c8 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.55 2002/02/07 05:48:54 mickey Exp $ */ +/* $OpenBSD: machdep.c,v 1.56 2002/02/11 19:42:11 mickey Exp $ */ /* * Copyright (c) 1999-2002 Michael Shalayeff @@ -518,11 +518,12 @@ hppa_init(start) &pdc_coproc)) < 0) printf("WARNING: PDC_COPROC error %d\n", error); else { + extern u_int fpu_enable; #ifdef DEBUG printf("pdc_coproc: %x, %x\n", pdc_coproc.ccr_enable, pdc_coproc.ccr_present); #endif - mtctl(pdc_coproc.ccr_enable & CCR_MASK, CR_CCR); + fpu_enable = pdc_coproc.ccr_enable & CCR_MASK; } /* they say PDC_COPROC might turn fault light on */ diff --git a/sys/arch/hppa/include/cpu.h b/sys/arch/hppa/include/cpu.h index 50b7382bdaa..b823093bbd4 100644 --- a/sys/arch/hppa/include/cpu.h +++ b/sys/arch/hppa/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.24 2001/12/02 04:14:11 mickey Exp $ */ +/* $OpenBSD: cpu.h,v 1.25 2002/02/11 19:42:11 mickey Exp $ */ /* * Copyright (c) 2000-2001 Michael Shalayeff @@ -80,6 +80,7 @@ extern const char *cpu_typename; * COPR/SFUs */ #define HPPA_FPUS 0xc0 +#define HPPA_FPUVER(w) (((w) & 0x003ff800) >> 11) #define HPPA_PMSFUS 0x20 /* ??? */ /* |