Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/oea Only read from HID1 when a G3 CPU was d...



details:   https://anonhg.NetBSD.org/src/rev/f1f41c68b8c9
branches:  trunk
changeset: 758457:f1f41c68b8c9
user:      phx <phx%NetBSD.org@localhost>
date:      Fri Nov 05 08:34:35 2010 +0000

description:
Only read from HID1 when a G3 CPU was detected in cpu_get_dfs(), otherwise
the access might cause a PGM trap.

diffstat:

 sys/arch/powerpc/oea/cpu_subr.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r 4882431563fa -r f1f41c68b8c9 sys/arch/powerpc/oea/cpu_subr.c
--- a/sys/arch/powerpc/oea/cpu_subr.c   Fri Nov 05 07:41:20 2010 +0000
+++ b/sys/arch/powerpc/oea/cpu_subr.c   Fri Nov 05 08:34:35 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu_subr.c,v 1.57 2010/10/28 13:58:03 macallan Exp $   */
+/*     $NetBSD: cpu_subr.c,v 1.58 2010/11/05 08:34:35 phx Exp $        */
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.57 2010/10/28 13:58:03 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.58 2010/11/05 08:34:35 phx Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_multiprocessor.h"
@@ -1002,18 +1002,17 @@
 int
 cpu_get_dfs(void)
 {
-       u_int hid1, pvr, vers;
+       u_int pvr, vers;
 
        pvr = mfpvr();
        vers = pvr >> 16;
-       hid1 = mfspr(SPR_HID1);
 
        switch (vers) {
        case MPC7448:
-               if (hid1 & HID1_DFS4)
+               if (mfspr(SPR_HID1) & HID1_DFS4)
                        return 4;
        case MPC7447A:
-               if (hid1 & HID1_DFS2)
+               if (mfspr(SPR_HID1) & HID1_DFS2)
                        return 2;
        }
        return 1;



Home | Main Index | Thread Index | Old Index