Re: [PATCH] Replace nvidia timer override quirk with pci id list

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Prakash Punnoor
Date: Saturday, February 9, 2008 - 5:18 am

On the day of Saturday 09 February 2008 Thomas Gleixner hast written:
If
d*

The problem is current behaviour is already broken as it applies the quirk=
=20
*unconditionally* for all Nvidia hardwarde where no hpet is detected. The=20
latter is just heuristics. *If* correct Nforce2 ID gets added to the propos=
ed=20
patch, behaviour would be equivalent to current situation for me (nforce2,=
=20
mcp51). Still I am saying mcp51 doesn't belong per-se to the list of chipse=
ts=20
which need to be quirked, as for me it shows adverse effect. Taking mcp51 o=
ut=20
would be an advancement.


If there are situations where quirking is correct and other situation where=
 it=20
is incorrect for the same type of chipsets, I think then the quirk should n=
ot=20
be applied automatically.



So I suggest something like this as a start. The quirk only gets applied fo=
r=20
nforce2 unconditionally, as it was intended originally. For chipsets betwee=
n=20
nforce3 and before nforce5 the user gets a message and no quirk gets applie=
d=20
automatically. If there are known bug reports (Andi Kleen didn't supply any=
=20
references) some more infos could be asked from the reportes. Then for know=
n=20
broken bios versions the quirk could be applied by DMI scan *selectively*.=
=20
(This part of code is missing here.) I also don't know whether the list of=
=20
IDs is complete.

Warning I hand edited the original proposed patch, so it won't apply and=20
probably won't compile. But I hope one gets the idea.


Index: linux/arch/x86/kernel/early-quirks.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=2D-- linux.orig/arch/x86/kernel/early-quirks.c
+++ linux/arch/x86/kernel/early-quirks.c
@@ -60,38 +60,21 @@ static void __init via_bugs(int  num, in
 #endif
 }
=20
=2D#ifdef CONFIG_ACPI
=2D#ifdef CONFIG_X86_IO_APIC
=2D
=2Dstatic int __init nvidia_hpet_check(struct acpi_table_header *header)
=2D{
=2D       return 0;
=2D}
=2D#endif /* CONFIG_X86_IO_APIC */
=2D#endif /* CONFIG_ACPI */
=2D
=2Dstatic void __init nvidia_bugs(int num, int slot, int func)
+static void __init nvidia_timer(int num, int slot, int func)
 {
 #ifdef CONFIG_ACPI
 #ifdef CONFIG_X86_IO_APIC
        /*
=2D        * All timer overrides on Nvidia are
=2D        * wrong unless HPET is enabled.
=2D        * Unfortunately that's not true on many Asus boards.
=2D        * We don't know yet how to detect this automatically, but
=2D        * at least allow a command line override.
+        * Timer overrides on Nvidia NForce2 are
+        * wrong.
         */
        if (acpi_use_timer_override)
                return;
=20
=2D       if (acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check)) {
=2D               acpi_skip_timer_override =3D 1;
=2D               printk(KERN_INFO "Nvidia board "
=2D                      "detected. Ignoring ACPI "
=2D                      "timer override.\n");
=2D               printk(KERN_INFO "If you got timer trouble "
=2D                       "try acpi_use_timer_override\n");
=2D       }
+       acpi_skip_timer_override =3D 1;
+       printk(KERN_INFO "NForce2 Nvidia board detected."
+                        "Ignoring ACPI timer override.\n");
+       printk(KERN_INFO "If you have trouble try acpi_use_timer_override\n=
");
 #endif
 #endif
        /* RED-PEN skip them on mptables too? */
@@ -121,9 +104,19 @@ struct chipset {
        void (*f)(int num, int slot, int func);
 };
=20
+ static void __init nvidia_timer_hint(int num, int slot, int func)
+ {
+ 	if (!acpi_skip_timer_override)
+ 		printk(KERN_INFO "Pre NForce5 Nvidia board detected."
+				 "If you have trouble, try booting with acpi_skip_timer_override\n"
+				 "If that works for you please report to the Linux kernel mailing=20
list.");
+ }

+#define QBRIDGE(vendor, device, func) { \
+       vendor, device, PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, \
+       QFLAG_APPLY_ONCE, func }
+
 static struct chipset early_qrk[] __initdata =3D {
=2D       { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
=2D         PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, nvidia_bugs=
 },
+       /* This list should cover at least one PCI ID from each NF3 or NF4
+          mainboard to handle a bug in their reference BIOS. */
+ =A0 =A0 =A0 QBRIDGE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2,=20
nvidia_timer),
+       QBRIDGE(PCI_VENDOR_ID_NVIDIA, 0x00e1, nvidia_timer_hint), /* nforce=
 3=20
*/
+       QBRIDGE(PCI_VENDOR_ID_NVIDIA, 0x00ed, nvidia_timer_hint), /* nforce=
 3=20
*/
+       QBRIDGE(PCI_VENDOR_ID_NVIDIA, 0x003d, nvidia_timer_hint), /* mcp 04=
 ??=20
*/
+       QBRIDGE(PCI_VENDOR_ID_NVIDIA, 0x02f0, nvidia_timer_hint), /* mcp=20
51/nf4 ? */
+       QBRIDGE(PCI_VENDOR_ID_NVIDIA, 0x026f, nvidia_timer_hint), /* mcp=20
51/nf4 ? */
+       QBRIDGE(PCI_VENDOR_ID_NVIDIA, 0x005c, nvidia_timer_hint), /* ck 804=
 */
        { PCI_VENDOR_ID_VIA, PCI_ANY_ID,
          PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, via_bugs },
        { PCI_VENDOR_ID_ATI, PCI_ANY_ID,


=2D-=20
(=B0=3D                 =3D=B0)
//\ Prakash Punnoor /\\
V_/                 \_V
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] Replace nvidia timer override quirk with pci i ..., Prakash Punnoor, (Sat Feb 9, 5:18 am)