Use write-through caching for video ram. (Disabled by default, for now.)

This commit is contained in:
tsubai 2001-03-15 19:48:04 +00:00
parent 4382a59d64
commit 5eab0287fb

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofb.c,v 1.17 2000/11/02 14:25:51 tsubai Exp $ */
/* $NetBSD: ofb.c,v 1.18 2001/03/15 19:48:04 tsubai Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -48,11 +48,18 @@
#include <dev/ofw/ofw_pci.h>
#include <machine/bat.h>
#include <machine/bus.h>
#include <machine/grfioctl.h>
#include <macppc/dev/ofbvar.h>
#if OFB_ENABLE_CACHE
int ofb_enable_cache = 1;
#else
int ofb_enable_cache = 0;
#endif
int ofbmatch __P((struct device *, struct cfdata *, void *));
void ofbattach __P((struct device *, struct device *, void *));
int ofbprint __P((void *, const char *));
@ -235,6 +242,14 @@ ofb_common_init(node, dc)
OF_call_method_1("color!", dc->dc_ih, 4, 0, 0, 0, 0);
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;
}
/* initialize rasops */
ri->ri_width = width;
ri->ri_height = height;