All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ondrej Zary <linux@rainbow-software.org>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: linux-kernel@vger.kernel.org, Chuck Ebbert <76306.1226@compuserve.com>
Subject: Re: Debugging APM - cat /proc/apm produces oops
Date: Tue, 25 Jul 2006 22:04:57 +0200	[thread overview]
Message-ID: <200607252204.57795.linux@rainbow-software.org> (raw)
In-Reply-To: <20060724010658.687e78be.sfr@canb.auug.org.au>

This is my "fix" - patches BIOS in shadow RAM. Ugly but allows me to use APM battery status.
Probably not worth including in the kernel but it might help someone...

--- linux-2.6.17.5-orig/drivers/pci/quirks.c	2006-07-15 04:38:43.000000000 +0200
+++ linux-2.6.17.5/drivers/pci/quirks.c	2006-07-26 18:41:01.000000000 +0200
@@ -1404,6 +1404,36 @@
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1_53c810);
 
+#ifdef CONFIG_X86
+/* 
+ * Fix DTK FortisPro TOP-5A APM BIOS bug which causes oops on /proc/apm access
+ * Most probably works only with the latest BIOS rev 2.31
+ */
+static void __devinit quirk_dtk_top5a(struct pci_dev *dev)
+{
+	u8 *patch_addr_1 = __va(0xf2f9d);
+	u8 orig_1[] = { 0x89, 0x5e, 0xfe }; /* mov [bp-2],bx -> this causes oops */
+	u8 patch_1[] = { 0x90, 0x90, 0x90 }; /* 3x nop */
+	u8 *patch_addr_2 = __va(0xf2fad);
+	u8 orig_2[] = { 0x83, 0x7e, 0xfe, 0x01, /* cmp w,[bp-2],1 -> second oops */
+			0x74 }; 		/* je somewhere -> this must be changed to jmps */
+	u8 patch_2[] = { 0x90, 0x90, 0x90, 0x90, 0xeb }; /* 4x nop + jmps */
+	u8 shadow_cfg;
+
+	/* Check if it's the buggy BIOS */
+	if (memcmp(patch_addr_1, &orig_1[0], ARRAY_SIZE(orig_1)) ||
+	    memcmp(patch_addr_2, &orig_2[0], ARRAY_SIZE(orig_2)))
+		return;
+
+	printk(KERN_INFO "Fixing DTK FortisPro TOP-5A APM BIOS bug\n");
+	pci_read_config_byte(dev, 0x59, &shadow_cfg);
+	pci_write_config_byte(dev, 0x59, 0x20);	/* enable shadow BIOS writes */
+	memcpy(patch_addr_1, patch_1, ARRAY_SIZE(patch_1));
+	memcpy(patch_addr_2, patch_2, ARRAY_SIZE(patch_2));
+	pci_write_config_byte(dev, 0x59, shadow_cfg);
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_82439TX,	quirk_dtk_top5a);
+#endif /* CONFIG_X86 */
 
 static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end)
 {

-- 
Ondrej Zary

  parent reply	other threads:[~2006-07-25 20:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-23 14:30 Debugging APM - cat /proc/apm produces oops Ondrej Zary
2006-07-23 14:41 ` Ondrej Zary
2006-07-23 15:06 ` Stephen Rothwell
2006-07-23 16:35   ` Ondrej Zary
2006-07-24 21:51   ` Ondrej Zary
2006-07-25 20:04   ` Ondrej Zary [this message]
2006-07-25 19:15 ` Alan Cox
2006-07-25 20:11   ` Ondrej Zary
  -- strict thread matches above, loose matches on Subject: below --
2006-07-25  7:46 Chuck Ebbert

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=200607252204.57795.linux@rainbow-software.org \
    --to=linux@rainbow-software.org \
    --cc=76306.1226@compuserve.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.