ide.h 3.4 KB

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