From a06d881670d211e655d84f7ef8e8555c6b0f46df Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 18 Jul 1997 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1997-07-18 --- pc/vgaclgd542x.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/pc/vgaclgd542x.c b/pc/vgaclgd542x.c index 88fd8cbde483d69740960d807ed770e61e56e43e..78884de2fbaa4a05ae9f2cd242e48b773380d24e 100644 --- a/pc/vgaclgd542x.c +++ b/pc/vgaclgd542x.c @@ -16,11 +16,22 @@ extern Cursor curcursor; static Lock clgd542xlock; static ulong storage; +static void +setclgd542xpage(int page) +{ + if(vgaxi(Seqx, 0x07) & 0xF0) + page = 0; + if(vgaxi(Seqx, 0x0B) & 0x20) + vgaxo(Grx, 0x09, page<<2); + else + vgaxo(Grx, 0x09, page<<4); +} + static void clgd542xpage(int page) { lock(&clgd542xlock); - vgaxo(Grx, 0x09, page<<4); + setclgd542xpage(page); unlock(&clgd542xlock); } @@ -30,7 +41,11 @@ clgd542xlinear(ulong* mem, ulong* size, ulong* align) ulong baseaddr; static Pcidev *p; - if((*size && *size < 16*MB) || (*align && (*align & (16*MB-1)))) + if(*size != 16*MB) + return 0; + if(*align == 0) + *align = 16*MB; + else if(*align & (16*MB-1)) return 0; *mem = 0; @@ -53,6 +68,10 @@ clgd542xlinear(ulong* mem, ulong* size, ulong* align) return 0; } + /* + * This doesn't work if the card is on the other side of a + * a bridge. Need to coordinate with PCI support. + */ if((baseaddr = upamalloc(0, *size, *align)) == 0) return 0; *mem = baseaddr; @@ -157,12 +176,10 @@ initcursor(Cursor* c, int xo, int yo, int index) if(vgaxi(Seqx, 0x07) & 0xF0) p = ((uchar*)gscreen.base) + storage; else { - vgaxo(Grx, 0x09, (storage>>16)<<4); + setclgd542xpage(storage>>16); p = ((uchar*)gscreen.base) + (storage & 0xFFFF); } -// p += index*1024; -memset(p, 0xFF, 16*1024); -return; + p += index*1024; for(y = yo; y < 16; y++){ p0 = c->clr[2*y]; @@ -228,6 +245,10 @@ load(Cursor* c) */ vgaxo(Seqx, 0x13, 0); vgaxo(Seqx, 0x12, sr12|0x05); +{ +for(storage = 0; storage < (2048-32)*1024; storage += 16*1024) + initcursor(c, 0, 0, 0); +} unlock(&clgd542xlock); }