floppy.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Architecture specific parts of the Floppy driver
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 1995
  9. */
  10. #ifndef __ASM_ALPHA_FLOPPY_H
  11. #define __ASM_ALPHA_FLOPPY_H
  12. #define fd_inb(port) inb_p(port)
  13. #define fd_outb(value,port) outb_p(value,port)
  14. #define fd_enable_dma() enable_dma(FLOPPY_DMA)
  15. #define fd_disable_dma() disable_dma(FLOPPY_DMA)
  16. #define fd_request_dma() request_dma(FLOPPY_DMA,"floppy")
  17. #define fd_free_dma() free_dma(FLOPPY_DMA)
  18. #define fd_clear_dma_ff() clear_dma_ff(FLOPPY_DMA)
  19. #define fd_set_dma_mode(mode) set_dma_mode(FLOPPY_DMA,mode)
  20. #define fd_set_dma_addr(addr) set_dma_addr(FLOPPY_DMA,virt_to_bus(addr))
  21. #define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA,count)
  22. #define fd_enable_irq() enable_irq(FLOPPY_IRQ)
  23. #define fd_disable_irq() disable_irq(FLOPPY_IRQ)
  24. #define fd_cacheflush(addr,size) /* nothing */
  25. #define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \
  26. SA_INTERRUPT|SA_SAMPLE_RANDOM, \
  27. "floppy", NULL)
  28. #define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
  29. #ifdef CONFIG_PCI
  30. #include <linux/pci.h>
  31. #define fd_dma_setup(addr,size,mode,io) alpha_fd_dma_setup(addr,size,mode,io)
  32. static __inline__ int
  33. alpha_fd_dma_setup(char *addr, unsigned long size, int mode, int io)
  34. {
  35. static unsigned long prev_size;
  36. static dma_addr_t bus_addr = 0;
  37. static char *prev_addr;
  38. static int prev_dir;
  39. int dir;
  40. dir = (mode != DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE;
  41. if (bus_addr
  42. && (addr != prev_addr || size != prev_size || dir != prev_dir)) {
  43. /* different from last time -- unmap prev */
  44. pci_unmap_single(isa_bridge, bus_addr, prev_size, prev_dir);
  45. bus_addr = 0;
  46. }
  47. if (!bus_addr) /* need to map it */
  48. bus_addr = pci_map_single(isa_bridge, addr, size, dir);
  49. /* remember this one as prev */
  50. prev_addr = addr;
  51. prev_size = size;
  52. prev_dir = dir;
  53. fd_clear_dma_ff();
  54. fd_cacheflush(addr, size);
  55. fd_set_dma_mode(mode);
  56. set_dma_addr(FLOPPY_DMA, bus_addr);
  57. fd_set_dma_count(size);
  58. virtual_dma_port = io;
  59. fd_enable_dma();
  60. return 0;
  61. }
  62. #endif /* CONFIG_PCI */
  63. __inline__ void virtual_dma_init(void)
  64. {
  65. /* Nothing to do on an Alpha */
  66. }
  67. static int FDC1 = 0x3f0;
  68. static int FDC2 = -1;
  69. /*
  70. * Again, the CMOS information doesn't work on the alpha..
  71. */
  72. #define FLOPPY0_TYPE 6
  73. #define FLOPPY1_TYPE 0
  74. #define N_FDC 2
  75. #define N_DRIVE 8
  76. #define FLOPPY_MOTOR_MASK 0xf0
  77. /*
  78. * Most Alphas have no problems with floppy DMA crossing 64k borders,
  79. * except for certain ones, like XL and RUFFIAN.
  80. *
  81. * However, the test is simple and fast, and this *is* floppy, after all,
  82. * so we do it for all platforms, just to make sure.
  83. *
  84. * This is advantageous in other circumstances as well, as in moving
  85. * about the PCI DMA windows and forcing the floppy to start doing
  86. * scatter-gather when it never had before, and there *is* a problem
  87. * on that platform... ;-}
  88. */
  89. static inline unsigned long CROSS_64KB(void *a, unsigned long s)
  90. {
  91. unsigned long p = (unsigned long)a;
  92. return ((p + s - 1) ^ p) & ~0xffffUL;
  93. }
  94. #define EXTRA_FLOPPY_PARAMS
  95. #endif /* __ASM_ALPHA_FLOPPY_H */