home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / src / linux-headers-2.6.28-15 / arch / alpha / include / asm / floppy.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-12-24  |  3.2 KB  |  116 lines

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