aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-dma.c')
-rw-r--r--drivers/ide/ide-dma.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 3fa07c0aeaa4..abab26de7687 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -288,7 +288,7 @@ EXPORT_SYMBOL_GPL(ide_destroy_dmatable);
288static int config_drive_for_dma (ide_drive_t *drive) 288static int config_drive_for_dma (ide_drive_t *drive)
289{ 289{
290 ide_hwif_t *hwif = drive->hwif; 290 ide_hwif_t *hwif = drive->hwif;
291 struct hd_driveid *id = drive->id; 291 u16 *id = drive->id;
292 292
293 if (drive->media != ide_disk) { 293 if (drive->media != ide_disk) {
294 if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA) 294 if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA)
@@ -299,16 +299,17 @@ static int config_drive_for_dma (ide_drive_t *drive)
299 * Enable DMA on any drive that has 299 * Enable DMA on any drive that has
300 * UltraDMA (mode 0/1/2/3/4/5/6) enabled 300 * UltraDMA (mode 0/1/2/3/4/5/6) enabled
301 */ 301 */
302 if ((id->field_valid & 4) && ((id->dma_ultra >> 8) & 0x7f)) 302 if ((id[ATA_ID_FIELD_VALID] & 4) &&
303 ((id[ATA_ID_UDMA_MODES] >> 8) & 0x7f))
303 return 1; 304 return 1;
304 305
305 /* 306 /*
306 * Enable DMA on any drive that has mode2 DMA 307 * Enable DMA on any drive that has mode2 DMA
307 * (multi or single) enabled 308 * (multi or single) enabled
308 */ 309 */
309 if (id->field_valid & 2) /* regular DMA */ 310 if (id[ATA_ID_FIELD_VALID] & 2) /* regular DMA */
310 if ((id->dma_mword & 0x404) == 0x404 || 311 if ((id[ATA_ID_MWDMA_MODES] & 0x404) == 0x404 ||
311 (id->dma_1word & 0x404) == 0x404) 312 (id[ATA_ID_SWDMA_MODES] & 0x404) == 0x404)
312 return 1; 313 return 1;
313 314
314 /* Consult the list of known "good" drives */ 315 /* Consult the list of known "good" drives */
@@ -591,12 +592,12 @@ static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }
591 592
592int __ide_dma_bad_drive (ide_drive_t *drive) 593int __ide_dma_bad_drive (ide_drive_t *drive)
593{ 594{
594 struct hd_driveid *id = drive->id; 595 u16 *id = drive->id;
595 596
596 int blacklist = ide_in_drive_list(id, drive_blacklist); 597 int blacklist = ide_in_drive_list(id, drive_blacklist);
597 if (blacklist) { 598 if (blacklist) {
598 printk(KERN_WARNING "%s: Disabling (U)DMA for %s (blacklisted)\n", 599 printk(KERN_WARNING "%s: Disabling (U)DMA for %s (blacklisted)\n",
599 drive->name, id->model); 600 drive->name, (char *)&id[ATA_ID_PROD]);
600 return blacklist; 601 return blacklist;
601 } 602 }
602 return 0; 603 return 0;
@@ -612,21 +613,21 @@ static const u8 xfer_mode_bases[] = {
612 613
613static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode) 614static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode)
614{ 615{
615 struct hd_driveid *id = drive->id; 616 u16 *id = drive->id;
616 ide_hwif_t *hwif = drive->hwif; 617 ide_hwif_t *hwif = drive->hwif;
617 const struct ide_port_ops *port_ops = hwif->port_ops; 618 const struct ide_port_ops *port_ops = hwif->port_ops;
618 unsigned int mask = 0; 619 unsigned int mask = 0;
619 620
620 switch(base) { 621 switch(base) {
621 case XFER_UDMA_0: 622 case XFER_UDMA_0:
622 if ((id->field_valid & 4) == 0) 623 if ((id[ATA_ID_FIELD_VALID] & 4) == 0)
623 break; 624 break;
624 625
625 if (port_ops && port_ops->udma_filter) 626 if (port_ops && port_ops->udma_filter)
626 mask = port_ops->udma_filter(drive); 627 mask = port_ops->udma_filter(drive);
627 else 628 else
628 mask = hwif->ultra_mask; 629 mask = hwif->ultra_mask;
629 mask &= id->dma_ultra; 630 mask &= id[ATA_ID_UDMA_MODES];
630 631
631 /* 632 /*
632 * avoid false cable warning from eighty_ninty_three() 633 * avoid false cable warning from eighty_ninty_three()
@@ -637,19 +638,19 @@ static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base, u8 req_mode)
637 } 638 }
638 break; 639 break;
639 case XFER_MW_DMA_0: 640 case XFER_MW_DMA_0:
640 if ((id->field_valid & 2) == 0) 641 if ((id[ATA_ID_FIELD_VALID] & 2) == 0)
641 break; 642 break;
642 if (port_ops && port_ops->mdma_filter) 643 if (port_ops && port_ops->mdma_filter)
643 mask = port_ops->mdma_filter(drive); 644 mask = port_ops->mdma_filter(drive);
644 else 645 else
645 mask = hwif->mwdma_mask; 646 mask = hwif->mwdma_mask;
646 mask &= id->dma_mword; 647 mask &= id[ATA_ID_MWDMA_MODES];
647 break; 648 break;
648 case XFER_SW_DMA_0: 649 case XFER_SW_DMA_0:
649 if (id->field_valid & 2) { 650 if (id[ATA_ID_FIELD_VALID] & 2) {
650 mask = id->dma_1word & hwif->swdma_mask; 651 mask = id[ATA_ID_SWDMA_MODES] & hwif->swdma_mask;
651 } else if (id->tDMA) { 652 } else if (drive->driveid->tDMA) {
652 u8 mode = id->tDMA; 653 u8 mode = drive->driveid->tDMA;
653 654
654 /* 655 /*
655 * if the mode is valid convert it to the mask 656 * if the mode is valid convert it to the mask
@@ -706,7 +707,8 @@ u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode)
706 /* 707 /*
707 * is this correct? 708 * is this correct?
708 */ 709 */
709 if (ide_dma_good_drive(drive) && drive->id->eide_dma_time < 150) 710 if (ide_dma_good_drive(drive) &&
711 drive->id[ATA_ID_EIDE_DMA_TIME] < 150)
710 mode = XFER_MW_DMA_1; 712 mode = XFER_MW_DMA_1;
711 } 713 }
712 714
@@ -725,7 +727,7 @@ static int ide_tune_dma(ide_drive_t *drive)
725 ide_hwif_t *hwif = drive->hwif; 727 ide_hwif_t *hwif = drive->hwif;
726 u8 speed; 728 u8 speed;
727 729
728 if (drive->nodma || (drive->id->capability & 1) == 0) 730 if (drive->nodma || (drive->driveid->capability & 1) == 0)
729 return 0; 731 return 0;
730 732
731 /* consult the list of known "bad" drives */ 733 /* consult the list of known "bad" drives */
@@ -767,13 +769,15 @@ static int ide_dma_check(ide_drive_t *drive)
767 769
768int ide_id_dma_bug(ide_drive_t *drive) 770int ide_id_dma_bug(ide_drive_t *drive)
769{ 771{
770 struct hd_driveid *id = drive->id; 772 u16 *id = drive->id;
771 773
772 if (id->field_valid & 4) { 774 if (id[ATA_ID_FIELD_VALID] & 4) {
773 if ((id->dma_ultra >> 8) && (id->dma_mword >> 8)) 775 if ((id[ATA_ID_UDMA_MODES] >> 8) &&
776 (id[ATA_ID_MWDMA_MODES] >> 8))
774 goto err_out; 777 goto err_out;
775 } else if (id->field_valid & 2) { 778 } else if (id[ATA_ID_FIELD_VALID] & 2) {
776 if ((id->dma_mword >> 8) && (id->dma_1word >> 8)) 779 if ((id[ATA_ID_MWDMA_MODES] >> 8) &&
780 (id[ATA_ID_SWDMA_MODES] >> 8))
777 goto err_out; 781 goto err_out;
778 } 782 }
779 return 0; 783 return 0;