/arch/alpha/include/asm/floppy.h

http://github.com/mirrors/linux · C Header · 113 lines · 64 code · 22 blank · 27 comment · 9 complexity · aa478c6cf822ba09bd1cbc9b391f6da1 MD5 · raw file

  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_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt,\
  25. 0, "floppy", NULL)
  26. #define fd_free_irq() free_irq(FLOPPY_IRQ, NULL)
  27. #ifdef CONFIG_PCI
  28. #include <linux/pci.h>
  29. #define fd_dma_setup(addr,size,mode,io) alpha_fd_dma_setup(addr,size,mode,io)
  30. static __inline__ int
  31. alpha_fd_dma_setup(char *addr, unsigned long size, int mode, int io)
  32. {
  33. static unsigned long prev_size;
  34. static dma_addr_t bus_addr = 0;
  35. static char *prev_addr;
  36. static int prev_dir;
  37. int dir;
  38. dir = (mode != DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE;
  39. if (bus_addr
  40. && (addr != prev_addr || size != prev_size || dir != prev_dir)) {
  41. /* different from last time -- unmap prev */
  42. pci_unmap_single(isa_bridge, bus_addr, prev_size, prev_dir);
  43. bus_addr = 0;
  44. }
  45. if (!bus_addr) /* need to map it */
  46. bus_addr = pci_map_single(isa_bridge, addr, size, dir);
  47. /* remember this one as prev */
  48. prev_addr = addr;
  49. prev_size = size;
  50. prev_dir = dir;
  51. fd_clear_dma_ff();
  52. fd_set_dma_mode(mode);
  53. set_dma_addr(FLOPPY_DMA, bus_addr);
  54. fd_set_dma_count(size);
  55. virtual_dma_port = io;
  56. fd_enable_dma();
  57. return 0;
  58. }
  59. #endif /* CONFIG_PCI */
  60. __inline__ void virtual_dma_init(void)
  61. {
  62. /* Nothing to do on an Alpha */
  63. }
  64. static int FDC1 = 0x3f0;
  65. static int FDC2 = -1;
  66. /*
  67. * Again, the CMOS information doesn't work on the alpha..
  68. */
  69. #define FLOPPY0_TYPE 6
  70. #define FLOPPY1_TYPE 0
  71. #define N_FDC 2
  72. #define N_DRIVE 8
  73. /*
  74. * Most Alphas have no problems with floppy DMA crossing 64k borders,
  75. * except for certain ones, like XL and RUFFIAN.
  76. *
  77. * However, the test is simple and fast, and this *is* floppy, after all,
  78. * so we do it for all platforms, just to make sure.
  79. *
  80. * This is advantageous in other circumstances as well, as in moving
  81. * about the PCI DMA windows and forcing the floppy to start doing
  82. * scatter-gather when it never had before, and there *is* a problem
  83. * on that platform... ;-}
  84. */
  85. static inline unsigned long CROSS_64KB(void *a, unsigned long s)
  86. {
  87. unsigned long p = (unsigned long)a;
  88. return ((p + s - 1) ^ p) & ~0xffffUL;
  89. }
  90. #define EXTRA_FLOPPY_PARAMS
  91. #endif /* __ASM_ALPHA_FLOPPY_H */