android_kernel_xiaomi_sm8350/include/asm-i386/ide.h
Alan Cox c47abbbffd [PATCH] ide: sensible probing for PCI systems
Old ISA/VESA systems sometimes put tertiary IDE controllers at addresses
0x1e8, 0x168, 0x1e0 or 0x160.  Linux thus probes these addresses on x86
systems.  Unfortunately some PCI systems now use these addresses for other
purposes which leads to users seeing minute plus hangs during boot or even
crashes.

The following patch (again has been in Fedora for a while) only probes the
obscure legacy ISA ports on machinea that are pre-PCI.  This seems to keep
everyone happy and if there is someone with that utterly weird corner case
the ide= command line still provides a get out of jail card.
Unsurprisingly we've not found anyone so affected.

Signed-off-by: Alan Cox <alan@redhat.com>
Acked-by: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-27 17:36:41 -07:00

74 lines
1.3 KiB
C

/*
* linux/include/asm-i386/ide.h
*
* Copyright (C) 1994-1996 Linus Torvalds & authors
*/
/*
* This file contains the i386 architecture specific IDE code.
*/
#ifndef __ASMi386_IDE_H
#define __ASMi386_IDE_H
#ifdef __KERNEL__
#include <linux/config.h>
#ifndef MAX_HWIFS
# ifdef CONFIG_BLK_DEV_IDEPCI
#define MAX_HWIFS 10
# else
#define MAX_HWIFS 6
# endif
#endif
#define IDE_ARCH_OBSOLETE_DEFAULTS
static __inline__ int ide_default_irq(unsigned long base)
{
switch (base) {
case 0x1f0: return 14;
case 0x170: return 15;
case 0x1e8: return 11;
case 0x168: return 10;
case 0x1e0: return 8;
case 0x160: return 12;
default:
return 0;
}
}
static __inline__ unsigned long ide_default_io_base(int index)
{
if (pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL) == NULL) {
switch(index) {
case 2: return 0x1e8;
case 3: return 0x168;
case 4: return 0x1e0;
case 5: return 0x160;
}
}
switch (index) {
case 0: return 0x1f0;
case 1: return 0x170;
default:
return 0;
}
}
#define IDE_ARCH_OBSOLETE_INIT
#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
#ifdef CONFIG_BLK_DEV_IDEPCI
#define ide_init_default_irq(base) (0)
#else
#define ide_init_default_irq(base) ide_default_irq(base)
#endif
#include <asm-generic/ide_iops.h>
#endif /* __KERNEL__ */
#endif /* __ASMi386_IDE_H */