ide.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 1994-1996 Linus Torvalds & authors
  7. *
  8. * Copied from i386; many of the especially older MIPS or ISA-based platforms
  9. * are basically identical. Using this file probably implies i8259 PIC
  10. * support in a system but the very least interrupt numbers 0 - 15 need to
  11. * be put aside for legacy devices.
  12. */
  13. #ifndef __ASM_MACH_GENERIC_IDE_H
  14. #define __ASM_MACH_GENERIC_IDE_H
  15. #ifdef __KERNEL__
  16. #include <linux/config.h>
  17. #include <linux/pci.h>
  18. #include <linux/stddef.h>
  19. #ifndef MAX_HWIFS
  20. # ifdef CONFIG_BLK_DEV_IDEPCI
  21. #define MAX_HWIFS 10
  22. # else
  23. #define MAX_HWIFS 6
  24. # endif
  25. #endif
  26. #define IDE_ARCH_OBSOLETE_DEFAULTS
  27. static __inline__ int ide_probe_legacy(void)
  28. {
  29. #ifdef CONFIG_PCI
  30. struct pci_dev *dev;
  31. if ((dev = pci_get_class(PCI_CLASS_BRIDGE_EISA << 8, NULL)) != NULL ||
  32. (dev = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL)) != NULL) {
  33. pci_dev_put(dev);
  34. return 1;
  35. }
  36. return 0;
  37. #elif defined(CONFIG_EISA) || defined(CONFIG_ISA)
  38. return 1;
  39. #else
  40. return 0;
  41. #endif
  42. }
  43. static __inline__ int ide_default_irq(unsigned long base)
  44. {
  45. if (ide_probe_legacy())
  46. switch (base) {
  47. case 0x1f0:
  48. return 14;
  49. case 0x170:
  50. return 15;
  51. case 0x1e8:
  52. return 11;
  53. case 0x168:
  54. return 10;
  55. case 0x1e0:
  56. return 8;
  57. case 0x160:
  58. return 12;
  59. default:
  60. return 0;
  61. }
  62. else
  63. return 0;
  64. }
  65. static __inline__ unsigned long ide_default_io_base(int index)
  66. {
  67. if (ide_probe_legacy())
  68. switch (index) {
  69. case 0:
  70. return 0x1f0;
  71. case 1:
  72. return 0x170;
  73. case 2:
  74. return 0x1e8;
  75. case 3:
  76. return 0x168;
  77. case 4:
  78. return 0x1e0;
  79. case 5:
  80. return 0x160;
  81. default:
  82. return 0;
  83. }
  84. else
  85. return 0;
  86. }
  87. #define IDE_ARCH_OBSOLETE_INIT
  88. #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
  89. #ifdef CONFIG_BLK_DEV_IDEPCI
  90. #define ide_init_default_irq(base) (0)
  91. #else
  92. #define ide_init_default_irq(base) ide_default_irq(base)
  93. #endif
  94. /* MIPS port and memory-mapped I/O string operations. */
  95. #define __ide_insw insw
  96. #define __ide_insl insl
  97. #define __ide_outsw outsw
  98. #define __ide_outsl outsl
  99. #define __ide_mm_insw readsw
  100. #define __ide_mm_insl readsl
  101. #define __ide_mm_outsw writesw
  102. #define __ide_mm_outsl writesl
  103. #endif /* __KERNEL__ */
  104. #endif /* __ASM_MACH_GENERIC_IDE_H */