*BSD News Article 4668


Return to BSD News archive

Xref: sserve comp.unix.bsd:4716 comp.windows.x:44873
Path: sserve!manuel!munnari.oz.au!spool.mu.edu!uunet!mcsun!uknet!edcastle!aiai!richard
From: richard@aiai.ed.ac.uk (Richard Tobin)
Newsgroups: comp.unix.bsd,comp.windows.x
Subject: X386 patch
Message-ID: <7477@skye.ed.ac.uk>
Date: 8 Sep 92 12:58:47 GMT
Organization: AIAI, University of Edinburgh, Scotland
Lines: 29

I had a problem with X under 386BSD (on an Elonex 33MHz 386 with Genoa
SVGA) that the CRTC registers weren't being set, so the display was
completely trashed.  This turns out to be because the bit in CRTC
register 17 that prevents writing to CRTC registers 0-7 was set
(presumably the BIOS sets it when it's booted - I don't know why).
The solution is to clear this bit before setting the other registers.

Here's the patch:

*** ddx/x386/vga/vgaHW.c.orig	Mon Aug 26 20:43:24 1991
--- ddx/x386/vga/vgaHW.c	Tue Sep  8 12:51:48 1992
***************
*** 125,130 ****
--- 125,134 ----
    for (i=0; i<16; i++) { outb(0x3C0,i); outb(0x3C0, restore->Attribute[i]); }
    for (i=16; i<21;i++) { outb(0x3C0,i | 0x20);
  			 outb(0x3C0, restore->Attribute[i]); }
+ 
+   /* Ensure CRTC registers 0-7 are writable by clearing bit 7 of register 17 */
+   outw(vgaIOBase + 4, ((restore->CRTC[17] & 0x7f) << 8) | 17);
+ 
    for (i=0; i<24; i++) outw(vgaIOBase + 4,(restore->CRTC[i] << 8) | i);
    for (i=0; i<9;  i++) outw(0x3CE, (restore->Graphics[i] << 8) | i);

-- Richard
-- 
Richard Tobin,
AI Applications Institute,                                R.Tobin@ed.ac.uk
Edinburgh University.