From fc15c3cbe0808160a312ec4225c25ac17a72f210 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 11 Feb 2000 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2000-02-11 --- pc/devarch.c | 2 ++ pc/vganeomagic.c | 35 +++++++++++++++++++---------------- port/devbridge.c | 4 ++-- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/pc/devarch.c b/pc/devarch.c index 23410ed60b0242b357cfedd4179ea6e3ebe0b0c2..f508dcf25db39b9a7c360454cea60e769369f8b9 100644 --- a/pc/devarch.c +++ b/pc/devarch.c @@ -441,6 +441,8 @@ static X86type x86amd[] = { 5, 8, 11, "AMD-K6 3D", }, /* guesswork */ { 5, 9, 11, "AMD-K6 3D+", },/* guesswork */ + { 6, 1, 11, "AMD-Athlon", }, + { 4, -1, 22, "Am486", }, /* guesswork */ { 5, -1, 23, "AMD-K5/K6", }, /* guesswork */ diff --git a/pc/vganeomagic.c b/pc/vganeomagic.c index 543094d0811b75294a50850ba3202ddceb64aa79..58bec92621539ccc74f71eb100f967fa80edd83b 100644 --- a/pc/vganeomagic.c +++ b/pc/vganeomagic.c @@ -21,10 +21,6 @@ typedef struct { int addr; } CursorNM; -enum { - CursorMMIO = 0x1000, /* MagicMedia 256AV */ -}; - static ulong neomagiclinear(VGAscr* scr, int* size, int* align) { @@ -39,6 +35,7 @@ neomagiclinear(VGAscr* scr, int* size, int* align) aperture = 0; if(p = pcimatch(nil, 0x10C8, 0)){ switch(p->did){ + case 0x0004: /* MagicGraph 128XD */ case 0x0005: /* MagicMedia 256AV */ aperture = p->mem[0].bar & ~0x0F; *size = p->mem[0].size; @@ -74,20 +71,26 @@ neomagicenable(VGAscr* scr) { Pcidev *p; Physseg seg; - int size, align, asize; + int align, curoff, size, vmsize; ulong aperture; /* * Only once, can't be disabled for now. - * scr->io holds the virtual address of - * the MMIO registers. + * scr->io holds the physical address of the cursor registers + * in the MMIO space. This may need to change for older chips + * which have the MMIO space offset in the framebuffer region. */ if(scr->io) return; if(p = pcimatch(nil, 0x10C8, 0)){ switch(p->did){ + case 0x0004: /* MagicGraph 128XD */ + curoff = 0x100; + vmsize = 2048*1024; + break; case 0x0005: /* MagicMedia 256AV */ - asize = 2560*1024; + curoff = 0x1000; + vmsize = 2560*1024; break; default: return; @@ -107,14 +110,14 @@ neomagicenable(VGAscr* scr) seg.size = p->mem[1].size; addphysseg(&seg); - scr->io = (ulong)KADDR(scr->io); + scr->io += curoff; size = p->mem[0].size; align = 0; aperture = neomagiclinear(scr, &size, &align); if(aperture) { scr->aperture = aperture; - scr->apsize = asize; + scr->apsize = vmsize; memset(&seg, 0, sizeof(seg)); seg.attr = SG_PHYSICAL; seg.name = smalloc(NAMELEN); @@ -132,16 +135,16 @@ neomagiccurdisable(VGAscr* scr) if(scr->io == 0) return; - cursornm = KADDR(scr->io+CursorMMIO); + cursornm = KADDR(scr->io); cursornm->enable = 0; } static void neomagicinitcursor(VGAscr* scr, int xo, int yo, int index) { - int x, y; uchar *p; uint p0, p1; + int x, y; p = KADDR(scr->aperture); p += scr->storage + index*1024; @@ -187,7 +190,7 @@ neomagiccurload(VGAscr* scr, Cursor* curs) if(scr->io == 0) return; - cursornm = KADDR(scr->io+CursorMMIO); + cursornm = KADDR(scr->io); cursornm->enable = 0; memmove(&scr->Cursor, curs, sizeof(Cursor)); @@ -203,7 +206,7 @@ neomagiccurmove(VGAscr* scr, Point p) if(scr->io == 0) return 1; - cursornm = KADDR(scr->io+CursorMMIO); + cursornm = KADDR(scr->io); index = 0; if((x = p.x+scr->offset.x) < 0){ @@ -242,7 +245,7 @@ neomagiccurenable(VGAscr* scr) neomagicenable(scr); if(scr->io == 0) return; - cursornm = KADDR(scr->io+CursorMMIO); + cursornm = KADDR(scr->io); cursornm->enable = 0; /* @@ -257,7 +260,7 @@ neomagiccurenable(VGAscr* scr) * 2KB of the framebuffer and initialise them to be * transparent. */ - scr->storage = /*scr->apsize*/2560*1024-2*1024; + scr->storage = scr->apsize-2*1024; /* * Load, locate and enable the 64x64 cursor. diff --git a/port/devbridge.c b/port/devbridge.c index 3754d13c8c826c09e2efd9f803acaa77baa20121..774a71b226d90cf7dfedc5f96c8101c7be1d2c72 100644 --- a/port/devbridge.c +++ b/port/devbridge.c @@ -986,7 +986,7 @@ if(0)print("devbridge: etherread: blocklen = %d\n", blocklen(bp)); if(bp == nil || port->closed) break; if(waserror()) { -print("etherread bridge error\n"); +//print("etherread bridge error\n"); if(bp) freeb(bp); continue; @@ -1026,7 +1026,7 @@ print("etherread bridge error\n"); if(bp) freeb(bp); } -print("etherread: trying to exit\n"); +//print("etherread: trying to exit\n"); port->readp = nil; portfree(port); qunlock(b);