ide.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 <linux/config.h>
  30. #include <asm/setup.h>
  31. #include <asm/io.h>
  32. #include <asm/irq.h>
  33. #ifdef CONFIG_ATARI
  34. #include <linux/interrupt.h>
  35. #include <asm/atari_stdma.h>
  36. #endif
  37. #ifdef CONFIG_MAC
  38. #include <asm/macints.h>
  39. #endif
  40. #ifndef MAX_HWIFS
  41. #define MAX_HWIFS 4 /* same as the other archs */
  42. #endif
  43. /*
  44. * Get rid of defs from io.h - ide has its private and conflicting versions
  45. * Since so far no single m68k platform uses ISA/PCI I/O space for IDE, we
  46. * always use the `raw' MMIO versions
  47. */
  48. #undef inb
  49. #undef inw
  50. #undef insw
  51. #undef inl
  52. #undef insl
  53. #undef outb
  54. #undef outw
  55. #undef outsw
  56. #undef outl
  57. #undef outsl
  58. #undef readb
  59. #undef readw
  60. #undef readl
  61. #undef writeb
  62. #undef writew
  63. #undef writel
  64. #define inb in_8
  65. #define inw in_be16
  66. #define insw(port, addr, n) raw_insw((u16 *)port, addr, n)
  67. #define inl in_be32
  68. #define insl(port, addr, n) raw_insl((u32 *)port, addr, n)
  69. #define outb(val, port) out_8(port, val)
  70. #define outw(val, port) out_be16(port, val)
  71. #define outsw(port, addr, n) raw_outsw((u16 *)port, addr, n)
  72. #define outl(val, port) out_be32(port, val)
  73. #define outsl(port, addr, n) raw_outsl((u32 *)port, addr, n)
  74. #define readb in_8
  75. #define readw in_be16
  76. #define __ide_mm_insw(port, addr, n) raw_insw((u16 *)port, addr, n)
  77. #define readl in_be32
  78. #define __ide_mm_insl(port, addr, n) raw_insl((u32 *)port, addr, n)
  79. #define writeb(val, port) out_8(port, val)
  80. #define writew(val, port) out_be16(port, val)
  81. #define __ide_mm_outsw(port, addr, n) raw_outsw((u16 *)port, addr, n)
  82. #define writel(val, port) out_be32(port, val)
  83. #define __ide_mm_outsl(port, addr, n) raw_outsl((u32 *)port, addr, n)
  84. #if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
  85. #define insw_swapw(port, addr, n) raw_insw_swapw((u16 *)port, addr, n)
  86. #define outsw_swapw(port, addr, n) raw_outsw_swapw((u16 *)port, addr, n)
  87. #endif
  88. /* Q40 and Atari have byteswapped IDE busses and since many interesting
  89. * values in the identification string are text, chars and words they
  90. * happened to be almost correct without swapping.. However *_capacity
  91. * is needed for drives over 8 GB. RZ */
  92. #if defined(CONFIG_Q40) || defined(CONFIG_ATARI)
  93. #define M68K_IDE_SWAPW (MACH_IS_Q40 || MACH_IS_ATARI)
  94. #endif
  95. #ifdef CONFIG_BLK_DEV_FALCON_IDE
  96. #define IDE_ARCH_LOCK
  97. extern int falconide_intr_lock;
  98. static __inline__ void ide_release_lock (void)
  99. {
  100. if (MACH_IS_ATARI) {
  101. if (falconide_intr_lock == 0) {
  102. printk("ide_release_lock: bug\n");
  103. return;
  104. }
  105. falconide_intr_lock = 0;
  106. stdma_release();
  107. }
  108. }
  109. static __inline__ void
  110. ide_get_lock(irqreturn_t (*handler)(int, void *, struct pt_regs *), void *data)
  111. {
  112. if (MACH_IS_ATARI) {
  113. if (falconide_intr_lock == 0) {
  114. if (in_interrupt() > 0)
  115. panic( "Falcon IDE hasn't ST-DMA lock in interrupt" );
  116. stdma_lock(handler, data);
  117. falconide_intr_lock = 1;
  118. }
  119. }
  120. }
  121. #endif /* CONFIG_BLK_DEV_FALCON_IDE */
  122. #define IDE_ARCH_ACK_INTR
  123. #define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1)
  124. #endif /* __KERNEL__ */
  125. #endif /* _M68K_IDE_H */