Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/macppc/dev Update OFB_ENABLE_CACHE to search for a ...



details:   https://anonhg.NetBSD.org/src/rev/7096bfea973e
branches:  trunk
changeset: 533699:7096bfea973e
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Jul 07 18:35:10 2002 +0000

description:
Update OFB_ENABLE_CACHE to search for a empty bat that does not
conflict the USER_SR or one of the kernel SRs.

diffstat:

 sys/arch/macppc/dev/ofb.c |  24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diffs (38 lines):

diff -r 4d59f4c814f4 -r 7096bfea973e sys/arch/macppc/dev/ofb.c
--- a/sys/arch/macppc/dev/ofb.c Sun Jul 07 18:07:43 2002 +0000
+++ b/sys/arch/macppc/dev/ofb.c Sun Jul 07 18:35:10 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ofb.c,v 1.28 2002/07/04 14:43:50 junyoung Exp $        */
+/*     $NetBSD: ofb.c,v 1.29 2002/07/07 18:35:10 matt Exp $    */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -250,11 +250,23 @@
        OF_call_method_1("color!", dc->dc_ih, 4, 255, 255, 255, 255);
 
        /* Enable write-through cache. */
-       if (ofb_enable_cache && battable[0xc].batu == 0) {
-               battable[0xc].batl = BATL(addr & 0xf0000000, BAT_W, BAT_PP_RW);
-               battable[0xc].batu = BATL(0xc0000000, BAT_BL_256M, BAT_Vs);
-               addr &= 0x0fffffff;
-               addr |= 0xc0000000;
+       if (ofb_enable_cache) {
+               vaddr_t va;
+               /*
+                * Let's try to find an empty BAT to use 
+                */
+               for (va = SEGMENT_LENGTH; va < (USER_SR << ADDR_SR_SHFT);
+                    va += SEGMENT_LENGTH) {
+                       if (battable[va >> ADDR_SR_SHFT].batu == 0) {
+                               battable[va >> ADDR_SR_SHFT].batl =
+                                   BATL(addr & 0xf0000000, BAT_W, BAT_PP_RW);
+                               battable[va >> ADDR_SR_SHFT].batu =
+                                   BATL(va, BAT_BL_256M, BAT_Vs);
+                               addr &= 0x0fffffff;
+                               addr |= va;
+                               break;
+                       }
+               }
        }
 
        /* initialize rasops */



Home | Main Index | Thread Index | Old Index