~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/asm-mips/floppy.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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 - 2000 Ralf Baechle
  9  */
 10 #ifndef _ASM_FLOPPY_H
 11 #define _ASM_FLOPPY_H
 12 
 13 #include <asm/bootinfo.h>
 14 #include <asm/jazz.h>
 15 #include <asm/jazzdma.h>
 16 
 17 struct fd_ops {
 18         unsigned char (*fd_inb)(unsigned int port);
 19         void (*fd_outb)(unsigned char value, unsigned int port);
 20 
 21         /*
 22          * How to access the floppy DMA functions.
 23          */
 24         void (*fd_enable_dma)(int channel);
 25         void (*fd_disable_dma)(int channel);
 26         int (*fd_request_dma)(int channel);
 27         void (*fd_free_dma)(int channel);
 28         void (*fd_clear_dma_ff)(int channel);
 29         void (*fd_set_dma_mode)(int channel, char mode);
 30         void (*fd_set_dma_addr)(int channel, unsigned int a);
 31         void (*fd_set_dma_count)(int channel, unsigned int count);
 32         int (*fd_get_dma_residue)(int channel);
 33         void (*fd_enable_irq)(int irq);
 34         void (*fd_disable_irq)(int irq);
 35         unsigned long (*fd_getfdaddr1)(void);
 36         unsigned long (*fd_dma_mem_alloc)(unsigned long size);
 37         void (*fd_dma_mem_free)(unsigned long addr, unsigned long size);
 38         unsigned long (*fd_drive_type)(unsigned long);
 39 };
 40 
 41 extern struct fd_ops *fd_ops;
 42 
 43 #define fd_inb(port)            fd_ops->fd_inb(port)
 44 #define fd_outb(value,port)     fd_ops->fd_outb(value,port)
 45 
 46 #define fd_enable_dma()         fd_ops->fd_enable_dma(FLOPPY_DMA)
 47 #define fd_disable_dma()        fd_ops->fd_disable_dma(FLOPPY_DMA)
 48 #define fd_request_dma()        fd_ops->fd_request_dma(FLOPPY_DMA)
 49 #define fd_free_dma()           fd_ops->fd_free_dma(FLOPPY_DMA)
 50 #define fd_clear_dma_ff()       fd_ops->fd_clear_dma_ff(FLOPPY_DMA)
 51 #define fd_set_dma_mode(mode)   fd_ops->fd_set_dma_mode(FLOPPY_DMA, mode)
 52 #define fd_set_dma_addr(addr)   fd_ops->fd_set_dma_addr(FLOPPY_DMA, \
 53                                                        virt_to_bus(addr))
 54 #define fd_set_dma_count(count) fd_ops->fd_set_dma_count(FLOPPY_DMA,count)
 55 #define fd_get_dma_residue()    fd_ops->fd_get_dma_residue(FLOPPY_DMA)
 56 
 57 #define fd_enable_irq()         fd_ops->fd_enable_irq(FLOPPY_IRQ)
 58 #define fd_disable_irq()        fd_ops->fd_disable_irq(FLOPPY_IRQ)
 59 #define fd_request_irq()        request_irq(FLOPPY_IRQ, floppy_interrupt, \
 60                                             SA_INTERRUPT | SA_SAMPLE_RANDOM, \
 61                                             "floppy", NULL)
 62 #define fd_free_irq()           free_irq(FLOPPY_IRQ, NULL);
 63 #define fd_dma_mem_alloc(size)  fd_ops->fd_dma_mem_alloc(size)
 64 #define fd_dma_mem_free(mem,size) fd_ops->fd_dma_mem_free(mem,size)
 65 #define fd_drive_type(n)        fd_ops->fd_drive_type(n)
 66 #define fd_cacheflush(addr,size) dma_cache_wback_inv(addr,size)
 67 
 68 #define MAX_BUFFER_SECTORS 24
 69 
 70 
 71 /*
 72  * And on Mips's the CMOS info fails also ...
 73  *
 74  * FIXME: This information should come from the ARC configuration tree
 75  *        or whereever a particular machine has stored this ...
 76  */
 77 #define FLOPPY0_TYPE                    fd_drive_type(0)
 78 #define FLOPPY1_TYPE                    fd_drive_type(1)
 79 
 80 #define FDC1                    fd_ops->fd_getfdaddr1();
 81 
 82 /*
 83  * Hack: The floppy drivrer defines this, before including fdreg.h.  We use
 84  * to define FDC2 only one and keep it a static variable in floppy.c.
 85  */
 86 #ifdef FDPATCHES
 87 static int FDC2 = -1;
 88 #endif
 89 
 90 #define N_FDC 1                 /* do you *really* want a second controller? */
 91 #define N_DRIVE 8
 92 
 93 #define FLOPPY_MOTOR_MASK 0xf0
 94 
 95 /*
 96  * The DMA channel used by the floppy controller cannot access data at
 97  * addresses >= 16MB
 98  *
 99  * Went back to the 1MB limit, as some people had problems with the floppy
100  * driver otherwise. It doesn't matter much for performance anyway, as most
101  * floppy accesses go through the track buffer.
102  *
103  * On MIPSes using vdma, this actually means that *all* transfers go thru
104  * the * track buffer since 0x1000000 is always smaller than KSEG0/1.
105  * Actually this needs to be a bit more complicated since the so much different
106  * hardware available with MIPS CPUs ...
107  */
108 #define CROSS_64KB(a,s) ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64)
109 
110 #endif /* _ASM_FLOPPY_H */
111 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.