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