1 diff -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
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)
11 - u32 bmide = pci_resource_start(drive->channel->pci_dev, 4);
13 + u32 bmide = pci_resource_start(ch->pci_dev, 4);
16 - map = XFER_PIO | XFER_EPIO | XFER_MWDMA | XFER_UDMA | XFER_SWDMA | XFER_UDMA;
17 + map = XFER_EPIO | XFER_SWDMA | XFER_MWDMA | XFER_UDMA;
19 - if (drive->channel->udma_four)
20 - switch (drive->channel->pci_dev->device) {
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,
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);
41 ch->tuneproc = aec62xx_tune_drive;
42 ch->speedproc = aec_set_drive;
48 + ch->udma_four = aec62xx_ata66_check(ch);
50 for (i = 0; i < 2; i++) {
51 ch->drives[i].autotune = 1;
52 ch->drives[i].dn = ch->unit * 2 + i;
54 #ifdef CONFIG_BLK_DEV_IDEDMA
57 - ch->udma_setup = aec62xx_udma_setup;
58 -#ifdef CONFIG_IDEDMA_AUTO
62 + ch->modes_map = aec62xx_modes_map(ch);
63 + ch->udma_setup = udma_generic_setup;
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
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} },
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,
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} },
102 diff -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
106 __restore_flags(flags);
109 -static byte ali15x3_can_ultra(struct ata_device *drive)
111 - if (m5229_revision <= 0x20) {
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))) {
118 - (drive->type != ATA_DISK)) {
126 -static int ali15x3_ratemask(struct ata_device *drive)
130 - if (!ali15x3_can_ultra(drive))
135 - if (!eighty_ninty_three(drive))
138 - if (m5229_revision >= 0xC4)
139 - map |= XFER_UDMA_100;
140 - if (m5229_revision >= 0xC2)
141 - map |= XFER_UDMA_66;
146 static int ali15x3_tune_chipset(struct ata_device *drive, byte speed)
148 struct pci_dev *dev = drive->channel->pci_dev;
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 @@
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)
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;
171 + return udma_generic_setup(drive, map);
175 - map = ali15x3_ratemask(drive);
177 - map = XFER_SWDMA | XFER_MWDMA;
179 - mode = ata_timing_mode(drive, map);
180 - if (mode < XFER_SW_DMA_0)
182 +static int ali15x3_udma_init(struct ata_device *drive, struct request *rq)
184 + if ((m5229_revision < 0xC2) && (drive->type != ATA_DISK))
185 + return ide_stopped; /* try PIO instead of DMA */
187 - return !ali15x3_tune_chipset(drive, mode);
188 + return udma_pci_init(drive, rq);
191 -static int ali15x3_udma_setup(struct ata_device *drive)
192 +static int __init ali15x3_modes_map(struct ata_channel *ch)
194 - struct hd_driveid *id = drive->id;
195 - struct ata_channel *hwif = drive->channel;
198 - byte can_ultra_dma = ali15x3_can_ultra(drive);
200 - if ((m5229_revision<=0x20) && (drive->type != ATA_DISK)) {
201 - udma_enable(drive, 0, 0);
205 - if ((id != NULL) && ((id->capability & 1) != 0) && hwif->autodma) {
206 - /* Consult the list of known "bad" drives */
207 - if (udma_black_list(drive)) {
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) &&
219 - goto try_dma_modes;
221 - } else if (id->field_valid & 2) {
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);
230 - } else if (udma_white_list(drive)) {
231 - if (id->eide_dma_time > 150) {
234 - /* Consult the list of known "good" drives */
235 - on = config_chipset_for_dma(drive, can_ultra_dma);
241 - } else if ((id->capability & 8) || (id->field_valid & 2)) {
246 - ali15x3_tune_drive(drive, 255);
248 + int map = XFER_EPIO | XFER_SWDMA | XFER_MWDMA;
250 - udma_enable(drive, on, verbose);
251 + if (m5229_revision <= 0x20)
258 -static int ali15x3_udma_init(struct ata_device *drive, struct request *rq)
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;
268 - return udma_pci_init(drive, rq);
275 #endif /* CONFIG_SPARC64 */
277 + hwif->udma_four = ali15x3_ata66_check(hwif);
279 hwif->tuneproc = &ali15x3_tune_drive;
280 hwif->drives[0].autotune = 1;
281 hwif->drives[1].autotune = 1;
282 @@ -436,15 +351,12 @@
284 * M1543C or newer for DMAing
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;
292 + hwif->udma_init = ali15x3_udma_init;
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} },
310 diff -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 @@
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)
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);
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));
333 - amd_set_drive(drive, speed);
335 - udma_enable(drive, drive->channel->autodma && (speed & XFER_MODE) != XFER_PIO, 0);
346 + hwif->udma_four = amd74xx_ata66_check(hwif);
348 hwif->tuneproc = &amd74xx_tune_drive;
349 hwif->speedproc = &amd_set_drive;
355 #ifdef CONFIG_BLK_DEV_IDEDMA
356 if (hwif->dma_base) {
358 - hwif->udma_setup = amd74xx_udma_setup;
359 -# ifdef CONFIG_IDEDMA_AUTO
363 + hwif->modes_map = amd_modes_map(hwif);
364 + hwif->udma_setup = udma_generic_setup;
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}},
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}},
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}},
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}},
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}},
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}},
416 diff -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
420 if ((map & XFER_UDMA_100) == XFER_UDMA_100)
421 if ((best = (id->dma_ultra & 0x0020) ? XFER_UDMA_5 : 0)) return best;
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;
429 + if ((map & XFER_UDMA_66_3) == XFER_UDMA_66_3)
430 + if ((best = (id->dma_ultra & 0x0008) ? XFER_UDMA_3 : 0)) return best;
432 if ((best = (id->dma_ultra & 0x0004) ? XFER_UDMA_2 :
433 (id->dma_ultra & 0x0002) ? XFER_UDMA_1 :
434 diff -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
438 #define ENOUGH(v,unit) (((v)-1)/(unit)+1)
439 #define EZ(v,unit) ((v)?ENOUGH(v,unit):0)
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
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
464 +#define XFER_UDMA_ALL 0xf40
465 +#define XFER_UDMA_80W 0xf00
467 /* External interface to host chips channel timing setup.
469 diff -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);
476 -static int cmd64x_ratemask(struct ata_device *drive)
477 +static int __init cmd6xx_modes_map(struct ata_channel *ch)
479 - struct pci_dev *dev = drive->channel->pci_dev;
481 + struct pci_dev *dev = ch->pci_dev;
482 + int map = XFER_EPIO | XFER_SWDMA | XFER_MWDMA;
484 switch(dev->device) {
485 case PCI_DEVICE_ID_CMD_680:
488 case PCI_DEVICE_ID_CMD_646:
491 - pci_read_config_dword(dev,
492 - PCI_CLASS_REVISION, &class_rev);
495 + pci_read_config_dword(dev, PCI_CLASS_REVISION, &rev);
498 * UltraDMA only supported on PCI646U and PCI646U2, which
499 * correspond to revisions 0x03, 0x05 and 0x07 respectively.
502 * So we only do UltraDMA on revision 0x05 and 0x07 chipsets.
504 - switch(class_rev) {
513 - if (!eighty_ninty_three(drive)) {
514 - if (map & XFER_UDMA)
524 #ifdef CONFIG_BLK_DEV_IDEDMA
525 -static int config_chipset_for_dma(struct ata_device *drive, u8 udma)
531 - map = cmd64x_ratemask(drive);
533 - map = XFER_SWDMA | XFER_MWDMA;
535 - mode = ata_timing_mode(drive, map);
537 - return !drive->channel->speedproc(drive, mode);
540 -static int cmd6xx_udma_setup(struct ata_device *drive)
542 - struct hd_driveid *id = drive->id;
543 - struct ata_channel *hwif = drive->channel;
547 - hwif->tuneproc(drive, 255);
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)) {
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) &&
564 - goto try_dma_modes;
566 - } else if (id->field_valid & 2) {
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);
575 - } else if (udma_white_list(drive)) {
576 - if (id->eide_dma_time > 150) {
579 - /* Consult the list of known "good" drives */
580 - on = config_chipset_for_dma(drive, 0);
586 - } else if ((id->capability & 8) || (id->field_valid & 2)) {
591 - hwif->tuneproc(drive, 255);
594 - udma_enable(drive, on, verbose);
599 static int cmd64x_udma_stop(struct ata_device *drive)
601 struct ata_channel *ch = drive->channel;
603 return (ata66 & mask) ? 1 : 0;
606 -static unsigned int __init cmd64x_ata66_check(struct ata_channel *hwif)
608 - if (hwif->pci_dev->device == PCI_DEVICE_ID_CMD_680)
609 - return cmd680_ata66(hwif);
610 - return cmd64x_ata66(hwif);
613 static void __init cmd64x_init_channel(struct ata_channel *hwif)
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;
624 hwif->resetproc = cmd680_reset;
625 hwif->speedproc = cmd680_tune_chipset;
626 hwif->tuneproc = cmd680_tuneproc;
627 + hwif->udma_four = cmd680_ata66(hwif);
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;
639 hwif->tuneproc = cmd64x_tuneproc;
640 hwif->speedproc = cmd64x_tune_chipset;
641 + hwif->udma_four = cmd64x_ata66(hwif);
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;
653 hwif->tuneproc = cmd64x_tuneproc;
654 hwif->speedproc = cmd64x_tune_chipset;
655 + hwif->udma_four = cmd64x_ata66(hwif);
660 #ifdef CONFIG_BLK_DEV_IDEDMA
661 if (hwif->dma_base) {
663 -# ifdef CONFIG_IDEDMA_AUTO
667 + hwif->modes_map = cmd6xx_modes_map(hwif);
668 + hwif->no_atapi_autodma = 1;
669 + hwif->udma_setup = udma_generic_setup;
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,
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,
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,
697 diff -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
704 -static int cs5530_udma_setup(struct ata_device *drive)
705 +static int cs5530_udma_setup(struct ata_device *drive, int map)
707 return cs5530_config_dma(drive);
709 @@ -285,17 +285,15 @@
711 static void __init ide_init_cs5530(struct ata_channel *hwif)
713 + u32 basereg, d0_timings;
715 hwif->serialized = 1;
716 - if (!hwif->dma_base) {
719 - unsigned int basereg, d0_timings;
721 #ifdef CONFIG_BLK_DEV_IDEDMA
722 - hwif->udma_setup = cs5530_udma_setup;
726 + if (hwif->dma_base) {
728 + hwif->udma_setup = cs5530_udma_setup;
732 hwif->tuneproc = &cs5530_tuneproc;
734 if (!hwif->drives[1].autotune)
735 hwif->drives[1].autotune = 1; /* needs autotuning later */
741 diff -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
746 * used to set DMA mode for CY82C693 (single and multi modes)
748 -static int cy82c693_udma_setup(struct ata_device *drive)
749 +static int cy82c693_udma_setup(struct ata_device *drive, int map)
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;
759 #ifdef CONFIG_BLK_DEV_IDEDMA
760 if (hwif->dma_base) {
762 hwif->udma_setup = cy82c693_udma_setup;
768 diff -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
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)
781 - if (drive->type != ATA_DISK)
787 - map = XFER_SWDMA | XFER_MWDMA;
789 - mode = ata_timing_mode(drive, map);
790 - if (mode < XFER_SW_DMA_0)
793 - return !hpt34x_tune_chipset(drive, mode);
796 -static int hpt34x_udma_setup(struct ata_device *drive)
798 - struct hd_driveid *id = drive->id;
802 - if (id && (id->capability & 1) && drive->channel->autodma) {
803 - /* Consult the list of known "bad" drives */
804 - if (udma_black_list(drive)) {
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) &&
816 - goto try_dma_modes;
818 - } else if (id->field_valid & 2) {
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);
827 - } else if (udma_white_list(drive)) {
828 - if (id->eide_dma_time > 150) {
831 - /* Consult the list of known "good" drives */
832 - on = config_chipset_for_dma(drive, 0);
838 - } else if ((id->capability & 8) || (id->field_valid & 2)) {
843 - hpt34x_tune_chipset(drive, ata_best_pio_mode(drive));
846 -#ifndef CONFIG_HPT34X_AUTODMA
850 - udma_enable(drive, on, verbose);
852 +#ifdef CONFIG_HPT34X_AUTODMA
853 + return udma_generic_setup(drive, map);
859 static int hpt34x_udma_stop(struct ata_device *drive)
860 @@ -252,24 +182,21 @@
861 unsigned short pcicmd = 0;
863 pci_read_config_word(hwif->pci_dev, PCI_COMMAND, &pcicmd);
865 - hwif->autodma = (pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0;
869 +#ifdef CONFIG_IDEDMA_AUTO
870 + hwif->autodma = (pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0;
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;
882 hwif->drives[0].autotune = 1;
883 hwif->drives[1].autotune = 1;
886 - hwif->drives[0].autotune = 1;
887 - hwif->drives[1].autotune = 1;
894 init_channel: ide_init_hpt34x,
895 bootable: NEVER_BOARD,
897 - flags: ATA_F_NOADMA | ATA_F_DMA
901 int __init init_hpt34x(void)
902 diff -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 @@
909 -static int hpt3xx_ratemask(struct ata_device *drive)
910 +static int __init hpt3xx_modes_map(struct ata_channel *ch)
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;
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))
938 - } else { /* HPT366 and HPT368 */
939 - map |= XFER_UDMA_66;
940 - if (check_in_drive_lists(drive, bad_ata33))
944 - if (!eighty_ninty_three(drive))
946 + } /* HPT366 / HPT368 */
950 @@ -662,62 +648,42 @@
951 return ide_config_drive_speed(drive, speed);
954 +/* FIXME: pio == 255 -> ata_best_pio_mode(drive) --bkz */
955 static void hpt3xx_tune_drive(struct ata_device *drive, u8 pio)
957 (void) hpt3xx_tune_chipset(drive, XFER_PIO_0 + min_t(u8, pio, 4));
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)
968 if (drive->type != ATA_DISK)
971 rev = hpt_revision(drive->channel->pci_dev);
973 - /* FIXME: check SWDMA modes --bkz */
974 - map = hpt3xx_ratemask(drive) | XFER_MWDMA;
975 - mode = ata_timing_mode(drive, map);
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
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;
987 - mode = ata_timing_mode(drive, map);
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;
995 - map &= ~XFER_UDMA_66;
997 - mode = ata_timing_mode(drive, map);
1001 - if (mode == XFER_UDMA_3 && rev < 3) {
1002 - if (check_in_drive_lists(drive, bad_ata66_3)) {
1003 - map &= ~XFER_UDMA_66;
1005 - mode = ata_timing_mode(drive, map);
1007 + /* FIXME: badlists need futher investigation --bkz */
1009 + /* bad_ata100_5 is for HPT370/370A,
1010 + bad_ata66_4, bad_ata66_3 and bad_ata33 are for HPT366/368 */
1012 + if (rev < 5 && check_in_drive_lists(drive, bad_ata100_5))
1013 + map &= ~XFER_UDMA_100;
1016 + if (check_in_drive_lists(drive, bad_ata66_4))
1017 + map &= ~XFER_UDMA_66_4;
1019 + if (check_in_drive_lists(drive, bad_ata66_3))
1020 + map &= ~XFER_UDMA_66_3;
1022 + if (check_in_drive_lists(drive, bad_ata33))
1023 + map &= ~XFER_UDMA_ALL;
1025 - if (check_in_drive_lists(drive, bad_ata33) && rev < 3)
1026 - mode = ata_timing_mode(drive, XFER_MWDMA);
1028 - return !hpt3xx_tune_chipset(drive, mode);
1029 + return udma_generic_setup(drive, map);
1032 static int hpt3xx_quirkproc(struct ata_device *drive)
1033 @@ -754,59 +720,6 @@
1037 -static int hpt3xx_udma_setup(struct ata_device *drive)
1039 - struct hd_driveid *id = drive->id;
1043 - if (id && (id->capability & 1) && drive->channel->autodma) {
1044 - /* Consult the list of known "bad" drives */
1045 - if (udma_black_list(drive)) {
1047 - goto fast_ata_pio;
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) &&
1057 - goto try_dma_modes;
1059 - } else if (id->field_valid & 2) {
1061 - if (id->dma_mword & 0x0007) {
1062 - /* Force if Capable regular DMA modes */
1063 - on = config_chipset_for_dma(drive);
1067 - } else if (udma_white_list(drive)) {
1068 - if (id->eide_dma_time > 150) {
1071 - /* Consult the list of known "good" drives */
1072 - on = config_chipset_for_dma(drive);
1076 - goto fast_ata_pio;
1078 - } else if ((id->capability & 8) || (id->field_valid & 2)) {
1083 - hpt3xx_tune_chipset(drive, ata_best_pio_mode(drive));
1085 - udma_enable(drive, on, verbose);
1090 static void hpt366_udma_irq_lost(struct ata_device *drive)
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);
1097 + ch->udma_four = hpt366_ata66_check(ch);
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;
1106 + ch->modes_map = hpt3xx_modes_map(ch);
1107 ch->udma_setup = hpt3xx_udma_setup;
1118 ch->drives[0].autotune = 1;
1119 ch->drives[1].autotune = 1;
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,
1145 diff -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
1152 -static int icside_dma_check(struct ata_device *drive)
1153 +static int icside_dma_check(struct ata_device *drive, int map)
1155 struct hd_driveid *id = drive->id;
1156 struct ata_channel *ch = drive->channel;
1157 diff -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)
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);
1169 - if (d->ata66_check)
1170 - ch->udma_four = d->ata66_check(ch);
1173 #ifdef CONFIG_BLK_DEV_IDEDMA
1175 * Setup DMA transfers on the channel.
1177 - if (d->flags & ATA_F_NOADMA)
1183 if (!((d->flags & ATA_F_DMA) || ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && (dev->class & 0x80))))
1187 d->init_dma(ch, dma_base);
1189 ata_init_dma(ch, dma_base);
1191 + if (ch->dma_base && autodma)
1196 @@ -335,6 +327,11 @@
1197 if (d->init_channel)
1198 d->init_channel(ch);
1200 +#ifdef CONFIG_BLK_DEV_IDEDMA
1201 + if ((d->flags & ATA_F_NOADMA) || noautodma)
1208 diff -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
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 @@
1224 -static int pmac_udma_setup(struct ata_device *drive)
1225 +static int pmac_udma_setup(struct ata_device *drive, int map)
1227 /* Change this to better match ide-dma.c */
1228 pmac_ide_check_dma(drive);
1229 diff -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 @@
1234 return ide_config_drive_speed(drive, speed);
1237 -static int it8172_udma_setup(struct ata_device *drive)
1239 - u8 speed = ata_timing_mode(drive, XFER_PIO | XFER_EPIO |
1240 - XFER_SWDMA | XFER_MWDMA | XFER_UDMA);
1242 - return !it8172_tune_chipset(drive, speed);
1244 #endif /* defined(CONFIG_BLK_DEV_IDEDMA) && (CONFIG_IT8172_TUNING) */
1247 @@ -216,15 +208,11 @@
1248 if (!hwif->dma_base)
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;
1263 cmdBase = dev->resource[0].start;
1264 ctrlBase = dev->resource[1].start;
1265 diff -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) {
1277 * Force DMAing for the beginning of the check. Some
1278 @@ -1085,7 +1086,7 @@
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);
1287 diff -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 @@
1294 -static int ns87415_udma_setup(struct ata_device *drive)
1295 +static int ns87415_udma_setup(struct ata_device *drive, int map)
1297 if (drive->type != ATA_DISK) {
1298 udma_enable(drive, 0, 0);
1302 - return udma_pci_setup(drive);
1303 + return udma_pci_setup(drive, map);
1307 diff -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
1311 #include <linux/ide.h>
1312 #include <linux/delay.h>
1314 +#include "ata-timing.h"
1317 #include <asm/irq.h>
1319 @@ -164,10 +166,73 @@
1323 +/* generic udma_setup() function for drivers having ->speedproc/tuneproc */
1324 +int udma_generic_setup(struct ata_device *drive, int map)
1326 + struct hd_driveid *id = drive->id;
1327 + struct ata_channel *ch = drive->channel;
1331 + if (!id || (drive->type != ATA_DISK && ch->no_atapi_autodma))
1334 + if ((map & XFER_UDMA_80W) && !eighty_ninty_three(drive))
1335 + map &= ~XFER_UDMA_80W;
1337 + if ((id->capability & 1) && ch->autodma && ch->speedproc) {
1339 + /* Consult the list of known "bad" devices. */
1340 + if (udma_black_list(drive))
1343 + mode = ata_timing_mode(drive, map);
1345 + /* Device is UltraDMA capable. */
1346 + if (mode & XFER_UDMA) {
1347 + if((on = !ch->speedproc(drive, mode)))
1350 + printk(KERN_WARNING "%s: UDMA auto-tune failed.\n", drive->name);
1352 + map &= ~XFER_UDMA_ALL;
1353 + mode = ata_timing_mode(drive, map);
1356 + /* Device is regular DMA capable. */
1357 + if (mode & (XFER_SWDMA | XFER_MWDMA)) {
1358 + if((on = !ch->speedproc(drive, mode)))
1361 + printk(KERN_WARNING "%s: DMA auto-tune failed.\n", drive->name);
1364 + /* FIXME: this seems non-functional --bkz */
1365 + /* Consult the list of known "good" devices. */
1366 + if (udma_white_list(drive)) {
1368 + if (id->eide_dma_time > 150)
1371 + printk(KERN_INFO "%s: device is on DMA whitelist.\n", drive->name);
1375 + /* Revert to PIO. */
1376 + if (!on && ch->tuneproc)
1377 + ch->tuneproc(drive, 255);
1381 + udma_enable(drive, on, !on);
1387 * Configure a device for DMA operation.
1389 -int udma_pci_setup(struct ata_device *drive)
1390 +int udma_pci_setup(struct ata_device *drive, int map)
1392 int config_allows_dma = 1;
1393 struct hd_driveid *id = drive->id;
1394 diff -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
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];
1405 diff -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 @@
1412 -static int pdc202xx_ratemask(struct ata_device *drive)
1413 +static int __init pdc202xx_modes_map(struct ata_channel *ch)
1415 - struct pci_dev *dev = drive->channel->pci_dev;
1418 - if (!eighty_ninty_three(drive))
1420 + int map = XFER_EPIO | XFER_SWDMA | XFER_MWDMA | XFER_UDMA;
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:
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;
1448 @@ -372,48 +373,34 @@
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)
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;
1462 + if (drive->type != ATA_DISK)
1465 + /* IORDY_EN & PREFETCH_EN */
1466 + if (id->capability & 4)
1467 + set_2regs(0x13, (IN_BYTE(datareg)|0x03));
1469 + return udma_generic_setup(drive, map);
1472 +static int pdc202xx_udma_setup(struct ata_device *drive, int map)
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;
1487 u8 drive_pci = 0, AP, tmp, mode = -1;
1488 u8 CLKSPD, mask = hwif->unit ? 0x08 : 0x02;
1491 - /* UDMA 3, 4, 5 and 6 */
1492 - u8 needs_80w = (id->dma_ultra & 0x0078);
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:
1501 - default: /* chipsets newer then 20267 */
1506 - /* FIXME: this check is wrong for 20246 --bkz */
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);
1514 - goto chipset_is_set;
1517 * Set the control register to use the 66Mhz system
1519 * FIXME: move this to pdc202xx_tuneproc()
1520 * right now you can't downgrade from U66 to U33 --bkz
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);
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)
1547 - if (id->capability & 4) { /* IORDY_EN & PREFETCH_EN */
1548 - set_2regs(0x13, (IN_BYTE(datareg)|0x03));
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);
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);
1566 - map = pdc202xx_ratemask(drive);
1569 - map = XFER_SWDMA | XFER_MWDMA;
1573 + map = hwif->modes_map;
1575 + if (!eighty_ninty_three(drive))
1576 + map &= ~XFER_UDMA_80W;
1578 mode = ata_timing_mode(drive, map);
1579 if (mode < XFER_SW_DMA_0) {
1580 /* restore original pci-config space */
1582 - pci_write_config_dword(dev, drive_pci, drive_conf);
1583 + pci_write_config_dword(dev, drive_pci, drive_conf);
1587 - return !hwif->speedproc(drive, mode);
1590 -static int pdc202xx_udma_setup(struct ata_device *drive)
1592 - struct hd_driveid *id = drive->id;
1593 - struct ata_channel *hwif = drive->channel;
1597 - if (id && (id->capability & 1) && hwif->autodma) {
1598 - /* Consult the list of known "bad" drives */
1600 - if (udma_black_list(drive))
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) &&
1608 - goto try_dma_modes;
1610 - } else if (id->field_valid & 2) {
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);
1619 - } else if (udma_white_list(drive)) {
1620 - if (id->eide_dma_time > 150) {
1623 - /* Consult the list of known "good" drives */
1624 - on = config_chipset_for_dma(drive, 0);
1627 - } else goto no_dma_set;
1628 - } else if ((id->capability & 8) || (id->field_valid & 2)) {
1630 - pdc202xx_tune_drive(drive, 255);
1633 - udma_enable(drive, on, verbose);
1636 + return udma_generic_setup(drive, map);
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);
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;
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);
1658 hwif->resetproc = &pdc202xx_reset;
1659 #ifdef CONFIG_BLK_DEV_IDEDMA
1660 /* we need special functions for lba48 */
1661 @@ -741,6 +676,10 @@
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;
1669 hwif->speedproc = &pdc202xx_tune_chipset;
1672 @@ -748,18 +687,15 @@
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;
1682 - hwif->autodma = 1;
1686 hwif->drives[0].autotune = 1;
1687 hwif->drives[1].autotune = 1;
1688 - hwif->autodma = 0;
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}},
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}},
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}},
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}},
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
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
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
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
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
1764 diff -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 @@
1770 #ifdef CONFIG_BLK_DEV_IDEDMA
1772 -static int piix_udma_setup(struct ata_device *drive)
1773 +static int __init piix_modes_map(struct ata_channel *ch)
1775 - short w80 = drive->channel->udma_four;
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))));
1785 - piix_set_drive(drive, speed);
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)));
1803 @@ -360,9 +352,10 @@
1807 + ch->udma_four = piix_ata66_check(ch);
1809 ch->tuneproc = &piix_tune_drive;
1810 ch->speedproc = &piix_set_drive;
1814 for (i = 0; i < 2; i++) {
1815 @@ -373,11 +366,8 @@
1816 #ifdef CONFIG_BLK_DEV_IDEDMA
1819 - ch->udma_setup = piix_udma_setup;
1820 -# ifdef CONFIG_IDEDMA_AUTO
1824 + ch->modes_map = piix_modes_map(ch);
1825 + ch->udma_setup = udma_generic_setup;
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}},
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}},
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}},
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}},
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}},
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}},
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}},
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}},
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}},
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}},
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}},
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}},
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}},
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}},
1941 diff -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 @@
1946 static struct pci_dev *isa_dev;
1948 -static int svwks_ratemask(struct ata_device *drive)
1949 +static int __init svwks_modes_map(struct ata_channel *ch)
1951 - struct pci_dev *dev = drive->channel->pci_dev;
1953 + int map = XFER_EPIO | XFER_MWDMA;
1955 - if (!eighty_ninty_three(drive))
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;
1972 csb5_pio |= ((speed - XFER_PIO_0) << (4*drive->dn));
1975 + /* FIXME: check SWDMA modes --bkz */
1976 #ifdef CONFIG_BLK_DEV_IDEDMA
1979 @@ -224,79 +222,13 @@
1980 return ide_config_drive_speed(drive, speed);
1983 +/* FIXME: pio == 255 -> ata_best_pio_mode(drive) --bkz */
1984 static void svwks_tune_drive(struct ata_device *drive, u8 pio)
1986 (void) svwks_tune_chipset(drive, XFER_PIO_0 + min_t(u8, pio, 4));
1989 #ifdef CONFIG_BLK_DEV_IDEDMA
1990 -static int config_chipset_for_dma(struct ata_device *drive)
1995 - /* FIXME: check SWDMA modes --bkz */
1996 - map = XFER_MWDMA | svwks_ratemask(drive);
1997 - mode = ata_timing_mode(drive, map);
1999 - return !svwks_tune_chipset(drive, mode);
2002 -static int svwks_udma_setup(struct ata_device *drive)
2004 - struct hd_driveid *id = drive->id;
2008 - if (id && (id->capability & 1) && drive->channel->autodma) {
2009 - /* Consult the list of known "bad" drives */
2010 - if (udma_black_list(drive)) {
2012 - goto fast_ata_pio;
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) &&
2022 - goto try_dma_modes;
2024 - } else if (id->field_valid & 2) {
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);
2033 - } else if (udma_white_list(drive)) {
2034 - if (id->eide_dma_time > 150) {
2037 - /* Consult the list of known "good" drives */
2038 - on = config_chipset_for_dma(drive);
2042 - goto fast_ata_pio;
2044 - } else if ((id->capability & 8) || (id->field_valid & 2)) {
2049 - svwks_tune_chipset(drive, ata_best_pio_mode(drive));
2052 - udma_enable(drive, on, verbose);
2057 static int svwks_udma_stop(struct ata_device *drive)
2059 struct ata_channel *ch = drive->channel;
2060 @@ -437,24 +369,21 @@
2062 hwif->irq = hwif->unit ? 15 : 14;
2064 + hwif->udma_four = svwks_ata66_check(hwif);
2066 hwif->tuneproc = &svwks_tune_drive;
2067 hwif->speedproc = &svwks_tune_chipset;
2069 #ifndef CONFIG_BLK_DEV_IDEDMA
2070 hwif->drives[0].autotune = 1;
2071 hwif->drives[1].autotune = 1;
2072 - hwif->autodma = 0;
2074 if (hwif->dma_base) {
2075 -#ifdef CONFIG_IDEDMA_AUTO
2077 - hwif->autodma = 1;
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;
2085 - hwif->autodma = 0;
2086 hwif->drives[0].autotune = 1;
2087 hwif->drives[1].autotune = 1;
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,
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,
2104 flags: ATA_F_SIMPLEX
2105 diff -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
2110 static struct pci_dev *host_dev = NULL;
2112 -static int sis5513_ratemask(struct ata_device *drive)
2113 +static int __init sis5513_modes_map(struct ata_channel *ch)
2116 + int map = XFER_EPIO | XFER_SWDMA | XFER_MWDMA;
2118 switch(chipset_family) {
2119 case ATA_133: /* map |= XFER_UDMA_133; */
2120 @@ -221,15 +221,8 @@
2130 - if (!eighty_ninty_three(drive))
2136 @@ -404,86 +397,6 @@
2137 (void)config_art_rwp_pio(drive, min_t(u8, pio, 4));
2140 -#ifdef CONFIG_BLK_DEV_IDEDMA
2141 -static int config_chipset_for_dma(struct ata_device *drive, u8 udma)
2147 - printk("SIS5513: config_chipset_for_dma, drive %d, udma %d\n",
2152 - map = sis5513_ratemask(drive);
2154 - map = XFER_SWDMA | XFER_MWDMA;
2156 - mode = ata_timing_mode(drive, map);
2157 - if (mode < XFER_SW_DMA_0)
2160 - return !sis5513_tune_chipset(drive, mode);
2163 -static int sis5513_udma_setup(struct ata_device *drive)
2165 - struct hd_driveid *id = drive->id;
2169 - config_drive_art_rwp(drive);
2170 - sis5513_tune_drive(drive, 255);
2172 - if (id && (id->capability & 1) && drive->channel->autodma) {
2173 - /* Consult the list of known "bad" drives */
2174 - if (udma_black_list(drive)) {
2176 - goto fast_ata_pio;
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) &&
2186 - goto try_dma_modes;
2188 - } else if (id->field_valid & 2) {
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);
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);
2204 - goto fast_ata_pio;
2206 - } else if ((id->capability & 8) || (id->field_valid & 2)) {
2211 - sis5513_tune_drive(drive, 255);
2214 - udma_enable(drive, on, verbose);
2220 /* Chip detection and general config */
2221 static unsigned int __init pci_init_sis5513(struct pci_dev *dev)
2223 @@ -576,25 +489,19 @@
2225 hwif->irq = hwif->unit ? 15 : 14;
2227 + hwif->udma_four = ata66_sis5513(hwif);
2229 hwif->tuneproc = &sis5513_tune_drive;
2230 hwif->speedproc = &sis5513_tune_chipset;
2232 - if (!(hwif->dma_base))
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;
2243 - hwif->autodma = 0;
2244 #ifdef CONFIG_BLK_DEV_IDEDMA
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;
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} },
2265 - flags: ATA_F_NOADMA
2268 int __init init_sis5513(void)
2269 diff -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
2273 * Check to see if the drive and
2274 * chipset is capable of DMA mode
2276 -static int sl82c105_dma_setup(struct ata_device *drive)
2277 +static int sl82c105_dma_setup(struct ata_device *drive, int map)
2287 outb(dma_state, dma_base + 2);
2289 diff -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
2293 return (inw(drive->channel->dma_base + 2) == 0x00ff);
2296 -static int trm290_udma_setup(struct ata_device *drive)
2297 +static int trm290_udma_setup(struct ata_device *drive, int map)
2299 - return udma_pci_setup(drive);
2300 + return udma_pci_setup(drive, map);
2307 hwif->selectproc = &trm290_selectproc;
2308 - hwif->autodma = 0; /* play it safe for now */
2312 diff -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 @@
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)
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);
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));
2337 - via_set_drive(drive, speed);
2339 - udma_enable(drive, drive->channel->autodma && (speed & XFER_MODE) != XFER_PIO, 0);
2346 @@ -352,9 +346,10 @@
2350 + hwif->udma_four = via82cxxx_ata66_check(hwif);
2352 hwif->tuneproc = &via82cxxx_tune_drive;
2353 hwif->speedproc = &via_set_drive;
2354 - hwif->autodma = 0;
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) {
2362 - hwif->udma_setup = via82cxxx_udma_setup;
2363 -# ifdef CONFIG_IDEDMA_AUTO
2365 - hwif->autodma = 1;
2367 + hwif->modes_map = via_modes_map(hwif);
2368 + hwif->udma_setup = udma_generic_setup;
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}},
2381 - flags: ATA_F_NOADMA
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}},
2392 - flags: ATA_F_NOADMA
2396 diff -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
2400 void (*atapi_read)(struct ata_device *, void *, unsigned int);
2401 void (*atapi_write)(struct ata_device *, void *, unsigned int);
2403 - int (*udma_setup)(struct ata_device *);
2404 + int (*udma_setup)(struct ata_device *, int);
2406 void (*udma_enable)(struct ata_device *, int, int);
2407 void (*udma_start) (struct ata_device *, struct request *);
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 */
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);
2425 +extern int udma_generic_setup(struct ata_device *, int);
2427 extern int udma_new_table(struct ata_device *, struct request *);
2428 extern void udma_destroy_table(struct ata_channel *);