lkml.org 
[lkml]   [2006]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: Debugging APM - cat /proc/apm produces oops
Date
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-07-25 22:07    [W:0.055 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site