[PATCH] libata: rename host states

Changes:
s/PIO_ST_/HSM_ST_/ and s/pio_task_state/hsm_task_state/.

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
This commit is contained in:
Albert Lee 2005-09-27 17:36:35 +08:00 committed by Jeff Garzik
parent ee500aabf1
commit 14be71f4c5
2 changed files with 48 additions and 48 deletions

View file

@ -2425,20 +2425,20 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
static unsigned long ata_pio_poll(struct ata_port *ap) static unsigned long ata_pio_poll(struct ata_port *ap)
{ {
u8 status; u8 status;
unsigned int poll_state = PIO_ST_UNKNOWN; unsigned int poll_state = HSM_ST_UNKNOWN;
unsigned int reg_state = PIO_ST_UNKNOWN; unsigned int reg_state = HSM_ST_UNKNOWN;
const unsigned int tmout_state = PIO_ST_TMOUT; const unsigned int tmout_state = HSM_ST_TMOUT;
switch (ap->pio_task_state) { switch (ap->hsm_task_state) {
case PIO_ST: case HSM_ST:
case PIO_ST_POLL: case HSM_ST_POLL:
poll_state = PIO_ST_POLL; poll_state = HSM_ST_POLL;
reg_state = PIO_ST; reg_state = HSM_ST;
break; break;
case PIO_ST_LAST: case HSM_ST_LAST:
case PIO_ST_LAST_POLL: case HSM_ST_LAST_POLL:
poll_state = PIO_ST_LAST_POLL; poll_state = HSM_ST_LAST_POLL;
reg_state = PIO_ST_LAST; reg_state = HSM_ST_LAST;
break; break;
default: default:
BUG(); BUG();
@ -2448,14 +2448,14 @@ static unsigned long ata_pio_poll(struct ata_port *ap)
status = ata_chk_status(ap); status = ata_chk_status(ap);
if (status & ATA_BUSY) { if (status & ATA_BUSY) {
if (time_after(jiffies, ap->pio_task_timeout)) { if (time_after(jiffies, ap->pio_task_timeout)) {
ap->pio_task_state = tmout_state; ap->hsm_task_state = tmout_state;
return 0; return 0;
} }
ap->pio_task_state = poll_state; ap->hsm_task_state = poll_state;
return ATA_SHORT_PAUSE; return ATA_SHORT_PAUSE;
} }
ap->pio_task_state = reg_state; ap->hsm_task_state = reg_state;
return 0; return 0;
} }
@ -2480,14 +2480,14 @@ static int ata_pio_complete (struct ata_port *ap)
* we enter, BSY will be cleared in a chk-status or two. If not, * we enter, BSY will be cleared in a chk-status or two. If not,
* the drive is probably seeking or something. Snooze for a couple * the drive is probably seeking or something. Snooze for a couple
* msecs, then chk-status again. If still busy, fall back to * msecs, then chk-status again. If still busy, fall back to
* PIO_ST_POLL state. * HSM_ST_POLL state.
*/ */
drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10); drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10);
if (drv_stat & (ATA_BUSY | ATA_DRQ)) { if (drv_stat & (ATA_BUSY | ATA_DRQ)) {
msleep(2); msleep(2);
drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10); drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10);
if (drv_stat & (ATA_BUSY | ATA_DRQ)) { if (drv_stat & (ATA_BUSY | ATA_DRQ)) {
ap->pio_task_state = PIO_ST_LAST_POLL; ap->hsm_task_state = HSM_ST_LAST_POLL;
ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO; ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO;
return 0; return 0;
} }
@ -2495,14 +2495,14 @@ static int ata_pio_complete (struct ata_port *ap)
drv_stat = ata_wait_idle(ap); drv_stat = ata_wait_idle(ap);
if (!ata_ok(drv_stat)) { if (!ata_ok(drv_stat)) {
ap->pio_task_state = PIO_ST_ERR; ap->hsm_task_state = HSM_ST_ERR;
return 0; return 0;
} }
qc = ata_qc_from_tag(ap, ap->active_tag); qc = ata_qc_from_tag(ap, ap->active_tag);
assert(qc != NULL); assert(qc != NULL);
ap->pio_task_state = PIO_ST_IDLE; ap->hsm_task_state = HSM_ST_IDLE;
ata_poll_qc_complete(qc, drv_stat); ata_poll_qc_complete(qc, drv_stat);
@ -2662,7 +2662,7 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
unsigned char *buf; unsigned char *buf;
if (qc->cursect == (qc->nsect - 1)) if (qc->cursect == (qc->nsect - 1))
ap->pio_task_state = PIO_ST_LAST; ap->hsm_task_state = HSM_ST_LAST;
page = sg[qc->cursg].page; page = sg[qc->cursg].page;
offset = sg[qc->cursg].offset + qc->cursg_ofs * ATA_SECT_SIZE; offset = sg[qc->cursg].offset + qc->cursg_ofs * ATA_SECT_SIZE;
@ -2712,7 +2712,7 @@ static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
unsigned int offset, count; unsigned int offset, count;
if (qc->curbytes + bytes >= qc->nbytes) if (qc->curbytes + bytes >= qc->nbytes)
ap->pio_task_state = PIO_ST_LAST; ap->hsm_task_state = HSM_ST_LAST;
next_sg: next_sg:
if (unlikely(qc->cursg >= qc->n_elem)) { if (unlikely(qc->cursg >= qc->n_elem)) {
@ -2734,7 +2734,7 @@ static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
for (i = 0; i < words; i++) for (i = 0; i < words; i++)
ata_data_xfer(ap, (unsigned char*)pad_buf, 2, do_write); ata_data_xfer(ap, (unsigned char*)pad_buf, 2, do_write);
ap->pio_task_state = PIO_ST_LAST; ap->hsm_task_state = HSM_ST_LAST;
return; return;
} }
@ -2815,7 +2815,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
err_out: err_out:
printk(KERN_INFO "ata%u: dev %u: ATAPI check failed\n", printk(KERN_INFO "ata%u: dev %u: ATAPI check failed\n",
ap->id, dev->devno); ap->id, dev->devno);
ap->pio_task_state = PIO_ST_ERR; ap->hsm_task_state = HSM_ST_ERR;
} }
/** /**
@ -2837,14 +2837,14 @@ static void ata_pio_block(struct ata_port *ap)
* a chk-status or two. If not, the drive is probably seeking * a chk-status or two. If not, the drive is probably seeking
* or something. Snooze for a couple msecs, then * or something. Snooze for a couple msecs, then
* chk-status again. If still busy, fall back to * chk-status again. If still busy, fall back to
* PIO_ST_POLL state. * HSM_ST_POLL state.
*/ */
status = ata_busy_wait(ap, ATA_BUSY, 5); status = ata_busy_wait(ap, ATA_BUSY, 5);
if (status & ATA_BUSY) { if (status & ATA_BUSY) {
msleep(2); msleep(2);
status = ata_busy_wait(ap, ATA_BUSY, 10); status = ata_busy_wait(ap, ATA_BUSY, 10);
if (status & ATA_BUSY) { if (status & ATA_BUSY) {
ap->pio_task_state = PIO_ST_POLL; ap->hsm_task_state = HSM_ST_POLL;
ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO; ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO;
return; return;
} }
@ -2856,7 +2856,7 @@ static void ata_pio_block(struct ata_port *ap)
if (is_atapi_taskfile(&qc->tf)) { if (is_atapi_taskfile(&qc->tf)) {
/* no more data to transfer or unsupported ATAPI command */ /* no more data to transfer or unsupported ATAPI command */
if ((status & ATA_DRQ) == 0) { if ((status & ATA_DRQ) == 0) {
ap->pio_task_state = PIO_ST_LAST; ap->hsm_task_state = HSM_ST_LAST;
return; return;
} }
@ -2864,7 +2864,7 @@ static void ata_pio_block(struct ata_port *ap)
} else { } else {
/* handle BSY=0, DRQ=0 as error */ /* handle BSY=0, DRQ=0 as error */
if ((status & ATA_DRQ) == 0) { if ((status & ATA_DRQ) == 0) {
ap->pio_task_state = PIO_ST_ERR; ap->hsm_task_state = HSM_ST_ERR;
return; return;
} }
@ -2884,7 +2884,7 @@ static void ata_pio_error(struct ata_port *ap)
printk(KERN_WARNING "ata%u: PIO error, drv_stat 0x%x\n", printk(KERN_WARNING "ata%u: PIO error, drv_stat 0x%x\n",
ap->id, drv_stat); ap->id, drv_stat);
ap->pio_task_state = PIO_ST_IDLE; ap->hsm_task_state = HSM_ST_IDLE;
ata_poll_qc_complete(qc, drv_stat | ATA_ERR); ata_poll_qc_complete(qc, drv_stat | ATA_ERR);
} }
@ -2899,25 +2899,25 @@ static void ata_pio_task(void *_data)
timeout = 0; timeout = 0;
qc_completed = 0; qc_completed = 0;
switch (ap->pio_task_state) { switch (ap->hsm_task_state) {
case PIO_ST_IDLE: case HSM_ST_IDLE:
return; return;
case PIO_ST: case HSM_ST:
ata_pio_block(ap); ata_pio_block(ap);
break; break;
case PIO_ST_LAST: case HSM_ST_LAST:
qc_completed = ata_pio_complete(ap); qc_completed = ata_pio_complete(ap);
break; break;
case PIO_ST_POLL: case HSM_ST_POLL:
case PIO_ST_LAST_POLL: case HSM_ST_LAST_POLL:
timeout = ata_pio_poll(ap); timeout = ata_pio_poll(ap);
break; break;
case PIO_ST_TMOUT: case HSM_ST_TMOUT:
case PIO_ST_ERR: case HSM_ST_ERR:
ata_pio_error(ap); ata_pio_error(ap);
return; return;
} }
@ -3360,7 +3360,7 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc)
case ATA_PROT_PIO: /* load tf registers, initiate polling pio */ case ATA_PROT_PIO: /* load tf registers, initiate polling pio */
ata_qc_set_polling(qc); ata_qc_set_polling(qc);
ata_tf_to_host_nolock(ap, &qc->tf); ata_tf_to_host_nolock(ap, &qc->tf);
ap->pio_task_state = PIO_ST; ap->hsm_task_state = HSM_ST;
queue_work(ata_wq, &ap->pio_task); queue_work(ata_wq, &ap->pio_task);
break; break;
@ -3806,7 +3806,7 @@ static void atapi_packet_task(void *_data)
ata_data_xfer(ap, qc->cdb, ap->cdb_len, 1); ata_data_xfer(ap, qc->cdb, ap->cdb_len, 1);
/* PIO commands are handled by polling */ /* PIO commands are handled by polling */
ap->pio_task_state = PIO_ST; ap->hsm_task_state = HSM_ST;
queue_work(ata_wq, &ap->pio_task); queue_work(ata_wq, &ap->pio_task);
} }

View file

@ -156,15 +156,15 @@ enum {
ATA_SHIFT_PIO = 11, ATA_SHIFT_PIO = 11,
}; };
enum pio_task_states { enum hsm_task_states {
PIO_ST_UNKNOWN, HSM_ST_UNKNOWN,
PIO_ST_IDLE, HSM_ST_IDLE,
PIO_ST_POLL, HSM_ST_POLL,
PIO_ST_TMOUT, HSM_ST_TMOUT,
PIO_ST, HSM_ST,
PIO_ST_LAST, HSM_ST_LAST,
PIO_ST_LAST_POLL, HSM_ST_LAST_POLL,
PIO_ST_ERR, HSM_ST_ERR,
}; };
/* forward declarations */ /* forward declarations */
@ -319,7 +319,7 @@ struct ata_port {
struct work_struct packet_task; struct work_struct packet_task;
struct work_struct pio_task; struct work_struct pio_task;
unsigned int pio_task_state; unsigned int hsm_task_state;
unsigned long pio_task_timeout; unsigned long pio_task_timeout;
void *private_data; void *private_data;