[PATCH] libata-dev: Convert ata_pio_task() to use the new ata_hsm_move()
Convert ata_pio_task() to use the new ata_hsm_move(). Changes: - refactor ata_pio_task() to poll device status register and - call the new ata_hsm_move() when device indicates it is not BSY. Signed-off-by: Albert Lee <albertcc@tw.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
parent
bb5cb290f0
commit
a1af37344f
|
@ -3986,44 +3986,40 @@ fsm_start:
|
||||||
static void ata_pio_task(void *_data)
|
static void ata_pio_task(void *_data)
|
||||||
{
|
{
|
||||||
struct ata_port *ap = _data;
|
struct ata_port *ap = _data;
|
||||||
unsigned long timeout;
|
struct ata_queued_cmd *qc;
|
||||||
int has_next;
|
u8 status;
|
||||||
|
int poll_next;
|
||||||
|
|
||||||
fsm_start:
|
fsm_start:
|
||||||
timeout = 0;
|
WARN_ON(ap->hsm_task_state == HSM_ST_IDLE);
|
||||||
has_next = 1;
|
|
||||||
|
|
||||||
switch (ap->hsm_task_state) {
|
qc = ata_qc_from_tag(ap, ap->active_tag);
|
||||||
case HSM_ST_FIRST:
|
WARN_ON(qc == NULL);
|
||||||
has_next = ata_pio_first_block(ap);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HSM_ST:
|
/*
|
||||||
ata_pio_block(ap);
|
* This is purely heuristic. This is a fast path.
|
||||||
break;
|
* Sometimes when we enter, BSY will be cleared in
|
||||||
|
* a chk-status or two. If not, the drive is probably seeking
|
||||||
case HSM_ST_LAST:
|
* or something. Snooze for a couple msecs, then
|
||||||
has_next = ata_pio_complete(ap);
|
* chk-status again. If still busy, queue delayed work.
|
||||||
break;
|
*/
|
||||||
|
status = ata_busy_wait(ap, ATA_BUSY, 5);
|
||||||
case HSM_ST_POLL:
|
if (status & ATA_BUSY) {
|
||||||
case HSM_ST_LAST_POLL:
|
msleep(2);
|
||||||
timeout = ata_pio_poll(ap);
|
status = ata_busy_wait(ap, ATA_BUSY, 10);
|
||||||
break;
|
if (status & ATA_BUSY) {
|
||||||
|
ata_port_queue_task(ap, ata_pio_task, ap, ATA_SHORT_PAUSE);
|
||||||
case HSM_ST_TMOUT:
|
return;
|
||||||
case HSM_ST_ERR:
|
}
|
||||||
ata_pio_error(ap);
|
|
||||||
return;
|
|
||||||
|
|
||||||
default:
|
|
||||||
BUG();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeout)
|
/* move the HSM */
|
||||||
ata_port_queue_task(ap, ata_pio_task, ap, timeout);
|
poll_next = ata_hsm_move(ap, qc, status, 1);
|
||||||
else if (has_next)
|
|
||||||
|
/* another command or interrupt handler
|
||||||
|
* may be running at this point.
|
||||||
|
*/
|
||||||
|
if (poll_next)
|
||||||
goto fsm_start;
|
goto fsm_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue