Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6440fcfc62767028a2bbdf742549d24f6a023004
Commit:     6440fcfc62767028a2bbdf742549d24f6a023004
Parent:     b1043cc7d9d7a7dec8d807570c067e0c90b94b57
Author:     Atsushi Nemoto <[EMAIL PROTECTED]>
AuthorDate: Tue Sep 4 23:02:02 2007 +0900
Committer:  Ralf Baechle <[EMAIL PROTECTED]>
CommitDate: Fri Sep 14 19:08:43 2007 +0100

    [MIPS] No ide_default_io_base() if PCI IDE was not found
    
    Revert b5438582090406e2ccb4169d9b2df7c9939ae42b and add
    no_pci_devices() check to avoid crash due to early calling of
    pci_get_class().
    
    Signed-off-by: Atsushi Nemoto <[EMAIL PROTECTED]>
    Signed-off-by: Ralf Baechle <[EMAIL PROTECTED]>
---
 include/asm-mips/mach-generic/ide.h |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/include/asm-mips/mach-generic/ide.h 
b/include/asm-mips/mach-generic/ide.h
index 2b92857..a771283 100644
--- a/include/asm-mips/mach-generic/ide.h
+++ b/include/asm-mips/mach-generic/ide.h
@@ -29,6 +29,35 @@
 
 #define IDE_ARCH_OBSOLETE_DEFAULTS
 
+static __inline__ int ide_probe_legacy(void)
+{
+#ifdef CONFIG_PCI
+       struct pci_dev *dev;
+       /*
+        * This can be called on the ide_setup() path, super-early in
+        * boot.  But the down_read() will enable local interrupts,
+        * which can cause some machines to crash.  So here we detect
+        * and flag that situation and bail out early.
+        */
+       if (no_pci_devices())
+               return 0;
+       dev = pci_get_class(PCI_CLASS_BRIDGE_EISA << 8, NULL);
+       if (dev)
+               goto found;
+       dev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL);
+       if (dev)
+               goto found;
+       return 0;
+found:
+       pci_dev_put(dev);
+       return 1;
+#elif defined(CONFIG_EISA) || defined(CONFIG_ISA)
+       return 1;
+#else
+       return 0;
+#endif
+}
+
 static __inline__ int ide_default_irq(unsigned long base)
 {
        switch (base) {
@@ -45,6 +74,8 @@ static __inline__ int ide_default_irq(unsigned long base)
 
 static __inline__ unsigned long ide_default_io_base(int index)
 {
+       if (!ide_probe_legacy())
+               return 0;
        /*
         *      If PCI is present then it is not safe to poke around
         *      the other legacy IDE ports. Only 0x1f0 and 0x170 are
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to