21 #ifndef __ASM_PARISC_FLOPPY_H
22 #define __ASM_PARISC_FLOPPY_H
35 #define _CROSS_64KB(a,s,vdma) \
36 (!vdma && ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64))
38 #define CROSS_64KB(a,s) _CROSS_64KB(a,s,use_virtual_dma & 1)
41 #define SW fd_routine[use_virtual_dma&1]
42 #define CSW fd_routine[can_use_virtual_dma & 1]
45 #define fd_inb(port) readb(port)
46 #define fd_outb(value, port) writeb(value, port)
48 #define fd_request_dma() CSW._request_dma(FLOPPY_DMA,"floppy")
49 #define fd_free_dma() CSW._free_dma(FLOPPY_DMA)
50 #define fd_enable_irq() enable_irq(FLOPPY_IRQ)
51 #define fd_disable_irq() disable_irq(FLOPPY_IRQ)
52 #define fd_free_irq() free_irq(FLOPPY_IRQ, NULL)
53 #define fd_get_dma_residue() SW._get_dma_residue(FLOPPY_DMA)
54 #define fd_dma_mem_alloc(size) SW._dma_mem_alloc(size)
55 #define fd_dma_setup(addr, size, mode, io) SW._dma_setup(addr, size, mode, io)
57 #define FLOPPY_CAN_FALLBACK_ON_NODMA
59 static int virtual_dma_count=0;
60 static int virtual_dma_residue=0;
61 static char *virtual_dma_addr=0;
62 static int virtual_dma_mode=0;
63 static int doing_pdma=0;
67 register unsigned char st;
74 static int dma_wait=0;
83 bytes = virtual_dma_count;
88 register char *lptr = virtual_dma_addr;
90 for (lcount = virtual_dma_count; lcount; lcount--) {
91 st =
fd_inb(virtual_dma_port+4) & 0xa0 ;
94 if (virtual_dma_mode) {
95 fd_outb(*lptr, virtual_dma_port+5);
97 *lptr =
fd_inb(virtual_dma_port+5);
101 virtual_dma_count = lcount;
102 virtual_dma_addr = lptr;
103 st =
fd_inb(virtual_dma_port+4);
106 #ifdef TRACE_FLPY_INT
112 virtual_dma_residue += virtual_dma_count;
113 virtual_dma_count = 0;
114 #ifdef TRACE_FLPY_INT
115 printk(
"count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n",
116 virtual_dma_count, virtual_dma_residue, calls, bytes,
125 #ifdef TRACE_FLPY_INT
126 if (!virtual_dma_count)
133 if(! (can_use_virtual_dma & 1))
136 virtual_dma_residue += virtual_dma_count;
140 static int vdma_request_dma(
unsigned int dmanr,
const char *
device_id)
145 static void vdma_nop(
unsigned int dummy)
150 static int vdma_get_dma_residue(
unsigned int dummy)
152 return virtual_dma_count + virtual_dma_residue;
158 if(can_use_virtual_dma)
166 static unsigned long dma_mem_alloc(
unsigned long size)
172 static unsigned long vdma_mem_alloc(
unsigned long size)
174 return (
unsigned long)
vmalloc(size);
178 #define nodma_mem_alloc(size) vdma_mem_alloc(size)
180 static void _fd_dma_mem_free(
unsigned long addr,
unsigned long size)
182 if((
unsigned int) addr >= (
unsigned int)
high_memory)
183 return vfree((
void *)addr);
188 #define fd_dma_mem_free(addr, size) _fd_dma_mem_free(addr, size)
190 static void _fd_chose_dma_mode(
char *
addr,
unsigned long size)
192 if(can_use_virtual_dma == 2) {
193 if((
unsigned int) addr >= (
unsigned int)
high_memory ||
200 use_virtual_dma = can_use_virtual_dma & 1;
204 #define fd_chose_dma_mode(addr, size) _fd_chose_dma_mode(addr, size)
207 static int vdma_dma_setup(
char *
addr,
unsigned long size,
int mode,
int io)
210 virtual_dma_port =
io;
212 virtual_dma_addr =
addr;
213 virtual_dma_count =
size;
214 virtual_dma_residue = 0;
218 static int hard_dma_setup(
char *
addr,
unsigned long size,
int mode,
int io)
220 #ifdef FLOPPY_SANITY_CHECK
222 printk(
"DMA crossing 64-K boundary %p-%p\n", addr, addr+size);
228 clear_dma_ff(FLOPPY_DMA);
236 static struct fd_routine_l {
237 int (*_request_dma)(
unsigned int dmanr,
const char *
device_id);
238 void (*_free_dma)(
unsigned int dmanr);
239 int (*_get_dma_residue)(
unsigned int dummy);
240 unsigned long (*_dma_mem_alloc) (
unsigned long size);
253 vdma_get_dma_residue,
260 static int FDC1 = 0x3f0;
261 static int FDC2 = -1;
263 #define FLOPPY0_TYPE 0
264 #define FLOPPY1_TYPE 0
269 #define EXTRA_FLOPPY_PARAMS