Port-powerpc archive

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

Re: 20020313+0314 time warp version works on kbd/screen



On Sat, 15 Jun 2002, Bill Studenmund wrote:

> One weird thing about this change is that you need version 1.3 of
> sys/arch/powerpc/mpc6xx/genassym.cf for it to work right. CPU_CI, used on
> line 206 of bzero.S, isn't defined w/o the above file. I'm not sure why
> bzero.S would compile.

Ok, looking into things more, we aren't using bzero.S. :-) So then the
problem has to be the change to syncicache.c. :-)

Try this patch (note I've not compiled nor run it). It should catch calls
to __syncicache() before we have initialized the cache info. There should
be a new printf during boot.

Take care,

Bill
Index: kern/init_main.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/init_main.c,v
retrieving revision 1.199
diff -u -r1.199 init_main.c
--- kern/init_main.c    2002/03/04 02:30:27     1.199
+++ kern/init_main.c    2002/06/16 01:03:10
@@ -153,6 +153,8 @@
 
 extern const struct emul emul_netbsd;  /* defined in kern_exec.c */
 
+extern int got_bad_cache;
+
 /*
  * System startup; initialize the world, create process 0, mount root
  * filesystem, and fork to create init and pagedaemon.  Most of the
@@ -224,6 +226,8 @@
         * Initialize process and pgrp structures.
         */
        procinit();
+
+       printf("got_bad_cache has value %d\n", got_bad_cache);
 
        /*
         * Create process 0 (the swapper).
Index: lib/libkern/arch/powerpc/syncicache.c
===================================================================
RCS file: /cvsroot/syssrc/sys/lib/libkern/arch/powerpc/syncicache.c,v
retrieving revision 1.8
diff -u -r1.8 syncicache.c
--- lib/libkern/arch/powerpc/syncicache.c       2002/03/28 00:46:08     1.8
+++ lib/libkern/arch/powerpc/syncicache.c       2002/06/16 01:03:11
@@ -91,11 +91,14 @@
 }
 #endif
 
+int got_bad_cache = 0;
+
 void
 __syncicache(void *from, size_t len)
 {
        size_t l, off;
        size_t linesz;
+       int i;
        char *p;
 
 #if    !defined(_KERNEL) && !defined(_STANDALONE)
@@ -103,8 +106,13 @@
                getcachelinesize();
 #endif 
 
-       if (CACHEINFO.dcache_size > 0) {
-               linesz = CACHEINFO.dcache_line_size;
+       // if (CACHEINFO.dcache_size > 0) {
+               i = CACHEINFO.dcache_line_size;
+               if (i <= 0) {
+                       i = 32;
+                       got_bad_cache = 1;
+               }
+               linesz = i;
                off = (uintptr_t)from & (linesz - 1);
                l = (len + off + linesz - 1) & ~(linesz - 1);
                p = (char *)from - off;
@@ -112,11 +120,16 @@
                        __asm__ __volatile ("dcbst 0,%0" :: "r"(p));
                        p += linesz;
                } while ((l -= linesz) != 0);
-       }
+       // }
        __asm__ __volatile ("sync");
 
-       if (CACHEINFO.icache_size > 0 ) {
-               linesz = CACHEINFO.icache_line_size;
+       // if (CACHEINFO.icache_size > 0 ) {
+               i = CACHEINFO.icache_line_size;
+               if (i <= 0) {
+                       i = 32;
+                       got_bad_cache = 1;
+               }
+               linesz = i;
                off = (uintptr_t)from & (linesz - 1);
                l = (len + off + linesz - 1) & ~(linesz - 1);
                p = (char *)from - off;
@@ -124,6 +137,6 @@
                        __asm__ __volatile ("icbi 0,%0" :: "r"(p));
                        p += linesz;
                } while ((l -= linesz) != 0);
-       }
+       // }
        __asm__ __volatile ("sync; isync");
 }


Home | Main Index | Thread Index | Old Index