linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andre Pang <ozone@algorithm.com.au>
To: Marcelo Tosatti <marcelo@conective.com.br>, linux-kernel@vger.kernel.org
Subject: [PATCH] 2.4.19-pre5 KL133/KM133 problems (screen corruption/MWQ)
Date: Thu, 4 Apr 2002 16:06:49 +1000	[thread overview]
Message-ID: <1017900409.368586.2284.nullmailer@bozar.algorithm.com.au> (raw)

Hi Marcelo,

(This is basically a resend of an earlier message to
 linux-kernel.)

People with KL133/KM133 motherboards who use the integrated
on-board video see major video corruption problems with 2.4.18.

This is because of the MWQ patch[1] which was submitted for
2.4.18.  The patch below fixes the video corruption by not
clearing bit 5, but _only_ on the K[LM]133 motherboards.  The
K[LM]133 northbridge is detected by the revision ID of the
northbridge chipset.  It thus does not affect people who use the
same VT836[35] northbridge which is present on other
motherboards, such as the KT133.

I think the patch is clean and conservative enough to go into the
production kernels.  Without the patch, the KL133 is completely
unusable in text mode and suffers major video corruption in
graphics mode; it really needs to be fixed.  Other motherboards
are completely unaffected.  I've received only positive feedback
from the patch so far.

Note that this is exactly what the VIA patches for Windows do:
the VIA 4in1 drivers normally clear bits 5, 6 and 7 of register
55, but they do not clear bit 5 if the motherboard is a K[LM]133.
This occurs on Windows 98 and Windows XP, and indicates to me
that what this patch does should be the correct behaviour.

Patch is against 2.4.19-pre5; Alan has said he'll merge it into
-ac.  It has also been submitted to Dave Jones for 2.5.

Thanks!

1. http://marc.theaimsgroup.com/?l=linux-kernel&m=100772126208656&w=2

--- linux-2.4.19-pre5/arch/i386/kernel/pci-pc.c	Thu Apr  4 15:51:19 2002
+++ linux-2.4.19-pre5-rx55-fix/arch/i386/kernel/pci-pc.c	Thu Apr  4 16:00:43 2002
@@ -1186,27 +1186,48 @@
 
 /*
  * Addresses issues with problems in the memory write queue timer in
- * certain VIA Northbridges.  This bugfix is per VIA's specifications.
- *
+ * certain VIA Northbridges.  This bugfix is per VIA's specifications,
+ * except for the KL133/KM133: clearing bit 5 on those Northbridges seems
+ * to trigger a bug in its integrated ProSavage video card, which
+ * causes screen corruption.  We only clear bits 6 and 7 for that chipset,
+ * until VIA can provide us with definitive information on why screen
+ * corruption occurs, and what exactly those bits do.
+ * 
  * VIA 8363,8622,8361 Northbridges:
  *  - bits  5, 6, 7 at offset 0x55 need to be turned off
  * VIA 8367 (KT266x) Northbridges:
  *  - bits  5, 6, 7 at offset 0x95 need to be turned off
+ * VIA 8363 rev 0x81/0x84 (KL133/KM133) Northbridges:
+ *  - bits     6, 7 at offset 0x55 need to be turned off
  */
+
+#define VIA_8363_KL133_REVISION_ID 0x81
+#define VIA_8363_KM133_REVISION_ID 0x84
+
 static void __init pci_fixup_via_northbridge_bug(struct pci_dev *d)
 {
 	u8 v;
+	u8 revision;
 	int where = 0x55;
+	int mask = 0x1f; /* clear bits 5, 6, 7 by default */
 
+	pci_read_config_byte(d, PCI_REVISION_ID, &revision);
+	
 	if (d->device == PCI_DEVICE_ID_VIA_8367_0) {
 		where = 0x95; /* the memory write queue timer register is 
-				 different for the kt266x's: 0x95 not 0x55 */
+				 different for the KT266x's: 0x95 not 0x55 */
+	} else if (d->device == PCI_DEVICE_ID_VIA_8363_0 &&
+	           (revision == VIA_8363_KL133_REVISION_ID || 
+		    revision == VIA_8363_KM133_REVISION_ID)) {
+		mask = 0x3f; /* clear only bits 6 and 7; clearing bit 5
+				causes screen corruption on the KL133/KM133 */
 	}
 
 	pci_read_config_byte(d, where, &v);
-	if (v & 0xe0) {
-		printk("Disabling VIA memory write queue: [%02x] %02x->%02x\n", where, v, v & 0x1f);
-		v &= 0x1f; /* clear bits 5, 6, 7 */
+	if (v & ~mask) {
+		printk("Disabling VIA memory write queue (PCI ID %04x, rev %02x): [%02x] %02x & %02x -> %02x\n", \
+			d->device, revision, where, v, mask, v & mask);
+		v &= mask;
 		pci_write_config_byte(d, where, v);
 	}
 }

-- 
#ozone/algorithm <ozone@algorithm.com.au>          - trust.in.love.to.save

             reply	other threads:[~2002-04-04  6:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-04  6:06 Andre Pang [this message]
2002-04-04 18:37 ` [PATCH] 2.4.19-pre5 KL133/KM133 problems (screen corruption/MWQ) Bill Davidsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1017900409.368586.2284.nullmailer@bozar.algorithm.com.au \
    --to=ozone@algorithm.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conective.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).