diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-alpha/floppy.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/asm-alpha/floppy.h')
-rw-r--r-- | include/asm-alpha/floppy.h | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/include/asm-alpha/floppy.h b/include/asm-alpha/floppy.h new file mode 100644 index 000000000000..289a00d51a90 --- /dev/null +++ b/include/asm-alpha/floppy.h | |||
@@ -0,0 +1,119 @@ | |||
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 | ||
9 | */ | ||
10 | #ifndef __ASM_ALPHA_FLOPPY_H | ||
11 | #define __ASM_ALPHA_FLOPPY_H | ||
12 | |||
13 | #include <linux/config.h> | ||
14 | |||
15 | #define fd_inb(port) inb_p(port) | ||
16 | #define fd_outb(value,port) outb_p(value,port) | ||
17 | |||
18 | #define fd_enable_dma() enable_dma(FLOPPY_DMA) | ||
19 | #define fd_disable_dma() disable_dma(FLOPPY_DMA) | ||
20 | #define fd_request_dma() request_dma(FLOPPY_DMA,"floppy") | ||
21 | #define fd_free_dma() free_dma(FLOPPY_DMA) | ||
22 | #define fd_clear_dma_ff() clear_dma_ff(FLOPPY_DMA) | ||
23 | #define fd_set_dma_mode(mode) set_dma_mode(FLOPPY_DMA,mode) | ||
24 | #define fd_set_dma_addr(addr) set_dma_addr(FLOPPY_DMA,virt_to_bus(addr)) | ||
25 | #define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA,count) | ||
26 | #define fd_enable_irq() enable_irq(FLOPPY_IRQ) | ||
27 | #define fd_disable_irq() disable_irq(FLOPPY_IRQ) | ||
28 | #define fd_cacheflush(addr,size) /* nothing */ | ||
29 | #define fd_request_irq() request_irq(FLOPPY_IRQ, floppy_interrupt, \ | ||
30 | SA_INTERRUPT|SA_SAMPLE_RANDOM, \ | ||
31 | "floppy", NULL) | ||
32 | #define fd_free_irq() free_irq(FLOPPY_IRQ, NULL); | ||
33 | |||
34 | #ifdef CONFIG_PCI | ||
35 | |||
36 | #include <linux/pci.h> | ||
37 | |||
38 | #define fd_dma_setup(addr,size,mode,io) alpha_fd_dma_setup(addr,size,mode,io) | ||
39 | |||
40 | static __inline__ int | ||
41 | alpha_fd_dma_setup(char *addr, unsigned long size, int mode, int io) | ||
42 | { | ||
43 | static unsigned long prev_size; | ||
44 | static dma_addr_t bus_addr = 0; | ||
45 | static char *prev_addr; | ||
46 | static int prev_dir; | ||
47 | int dir; | ||
48 | |||
49 | dir = (mode != DMA_MODE_READ) ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE; | ||
50 | |||
51 | if (bus_addr | ||
52 | && (addr != prev_addr || size != prev_size || dir != prev_dir)) { | ||
53 | /* different from last time -- unmap prev */ | ||
54 | pci_unmap_single(isa_bridge, bus_addr, prev_size, prev_dir); | ||
55 | bus_addr = 0; | ||
56 | } | ||
57 | |||
58 | if (!bus_addr) /* need to map it */ | ||
59 | bus_addr = pci_map_single(isa_bridge, addr, size, dir); | ||
60 | |||
61 | /* remember this one as prev */ | ||
62 | prev_addr = addr; | ||
63 | prev_size = size; | ||
64 | prev_dir = dir; | ||
65 | |||
66 | fd_clear_dma_ff(); | ||
67 | fd_cacheflush(addr, size); | ||
68 | fd_set_dma_mode(mode); | ||
69 | set_dma_addr(FLOPPY_DMA, bus_addr); | ||
70 | fd_set_dma_count(size); | ||
71 | virtual_dma_port = io; | ||
72 | fd_enable_dma(); | ||
73 | |||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | #endif /* CONFIG_PCI */ | ||
78 | |||
79 | __inline__ void virtual_dma_init(void) | ||
80 | { | ||
81 | /* Nothing to do on an Alpha */ | ||
82 | } | ||
83 | |||
84 | static int FDC1 = 0x3f0; | ||
85 | static int FDC2 = -1; | ||
86 | |||
87 | /* | ||
88 | * Again, the CMOS information doesn't work on the alpha.. | ||
89 | */ | ||
90 | #define FLOPPY0_TYPE 6 | ||
91 | #define FLOPPY1_TYPE 0 | ||
92 | |||
93 | #define N_FDC 2 | ||
94 | #define N_DRIVE 8 | ||
95 | |||
96 | #define FLOPPY_MOTOR_MASK 0xf0 | ||
97 | |||
98 | /* | ||
99 | * Most Alphas have no problems with floppy DMA crossing 64k borders, | ||
100 | * except for certain ones, like XL and RUFFIAN. | ||
101 | * | ||
102 | * However, the test is simple and fast, and this *is* floppy, after all, | ||
103 | * so we do it for all platforms, just to make sure. | ||
104 | * | ||
105 | * This is advantageous in other circumstances as well, as in moving | ||
106 | * about the PCI DMA windows and forcing the floppy to start doing | ||
107 | * scatter-gather when it never had before, and there *is* a problem | ||
108 | * on that platform... ;-} | ||
109 | */ | ||
110 | |||
111 | static inline unsigned long CROSS_64KB(void *a, unsigned long s) | ||
112 | { | ||
113 | unsigned long p = (unsigned long)a; | ||
114 | return ((p + s - 1) ^ p) & ~0xffffUL; | ||
115 | } | ||
116 | |||
117 | #define EXTRA_FLOPPY_PARAMS | ||
118 | |||
119 | #endif /* __ASM_ALPHA_FLOPPY_H */ | ||