diff options
Diffstat (limited to 'drivers/ide/ide-lib.c')
-rw-r--r-- | drivers/ide/ide-lib.c | 151 |
1 files changed, 0 insertions, 151 deletions
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 47af80df6872..13af72f09ec4 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -1,26 +1,11 @@ | |||
1 | #include <linux/module.h> | ||
2 | #include <linux/types.h> | 1 | #include <linux/types.h> |
3 | #include <linux/string.h> | 2 | #include <linux/string.h> |
4 | #include <linux/kernel.h> | 3 | #include <linux/kernel.h> |
5 | #include <linux/timer.h> | ||
6 | #include <linux/mm.h> | ||
7 | #include <linux/interrupt.h> | 4 | #include <linux/interrupt.h> |
8 | #include <linux/major.h> | ||
9 | #include <linux/errno.h> | ||
10 | #include <linux/genhd.h> | ||
11 | #include <linux/blkpg.h> | ||
12 | #include <linux/slab.h> | ||
13 | #include <linux/pci.h> | ||
14 | #include <linux/delay.h> | ||
15 | #include <linux/hdreg.h> | 5 | #include <linux/hdreg.h> |
16 | #include <linux/ide.h> | 6 | #include <linux/ide.h> |
17 | #include <linux/bitops.h> | 7 | #include <linux/bitops.h> |
18 | 8 | ||
19 | #include <asm/byteorder.h> | ||
20 | #include <asm/irq.h> | ||
21 | #include <asm/uaccess.h> | ||
22 | #include <asm/io.h> | ||
23 | |||
24 | static const char *udma_str[] = | 9 | static const char *udma_str[] = |
25 | { "UDMA/16", "UDMA/25", "UDMA/33", "UDMA/44", | 10 | { "UDMA/16", "UDMA/25", "UDMA/33", "UDMA/44", |
26 | "UDMA/66", "UDMA/100", "UDMA/133", "UDMA7" }; | 11 | "UDMA/66", "UDMA/100", "UDMA/133", "UDMA7" }; |
@@ -90,142 +75,6 @@ static u8 ide_rate_filter(ide_drive_t *drive, u8 speed) | |||
90 | return min(speed, mode); | 75 | return min(speed, mode); |
91 | } | 76 | } |
92 | 77 | ||
93 | /* | ||
94 | * Standard (generic) timings for PIO modes, from ATA2 specification. | ||
95 | * These timings are for access to the IDE data port register *only*. | ||
96 | * Some drives may specify a mode, while also specifying a different | ||
97 | * value for cycle_time (from drive identification data). | ||
98 | */ | ||
99 | const ide_pio_timings_t ide_pio_timings[6] = { | ||
100 | { 70, 165, 600 }, /* PIO Mode 0 */ | ||
101 | { 50, 125, 383 }, /* PIO Mode 1 */ | ||
102 | { 30, 100, 240 }, /* PIO Mode 2 */ | ||
103 | { 30, 80, 180 }, /* PIO Mode 3 with IORDY */ | ||
104 | { 25, 70, 120 }, /* PIO Mode 4 with IORDY */ | ||
105 | { 20, 50, 100 } /* PIO Mode 5 with IORDY (nonstandard) */ | ||
106 | }; | ||
107 | |||
108 | EXPORT_SYMBOL_GPL(ide_pio_timings); | ||
109 | |||
110 | /* | ||
111 | * Shared data/functions for determining best PIO mode for an IDE drive. | ||
112 | * Most of this stuff originally lived in cmd640.c, and changes to the | ||
113 | * ide_pio_blacklist[] table should be made with EXTREME CAUTION to avoid | ||
114 | * breaking the fragile cmd640.c support. | ||
115 | */ | ||
116 | |||
117 | /* | ||
118 | * Black list. Some drives incorrectly report their maximal PIO mode, | ||
119 | * at least in respect to CMD640. Here we keep info on some known drives. | ||
120 | */ | ||
121 | static struct ide_pio_info { | ||
122 | const char *name; | ||
123 | int pio; | ||
124 | } ide_pio_blacklist [] = { | ||
125 | { "Conner Peripherals 540MB - CFS540A", 3 }, | ||
126 | |||
127 | { "WDC AC2700", 3 }, | ||
128 | { "WDC AC2540", 3 }, | ||
129 | { "WDC AC2420", 3 }, | ||
130 | { "WDC AC2340", 3 }, | ||
131 | { "WDC AC2250", 0 }, | ||
132 | { "WDC AC2200", 0 }, | ||
133 | { "WDC AC21200", 4 }, | ||
134 | { "WDC AC2120", 0 }, | ||
135 | { "WDC AC2850", 3 }, | ||
136 | { "WDC AC1270", 3 }, | ||
137 | { "WDC AC1170", 1 }, | ||
138 | { "WDC AC1210", 1 }, | ||
139 | { "WDC AC280", 0 }, | ||
140 | { "WDC AC31000", 3 }, | ||
141 | { "WDC AC31200", 3 }, | ||
142 | |||
143 | { "Maxtor 7131 AT", 1 }, | ||
144 | { "Maxtor 7171 AT", 1 }, | ||
145 | { "Maxtor 7213 AT", 1 }, | ||
146 | { "Maxtor 7245 AT", 1 }, | ||
147 | { "Maxtor 7345 AT", 1 }, | ||
148 | { "Maxtor 7546 AT", 3 }, | ||
149 | { "Maxtor 7540 AV", 3 }, | ||
150 | |||
151 | { "SAMSUNG SHD-3121A", 1 }, | ||
152 | { "SAMSUNG SHD-3122A", 1 }, | ||
153 | { "SAMSUNG SHD-3172A", 1 }, | ||
154 | |||
155 | { "ST5660A", 3 }, | ||
156 | { "ST3660A", 3 }, | ||
157 | { "ST3630A", 3 }, | ||
158 | { "ST3655A", 3 }, | ||
159 | { "ST3391A", 3 }, | ||
160 | { "ST3390A", 1 }, | ||
161 | { "ST3600A", 1 }, | ||
162 | { "ST3290A", 0 }, | ||
163 | { "ST3144A", 0 }, | ||
164 | { "ST3491A", 1 }, /* reports 3, should be 1 or 2 (depending on */ | ||
165 | /* drive) according to Seagates FIND-ATA program */ | ||
166 | |||
167 | { "QUANTUM ELS127A", 0 }, | ||
168 | { "QUANTUM ELS170A", 0 }, | ||
169 | { "QUANTUM LPS240A", 0 }, | ||
170 | { "QUANTUM LPS210A", 3 }, | ||
171 | { "QUANTUM LPS270A", 3 }, | ||
172 | { "QUANTUM LPS365A", 3 }, | ||
173 | { "QUANTUM LPS540A", 3 }, | ||
174 | { "QUANTUM LIGHTNING 540A", 3 }, | ||
175 | { "QUANTUM LIGHTNING 730A", 3 }, | ||
176 | |||
177 | { "QUANTUM FIREBALL_540", 3 }, /* Older Quantum Fireballs don't work */ | ||
178 | { "QUANTUM FIREBALL_640", 3 }, | ||
179 | { "QUANTUM FIREBALL_1080", 3 }, | ||
180 | { "QUANTUM FIREBALL_1280", 3 }, | ||
181 | { NULL, 0 } | ||
182 | }; | ||
183 | |||
184 | /** | ||
185 | * ide_scan_pio_blacklist - check for a blacklisted drive | ||
186 | * @model: Drive model string | ||
187 | * | ||
188 | * This routine searches the ide_pio_blacklist for an entry | ||
189 | * matching the start/whole of the supplied model name. | ||
190 | * | ||
191 | * Returns -1 if no match found. | ||
192 | * Otherwise returns the recommended PIO mode from ide_pio_blacklist[]. | ||
193 | */ | ||
194 | |||
195 | static int ide_scan_pio_blacklist (char *model) | ||
196 | { | ||
197 | struct ide_pio_info *p; | ||
198 | |||
199 | for (p = ide_pio_blacklist; p->name != NULL; p++) { | ||
200 | if (strncmp(p->name, model, strlen(p->name)) == 0) | ||
201 | return p->pio; | ||
202 | } | ||
203 | return -1; | ||
204 | } | ||
205 | |||
206 | unsigned int ide_pio_cycle_time(ide_drive_t *drive, u8 pio) | ||
207 | { | ||
208 | struct hd_driveid *id = drive->id; | ||
209 | int cycle_time = 0; | ||
210 | |||
211 | if (id->field_valid & 2) { | ||
212 | if (id->capability & 8) | ||
213 | cycle_time = id->eide_pio_iordy; | ||
214 | else | ||
215 | cycle_time = id->eide_pio; | ||
216 | } | ||
217 | |||
218 | /* conservative "downgrade" for all pre-ATA2 drives */ | ||
219 | if (pio < 3) { | ||
220 | if (cycle_time && cycle_time < ide_pio_timings[pio].cycle_time) | ||
221 | cycle_time = 0; /* use standard timing */ | ||
222 | } | ||
223 | |||
224 | return cycle_time ? cycle_time : ide_pio_timings[pio].cycle_time; | ||
225 | } | ||
226 | |||
227 | EXPORT_SYMBOL_GPL(ide_pio_cycle_time); | ||
228 | |||
229 | /** | 78 | /** |
230 | * ide_get_best_pio_mode - get PIO mode from drive | 79 | * ide_get_best_pio_mode - get PIO mode from drive |
231 | * @drive: drive to consider | 80 | * @drive: drive to consider |