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 Fill in real cache size/organization...



details:   https://anonhg.NetBSD.org/src/rev/6a7e4aa8b281
branches:  trunk
changeset: 532103:6a7e4aa8b281
user:      kleink <kleink%NetBSD.org@localhost>
date:      Fri May 31 15:04:14 2002 +0000

description:
Fill in real cache size/organization information and recolor; currently
doesn't make a difference except for the 604e.

XXX Does not consider L2 caches yet.

diffstat:

 sys/arch/powerpc/mpc6xx/cpu_subr.c |  44 ++++++++++++++++++++++++++++++++++---
 1 files changed, 40 insertions(+), 4 deletions(-)

diffs (60 lines):

diff -r 8b1fea083a2c -r 6a7e4aa8b281 sys/arch/powerpc/mpc6xx/cpu_subr.c
--- a/sys/arch/powerpc/mpc6xx/cpu_subr.c        Fri May 31 14:28:20 2002 +0000
+++ b/sys/arch/powerpc/mpc6xx/cpu_subr.c        Fri May 31 15:04:14 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu_subr.c,v 1.14 2002/04/03 00:09:52 matt Exp $       */
+/*     $NetBSD: cpu_subr.c,v 1.15 2002/05/31 15:04:14 kleink Exp $     */
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -72,11 +72,47 @@
 void
 cpu_probe_cache(void)
 {
-       /* XXXX Initialze cache_info */
-       curcpu()->ci_ci.dcache_size = PAGE_SIZE;
+       u_int assoc, pvr, vers;
+
+       __asm __volatile ("mfpvr %0" : "=r"(pvr));
+       vers = pvr >> 16;
+
+       switch (vers) {
+#define        K       *1024
+       case MPC601:
+       case MPC750:
+       case MPC7450:
+       case MPC7455:
+               curcpu()->ci_ci.dcache_size = 32 K;
+               curcpu()->ci_ci.icache_size = 32 K;
+               assoc = 8;
+               break;
+       case MPC603e:
+       case MPC604:
+               curcpu()->ci_ci.dcache_size = 16 K;
+               curcpu()->ci_ci.icache_size = 16 K;
+               assoc = 4;
+               break;
+       case MPC604ev:
+               curcpu()->ci_ci.dcache_size = 32 K;
+               curcpu()->ci_ci.icache_size = 32 K;
+               assoc = 4;
+               break;
+       default:
+               curcpu()->ci_ci.dcache_size = PAGE_SIZE;
+               curcpu()->ci_ci.icache_size = PAGE_SIZE;
+               assoc = 1;
+#undef K
+       }
+
+       /* Presently common across all implementations. */
        curcpu()->ci_ci.dcache_line_size = CACHELINESIZE;
-       curcpu()->ci_ci.icache_size = PAGE_SIZE;
        curcpu()->ci_ci.icache_line_size = CACHELINESIZE;
+
+       /*
+        * Possibly recolor.
+        */
+        uvm_page_recolor(atop(curcpu()->ci_ci.dcache_line_size / assoc));
 }
 
 struct cpu_info *



Home | Main Index | Thread Index | Old Index