]> git.pld-linux.org Git - packages/kernel.git/blame - ide-clean-97.diff
- obsolete
[packages/kernel.git] / ide-clean-97.diff
CommitLineData
e0fd00f6 1diff -ur -Xdontdiff linux-2.5.24/drivers/ide/aec62xx.c linux/drivers/ide/aec62xx.c
2--- linux-2.5.24/drivers/ide/aec62xx.c Tue Jun 25 22:46:43 2002
3+++ linux/drivers/ide/aec62xx.c Tue Jul 2 23:54:16 2002
4@@ -160,16 +160,15 @@
5 }
6
7 #ifdef CONFIG_BLK_DEV_IDEDMA
8-static int aec62xx_udma_setup(struct ata_device *drive)
9+static int __init aec62xx_modes_map(struct ata_channel *ch)
10 {
11- u32 bmide = pci_resource_start(drive->channel->pci_dev, 4);
12- short speed;
13+ u32 bmide = pci_resource_start(ch->pci_dev, 4);
14 int map;
15
16- map = XFER_PIO | XFER_EPIO | XFER_MWDMA | XFER_UDMA | XFER_SWDMA | XFER_UDMA;
17+ map = XFER_EPIO | XFER_SWDMA | XFER_MWDMA | XFER_UDMA;
18
19- if (drive->channel->udma_four)
20- switch (drive->channel->pci_dev->device) {
21+ if (ch->udma_four)
22+ switch (ch->pci_dev->device) {
23 case PCI_DEVICE_ID_ARTOP_ATP865R:
24 case PCI_DEVICE_ID_ARTOP_ATP865:
25 /* Can't use these modes simultaneously,
26@@ -180,11 +179,7 @@
27 map |= XFER_UDMA_66;
28 }
29
30- speed = ata_timing_mode(drive, map);
31- aec_set_drive(drive, speed);
32- udma_enable(drive, drive->channel->autodma && (speed & XFER_MODE) != XFER_PIO, 0);
33-
34- return 0;
35+ return map;
36 }
37 #endif
38
39@@ -256,11 +251,12 @@
40
41 ch->tuneproc = aec62xx_tune_drive;
42 ch->speedproc = aec_set_drive;
43- ch->autodma = 0;
44
45 ch->io_32bit = 1;
46 ch->unmask = 1;
47
48+ ch->udma_four = aec62xx_ata66_check(ch);
49+
50 for (i = 0; i < 2; i++) {
51 ch->drives[i].autotune = 1;
52 ch->drives[i].dn = ch->unit * 2 + i;
53@@ -269,11 +265,8 @@
54 #ifdef CONFIG_BLK_DEV_IDEDMA
55 if (ch->dma_base) {
56 ch->highmem = 1;
57- ch->udma_setup = aec62xx_udma_setup;
58-#ifdef CONFIG_IDEDMA_AUTO
59- if (!noautodma)
60- ch->autodma = 1;
61-#endif
62+ ch->modes_map = aec62xx_modes_map(ch);
63+ ch->udma_setup = udma_generic_setup;
64 }
65 #endif
66 }
67@@ -306,17 +299,15 @@
68 vendor: PCI_VENDOR_ID_ARTOP,
69 device: PCI_DEVICE_ID_ARTOP_ATP860,
70 init_chipset: aec62xx_init_chipset,
71- ata66_check: aec62xx_ata66_check,
72 init_channel: aec62xx_init_channel,
73 enablebits: { {0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
74 bootable: NEVER_BOARD,
75- flags: ATA_F_IRQ | ATA_F_NOADMA | ATA_F_DMA
76+ flags: ATA_F_IRQ | ATA_F_DMA
77 },
78 {
79 vendor: PCI_VENDOR_ID_ARTOP,
80 device: PCI_DEVICE_ID_ARTOP_ATP860R,
81 init_chipset: aec62xx_init_chipset,
82- ata66_check: aec62xx_ata66_check,
83 init_channel: aec62xx_init_channel,
84 enablebits: { {0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
85 bootable: OFF_BOARD,
86@@ -326,7 +317,6 @@
87 vendor: PCI_VENDOR_ID_ARTOP,
88 device: PCI_DEVICE_ID_ARTOP_ATP865,
89 init_chipset: aec62xx_init_chipset,
90- ata66_check: aec62xx_ata66_check,
91 init_channel: aec62xx_init_channel,
92 enablebits: { {0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
93 bootable: NEVER_BOARD,
94@@ -336,7 +326,6 @@
95 vendor: PCI_VENDOR_ID_ARTOP,
96 device: PCI_DEVICE_ID_ARTOP_ATP865R,
97 init_chipset: aec62xx_init_chipset,
98- ata66_check: aec62xx_ata66_check,
99 init_channel: aec62xx_init_channel,
100 enablebits: { {0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
101 bootable: OFF_BOARD,
102diff -ur -Xdontdiff linux-2.5.24/drivers/ide/alim15x3.c linux/drivers/ide/alim15x3.c
103--- linux-2.5.24/drivers/ide/alim15x3.c Tue Jun 25 22:46:43 2002
104+++ linux/drivers/ide/alim15x3.c Tue Jul 2 23:54:16 2002
105@@ -99,43 +99,6 @@
106 __restore_flags(flags);
107 }
108
109-static byte ali15x3_can_ultra(struct ata_device *drive)
110-{
111- if (m5229_revision <= 0x20) {
112- return 0;
113- } else if ((m5229_revision < 0xC2) &&
114-#ifndef CONFIG_WDC_ALI15X3
115- ((chip_is_1543c_e && strstr(drive->id->model, "WDC ")) ||
116- (drive->type != ATA_DISK))) {
117-#else
118- (drive->type != ATA_DISK)) {
119-#endif
120- return 0;
121- } else {
122- return 1;
123- }
124-}
125-
126-static int ali15x3_ratemask(struct ata_device *drive)
127-{
128- int map = 0;
129-
130- if (!ali15x3_can_ultra(drive))
131- return 0;
132-
133- map |= XFER_UDMA;
134-
135- if (!eighty_ninty_three(drive))
136- return map;
137-
138- if (m5229_revision >= 0xC4)
139- map |= XFER_UDMA_100;
140- if (m5229_revision >= 0xC2)
141- map |= XFER_UDMA_66;
142-
143- return map;
144-}
145-
146 static int ali15x3_tune_chipset(struct ata_device *drive, byte speed)
147 {
148 struct pci_dev *dev = drive->channel->pci_dev;
149@@ -156,6 +119,7 @@
150 if (speed < XFER_SW_DMA_0)
151 ali15x3_tune_drive(drive, speed);
152 #ifdef CONFIG_BLK_DEV_IDEDMA
153+ /* FIXME: no support for MWDMA and SWDMA modes --bkz */
154 else if (speed >= XFER_UDMA_0) {
155 pci_read_config_byte(dev, m5229_udma, &tmpbyte);
156 tmpbyte &= (0x0f << ((1-unit) << 2));
157@@ -176,91 +140,40 @@
158 }
159
160 #ifdef CONFIG_BLK_DEV_IDEDMA
161-static int config_chipset_for_dma(struct ata_device *drive, u8 udma)
162+static int ali15x3_udma_setup(struct ata_device *drive, int map)
163 {
164- int map;
165- u8 mode;
166+#ifndef CONFIG_WDC_ALI15X3
167+ if ((m5229_revision < 0xC2) && chip_is_1543c_e &&
168+ strstr(drive->id->model, "WDC "))
169+ map &= ~XFER_UDMA_ALL;
170+#endif
171+ return udma_generic_setup(drive, map);
172+}
173
174- if (udma)
175- map = ali15x3_ratemask(drive);
176- else
177- map = XFER_SWDMA | XFER_MWDMA;
178-
179- mode = ata_timing_mode(drive, map);
180- if (mode < XFER_SW_DMA_0)
181- return 0;
182+static int ali15x3_udma_init(struct ata_device *drive, struct request *rq)
183+{
184+ if ((m5229_revision < 0xC2) && (drive->type != ATA_DISK))
185+ return ide_stopped; /* try PIO instead of DMA */
186
187- return !ali15x3_tune_chipset(drive, mode);
188+ return udma_pci_init(drive, rq);
189 }
190
191-static int ali15x3_udma_setup(struct ata_device *drive)
192+static int __init ali15x3_modes_map(struct ata_channel *ch)
193 {
194- struct hd_driveid *id = drive->id;
195- struct ata_channel *hwif = drive->channel;
196- int on = 1;
197- int verbose = 1;
198- byte can_ultra_dma = ali15x3_can_ultra(drive);
199-
200- if ((m5229_revision<=0x20) && (drive->type != ATA_DISK)) {
201- udma_enable(drive, 0, 0);
202- return 0;
203- }
204-
205- if ((id != NULL) && ((id->capability & 1) != 0) && hwif->autodma) {
206- /* Consult the list of known "bad" drives */
207- if (udma_black_list(drive)) {
208- on = 0;
209- goto fast_ata_pio;
210- }
211- on = 0;
212- verbose = 0;
213- if ((id->field_valid & 4) && (m5229_revision >= 0xC2)) {
214- if (id->dma_ultra & 0x003F) {
215- /* Force if Capable UltraDMA */
216- on = config_chipset_for_dma(drive, can_ultra_dma);
217- if ((id->field_valid & 2) &&
218- (!on))
219- goto try_dma_modes;
220- }
221- } else if (id->field_valid & 2) {
222-try_dma_modes:
223- if ((id->dma_mword & 0x0007) ||
224- (id->dma_1word & 0x0007)) {
225- /* Force if Capable regular DMA modes */
226- on = config_chipset_for_dma(drive, can_ultra_dma);
227- if (!on)
228- goto no_dma_set;
229- }
230- } else if (udma_white_list(drive)) {
231- if (id->eide_dma_time > 150) {
232- goto no_dma_set;
233- }
234- /* Consult the list of known "good" drives */
235- on = config_chipset_for_dma(drive, can_ultra_dma);
236- if (!on)
237- goto no_dma_set;
238- } else {
239- goto fast_ata_pio;
240- }
241- } else if ((id->capability & 8) || (id->field_valid & 2)) {
242-fast_ata_pio:
243- on = 0;
244- verbose = 0;
245-no_dma_set:
246- ali15x3_tune_drive(drive, 255);
247- }
248+ int map = XFER_EPIO | XFER_SWDMA | XFER_MWDMA;
249
250- udma_enable(drive, on, verbose);
251+ if (m5229_revision <= 0x20)
252+ return map;
253
254- return 0;
255-}
256+ map |= XFER_UDMA;
257
258-static int ali15x3_udma_init(struct ata_device *drive, struct request *rq)
259-{
260- if ((m5229_revision < 0xC2) && (drive->type != ATA_DISK))
261- return ide_stopped; /* try PIO instead of DMA */
262+ if (m5229_revision >= 0xC2) {
263+ map |= XFER_UDMA_66;
264+ if (m5229_revision >= 0xC4)
265+ map |= XFER_UDMA_100;
266+ }
267
268- return udma_pci_init(drive, rq);
269+ return map;
270 }
271 #endif
272
273@@ -426,6 +339,8 @@
274 }
275 #endif /* CONFIG_SPARC64 */
276
277+ hwif->udma_four = ali15x3_ata66_check(hwif);
278+
279 hwif->tuneproc = &ali15x3_tune_drive;
280 hwif->drives[0].autotune = 1;
281 hwif->drives[1].autotune = 1;
282@@ -436,15 +351,12 @@
283 /*
284 * M1543C or newer for DMAing
285 */
286- hwif->udma_init = ali15x3_udma_init;
287+ hwif->modes_map = ali15x3_modes_map(hwif);
288+ if (m5229_revision < 0xC2)
289+ hwif->no_atapi_autodma = 1;
290 hwif->udma_setup = ali15x3_udma_setup;
291- hwif->autodma = 1;
292+ hwif->udma_init = ali15x3_udma_init;
293 }
294-
295- if (noautodma)
296- hwif->autodma = 0;
297-#else
298- hwif->autodma = 0;
299 #endif
300 }
301
302@@ -472,7 +384,6 @@
303 vendor: PCI_VENDOR_ID_AL,
304 device: PCI_DEVICE_ID_AL_M5229,
305 init_chipset: ali15x3_init_chipset,
306- ata66_check: ali15x3_ata66_check,
307 init_channel: ali15x3_init_channel,
308 init_dma: ali15x3_init_dma,
309 enablebits: { {0x00,0x00,0x00}, {0x00,0x00,0x00} },
310diff -ur -Xdontdiff linux-2.5.24/drivers/ide/amd74xx.c linux/drivers/ide/amd74xx.c
311--- linux-2.5.24/drivers/ide/amd74xx.c Tue Jun 25 22:46:05 2002
312+++ linux/drivers/ide/amd74xx.c Tue Jul 2 23:54:16 2002
313@@ -175,21 +175,15 @@
314 }
315
316 #ifdef CONFIG_BLK_DEV_IDEDMA
317-static int amd74xx_udma_setup(struct ata_device *drive)
318+static int __init amd_modes_map(struct ata_channel *ch)
319 {
320- short w80 = drive->channel->udma_four;
321+ short w80 = ch->udma_four;
322+ int map = XFER_EPIO | XFER_MWDMA | XFER_UDMA |
323+ ((amd_config->flags & AMD_BAD_SWDMA) ? 0 : XFER_SWDMA) |
324+ (w80 && (amd_config->flags & AMD_UDMA) >= AMD_UDMA_66 ? XFER_UDMA_66 : 0) |
325+ (w80 && (amd_config->flags & AMD_UDMA) >= AMD_UDMA_100 ? XFER_UDMA_100 : 0);
326
327- short speed = ata_timing_mode(drive,
328- XFER_PIO | XFER_EPIO | XFER_MWDMA | XFER_UDMA |
329- ((amd_config->flags & AMD_BAD_SWDMA) ? 0 : XFER_SWDMA) |
330- (w80 && (amd_config->flags & AMD_UDMA) >= AMD_UDMA_66 ? XFER_UDMA_66 : 0) |
331- (w80 && (amd_config->flags & AMD_UDMA) >= AMD_UDMA_100 ? XFER_UDMA_100 : 0));
332-
333- amd_set_drive(drive, speed);
334-
335- udma_enable(drive, drive->channel->autodma && (speed & XFER_MODE) != XFER_PIO, 0);
336-
337- return 0;
338+ return map;
339 }
340 #endif
341
342@@ -274,9 +268,10 @@
343 {
344 int i;
345
346+ hwif->udma_four = amd74xx_ata66_check(hwif);
347+
348 hwif->tuneproc = &amd74xx_tune_drive;
349 hwif->speedproc = &amd_set_drive;
350- hwif->autodma = 0;
351
352 hwif->io_32bit = 1;
353 hwif->unmask = 1;
354@@ -289,11 +284,8 @@
355 #ifdef CONFIG_BLK_DEV_IDEDMA
356 if (hwif->dma_base) {
357 hwif->highmem = 1;
358- hwif->udma_setup = amd74xx_udma_setup;
359-# ifdef CONFIG_IDEDMA_AUTO
360- if (!noautodma)
361- hwif->autodma = 1;
362-# endif
363+ hwif->modes_map = amd_modes_map(hwif);
364+ hwif->udma_setup = udma_generic_setup;
365 }
366 #endif
367 }
368@@ -314,7 +306,6 @@
369 vendor: PCI_VENDOR_ID_AMD,
370 device: PCI_DEVICE_ID_AMD_COBRA_7401,
371 init_chipset: amd74xx_init_chipset,
372- ata66_check: amd74xx_ata66_check,
373 init_channel: amd74xx_init_channel,
374 init_dma: amd74xx_init_dma,
375 enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
376@@ -324,7 +315,6 @@
377 vendor: PCI_VENDOR_ID_AMD,
378 device: PCI_DEVICE_ID_AMD_VIPER_7409,
379 init_chipset: amd74xx_init_chipset,
380- ata66_check: amd74xx_ata66_check,
381 init_channel: amd74xx_init_channel,
382 init_dma: amd74xx_init_dma,
383 enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
384@@ -335,7 +325,6 @@
385 vendor: PCI_VENDOR_ID_AMD,
386 device: PCI_DEVICE_ID_AMD_VIPER_7411,
387 init_chipset: amd74xx_init_chipset,
388- ata66_check: amd74xx_ata66_check,
389 init_channel: amd74xx_init_channel,
390 init_dma: amd74xx_init_dma,
391 enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
392@@ -345,7 +334,6 @@
393 vendor: PCI_VENDOR_ID_AMD,
394 device: PCI_DEVICE_ID_AMD_OPUS_7441,
395 init_chipset: amd74xx_init_chipset,
396- ata66_check: amd74xx_ata66_check,
397 init_channel: amd74xx_init_channel,
398 init_dma: amd74xx_init_dma,
399 enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
400@@ -355,7 +343,6 @@
401 vendor: PCI_VENDOR_ID_AMD,
402 device: PCI_DEVICE_ID_AMD_8111_IDE,
403 init_chipset: amd74xx_init_chipset,
404- ata66_check: amd74xx_ata66_check,
405 init_channel: amd74xx_init_channel,
406 init_dma: amd74xx_init_dma,
407 enablebits: {{0x40,0x01,0x01}, {0x40,0x02,0x02}},
408@@ -365,7 +352,6 @@
409 vendor: PCI_VENDOR_ID_NVIDIA,
410 device: PCI_DEVICE_ID_NVIDIA_NFORCE_IDE,
411 init_chipset: amd74xx_init_chipset,
412- ata66_check: amd74xx_ata66_check,
413 init_channel: amd74xx_init_channel,
414 init_dma: amd74xx_init_dma,
415 enablebits: {{0x50,0x01,0x01}, {0x50,0x02,0x02}},
416diff -ur -Xdontdiff linux-2.5.24/drivers/ide/ata-timing.c linux/drivers/ide/ata-timing.c
417--- linux-2.5.24/drivers/ide/ata-timing.c Tue Jun 25 22:46:00 2002
418+++ linux/drivers/ide/ata-timing.c Tue Jul 2 23:53:04 2002
419@@ -86,9 +86,11 @@
420 if ((map & XFER_UDMA_100) == XFER_UDMA_100)
421 if ((best = (id->dma_ultra & 0x0020) ? XFER_UDMA_5 : 0)) return best;
422
423- if ((map & XFER_UDMA_66) == XFER_UDMA_66)
424- if ((best = (id->dma_ultra & 0x0010) ? XFER_UDMA_4 :
425- (id->dma_ultra & 0x0008) ? XFER_UDMA_3 : 0)) return best;
426+ if ((map & XFER_UDMA_66_4) == XFER_UDMA_66_4)
427+ if ((best = (id->dma_ultra & 0x0010) ? XFER_UDMA_4 : 0)) return best;
428+
429+ if ((map & XFER_UDMA_66_3) == XFER_UDMA_66_3)
430+ if ((best = (id->dma_ultra & 0x0008) ? XFER_UDMA_3 : 0)) return best;
431
432 if ((best = (id->dma_ultra & 0x0004) ? XFER_UDMA_2 :
433 (id->dma_ultra & 0x0002) ? XFER_UDMA_1 :
434diff -ur -Xdontdiff linux-2.5.24/drivers/ide/ata-timing.h linux/drivers/ide/ata-timing.h
435--- linux-2.5.24/drivers/ide/ata-timing.h Tue Jun 25 22:46:43 2002
436+++ linux/drivers/ide/ata-timing.h Tue Jul 2 23:53:04 2002
437@@ -59,15 +59,22 @@
438 #define ENOUGH(v,unit) (((v)-1)/(unit)+1)
439 #define EZ(v,unit) ((v)?ENOUGH(v,unit):0)
440
441-#define XFER_MODE 0xf0
442-#define XFER_UDMA_133 0x48
443-#define XFER_UDMA_100 0x44
444-#define XFER_UDMA_66 0x42
445-#define XFER_UDMA 0x40
446-#define XFER_MWDMA 0x20
447-#define XFER_SWDMA 0x10
448-#define XFER_EPIO 0x01
449-#define XFER_PIO 0x00
450+/* see hpt366.c for details */
451+#define XFER_UDMA_66_3 0x100
452+#define XFER_UDMA_66_4 0x200
453+
454+#define XFER_MODE 0xff0
455+#define XFER_UDMA_133 0x800
456+#define XFER_UDMA_100 0x400
457+#define XFER_UDMA_66 0x300
458+#define XFER_UDMA 0x040
459+#define XFER_MWDMA 0x020
460+#define XFER_SWDMA 0x010
461+#define XFER_EPIO 0x001
462+#define XFER_PIO 0x000
463+
464+#define XFER_UDMA_ALL 0xf40
465+#define XFER_UDMA_80W 0xf00
466
467 /* External interface to host chips channel timing setup.
468 *
469diff -ur -Xdontdiff linux-2.5.24/drivers/ide/cmd64x.c linux/drivers/ide/cmd64x.c
470--- linux-2.5.24/drivers/ide/cmd64x.c Tue Jun 25 22:46:43 2002
471+++ linux/drivers/ide/cmd64x.c Tue Jul 2 23:54:16 2002
472@@ -217,10 +217,10 @@
473 ide_config_drive_speed(drive, speed);
474 }
475
476-static int cmd64x_ratemask(struct ata_device *drive)
477+static int __init cmd6xx_modes_map(struct ata_channel *ch)
478 {
479- struct pci_dev *dev = drive->channel->pci_dev;
480- int map = 0;
481+ struct pci_dev *dev = ch->pci_dev;
482+ int map = XFER_EPIO | XFER_SWDMA | XFER_MWDMA;
483
484 switch(dev->device) {
485 case PCI_DEVICE_ID_CMD_680:
486@@ -234,10 +234,9 @@
487 break;
488 case PCI_DEVICE_ID_CMD_646:
489 {
490- u32 class_rev;
491- pci_read_config_dword(dev,
492- PCI_CLASS_REVISION, &class_rev);
493- class_rev &= 0xff;
494+ u32 rev;
495+ pci_read_config_dword(dev, PCI_CLASS_REVISION, &rev);
496+ rev &= 0xff;
497 /*
498 * UltraDMA only supported on PCI646U and PCI646U2, which
499 * correspond to revisions 0x03, 0x05 and 0x07 respectively.
500@@ -250,7 +249,7 @@
501 *
502 * So we only do UltraDMA on revision 0x05 and 0x07 chipsets.
503 */
504- switch(class_rev) {
505+ switch(rev) {
506 case 0x07:
507 case 0x05:
508 map |= XFER_UDMA;
509@@ -260,11 +259,6 @@
510 }
511 }
512
513- if (!eighty_ninty_three(drive)) {
514- if (map & XFER_UDMA)
515- return XFER_UDMA;
516- return 0;
517- }
518 return map;
519 }
520
521@@ -515,80 +509,6 @@
522 }
523
524 #ifdef CONFIG_BLK_DEV_IDEDMA
525-static int config_chipset_for_dma(struct ata_device *drive, u8 udma)
526-{
527- int map;
528- u8 mode;
529-
530- if (udma)
531- map = cmd64x_ratemask(drive);
532- else
533- map = XFER_SWDMA | XFER_MWDMA;
534-
535- mode = ata_timing_mode(drive, map);
536-
537- return !drive->channel->speedproc(drive, mode);
538-}
539-
540-static int cmd6xx_udma_setup(struct ata_device *drive)
541-{
542- struct hd_driveid *id = drive->id;
543- struct ata_channel *hwif = drive->channel;
544- int on = 1;
545- int verbose = 1;
546-
547- hwif->tuneproc(drive, 255);
548-
549- if ((id != NULL) && ((id->capability & 1) != 0) &&
550- hwif->autodma && (drive->type == ATA_DISK)) {
551- /* Consult the list of known "bad" drives */
552- if (udma_black_list(drive)) {
553- on = 0;
554- goto fast_ata_pio;
555- }
556- on = 0;
557- verbose = 0;
558- if ((id->field_valid & 4)) {
559- if (id->dma_ultra & 0x007F) {
560- /* Force if Capable UltraDMA */
561- on = config_chipset_for_dma(drive, 1);
562- if ((id->field_valid & 2) &&
563- (!on))
564- goto try_dma_modes;
565- }
566- } else if (id->field_valid & 2) {
567-try_dma_modes:
568- if ((id->dma_mword & 0x0007) ||
569- (id->dma_1word & 0x0007)) {
570- /* Force if Capable regular DMA modes */
571- on = config_chipset_for_dma(drive, 0);
572- if (!on)
573- goto no_dma_set;
574- }
575- } else if (udma_white_list(drive)) {
576- if (id->eide_dma_time > 150) {
577- goto no_dma_set;
578- }
579- /* Consult the list of known "good" drives */
580- on = config_chipset_for_dma(drive, 0);
581- if (!on)
582- goto no_dma_set;
583- } else {
584- goto fast_ata_pio;
585- }
586- } else if ((id->capability & 8) || (id->field_valid & 2)) {
587-fast_ata_pio:
588- on = 0;
589- verbose = 0;
590-no_dma_set:
591- hwif->tuneproc(drive, 255);
592- }
593-
594- udma_enable(drive, on, verbose);
595-
596- return 0;
597-}
598-
599 static int cmd64x_udma_stop(struct ata_device *drive)
600 {
601 struct ata_channel *ch = drive->channel;
602@@ -822,13 +742,6 @@
603 return (ata66 & mask) ? 1 : 0;
604 }
605
606-static unsigned int __init cmd64x_ata66_check(struct ata_channel *hwif)
607-{
608- if (hwif->pci_dev->device == PCI_DEVICE_ID_CMD_680)
609- return cmd680_ata66(hwif);
610- return cmd64x_ata66(hwif);
611-}
612-
613 static void __init cmd64x_init_channel(struct ata_channel *hwif)
614 {
615 struct pci_dev *dev = hwif->pci_dev;
616@@ -843,32 +756,28 @@
617 switch(dev->device) {
618 case PCI_DEVICE_ID_CMD_680:
619 hwif->busproc = cmd680_busproc;
620-#ifdef CONFIG_BLK_DEV_IDEDMA
621- if (hwif->dma_base)
622- hwif->udma_setup = cmd6xx_udma_setup;
623-#endif
624 hwif->resetproc = cmd680_reset;
625 hwif->speedproc = cmd680_tune_chipset;
626 hwif->tuneproc = cmd680_tuneproc;
627+ hwif->udma_four = cmd680_ata66(hwif);
628 break;
629 case PCI_DEVICE_ID_CMD_649:
630 case PCI_DEVICE_ID_CMD_648:
631 case PCI_DEVICE_ID_CMD_643:
632 #ifdef CONFIG_BLK_DEV_IDEDMA
633 if (hwif->dma_base) {
634- hwif->udma_setup = cmd6xx_udma_setup;
635 hwif->udma_stop = cmd64x_udma_stop;
636 hwif->udma_irq_status = cmd64x_udma_irq_status;
637 }
638 #endif
639 hwif->tuneproc = cmd64x_tuneproc;
640 hwif->speedproc = cmd64x_tune_chipset;
641+ hwif->udma_four = cmd64x_ata66(hwif);
642 break;
643 case PCI_DEVICE_ID_CMD_646:
644 hwif->chipset = ide_cmd646;
645 #ifdef CONFIG_BLK_DEV_IDEDMA
646 if (hwif->dma_base) {
647- hwif->udma_setup = cmd6xx_udma_setup;
648 if (class_rev == 0x01) {
649 hwif->udma_stop = cmd646_1_udma_stop;
650 } else {
651@@ -879,6 +788,7 @@
652 #endif
653 hwif->tuneproc = cmd64x_tuneproc;
654 hwif->speedproc = cmd64x_tune_chipset;
655+ hwif->udma_four = cmd64x_ata66(hwif);
656 break;
657 default:
658 break;
659@@ -887,10 +797,9 @@
660 #ifdef CONFIG_BLK_DEV_IDEDMA
661 if (hwif->dma_base) {
662 hwif->highmem = 1;
663-# ifdef CONFIG_IDEDMA_AUTO
664- if (!noautodma)
665- hwif->autodma = 1;
666-# endif
667+ hwif->modes_map = cmd6xx_modes_map(hwif);
668+ hwif->no_atapi_autodma = 1;
669+ hwif->udma_setup = udma_generic_setup;
670 }
671 #endif
672 }
673@@ -919,7 +828,6 @@
674 vendor: PCI_VENDOR_ID_CMD,
675 device: PCI_DEVICE_ID_CMD_648,
676 init_chipset: cmd64x_init_chipset,
677- ata66_check: cmd64x_ata66_check,
678 init_channel: cmd64x_init_channel,
679 bootable: ON_BOARD,
680 flags: ATA_F_DMA
681@@ -928,7 +836,6 @@
682 vendor: PCI_VENDOR_ID_CMD,
683 device: PCI_DEVICE_ID_CMD_649,
684 init_chipset: cmd64x_init_chipset,
685- ata66_check: cmd64x_ata66_check,
686 init_channel: cmd64x_init_channel,
687 bootable: ON_BOARD,
688 flags: ATA_F_DMA
689@@ -937,7 +844,6 @@
690 vendor: PCI_VENDOR_ID_CMD,
691 device: PCI_DEVICE_ID_CMD_680,
692 init_chipset: cmd64x_init_chipset,
693- ata66_check: cmd64x_ata66_check,
694 init_channel: cmd64x_init_channel,
695 bootable: ON_BOARD,
696 flags: ATA_F_DMA
697diff -ur -Xdontdiff linux-2.5.24/drivers/ide/cs5530.c linux/drivers/ide/cs5530.c
698--- linux-2.5.24/drivers/ide/cs5530.c Tue Jun 25 22:46:02 2002
699+++ linux/drivers/ide/cs5530.c Tue Jul 2 23:54:07 2002
700@@ -191,7 +191,7 @@
701 return 0;
702 }
703
704-static int cs5530_udma_setup(struct ata_device *drive)
705+static int cs5530_udma_setup(struct ata_device *drive, int map)
706 {
707 return cs5530_config_dma(drive);
708 }
709@@ -285,17 +285,15 @@
710 */
711 static void __init ide_init_cs5530(struct ata_channel *hwif)
712 {
713+ u32 basereg, d0_timings;
714+
715 hwif->serialized = 1;
716- if (!hwif->dma_base) {
717- hwif->autodma = 0;
718- } else {
719- unsigned int basereg, d0_timings;
720
721 #ifdef CONFIG_BLK_DEV_IDEDMA
722- hwif->udma_setup = cs5530_udma_setup;
723- hwif->highmem = 1;
724-#else
725- hwif->autodma = 0;
726+ if (hwif->dma_base) {
727+ hwif->highmem = 1;
728+ hwif->udma_setup = cs5530_udma_setup;
729+ }
730 #endif
731
732 hwif->tuneproc = &cs5530_tuneproc;
733@@ -311,7 +309,6 @@
734 if (!hwif->drives[1].autotune)
735 hwif->drives[1].autotune = 1; /* needs autotuning later */
736 }
737- }
738 }
739
740
741diff -ur -Xdontdiff linux-2.5.24/drivers/ide/cy82c693.c linux/drivers/ide/cy82c693.c
742--- linux-2.5.24/drivers/ide/cy82c693.c Tue Jun 25 22:46:02 2002
743+++ linux/drivers/ide/cy82c693.c Tue Jul 2 23:54:07 2002
744@@ -237,7 +237,7 @@
745 /*
746 * used to set DMA mode for CY82C693 (single and multi modes)
747 */
748-static int cy82c693_udma_setup(struct ata_device *drive)
749+static int cy82c693_udma_setup(struct ata_device *drive, int map)
750 {
751 /*
752 * Set dma mode for drive everything else is done by the defaul func.
753@@ -414,14 +414,11 @@
754 hwif->tuneproc = cy82c693_tune_drive;
755 hwif->drives[0].autotune = 1;
756 hwif->drives[1].autotune = 1;
757- hwif->autodma = 0;
758
759 #ifdef CONFIG_BLK_DEV_IDEDMA
760 if (hwif->dma_base) {
761 hwif->highmem = 1;
762 hwif->udma_setup = cy82c693_udma_setup;
763- if (!noautodma)
764- hwif->autodma = 1;
765 }
766 #endif
767 }
768diff -ur -Xdontdiff linux-2.5.24/drivers/ide/hpt34x.c linux/drivers/ide/hpt34x.c
769--- linux-2.5.24/drivers/ide/hpt34x.c Tue Jun 25 22:46:05 2002
770+++ linux/drivers/ide/hpt34x.c Tue Jul 2 23:54:07 2002
771@@ -72,83 +72,13 @@
772 }
773
774 #ifdef CONFIG_BLK_DEV_IDEDMA
775-static int config_chipset_for_dma(struct ata_device *drive, u8 udma)
776+static int hpt34x_udma_setup(struct ata_device *drive, int map)
777 {
778- int map;
779- u8 mode;
780-
781- if (drive->type != ATA_DISK)
782- return 0;
783-
784- if (udma)
785- map = XFER_UDMA;
786- else
787- map = XFER_SWDMA | XFER_MWDMA;
788-
789- mode = ata_timing_mode(drive, map);
790- if (mode < XFER_SW_DMA_0)
791- return 0;
792-
793- return !hpt34x_tune_chipset(drive, mode);
794-}
795-
796-static int hpt34x_udma_setup(struct ata_device *drive)
797-{
798- struct hd_driveid *id = drive->id;
799- int on = 1;
800- int verbose = 1;
801-
802- if (id && (id->capability & 1) && drive->channel->autodma) {
803- /* Consult the list of known "bad" drives */
804- if (udma_black_list(drive)) {
805- on = 0;
806- goto fast_ata_pio;
807- }
808- on = 0;
809- verbose = 0;
810- if (id->field_valid & 4) {
811- if (id->dma_ultra & 0x0007) {
812- /* Force if Capable UltraDMA */
813- on = config_chipset_for_dma(drive, 1);
814- if ((id->field_valid & 2) &&
815- (!on))
816- goto try_dma_modes;
817- }
818- } else if (id->field_valid & 2) {
819-try_dma_modes:
820- if ((id->dma_mword & 0x0007) ||
821- (id->dma_1word & 0x0007)) {
822- /* Force if Capable regular DMA modes */
823- on = config_chipset_for_dma(drive, 0);
824- if (!on)
825- goto no_dma_set;
826- }
827- } else if (udma_white_list(drive)) {
828- if (id->eide_dma_time > 150) {
829- goto no_dma_set;
830- }
831- /* Consult the list of known "good" drives */
832- on = config_chipset_for_dma(drive, 0);
833- if (!on)
834- goto no_dma_set;
835- } else {
836- goto fast_ata_pio;
837- }
838- } else if ((id->capability & 8) || (id->field_valid & 2)) {
839-fast_ata_pio:
840- on = 0;
841- verbose = 0;
842-no_dma_set:
843- hpt34x_tune_chipset(drive, ata_best_pio_mode(drive));
844- }
845-
846-#ifndef CONFIG_HPT34X_AUTODMA
847- if (on)
848- on = 0;
849-#endif
850- udma_enable(drive, on, verbose);
851-
852+#ifdef CONFIG_HPT34X_AUTODMA
853+ return udma_generic_setup(drive, map);
854+#else
855 return 0;
856+#endif
857 }
858
859 static int hpt34x_udma_stop(struct ata_device *drive)
860@@ -252,24 +182,21 @@
861 unsigned short pcicmd = 0;
862
863 pci_read_config_word(hwif->pci_dev, PCI_COMMAND, &pcicmd);
864- if (!noautodma)
865- hwif->autodma = (pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0;
866- else
867- hwif->autodma = 0;
868-
869+#ifdef CONFIG_IDEDMA_AUTO
870+ hwif->autodma = (pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0;
871+#endif
872 hwif->udma_stop = hpt34x_udma_stop;
873 hwif->udma_init = hpt34x_udma_init;
874+ hwif->modes_map = XFER_EPIO | XFER_SWDMA | XFER_MWDMA | XFER_UDMA;
875+ hwif->no_atapi_autodma = 1;
876 hwif->udma_setup = hpt34x_udma_setup;
877 hwif->highmem = 1;
878- } else {
879+ } else
880+#endif
881+ {
882 hwif->drives[0].autotune = 1;
883 hwif->drives[1].autotune = 1;
884 }
885-#else
886- hwif->drives[0].autotune = 1;
887- hwif->drives[1].autotune = 1;
888- hwif->autodma = 0;
889-#endif
890 }
891
892
893@@ -281,7 +208,7 @@
894 init_channel: ide_init_hpt34x,
895 bootable: NEVER_BOARD,
896 extra: 16,
897- flags: ATA_F_NOADMA | ATA_F_DMA
898+ flags: ATA_F_DMA
899 };
900
901 int __init init_hpt34x(void)
902diff -ur -Xdontdiff linux-2.5.24/drivers/ide/hpt366.c linux/drivers/ide/hpt366.c
903--- linux-2.5.24/drivers/ide/hpt366.c Tue Jun 25 22:46:43 2002
904+++ linux/drivers/ide/hpt366.c Tue Jul 2 23:54:16 2002
905@@ -493,37 +493,23 @@
906 return class_rev;
907 }
908
909-static int hpt3xx_ratemask(struct ata_device *drive)
910+static int __init hpt3xx_modes_map(struct ata_channel *ch)
911 {
912- u32 rev = hpt_revision(drive->channel->pci_dev);
913- int map = XFER_UDMA;
914+ u32 rev = hpt_revision(ch->pci_dev);
915+ int map = XFER_EPIO | XFER_MWDMA | XFER_UDMA | XFER_UDMA_66;
916
917 if (rev >= 8) { /* HPT374 */
918 if (HPT374_ALLOW_ATA133_6)
919 map |= XFER_UDMA_133;
920- map |= (XFER_UDMA_100 | XFER_UDMA_66);
921+ map |= XFER_UDMA_100;
922 } else if (rev >= 5) { /* HPT372 */
923 if (HPT372_ALLOW_ATA133_6)
924 map |= XFER_UDMA_133;
925- map |= (XFER_UDMA_100 | XFER_UDMA_66);
926- } else if (rev >= 4) { /* HPT370A */
927+ map |= XFER_UDMA_100;
928+ } else if (rev >= 3) { /* HPT370A / HPT370 */
929 if (HPT370_ALLOW_ATA100_5)
930 map |= XFER_UDMA_100;
931- map |= XFER_UDMA_66;
932- } else if (rev >= 3) { /* HPT370 */
933- if (HPT370_ALLOW_ATA100_5)
934- map |= XFER_UDMA_100;
935- map |= XFER_UDMA_66;
936- if (check_in_drive_lists(drive, bad_ata33))
937- return 0;
938- } else { /* HPT366 and HPT368 */
939- map |= XFER_UDMA_66;
940- if (check_in_drive_lists(drive, bad_ata33))
941- return 0;
942- }
943-
944- if (!eighty_ninty_three(drive))
945- return XFER_UDMA;
946+ } /* HPT366 / HPT368 */
947
948 return map;
949 }
950@@ -662,62 +648,42 @@
951 return ide_config_drive_speed(drive, speed);
952 }
953
954+/* FIXME: pio == 255 -> ata_best_pio_mode(drive) --bkz */
955 static void hpt3xx_tune_drive(struct ata_device *drive, u8 pio)
956 {
957 (void) hpt3xx_tune_chipset(drive, XFER_PIO_0 + min_t(u8, pio, 4));
958 }
959
960 #ifdef CONFIG_BLK_DEV_IDEDMA
961-static int config_chipset_for_dma(struct ata_device *drive)
962+static int hpt3xx_udma_setup(struct ata_device *drive, int map)
963 {
964- int map;
965 u32 rev;
966- u8 mode;
967
968 if (drive->type != ATA_DISK)
969 return 0;
970
971 rev = hpt_revision(drive->channel->pci_dev);
972
973- /* FIXME: check SWDMA modes --bkz */
974- map = hpt3xx_ratemask(drive) | XFER_MWDMA;
975- mode = ata_timing_mode(drive, map);
976-
977- /* FIXME: badlists need futher investigation --bkz
978- bad_ata100_5 is for HPT370/370A,
979- bad_ata66_4, bad_ata66_3 and bad_ata33 are for HPT366/368
980- */
981- if (mode == XFER_UDMA_5 && rev < 5) {
982- if (check_in_drive_lists(drive, bad_ata100_5)) {
983- /* FIXME: make XFER_UDMA_66/100/133
984- independent of XFER_UDMA --bkz */
985- map &= ~XFER_UDMA_100;
986- map |= XFER_UDMA;
987- mode = ata_timing_mode(drive, map);
988- }
989- }
990- if (mode == XFER_UDMA_4 && rev < 3) {
991- if (check_in_drive_lists(drive, bad_ata66_4)) {
992- if (drive->id->dma_ultra & 0x0008) {
993- mode = XFER_UDMA_3;
994- } else {
995- map &= ~XFER_UDMA_66;
996- map |= XFER_UDMA;
997- mode = ata_timing_mode(drive, map);
998- }
999- }
1000- }
1001- if (mode == XFER_UDMA_3 && rev < 3) {
1002- if (check_in_drive_lists(drive, bad_ata66_3)) {
1003- map &= ~XFER_UDMA_66;
1004- map |= XFER_UDMA;
1005- mode = ata_timing_mode(drive, map);
1006- }
1007+ /* FIXME: badlists need futher investigation --bkz */
1008+
1009+ /* bad_ata100_5 is for HPT370/370A,
1010+ bad_ata66_4, bad_ata66_3 and bad_ata33 are for HPT366/368 */
1011+
1012+ if (rev < 5 && check_in_drive_lists(drive, bad_ata100_5))
1013+ map &= ~XFER_UDMA_100;
1014+
1015+ if (rev < 3) {
1016+ if (check_in_drive_lists(drive, bad_ata66_4))
1017+ map &= ~XFER_UDMA_66_4;
1018+
1019+ if (check_in_drive_lists(drive, bad_ata66_3))
1020+ map &= ~XFER_UDMA_66_3;
1021+
1022+ if (check_in_drive_lists(drive, bad_ata33))
1023+ map &= ~XFER_UDMA_ALL;
1024 }
1025- if (check_in_drive_lists(drive, bad_ata33) && rev < 3)
1026- mode = ata_timing_mode(drive, XFER_MWDMA);
1027
1028- return !hpt3xx_tune_chipset(drive, mode);
1029+ return udma_generic_setup(drive, map);
1030 }
1031
1032 static int hpt3xx_quirkproc(struct ata_device *drive)
1033@@ -754,59 +720,6 @@
1034 }
1035 }
1036
1037-static int hpt3xx_udma_setup(struct ata_device *drive)
1038-{
1039- struct hd_driveid *id = drive->id;
1040- int on = 1;
1041- int verbose = 1;
1042-
1043- if (id && (id->capability & 1) && drive->channel->autodma) {
1044- /* Consult the list of known "bad" drives */
1045- if (udma_black_list(drive)) {
1046- on = 0;
1047- goto fast_ata_pio;
1048- }
1049- on = 0;
1050- verbose = 0;
1051- if (id->field_valid & 4) {
1052- if (id->dma_ultra & 0x007F) {
1053- /* Force if Capable UltraDMA */
1054- on = config_chipset_for_dma(drive);
1055- if ((id->field_valid & 2) &&
1056- (!on))
1057- goto try_dma_modes;
1058- }
1059- } else if (id->field_valid & 2) {
1060-try_dma_modes:
1061- if (id->dma_mword & 0x0007) {
1062- /* Force if Capable regular DMA modes */
1063- on = config_chipset_for_dma(drive);
1064- if (!on)
1065- goto no_dma_set;
1066- }
1067- } else if (udma_white_list(drive)) {
1068- if (id->eide_dma_time > 150) {
1069- goto no_dma_set;
1070- }
1071- /* Consult the list of known "good" drives */
1072- on = config_chipset_for_dma(drive);
1073- if (!on)
1074- goto no_dma_set;
1075- } else {
1076- goto fast_ata_pio;
1077- }
1078- } else if ((id->capability & 8) || (id->field_valid & 2)) {
1079-fast_ata_pio:
1080- on = 0;
1081- verbose = 0;
1082-no_dma_set:
1083- hpt3xx_tune_chipset(drive, ata_best_pio_mode(drive));
1084- }
1085- udma_enable(drive, on, verbose);
1086-
1087- return 0;
1088-}
1089-
1090 static void hpt366_udma_irq_lost(struct ata_device *drive)
1091 {
1092 struct pci_dev *dev = drive->channel->pci_dev;
1093@@ -1232,6 +1145,8 @@
1094 struct pci_dev *dev = ch->pci_dev;
1095 u32 rev = hpt_revision(dev);
1096
1097+ ch->udma_four = hpt366_ata66_check(ch);
1098+
1099 ch->tuneproc = hpt3xx_tune_drive;
1100 ch->speedproc = hpt3xx_tune_chipset;
1101 ch->quirkproc = hpt3xx_quirkproc;
1102@@ -1272,17 +1187,12 @@
1103 // ch->resetproc = hpt3xx_reset;
1104 // ch->busproc = hpt3xx_tristate;
1105 }
1106+ ch->modes_map = hpt3xx_modes_map(ch);
1107 ch->udma_setup = hpt3xx_udma_setup;
1108-
1109- if (!noautodma)
1110- ch->autodma = 1;
1111- else
1112- ch->autodma = 0;
1113 ch->highmem = 1;
1114 } else
1115 #endif
1116 {
1117- ch->autodma = 0;
1118 ch->drives[0].autotune = 1;
1119 ch->drives[1].autotune = 1;
1120 }
1121@@ -1315,7 +1225,6 @@
1122 vendor: PCI_VENDOR_ID_TTI,
1123 device: PCI_DEVICE_ID_TTI_HPT366,
1124 init_chipset: hpt366_init_chipset,
1125- ata66_check: hpt366_ata66_check,
1126 init_channel: hpt366_init_channel,
1127 init_dma: hpt366_init_dma,
1128 bootable: OFF_BOARD,
1129@@ -1326,7 +1235,6 @@
1130 vendor: PCI_VENDOR_ID_TTI,
1131 device: PCI_DEVICE_ID_TTI_HPT372,
1132 init_chipset: hpt366_init_chipset,
1133- ata66_check: hpt366_ata66_check,
1134 init_channel: hpt366_init_channel,
1135 init_dma: hpt366_init_dma,
1136 bootable: OFF_BOARD,
1137@@ -1337,7 +1245,6 @@
1138 vendor: PCI_VENDOR_ID_TTI,
1139 device: PCI_DEVICE_ID_TTI_HPT374,
1140 init_chipset: hpt366_init_chipset,
1141- ata66_check: hpt366_ata66_check,
1142 init_channel: hpt366_init_channel,
1143 init_dma: hpt366_init_dma,
1144 bootable: OFF_BOARD,
1145diff -ur -Xdontdiff linux-2.5.24/drivers/ide/icside.c linux/drivers/ide/icside.c
1146--- linux-2.5.24/drivers/ide/icside.c Tue Jun 25 22:46:02 2002
1147+++ linux/drivers/ide/icside.c Tue Jul 2 23:52:58 2002
1148@@ -405,7 +405,7 @@
1149 #endif
1150 }
1151
1152-static int icside_dma_check(struct ata_device *drive)
1153+static int icside_dma_check(struct ata_device *drive, int map)
1154 {
1155 struct hd_driveid *id = drive->id;
1156 struct ata_channel *ch = drive->channel;
1157diff -ur -Xdontdiff linux-2.5.24/drivers/ide/ide-pci.c linux/drivers/ide/ide-pci.c
1158--- linux-2.5.24/drivers/ide/ide-pci.c Tue Jun 25 22:45:54 2002
1159+++ linux/drivers/ide/ide-pci.c Tue Jul 2 23:54:16 2002
1160@@ -257,24 +257,13 @@
1161 if (d->flags & ATA_F_NODMA)
1162 goto no_dma;
1163
1164- /* Check whatever this interface is UDMA4 mode capable. */
1165- if (ch->udma_four) {
1166+ if (ch->udma_four)
1167 printk("%s: warning: ATA-66/100 forced bit set!\n", dev->name);
1168- } else {
1169- if (d->ata66_check)
1170- ch->udma_four = d->ata66_check(ch);
1171- }
1172
1173 #ifdef CONFIG_BLK_DEV_IDEDMA
1174 /*
1175 * Setup DMA transfers on the channel.
1176 */
1177- if (d->flags & ATA_F_NOADMA)
1178- autodma = 0;
1179-
1180- if (autodma)
1181- ch->autodma = 1;
1182-
1183 if (!((d->flags & ATA_F_DMA) || ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && (dev->class & 0x80))))
1184 goto no_dma;
1185 /*
1186@@ -328,6 +317,9 @@
1187 d->init_dma(ch, dma_base);
1188 else
1189 ata_init_dma(ch, dma_base);
1190+
1191+ if (ch->dma_base && autodma)
1192+ ch->autodma = 1;
1193 #endif
1194
1195 no_dma:
1196@@ -335,6 +327,11 @@
1197 if (d->init_channel)
1198 d->init_channel(ch);
1199
1200+#ifdef CONFIG_BLK_DEV_IDEDMA
1201+ if ((d->flags & ATA_F_NOADMA) || noautodma)
1202+ ch->autodma = 0;
1203+#endif
1204+
1205 return 0;
1206 }
1207
1208diff -ur -Xdontdiff linux-2.5.24/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
1209--- linux-2.5.24/drivers/ide/ide-pmac.c Wed Jun 26 00:02:53 2002
1210+++ linux/drivers/ide/ide-pmac.c Tue Jul 2 23:52:58 2002
1211@@ -260,7 +260,7 @@
1212 static int pmac_udma_stop(struct ata_device *drive);
1213 static int pmac_udma_init(struct ata_device *drive, struct request *rq);
1214 static int pmac_udma_irq_status(struct ata_device *drive);
1215-static int pmac_udma_setup(struct ata_device *drive);
1216+static int pmac_udma_setup(struct ata_device *drive, int map);
1217 static int pmac_ide_build_dmatable(struct ata_device *drive, struct request *rq, int ix, int wr);
1218 static int pmac_ide_tune_chipset(struct ata_device *drive, byte speed);
1219 static void pmac_ide_tuneproc(struct ata_device *drive, byte pio);
1220@@ -1498,7 +1498,7 @@
1221 return 0;
1222 }
1223
1224-static int pmac_udma_setup(struct ata_device *drive)
1225+static int pmac_udma_setup(struct ata_device *drive, int map)
1226 {
1227 /* Change this to better match ide-dma.c */
1228 pmac_ide_check_dma(drive);
1229diff -ur -Xdontdiff linux-2.5.24/drivers/ide/it8172.c linux/drivers/ide/it8172.c
1230--- linux-2.5.24/drivers/ide/it8172.c Tue Jun 25 22:45:58 2002
1231+++ linux/drivers/ide/it8172.c Tue Jul 2 23:54:07 2002
1232@@ -179,14 +179,6 @@
1233
1234 return ide_config_drive_speed(drive, speed);
1235 }
1236-
1237-static int it8172_udma_setup(struct ata_device *drive)
1238-{
1239- u8 speed = ata_timing_mode(drive, XFER_PIO | XFER_EPIO |
1240- XFER_SWDMA | XFER_MWDMA | XFER_UDMA);
1241-
1242- return !it8172_tune_chipset(drive, speed);
1243-}
1244 #endif /* defined(CONFIG_BLK_DEV_IDEDMA) && (CONFIG_IT8172_TUNING) */
1245
1246
1247@@ -216,15 +208,11 @@
1248 if (!hwif->dma_base)
1249 return;
1250
1251-#ifndef CONFIG_BLK_DEV_IDEDMA
1252- hwif->autodma = 0;
1253-#else /* CONFIG_BLK_DEV_IDEDMA */
1254 # ifdef CONFIG_IT8172_TUNING
1255- hwif->autodma = 1;
1256- hwif->dmaproc = &it8172_dmaproc;
1257+ hwif->modes_map = XFER_EPIO | XFER_SWDMA | XFER_MWDMA | XFER_UDMA;
1258+ hwif->udma_setup = udma_generic_setup;
1259 hwif->speedproc = &it8172_tune_chipset;
1260 # endif
1261-#endif
1262
1263 cmdBase = dev->resource[0].start;
1264 ctrlBase = dev->resource[1].start;
1265diff -ur -Xdontdiff linux-2.5.24/drivers/ide/main.c linux/drivers/ide/main.c
1266--- linux-2.5.24/drivers/ide/main.c Tue Jun 25 22:46:02 2002
1267+++ linux/drivers/ide/main.c Tue Jul 2 23:52:58 2002
1268@@ -1074,7 +1074,8 @@
1269 spin_unlock_irqrestore(&ide_lock, flags);
1270 /* Default autotune or requested autotune */
1271 if (drive->autotune != 2) {
1272- if (drive->channel->udma_setup) {
1273+ struct ata_channel *ch = drive->channel;
1274+ if (ch->udma_setup) {
1275
1276 /*
1277 * Force DMAing for the beginning of the check. Some
1278@@ -1085,7 +1086,7 @@
1279 */
1280
1281 udma_enable(drive, 0, 0);
1282- drive->channel->udma_setup(drive);
1283+ ch->udma_setup(drive, ch->modes_map);
1284 #ifdef CONFIG_BLK_DEV_IDE_TCQ_DEFAULT
1285 udma_tcq_enable(drive, 1);
1286 #endif
1287diff -ur -Xdontdiff linux-2.5.24/drivers/ide/ns87415.c linux/drivers/ide/ns87415.c
1288--- linux-2.5.24/drivers/ide/ns87415.c Tue Jun 25 22:46:02 2002
1289+++ linux/drivers/ide/ns87415.c Tue Jul 2 23:52:58 2002
1290@@ -112,14 +112,14 @@
1291 return ide_stopped;
1292 }
1293
1294-static int ns87415_udma_setup(struct ata_device *drive)
1295+static int ns87415_udma_setup(struct ata_device *drive, int map)
1296 {
1297 if (drive->type != ATA_DISK) {
1298 udma_enable(drive, 0, 0);
1299
1300 return 0;
1301 }
1302- return udma_pci_setup(drive);
1303+ return udma_pci_setup(drive, map);
1304 }
1305 #endif
1306
1307diff -ur -Xdontdiff linux-2.5.24/drivers/ide/pcidma.c linux/drivers/ide/pcidma.c
1308--- linux-2.5.24/drivers/ide/pcidma.c Tue Jul 2 17:28:02 2002
1309+++ linux/drivers/ide/pcidma.c Tue Jul 2 23:52:58 2002
1310@@ -27,6 +27,8 @@
1311 #include <linux/ide.h>
1312 #include <linux/delay.h>
1313
1314+#include "ata-timing.h"
1315+
1316 #include <asm/io.h>
1317 #include <asm/irq.h>
1318
1319@@ -164,10 +166,73 @@
1320 return 0;
1321 }
1322
1323+/* generic udma_setup() function for drivers having ->speedproc/tuneproc */
1324+int udma_generic_setup(struct ata_device *drive, int map)
1325+{
1326+ struct hd_driveid *id = drive->id;
1327+ struct ata_channel *ch = drive->channel;
1328+ int on = 0;
1329+ u8 mode;
1330+
1331+ if (!id || (drive->type != ATA_DISK && ch->no_atapi_autodma))
1332+ return 0;
1333+
1334+ if ((map & XFER_UDMA_80W) && !eighty_ninty_three(drive))
1335+ map &= ~XFER_UDMA_80W;
1336+
1337+ if ((id->capability & 1) && ch->autodma && ch->speedproc) {
1338+
1339+ /* Consult the list of known "bad" devices. */
1340+ if (udma_black_list(drive))
1341+ goto set_dma;
1342+
1343+ mode = ata_timing_mode(drive, map);
1344+
1345+ /* Device is UltraDMA capable. */
1346+ if (mode & XFER_UDMA) {
1347+ if((on = !ch->speedproc(drive, mode)))
1348+ goto set_dma;
1349+
1350+ printk(KERN_WARNING "%s: UDMA auto-tune failed.\n", drive->name);
1351+
1352+ map &= ~XFER_UDMA_ALL;
1353+ mode = ata_timing_mode(drive, map);
1354+ }
1355+
1356+ /* Device is regular DMA capable. */
1357+ if (mode & (XFER_SWDMA | XFER_MWDMA)) {
1358+ if((on = !ch->speedproc(drive, mode)))
1359+ goto set_dma;
1360+
1361+ printk(KERN_WARNING "%s: DMA auto-tune failed.\n", drive->name);
1362+ }
1363+
1364+ /* FIXME: this seems non-functional --bkz */
1365+ /* Consult the list of known "good" devices. */
1366+ if (udma_white_list(drive)) {
1367+
1368+ if (id->eide_dma_time > 150)
1369+ goto set_dma;
1370+
1371+ printk(KERN_INFO "%s: device is on DMA whitelist.\n", drive->name);
1372+// on = 1;
1373+ }
1374+
1375+ /* Revert to PIO. */
1376+ if (!on && ch->tuneproc)
1377+ ch->tuneproc(drive, 255);
1378+ }
1379+
1380+set_dma:
1381+ udma_enable(drive, on, !on);
1382+
1383+ return 0;
1384+}
1385+
1386 /*
1387 * Configure a device for DMA operation.
1388 */
1389-int udma_pci_setup(struct ata_device *drive)
1390+int udma_pci_setup(struct ata_device *drive, int map)
1391 {
1392 int config_allows_dma = 1;
1393 struct hd_driveid *id = drive->id;
1394diff -ur -Xdontdiff linux-2.5.24/drivers/ide/pcihost.h linux/drivers/ide/pcihost.h
1395--- linux-2.5.24/drivers/ide/pcihost.h Tue Jun 25 22:45:47 2002
1396+++ linux/drivers/ide/pcihost.h Tue Jul 2 23:54:16 2002
1397@@ -117,7 +117,6 @@
1398 unsigned short vendor;
1399 unsigned short device;
1400 unsigned int (*init_chipset)(struct pci_dev *);
1401- unsigned int (*ata66_check)(struct ata_channel *);
1402 void (*init_channel)(struct ata_channel *);
1403 void (*init_dma)(struct ata_channel *, unsigned long);
1404 ide_pci_enablebit_t enablebits[2];
1405diff -ur -Xdontdiff linux-2.5.24/drivers/ide/pdc202xx.c linux/drivers/ide/pdc202xx.c
1406--- linux-2.5.24/drivers/ide/pdc202xx.c Tue Jun 25 22:46:43 2002
1407+++ linux/drivers/ide/pdc202xx.c Tue Jul 2 23:54:16 2002
1408@@ -129,29 +129,30 @@
1409 return 0;
1410 }
1411
1412-static int pdc202xx_ratemask(struct ata_device *drive)
1413+static int __init pdc202xx_modes_map(struct ata_channel *ch)
1414 {
1415- struct pci_dev *dev = drive->channel->pci_dev;
1416- int map = 0;
1417-
1418- if (!eighty_ninty_three(drive))
1419- return XFER_UDMA;
1420+ int map = XFER_EPIO | XFER_SWDMA | XFER_MWDMA | XFER_UDMA;
1421
1422- switch(dev->device) {
1423+ switch(ch->pci_dev->device) {
1424 case PCI_DEVICE_ID_PROMISE_20276:
1425 case PCI_DEVICE_ID_PROMISE_20275:
1426 case PCI_DEVICE_ID_PROMISE_20269:
1427 map |= XFER_UDMA_133;
1428 case PCI_DEVICE_ID_PROMISE_20268R:
1429 case PCI_DEVICE_ID_PROMISE_20268:
1430+ map &= ~XFER_SWDMA;
1431 case PCI_DEVICE_ID_PROMISE_20267:
1432 case PCI_DEVICE_ID_PROMISE_20265:
1433 map |= XFER_UDMA_100;
1434 case PCI_DEVICE_ID_PROMISE_20262:
1435 map |= XFER_UDMA_66;
1436- case PCI_DEVICE_ID_PROMISE_20246:
1437- map |= XFER_UDMA;
1438+
1439+ if (!ch->udma_four) {
1440+ printk(KERN_WARNING "%s: 40-pin cable, speed reduced to UDMA(33) mode.\n", ch->name);
1441+ map &= ~XFER_UDMA_80W;
1442+ }
1443 }
1444+
1445 return map;
1446 }
1447
1448@@ -372,48 +373,34 @@
1449 }
1450
1451 #ifdef CONFIG_BLK_DEV_IDEDMA
1452-/* FIXME: split this for old & new chipsets (jumpbit) --bkz */
1453-static int config_chipset_for_dma(struct ata_device *drive, byte udma)
1454+static int pdc202xx_tx_udma_setup(struct ata_device *drive, int map)
1455+{
1456+ struct hd_driveid *id = drive->id;
1457+ struct ata_channel *ch = drive->channel;
1458+ u32 indexreg = ch->dma_base + 1;
1459+ u32 datareg = indexreg + 2;
1460+ u8 adj = (drive->dn % 2) ? 0x08 : 0x00;
1461+
1462+ if (drive->type != ATA_DISK)
1463+ return 0;
1464+
1465+ /* IORDY_EN & PREFETCH_EN */
1466+ if (id->capability & 4)
1467+ set_2regs(0x13, (IN_BYTE(datareg)|0x03));
1468+
1469+ return udma_generic_setup(drive, map);
1470+}
1471+
1472+static int pdc202xx_udma_setup(struct ata_device *drive, int map)
1473 {
1474- struct hd_driveid *id = drive->id;
1475+ struct hd_driveid *id = drive->id;
1476 struct ata_channel *hwif = drive->channel;
1477 struct hd_driveid *mate_id = hwif->drives[!(drive->dn%2)].id;
1478- struct pci_dev *dev = hwif->pci_dev;
1479+ struct pci_dev *dev = hwif->pci_dev;
1480 u32 high_16 = pci_resource_start(dev, 4);
1481- u32 dma_base = hwif->dma_base;
1482- u32 indexreg = dma_base + 1;
1483- u32 datareg = dma_base + 3;
1484- byte adj = (drive->dn%2) ? 0x08 : 0x00;
1485- u8 jumpbit;
1486 u32 drive_conf;
1487 u8 drive_pci = 0, AP, tmp, mode = -1;
1488 u8 CLKSPD, mask = hwif->unit ? 0x08 : 0x02;
1489- int map;
1490-
1491- /* UDMA 3, 4, 5 and 6 */
1492- u8 needs_80w = (id->dma_ultra & 0x0078);
1493-
1494- switch(dev->device) {
1495- case PCI_DEVICE_ID_PROMISE_20267:
1496- case PCI_DEVICE_ID_PROMISE_20265:
1497- case PCI_DEVICE_ID_PROMISE_20262:
1498- case PCI_DEVICE_ID_PROMISE_20246:
1499- jumpbit = 0;
1500- break;
1501- default: /* chipsets newer then 20267 */
1502- jumpbit = 1;
1503- break;
1504- }
1505-
1506- /* FIXME: this check is wrong for 20246 --bkz */
1507- /* */
1508- if (needs_80w && !hwif->udma_four) {
1509- printk(KERN_WARNING "%s: channel requires an 80-pin cable.\n", hwif->name);
1510- printk(KERN_INFO "%s: reduced to UDMA(33) mode.\n", drive->name);
1511- }
1512-
1513- if (jumpbit)
1514- goto chipset_is_set;
1515
1516 /*
1517 * Set the control register to use the 66Mhz system
1518@@ -427,7 +414,7 @@
1519 * FIXME: move this to pdc202xx_tuneproc()
1520 * right now you can't downgrade from U66 to U33 --bkz
1521 */
1522- if (needs_80w) {
1523+ if (id->dma_ultra & 0x0078) { /* UDMA 3, 4, 5 and 6 */
1524 CLKSPD = IN_BYTE(high_16 + PDC_CLK);
1525 /* check cable and mate (must be at least udma3 capable) */
1526 if (!hwif->udma_four ||
1527@@ -449,12 +436,11 @@
1528 /* FIXME: what if SYNC_ERRDY is enabled for slave
1529 and disabled for master? --bkz */
1530 pci_read_config_byte(dev, drive_pci, &AP);
1531+ /* enable SYNC_ERRDY for master and slave (if enabled for master) */
1532 if (!(AP & SYNC_ERRDY_EN)) {
1533- if (drive->dn == 0 || drive->dn == 2) {
1534- /* enable SYNC_ERRDY for master */
1535+ if (!(drive->dn % 2)) {
1536 pci_write_config_byte(dev, drive_pci, AP|SYNC_ERRDY_EN);
1537 } else {
1538- /* enable SYNC_ERRDY for slave if enabled for master */
1539 pci_read_config_byte(dev, drive_pci - 4, &tmp);
1540 if (tmp & SYNC_ERRDY_EN)
1541 pci_write_config_byte(dev, drive_pci, AP|SYNC_ERRDY_EN);
1542@@ -466,85 +452,26 @@
1543 if (drive->type != ATA_DISK)
1544 return 0;
1545
1546- if (jumpbit) {
1547- if (id->capability & 4) { /* IORDY_EN & PREFETCH_EN */
1548- set_2regs(0x13, (IN_BYTE(datareg)|0x03));
1549- }
1550- } else {
1551- pci_read_config_byte(dev, drive_pci, &AP);
1552- if (id->capability & 4) /* IORDY_EN */
1553- pci_write_config_byte(dev, drive_pci, AP|IORDY_EN);
1554- pci_read_config_byte(dev, drive_pci, &AP);
1555- if (drive->type == ATA_DISK) /* PREFETCH_EN */
1556- pci_write_config_byte(dev, drive_pci, AP|PREFETCH_EN);
1557- }
1558+ pci_read_config_byte(dev, drive_pci, &AP);
1559+ if (id->capability & 4) /* IORDY_EN */
1560+ pci_write_config_byte(dev, drive_pci, AP|IORDY_EN);
1561+ pci_read_config_byte(dev, drive_pci, &AP);
1562+ if (drive->type == ATA_DISK) /* PREFETCH_EN */
1563+ pci_write_config_byte(dev, drive_pci, AP|PREFETCH_EN);
1564
1565- if (udma) {
1566- map = pdc202xx_ratemask(drive);
1567- } else {
1568- if (!jumpbit)
1569- map = XFER_SWDMA | XFER_MWDMA;
1570- else
1571- map = XFER_MWDMA;
1572- }
1573+ map = hwif->modes_map;
1574+
1575+ if (!eighty_ninty_three(drive))
1576+ map &= ~XFER_UDMA_80W;
1577
1578 mode = ata_timing_mode(drive, map);
1579 if (mode < XFER_SW_DMA_0) {
1580 /* restore original pci-config space */
1581- if (!jumpbit)
1582- pci_write_config_dword(dev, drive_pci, drive_conf);
1583+ pci_write_config_dword(dev, drive_pci, drive_conf);
1584 return 0;
1585 }
1586
1587- return !hwif->speedproc(drive, mode);
1588-}
1589-
1590-static int pdc202xx_udma_setup(struct ata_device *drive)
1591-{
1592- struct hd_driveid *id = drive->id;
1593- struct ata_channel *hwif = drive->channel;
1594- int on = 0;
1595- int verbose = 1;
1596-
1597- if (id && (id->capability & 1) && hwif->autodma) {
1598- /* Consult the list of known "bad" drives */
1599- verbose = 0;
1600- if (udma_black_list(drive))
1601- goto no_dma_set;
1602- if (id->field_valid & 4) {
1603- if (id->dma_ultra & 0x007F) {
1604- /* Force if Capable UltraDMA */
1605- on = config_chipset_for_dma(drive, 1);
1606- if ((id->field_valid & 2) &&
1607- (!on))
1608- goto try_dma_modes;
1609- }
1610- } else if (id->field_valid & 2) {
1611-try_dma_modes:
1612- if ((id->dma_mword & 0x0007) ||
1613- (id->dma_1word & 0x0007)) {
1614- /* Force if Capable regular DMA modes */
1615- on = config_chipset_for_dma(drive, 0);
1616- if (!on)
1617- goto no_dma_set;
1618- }
1619- } else if (udma_white_list(drive)) {
1620- if (id->eide_dma_time > 150) {
1621- goto no_dma_set;
1622- }
1623- /* Consult the list of known "good" drives */
1624- on = config_chipset_for_dma(drive, 0);
1625- if (!on)
1626- goto no_dma_set;
1627- } else goto no_dma_set;
1628- } else if ((id->capability & 8) || (id->field_valid & 2)) {
1629-no_dma_set:
1630- pdc202xx_tune_drive(drive, 255);
1631- }
1632-
1633- udma_enable(drive, on, verbose);
1634-
1635- return 0;
1636+ return udma_generic_setup(drive, map);
1637 }
1638
1639 static void pdc202xx_udma_start(struct ata_device *drive, struct request *rq)
1640@@ -725,12 +652,20 @@
1641 case PCI_DEVICE_ID_PROMISE_20269:
1642 case PCI_DEVICE_ID_PROMISE_20268:
1643 case PCI_DEVICE_ID_PROMISE_20268R:
1644+ hwif->udma_four = pdc202xx_tx_ata66_check(hwif);
1645+
1646 hwif->speedproc = &pdc202xx_new_tune_chipset;
1647 hwif->resetproc = &pdc202xx_new_reset;
1648+#ifdef CONFIG_BLK_DEV_IDEDMA
1649+ if (hwif->dma_base)
1650+ hwif->udma_setup = pdc202xx_tx_udma_setup;
1651+#endif
1652 break;
1653 case PCI_DEVICE_ID_PROMISE_20267:
1654 case PCI_DEVICE_ID_PROMISE_20265:
1655 case PCI_DEVICE_ID_PROMISE_20262:
1656+ hwif->udma_four = pdc202xx_ata66_check(hwif);
1657+
1658 hwif->resetproc = &pdc202xx_reset;
1659 #ifdef CONFIG_BLK_DEV_IDEDMA
1660 /* we need special functions for lba48 */
1661@@ -741,6 +676,10 @@
1662 #endif
1663 /* FIXME: check whether 20246 works with lba48 --bkz */
1664 case PCI_DEVICE_ID_PROMISE_20246:
1665+#ifdef CONFIG_BLK_DEV_IDEDMA
1666+ if (hwif->dma_base)
1667+ hwif->udma_setup = pdc202xx_udma_setup;
1668+#endif
1669 hwif->speedproc = &pdc202xx_tune_chipset;
1670 default:
1671 break;
1672@@ -748,18 +687,15 @@
1673
1674 #ifdef CONFIG_BLK_DEV_IDEDMA
1675 if (hwif->dma_base) {
1676+ hwif->modes_map = pdc202xx_modes_map(hwif);
1677 hwif->udma_irq_lost = pdc202xx_bug;
1678 hwif->udma_timeout = pdc202xx_bug;
1679- hwif->udma_setup = pdc202xx_udma_setup;
1680 hwif->highmem = 1;
1681- if (!noautodma)
1682- hwif->autodma = 1;
1683 } else
1684 #endif
1685 {
1686 hwif->drives[0].autotune = 1;
1687 hwif->drives[1].autotune = 1;
1688- hwif->autodma = 0;
1689 }
1690 }
1691
1692@@ -770,7 +706,6 @@
1693 vendor: PCI_VENDOR_ID_PROMISE,
1694 device: PCI_DEVICE_ID_PROMISE_20246,
1695 init_chipset: pdc202xx_init_chipset,
1696- ata66_check: NULL,
1697 init_channel: ide_init_pdc202xx,
1698 #ifndef CONFIG_PDC202XX_FORCE
1699 enablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
1700@@ -783,7 +718,6 @@
1701 vendor: PCI_VENDOR_ID_PROMISE,
1702 device: PCI_DEVICE_ID_PROMISE_20262,
1703 init_chipset: pdc202xx_init_chipset,
1704- ata66_check: pdc202xx_ata66_check,
1705 init_channel: ide_init_pdc202xx,
1706 #ifndef CONFIG_PDC202XX_FORCE
1707 enablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
1708@@ -796,7 +730,6 @@
1709 vendor: PCI_VENDOR_ID_PROMISE,
1710 device: PCI_DEVICE_ID_PROMISE_20265,
1711 init_chipset: pdc202xx_init_chipset,
1712- ata66_check: pdc202xx_ata66_check,
1713 init_channel: ide_init_pdc202xx,
1714 #ifndef CONFIG_PDC202XX_FORCE
1715 enablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
1716@@ -811,7 +744,6 @@
1717 vendor: PCI_VENDOR_ID_PROMISE,
1718 device: PCI_DEVICE_ID_PROMISE_20267,
1719 init_chipset: pdc202xx_init_chipset,
1720- ata66_check: pdc202xx_ata66_check,
1721 init_channel: ide_init_pdc202xx,
1722 #ifndef CONFIG_PDC202XX_FORCE
1723 enablebits: {{0x50,0x02,0x02}, {0x50,0x04,0x04}},
1724@@ -824,7 +756,6 @@
1725 vendor: PCI_VENDOR_ID_PROMISE,
1726 device: PCI_DEVICE_ID_PROMISE_20268,
1727 init_chipset: pdc202xx_tx_init_chipset,
1728- ata66_check: pdc202xx_tx_ata66_check,
1729 init_channel: ide_init_pdc202xx,
1730 bootable: OFF_BOARD,
1731 flags: ATA_F_IRQ | ATA_F_DMA
1732@@ -837,7 +768,6 @@
1733 vendor: PCI_VENDOR_ID_PROMISE,
1734 device: PCI_DEVICE_ID_PROMISE_20268R,
1735 init_chipset: pdc202xx_tx_init_chipset,
1736- ata66_check: pdc202xx_tx_ata66_check,
1737 init_channel: ide_init_pdc202xx,
1738 bootable: OFF_BOARD,
1739 flags: ATA_F_IRQ | ATA_F_DMA
1740@@ -846,7 +776,6 @@
1741 vendor: PCI_VENDOR_ID_PROMISE,
1742 device: PCI_DEVICE_ID_PROMISE_20269,
1743 init_chipset: pdc202xx_tx_init_chipset,
1744- ata66_check: pdc202xx_tx_ata66_check,
1745 init_channel: ide_init_pdc202xx,
1746 bootable: OFF_BOARD,
1747 flags: ATA_F_IRQ | ATA_F_DMA
1748@@ -855,7 +784,6 @@
1749 vendor: PCI_VENDOR_ID_PROMISE,
1750 device: PCI_DEVICE_ID_PROMISE_20275,
1751 init_chipset: pdc202xx_tx_init_chipset,
1752- ata66_check: pdc202xx_tx_ata66_check,
1753 init_channel: ide_init_pdc202xx,
1754 bootable: OFF_BOARD,
1755 flags: ATA_F_IRQ | ATA_F_DMA
1756@@ -864,7 +792,6 @@
1757 vendor: PCI_VENDOR_ID_PROMISE,
1758 device: PCI_DEVICE_ID_PROMISE_20276,
1759 init_chipset: pdc202xx_tx_init_chipset,
1760- ata66_check: pdc202xx_tx_ata66_check,
1761 init_channel: ide_init_pdc202xx,
1762 bootable: OFF_BOARD,
1763 flags: ATA_F_IRQ | ATA_F_DMA
1764diff -ur -Xdontdiff linux-2.5.24/drivers/ide/piix.c linux/drivers/ide/piix.c
1765--- linux-2.5.24/drivers/ide/piix.c Tue Jun 25 22:46:05 2002
1766+++ linux/drivers/ide/piix.c Tue Jul 2 23:54:16 2002
1767@@ -244,26 +244,18 @@
1768 }
1769
1770 #ifdef CONFIG_BLK_DEV_IDEDMA
1771-
1772-static int piix_udma_setup(struct ata_device *drive)
1773+static int __init piix_modes_map(struct ata_channel *ch)
1774 {
1775- short w80 = drive->channel->udma_four;
1776-
1777- short speed = ata_timing_mode(drive,
1778- XFER_PIO | XFER_EPIO |
1779- (piix_config->flags & PIIX_NODMA ? 0 : (XFER_SWDMA | XFER_MWDMA |
1780- (piix_config->flags & PIIX_UDMA ? XFER_UDMA : 0) |
1781- (w80 && (piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_66 ? XFER_UDMA_66 : 0) |
1782- (w80 && (piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_100 ? XFER_UDMA_100 : 0) |
1783- (w80 && (piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_133 ? XFER_UDMA_133 : 0))));
1784-
1785- piix_set_drive(drive, speed);
1786-
1787- udma_enable(drive, drive->channel->autodma && (speed & XFER_MODE) != XFER_PIO, 0);
1788+ short w80 = ch->udma_four;
1789+ int map = XFER_EPIO |
1790+ (piix_config->flags & PIIX_NODMA ? 0 : (XFER_SWDMA | XFER_MWDMA |
1791+ (piix_config->flags & PIIX_UDMA ? XFER_UDMA : 0) |
1792+ (w80 && (piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_66 ? XFER_UDMA_66 : 0) |
1793+ (w80 && (piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_100 ? XFER_UDMA_100 : 0) |
1794+ (w80 && (piix_config->flags & PIIX_UDMA) >= PIIX_UDMA_133 ? XFER_UDMA_133 : 0)));
1795
1796- return 0;
1797+ return map;
1798 }
1799-
1800 #endif
1801
1802 /*
1803@@ -360,9 +352,10 @@
1804 {
1805 int i;
1806
1807+ ch->udma_four = piix_ata66_check(ch);
1808+
1809 ch->tuneproc = &piix_tune_drive;
1810 ch->speedproc = &piix_set_drive;
1811- ch->autodma = 0;
1812 ch->io_32bit = 1;
1813 ch->unmask = 1;
1814 for (i = 0; i < 2; i++) {
1815@@ -373,11 +366,8 @@
1816 #ifdef CONFIG_BLK_DEV_IDEDMA
1817 if (ch->dma_base) {
1818 ch->highmem = 1;
1819- ch->udma_setup = piix_udma_setup;
1820-# ifdef CONFIG_IDEDMA_AUTO
1821- if (!noautodma)
1822- ch->autodma = 1;
1823-# endif
1824+ ch->modes_map = piix_modes_map(ch);
1825+ ch->udma_setup = udma_generic_setup;
1826 }
1827 #endif
1828 }
1829@@ -401,7 +391,6 @@
1830 vendor: PCI_VENDOR_ID_INTEL,
1831 device: PCI_DEVICE_ID_INTEL_82371FB_1,
1832 init_chipset: piix_init_chipset,
1833- ata66_check: piix_ata66_check,
1834 init_channel: piix_init_channel,
1835 init_dma: piix_init_dma,
1836 enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
1837@@ -411,7 +400,6 @@
1838 vendor: PCI_VENDOR_ID_INTEL,
1839 device: PCI_DEVICE_ID_INTEL_82371SB_1,
1840 init_chipset: piix_init_chipset,
1841- ata66_check: piix_ata66_check,
1842 init_channel: piix_init_channel,
1843 init_dma: piix_init_dma,
1844 enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
1845@@ -421,7 +409,6 @@
1846 vendor: PCI_VENDOR_ID_INTEL,
1847 device: PCI_DEVICE_ID_INTEL_82371AB,
1848 init_chipset: piix_init_chipset,
1849- ata66_check: piix_ata66_check,
1850 init_channel: piix_init_channel,
1851 init_dma: piix_init_dma,
1852 enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
1853@@ -431,7 +418,6 @@
1854 vendor: PCI_VENDOR_ID_INTEL,
1855 device: PCI_DEVICE_ID_INTEL_82443MX_1,
1856 init_chipset: piix_init_chipset,
1857- ata66_check: piix_ata66_check,
1858 init_channel: piix_init_channel,
1859 init_dma: piix_init_dma,
1860 enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
1861@@ -441,7 +427,6 @@
1862 vendor: PCI_VENDOR_ID_INTEL,
1863 device: PCI_DEVICE_ID_INTEL_82372FB_1,
1864 init_chipset: piix_init_chipset,
1865- ata66_check: piix_ata66_check,
1866 init_channel: piix_init_channel,
1867 init_dma: piix_init_dma,
1868 enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
1869@@ -451,7 +436,6 @@
1870 vendor: PCI_VENDOR_ID_INTEL,
1871 device: PCI_DEVICE_ID_INTEL_82801AA_1,
1872 init_chipset: piix_init_chipset,
1873- ata66_check: piix_ata66_check,
1874 init_channel: piix_init_channel,
1875 init_dma: piix_init_dma,
1876 enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
1877@@ -461,7 +445,6 @@
1878 vendor: PCI_VENDOR_ID_INTEL,
1879 device: PCI_DEVICE_ID_INTEL_82801AB_1,
1880 init_chipset: piix_init_chipset,
1881- ata66_check: piix_ata66_check,
1882 init_channel: piix_init_channel,
1883 init_dma: piix_init_dma,
1884 enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
1885@@ -471,7 +454,6 @@
1886 vendor: PCI_VENDOR_ID_INTEL,
1887 device: PCI_DEVICE_ID_INTEL_82801BA_9,
1888 init_chipset: piix_init_chipset,
1889- ata66_check: piix_ata66_check,
1890 init_channel: piix_init_channel,
1891 init_dma: piix_init_dma,
1892 enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
1893@@ -481,7 +463,6 @@
1894 vendor: PCI_VENDOR_ID_INTEL,
1895 device: PCI_DEVICE_ID_INTEL_82801BA_8,
1896 init_chipset: piix_init_chipset,
1897- ata66_check: piix_ata66_check,
1898 init_channel: piix_init_channel,
1899 init_dma: piix_init_dma,
1900 enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
1901@@ -491,7 +472,6 @@
1902 vendor: PCI_VENDOR_ID_INTEL,
1903 device: PCI_DEVICE_ID_INTEL_82801E_9,
1904 init_chipset: piix_init_chipset,
1905- ata66_check: piix_ata66_check,
1906 init_channel: piix_init_channel,
1907 init_dma: piix_init_dma,
1908 enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
1909@@ -501,7 +481,6 @@
1910 vendor: PCI_VENDOR_ID_INTEL,
1911 device: PCI_DEVICE_ID_INTEL_82801CA_10,
1912 init_chipset: piix_init_chipset,
1913- ata66_check: piix_ata66_check,
1914 init_channel: piix_init_channel,
1915 init_dma: piix_init_dma,
1916 enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
1917@@ -511,7 +490,6 @@
1918 vendor: PCI_VENDOR_ID_INTEL,
1919 device: PCI_DEVICE_ID_INTEL_82801CA_11,
1920 init_chipset: piix_init_chipset,
1921- ata66_check: piix_ata66_check,
1922 init_channel: piix_init_channel,
1923 init_dma: piix_init_dma,
1924 enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
1925@@ -521,7 +499,6 @@
1926 vendor: PCI_VENDOR_ID_INTEL,
1927 device: PCI_DEVICE_ID_INTEL_82801DB_9,
1928 init_chipset: piix_init_chipset,
1929- ata66_check: piix_ata66_check,
1930 init_channel: piix_init_channel,
1931 init_dma: piix_init_dma,
1932 enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
1933@@ -531,7 +508,6 @@
1934 vendor: PCI_VENDOR_ID_EFAR,
1935 device: PCI_DEVICE_ID_EFAR_SLC90E66_1,
1936 init_chipset: piix_init_chipset,
1937- ata66_check: piix_ata66_check,
1938 init_channel: piix_init_channel,
1939 init_dma: piix_init_dma,
1940 enablebits: {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
1941diff -ur -Xdontdiff linux-2.5.24/drivers/ide/serverworks.c linux/drivers/ide/serverworks.c
1942--- linux-2.5.24/drivers/ide/serverworks.c Tue Jun 25 22:46:43 2002
1943+++ linux/drivers/ide/serverworks.c Tue Jul 2 23:54:16 2002
1944@@ -103,15 +103,11 @@
1945
1946 static struct pci_dev *isa_dev;
1947
1948-static int svwks_ratemask(struct ata_device *drive)
1949+static int __init svwks_modes_map(struct ata_channel *ch)
1950 {
1951- struct pci_dev *dev = drive->channel->pci_dev;
1952- int map = 0;
1953+ int map = XFER_EPIO | XFER_MWDMA;
1954
1955- if (!eighty_ninty_three(drive))
1956- return XFER_UDMA;
1957-
1958- switch(dev->device) {
1959+ switch(ch->pci_dev->device) {
1960 case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE:
1961 if (svwks_revision >= SVWKS_CSB5_REVISION_NEW)
1962 map |= XFER_UDMA_100;
1963@@ -120,6 +116,7 @@
1964 map |= XFER_UDMA;
1965 break;
1966 }
1967+
1968 return map;
1969 }
1970
1971@@ -176,6 +173,7 @@
1972 csb5_pio |= ((speed - XFER_PIO_0) << (4*drive->dn));
1973 break;
1974
1975+ /* FIXME: check SWDMA modes --bkz */
1976 #ifdef CONFIG_BLK_DEV_IDEDMA
1977 case XFER_MW_DMA_2:
1978 case XFER_MW_DMA_1:
1979@@ -224,79 +222,13 @@
1980 return ide_config_drive_speed(drive, speed);
1981 }
1982
1983+/* FIXME: pio == 255 -> ata_best_pio_mode(drive) --bkz */
1984 static void svwks_tune_drive(struct ata_device *drive, u8 pio)
1985 {
1986 (void) svwks_tune_chipset(drive, XFER_PIO_0 + min_t(u8, pio, 4));
1987 }
1988
1989 #ifdef CONFIG_BLK_DEV_IDEDMA
1990-static int config_chipset_for_dma(struct ata_device *drive)
1991-{
1992- int map;
1993- u8 mode;
1994-
1995- /* FIXME: check SWDMA modes --bkz */
1996- map = XFER_MWDMA | svwks_ratemask(drive);
1997- mode = ata_timing_mode(drive, map);
1998-
1999- return !svwks_tune_chipset(drive, mode);
2000-}
2001-
2002-static int svwks_udma_setup(struct ata_device *drive)
2003-{
2004- struct hd_driveid *id = drive->id;
2005- int on = 1;
2006- int verbose = 1;
2007-
2008- if (id && (id->capability & 1) && drive->channel->autodma) {
2009- /* Consult the list of known "bad" drives */
2010- if (udma_black_list(drive)) {
2011- on = 0;
2012- goto fast_ata_pio;
2013- }
2014- on = 0;
2015- verbose = 0;
2016- if (id->field_valid & 4) {
2017- if (id->dma_ultra & 0x003F) {
2018- /* Force if Capable UltraDMA */
2019- on = config_chipset_for_dma(drive);
2020- if ((id->field_valid & 2) &&
2021- (!on))
2022- goto try_dma_modes;
2023- }
2024- } else if (id->field_valid & 2) {
2025-try_dma_modes:
2026- if ((id->dma_mword & 0x0007) ||
2027- (id->dma_1word & 0x007)) {
2028- /* Force if Capable regular DMA modes */
2029- on = config_chipset_for_dma(drive);
2030- if (!on)
2031- goto no_dma_set;
2032- }
2033- } else if (udma_white_list(drive)) {
2034- if (id->eide_dma_time > 150) {
2035- goto no_dma_set;
2036- }
2037- /* Consult the list of known "good" drives */
2038- on = config_chipset_for_dma(drive);
2039- if (!on)
2040- goto no_dma_set;
2041- } else {
2042- goto fast_ata_pio;
2043- }
2044- } else if ((id->capability & 8) || (id->field_valid & 2)) {
2045-fast_ata_pio:
2046- on = 0;
2047- verbose = 0;
2048-no_dma_set:
2049- svwks_tune_chipset(drive, ata_best_pio_mode(drive));
2050- }
2051-
2052- udma_enable(drive, on, verbose);
2053-
2054- return 0;
2055-}
2056-
2057 static int svwks_udma_stop(struct ata_device *drive)
2058 {
2059 struct ata_channel *ch = drive->channel;
2060@@ -437,24 +369,21 @@
2061 if (!hwif->irq)
2062 hwif->irq = hwif->unit ? 15 : 14;
2063
2064+ hwif->udma_four = svwks_ata66_check(hwif);
2065+
2066 hwif->tuneproc = &svwks_tune_drive;
2067 hwif->speedproc = &svwks_tune_chipset;
2068
2069 #ifndef CONFIG_BLK_DEV_IDEDMA
2070 hwif->drives[0].autotune = 1;
2071 hwif->drives[1].autotune = 1;
2072- hwif->autodma = 0;
2073 #else
2074 if (hwif->dma_base) {
2075-#ifdef CONFIG_IDEDMA_AUTO
2076- if (!noautodma)
2077- hwif->autodma = 1;
2078-#endif
2079+ hwif->modes_map = svwks_modes_map(hwif);
2080+ hwif->udma_setup = udma_generic_setup;
2081 hwif->udma_stop = svwks_udma_stop;
2082- hwif->udma_setup = svwks_udma_setup;
2083 hwif->highmem = 1;
2084 } else {
2085- hwif->autodma = 0;
2086 hwif->drives[0].autotune = 1;
2087 hwif->drives[1].autotune = 1;
2088 }
2089@@ -468,7 +397,6 @@
2090 vendor: PCI_VENDOR_ID_SERVERWORKS,
2091 device: PCI_DEVICE_ID_SERVERWORKS_OSB4IDE,
2092 init_chipset: svwks_init_chipset,
2093- ata66_check: svwks_ata66_check,
2094 init_channel: ide_init_svwks,
2095 bootable: ON_BOARD,
2096 flags: ATA_F_DMA
2097@@ -477,7 +405,6 @@
2098 vendor: PCI_VENDOR_ID_SERVERWORKS,
2099 device: PCI_DEVICE_ID_SERVERWORKS_CSB5IDE,
2100 init_chipset: svwks_init_chipset,
2101- ata66_check: svwks_ata66_check,
2102 init_channel: ide_init_svwks,
2103 bootable: ON_BOARD,
2104 flags: ATA_F_SIMPLEX
2105diff -ur -Xdontdiff linux-2.5.24/drivers/ide/sis5513.c linux/drivers/ide/sis5513.c
2106--- linux-2.5.24/drivers/ide/sis5513.c Tue Jun 25 22:46:43 2002
2107+++ linux/drivers/ide/sis5513.c Tue Jul 2 23:54:16 2002
2108@@ -207,9 +207,9 @@
2109
2110 static struct pci_dev *host_dev = NULL;
2111
2112-static int sis5513_ratemask(struct ata_device *drive)
2113+static int __init sis5513_modes_map(struct ata_channel *ch)
2114 {
2115- int map = 0;
2116+ int map = XFER_EPIO | XFER_SWDMA | XFER_MWDMA;
2117
2118 switch(chipset_family) {
2119 case ATA_133: /* map |= XFER_UDMA_133; */
2120@@ -221,15 +221,8 @@
2121 case ATA_33:
2122 map |= XFER_UDMA;
2123 break;
2124- case ATA_16:
2125- case ATA_00:
2126- default:
2127- return 0;
2128 }
2129
2130- if (!eighty_ninty_three(drive))
2131- return XFER_UDMA;
2132-
2133 return map;
2134 }
2135
2136@@ -404,86 +397,6 @@
2137 (void)config_art_rwp_pio(drive, min_t(u8, pio, 4));
2138 }
2139
2140-#ifdef CONFIG_BLK_DEV_IDEDMA
2141-static int config_chipset_for_dma(struct ata_device *drive, u8 udma)
2142-{
2143- int map;
2144- u8 mode;
2145-
2146-#ifdef DEBUG
2147- printk("SIS5513: config_chipset_for_dma, drive %d, udma %d\n",
2148- drive->dn, udma);
2149-#endif
2150-
2151- if (udma)
2152- map = sis5513_ratemask(drive);
2153- else
2154- map = XFER_SWDMA | XFER_MWDMA;
2155-
2156- mode = ata_timing_mode(drive, map);
2157- if (mode < XFER_SW_DMA_0)
2158- return 0;
2159-
2160- return !sis5513_tune_chipset(drive, mode);
2161-}
2162-
2163-static int sis5513_udma_setup(struct ata_device *drive)
2164-{
2165- struct hd_driveid *id = drive->id;
2166- int on = 0;
2167- int verbose = 1;
2168-
2169- config_drive_art_rwp(drive);
2170- sis5513_tune_drive(drive, 255);
2171-
2172- if (id && (id->capability & 1) && drive->channel->autodma) {
2173- /* Consult the list of known "bad" drives */
2174- if (udma_black_list(drive)) {
2175- on = 0;
2176- goto fast_ata_pio;
2177- }
2178- on = 0;
2179- verbose = 0;
2180- if (id->field_valid & 4) {
2181- if (id->dma_ultra & 0x003F) {
2182- /* Force if Capable UltraDMA */
2183- on = config_chipset_for_dma(drive, 1);
2184- if ((id->field_valid & 2) &&
2185- (!on))
2186- goto try_dma_modes;
2187- }
2188- } else if (id->field_valid & 2) {
2189-try_dma_modes:
2190- if ((id->dma_mword & 0x0007) ||
2191- (id->dma_1word & 0x0007)) {
2192- /* Force if Capable regular DMA modes */
2193- on = config_chipset_for_dma(drive, 0);
2194- if (!on)
2195- goto no_dma_set;
2196- }
2197- } else if ((udma_white_list(drive)) &&
2198- (id->eide_dma_time > 150)) {
2199- /* Consult the list of known "good" drives */
2200- on = config_chipset_for_dma(drive, 0);
2201- if (!on)
2202- goto no_dma_set;
2203- } else {
2204- goto fast_ata_pio;
2205- }
2206- } else if ((id->capability & 8) || (id->field_valid & 2)) {
2207-fast_ata_pio:
2208- on = 0;
2209- verbose = 0;
2210-no_dma_set:
2211- sis5513_tune_drive(drive, 255);
2212- }
2213-
2214- udma_enable(drive, on, verbose);
2215-
2216- return 0;
2217-}
2218-#endif
2219-
2220 /* Chip detection and general config */
2221 static unsigned int __init pci_init_sis5513(struct pci_dev *dev)
2222 {
2223@@ -576,25 +489,19 @@
2224
2225 hwif->irq = hwif->unit ? 15 : 14;
2226
2227+ hwif->udma_four = ata66_sis5513(hwif);
2228+
2229 hwif->tuneproc = &sis5513_tune_drive;
2230 hwif->speedproc = &sis5513_tune_chipset;
2231
2232- if (!(hwif->dma_base))
2233- return;
2234-
2235- if (host_dev) {
2236-#ifdef CONFIG_BLK_DEV_IDEDMA
2237- if (chipset_family > ATA_16) {
2238- hwif->autodma = noautodma ? 0 : 1;
2239- hwif->highmem = 1;
2240- hwif->udma_setup = sis5513_udma_setup;
2241- } else {
2242-#endif
2243- hwif->autodma = 0;
2244 #ifdef CONFIG_BLK_DEV_IDEDMA
2245- }
2246-#endif
2247+ if (hwif->dma_base && host_dev && chipset_family > ATA_16) {
2248+ hwif->highmem = 1;
2249+ hwif->modes_map = sis5513_modes_map(hwif);
2250+ hwif->udma_setup = udma_generic_setup;
2251 }
2252+#endif
2253+
2254 return;
2255 }
2256
2257@@ -604,11 +511,9 @@
2258 vendor: PCI_VENDOR_ID_SI,
2259 device: PCI_DEVICE_ID_SI_5513,
2260 init_chipset: pci_init_sis5513,
2261- ata66_check: ata66_sis5513,
2262 init_channel: ide_init_sis5513,
2263 enablebits: {{0x4a,0x02,0x02}, {0x4a,0x04,0x04} },
2264 bootable: ON_BOARD,
2265- flags: ATA_F_NOADMA
2266 };
2267
2268 int __init init_sis5513(void)
2269diff -ur -Xdontdiff linux-2.5.24/drivers/ide/sl82c105.c linux/drivers/ide/sl82c105.c
2270--- linux-2.5.24/drivers/ide/sl82c105.c Tue Jun 25 22:46:02 2002
2271+++ linux/drivers/ide/sl82c105.c Tue Jul 2 23:54:07 2002
2272@@ -130,7 +130,7 @@
2273 * Check to see if the drive and
2274 * chipset is capable of DMA mode
2275 */
2276-static int sl82c105_dma_setup(struct ata_device *drive)
2277+static int sl82c105_dma_setup(struct ata_device *drive, int map)
2278 {
2279 int on = 0;
2280
2281@@ -333,7 +333,6 @@
2282 dma_state &= ~0x60;
2283 } else {
2284 dma_state |= 0x60;
2285- ch->autodma = 1;
2286 }
2287 outb(dma_state, dma_base + 2);
2288
2289diff -ur -Xdontdiff linux-2.5.24/drivers/ide/trm290.c linux/drivers/ide/trm290.c
2290--- linux-2.5.24/drivers/ide/trm290.c Tue Jun 25 22:46:02 2002
2291+++ linux/drivers/ide/trm290.c Tue Jul 2 23:54:07 2002
2292@@ -239,9 +239,9 @@
2293 return (inw(drive->channel->dma_base + 2) == 0x00ff);
2294 }
2295
2296-static int trm290_udma_setup(struct ata_device *drive)
2297+static int trm290_udma_setup(struct ata_device *drive, int map)
2298 {
2299- return udma_pci_setup(drive);
2300+ return udma_pci_setup(drive, map);
2301 }
2302 #endif
2303
2304@@ -303,7 +303,6 @@
2305 #endif
2306
2307 hwif->selectproc = &trm290_selectproc;
2308- hwif->autodma = 0; /* play it safe for now */
2309 #if 1
2310 {
2311 /*
2312diff -ur -Xdontdiff linux-2.5.24/drivers/ide/via82cxxx.c linux/drivers/ide/via82cxxx.c
2313--- linux-2.5.24/drivers/ide/via82cxxx.c Tue Jun 25 22:46:05 2002
2314+++ linux/drivers/ide/via82cxxx.c Tue Jul 2 23:54:16 2002
2315@@ -221,22 +221,16 @@
2316 }
2317
2318 #ifdef CONFIG_BLK_DEV_IDEDMA
2319-static int via82cxxx_udma_setup(struct ata_device *drive)
2320+static int __init via_modes_map(struct ata_channel *ch)
2321 {
2322- short w80 = drive->channel->udma_four;
2323+ short w80 = ch->udma_four;
2324+ int map = XFER_EPIO | XFER_SWDMA | XFER_MWDMA |
2325+ (via_config->flags & VIA_UDMA ? XFER_UDMA : 0) |
2326+ (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_66 ? XFER_UDMA_66 : 0) |
2327+ (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_100 ? XFER_UDMA_100 : 0) |
2328+ (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_133 ? XFER_UDMA_133 : 0);
2329
2330- short speed = ata_timing_mode(drive,
2331- XFER_PIO | XFER_EPIO | XFER_SWDMA | XFER_MWDMA |
2332- (via_config->flags & VIA_UDMA ? XFER_UDMA : 0) |
2333- (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_66 ? XFER_UDMA_66 : 0) |
2334- (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_100 ? XFER_UDMA_100 : 0) |
2335- (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_133 ? XFER_UDMA_133 : 0));
2336-
2337- via_set_drive(drive, speed);
2338-
2339- udma_enable(drive, drive->channel->autodma && (speed & XFER_MODE) != XFER_PIO, 0);
2340-
2341- return 0;
2342+ return map;
2343 }
2344 #endif
2345
2346@@ -352,9 +346,10 @@
2347 {
2348 int i;
2349
2350+ hwif->udma_four = via82cxxx_ata66_check(hwif);
2351+
2352 hwif->tuneproc = &via82cxxx_tune_drive;
2353 hwif->speedproc = &via_set_drive;
2354- hwif->autodma = 0;
2355 hwif->io_32bit = 1;
2356
2357 hwif->unmask = (via_config->flags & VIA_NO_UNMASK) ? 0 : 1;
2358@@ -366,11 +361,8 @@
2359 #ifdef CONFIG_BLK_DEV_IDEDMA
2360 if (hwif->dma_base) {
2361 hwif->highmem = 1;
2362- hwif->udma_setup = via82cxxx_udma_setup;
2363-# ifdef CONFIG_IDEDMA_AUTO
2364- if (!noautodma)
2365- hwif->autodma = 1;
2366-# endif
2367+ hwif->modes_map = via_modes_map(hwif);
2368+ hwif->udma_setup = udma_generic_setup;
2369 }
2370 #endif
2371 }
2372@@ -391,23 +383,19 @@
2373 vendor: PCI_VENDOR_ID_VIA,
2374 device: PCI_DEVICE_ID_VIA_82C576_1,
2375 init_chipset: via82cxxx_init_chipset,
2376- ata66_check: via82cxxx_ata66_check,
2377 init_channel: via82cxxx_init_channel,
2378 init_dma: via82cxxx_init_dma,
2379 enablebits: {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
2380 bootable: ON_BOARD,
2381- flags: ATA_F_NOADMA
2382 },
2383 {
2384 vendor: PCI_VENDOR_ID_VIA,
2385 device: PCI_DEVICE_ID_VIA_82C586_1,
2386 init_chipset: via82cxxx_init_chipset,
2387- ata66_check: via82cxxx_ata66_check,
2388 init_channel: via82cxxx_init_channel,
2389 init_dma: via82cxxx_init_dma,
2390 enablebits: {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
2391 bootable: ON_BOARD,
2392- flags: ATA_F_NOADMA
2393 },
2394 };
2395
2396diff -ur -Xdontdiff linux-2.5.24/include/linux/ide.h linux/include/linux/ide.h
2397--- linux-2.5.24/include/linux/ide.h Wed Jul 3 00:02:07 2002
2398+++ linux/include/linux/ide.h Tue Jul 2 23:52:58 2002
2399@@ -456,7 +456,7 @@
2400 void (*atapi_read)(struct ata_device *, void *, unsigned int);
2401 void (*atapi_write)(struct ata_device *, void *, unsigned int);
2402
2403- int (*udma_setup)(struct ata_device *);
2404+ int (*udma_setup)(struct ata_device *, int);
2405
2406 void (*udma_enable)(struct ata_device *, int, int);
2407 void (*udma_start) (struct ata_device *, struct request *);
2408@@ -496,7 +496,9 @@
2409 unsigned unmask : 1; /* flag: okay to unmask other irqs */
2410 unsigned slow : 1; /* flag: slow data port */
2411 unsigned io_32bit : 1; /* 0=16-bit, 1=32-bit */
2412+ unsigned no_atapi_autodma : 1; /* flag: use auto DMA only for disks */
2413 unsigned char bus_state; /* power state of the IDE bus */
2414+ int modes_map; /* map of supported transfer modes */
2415 };
2416
2417 /*
2418@@ -771,7 +773,9 @@
2419 extern int udma_pci_irq_status(struct ata_device *drive);
2420 extern void udma_pci_timeout(struct ata_device *drive);
2421 extern void udma_pci_irq_lost(struct ata_device *);
2422-extern int udma_pci_setup(struct ata_device *);
2423+extern int udma_pci_setup(struct ata_device *, int);
2424+
2425+extern int udma_generic_setup(struct ata_device *, int);
2426
2427 extern int udma_new_table(struct ata_device *, struct request *);
2428 extern void udma_destroy_table(struct ata_channel *);
This page took 0.449721 seconds and 4 git commands to generate.