Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/mpc6xx split off the part of cpu_attach_com...



details:   https://anonhg.NetBSD.org/src/rev/f96e3dd31e2e
branches:  trunk
changeset: 534487:f96e3dd31e2e
user:      chs <chs%NetBSD.org@localhost>
date:      Sun Jul 28 07:03:15 2002 +0000

description:
split off the part of cpu_attach_common() that pokes at special CPU registers
into a separate function so that we can run it on each CPU we configure
rather than always on the boot CPU.

diffstat:

 sys/arch/powerpc/mpc6xx/cpu_subr.c |  24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diffs (61 lines):

diff -r 52a1b9e8e50a -r f96e3dd31e2e sys/arch/powerpc/mpc6xx/cpu_subr.c
--- a/sys/arch/powerpc/mpc6xx/cpu_subr.c        Sun Jul 28 07:02:54 2002 +0000
+++ b/sys/arch/powerpc/mpc6xx/cpu_subr.c        Sun Jul 28 07:03:15 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu_subr.c,v 1.24 2002/07/16 23:04:21 matt Exp $       */
+/*     $NetBSD: cpu_subr.c,v 1.25 2002/07/28 07:03:15 chs Exp $        */
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -130,8 +130,7 @@
 cpu_attach_common(struct device *self, int id)
 {
        struct cpu_info *ci;
-       u_int hid0, pvr, vers;
-       char model[80];
+       u_int pvr, vers;
 
        ncpus++;
 #ifdef MULTIPROCESSOR
@@ -171,6 +170,7 @@
                case MPC7455:
                        __asm __volatile ("mtspr %1,%0" :: "r"(id), "n"(SPR_PIR));
                }
+               cpu_setup(self, ci);
                break;
        default:
                if (id >= CPU_MAXNUM) {
@@ -182,9 +182,23 @@
                return NULL;
 #endif
        }
+       return (ci);
+}
+
+void
+cpu_setup(self, ci)
+       struct device *self;
+       struct cpu_info *ci;
+{
+       u_int hid0, pvr, vers;
+       char model[80];
+
+       __asm __volatile ("mfpvr %0" : "=r"(pvr));
+       vers = (pvr >> 16) & 0xffff;
+
        cpu_identify(model, sizeof(model));
        printf(": %s, ID %d%s\n", model,  cpu_number(),
-           id == 0 ? " (primary)" : "");
+           cpu_number() == 0 ? " (primary)" : "");
 
        __asm __volatile("mfspr %0,%1" : "=r"(hid0) : "n"(SPR_HID0));
        cpu_probe_cache();
@@ -331,8 +345,6 @@
                    &ci->ci_ev_vec, self->dv_xname, "AltiVec context switches");
        }
 #endif
-
-       return ci;
 }
 
 struct cputab {



Home | Main Index | Thread Index | Old Index