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 struct fd_ops { 14 unsigned char (*fd_inb)(unsigned int port); 15 void (*fd_outb)(unsigned char value, unsigned int port); 16 17 /* 18 * How to access the floppy DMA functions. 19 */ 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); 35 }; 36 37 extern struct fd_ops *fd_ops; 38 39 #define fd_inb(port) fd_ops->fd_inb(port) 40 #define fd_outb(value,port) fd_ops->fd_outb(value,port) 41 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 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) 52 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, \ 57 "floppy", NULL) 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) dma_cache_wback_inv(addr,size) 63 64 #define MAX_BUFFER_SECTORS 24 65 66 67 /* 68 * And on Mips's the CMOS info fails also ... 69 * 70 * FIXME: This information should come from the ARC configuration tree 71 * or whereever a particular machine has stored this ... 72 */ 73 #define FLOPPY0_TYPE fd_drive_type(0) 74 #define FLOPPY1_TYPE fd_drive_type(1) 75 76 #define FDC1 fd_ops->fd_getfdaddr1(); 77 78 #define N_FDC 1 /* do you *really* want a second controller? */ 79 #define N_DRIVE 8 80 81 #define FLOPPY_MOTOR_MASK 0xf0 82 83 /* 84 * The DMA channel used by the floppy controller cannot access data at 85 * addresses >= 16MB 86 * 87 * Went back to the 1MB limit, as some people had problems with the floppy 88 * driver otherwise. It doesn't matter much for performance anyway, as most 89 * floppy accesses go through the track buffer. 90 * 91 * On MIPSes using vdma, this actually means that *all* transfers go thru 92 * the * track buffer since 0x1000000 is always smaller than KSEG0/1. 93 * Actually this needs to be a bit more complicated since the so much different 94 * hardware available with MIPS CPUs ... 95 */ 96 #define CROSS_64KB(a,s) ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64) 97 98 #define EXTRA_FLOPPY_PARAMS 99 100 #endif /* _ASM_FLOPPY_H */ 101