From 6d7bcedb9d46094bdfb9e3ed53587773df0cda0d Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 12 May 1999 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1999-05-12 --- alphapc/devvga.c | 7 ++++++- alphapc/mmu.c | 8 +++----- alphapc/screen.h | 3 ++- alphapc/vgas3.c | 12 +++++++++--- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/alphapc/devvga.c b/alphapc/devvga.c index e6b4aa907e6cd9a3c0fd873a9e22aacf63d1092d..b8161f1d00741c8bff7e18e622531fa942b32fcc 100644 --- a/alphapc/devvga.c +++ b/alphapc/devvga.c @@ -103,7 +103,12 @@ vgaread(Chan* c, void* a, long n, vlong off) else s = "off"; len += snprint(p+len, READSTR-len, "hwgc: %s\n", s); - snprint(p+len, READSTR-len, "addr: 0x%lux\n", scr->aperture); + if(scr->pciaddr) + snprint(p+len, READSTR-len, "addr: 0x%lux\n", + scr->pciaddr); + else + snprint(p+len, READSTR-len, "addr: 0x%lux\n", + scr->aperture); n = readstr(offset, a, n, p); poperror(); diff --git a/alphapc/mmu.c b/alphapc/mmu.c index 0beaaba530bbf96552f2fa5a58007cded3d7ff4e..40652ddf6f078768c2c63db71ba63e5276f07ff4 100644 --- a/alphapc/mmu.c +++ b/alphapc/mmu.c @@ -238,14 +238,12 @@ upamalloc(ulong pa, int size, int align) void *va; /* - * Viability hack. - return kmapv(((uvlong)space<<32LL)|offset, size); - return kmapio(0x88, addr, len); + * Viability hack. Only for PCI frambuffers. */ + if(pa == 0) + return 0; USED(align); -print("upa0: pa %luX size %d, align %d nextio %luX\n", pa, size, align, nextio); va = kmapv(((uvlong)0x88<<32LL)|pa, size); -print("upa1: va %luX nextio %luX\n", va, nextio); if(va == nil) return 0; return PADDR(va); diff --git a/alphapc/screen.h b/alphapc/screen.h index ac896752d94c2e630a80b69dca75e39bcbe6c344..9c1ca1e95746340832344bd9981949c29f864a77 100644 --- a/alphapc/screen.h +++ b/alphapc/screen.h @@ -89,7 +89,8 @@ struct VGAscr { int useflush; - ulong aperture; /* physical address */ + ulong aperture; /* physical address, kernel */ + ulong pciaddr; /* physical address, user */ int isupamem; int apsize; diff --git a/alphapc/vgas3.c b/alphapc/vgas3.c index a9d3bb164e64f6ee6b6e3407e5f683f78dc181aa..01e0daf8bc7ec7542c00a9e6ab2523b5b1b826c6 100644 --- a/alphapc/vgas3.c +++ b/alphapc/vgas3.c @@ -64,16 +64,18 @@ s3page(VGAscr* scr, int page) static ulong s3linear(VGAscr* scr, int* size, int* align) { - ulong aperture, oaperture; + ulong aperture, oaperture, opciaddr; int oapsize, wasupamem; Pcidev *p; oaperture = scr->aperture; oapsize = scr->apsize; + opciaddr = scr->pciaddr; wasupamem = scr->isupamem; if(wasupamem) upafree(oaperture, oapsize); scr->isupamem = 0; + scr->pciaddr = 0; if(p = pcimatch(nil, 0x5333, 0)){ aperture = p->mem[0].bar & ~0x0F; @@ -84,11 +86,15 @@ s3linear(VGAscr* scr, int* size, int* align) aperture = upamalloc(aperture, *size, *align); if(aperture == 0){ - if(wasupamem && upamalloc(oaperture, oapsize, 0)) + if(wasupamem && upamalloc(oaperture, oapsize, 0)){ scr->isupamem = 1; + scr->pciaddr = opciaddr; + } } - else + else{ + scr->pciaddr = p->mem[0].bar & ~0x0F; scr->isupamem = 1; + } return aperture; }