M carrera/segment.h => carrera/segment.h +1 -1
@@ 10,6 10,6 @@ Physseg physseg[] =
{ SG_PHYSICAL, "eisavga", Eisavgaphys, 128*1024, 0, 0 },
{ SG_PHYSICAL, "bootrom", 0x1fc00000, 256*1024, 0, 0 },
{ SG_PHYSICAL, "nvram", 0xe0009000, 12*1024, 0, 0 },
- { SG_PHYSICAL, "fb", 0x40000000, 4*1024*1024, 0, 0 },
+ { SG_PHYSICAL, "fb", 0x40000000, 4*1024*1024, 0, 0 },
{ 0, 0, 0, 0, 0, 0 },
};
M pc/devvga.c => pc/devvga.c +68 -79
@@ 18,6 18,7 @@ enum
/* imported */
extern Subfont defont0;
+extern Cursor curs; /* barf */
/* exported */
Bitmap gscreen;
@@ 26,7 27,7 @@ Cursor curcursor; /* current cursor */
/* vga screen */
static Lock screenlock;
-static ulong colormap[256][3];
+static ulong colormap[Pcolours][3];
/* cga screen */
static int cga = 1; /* true if in cga mode */
@@ 48,47 49,20 @@ static Point curpos;
#define SCREENMEM (0xA0000 | KZERO)
#define CGASCREEN ((uchar*)(0xB8000 | KZERO))
-/*
- * definitions of known cards
- */
-typedef struct Vgacard Vgacard;
-struct Vgacard
-{
- char *name;
- void (*setpage)(int); /* routine to page though display memory */
-};
-
-static void nopage(int);
-static void cirruspage(int);
-extern void et4000page(int);
-extern void s3page(int);
-
-Vgacard vgachips[] =
-{
- { "vga", nopage, },
- { "clgd542x", cirruspage, },
- { "et4000", et4000page, },
- { "s3", s3page, },
- { 0, 0, },
-};
-
-Vgacard *vgacard = &vgachips[0]; /* current vga card */
+static void nopage(int);
-extern Hwgc bt485hwgc;
-extern Hwgc et4000hwgc;
-extern Hwgc s3hwgc;
-extern Hwgc tvp3020hwgc;
+static Vgac vga = {
+ "vga",
+ nopage,
-static Hwgc *hwcursor[] = {
- &bt485hwgc,
- &et4000hwgc,
- &s3hwgc,
- &tvp3020hwgc,
0,
};
-Hwgc *hwgc;
-extern Cursor curs; /* barf */
+static Vgac *vgactlr = &vga; /* available VGA ctlrs */
+static Vgac *vgac; /* current VGA ctlr */
+static Hwgc *hwgctlr; /* available HWGC's */
+Hwgc *hwgc; /* current HWGC */
+
static char interlaced[2];
/*
@@ 203,12 177,17 @@ vgaread(Chan *c, void *buf, long n, ulong offset)
char cbuf[64];
ushort *sp;
ulong *lp;
+ Vgac *vgacp;
switch(c->qid.path&~CHDIR){
case Qdir:
return devdirread(c, buf, n, vgadir, Nvga, devgen);
case Qvgactl:
- port = sprint(cbuf, "type: %s\n", vgacard->name);
+ if(vgac == 0)
+ vgacp = &vga;
+ else
+ vgacp = vgac;
+ port = sprint(cbuf, "type: %s\n", vgacp->name);
port += sprint(cbuf+port, "size: %dx%dx%d%s\n",
gscreen.r.max.x, gscreen.r.max.y,
1<<gscreen.ldepth, interlaced);
@@ 253,8 232,10 @@ vgabread(Chan *c, long n, ulong offset)
static void
vgactl(char *arg)
{
- int i, x, y, z;
+ int x, y, z;
char *cp, *field[3];
+ Hwgc *hwgcp;
+ Vgac *vgacp;
if(getfields(arg, field, 3, " ") != 2)
error(Ebadarg);
@@ 269,13 250,13 @@ vgactl(char *arg)
return;
}
- for(i = 0; hwcursor[i]; i++){
- if(strcmp(field[1], hwcursor[i]->name) == 0){
+ for(hwgcp = hwgctlr; hwgcp; hwgcp = hwgcp->link){
+ if(strcmp(field[1], hwgcp->name) == 0){
if(hwgc)
(*hwgc->disable)();
else
cursoroff(1);
- hwgc = hwcursor[i];
+ hwgc = hwgcp;
(*hwgc->enable)();
setcursor(&curs);
cursoron(1);
@@ 284,9 265,9 @@ vgactl(char *arg)
}
}
else if(strcmp(field[0], "type") == 0){
- for(i = 0; vgachips[i].name; i++){
- if(strcmp(field[1], vgachips[i].name) == 0){
- vgacard = &vgachips[i];
+ for(vgacp = vgactlr; vgacp; vgacp = vgacp->link){
+ if(strcmp(field[1], vgacp->name) == 0){
+ vgac = vgacp;
return;
}
}
@@ 577,21 558,18 @@ setmode(VGAmode *vga)
vgao(MiscW, vga->misc);
- for(i = 1; i < NSeqx; i++){
- if(i == 1)
- continue;
+ for(i = 2; i < sizeof(vga->sequencer); i++)
vgaxo(Seqx, i, vga->sequencer[i]);
- }
vgaxo(Seqx, 0x00, seq00);
vgaxo(Crtx, 0x11, vga->crt[0x11] & ~0x80);
- for(i = 0; i < NCrtx; i++)
+ for(i = 0; i < sizeof(vga->crt); i++)
vgaxo(Crtx, i, vga->crt[i]);
- for(i = 0; i < NGrax; i++)
+ for(i = 0; i < sizeof(vga->graphics); i++)
vgaxo(Grx, i, vga->graphics[i]);
- for(i = 0; i < NAttrx; i++)
+ for(i = 0; i < sizeof(vga->attribute); i++)
vgaxo(Attrx, i, vga->attribute[i]);
vgaxo(Seqx, 0x01, seq01);
@@ 648,7 626,7 @@ setscreen(int maxx, int maxy, int ldepth)
gscreen.r.max = Pt(maxx, maxy);
gscreen.clipr = gscreen.r;
for(i = 0; i < gscreen.width*BY2WD*maxy; i += Footprint){
- vgacard->setpage(i>>Footshift);
+ vgac->page(i>>Footshift);
memset(gscreen.base, 0xff, Footprint);
}
@@ 685,7 663,7 @@ setscreen(int maxx, int maxy, int ldepth)
/* default color map (has to be outside the lock) */
switch(ldepth){
case 3:
- for(i = 0; i < 256; i++)
+ for(i = 0; i < Pcolours; i++)
setcolor(i, xnto32(i>>5, 3), xnto32(i>>2, 3), xnto32(i, 2));
setcolor(0x55, xnto32(0x15, 6), xnto32(0x15, 6), xnto32(0x15, 6));
setcolor(0xaa, xnto32(0x2a, 6), xnto32(0x2a, 6), xnto32(0x2a, 6));
@@ 734,7 712,7 @@ byteload(uchar *q, uchar *data, int m, int *page, uchar *e)
diff = 0;
if(q >= e){
pg = ++*page;
- vgacard->setpage(pg);
+ vgac->page(pg);
q -= Footprint;
diff -= Footprint;
}
@@ 755,7 733,7 @@ lineload(uchar *q, uchar *data, int len, int *page, uchar *e)
diff = 0;
if(q >= e){
pg = ++*page;
- vgacard->setpage(pg);
+ vgac->page(pg);
q -= Footprint;
diff -= Footprint;
}
@@ 765,7 743,7 @@ lineload(uchar *q, uchar *data, int len, int *page, uchar *e)
if(rem < len){
memmove(q, data, rem);
pg = ++*page;
- vgacard->setpage(pg);
+ vgac->page(pg);
q -= Footprint;
diff -= Footprint;
memmove(q+rem, data+rem, len-rem);
@@ 803,7 781,7 @@ screenload(Rectangle r, uchar *data, int tl, int l, int dolock)
off = q - (uchar*)gscreen.base;
page = off>>Footshift;
- vgacard->setpage(page);
+ vgac->page(page);
q = ((uchar*)gscreen.base) + (off&(Footprint-1));
sw = gscreen.width*sizeof(ulong);
@@ 890,7 868,7 @@ byteunload(uchar *q, uchar *data, int m, int *page, uchar *e)
diff = 0;
if(q >= e){
pg = ++*page;
- vgacard->setpage(pg);
+ vgac->page(pg);
q -= Footprint;
diff -= Footprint;
}
@@ 911,7 889,7 @@ lineunload(uchar *q, uchar *data, int len, int *page, uchar *e)
diff = 0;
if(q >= e){
pg = ++*page;
- vgacard->setpage(pg);
+ vgac->page(pg);
q -= Footprint;
diff -= Footprint;
}
@@ 921,7 899,7 @@ lineunload(uchar *q, uchar *data, int len, int *page, uchar *e)
if(rem < len){
memmove(data, q, rem);
pg = ++*page;
- vgacard->setpage(pg);
+ vgac->page(pg);
q -= Footprint;
diff -= Footprint;
memmove(data+rem, q+rem, len-rem);
@@ 960,7 938,7 @@ screenunload(Rectangle r, uchar *data, int tl, int l, int dolock)
off = q - (uchar*)gscreen.base;
page = off>>Footshift;
- vgacard->setpage(page);
+ vgac->page(page);
q = ((uchar*)gscreen.base) + (off&(Footprint-1));
sw = gscreen.width*sizeof(ulong);
@@ 1074,9 1052,6 @@ screenputs(char *s, int n)
}
/*
- * expand n bits of color to 32
- */
-/*
* paging routines for different cards
*/
static void
@@ 1227,18 1202,18 @@ getcolor(ulong p, ulong *pr, ulong *pg, ulong *pb)
switch(gscreen.ldepth){
default:
- x = 0xf;
+ x = 0xF;
break;
case 3:
- x = 0xff;
+ x = 0xFF;
break;
}
p &= x;
p ^= x;
lock(&palettelock);
- *pr = colormap[p][0];
- *pg = colormap[p][1];
- *pb = colormap[p][2];
+ *pr = colormap[p][Pred];
+ *pg = colormap[p][Pgreen];
+ *pb = colormap[p][Pblue];
unlock(&palettelock);
}
@@ 1249,22 1224,22 @@ setcolor(ulong p, ulong r, ulong g, ulong b)
switch(gscreen.ldepth){
default:
- x = 0xf;
+ x = 0xF;
break;
case 3:
- x = 0xff;
+ x = 0xFF;
break;
}
p &= x;
p ^= x;
lock(&palettelock);
- colormap[p][0] = r;
- colormap[p][1] = g;
- colormap[p][2] = b;
- vgao(DACWx, p);
- vgao(DACData, r>>(32-6));
- vgao(DACData, g>>(32-6));
- vgao(DACData, b>>(32-6));
+ colormap[p][Pred] = r;
+ colormap[p][Pgreen] = g;
+ colormap[p][Pblue] = b;
+ vgao(PaddrW, p);
+ vgao(Pdata, r>>(32-6));
+ vgao(Pdata, g>>(32-6));
+ vgao(Pdata, b>>(32-6));
unlock(&palettelock);
return ~0;
}
@@ 1461,3 1436,17 @@ cursorunlock(void)
cursor.frozen = 0;
unlock(&cursor);
}
+
+void
+addhwgclink(Hwgc *hwgcp)
+{
+ hwgcp->link = hwgctlr;
+ hwgctlr = hwgcp;
+}
+
+void
+addvgaclink(Vgac *vgacp)
+{
+ vgacp->link = vgactlr;
+ vgactlr = vgacp;
+}
M pc/ether8003.c => pc/ether8003.c +1 -1
@@ 191,7 191,7 @@ reset(Ether *ether)
dp8390setea(ether);
if(getisa(ether->mem, ether->size, 0) == 0)
- panic("ether8003: %lux reused", ether->mem);
+ panic("ether8003: 0x%lux reused", ether->mem);
return 0;
}
M pc/io.h => pc/io.h +1 -0
@@ 31,4 31,5 @@ enum
enum {
MaxEISA = 16,
+ EISAconfig = 0xC80,
};
M pc/vga.h => pc/vga.h +34 -17
@@ 10,23 10,23 @@ enum {
FeatureW = 0x03DA, /* Feature Control (W) */
Seqx = 0x03C4, /* Sequencer Index, Data at Seqx+1 */
- NSeqx = 0x05,
-
Crtx = 0x03D4, /* CRT Controller Index, Data at Crtx+1 */
- NCrtx = 0x19,
-
Grx = 0x03CE, /* Graphics Controller Index, Data at Grx+1 */
- NGrax = 0x09,
-
Attrx = 0x03C0, /* Attribute Controller Index and Data */
- NAttrx = 0x15,
-
- DACMask = 0x03C6, /* DAC Mask */
- DACRx = 0x03C7, /* DAC Read Index (W) */
- DACSts = 0x03C7, /* DAC Status (R) */
- DACWx = 0x03C8, /* DAC Write Index */
- DACData = 0x03C9, /* DAC Data */
- NDACx = 0x100,
+
+ PaddrW = 0x03C8, /* Palette Address Register, write */
+ Pdata = 0x03C9, /* Palette Data Register */
+ Pixmask = 0x03C6, /* Pixel Mask Register */
+ PaddrR = 0x03C7, /* Palette Address Register, read */
+ Pstatus = 0x03C7, /* DAC Status (RO) */
+
+ Pcolours = 256, /* Palette */
+ Pred = 0,
+ Pgreen = 1,
+ Pblue = 2,
+
+ Pblack = 0x00,
+ Pwhite = 0xFF,
};
#define vgai(port) inb(port)
@@ 36,15 36,32 @@ extern int vgaxi(long, uchar);
extern int vgaxo(long, uchar, uchar);
/*
- * Definitions of known hardware graphics cursors.
+ * Definitions of known VGA controllers.
*/
-typedef struct Hwgc {
+typedef struct Vgac Vgac;
+struct Vgac {
char *name;
+ void (*page)(int);
+
+ Vgac* link;
+};
+
+/*
+ * Definition of known hardware graphics cursors.
+ */
+typedef struct Hwgc Hwgc;
+struct Hwgc {
+ char* name;
void (*enable)(void);
void (*load)(Cursor*);
int (*move)(Point);
void (*disable)(void);
-} Hwgc;
+
+ Hwgc* link;
+};
+
+extern void addvgaclink(Vgac*);
+extern void addhwgclink(Hwgc*);
extern Hwgc *hwgc;
M pc/vgabt485.c => pc/vgabt485.c +13 -5
@@ 45,7 45,7 @@ enum {
* addressing.
*/
static ushort dacxreg[4] = {
- DACWx, DACData, DACMask, DACSts
+ PaddrW, Pdata, Pixmask, PaddrR
};
static uchar
@@ 183,12 183,12 @@ enable(void)
* cursor colour 2, 3 (black).
*/
bt485o(ColorW, 0x00);
- bt485o(Color, 0xFF); bt485o(Color, 0xFF); bt485o(Color, 0xFF);
+ bt485o(Color, Pwhite); bt485o(Color, Pwhite); bt485o(Color, Pwhite);
- bt485o(Color, 0xFF); bt485o(Color, 0xFF); bt485o(Color, 0xFF);
+ bt485o(Color, Pwhite); bt485o(Color, Pwhite); bt485o(Color, Pwhite);
- bt485o(Color, 0x00); bt485o(Color, 0x00); bt485o(Color, 0x00);
- bt485o(Color, 0x00); bt485o(Color, 0x00); bt485o(Color, 0x00);
+ bt485o(Color, Pblack); bt485o(Color, Pblack); bt485o(Color, Pblack);
+ bt485o(Color, Pblack); bt485o(Color, Pblack); bt485o(Color, Pblack);
unlock(&palettelock);
@@ 256,4 256,12 @@ Hwgc bt485hwgc = {
load,
move,
disable,
+
+ 0,
};
+
+void
+vgabt485link(void)
+{
+ addhwgclink(&bt485hwgc);
+}
M pc/vgaet4000.c => pc/vgaet4000.c +16 -0
@@ 254,6 254,8 @@ Hwgc et4000hwgc = {
load,
move,
disable,
+
+ 0,
};
void
@@ 267,3 269,17 @@ et4000page(int page)
else
setet4000page(page);
}
+
+static Vgac et4000 = {
+ "et4000",
+ et4000page,
+
+ 0,
+};
+
+void
+vgaet4000link(void)
+{
+ addvgaclink(&et4000);
+ addhwgclink(&et4000hwgc);
+}
M pc/vgas3.c => pc/vgas3.c +20 -7
@@ 26,9 26,6 @@ sets3page(int page)
{
uchar crt51;
- /*
- * I don't understand why these are different.
- */
if(gscreen.ldepth == 3){
/*
* The S3 registers need to be unlocked for this.
@@ 84,14 81,14 @@ enable(void)
* stack in case we are using a 16-bit RAMDAC.
* Why are these colours reversed?
*/
- vgaxo(Crtx, 0x0E, 0xFF);
- vgaxo(Crtx, 0x0F, 0x00);
+ vgaxo(Crtx, 0x0E, Pwhite);
+ vgaxo(Crtx, 0x0F, Pblack);
vgaxi(Crtx, 0x45);
for(i = 0; i < 4; i++)
- vgaxo(Crtx, 0x4A, 0xFF);
+ vgaxo(Crtx, 0x4A, Pwhite);
vgaxi(Crtx, 0x45);
for(i = 0; i < 4; i++)
- vgaxo(Crtx, 0x4B, 0x00);
+ vgaxo(Crtx, 0x4B, Pblack);
/*
* Find a place for the cursor data in display memory.
@@ 230,6 227,8 @@ Hwgc s3hwgc = {
load,
move,
disable,
+
+ 0,
};
void
@@ 243,3 242,17 @@ s3page(int page)
else
sets3page(page);
}
+
+static Vgac s3 = {
+ "s3",
+ s3page,
+
+ 0,
+};
+
+void
+vgas3link(void)
+{
+ addvgaclink(&s3);
+ addhwgclink(&s3hwgc);
+}
M pc/vgatvp3020.c => pc/vgatvp3020.c +12 -4
@@ 30,7 30,7 @@ enum {
* addressing.
*/
static ushort dacxreg[4] = {
- DACWx, DACData, DACMask, DACSts
+ PaddrW, Pdata, Pixmask, PaddrR
};
static uchar
@@ 182,9 182,9 @@ enable(void)
* cursor colour 1 (white),
* cursor colour 2 (black).
*/
- tvp3020xo(0x20, 0xFF); tvp3020xo(0x21, 0xFF); tvp3020xo(0x22, 0xFF);
- tvp3020xo(0x23, 0xFF); tvp3020xo(0x24, 0xFF); tvp3020xo(0x25, 0xFF);
- tvp3020xo(0x26, 0x00); tvp3020xo(0x27, 0x00); tvp3020xo(0x28, 0x00);
+ tvp3020xo(0x20, Pwhite); tvp3020xo(0x21, Pwhite); tvp3020xo(0x22, Pwhite);
+ tvp3020xo(0x23, Pwhite); tvp3020xo(0x24, Pwhite); tvp3020xo(0x25, Pwhite);
+ tvp3020xo(0x26, Pblack); tvp3020xo(0x27, Pblack); tvp3020xo(0x28, Pblack);
unlock(&palettelock);
@@ 243,4 243,12 @@ Hwgc tvp3020hwgc = {
load,
move,
disable,
+
+ 0,
};
+
+void
+vgatvp3020link(void)
+{
+ addhwgclink(&tvp3020hwgc);
+}
M port/proc.c => port/proc.c +0 -8
@@ 406,9 406,6 @@ sleep(Rendez *r, int (*f)(void*), void *arg)
{
int s;
- if((getstatus()&IE) == 0)
- print("sleep hi %lux\n", getcallerpc(r));
-
sleep1(r, f, arg);
if(up->notepending == 0)
sched(); /* notepending may go true while asleep */
@@ 437,9 434,6 @@ tsleep(Rendez *r, int (*fn)(void*), void *arg, int ms)
ulong when;
Proc *f, **l;
- if((getstatus()&IE) == 0)
- print("tsleep hi %lux\n", getcallerpc(r));
-
when = MS2TK(ms)+MACHP(0)->ticks;
lock(&talarm);
@@ 923,8 917,6 @@ procctl(Proc *p)
void
error(char *err)
{
- if((getstatus()&IE) == 0)
- print("error hi %lux\n", getcallerpc(err));
spllo();
strncpy(up->error, err, ERRLEN);
nexterror();
M port/qlock.c => port/qlock.c +0 -4
@@ 10,8 10,6 @@ qlock(QLock *q)
{
Proc *p, *mp;
- if((getstatus()&IE)==0)
- print("qlock hi %lux\n", getcallerpc(q));
lock(&q->use);
if(!q->locked) {
q->locked = 1;
@@ 50,8 48,6 @@ qunlock(QLock *q)
{
Proc *p;
- if((getstatus()&IE)==0)
- print("qunlock hi %lux\n", getcallerpc(q));
lock(&q->use);
p = q->head;
if(p) {