M alphapc/devvga.c => alphapc/devvga.c +6 -1
@@ 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();
M alphapc/mmu.c => alphapc/mmu.c +3 -5
@@ 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);
M alphapc/screen.h => alphapc/screen.h +2 -1
@@ 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;
M alphapc/vgas3.c => alphapc/vgas3.c +9 -3
@@ 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;
}