[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#476876: [PATCH] S3 Trio64 on Alpha



> I can put the S3 back in and get the lspci output for you, but it will
> be a few days before I can do so. The card itself and the bus it goes
> into is working, as OpenVMS on the same system does correctly
> initialize and use the display with the S3 card in place.

I've searched in Google the similar bug reports and found that there was
the problems with Trio64 on Alphas. More frequent advice to reporters
was to enable "no_pci_disconnect" driver's option (you can type
"no_pci_disconnect" in Google and read these bug reports). But this
option was removed long time ago.

There is register in S3 Trio64 which disables PCI Disconnect. Also there
is register which disables or enables PCI Read Burst. I've wrote the
patch for s3 driver from Etch (0.4.1-5) which adds two new options:
Option "pci_burst" and Option "no_pci_disconnect". You can try all the
four combinations of these options. By default "(if ommited) pci_burst"
is "on" (PCI Read Burst is enabled) and "no_pci_disconnect" is "off"
(PCI Disconnect is enabled). In original driver from Etch PCI Read Burst
is disabled and PCI Disconnect is enabled.

If you are still interested and will have some time in future, you will
be able to patch source from Debian (apt-get source
xserver-xorg-video-s3) and recompile driver.

Notes: 

1. Sometimes Trio64 can hangs your system when switching between
graphical mode and console (even on start). This is due to enabling
graphic mode without waiting vertical sync. This bug was corrected only
in upstream but not in Etch. So if you get this problem, you need to try
again.

2. Don't make the missprints in option names. (no_pci_disconnect,
pci_burst). An example:

Option "pci_burst" "off"
Option "no_pci_disconnect"

Patch is attached. I've verified patch by dumping S3 registers after
initialization -- the new options are working correctly.

diff -u xserver-xorg-video-s3-0.4.1/src/s3_driver.c xserver-xorg-video-s3/src/s3_driver.c
--- xserver-xorg-video-s3-0.4.1/src/s3_driver.c	2006-04-04 16:06:58.000000000 +0400
+++ xserver-xorg-video-s3/src/s3_driver.c	2008-08-07 22:02:21.000000000 +0400
@@ -157,7 +157,9 @@
 	OPTION_SLOW_DRAM_REFRESH,
 	OPTION_SLOW_DRAM,
 	OPTION_SLOW_EDODRAM,
-	OPTION_SLOW_VRAM
+	OPTION_SLOW_VRAM,
+	OPTION_PCI_BURST,
+	OPTION_NO_PCI_DISC
 } S3Opts;
 
 static OptionInfoRec S3Options[] = {
@@ -167,6 +169,8 @@
 	{ OPTION_SLOW_DRAM, "slow_dram", OPTV_BOOLEAN, {0}, FALSE },
 	{ OPTION_SLOW_EDODRAM, "slow_edodram", OPTV_BOOLEAN, {0}, FALSE },
 	{ OPTION_SLOW_VRAM, "slow_vram", OPTV_BOOLEAN, {0}, FALSE },
+	{ OPTION_PCI_BURST, "pci_burst", OPTV_BOOLEAN, {0}, FALSE },
+	{ OPTION_NO_PCI_DISC, "no_pci_disconnect", OPTV_BOOLEAN, {0}, FALSE },
 	{ -1, NULL, OPTV_NONE, {0}, FALSE }
 };
 
@@ -459,6 +463,8 @@
 	} else
 		pS3->SlowVRAM = FALSE;
 
+	pS3->PCIBurst = xf86ReturnOptValBool(S3Options, OPTION_PCI_BURST, TRUE);
+	pS3->NoPCIDisc = xf86ReturnOptValBool(S3Options, OPTION_NO_PCI_DISC, FALSE);
         if (pScrn->numEntities > 1) {      
                 S3FreeRec(pScrn);
                 return FALSE;
@@ -1198,13 +1204,6 @@
 	outb(vgaCRIndex, 0x34);
 	outb(vgaCRReg, new->cr34);
 
-	if (pS3->SlowDRAMRefresh)
-		new->cr3a = 0xb7;
-	else
-		new->cr3a = 0xb5;
-	outb(vgaCRIndex, 0x3a);
-	outb(vgaCRReg, new->cr3a);
-
 	if (pS3->Chipset != PCI_CHIP_AURORA64VP) {
 		new->cr3b = (pVga->CRTC[0] + pVga->CRTC[4] + 1) / 2;
 		outb(vgaCRIndex, 0x3b);
@@ -1462,13 +1461,57 @@
 		outb(vgaCRReg, bdelay);
 	}
 
+ 
+	/*
+	 *  Overriding refresh cycles count.
+	 *
+	 *  1-0: Number of refresh cycles per scanline
+	 *  2: Enable alternate refresh count control (1 = enable bits 0-1)
+	 *  4: Colour enhanced mode (1 = enable)
+	 */
+	outb(vgaCRIndex, 0x3a);
+	new->cr3a = inb(vgaCRReg) & 0xfc;
+ 	if (pS3->SlowDRAMRefresh)
+		new->cr3a |= 0x17;
+ 	else
+		new->cr3a |= 0x15;
+	outb(vgaCRReg, new->cr3a);	
+	
+	/*
+	 *  Disable or enable PCI Read Bursts
+	 *  cr3a_7: PCIRB DISA: 0 - enabled, 1 - disabled 
+	 * 
+	 *  cr66_7 must be set to 1 before cr3a_7 is set to 1 
+	 *  (from documentation) 
+	 */
+	if (!pS3->PCIBurst) {
+		outb(vgaCRIndex, 0x66);
+		outb(vgaCRReg, inb(vgaCRReg) | 0x80);
+
+		outb(vgaCRIndex, 0x3a);
+		outb(vgaCRReg, inb(vgaCRReg) | 0x80);
+	} else {
+		outb(vgaCRIndex, 0x3a);
+		outb(vgaCRReg, inb(vgaCRReg) & 0x7f);
+	}
+
+	/*
+	 *  Setting PCI Disconnect. 
+	 *  cr66_7: PCI DE: 0 - disabled, 1 - enabled
+	 */
 	outb(vgaCRIndex, 0x66);
 	new->cr66 = inb(vgaCRReg);
-	if (pS3->S3NewMMIO)
-		new->cr66 |= 0x88;
-	else
-		new->cr66 |= 0x80;
-	outb(vgaCRReg, new->cr66);
+ 
+	if (pS3->NoPCIDisc) {
+		if (pS3->S3NewMMIO)
+			new->cr66 &= 0xf7;
+		outb(vgaCRReg, new->cr66 & 0x7f);
+	} else {
+		if (pS3->S3NewMMIO)
+			new->cr66 |= 0x08;
+		outb(vgaCRReg, new->cr66 | 0x80);
+	}
+		
 
 	if (pS3->SlowVRAM) {
 		/*
diff -u xserver-xorg-video-s3-0.4.1/src/s3.h xserver-xorg-video-s3/src/s3.h
--- xserver-xorg-video-s3-0.4.1/src/s3.h	2006-04-08 05:38:57.000000000 +0400
+++ xserver-xorg-video-s3/src/s3.h	2008-08-07 21:28:51.000000000 +0400
@@ -102,6 +102,8 @@
 	Bool			SlowEDODRAM;
 	Bool			SlowVRAM;
 	Bool			S3NewMMIO;
+	Bool                    PCIBurst;
+	Bool                    NoPCIDisc;
 	Bool			PCIRetry;
 	Bool			ColorExpandBug;
 

Reply to: