ide.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * linux/include/asm-i386/ide.h
  3. *
  4. * Copyright (C) 1994-1996 Linus Torvalds & authors
  5. */
  6. /*
  7. * This file contains the i386 architecture specific IDE code.
  8. */
  9. #ifndef __ASMi386_IDE_H
  10. #define __ASMi386_IDE_H
  11. #ifdef __KERNEL__
  12. #include <linux/config.h>
  13. #ifndef MAX_HWIFS
  14. # ifdef CONFIG_BLK_DEV_IDEPCI
  15. #define MAX_HWIFS 10
  16. # else
  17. #define MAX_HWIFS 6
  18. # endif
  19. #endif
  20. #define IDE_ARCH_OBSOLETE_DEFAULTS
  21. static __inline__ int ide_default_irq(unsigned long base)
  22. {
  23. switch (base) {
  24. case 0x1f0: return 14;
  25. case 0x170: return 15;
  26. case 0x1e8: return 11;
  27. case 0x168: return 10;
  28. case 0x1e0: return 8;
  29. case 0x160: return 12;
  30. default:
  31. return 0;
  32. }
  33. }
  34. static __inline__ unsigned long ide_default_io_base(int index)
  35. {
  36. /*
  37. * If PCI is present then it is not safe to poke around
  38. * the other legacy IDE ports. Only 0x1f0 and 0x170 are
  39. * defined compatibility mode ports for PCI. A user can
  40. * override this using ide= but we must default safe.
  41. */
  42. if (pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL) == NULL) {
  43. switch(index) {
  44. case 2: return 0x1e8;
  45. case 3: return 0x168;
  46. case 4: return 0x1e0;
  47. case 5: return 0x160;
  48. }
  49. }
  50. switch (index) {
  51. case 0: return 0x1f0;
  52. case 1: return 0x170;
  53. default:
  54. return 0;
  55. }
  56. }
  57. #define IDE_ARCH_OBSOLETE_INIT
  58. #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
  59. #ifdef CONFIG_BLK_DEV_IDEPCI
  60. #define ide_init_default_irq(base) (0)
  61. #else
  62. #define ide_init_default_irq(base) ide_default_irq(base)
  63. #endif
  64. #include <asm-generic/ide_iops.h>
  65. #endif /* __KERNEL__ */
  66. #endif /* __ASMi386_IDE_H */