ide.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * linux/include/asm-m68k/ide.h
  3. *
  4. * Copyright (C) 1994-1996 Linus Torvalds & authors
  5. */
  6. /* Copyright(c) 1996 Kars de Jong */
  7. /* Based on the ide driver from 1.2.13pl8 */
  8. /*
  9. * Credits (alphabetical):
  10. *
  11. * - Bjoern Brauel
  12. * - Kars de Jong
  13. * - Torsten Ebeling
  14. * - Dwight Engen
  15. * - Thorsten Floeck
  16. * - Roman Hodek
  17. * - Guenther Kelleter
  18. * - Chris Lawrence
  19. * - Michael Rausch
  20. * - Christian Sauer
  21. * - Michael Schmitz
  22. * - Jes Soerensen
  23. * - Michael Thurm
  24. * - Geert Uytterhoeven
  25. */
  26. #ifndef _M68K_IDE_H
  27. #define _M68K_IDE_H
  28. #ifdef __KERNEL__
  29. #include <asm/setup.h>
  30. #include <asm/io.h>
  31. #include <asm/irq.h>
  32. #ifdef CONFIG_ATARI
  33. #include <linux/interrupt.h>
  34. #include <asm/atari_stdma.h>
  35. #endif
  36. #ifdef CONFIG_MAC
  37. #include <asm/macints.h>
  38. #endif
  39. #ifndef MAX_HWIFS
  40. #define MAX_HWIFS 4 /* same as the other archs */
  41. #endif
  42. /*
  43. * Get rid of defs from io.h - ide has its private and conflicting versions
  44. * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we
  45. * always use the `raw' MMIO versions
  46. */
  47. #undef inb
  48. #undef inw
  49. #undef insw
  50. #undef inl
  51. #undef insl
  52. #undef outb
  53. #undef outw
  54. #undef outsw
  55. #undef outl
  56. #undef outsl
  57. #undef readb
  58. #undef readw
  59. #undef readl
  60. #undef writeb
  61. #undef writew
  62. #undef writel
  63. #define inb in_8
  64. #define inw in_be16
  65. #define insw(port, addr, n) raw_insw((u16 *)port, addr, n)
  66. #define inl in_be32
  67. #define insl(port, addr, n) raw_insl((u32 *)port, addr, n)
  68. #define outb(val, port) out_8(port, val)
  69. #define outw(val, port) out_be16(port, val)
  70. #define outsw(port, addr, n) raw_outsw((u16 *)port, addr, n)
  71. #define outl(val, port) out_be32(port, val)
  72. #define outsl(port, addr, n) raw_outsl((u32 *)port, addr, n)
  73. #define readb in_8
  74. #define readw in_be16
  75. #define __ide_mm_insw(port, addr, n) raw_insw((u16 *)port, addr, n)
  76. #define readl in_be32
  77. #define __ide_mm_insl(port, addr, n) raw_insl((u32 *)port, addr, n)
  78. #define writeb(val, port) out_8(port, val)
  79. #define writew(val, port) out_be16(port, val)
  80. #define __ide_mm_outsw(port, addr, n) raw_outsw((u16 *)port, addr, n)
  81. #define writel(val, port) out_be32(port, val)
  82. #define __ide_mm_outsl(port, addr, n) raw_outsl((u32 *)port, addr, n)
  83. #if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
  84. #define insw_swapw(port, addr, n) raw_insw_swapw((u16 *)port, addr, n)
  85. #define outsw_swapw(port, addr, n) raw_outsw_swapw((u16 *)port, addr, n)
  86. #endif
  87. /* Q40 and Atari have byteswapped IDE busses and since many interesting
  88. * values in the identification string are text, chars and words they
  89. * happened to be almost correct without swapping.. However *_capacity
  90. * is needed for drives over 8 GB. RZ */
  91. #if defined(CONFIG_Q40) || defined(CONFIG_ATARI)
  92. #define M68K_IDE_SWAPW (MACH_IS_Q40 || MACH_IS_ATARI)
  93. #endif
  94. #ifdef CONFIG_BLK_DEV_FALCON_IDE
  95. #define IDE_ARCH_LOCK
  96. extern int falconide_intr_lock;
  97. static __inline__ void ide_release_lock (void)
  98. {
  99. if (MACH_IS_ATARI) {
  100. if (falconide_intr_lock == 0) {
  101. printk("ide_release_lock: bug\n");
  102. return;
  103. }
  104. falconide_intr_lock = 0;
  105. stdma_release();
  106. }
  107. }
  108. static __inline__ void
  109. ide_get_lock(irq_handler_t handler, void *data)
  110. {
  111. if (MACH_IS_ATARI) {
  112. if (falconide_intr_lock == 0) {
  113. if (in_interrupt() > 0)
  114. panic( "Falcon IDE hasn't ST-DMA lock in interrupt" );
  115. stdma_lock(handler, data);
  116. falconide_intr_lock = 1;
  117. }
  118. }
  119. }
  120. #endif /* CONFIG_BLK_DEV_FALCON_IDE */
  121. #define IDE_ARCH_ACK_INTR
  122. #define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1)
  123. #endif /* __KERNEL__ */
  124. #endif /* _M68K_IDE_H */