[PATCH] PCI detection in 2.2.x and 2.4.0

From: Rasmus Andersen (rasmus@jaquet.dk)
Date: Fri Oct 06 2000 - 07:24:40 EST


Hi.

(This mail is a repeat from an earlier l-k mail.)

I recently had a problem with linux 2.2.x and 2.4.0 oopsing early
in the boot process on a old pentium I had gotten hold of. printk
investigation showed the problem to be in the PCI detection code,
specifically the part where linux tries to go through the BIOS to
get the PCI settings. Picking 'Direct' (CONFIG_PCI_GODIRECT) make
the boot succeed where 'Any' had not.

This stumped me since the help text had led me to believe
otherwise: The help text states that if CONFIG_PCI_GOANY is set
linux will first try to detect the settings directly and go
through BIOS if this fails. The code first goes through BIOS to
get the settings, then gets them directly and then pick the
direct settings (if valid) otherwise the BIOS settings (if
valid).

The following patches fixes the code to follow the help text. I
am not sure if this is the correct fix (vs. changing the documen-
tation), but I prefer it since it makes my machine boot :)

Patches for both 2.4.0-test9-pre7 and 2.2.18pre10. Please comment.

2.4.0-test9-pre7:

--- linux-240test9-pre7-clean/arch/i386/kernel/pci-pc.c Mon Jul 31 21:03:10 2000
+++ linux/arch/i386/kernel/pci-pc.c Sat Sep 30 20:36:10 2000
@@ -962,15 +962,15 @@
         struct pci_ops *bios = NULL;
         struct pci_ops *dir = NULL;
 
+#ifdef CONFIG_PCI_DIRECT
+ if (pci_probe & (PCI_PROBE_CONF1 | PCI_PROBE_CONF2))
+ dir = pci_check_direct();
+#endif
 #ifdef CONFIG_PCI_BIOS
- if ((pci_probe & PCI_PROBE_BIOS) && ((bios = pci_find_bios()))) {
+ if ((pci_probe & PCI_PROBE_BIOS) && (!dir) && ((bios = pci_find_bios()))) {
                 pci_probe |= PCI_BIOS_SORT;
                 pci_bios_present = 1;
         }
-#endif
-#ifdef CONFIG_PCI_DIRECT
- if (pci_probe & (PCI_PROBE_CONF1 | PCI_PROBE_CONF2))
- dir = pci_check_direct();
 #endif
         if (dir)
                 pci_root_ops = dir;

2.2.18-pre10:

--- linux-2.2.18pre10/arch/i386/kernel/bios32.c.org Mon Sep 25 16:37:03 2000
+++ linux-2.2.18pre10/arch/i386/kernel/bios32.c Mon Sep 25 16:39:28 2000
@@ -1267,15 +1267,15 @@
         struct pci_access *bios = NULL;
         struct pci_access *dir = NULL;
 
+#ifdef CONFIG_PCI_DIRECT
+ if (pci_probe & (PCI_PROBE_CONF1 | PCI_PROBE_CONF2))
+ dir = pci_check_direct();
+#endif
 #ifdef CONFIG_PCI_BIOS
- if ((pci_probe & PCI_PROBE_BIOS) && ((bios = pci_find_bios()))) {
+ if ((pci_probe & PCI_PROBE_BIOS) && (!dir) ((bios = pci_find_bios()))) {
                 pci_probe |= PCI_BIOS_SORT;
                 pci_bios_present = 1;
         }
-#endif
-#ifdef CONFIG_PCI_DIRECT
- if (pci_probe & (PCI_PROBE_CONF1 | PCI_PROBE_CONF2))
- dir = pci_check_direct();
 #endif
         if (dir)
                 access_pci = dir;

-- 
Regards,
        Rasmus(rasmus@jaquet.dk)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Oct 07 2000 - 21:00:19 EST