diff options
-rw-r--r-- | drivers/scsi/libata-core.c | 588 | ||||
-rw-r--r-- | drivers/scsi/pdc_adma.c | 8 | ||||
-rw-r--r-- | drivers/scsi/sata_mv.c | 7 | ||||
-rw-r--r-- | drivers/scsi/sata_nv.c | 4 | ||||
-rw-r--r-- | drivers/scsi/sata_promise.c | 7 | ||||
-rw-r--r-- | drivers/scsi/sata_qstor.c | 11 | ||||
-rw-r--r-- | drivers/scsi/sata_sx4.c | 6 | ||||
-rw-r--r-- | drivers/scsi/sata_vsc.c | 6 | ||||
-rw-r--r-- | include/linux/ata.h | 11 | ||||
-rw-r--r-- | include/linux/libata.h | 27 |
10 files changed, 483 insertions, 192 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 14cdbb336dd5..c93bb1bd3332 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -70,6 +70,7 @@ static int fgb(u32 bitmap); | |||
70 | static int ata_choose_xfer_mode(const struct ata_port *ap, | 70 | static int ata_choose_xfer_mode(const struct ata_port *ap, |
71 | u8 *xfer_mode_out, | 71 | u8 *xfer_mode_out, |
72 | unsigned int *xfer_shift_out); | 72 | unsigned int *xfer_shift_out); |
73 | static void ata_pio_error(struct ata_port *ap); | ||
73 | 74 | ||
74 | static unsigned int ata_unique_id = 1; | 75 | static unsigned int ata_unique_id = 1; |
75 | static struct workqueue_struct *ata_wq; | 76 | static struct workqueue_struct *ata_wq; |
@@ -610,7 +611,7 @@ int ata_rwcmd_protocol(struct ata_queued_cmd *qc) | |||
610 | } else if (lba48 && (qc->ap->flags & ATA_FLAG_PIO_LBA48)) { | 611 | } else if (lba48 && (qc->ap->flags & ATA_FLAG_PIO_LBA48)) { |
611 | /* Unable to use DMA due to host limitation */ | 612 | /* Unable to use DMA due to host limitation */ |
612 | tf->protocol = ATA_PROT_PIO; | 613 | tf->protocol = ATA_PROT_PIO; |
613 | index = dev->multi_count ? 0 : 4; | 614 | index = dev->multi_count ? 0 : 8; |
614 | } else { | 615 | } else { |
615 | tf->protocol = ATA_PROT_DMA; | 616 | tf->protocol = ATA_PROT_DMA; |
616 | index = 16; | 617 | index = 16; |
@@ -1072,13 +1073,6 @@ static unsigned int ata_pio_modes(const struct ata_device *adev) | |||
1072 | } | 1073 | } |
1073 | 1074 | ||
1074 | static inline void | 1075 | static inline void |
1075 | ata_queue_packet_task(struct ata_port *ap) | ||
1076 | { | ||
1077 | if (!(ap->flags & ATA_FLAG_FLUSH_PIO_TASK)) | ||
1078 | queue_work(ata_wq, &ap->packet_task); | ||
1079 | } | ||
1080 | |||
1081 | static inline void | ||
1082 | ata_queue_pio_task(struct ata_port *ap) | 1076 | ata_queue_pio_task(struct ata_port *ap) |
1083 | { | 1077 | { |
1084 | if (!(ap->flags & ATA_FLAG_FLUSH_PIO_TASK)) | 1078 | if (!(ap->flags & ATA_FLAG_FLUSH_PIO_TASK)) |
@@ -1449,6 +1443,12 @@ retry: | |||
1449 | 1443 | ||
1450 | } | 1444 | } |
1451 | 1445 | ||
1446 | if (dev->id[59] & 0x100) { | ||
1447 | dev->multi_count = dev->id[59] & 0xff; | ||
1448 | DPRINTK("ata%u: dev %u multi count %u\n", | ||
1449 | ap->id, device, dev->multi_count); | ||
1450 | } | ||
1451 | |||
1452 | ap->host->max_cmd_len = 16; | 1452 | ap->host->max_cmd_len = 16; |
1453 | } | 1453 | } |
1454 | 1454 | ||
@@ -1465,6 +1465,9 @@ retry: | |||
1465 | ap->cdb_len = (unsigned int) rc; | 1465 | ap->cdb_len = (unsigned int) rc; |
1466 | ap->host->max_cmd_len = (unsigned char) ap->cdb_len; | 1466 | ap->host->max_cmd_len = (unsigned char) ap->cdb_len; |
1467 | 1467 | ||
1468 | if (ata_id_cdb_intr(dev->id)) | ||
1469 | dev->flags |= ATA_DFLAG_CDB_INTR; | ||
1470 | |||
1468 | /* print device info to dmesg */ | 1471 | /* print device info to dmesg */ |
1469 | printk(KERN_INFO "ata%u: dev %u ATAPI, max %s\n", | 1472 | printk(KERN_INFO "ata%u: dev %u ATAPI, max %s\n", |
1470 | ap->id, device, | 1473 | ap->id, device, |
@@ -3265,7 +3268,6 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc) | |||
3265 | unsigned long flags; | 3268 | unsigned long flags; |
3266 | 3269 | ||
3267 | spin_lock_irqsave(&ap->host_set->lock, flags); | 3270 | spin_lock_irqsave(&ap->host_set->lock, flags); |
3268 | ap->flags &= ~ATA_FLAG_NOINTR; | ||
3269 | ata_irq_on(ap); | 3271 | ata_irq_on(ap); |
3270 | ata_qc_complete(qc); | 3272 | ata_qc_complete(qc); |
3271 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | 3273 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
@@ -3331,7 +3333,8 @@ static unsigned long ata_pio_poll(struct ata_port *ap) | |||
3331 | * None. (executing in kernel thread context) | 3333 | * None. (executing in kernel thread context) |
3332 | * | 3334 | * |
3333 | * RETURNS: | 3335 | * RETURNS: |
3334 | * Non-zero if qc completed, zero otherwise. | 3336 | * Zero if qc completed. |
3337 | * Non-zero if has next. | ||
3335 | */ | 3338 | */ |
3336 | 3339 | ||
3337 | static int ata_pio_complete (struct ata_port *ap) | 3340 | static int ata_pio_complete (struct ata_port *ap) |
@@ -3344,7 +3347,7 @@ static int ata_pio_complete (struct ata_port *ap) | |||
3344 | * we enter, BSY will be cleared in a chk-status or two. If not, | 3347 | * we enter, BSY will be cleared in a chk-status or two. If not, |
3345 | * the drive is probably seeking or something. Snooze for a couple | 3348 | * the drive is probably seeking or something. Snooze for a couple |
3346 | * msecs, then chk-status again. If still busy, fall back to | 3349 | * msecs, then chk-status again. If still busy, fall back to |
3347 | * HSM_ST_POLL state. | 3350 | * HSM_ST_LAST_POLL state. |
3348 | */ | 3351 | */ |
3349 | drv_stat = ata_busy_wait(ap, ATA_BUSY, 10); | 3352 | drv_stat = ata_busy_wait(ap, ATA_BUSY, 10); |
3350 | if (drv_stat & ATA_BUSY) { | 3353 | if (drv_stat & ATA_BUSY) { |
@@ -3353,7 +3356,7 @@ static int ata_pio_complete (struct ata_port *ap) | |||
3353 | if (drv_stat & ATA_BUSY) { | 3356 | if (drv_stat & ATA_BUSY) { |
3354 | ap->hsm_task_state = HSM_ST_LAST_POLL; | 3357 | ap->hsm_task_state = HSM_ST_LAST_POLL; |
3355 | ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO; | 3358 | ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO; |
3356 | return 0; | 3359 | return 1; |
3357 | } | 3360 | } |
3358 | } | 3361 | } |
3359 | 3362 | ||
@@ -3364,7 +3367,7 @@ static int ata_pio_complete (struct ata_port *ap) | |||
3364 | if (!ata_ok(drv_stat)) { | 3367 | if (!ata_ok(drv_stat)) { |
3365 | qc->err_mask |= __ac_err_mask(drv_stat); | 3368 | qc->err_mask |= __ac_err_mask(drv_stat); |
3366 | ap->hsm_task_state = HSM_ST_ERR; | 3369 | ap->hsm_task_state = HSM_ST_ERR; |
3367 | return 0; | 3370 | return 1; |
3368 | } | 3371 | } |
3369 | 3372 | ||
3370 | ap->hsm_task_state = HSM_ST_IDLE; | 3373 | ap->hsm_task_state = HSM_ST_IDLE; |
@@ -3374,7 +3377,7 @@ static int ata_pio_complete (struct ata_port *ap) | |||
3374 | 3377 | ||
3375 | /* another command may start at this point */ | 3378 | /* another command may start at this point */ |
3376 | 3379 | ||
3377 | return 1; | 3380 | return 0; |
3378 | } | 3381 | } |
3379 | 3382 | ||
3380 | 3383 | ||
@@ -3546,7 +3549,23 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) | |||
3546 | page = nth_page(page, (offset >> PAGE_SHIFT)); | 3549 | page = nth_page(page, (offset >> PAGE_SHIFT)); |
3547 | offset %= PAGE_SIZE; | 3550 | offset %= PAGE_SIZE; |
3548 | 3551 | ||
3549 | buf = kmap(page) + offset; | 3552 | DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); |
3553 | |||
3554 | if (PageHighMem(page)) { | ||
3555 | unsigned long flags; | ||
3556 | |||
3557 | local_irq_save(flags); | ||
3558 | buf = kmap_atomic(page, KM_IRQ0); | ||
3559 | |||
3560 | /* do the actual data transfer */ | ||
3561 | ata_data_xfer(ap, buf + offset, ATA_SECT_SIZE, do_write); | ||
3562 | |||
3563 | kunmap_atomic(buf, KM_IRQ0); | ||
3564 | local_irq_restore(flags); | ||
3565 | } else { | ||
3566 | buf = page_address(page); | ||
3567 | ata_data_xfer(ap, buf + offset, ATA_SECT_SIZE, do_write); | ||
3568 | } | ||
3550 | 3569 | ||
3551 | qc->cursect++; | 3570 | qc->cursect++; |
3552 | qc->cursg_ofs++; | 3571 | qc->cursg_ofs++; |
@@ -3555,14 +3574,153 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) | |||
3555 | qc->cursg++; | 3574 | qc->cursg++; |
3556 | qc->cursg_ofs = 0; | 3575 | qc->cursg_ofs = 0; |
3557 | } | 3576 | } |
3577 | } | ||
3558 | 3578 | ||
3559 | DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); | 3579 | /** |
3580 | * ata_pio_sectors - Transfer one or many 512-byte sectors. | ||
3581 | * @qc: Command on going | ||
3582 | * | ||
3583 | * Transfer one or many ATA_SECT_SIZE of data from/to the | ||
3584 | * ATA device for the DRQ request. | ||
3585 | * | ||
3586 | * LOCKING: | ||
3587 | * Inherited from caller. | ||
3588 | */ | ||
3589 | |||
3590 | static void ata_pio_sectors(struct ata_queued_cmd *qc) | ||
3591 | { | ||
3592 | if (is_multi_taskfile(&qc->tf)) { | ||
3593 | /* READ/WRITE MULTIPLE */ | ||
3594 | unsigned int nsect; | ||
3595 | |||
3596 | assert(qc->dev->multi_count); | ||
3597 | |||
3598 | nsect = min(qc->nsect - qc->cursect, qc->dev->multi_count); | ||
3599 | while (nsect--) | ||
3600 | ata_pio_sector(qc); | ||
3601 | } else | ||
3602 | ata_pio_sector(qc); | ||
3603 | } | ||
3604 | |||
3605 | /** | ||
3606 | * atapi_send_cdb - Write CDB bytes to hardware | ||
3607 | * @ap: Port to which ATAPI device is attached. | ||
3608 | * @qc: Taskfile currently active | ||
3609 | * | ||
3610 | * When device has indicated its readiness to accept | ||
3611 | * a CDB, this function is called. Send the CDB. | ||
3612 | * | ||
3613 | * LOCKING: | ||
3614 | * caller. | ||
3615 | */ | ||
3616 | |||
3617 | static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc) | ||
3618 | { | ||
3619 | /* send SCSI cdb */ | ||
3620 | DPRINTK("send cdb\n"); | ||
3621 | assert(ap->cdb_len >= 12); | ||
3622 | |||
3623 | ata_data_xfer(ap, qc->cdb, ap->cdb_len, 1); | ||
3624 | ata_altstatus(ap); /* flush */ | ||
3625 | |||
3626 | switch (qc->tf.protocol) { | ||
3627 | case ATA_PROT_ATAPI: | ||
3628 | ap->hsm_task_state = HSM_ST; | ||
3629 | break; | ||
3630 | case ATA_PROT_ATAPI_NODATA: | ||
3631 | ap->hsm_task_state = HSM_ST_LAST; | ||
3632 | break; | ||
3633 | case ATA_PROT_ATAPI_DMA: | ||
3634 | ap->hsm_task_state = HSM_ST_LAST; | ||
3635 | /* initiate bmdma */ | ||
3636 | ap->ops->bmdma_start(qc); | ||
3637 | break; | ||
3638 | } | ||
3639 | } | ||
3640 | |||
3641 | /** | ||
3642 | * ata_pio_first_block - Write first data block to hardware | ||
3643 | * @ap: Port to which ATA/ATAPI device is attached. | ||
3644 | * | ||
3645 | * When device has indicated its readiness to accept | ||
3646 | * the data, this function sends out the CDB or | ||
3647 | * the first data block by PIO. | ||
3648 | * After this, | ||
3649 | * - If polling, ata_pio_task() handles the rest. | ||
3650 | * - Otherwise, interrupt handler takes over. | ||
3651 | * | ||
3652 | * LOCKING: | ||
3653 | * Kernel thread context (may sleep) | ||
3654 | * | ||
3655 | * RETURNS: | ||
3656 | * Zero if irq handler takes over | ||
3657 | * Non-zero if has next (polling). | ||
3658 | */ | ||
3659 | |||
3660 | static int ata_pio_first_block(struct ata_port *ap) | ||
3661 | { | ||
3662 | struct ata_queued_cmd *qc; | ||
3663 | u8 status; | ||
3664 | unsigned long flags; | ||
3665 | int has_next; | ||
3666 | |||
3667 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
3668 | assert(qc != NULL); | ||
3669 | assert(qc->flags & ATA_QCFLAG_ACTIVE); | ||
3670 | |||
3671 | /* if polling, we will stay in the work queue after sending the data. | ||
3672 | * otherwise, interrupt handler takes over after sending the data. | ||
3673 | */ | ||
3674 | has_next = (qc->tf.flags & ATA_TFLAG_POLLING); | ||
3675 | |||
3676 | /* sleep-wait for BSY to clear */ | ||
3677 | DPRINTK("busy wait\n"); | ||
3678 | if (ata_busy_sleep(ap, ATA_TMOUT_DATAOUT_QUICK, ATA_TMOUT_DATAOUT)) { | ||
3679 | qc->err_mask |= AC_ERR_TIMEOUT; | ||
3680 | ap->hsm_task_state = HSM_ST_TMOUT; | ||
3681 | goto err_out; | ||
3682 | } | ||
3683 | |||
3684 | /* make sure DRQ is set */ | ||
3685 | status = ata_chk_status(ap); | ||
3686 | if ((status & (ATA_BUSY | ATA_DRQ)) != ATA_DRQ) { | ||
3687 | /* device status error */ | ||
3688 | qc->err_mask |= AC_ERR_HSM; | ||
3689 | ap->hsm_task_state = HSM_ST_ERR; | ||
3690 | goto err_out; | ||
3691 | } | ||
3692 | |||
3693 | /* Send the CDB (atapi) or the first data block (ata pio out). | ||
3694 | * During the state transition, interrupt handler shouldn't | ||
3695 | * be invoked before the data transfer is complete and | ||
3696 | * hsm_task_state is changed. Hence, the following locking. | ||
3697 | */ | ||
3698 | spin_lock_irqsave(&ap->host_set->lock, flags); | ||
3699 | |||
3700 | if (qc->tf.protocol == ATA_PROT_PIO) { | ||
3701 | /* PIO data out protocol. | ||
3702 | * send first data block. | ||
3703 | */ | ||
3704 | |||
3705 | /* ata_pio_sectors() might change the state to HSM_ST_LAST. | ||
3706 | * so, the state is changed here before ata_pio_sectors(). | ||
3707 | */ | ||
3708 | ap->hsm_task_state = HSM_ST; | ||
3709 | ata_pio_sectors(qc); | ||
3710 | ata_altstatus(ap); /* flush */ | ||
3711 | } else | ||
3712 | /* send CDB */ | ||
3713 | atapi_send_cdb(ap, qc); | ||
3560 | 3714 | ||
3561 | /* do the actual data transfer */ | 3715 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
3562 | do_write = (qc->tf.flags & ATA_TFLAG_WRITE); | 3716 | |
3563 | ata_data_xfer(ap, buf, ATA_SECT_SIZE, do_write); | 3717 | /* if polling, ata_pio_task() handles the rest. |
3718 | * otherwise, interrupt handler takes over from here. | ||
3719 | */ | ||
3720 | return has_next; | ||
3564 | 3721 | ||
3565 | kunmap(page); | 3722 | err_out: |
3723 | return 1; /* has next */ | ||
3566 | } | 3724 | } |
3567 | 3725 | ||
3568 | /** | 3726 | /** |
@@ -3628,7 +3786,23 @@ next_sg: | |||
3628 | /* don't cross page boundaries */ | 3786 | /* don't cross page boundaries */ |
3629 | count = min(count, (unsigned int)PAGE_SIZE - offset); | 3787 | count = min(count, (unsigned int)PAGE_SIZE - offset); |
3630 | 3788 | ||
3631 | buf = kmap(page) + offset; | 3789 | DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); |
3790 | |||
3791 | if (PageHighMem(page)) { | ||
3792 | unsigned long flags; | ||
3793 | |||
3794 | local_irq_save(flags); | ||
3795 | buf = kmap_atomic(page, KM_IRQ0); | ||
3796 | |||
3797 | /* do the actual data transfer */ | ||
3798 | ata_data_xfer(ap, buf + offset, count, do_write); | ||
3799 | |||
3800 | kunmap_atomic(buf, KM_IRQ0); | ||
3801 | local_irq_restore(flags); | ||
3802 | } else { | ||
3803 | buf = page_address(page); | ||
3804 | ata_data_xfer(ap, buf + offset, count, do_write); | ||
3805 | } | ||
3632 | 3806 | ||
3633 | bytes -= count; | 3807 | bytes -= count; |
3634 | qc->curbytes += count; | 3808 | qc->curbytes += count; |
@@ -3639,13 +3813,6 @@ next_sg: | |||
3639 | qc->cursg_ofs = 0; | 3813 | qc->cursg_ofs = 0; |
3640 | } | 3814 | } |
3641 | 3815 | ||
3642 | DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read"); | ||
3643 | |||
3644 | /* do the actual data transfer */ | ||
3645 | ata_data_xfer(ap, buf, count, do_write); | ||
3646 | |||
3647 | kunmap(page); | ||
3648 | |||
3649 | if (bytes) | 3816 | if (bytes) |
3650 | goto next_sg; | 3817 | goto next_sg; |
3651 | } | 3818 | } |
@@ -3682,6 +3849,8 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc) | |||
3682 | if (do_write != i_write) | 3849 | if (do_write != i_write) |
3683 | goto err_out; | 3850 | goto err_out; |
3684 | 3851 | ||
3852 | VPRINTK("ata%u: xfering %d bytes\n", ap->id, bytes); | ||
3853 | |||
3685 | __atapi_pio_bytes(qc, bytes); | 3854 | __atapi_pio_bytes(qc, bytes); |
3686 | 3855 | ||
3687 | return; | 3856 | return; |
@@ -3752,19 +3921,22 @@ static void ata_pio_block(struct ata_port *ap) | |||
3752 | return; | 3921 | return; |
3753 | } | 3922 | } |
3754 | 3923 | ||
3755 | ata_pio_sector(qc); | 3924 | ata_pio_sectors(qc); |
3756 | } | 3925 | } |
3926 | |||
3927 | ata_altstatus(ap); /* flush */ | ||
3757 | } | 3928 | } |
3758 | 3929 | ||
3759 | static void ata_pio_error(struct ata_port *ap) | 3930 | static void ata_pio_error(struct ata_port *ap) |
3760 | { | 3931 | { |
3761 | struct ata_queued_cmd *qc; | 3932 | struct ata_queued_cmd *qc; |
3762 | 3933 | ||
3763 | printk(KERN_WARNING "ata%u: PIO error\n", ap->id); | ||
3764 | |||
3765 | qc = ata_qc_from_tag(ap, ap->active_tag); | 3934 | qc = ata_qc_from_tag(ap, ap->active_tag); |
3766 | assert(qc != NULL); | 3935 | assert(qc != NULL); |
3767 | 3936 | ||
3937 | if (qc->tf.command != ATA_CMD_PACKET) | ||
3938 | printk(KERN_WARNING "ata%u: PIO error\n", ap->id); | ||
3939 | |||
3768 | /* make sure qc->err_mask is available to | 3940 | /* make sure qc->err_mask is available to |
3769 | * know what's wrong and recover | 3941 | * know what's wrong and recover |
3770 | */ | 3942 | */ |
@@ -3779,22 +3951,23 @@ static void ata_pio_task(void *_data) | |||
3779 | { | 3951 | { |
3780 | struct ata_port *ap = _data; | 3952 | struct ata_port *ap = _data; |
3781 | unsigned long timeout; | 3953 | unsigned long timeout; |
3782 | int qc_completed; | 3954 | int has_next; |
3783 | 3955 | ||
3784 | fsm_start: | 3956 | fsm_start: |
3785 | timeout = 0; | 3957 | timeout = 0; |
3786 | qc_completed = 0; | 3958 | has_next = 1; |
3787 | 3959 | ||
3788 | switch (ap->hsm_task_state) { | 3960 | switch (ap->hsm_task_state) { |
3789 | case HSM_ST_IDLE: | 3961 | case HSM_ST_FIRST: |
3790 | return; | 3962 | has_next = ata_pio_first_block(ap); |
3963 | break; | ||
3791 | 3964 | ||
3792 | case HSM_ST: | 3965 | case HSM_ST: |
3793 | ata_pio_block(ap); | 3966 | ata_pio_block(ap); |
3794 | break; | 3967 | break; |
3795 | 3968 | ||
3796 | case HSM_ST_LAST: | 3969 | case HSM_ST_LAST: |
3797 | qc_completed = ata_pio_complete(ap); | 3970 | has_next = ata_pio_complete(ap); |
3798 | break; | 3971 | break; |
3799 | 3972 | ||
3800 | case HSM_ST_POLL: | 3973 | case HSM_ST_POLL: |
@@ -3806,11 +3979,15 @@ fsm_start: | |||
3806 | case HSM_ST_ERR: | 3979 | case HSM_ST_ERR: |
3807 | ata_pio_error(ap); | 3980 | ata_pio_error(ap); |
3808 | return; | 3981 | return; |
3982 | |||
3983 | default: | ||
3984 | BUG(); | ||
3985 | return; | ||
3809 | } | 3986 | } |
3810 | 3987 | ||
3811 | if (timeout) | 3988 | if (timeout) |
3812 | ata_queue_delayed_pio_task(ap, timeout); | 3989 | ata_queue_delayed_pio_task(ap, timeout); |
3813 | else if (!qc_completed) | 3990 | else if (has_next) |
3814 | goto fsm_start; | 3991 | goto fsm_start; |
3815 | } | 3992 | } |
3816 | 3993 | ||
@@ -3868,8 +4045,10 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc) | |||
3868 | printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x host_stat 0x%x\n", | 4045 | printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x host_stat 0x%x\n", |
3869 | ap->id, qc->tf.command, drv_stat, host_stat); | 4046 | ap->id, qc->tf.command, drv_stat, host_stat); |
3870 | 4047 | ||
4048 | ap->hsm_task_state = HSM_ST_IDLE; | ||
4049 | |||
3871 | /* complete taskfile transaction */ | 4050 | /* complete taskfile transaction */ |
3872 | qc->err_mask |= ac_err_mask(drv_stat); | 4051 | qc->err_mask |= AC_ERR_TIMEOUT; |
3873 | break; | 4052 | break; |
3874 | } | 4053 | } |
3875 | 4054 | ||
@@ -4118,43 +4297,104 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc) | |||
4118 | { | 4297 | { |
4119 | struct ata_port *ap = qc->ap; | 4298 | struct ata_port *ap = qc->ap; |
4120 | 4299 | ||
4300 | /* Use polling pio if the LLD doesn't handle | ||
4301 | * interrupt driven pio and atapi CDB interrupt. | ||
4302 | */ | ||
4303 | if (ap->flags & ATA_FLAG_PIO_POLLING) { | ||
4304 | switch (qc->tf.protocol) { | ||
4305 | case ATA_PROT_PIO: | ||
4306 | case ATA_PROT_ATAPI: | ||
4307 | case ATA_PROT_ATAPI_NODATA: | ||
4308 | qc->tf.flags |= ATA_TFLAG_POLLING; | ||
4309 | break; | ||
4310 | case ATA_PROT_ATAPI_DMA: | ||
4311 | if (qc->dev->flags & ATA_DFLAG_CDB_INTR) | ||
4312 | BUG(); | ||
4313 | break; | ||
4314 | default: | ||
4315 | break; | ||
4316 | } | ||
4317 | } | ||
4318 | |||
4319 | /* select the device */ | ||
4121 | ata_dev_select(ap, qc->dev->devno, 1, 0); | 4320 | ata_dev_select(ap, qc->dev->devno, 1, 0); |
4122 | 4321 | ||
4322 | /* start the command */ | ||
4123 | switch (qc->tf.protocol) { | 4323 | switch (qc->tf.protocol) { |
4124 | case ATA_PROT_NODATA: | 4324 | case ATA_PROT_NODATA: |
4325 | if (qc->tf.flags & ATA_TFLAG_POLLING) | ||
4326 | ata_qc_set_polling(qc); | ||
4327 | |||
4125 | ata_tf_to_host(ap, &qc->tf); | 4328 | ata_tf_to_host(ap, &qc->tf); |
4329 | ap->hsm_task_state = HSM_ST_LAST; | ||
4330 | |||
4331 | if (qc->tf.flags & ATA_TFLAG_POLLING) | ||
4332 | ata_queue_pio_task(ap); | ||
4333 | |||
4126 | break; | 4334 | break; |
4127 | 4335 | ||
4128 | case ATA_PROT_DMA: | 4336 | case ATA_PROT_DMA: |
4337 | assert(!(qc->tf.flags & ATA_TFLAG_POLLING)); | ||
4338 | |||
4129 | ap->ops->tf_load(ap, &qc->tf); /* load tf registers */ | 4339 | ap->ops->tf_load(ap, &qc->tf); /* load tf registers */ |
4130 | ap->ops->bmdma_setup(qc); /* set up bmdma */ | 4340 | ap->ops->bmdma_setup(qc); /* set up bmdma */ |
4131 | ap->ops->bmdma_start(qc); /* initiate bmdma */ | 4341 | ap->ops->bmdma_start(qc); /* initiate bmdma */ |
4342 | ap->hsm_task_state = HSM_ST_LAST; | ||
4132 | break; | 4343 | break; |
4133 | 4344 | ||
4134 | case ATA_PROT_PIO: /* load tf registers, initiate polling pio */ | 4345 | case ATA_PROT_PIO: |
4135 | ata_qc_set_polling(qc); | 4346 | if (qc->tf.flags & ATA_TFLAG_POLLING) |
4136 | ata_tf_to_host(ap, &qc->tf); | 4347 | ata_qc_set_polling(qc); |
4137 | ap->hsm_task_state = HSM_ST; | ||
4138 | ata_queue_pio_task(ap); | ||
4139 | break; | ||
4140 | 4348 | ||
4141 | case ATA_PROT_ATAPI: | ||
4142 | ata_qc_set_polling(qc); | ||
4143 | ata_tf_to_host(ap, &qc->tf); | 4349 | ata_tf_to_host(ap, &qc->tf); |
4144 | ata_queue_packet_task(ap); | 4350 | |
4351 | if (qc->tf.flags & ATA_TFLAG_WRITE) { | ||
4352 | /* PIO data out protocol */ | ||
4353 | ap->hsm_task_state = HSM_ST_FIRST; | ||
4354 | ata_queue_pio_task(ap); | ||
4355 | |||
4356 | /* always send first data block using | ||
4357 | * the ata_pio_task() codepath. | ||
4358 | */ | ||
4359 | } else { | ||
4360 | /* PIO data in protocol */ | ||
4361 | ap->hsm_task_state = HSM_ST; | ||
4362 | |||
4363 | if (qc->tf.flags & ATA_TFLAG_POLLING) | ||
4364 | ata_queue_pio_task(ap); | ||
4365 | |||
4366 | /* if polling, ata_pio_task() handles the rest. | ||
4367 | * otherwise, interrupt handler takes over from here. | ||
4368 | */ | ||
4369 | } | ||
4370 | |||
4145 | break; | 4371 | break; |
4146 | 4372 | ||
4373 | case ATA_PROT_ATAPI: | ||
4147 | case ATA_PROT_ATAPI_NODATA: | 4374 | case ATA_PROT_ATAPI_NODATA: |
4148 | ap->flags |= ATA_FLAG_NOINTR; | 4375 | if (qc->tf.flags & ATA_TFLAG_POLLING) |
4376 | ata_qc_set_polling(qc); | ||
4377 | |||
4149 | ata_tf_to_host(ap, &qc->tf); | 4378 | ata_tf_to_host(ap, &qc->tf); |
4150 | ata_queue_packet_task(ap); | 4379 | |
4380 | ap->hsm_task_state = HSM_ST_FIRST; | ||
4381 | |||
4382 | /* send cdb by polling if no cdb interrupt */ | ||
4383 | if ((!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) || | ||
4384 | (qc->tf.flags & ATA_TFLAG_POLLING)) | ||
4385 | ata_queue_pio_task(ap); | ||
4151 | break; | 4386 | break; |
4152 | 4387 | ||
4153 | case ATA_PROT_ATAPI_DMA: | 4388 | case ATA_PROT_ATAPI_DMA: |
4154 | ap->flags |= ATA_FLAG_NOINTR; | 4389 | assert(!(qc->tf.flags & ATA_TFLAG_POLLING)); |
4390 | |||
4155 | ap->ops->tf_load(ap, &qc->tf); /* load tf registers */ | 4391 | ap->ops->tf_load(ap, &qc->tf); /* load tf registers */ |
4156 | ap->ops->bmdma_setup(qc); /* set up bmdma */ | 4392 | ap->ops->bmdma_setup(qc); /* set up bmdma */ |
4157 | ata_queue_packet_task(ap); | 4393 | ap->hsm_task_state = HSM_ST_FIRST; |
4394 | |||
4395 | /* send cdb by polling if no cdb interrupt */ | ||
4396 | if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) | ||
4397 | ata_queue_pio_task(ap); | ||
4158 | break; | 4398 | break; |
4159 | 4399 | ||
4160 | default: | 4400 | default: |
@@ -4415,48 +4655,160 @@ void ata_bmdma_stop(struct ata_queued_cmd *qc) | |||
4415 | inline unsigned int ata_host_intr (struct ata_port *ap, | 4655 | inline unsigned int ata_host_intr (struct ata_port *ap, |
4416 | struct ata_queued_cmd *qc) | 4656 | struct ata_queued_cmd *qc) |
4417 | { | 4657 | { |
4418 | u8 status, host_stat; | 4658 | u8 status, host_stat = 0; |
4419 | 4659 | ||
4420 | switch (qc->tf.protocol) { | 4660 | VPRINTK("ata%u: protocol %d task_state %d\n", |
4661 | ap->id, qc->tf.protocol, ap->hsm_task_state); | ||
4421 | 4662 | ||
4422 | case ATA_PROT_DMA: | 4663 | /* Check whether we are expecting interrupt in this state */ |
4423 | case ATA_PROT_ATAPI_DMA: | 4664 | switch (ap->hsm_task_state) { |
4424 | case ATA_PROT_ATAPI: | 4665 | case HSM_ST_FIRST: |
4425 | /* check status of DMA engine */ | 4666 | /* Check the ATA_DFLAG_CDB_INTR flag is enough here. |
4426 | host_stat = ap->ops->bmdma_status(ap); | 4667 | * The flag was turned on only for atapi devices. |
4427 | VPRINTK("ata%u: host_stat 0x%X\n", ap->id, host_stat); | 4668 | * No need to check is_atapi_taskfile(&qc->tf) again. |
4428 | 4669 | */ | |
4429 | /* if it's not our irq... */ | 4670 | if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) |
4430 | if (!(host_stat & ATA_DMA_INTR)) | ||
4431 | goto idle_irq; | 4671 | goto idle_irq; |
4672 | break; | ||
4673 | case HSM_ST_LAST: | ||
4674 | if (qc->tf.protocol == ATA_PROT_DMA || | ||
4675 | qc->tf.protocol == ATA_PROT_ATAPI_DMA) { | ||
4676 | /* check status of DMA engine */ | ||
4677 | host_stat = ap->ops->bmdma_status(ap); | ||
4678 | VPRINTK("ata%u: host_stat 0x%X\n", ap->id, host_stat); | ||
4679 | |||
4680 | /* if it's not our irq... */ | ||
4681 | if (!(host_stat & ATA_DMA_INTR)) | ||
4682 | goto idle_irq; | ||
4683 | |||
4684 | /* before we do anything else, clear DMA-Start bit */ | ||
4685 | ap->ops->bmdma_stop(qc); | ||
4686 | |||
4687 | if (unlikely(host_stat & ATA_DMA_ERR)) { | ||
4688 | /* error when transfering data to/from memory */ | ||
4689 | qc->err_mask |= AC_ERR_HOST_BUS; | ||
4690 | ap->hsm_task_state = HSM_ST_ERR; | ||
4691 | } | ||
4692 | } | ||
4693 | break; | ||
4694 | case HSM_ST: | ||
4695 | break; | ||
4696 | default: | ||
4697 | goto idle_irq; | ||
4698 | } | ||
4432 | 4699 | ||
4433 | /* before we do anything else, clear DMA-Start bit */ | 4700 | /* check altstatus */ |
4434 | ap->ops->bmdma_stop(qc); | 4701 | status = ata_altstatus(ap); |
4702 | if (status & ATA_BUSY) | ||
4703 | goto idle_irq; | ||
4435 | 4704 | ||
4436 | /* fall through */ | 4705 | /* check main status, clearing INTRQ */ |
4706 | status = ata_chk_status(ap); | ||
4707 | if (unlikely(status & ATA_BUSY)) | ||
4708 | goto idle_irq; | ||
4437 | 4709 | ||
4438 | case ATA_PROT_ATAPI_NODATA: | 4710 | DPRINTK("ata%u: protocol %d task_state %d (dev_stat 0x%X)\n", |
4439 | case ATA_PROT_NODATA: | 4711 | ap->id, qc->tf.protocol, ap->hsm_task_state, status); |
4440 | /* check altstatus */ | ||
4441 | status = ata_altstatus(ap); | ||
4442 | if (status & ATA_BUSY) | ||
4443 | goto idle_irq; | ||
4444 | 4712 | ||
4445 | /* check main status, clearing INTRQ */ | 4713 | /* ack bmdma irq events */ |
4446 | status = ata_chk_status(ap); | 4714 | ap->ops->irq_clear(ap); |
4447 | if (unlikely(status & ATA_BUSY)) | ||
4448 | goto idle_irq; | ||
4449 | DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n", | ||
4450 | ap->id, qc->tf.protocol, status); | ||
4451 | 4715 | ||
4452 | /* ack bmdma irq events */ | 4716 | /* check error */ |
4453 | ap->ops->irq_clear(ap); | 4717 | if (unlikely(status & (ATA_ERR | ATA_DF))) { |
4718 | qc->err_mask |= AC_ERR_DEV; | ||
4719 | ap->hsm_task_state = HSM_ST_ERR; | ||
4720 | } | ||
4721 | |||
4722 | fsm_start: | ||
4723 | switch (ap->hsm_task_state) { | ||
4724 | case HSM_ST_FIRST: | ||
4725 | /* Some pre-ATAPI-4 devices assert INTRQ | ||
4726 | * at this state when ready to receive CDB. | ||
4727 | */ | ||
4728 | |||
4729 | /* check device status */ | ||
4730 | if (unlikely((status & (ATA_BUSY | ATA_DRQ)) != ATA_DRQ)) { | ||
4731 | /* Wrong status. Let EH handle this */ | ||
4732 | qc->err_mask |= AC_ERR_HSM; | ||
4733 | ap->hsm_task_state = HSM_ST_ERR; | ||
4734 | goto fsm_start; | ||
4735 | } | ||
4736 | |||
4737 | atapi_send_cdb(ap, qc); | ||
4738 | |||
4739 | break; | ||
4740 | |||
4741 | case HSM_ST: | ||
4742 | /* complete command or read/write the data register */ | ||
4743 | if (qc->tf.protocol == ATA_PROT_ATAPI) { | ||
4744 | /* ATAPI PIO protocol */ | ||
4745 | if ((status & ATA_DRQ) == 0) { | ||
4746 | /* no more data to transfer */ | ||
4747 | ap->hsm_task_state = HSM_ST_LAST; | ||
4748 | goto fsm_start; | ||
4749 | } | ||
4750 | |||
4751 | atapi_pio_bytes(qc); | ||
4752 | |||
4753 | if (unlikely(ap->hsm_task_state == HSM_ST_ERR)) | ||
4754 | /* bad ireason reported by device */ | ||
4755 | goto fsm_start; | ||
4756 | |||
4757 | } else { | ||
4758 | /* ATA PIO protocol */ | ||
4759 | if (unlikely((status & ATA_DRQ) == 0)) { | ||
4760 | /* handle BSY=0, DRQ=0 as error */ | ||
4761 | qc->err_mask |= AC_ERR_HSM; | ||
4762 | ap->hsm_task_state = HSM_ST_ERR; | ||
4763 | goto fsm_start; | ||
4764 | } | ||
4765 | |||
4766 | ata_pio_sectors(qc); | ||
4767 | |||
4768 | if (ap->hsm_task_state == HSM_ST_LAST && | ||
4769 | (!(qc->tf.flags & ATA_TFLAG_WRITE))) { | ||
4770 | /* all data read */ | ||
4771 | ata_altstatus(ap); | ||
4772 | status = ata_chk_status(ap); | ||
4773 | goto fsm_start; | ||
4774 | } | ||
4775 | } | ||
4776 | |||
4777 | ata_altstatus(ap); /* flush */ | ||
4778 | break; | ||
4779 | |||
4780 | case HSM_ST_LAST: | ||
4781 | if (unlikely(status & ATA_DRQ)) { | ||
4782 | /* handle DRQ=1 as error */ | ||
4783 | qc->err_mask |= AC_ERR_HSM; | ||
4784 | ap->hsm_task_state = HSM_ST_ERR; | ||
4785 | goto fsm_start; | ||
4786 | } | ||
4787 | |||
4788 | /* no more data to transfer */ | ||
4789 | DPRINTK("ata%u: command complete, drv_stat 0x%x\n", | ||
4790 | ap->id, status); | ||
4791 | |||
4792 | ap->hsm_task_state = HSM_ST_IDLE; | ||
4454 | 4793 | ||
4455 | /* complete taskfile transaction */ | 4794 | /* complete taskfile transaction */ |
4456 | qc->err_mask |= ac_err_mask(status); | 4795 | qc->err_mask |= ac_err_mask(status); |
4457 | ata_qc_complete(qc); | 4796 | ata_qc_complete(qc); |
4458 | break; | 4797 | break; |
4459 | 4798 | ||
4799 | case HSM_ST_ERR: | ||
4800 | if (qc->tf.command != ATA_CMD_PACKET) | ||
4801 | printk(KERN_ERR "ata%u: command error, drv_stat 0x%x host_stat 0x%x\n", | ||
4802 | ap->id, status, host_stat); | ||
4803 | |||
4804 | /* make sure qc->err_mask is available to | ||
4805 | * know what's wrong and recover | ||
4806 | */ | ||
4807 | assert(qc->err_mask); | ||
4808 | |||
4809 | ap->hsm_task_state = HSM_ST_IDLE; | ||
4810 | ata_qc_complete(qc); | ||
4811 | break; | ||
4460 | default: | 4812 | default: |
4461 | goto idle_irq; | 4813 | goto idle_irq; |
4462 | } | 4814 | } |
@@ -4507,11 +4859,11 @@ irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs) | |||
4507 | 4859 | ||
4508 | ap = host_set->ports[i]; | 4860 | ap = host_set->ports[i]; |
4509 | if (ap && | 4861 | if (ap && |
4510 | !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) { | 4862 | !(ap->flags & ATA_FLAG_PORT_DISABLED)) { |
4511 | struct ata_queued_cmd *qc; | 4863 | struct ata_queued_cmd *qc; |
4512 | 4864 | ||
4513 | qc = ata_qc_from_tag(ap, ap->active_tag); | 4865 | qc = ata_qc_from_tag(ap, ap->active_tag); |
4514 | if (qc && (!(qc->tf.ctl & ATA_NIEN)) && | 4866 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) && |
4515 | (qc->flags & ATA_QCFLAG_ACTIVE)) | 4867 | (qc->flags & ATA_QCFLAG_ACTIVE)) |
4516 | handled |= ata_host_intr(ap, qc); | 4868 | handled |= ata_host_intr(ap, qc); |
4517 | } | 4869 | } |
@@ -4522,79 +4874,6 @@ irqreturn_t ata_interrupt (int irq, void *dev_instance, struct pt_regs *regs) | |||
4522 | return IRQ_RETVAL(handled); | 4874 | return IRQ_RETVAL(handled); |
4523 | } | 4875 | } |
4524 | 4876 | ||
4525 | /** | ||
4526 | * atapi_packet_task - Write CDB bytes to hardware | ||
4527 | * @_data: Port to which ATAPI device is attached. | ||
4528 | * | ||
4529 | * When device has indicated its readiness to accept | ||
4530 | * a CDB, this function is called. Send the CDB. | ||
4531 | * If DMA is to be performed, exit immediately. | ||
4532 | * Otherwise, we are in polling mode, so poll | ||
4533 | * status under operation succeeds or fails. | ||
4534 | * | ||
4535 | * LOCKING: | ||
4536 | * Kernel thread context (may sleep) | ||
4537 | */ | ||
4538 | |||
4539 | static void atapi_packet_task(void *_data) | ||
4540 | { | ||
4541 | struct ata_port *ap = _data; | ||
4542 | struct ata_queued_cmd *qc; | ||
4543 | u8 status; | ||
4544 | |||
4545 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
4546 | assert(qc != NULL); | ||
4547 | assert(qc->flags & ATA_QCFLAG_ACTIVE); | ||
4548 | |||
4549 | /* sleep-wait for BSY to clear */ | ||
4550 | DPRINTK("busy wait\n"); | ||
4551 | if (ata_busy_sleep(ap, ATA_TMOUT_CDB_QUICK, ATA_TMOUT_CDB)) { | ||
4552 | qc->err_mask |= AC_ERR_TIMEOUT; | ||
4553 | goto err_out; | ||
4554 | } | ||
4555 | |||
4556 | /* make sure DRQ is set */ | ||
4557 | status = ata_chk_status(ap); | ||
4558 | if ((status & (ATA_BUSY | ATA_DRQ)) != ATA_DRQ) { | ||
4559 | qc->err_mask |= AC_ERR_HSM; | ||
4560 | goto err_out; | ||
4561 | } | ||
4562 | |||
4563 | /* send SCSI cdb */ | ||
4564 | DPRINTK("send cdb\n"); | ||
4565 | assert(ap->cdb_len >= 12); | ||
4566 | |||
4567 | if (qc->tf.protocol == ATA_PROT_ATAPI_DMA || | ||
4568 | qc->tf.protocol == ATA_PROT_ATAPI_NODATA) { | ||
4569 | unsigned long flags; | ||
4570 | |||
4571 | /* Once we're done issuing command and kicking bmdma, | ||
4572 | * irq handler takes over. To not lose irq, we need | ||
4573 | * to clear NOINTR flag before sending cdb, but | ||
4574 | * interrupt handler shouldn't be invoked before we're | ||
4575 | * finished. Hence, the following locking. | ||
4576 | */ | ||
4577 | spin_lock_irqsave(&ap->host_set->lock, flags); | ||
4578 | ap->flags &= ~ATA_FLAG_NOINTR; | ||
4579 | ata_data_xfer(ap, qc->cdb, ap->cdb_len, 1); | ||
4580 | if (qc->tf.protocol == ATA_PROT_ATAPI_DMA) | ||
4581 | ap->ops->bmdma_start(qc); /* initiate bmdma */ | ||
4582 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
4583 | } else { | ||
4584 | ata_data_xfer(ap, qc->cdb, ap->cdb_len, 1); | ||
4585 | |||
4586 | /* PIO commands are handled by polling */ | ||
4587 | ap->hsm_task_state = HSM_ST; | ||
4588 | ata_queue_pio_task(ap); | ||
4589 | } | ||
4590 | |||
4591 | return; | ||
4592 | |||
4593 | err_out: | ||
4594 | ata_poll_qc_complete(qc); | ||
4595 | } | ||
4596 | |||
4597 | |||
4598 | /* | 4877 | /* |
4599 | * Execute a 'simple' command, that only consists of the opcode 'cmd' itself, | 4878 | * Execute a 'simple' command, that only consists of the opcode 'cmd' itself, |
4600 | * without filling any other registers | 4879 | * without filling any other registers |
@@ -4814,7 +5093,6 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, | |||
4814 | ap->active_tag = ATA_TAG_POISON; | 5093 | ap->active_tag = ATA_TAG_POISON; |
4815 | ap->last_ctl = 0xFF; | 5094 | ap->last_ctl = 0xFF; |
4816 | 5095 | ||
4817 | INIT_WORK(&ap->packet_task, atapi_packet_task, ap); | ||
4818 | INIT_WORK(&ap->pio_task, ata_pio_task, ap); | 5096 | INIT_WORK(&ap->pio_task, ata_pio_task, ap); |
4819 | INIT_LIST_HEAD(&ap->eh_done_q); | 5097 | INIT_LIST_HEAD(&ap->eh_done_q); |
4820 | 5098 | ||
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c index 3a6bf58dc37b..2dca6c53868a 100644 --- a/drivers/scsi/pdc_adma.c +++ b/drivers/scsi/pdc_adma.c | |||
@@ -457,13 +457,13 @@ static inline unsigned int adma_intr_pkt(struct ata_host_set *host_set) | |||
457 | continue; | 457 | continue; |
458 | handled = 1; | 458 | handled = 1; |
459 | adma_enter_reg_mode(ap); | 459 | adma_enter_reg_mode(ap); |
460 | if (ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR)) | 460 | if (ap->flags & ATA_FLAG_PORT_DISABLED) |
461 | continue; | 461 | continue; |
462 | pp = ap->private_data; | 462 | pp = ap->private_data; |
463 | if (!pp || pp->state != adma_state_pkt) | 463 | if (!pp || pp->state != adma_state_pkt) |
464 | continue; | 464 | continue; |
465 | qc = ata_qc_from_tag(ap, ap->active_tag); | 465 | qc = ata_qc_from_tag(ap, ap->active_tag); |
466 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { | 466 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { |
467 | if ((status & (aPERR | aPSD | aUIRQ))) | 467 | if ((status & (aPERR | aPSD | aUIRQ))) |
468 | qc->err_mask |= AC_ERR_OTHER; | 468 | qc->err_mask |= AC_ERR_OTHER; |
469 | else if (pp->pkt[0] != cDONE) | 469 | else if (pp->pkt[0] != cDONE) |
@@ -482,13 +482,13 @@ static inline unsigned int adma_intr_mmio(struct ata_host_set *host_set) | |||
482 | for (port_no = 0; port_no < host_set->n_ports; ++port_no) { | 482 | for (port_no = 0; port_no < host_set->n_ports; ++port_no) { |
483 | struct ata_port *ap; | 483 | struct ata_port *ap; |
484 | ap = host_set->ports[port_no]; | 484 | ap = host_set->ports[port_no]; |
485 | if (ap && (!(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR)))) { | 485 | if (ap && (!(ap->flags & ATA_FLAG_PORT_DISABLED))) { |
486 | struct ata_queued_cmd *qc; | 486 | struct ata_queued_cmd *qc; |
487 | struct adma_port_priv *pp = ap->private_data; | 487 | struct adma_port_priv *pp = ap->private_data; |
488 | if (!pp || pp->state != adma_state_mmio) | 488 | if (!pp || pp->state != adma_state_mmio) |
489 | continue; | 489 | continue; |
490 | qc = ata_qc_from_tag(ap, ap->active_tag); | 490 | qc = ata_qc_from_tag(ap, ap->active_tag); |
491 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { | 491 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { |
492 | 492 | ||
493 | /* check main status, clearing INTRQ */ | 493 | /* check main status, clearing INTRQ */ |
494 | u8 status = ata_check_status(ap); | 494 | u8 status = ata_check_status(ap); |
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 3e916327ae37..5b36a23455de 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -87,7 +87,7 @@ enum { | |||
87 | MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ | 87 | MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ |
88 | MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 88 | MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
89 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | | 89 | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | |
90 | ATA_FLAG_NO_ATAPI), | 90 | ATA_FLAG_PIO_POLLING), |
91 | MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, | 91 | MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, |
92 | 92 | ||
93 | CRQB_FLAG_READ = (1 << 0), | 93 | CRQB_FLAG_READ = (1 << 0), |
@@ -1387,8 +1387,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1387 | handled++; | 1387 | handled++; |
1388 | } | 1388 | } |
1389 | 1389 | ||
1390 | if (ap && | 1390 | if (ap && (ap->flags & ATA_FLAG_PORT_DISABLED)) |
1391 | (ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) | ||
1392 | continue; | 1391 | continue; |
1393 | 1392 | ||
1394 | err_mask = ac_err_mask(ata_status); | 1393 | err_mask = ac_err_mask(ata_status); |
@@ -1409,7 +1408,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1409 | VPRINTK("port %u IRQ found for qc, " | 1408 | VPRINTK("port %u IRQ found for qc, " |
1410 | "ata_status 0x%x\n", port,ata_status); | 1409 | "ata_status 0x%x\n", port,ata_status); |
1411 | /* mark qc status appropriately */ | 1410 | /* mark qc status appropriately */ |
1412 | if (!(qc->tf.ctl & ATA_NIEN)) { | 1411 | if (!(qc->tf.flags & ATA_TFLAG_POLLING)) { |
1413 | qc->err_mask |= err_mask; | 1412 | qc->err_mask |= err_mask; |
1414 | ata_qc_complete(qc); | 1413 | ata_qc_complete(qc); |
1415 | } | 1414 | } |
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c index bbbb55eeb73a..945194b76998 100644 --- a/drivers/scsi/sata_nv.c +++ b/drivers/scsi/sata_nv.c | |||
@@ -309,11 +309,11 @@ static irqreturn_t nv_interrupt (int irq, void *dev_instance, | |||
309 | 309 | ||
310 | ap = host_set->ports[i]; | 310 | ap = host_set->ports[i]; |
311 | if (ap && | 311 | if (ap && |
312 | !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) { | 312 | !(ap->flags & ATA_FLAG_PORT_DISABLED)) { |
313 | struct ata_queued_cmd *qc; | 313 | struct ata_queued_cmd *qc; |
314 | 314 | ||
315 | qc = ata_qc_from_tag(ap, ap->active_tag); | 315 | qc = ata_qc_from_tag(ap, ap->active_tag); |
316 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) | 316 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) |
317 | handled += ata_host_intr(ap, qc); | 317 | handled += ata_host_intr(ap, qc); |
318 | else | 318 | else |
319 | // No request pending? Clear interrupt status | 319 | // No request pending? Clear interrupt status |
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index 0950a8e45814..dcd1667f4144 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -76,7 +76,8 @@ enum { | |||
76 | PDC_RESET = (1 << 11), /* HDMA reset */ | 76 | PDC_RESET = (1 << 11), /* HDMA reset */ |
77 | 77 | ||
78 | PDC_COMMON_FLAGS = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST | | 78 | PDC_COMMON_FLAGS = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST | |
79 | ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI, | 79 | ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI | |
80 | ATA_FLAG_PIO_POLLING, | ||
80 | }; | 81 | }; |
81 | 82 | ||
82 | 83 | ||
@@ -540,11 +541,11 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r | |||
540 | ap = host_set->ports[i]; | 541 | ap = host_set->ports[i]; |
541 | tmp = mask & (1 << (i + 1)); | 542 | tmp = mask & (1 << (i + 1)); |
542 | if (tmp && ap && | 543 | if (tmp && ap && |
543 | !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) { | 544 | !(ap->flags & ATA_FLAG_PORT_DISABLED)) { |
544 | struct ata_queued_cmd *qc; | 545 | struct ata_queued_cmd *qc; |
545 | 546 | ||
546 | qc = ata_qc_from_tag(ap, ap->active_tag); | 547 | qc = ata_qc_from_tag(ap, ap->active_tag); |
547 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) | 548 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) |
548 | handled += pdc_host_intr(ap, qc); | 549 | handled += pdc_host_intr(ap, qc); |
549 | } | 550 | } |
550 | } | 551 | } |
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c index 2afbeb77f6fe..b2f87da75735 100644 --- a/drivers/scsi/sata_qstor.c +++ b/drivers/scsi/sata_qstor.c | |||
@@ -177,7 +177,7 @@ static const struct ata_port_info qs_port_info[] = { | |||
177 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 177 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
178 | ATA_FLAG_SATA_RESET | | 178 | ATA_FLAG_SATA_RESET | |
179 | //FIXME ATA_FLAG_SRST | | 179 | //FIXME ATA_FLAG_SRST | |
180 | ATA_FLAG_MMIO, | 180 | ATA_FLAG_MMIO | ATA_FLAG_PIO_POLLING, |
181 | .pio_mask = 0x10, /* pio4 */ | 181 | .pio_mask = 0x10, /* pio4 */ |
182 | .udma_mask = 0x7f, /* udma0-6 */ | 182 | .udma_mask = 0x7f, /* udma0-6 */ |
183 | .port_ops = &qs_ata_ops, | 183 | .port_ops = &qs_ata_ops, |
@@ -396,14 +396,13 @@ static inline unsigned int qs_intr_pkt(struct ata_host_set *host_set) | |||
396 | DPRINTK("SFF=%08x%08x: sCHAN=%u sHST=%d sDST=%02x\n", | 396 | DPRINTK("SFF=%08x%08x: sCHAN=%u sHST=%d sDST=%02x\n", |
397 | sff1, sff0, port_no, sHST, sDST); | 397 | sff1, sff0, port_no, sHST, sDST); |
398 | handled = 1; | 398 | handled = 1; |
399 | if (ap && !(ap->flags & | 399 | if (ap && !(ap->flags & ATA_FLAG_PORT_DISABLED)) { |
400 | (ATA_FLAG_PORT_DISABLED|ATA_FLAG_NOINTR))) { | ||
401 | struct ata_queued_cmd *qc; | 400 | struct ata_queued_cmd *qc; |
402 | struct qs_port_priv *pp = ap->private_data; | 401 | struct qs_port_priv *pp = ap->private_data; |
403 | if (!pp || pp->state != qs_state_pkt) | 402 | if (!pp || pp->state != qs_state_pkt) |
404 | continue; | 403 | continue; |
405 | qc = ata_qc_from_tag(ap, ap->active_tag); | 404 | qc = ata_qc_from_tag(ap, ap->active_tag); |
406 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { | 405 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { |
407 | switch (sHST) { | 406 | switch (sHST) { |
408 | case 0: /* successful CPB */ | 407 | case 0: /* successful CPB */ |
409 | case 3: /* device error */ | 408 | case 3: /* device error */ |
@@ -430,13 +429,13 @@ static inline unsigned int qs_intr_mmio(struct ata_host_set *host_set) | |||
430 | struct ata_port *ap; | 429 | struct ata_port *ap; |
431 | ap = host_set->ports[port_no]; | 430 | ap = host_set->ports[port_no]; |
432 | if (ap && | 431 | if (ap && |
433 | !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) { | 432 | !(ap->flags & ATA_FLAG_PORT_DISABLED)) { |
434 | struct ata_queued_cmd *qc; | 433 | struct ata_queued_cmd *qc; |
435 | struct qs_port_priv *pp = ap->private_data; | 434 | struct qs_port_priv *pp = ap->private_data; |
436 | if (!pp || pp->state != qs_state_mmio) | 435 | if (!pp || pp->state != qs_state_mmio) |
437 | continue; | 436 | continue; |
438 | qc = ata_qc_from_tag(ap, ap->active_tag); | 437 | qc = ata_qc_from_tag(ap, ap->active_tag); |
439 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { | 438 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { |
440 | 439 | ||
441 | /* check main status, clearing INTRQ */ | 440 | /* check main status, clearing INTRQ */ |
442 | u8 status = ata_check_status(ap); | 441 | u8 status = ata_check_status(ap); |
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index 9f992fbcf2e7..c3975fada63f 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c | |||
@@ -220,7 +220,7 @@ static const struct ata_port_info pdc_port_info[] = { | |||
220 | .sht = &pdc_sata_sht, | 220 | .sht = &pdc_sata_sht, |
221 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | 221 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | |
222 | ATA_FLAG_SRST | ATA_FLAG_MMIO | | 222 | ATA_FLAG_SRST | ATA_FLAG_MMIO | |
223 | ATA_FLAG_NO_ATAPI, | 223 | ATA_FLAG_PIO_POLLING, |
224 | .pio_mask = 0x1f, /* pio0-4 */ | 224 | .pio_mask = 0x1f, /* pio0-4 */ |
225 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 225 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
226 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | 226 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ |
@@ -835,11 +835,11 @@ static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance, struct pt_re | |||
835 | tmp = mask & (1 << i); | 835 | tmp = mask & (1 << i); |
836 | VPRINTK("seq %u, port_no %u, ap %p, tmp %x\n", i, port_no, ap, tmp); | 836 | VPRINTK("seq %u, port_no %u, ap %p, tmp %x\n", i, port_no, ap, tmp); |
837 | if (tmp && ap && | 837 | if (tmp && ap && |
838 | !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) { | 838 | !(ap->flags & ATA_FLAG_PORT_DISABLED)) { |
839 | struct ata_queued_cmd *qc; | 839 | struct ata_queued_cmd *qc; |
840 | 840 | ||
841 | qc = ata_qc_from_tag(ap, ap->active_tag); | 841 | qc = ata_qc_from_tag(ap, ap->active_tag); |
842 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) | 842 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) |
843 | handled += pdc20621_host_intr(ap, qc, (i > 4), | 843 | handled += pdc20621_host_intr(ap, qc, (i > 4), |
844 | mmio_base); | 844 | mmio_base); |
845 | } | 845 | } |
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c index 2e2c3b7acb0c..3e34fedd2104 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/scsi/sata_vsc.c | |||
@@ -201,12 +201,12 @@ static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance, | |||
201 | struct ata_port *ap; | 201 | struct ata_port *ap; |
202 | 202 | ||
203 | ap = host_set->ports[i]; | 203 | ap = host_set->ports[i]; |
204 | if (ap && !(ap->flags & | 204 | if (ap && |
205 | (ATA_FLAG_PORT_DISABLED|ATA_FLAG_NOINTR))) { | 205 | !(ap->flags & ATA_FLAG_PORT_DISABLED)) { |
206 | struct ata_queued_cmd *qc; | 206 | struct ata_queued_cmd *qc; |
207 | 207 | ||
208 | qc = ata_qc_from_tag(ap, ap->active_tag); | 208 | qc = ata_qc_from_tag(ap, ap->active_tag); |
209 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) | 209 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) |
210 | handled += ata_host_intr(ap, qc); | 210 | handled += ata_host_intr(ap, qc); |
211 | } | 211 | } |
212 | } | 212 | } |
diff --git a/include/linux/ata.h b/include/linux/ata.h index a8155ca4947f..8e88efc565be 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -197,6 +197,7 @@ enum { | |||
197 | ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ | 197 | ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ |
198 | ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ | 198 | ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ |
199 | ATA_TFLAG_FUA = (1 << 5), /* enable FUA */ | 199 | ATA_TFLAG_FUA = (1 << 5), /* enable FUA */ |
200 | ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */ | ||
200 | }; | 201 | }; |
201 | 202 | ||
202 | enum ata_tf_protocols { | 203 | enum ata_tf_protocols { |
@@ -267,6 +268,8 @@ struct ata_taskfile { | |||
267 | ((u64) (id)[(n) + 1] << 16) | \ | 268 | ((u64) (id)[(n) + 1] << 16) | \ |
268 | ((u64) (id)[(n) + 0]) ) | 269 | ((u64) (id)[(n) + 0]) ) |
269 | 270 | ||
271 | #define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20) | ||
272 | |||
270 | static inline int ata_id_current_chs_valid(const u16 *id) | 273 | static inline int ata_id_current_chs_valid(const u16 *id) |
271 | { | 274 | { |
272 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command | 275 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command |
@@ -296,6 +299,14 @@ static inline int is_atapi_taskfile(const struct ata_taskfile *tf) | |||
296 | (tf->protocol == ATA_PROT_ATAPI_DMA); | 299 | (tf->protocol == ATA_PROT_ATAPI_DMA); |
297 | } | 300 | } |
298 | 301 | ||
302 | static inline int is_multi_taskfile(struct ata_taskfile *tf) | ||
303 | { | ||
304 | return (tf->command == ATA_CMD_READ_MULTI) || | ||
305 | (tf->command == ATA_CMD_WRITE_MULTI) || | ||
306 | (tf->command == ATA_CMD_READ_MULTI_EXT) || | ||
307 | (tf->command == ATA_CMD_WRITE_MULTI_EXT); | ||
308 | } | ||
309 | |||
299 | static inline int ata_ok(u8 status) | 310 | static inline int ata_ok(u8 status) |
300 | { | 311 | { |
301 | return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) | 312 | return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 68b3fe6f9a4d..29c78191ab60 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -134,6 +134,7 @@ enum { | |||
134 | ATA_DFLAG_PIO = (1 << 1), /* device currently in PIO mode */ | 134 | ATA_DFLAG_PIO = (1 << 1), /* device currently in PIO mode */ |
135 | ATA_DFLAG_LOCK_SECTORS = (1 << 2), /* don't adjust max_sectors */ | 135 | ATA_DFLAG_LOCK_SECTORS = (1 << 2), /* don't adjust max_sectors */ |
136 | ATA_DFLAG_LBA = (1 << 3), /* device supports LBA */ | 136 | ATA_DFLAG_LBA = (1 << 3), /* device supports LBA */ |
137 | ATA_DFLAG_CDB_INTR = (1 << 4), /* device asserts INTRQ when ready for CDB */ | ||
137 | 138 | ||
138 | ATA_DEV_UNKNOWN = 0, /* unknown device */ | 139 | ATA_DEV_UNKNOWN = 0, /* unknown device */ |
139 | ATA_DEV_ATA = 1, /* ATA device */ | 140 | ATA_DEV_ATA = 1, /* ATA device */ |
@@ -152,8 +153,8 @@ enum { | |||
152 | ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */ | 153 | ATA_FLAG_MMIO = (1 << 6), /* use MMIO, not PIO */ |
153 | ATA_FLAG_SATA_RESET = (1 << 7), /* (obsolete) use COMRESET */ | 154 | ATA_FLAG_SATA_RESET = (1 << 7), /* (obsolete) use COMRESET */ |
154 | ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */ | 155 | ATA_FLAG_PIO_DMA = (1 << 8), /* PIO cmds via DMA */ |
155 | ATA_FLAG_NOINTR = (1 << 9), /* FIXME: Remove this once | 156 | ATA_FLAG_PIO_POLLING = (1 << 9), /* use polling PIO if LLD |
156 | * proper HSM is in place. */ | 157 | * doesn't handle PIO interrupts */ |
157 | ATA_FLAG_DEBUGMSG = (1 << 10), | 158 | ATA_FLAG_DEBUGMSG = (1 << 10), |
158 | ATA_FLAG_NO_ATAPI = (1 << 11), /* No ATAPI support */ | 159 | ATA_FLAG_NO_ATAPI = (1 << 11), /* No ATAPI support */ |
159 | 160 | ||
@@ -175,6 +176,8 @@ enum { | |||
175 | ATA_TMOUT_PIO = 30 * HZ, | 176 | ATA_TMOUT_PIO = 30 * HZ, |
176 | ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ | 177 | ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ |
177 | ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ | 178 | ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ |
179 | ATA_TMOUT_DATAOUT = 30 * HZ, | ||
180 | ATA_TMOUT_DATAOUT_QUICK = 5 * HZ, | ||
178 | ATA_TMOUT_CDB = 30 * HZ, | 181 | ATA_TMOUT_CDB = 30 * HZ, |
179 | ATA_TMOUT_CDB_QUICK = 5 * HZ, | 182 | ATA_TMOUT_CDB_QUICK = 5 * HZ, |
180 | ATA_TMOUT_INTERNAL = 30 * HZ, | 183 | ATA_TMOUT_INTERNAL = 30 * HZ, |
@@ -214,14 +217,16 @@ enum { | |||
214 | }; | 217 | }; |
215 | 218 | ||
216 | enum hsm_task_states { | 219 | enum hsm_task_states { |
217 | HSM_ST_UNKNOWN, | 220 | HSM_ST_UNKNOWN, /* state unknown */ |
218 | HSM_ST_IDLE, | 221 | HSM_ST_IDLE, /* no command on going */ |
219 | HSM_ST_POLL, | 222 | HSM_ST_POLL, /* same as HSM_ST, waits longer */ |
220 | HSM_ST_TMOUT, | 223 | HSM_ST_TMOUT, /* timeout */ |
221 | HSM_ST, | 224 | HSM_ST, /* (waiting the device to) transfer data */ |
222 | HSM_ST_LAST, | 225 | HSM_ST_LAST, /* (waiting the device to) complete command */ |
223 | HSM_ST_LAST_POLL, | 226 | HSM_ST_LAST_POLL, /* same as HSM_ST_LAST, waits longer */ |
224 | HSM_ST_ERR, | 227 | HSM_ST_ERR, /* error */ |
228 | HSM_ST_FIRST, /* (waiting the device to) | ||
229 | write CDB or first data block */ | ||
225 | }; | 230 | }; |
226 | 231 | ||
227 | enum ata_completion_errors { | 232 | enum ata_completion_errors { |
@@ -397,8 +402,6 @@ struct ata_port { | |||
397 | struct ata_host_stats stats; | 402 | struct ata_host_stats stats; |
398 | struct ata_host_set *host_set; | 403 | struct ata_host_set *host_set; |
399 | 404 | ||
400 | struct work_struct packet_task; | ||
401 | |||
402 | struct work_struct pio_task; | 405 | struct work_struct pio_task; |
403 | unsigned int hsm_task_state; | 406 | unsigned int hsm_task_state; |
404 | unsigned long pio_task_timeout; | 407 | unsigned long pio_task_timeout; |