diff options
author | Tejun Heo <htejun@gmail.com> | 2006-04-02 05:51:53 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-04-02 10:09:21 -0400 |
commit | ece1d63619df010b8c4f08e43755e2a03f3b6eed (patch) | |
tree | c6474fe7541d479bf19c36c79700dfa9f6093a8d /drivers/scsi/libata-core.c | |
parent | 35e86b53b1a38e78ff0d70dae4aeb25f4572e433 (diff) |
[PATCH] libata: separate out libata-eh.c
A lot of EH codes are about to be added to libata. Separate out
libata-eh.c. ata_scsi_timed_out(), ata_scsi_error(),
ata_qc_timeout(), ata_eng_timeout(), ata_eh_qc_complete() and
ata_eh_qc_retry() are moved. No code is changed by this patch.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 102 |
1 files changed, 5 insertions, 97 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 66b48b11fa0e..186a9ce4f072 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -4016,99 +4016,6 @@ err_out: | |||
4016 | } | 4016 | } |
4017 | 4017 | ||
4018 | /** | 4018 | /** |
4019 | * ata_qc_timeout - Handle timeout of queued command | ||
4020 | * @qc: Command that timed out | ||
4021 | * | ||
4022 | * Some part of the kernel (currently, only the SCSI layer) | ||
4023 | * has noticed that the active command on port @ap has not | ||
4024 | * completed after a specified length of time. Handle this | ||
4025 | * condition by disabling DMA (if necessary) and completing | ||
4026 | * transactions, with error if necessary. | ||
4027 | * | ||
4028 | * This also handles the case of the "lost interrupt", where | ||
4029 | * for some reason (possibly hardware bug, possibly driver bug) | ||
4030 | * an interrupt was not delivered to the driver, even though the | ||
4031 | * transaction completed successfully. | ||
4032 | * | ||
4033 | * LOCKING: | ||
4034 | * Inherited from SCSI layer (none, can sleep) | ||
4035 | */ | ||
4036 | |||
4037 | static void ata_qc_timeout(struct ata_queued_cmd *qc) | ||
4038 | { | ||
4039 | struct ata_port *ap = qc->ap; | ||
4040 | struct ata_host_set *host_set = ap->host_set; | ||
4041 | u8 host_stat = 0, drv_stat; | ||
4042 | unsigned long flags; | ||
4043 | |||
4044 | DPRINTK("ENTER\n"); | ||
4045 | |||
4046 | ap->hsm_task_state = HSM_ST_IDLE; | ||
4047 | |||
4048 | spin_lock_irqsave(&host_set->lock, flags); | ||
4049 | |||
4050 | switch (qc->tf.protocol) { | ||
4051 | |||
4052 | case ATA_PROT_DMA: | ||
4053 | case ATA_PROT_ATAPI_DMA: | ||
4054 | host_stat = ap->ops->bmdma_status(ap); | ||
4055 | |||
4056 | /* before we do anything else, clear DMA-Start bit */ | ||
4057 | ap->ops->bmdma_stop(qc); | ||
4058 | |||
4059 | /* fall through */ | ||
4060 | |||
4061 | default: | ||
4062 | ata_altstatus(ap); | ||
4063 | drv_stat = ata_chk_status(ap); | ||
4064 | |||
4065 | /* ack bmdma irq events */ | ||
4066 | ap->ops->irq_clear(ap); | ||
4067 | |||
4068 | printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x host_stat 0x%x\n", | ||
4069 | ap->id, qc->tf.command, drv_stat, host_stat); | ||
4070 | |||
4071 | /* complete taskfile transaction */ | ||
4072 | qc->err_mask |= ac_err_mask(drv_stat); | ||
4073 | break; | ||
4074 | } | ||
4075 | |||
4076 | spin_unlock_irqrestore(&host_set->lock, flags); | ||
4077 | |||
4078 | ata_eh_qc_complete(qc); | ||
4079 | |||
4080 | DPRINTK("EXIT\n"); | ||
4081 | } | ||
4082 | |||
4083 | /** | ||
4084 | * ata_eng_timeout - Handle timeout of queued command | ||
4085 | * @ap: Port on which timed-out command is active | ||
4086 | * | ||
4087 | * Some part of the kernel (currently, only the SCSI layer) | ||
4088 | * has noticed that the active command on port @ap has not | ||
4089 | * completed after a specified length of time. Handle this | ||
4090 | * condition by disabling DMA (if necessary) and completing | ||
4091 | * transactions, with error if necessary. | ||
4092 | * | ||
4093 | * This also handles the case of the "lost interrupt", where | ||
4094 | * for some reason (possibly hardware bug, possibly driver bug) | ||
4095 | * an interrupt was not delivered to the driver, even though the | ||
4096 | * transaction completed successfully. | ||
4097 | * | ||
4098 | * LOCKING: | ||
4099 | * Inherited from SCSI layer (none, can sleep) | ||
4100 | */ | ||
4101 | |||
4102 | void ata_eng_timeout(struct ata_port *ap) | ||
4103 | { | ||
4104 | DPRINTK("ENTER\n"); | ||
4105 | |||
4106 | ata_qc_timeout(ata_qc_from_tag(ap, ap->active_tag)); | ||
4107 | |||
4108 | DPRINTK("EXIT\n"); | ||
4109 | } | ||
4110 | |||
4111 | /** | ||
4112 | * ata_qc_new - Request an available ATA command, for queueing | 4019 | * ata_qc_new - Request an available ATA command, for queueing |
4113 | * @ap: Port associated with device @dev | 4020 | * @ap: Port associated with device @dev |
4114 | * @dev: Device from whom we request an available command structure | 4021 | * @dev: Device from whom we request an available command structure |
@@ -5145,7 +5052,6 @@ EXPORT_SYMBOL_GPL(ata_sg_init); | |||
5145 | EXPORT_SYMBOL_GPL(ata_sg_init_one); | 5052 | EXPORT_SYMBOL_GPL(ata_sg_init_one); |
5146 | EXPORT_SYMBOL_GPL(__ata_qc_complete); | 5053 | EXPORT_SYMBOL_GPL(__ata_qc_complete); |
5147 | EXPORT_SYMBOL_GPL(ata_qc_issue_prot); | 5054 | EXPORT_SYMBOL_GPL(ata_qc_issue_prot); |
5148 | EXPORT_SYMBOL_GPL(ata_eng_timeout); | ||
5149 | EXPORT_SYMBOL_GPL(ata_tf_load); | 5055 | EXPORT_SYMBOL_GPL(ata_tf_load); |
5150 | EXPORT_SYMBOL_GPL(ata_tf_read); | 5056 | EXPORT_SYMBOL_GPL(ata_tf_read); |
5151 | EXPORT_SYMBOL_GPL(ata_noop_dev_select); | 5057 | EXPORT_SYMBOL_GPL(ata_noop_dev_select); |
@@ -5185,15 +5091,12 @@ EXPORT_SYMBOL_GPL(ata_busy_sleep); | |||
5185 | EXPORT_SYMBOL_GPL(ata_port_queue_task); | 5091 | EXPORT_SYMBOL_GPL(ata_port_queue_task); |
5186 | EXPORT_SYMBOL_GPL(ata_scsi_ioctl); | 5092 | EXPORT_SYMBOL_GPL(ata_scsi_ioctl); |
5187 | EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); | 5093 | EXPORT_SYMBOL_GPL(ata_scsi_queuecmd); |
5188 | EXPORT_SYMBOL_GPL(ata_scsi_error); | ||
5189 | EXPORT_SYMBOL_GPL(ata_scsi_slave_config); | 5094 | EXPORT_SYMBOL_GPL(ata_scsi_slave_config); |
5190 | EXPORT_SYMBOL_GPL(ata_scsi_release); | 5095 | EXPORT_SYMBOL_GPL(ata_scsi_release); |
5191 | EXPORT_SYMBOL_GPL(ata_host_intr); | 5096 | EXPORT_SYMBOL_GPL(ata_host_intr); |
5192 | EXPORT_SYMBOL_GPL(ata_id_string); | 5097 | EXPORT_SYMBOL_GPL(ata_id_string); |
5193 | EXPORT_SYMBOL_GPL(ata_id_c_string); | 5098 | EXPORT_SYMBOL_GPL(ata_id_c_string); |
5194 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); | 5099 | EXPORT_SYMBOL_GPL(ata_scsi_simulate); |
5195 | EXPORT_SYMBOL_GPL(ata_eh_qc_complete); | ||
5196 | EXPORT_SYMBOL_GPL(ata_eh_qc_retry); | ||
5197 | 5100 | ||
5198 | EXPORT_SYMBOL_GPL(ata_pio_need_iordy); | 5101 | EXPORT_SYMBOL_GPL(ata_pio_need_iordy); |
5199 | EXPORT_SYMBOL_GPL(ata_timing_compute); | 5102 | EXPORT_SYMBOL_GPL(ata_timing_compute); |
@@ -5215,3 +5118,8 @@ EXPORT_SYMBOL_GPL(ata_device_suspend); | |||
5215 | EXPORT_SYMBOL_GPL(ata_device_resume); | 5118 | EXPORT_SYMBOL_GPL(ata_device_resume); |
5216 | EXPORT_SYMBOL_GPL(ata_scsi_device_suspend); | 5119 | EXPORT_SYMBOL_GPL(ata_scsi_device_suspend); |
5217 | EXPORT_SYMBOL_GPL(ata_scsi_device_resume); | 5120 | EXPORT_SYMBOL_GPL(ata_scsi_device_resume); |
5121 | |||
5122 | EXPORT_SYMBOL_GPL(ata_scsi_error); | ||
5123 | EXPORT_SYMBOL_GPL(ata_eng_timeout); | ||
5124 | EXPORT_SYMBOL_GPL(ata_eh_qc_complete); | ||
5125 | EXPORT_SYMBOL_GPL(ata_eh_qc_retry); | ||