diff options
Diffstat (limited to 'drivers/ide/ide-iops.c')
-rw-r--r-- | drivers/ide/ide-iops.c | 225 |
1 files changed, 67 insertions, 158 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 2cbadffe922e..0a2fd3b37ac4 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/pci.h> | 19 | #include <linux/pci.h> |
20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
21 | #include <linux/hdreg.h> | ||
22 | #include <linux/ide.h> | 21 | #include <linux/ide.h> |
23 | #include <linux/bitops.h> | 22 | #include <linux/bitops.h> |
24 | #include <linux/nmi.h> | 23 | #include <linux/nmi.h> |
@@ -400,97 +399,14 @@ const struct ide_tp_ops default_tp_ops = { | |||
400 | .output_data = ide_output_data, | 399 | .output_data = ide_output_data, |
401 | }; | 400 | }; |
402 | 401 | ||
403 | void ide_fix_driveid (struct hd_driveid *id) | 402 | void ide_fix_driveid(u16 *id) |
404 | { | 403 | { |
405 | #ifndef __LITTLE_ENDIAN | 404 | #ifndef __LITTLE_ENDIAN |
406 | # ifdef __BIG_ENDIAN | 405 | # ifdef __BIG_ENDIAN |
407 | int i; | 406 | int i; |
408 | u16 *stringcast; | 407 | |
409 | 408 | for (i = 0; i < 256; i++) | |
410 | id->config = __le16_to_cpu(id->config); | 409 | id[i] = __le16_to_cpu(id[i]); |
411 | id->cyls = __le16_to_cpu(id->cyls); | ||
412 | id->reserved2 = __le16_to_cpu(id->reserved2); | ||
413 | id->heads = __le16_to_cpu(id->heads); | ||
414 | id->track_bytes = __le16_to_cpu(id->track_bytes); | ||
415 | id->sector_bytes = __le16_to_cpu(id->sector_bytes); | ||
416 | id->sectors = __le16_to_cpu(id->sectors); | ||
417 | id->vendor0 = __le16_to_cpu(id->vendor0); | ||
418 | id->vendor1 = __le16_to_cpu(id->vendor1); | ||
419 | id->vendor2 = __le16_to_cpu(id->vendor2); | ||
420 | stringcast = (u16 *)&id->serial_no[0]; | ||
421 | for (i = 0; i < (20/2); i++) | ||
422 | stringcast[i] = __le16_to_cpu(stringcast[i]); | ||
423 | id->buf_type = __le16_to_cpu(id->buf_type); | ||
424 | id->buf_size = __le16_to_cpu(id->buf_size); | ||
425 | id->ecc_bytes = __le16_to_cpu(id->ecc_bytes); | ||
426 | stringcast = (u16 *)&id->fw_rev[0]; | ||
427 | for (i = 0; i < (8/2); i++) | ||
428 | stringcast[i] = __le16_to_cpu(stringcast[i]); | ||
429 | stringcast = (u16 *)&id->model[0]; | ||
430 | for (i = 0; i < (40/2); i++) | ||
431 | stringcast[i] = __le16_to_cpu(stringcast[i]); | ||
432 | id->dword_io = __le16_to_cpu(id->dword_io); | ||
433 | id->reserved50 = __le16_to_cpu(id->reserved50); | ||
434 | id->field_valid = __le16_to_cpu(id->field_valid); | ||
435 | id->cur_cyls = __le16_to_cpu(id->cur_cyls); | ||
436 | id->cur_heads = __le16_to_cpu(id->cur_heads); | ||
437 | id->cur_sectors = __le16_to_cpu(id->cur_sectors); | ||
438 | id->cur_capacity0 = __le16_to_cpu(id->cur_capacity0); | ||
439 | id->cur_capacity1 = __le16_to_cpu(id->cur_capacity1); | ||
440 | id->lba_capacity = __le32_to_cpu(id->lba_capacity); | ||
441 | id->dma_1word = __le16_to_cpu(id->dma_1word); | ||
442 | id->dma_mword = __le16_to_cpu(id->dma_mword); | ||
443 | id->eide_pio_modes = __le16_to_cpu(id->eide_pio_modes); | ||
444 | id->eide_dma_min = __le16_to_cpu(id->eide_dma_min); | ||
445 | id->eide_dma_time = __le16_to_cpu(id->eide_dma_time); | ||
446 | id->eide_pio = __le16_to_cpu(id->eide_pio); | ||
447 | id->eide_pio_iordy = __le16_to_cpu(id->eide_pio_iordy); | ||
448 | for (i = 0; i < 2; ++i) | ||
449 | id->words69_70[i] = __le16_to_cpu(id->words69_70[i]); | ||
450 | for (i = 0; i < 4; ++i) | ||
451 | id->words71_74[i] = __le16_to_cpu(id->words71_74[i]); | ||
452 | id->queue_depth = __le16_to_cpu(id->queue_depth); | ||
453 | for (i = 0; i < 4; ++i) | ||
454 | id->words76_79[i] = __le16_to_cpu(id->words76_79[i]); | ||
455 | id->major_rev_num = __le16_to_cpu(id->major_rev_num); | ||
456 | id->minor_rev_num = __le16_to_cpu(id->minor_rev_num); | ||
457 | id->command_set_1 = __le16_to_cpu(id->command_set_1); | ||
458 | id->command_set_2 = __le16_to_cpu(id->command_set_2); | ||
459 | id->cfsse = __le16_to_cpu(id->cfsse); | ||
460 | id->cfs_enable_1 = __le16_to_cpu(id->cfs_enable_1); | ||
461 | id->cfs_enable_2 = __le16_to_cpu(id->cfs_enable_2); | ||
462 | id->csf_default = __le16_to_cpu(id->csf_default); | ||
463 | id->dma_ultra = __le16_to_cpu(id->dma_ultra); | ||
464 | id->trseuc = __le16_to_cpu(id->trseuc); | ||
465 | id->trsEuc = __le16_to_cpu(id->trsEuc); | ||
466 | id->CurAPMvalues = __le16_to_cpu(id->CurAPMvalues); | ||
467 | id->mprc = __le16_to_cpu(id->mprc); | ||
468 | id->hw_config = __le16_to_cpu(id->hw_config); | ||
469 | id->acoustic = __le16_to_cpu(id->acoustic); | ||
470 | id->msrqs = __le16_to_cpu(id->msrqs); | ||
471 | id->sxfert = __le16_to_cpu(id->sxfert); | ||
472 | id->sal = __le16_to_cpu(id->sal); | ||
473 | id->spg = __le32_to_cpu(id->spg); | ||
474 | id->lba_capacity_2 = __le64_to_cpu(id->lba_capacity_2); | ||
475 | for (i = 0; i < 22; i++) | ||
476 | id->words104_125[i] = __le16_to_cpu(id->words104_125[i]); | ||
477 | id->last_lun = __le16_to_cpu(id->last_lun); | ||
478 | id->word127 = __le16_to_cpu(id->word127); | ||
479 | id->dlf = __le16_to_cpu(id->dlf); | ||
480 | id->csfo = __le16_to_cpu(id->csfo); | ||
481 | for (i = 0; i < 26; i++) | ||
482 | id->words130_155[i] = __le16_to_cpu(id->words130_155[i]); | ||
483 | id->word156 = __le16_to_cpu(id->word156); | ||
484 | for (i = 0; i < 3; i++) | ||
485 | id->words157_159[i] = __le16_to_cpu(id->words157_159[i]); | ||
486 | id->cfa_power = __le16_to_cpu(id->cfa_power); | ||
487 | for (i = 0; i < 15; i++) | ||
488 | id->words161_175[i] = __le16_to_cpu(id->words161_175[i]); | ||
489 | for (i = 0; i < 30; i++) | ||
490 | id->words176_205[i] = __le16_to_cpu(id->words176_205[i]); | ||
491 | for (i = 0; i < 49; i++) | ||
492 | id->words206_254[i] = __le16_to_cpu(id->words206_254[i]); | ||
493 | id->integrity_word = __le16_to_cpu(id->integrity_word); | ||
494 | # else | 410 | # else |
495 | # error "Please fix <asm/byteorder.h>" | 411 | # error "Please fix <asm/byteorder.h>" |
496 | # endif | 412 | # endif |
@@ -501,19 +417,21 @@ void ide_fix_driveid (struct hd_driveid *id) | |||
501 | * ide_fixstring() cleans up and (optionally) byte-swaps a text string, | 417 | * ide_fixstring() cleans up and (optionally) byte-swaps a text string, |
502 | * removing leading/trailing blanks and compressing internal blanks. | 418 | * removing leading/trailing blanks and compressing internal blanks. |
503 | * It is primarily used to tidy up the model name/number fields as | 419 | * It is primarily used to tidy up the model name/number fields as |
504 | * returned by the WIN_[P]IDENTIFY commands. | 420 | * returned by the ATA_CMD_ID_ATA[PI] commands. |
505 | */ | 421 | */ |
506 | 422 | ||
507 | void ide_fixstring (u8 *s, const int bytecount, const int byteswap) | 423 | void ide_fixstring (u8 *s, const int bytecount, const int byteswap) |
508 | { | 424 | { |
509 | u8 *p = s, *end = &s[bytecount & ~1]; /* bytecount must be even */ | 425 | u8 *p, *end = &s[bytecount & ~1]; /* bytecount must be even */ |
510 | 426 | ||
511 | if (byteswap) { | 427 | if (byteswap) { |
512 | /* convert from big-endian to host byte order */ | 428 | /* convert from big-endian to host byte order */ |
513 | for (p = end ; p != s;) | 429 | for (p = s ; p != end ; p += 2) |
514 | be16_to_cpus((u16 *)(p -= 2)); | 430 | be16_to_cpus((u16 *) p); |
515 | } | 431 | } |
432 | |||
516 | /* strip leading blanks */ | 433 | /* strip leading blanks */ |
434 | p = s; | ||
517 | while (s != end && *s == ' ') | 435 | while (s != end && *s == ' ') |
518 | ++s; | 436 | ++s; |
519 | /* compress internal blanks and strip trailing blanks */ | 437 | /* compress internal blanks and strip trailing blanks */ |
@@ -556,7 +474,7 @@ int drive_is_ready (ide_drive_t *drive) | |||
556 | /* Note: this may clear a pending IRQ!! */ | 474 | /* Note: this may clear a pending IRQ!! */ |
557 | stat = hwif->tp_ops->read_status(hwif); | 475 | stat = hwif->tp_ops->read_status(hwif); |
558 | 476 | ||
559 | if (stat & BUSY_STAT) | 477 | if (stat & ATA_BUSY) |
560 | /* drive busy: definitely not interrupting */ | 478 | /* drive busy: definitely not interrupting */ |
561 | return 0; | 479 | return 0; |
562 | 480 | ||
@@ -588,10 +506,10 @@ static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long ti | |||
588 | udelay(1); /* spec allows drive 400ns to assert "BUSY" */ | 506 | udelay(1); /* spec allows drive 400ns to assert "BUSY" */ |
589 | stat = tp_ops->read_status(hwif); | 507 | stat = tp_ops->read_status(hwif); |
590 | 508 | ||
591 | if (stat & BUSY_STAT) { | 509 | if (stat & ATA_BUSY) { |
592 | local_irq_set(flags); | 510 | local_irq_set(flags); |
593 | timeout += jiffies; | 511 | timeout += jiffies; |
594 | while ((stat = tp_ops->read_status(hwif)) & BUSY_STAT) { | 512 | while ((stat = tp_ops->read_status(hwif)) & ATA_BUSY) { |
595 | if (time_after(jiffies, timeout)) { | 513 | if (time_after(jiffies, timeout)) { |
596 | /* | 514 | /* |
597 | * One last read after the timeout in case | 515 | * One last read after the timeout in case |
@@ -599,7 +517,7 @@ static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long ti | |||
599 | * progress during the timeout.. | 517 | * progress during the timeout.. |
600 | */ | 518 | */ |
601 | stat = tp_ops->read_status(hwif); | 519 | stat = tp_ops->read_status(hwif); |
602 | if (!(stat & BUSY_STAT)) | 520 | if ((stat & ATA_BUSY) == 0) |
603 | break; | 521 | break; |
604 | 522 | ||
605 | local_irq_restore(flags); | 523 | local_irq_restore(flags); |
@@ -660,18 +578,18 @@ EXPORT_SYMBOL(ide_wait_stat); | |||
660 | /** | 578 | /** |
661 | * ide_in_drive_list - look for drive in black/white list | 579 | * ide_in_drive_list - look for drive in black/white list |
662 | * @id: drive identifier | 580 | * @id: drive identifier |
663 | * @drive_table: list to inspect | 581 | * @table: list to inspect |
664 | * | 582 | * |
665 | * Look for a drive in the blacklist and the whitelist tables | 583 | * Look for a drive in the blacklist and the whitelist tables |
666 | * Returns 1 if the drive is found in the table. | 584 | * Returns 1 if the drive is found in the table. |
667 | */ | 585 | */ |
668 | 586 | ||
669 | int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) | 587 | int ide_in_drive_list(u16 *id, const struct drive_list_entry *table) |
670 | { | 588 | { |
671 | for ( ; drive_table->id_model; drive_table++) | 589 | for ( ; table->id_model; table++) |
672 | if ((!strcmp(drive_table->id_model, id->model)) && | 590 | if ((!strcmp(table->id_model, (char *)&id[ATA_ID_PROD])) && |
673 | (!drive_table->id_firmware || | 591 | (!table->id_firmware || |
674 | strstr(id->fw_rev, drive_table->id_firmware))) | 592 | strstr((char *)&id[ATA_ID_FW_REV], table->id_firmware))) |
675 | return 1; | 593 | return 1; |
676 | return 0; | 594 | return 0; |
677 | } | 595 | } |
@@ -702,7 +620,7 @@ static const struct drive_list_entry ivb_list[] = { | |||
702 | u8 eighty_ninty_three (ide_drive_t *drive) | 620 | u8 eighty_ninty_three (ide_drive_t *drive) |
703 | { | 621 | { |
704 | ide_hwif_t *hwif = drive->hwif; | 622 | ide_hwif_t *hwif = drive->hwif; |
705 | struct hd_driveid *id = drive->id; | 623 | u16 *id = drive->id; |
706 | int ivb = ide_in_drive_list(id, ivb_list); | 624 | int ivb = ide_in_drive_list(id, ivb_list); |
707 | 625 | ||
708 | if (hwif->cbl == ATA_CBL_PATA40_SHORT) | 626 | if (hwif->cbl == ATA_CBL_PATA40_SHORT) |
@@ -712,7 +630,7 @@ u8 eighty_ninty_three (ide_drive_t *drive) | |||
712 | printk(KERN_DEBUG "%s: skipping word 93 validity check\n", | 630 | printk(KERN_DEBUG "%s: skipping word 93 validity check\n", |
713 | drive->name); | 631 | drive->name); |
714 | 632 | ||
715 | if (ide_dev_is_sata(id) && !ivb) | 633 | if (ata_id_is_sata(id) && !ivb) |
716 | return 1; | 634 | return 1; |
717 | 635 | ||
718 | if (hwif->cbl != ATA_CBL_PATA80 && !ivb) | 636 | if (hwif->cbl != ATA_CBL_PATA80 && !ivb) |
@@ -724,7 +642,8 @@ u8 eighty_ninty_three (ide_drive_t *drive) | |||
724 | * - force bit13 (80c cable present) check also for !ivb devices | 642 | * - force bit13 (80c cable present) check also for !ivb devices |
725 | * (unless the slave device is pre-ATA3) | 643 | * (unless the slave device is pre-ATA3) |
726 | */ | 644 | */ |
727 | if ((id->hw_config & 0x4000) || (ivb && (id->hw_config & 0x2000))) | 645 | if ((id[ATA_ID_HW_CONFIG] & 0x4000) || |
646 | (ivb && (id[ATA_ID_HW_CONFIG] & 0x2000))) | ||
728 | return 1; | 647 | return 1; |
729 | 648 | ||
730 | no_80w: | 649 | no_80w: |
@@ -745,8 +664,8 @@ int ide_driveid_update(ide_drive_t *drive) | |||
745 | { | 664 | { |
746 | ide_hwif_t *hwif = drive->hwif; | 665 | ide_hwif_t *hwif = drive->hwif; |
747 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | 666 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
748 | struct hd_driveid *id; | 667 | u16 *id; |
749 | unsigned long timeout, flags; | 668 | unsigned long flags; |
750 | u8 stat; | 669 | u8 stat; |
751 | 670 | ||
752 | /* | 671 | /* |
@@ -757,29 +676,24 @@ int ide_driveid_update(ide_drive_t *drive) | |||
757 | SELECT_MASK(drive, 1); | 676 | SELECT_MASK(drive, 1); |
758 | tp_ops->set_irq(hwif, 0); | 677 | tp_ops->set_irq(hwif, 0); |
759 | msleep(50); | 678 | msleep(50); |
760 | tp_ops->exec_command(hwif, WIN_IDENTIFY); | 679 | tp_ops->exec_command(hwif, ATA_CMD_ID_ATA); |
761 | timeout = jiffies + WAIT_WORSTCASE; | ||
762 | do { | ||
763 | if (time_after(jiffies, timeout)) { | ||
764 | SELECT_MASK(drive, 0); | ||
765 | return 0; /* drive timed-out */ | ||
766 | } | ||
767 | 680 | ||
768 | msleep(50); /* give drive a breather */ | 681 | if (ide_busy_sleep(hwif, WAIT_WORSTCASE, 1)) { |
769 | stat = tp_ops->read_altstatus(hwif); | 682 | SELECT_MASK(drive, 0); |
770 | } while (stat & BUSY_STAT); | 683 | return 0; |
684 | } | ||
771 | 685 | ||
772 | msleep(50); /* wait for IRQ and DRQ_STAT */ | 686 | msleep(50); /* wait for IRQ and ATA_DRQ */ |
773 | stat = tp_ops->read_status(hwif); | 687 | stat = tp_ops->read_status(hwif); |
774 | 688 | ||
775 | if (!OK_STAT(stat, DRQ_STAT, BAD_R_STAT)) { | 689 | if (!OK_STAT(stat, ATA_DRQ, BAD_R_STAT)) { |
776 | SELECT_MASK(drive, 0); | 690 | SELECT_MASK(drive, 0); |
777 | printk("%s: CHECK for good STATUS\n", drive->name); | 691 | printk("%s: CHECK for good STATUS\n", drive->name); |
778 | return 0; | 692 | return 0; |
779 | } | 693 | } |
780 | local_irq_save(flags); | 694 | local_irq_save(flags); |
781 | SELECT_MASK(drive, 0); | 695 | SELECT_MASK(drive, 0); |
782 | id = kmalloc(SECTOR_WORDS*4, GFP_ATOMIC); | 696 | id = kmalloc(SECTOR_SIZE, GFP_ATOMIC); |
783 | if (!id) { | 697 | if (!id) { |
784 | local_irq_restore(flags); | 698 | local_irq_restore(flags); |
785 | return 0; | 699 | return 0; |
@@ -789,16 +703,16 @@ int ide_driveid_update(ide_drive_t *drive) | |||
789 | local_irq_enable(); | 703 | local_irq_enable(); |
790 | local_irq_restore(flags); | 704 | local_irq_restore(flags); |
791 | ide_fix_driveid(id); | 705 | ide_fix_driveid(id); |
792 | if (id) { | 706 | |
793 | drive->id->dma_ultra = id->dma_ultra; | 707 | drive->id[ATA_ID_UDMA_MODES] = id[ATA_ID_UDMA_MODES]; |
794 | drive->id->dma_mword = id->dma_mword; | 708 | drive->id[ATA_ID_MWDMA_MODES] = id[ATA_ID_MWDMA_MODES]; |
795 | drive->id->dma_1word = id->dma_1word; | 709 | drive->id[ATA_ID_SWDMA_MODES] = id[ATA_ID_SWDMA_MODES]; |
796 | /* anything more ? */ | 710 | /* anything more ? */ |
797 | kfree(id); | 711 | |
798 | 712 | kfree(id); | |
799 | if (drive->using_dma && ide_id_dma_bug(drive)) | 713 | |
800 | ide_dma_off(drive); | 714 | if (drive->using_dma && ide_id_dma_bug(drive)) |
801 | } | 715 | ide_dma_off(drive); |
802 | 716 | ||
803 | return 1; | 717 | return 1; |
804 | } | 718 | } |
@@ -807,6 +721,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
807 | { | 721 | { |
808 | ide_hwif_t *hwif = drive->hwif; | 722 | ide_hwif_t *hwif = drive->hwif; |
809 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | 723 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; |
724 | u16 *id = drive->id, i; | ||
810 | int error = 0; | 725 | int error = 0; |
811 | u8 stat; | 726 | u8 stat; |
812 | ide_task_t task; | 727 | ide_task_t task; |
@@ -817,7 +732,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
817 | #endif | 732 | #endif |
818 | 733 | ||
819 | /* Skip setting PIO flow-control modes on pre-EIDE drives */ | 734 | /* Skip setting PIO flow-control modes on pre-EIDE drives */ |
820 | if ((speed & 0xf8) == XFER_PIO_0 && !(drive->id->capability & 0x08)) | 735 | if ((speed & 0xf8) == XFER_PIO_0 && ata_id_has_iordy(drive->id) == 0) |
821 | goto skip; | 736 | goto skip; |
822 | 737 | ||
823 | /* | 738 | /* |
@@ -851,13 +766,13 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
851 | 766 | ||
852 | tp_ops->tf_load(drive, &task); | 767 | tp_ops->tf_load(drive, &task); |
853 | 768 | ||
854 | tp_ops->exec_command(hwif, WIN_SETFEATURES); | 769 | tp_ops->exec_command(hwif, ATA_CMD_SET_FEATURES); |
855 | 770 | ||
856 | if (drive->quirk_list == 2) | 771 | if (drive->quirk_list == 2) |
857 | tp_ops->set_irq(hwif, 1); | 772 | tp_ops->set_irq(hwif, 1); |
858 | 773 | ||
859 | error = __ide_wait_stat(drive, drive->ready_stat, | 774 | error = __ide_wait_stat(drive, drive->ready_stat, |
860 | BUSY_STAT|DRQ_STAT|ERR_STAT, | 775 | ATA_BUSY | ATA_DRQ | ATA_ERR, |
861 | WAIT_CMD, &stat); | 776 | WAIT_CMD, &stat); |
862 | 777 | ||
863 | SELECT_MASK(drive, 0); | 778 | SELECT_MASK(drive, 0); |
@@ -869,9 +784,9 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
869 | return error; | 784 | return error; |
870 | } | 785 | } |
871 | 786 | ||
872 | drive->id->dma_ultra &= ~0xFF00; | 787 | id[ATA_ID_UDMA_MODES] &= ~0xFF00; |
873 | drive->id->dma_mword &= ~0x0F00; | 788 | id[ATA_ID_MWDMA_MODES] &= ~0x0F00; |
874 | drive->id->dma_1word &= ~0x0F00; | 789 | id[ATA_ID_SWDMA_MODES] &= ~0x0F00; |
875 | 790 | ||
876 | skip: | 791 | skip: |
877 | #ifdef CONFIG_BLK_DEV_IDEDMA | 792 | #ifdef CONFIG_BLK_DEV_IDEDMA |
@@ -881,23 +796,17 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
881 | ide_dma_off_quietly(drive); | 796 | ide_dma_off_quietly(drive); |
882 | #endif | 797 | #endif |
883 | 798 | ||
884 | switch(speed) { | 799 | if (speed >= XFER_UDMA_0) { |
885 | case XFER_UDMA_7: drive->id->dma_ultra |= 0x8080; break; | 800 | i = 1 << (speed - XFER_UDMA_0); |
886 | case XFER_UDMA_6: drive->id->dma_ultra |= 0x4040; break; | 801 | id[ATA_ID_UDMA_MODES] |= (i << 8 | i); |
887 | case XFER_UDMA_5: drive->id->dma_ultra |= 0x2020; break; | 802 | } else if (speed >= XFER_MW_DMA_0) { |
888 | case XFER_UDMA_4: drive->id->dma_ultra |= 0x1010; break; | 803 | i = 1 << (speed - XFER_MW_DMA_0); |
889 | case XFER_UDMA_3: drive->id->dma_ultra |= 0x0808; break; | 804 | id[ATA_ID_MWDMA_MODES] |= (i << 8 | i); |
890 | case XFER_UDMA_2: drive->id->dma_ultra |= 0x0404; break; | 805 | } else if (speed >= XFER_SW_DMA_0) { |
891 | case XFER_UDMA_1: drive->id->dma_ultra |= 0x0202; break; | 806 | i = 1 << (speed - XFER_SW_DMA_0); |
892 | case XFER_UDMA_0: drive->id->dma_ultra |= 0x0101; break; | 807 | id[ATA_ID_SWDMA_MODES] |= (i << 8 | i); |
893 | case XFER_MW_DMA_2: drive->id->dma_mword |= 0x0404; break; | ||
894 | case XFER_MW_DMA_1: drive->id->dma_mword |= 0x0202; break; | ||
895 | case XFER_MW_DMA_0: drive->id->dma_mword |= 0x0101; break; | ||
896 | case XFER_SW_DMA_2: drive->id->dma_1word |= 0x0404; break; | ||
897 | case XFER_SW_DMA_1: drive->id->dma_1word |= 0x0202; break; | ||
898 | case XFER_SW_DMA_0: drive->id->dma_1word |= 0x0101; break; | ||
899 | default: break; | ||
900 | } | 808 | } |
809 | |||
901 | if (!drive->init_speed) | 810 | if (!drive->init_speed) |
902 | drive->init_speed = speed; | 811 | drive->init_speed = speed; |
903 | drive->current_speed = speed; | 812 | drive->current_speed = speed; |
@@ -977,7 +886,7 @@ void ide_execute_pkt_cmd(ide_drive_t *drive) | |||
977 | unsigned long flags; | 886 | unsigned long flags; |
978 | 887 | ||
979 | spin_lock_irqsave(&ide_lock, flags); | 888 | spin_lock_irqsave(&ide_lock, flags); |
980 | hwif->tp_ops->exec_command(hwif, WIN_PACKETCMD); | 889 | hwif->tp_ops->exec_command(hwif, ATA_CMD_PACKET); |
981 | ndelay(400); | 890 | ndelay(400); |
982 | spin_unlock_irqrestore(&ide_lock, flags); | 891 | spin_unlock_irqrestore(&ide_lock, flags); |
983 | } | 892 | } |
@@ -1010,7 +919,7 @@ static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive) | |||
1010 | udelay (10); | 919 | udelay (10); |
1011 | stat = hwif->tp_ops->read_status(hwif); | 920 | stat = hwif->tp_ops->read_status(hwif); |
1012 | 921 | ||
1013 | if (OK_STAT(stat, 0, BUSY_STAT)) | 922 | if (OK_STAT(stat, 0, ATA_BUSY)) |
1014 | printk("%s: ATAPI reset complete\n", drive->name); | 923 | printk("%s: ATAPI reset complete\n", drive->name); |
1015 | else { | 924 | else { |
1016 | if (time_before(jiffies, hwgroup->poll_timeout)) { | 925 | if (time_before(jiffies, hwgroup->poll_timeout)) { |
@@ -1056,7 +965,7 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive) | |||
1056 | 965 | ||
1057 | tmp = hwif->tp_ops->read_status(hwif); | 966 | tmp = hwif->tp_ops->read_status(hwif); |
1058 | 967 | ||
1059 | if (!OK_STAT(tmp, 0, BUSY_STAT)) { | 968 | if (!OK_STAT(tmp, 0, ATA_BUSY)) { |
1060 | if (time_before(jiffies, hwgroup->poll_timeout)) { | 969 | if (time_before(jiffies, hwgroup->poll_timeout)) { |
1061 | ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL); | 970 | ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL); |
1062 | /* continue polling */ | 971 | /* continue polling */ |
@@ -1102,7 +1011,7 @@ out: | |||
1102 | 1011 | ||
1103 | static void ide_disk_pre_reset(ide_drive_t *drive) | 1012 | static void ide_disk_pre_reset(ide_drive_t *drive) |
1104 | { | 1013 | { |
1105 | int legacy = (drive->id->cfs_enable_2 & 0x0400) ? 0 : 1; | 1014 | int legacy = (drive->id[ATA_ID_CFS_ENABLE_2] & 0x0400) ? 0 : 1; |
1106 | 1015 | ||
1107 | drive->special.all = 0; | 1016 | drive->special.all = 0; |
1108 | drive->special.b.set_geometry = legacy; | 1017 | drive->special.b.set_geometry = legacy; |
@@ -1187,7 +1096,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi) | |||
1187 | pre_reset(drive); | 1096 | pre_reset(drive); |
1188 | SELECT_DRIVE(drive); | 1097 | SELECT_DRIVE(drive); |
1189 | udelay (20); | 1098 | udelay (20); |
1190 | tp_ops->exec_command(hwif, WIN_SRST); | 1099 | tp_ops->exec_command(hwif, ATA_CMD_DEV_RESET); |
1191 | ndelay(400); | 1100 | ndelay(400); |
1192 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; | 1101 | hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; |
1193 | hwgroup->polling = 1; | 1102 | hwgroup->polling = 1; |
@@ -1270,7 +1179,7 @@ int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout) | |||
1270 | */ | 1179 | */ |
1271 | mdelay(1); | 1180 | mdelay(1); |
1272 | stat = hwif->tp_ops->read_status(hwif); | 1181 | stat = hwif->tp_ops->read_status(hwif); |
1273 | if ((stat & BUSY_STAT) == 0) | 1182 | if ((stat & ATA_BUSY) == 0) |
1274 | return 0; | 1183 | return 0; |
1275 | /* | 1184 | /* |
1276 | * Assume a value of 0xff means nothing is connected to | 1185 | * Assume a value of 0xff means nothing is connected to |