2 * Architecture specific parts of the Floppy driver
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
8 * Copyright (C) 1995 - 2000 Ralf Baechle
14 unsigned char (*fd_inb
)(unsigned int port
);
15 void (*fd_outb
)(unsigned char value
, unsigned int port
);
18 * How to access the floppy DMA functions.
20 void (*fd_enable_dma
)(int channel
);
21 void (*fd_disable_dma
)(int channel
);
22 int (*fd_request_dma
)(int channel
);
23 void (*fd_free_dma
)(int channel
);
24 void (*fd_clear_dma_ff
)(int channel
);
25 void (*fd_set_dma_mode
)(int channel
, char mode
);
26 void (*fd_set_dma_addr
)(int channel
, unsigned int a
);
27 void (*fd_set_dma_count
)(int channel
, unsigned int count
);
28 int (*fd_get_dma_residue
)(int channel
);
29 void (*fd_enable_irq
)(int irq
);
30 void (*fd_disable_irq
)(int irq
);
31 unsigned long (*fd_getfdaddr1
)(void);
32 unsigned long (*fd_dma_mem_alloc
)(unsigned long size
);
33 void (*fd_dma_mem_free
)(unsigned long addr
, unsigned long size
);
34 unsigned long (*fd_drive_type
)(unsigned long);
37 extern struct fd_ops
*fd_ops
;
39 #define fd_inb(port) fd_ops->fd_inb(port)
40 #define fd_outb(value,port) fd_ops->fd_outb(value,port)
42 #define fd_enable_dma() fd_ops->fd_enable_dma(FLOPPY_DMA)
43 #define fd_disable_dma() fd_ops->fd_disable_dma(FLOPPY_DMA)
44 #define fd_request_dma() fd_ops->fd_request_dma(FLOPPY_DMA)
45 #define fd_free_dma() fd_ops->fd_free_dma(FLOPPY_DMA)
46 #define fd_clear_dma_ff() fd_ops->fd_clear_dma_ff(FLOPPY_DMA)
47 #define fd_set_dma_mode(mode) fd_ops->fd_set_dma_mode(FLOPPY_DMA, mode)
48 #define fd_set_dma_addr(addr) fd_ops->fd_set_dma_addr(FLOPPY_DMA, \
49 isa_virt_to_bus(addr))
50 #define fd_set_dma_count(count) fd_ops->fd_set_dma_count(FLOPPY_DMA,count)
51 #define fd_get_dma_residue() fd_ops->fd_get_dma_residue(FLOPPY_DMA)
53 #define fd_enable_irq() fd_ops->fd_enable_irq(FLOPPY_IRQ)
54 #define fd_disable_irq() fd_ops->fd_disable_irq(FLOPPY_IRQ)
55 #define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \
56 SA_INTERRUPT | SA_SAMPLE_RANDOM, \
58 #define fd_free_irq() free_irq(FLOPPY_IRQ, NULL);
59 #define fd_dma_mem_alloc(size) fd_ops->fd_dma_mem_alloc(size)
60 #define fd_dma_mem_free(mem,size) fd_ops->fd_dma_mem_free(mem,size)
61 #define fd_drive_type(n) fd_ops->fd_drive_type(n)
62 #define fd_cacheflush(addr,size) \
63 dma_cache_wback_inv((unsigned long)(addr),(size))
65 #define MAX_BUFFER_SECTORS 24
69 * And on Mips's the CMOS info fails also ...
71 * FIXME: This information should come from the ARC configuration tree
72 * or whereever a particular machine has stored this ...
74 #define FLOPPY0_TYPE fd_drive_type(0)
75 #define FLOPPY1_TYPE fd_drive_type(1)
77 #define FDC1 fd_ops->fd_getfdaddr1();
79 #define N_FDC 1 /* do you *really* want a second controller? */
82 #define FLOPPY_MOTOR_MASK 0xf0
85 * The DMA channel used by the floppy controller cannot access data at
88 * Went back to the 1MB limit, as some people had problems with the floppy
89 * driver otherwise. It doesn't matter much for performance anyway, as most
90 * floppy accesses go through the track buffer.
92 * On MIPSes using vdma, this actually means that *all* transfers go thru
93 * the * track buffer since 0x1000000 is always smaller than KSEG0/1.
94 * Actually this needs to be a bit more complicated since the so much different
95 * hardware available with MIPS CPUs ...
97 #define CROSS_64KB(a,s) ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64)
99 #define EXTRA_FLOPPY_PARAMS
101 #endif /* _ASM_FLOPPY_H */