aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libata-core.c
diff options
context:
space:
mode:
authorAlbert Lee <albertcc@tw.ibm.com>2005-09-27 05:36:35 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-28 11:58:39 -0400
commit14be71f4c5c5ad1e222c5202ee6d234e9c8828b7 (patch)
tree715ac051b4fd2e3d62219110be4fc71d2f1a06f8 /drivers/scsi/libata-core.c
parentee500aabf10323a7e313731b8c0be7c2c6dd27c7 (diff)
[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>
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r--drivers/scsi/libata-core.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index cc68f5706acf..c4fcdc30f18c 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -2425,20 +2425,20 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
2425static unsigned long ata_pio_poll(struct ata_port *ap) 2425static unsigned long ata_pio_poll(struct ata_port *ap)
2426{ 2426{
2427 u8 status; 2427 u8 status;
2428 unsigned int poll_state = PIO_ST_UNKNOWN; 2428 unsigned int poll_state = HSM_ST_UNKNOWN;
2429 unsigned int reg_state = PIO_ST_UNKNOWN; 2429 unsigned int reg_state = HSM_ST_UNKNOWN;
2430 const unsigned int tmout_state = PIO_ST_TMOUT; 2430 const unsigned int tmout_state = HSM_ST_TMOUT;
2431 2431
2432 switch (ap->pio_task_state) { 2432 switch (ap->hsm_task_state) {
2433 case PIO_ST: 2433 case HSM_ST:
2434 case PIO_ST_POLL: 2434 case HSM_ST_POLL:
2435 poll_state = PIO_ST_POLL; 2435 poll_state = HSM_ST_POLL;
2436 reg_state = PIO_ST; 2436 reg_state = HSM_ST;
2437 break; 2437 break;
2438 case PIO_ST_LAST: 2438 case HSM_ST_LAST:
2439 case PIO_ST_LAST_POLL: 2439 case HSM_ST_LAST_POLL:
2440 poll_state = PIO_ST_LAST_POLL; 2440 poll_state = HSM_ST_LAST_POLL;
2441 reg_state = PIO_ST_LAST; 2441 reg_state = HSM_ST_LAST;
2442 break; 2442 break;
2443 default: 2443 default:
2444 BUG(); 2444 BUG();
@@ -2448,14 +2448,14 @@ static unsigned long ata_pio_poll(struct ata_port *ap)
2448 status = ata_chk_status(ap); 2448 status = ata_chk_status(ap);
2449 if (status & ATA_BUSY) { 2449 if (status & ATA_BUSY) {
2450 if (time_after(jiffies, ap->pio_task_timeout)) { 2450 if (time_after(jiffies, ap->pio_task_timeout)) {
2451 ap->pio_task_state = tmout_state; 2451 ap->hsm_task_state = tmout_state;
2452 return 0; 2452 return 0;
2453 } 2453 }
2454 ap->pio_task_state = poll_state; 2454 ap->hsm_task_state = poll_state;
2455 return ATA_SHORT_PAUSE; 2455 return ATA_SHORT_PAUSE;
2456 } 2456 }
2457 2457
2458 ap->pio_task_state = reg_state; 2458 ap->hsm_task_state = reg_state;
2459 return 0; 2459 return 0;
2460} 2460}
2461 2461
@@ -2480,14 +2480,14 @@ static int ata_pio_complete (struct ata_port *ap)
2480 * we enter, BSY will be cleared in a chk-status or two. If not, 2480 * we enter, BSY will be cleared in a chk-status or two. If not,
2481 * the drive is probably seeking or something. Snooze for a couple 2481 * the drive is probably seeking or something. Snooze for a couple
2482 * msecs, then chk-status again. If still busy, fall back to 2482 * msecs, then chk-status again. If still busy, fall back to
2483 * PIO_ST_POLL state. 2483 * HSM_ST_POLL state.
2484 */ 2484 */
2485 drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10); 2485 drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10);
2486 if (drv_stat & (ATA_BUSY | ATA_DRQ)) { 2486 if (drv_stat & (ATA_BUSY | ATA_DRQ)) {
2487 msleep(2); 2487 msleep(2);
2488 drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10); 2488 drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10);
2489 if (drv_stat & (ATA_BUSY | ATA_DRQ)) { 2489 if (drv_stat & (ATA_BUSY | ATA_DRQ)) {
2490 ap->pio_task_state = PIO_ST_LAST_POLL; 2490 ap->hsm_task_state = HSM_ST_LAST_POLL;
2491 ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO; 2491 ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO;
2492 return 0; 2492 return 0;
2493 } 2493 }
@@ -2495,14 +2495,14 @@ static int ata_pio_complete (struct ata_port *ap)
2495 2495
2496 drv_stat = ata_wait_idle(ap); 2496 drv_stat = ata_wait_idle(ap);
2497 if (!ata_ok(drv_stat)) { 2497 if (!ata_ok(drv_stat)) {
2498 ap->pio_task_state = PIO_ST_ERR; 2498 ap->hsm_task_state = HSM_ST_ERR;
2499 return 0; 2499 return 0;
2500 } 2500 }
2501 2501
2502 qc = ata_qc_from_tag(ap, ap->active_tag); 2502 qc = ata_qc_from_tag(ap, ap->active_tag);
2503 assert(qc != NULL); 2503 assert(qc != NULL);
2504 2504
2505 ap->pio_task_state = PIO_ST_IDLE; 2505 ap->hsm_task_state = HSM_ST_IDLE;
2506 2506
2507 ata_poll_qc_complete(qc, drv_stat); 2507 ata_poll_qc_complete(qc, drv_stat);
2508 2508
@@ -2662,7 +2662,7 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
2662 unsigned char *buf; 2662 unsigned char *buf;
2663 2663
2664 if (qc->cursect == (qc->nsect - 1)) 2664 if (qc->cursect == (qc->nsect - 1))
2665 ap->pio_task_state = PIO_ST_LAST; 2665 ap->hsm_task_state = HSM_ST_LAST;
2666 2666
2667 page = sg[qc->cursg].page; 2667 page = sg[qc->cursg].page;
2668 offset = sg[qc->cursg].offset + qc->cursg_ofs * ATA_SECT_SIZE; 2668 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)
2712 unsigned int offset, count; 2712 unsigned int offset, count;
2713 2713
2714 if (qc->curbytes + bytes >= qc->nbytes) 2714 if (qc->curbytes + bytes >= qc->nbytes)
2715 ap->pio_task_state = PIO_ST_LAST; 2715 ap->hsm_task_state = HSM_ST_LAST;
2716 2716
2717next_sg: 2717next_sg:
2718 if (unlikely(qc->cursg >= qc->n_elem)) { 2718 if (unlikely(qc->cursg >= qc->n_elem)) {
@@ -2734,7 +2734,7 @@ next_sg:
2734 for (i = 0; i < words; i++) 2734 for (i = 0; i < words; i++)
2735 ata_data_xfer(ap, (unsigned char*)pad_buf, 2, do_write); 2735 ata_data_xfer(ap, (unsigned char*)pad_buf, 2, do_write);
2736 2736
2737 ap->pio_task_state = PIO_ST_LAST; 2737 ap->hsm_task_state = HSM_ST_LAST;
2738 return; 2738 return;
2739 } 2739 }
2740 2740
@@ -2815,7 +2815,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
2815err_out: 2815err_out:
2816 printk(KERN_INFO "ata%u: dev %u: ATAPI check failed\n", 2816 printk(KERN_INFO "ata%u: dev %u: ATAPI check failed\n",
2817 ap->id, dev->devno); 2817 ap->id, dev->devno);
2818 ap->pio_task_state = PIO_ST_ERR; 2818 ap->hsm_task_state = HSM_ST_ERR;
2819} 2819}
2820 2820
2821/** 2821/**
@@ -2837,14 +2837,14 @@ static void ata_pio_block(struct ata_port *ap)
2837 * a chk-status or two. If not, the drive is probably seeking 2837 * a chk-status or two. If not, the drive is probably seeking
2838 * or something. Snooze for a couple msecs, then 2838 * or something. Snooze for a couple msecs, then
2839 * chk-status again. If still busy, fall back to 2839 * chk-status again. If still busy, fall back to
2840 * PIO_ST_POLL state. 2840 * HSM_ST_POLL state.
2841 */ 2841 */
2842 status = ata_busy_wait(ap, ATA_BUSY, 5); 2842 status = ata_busy_wait(ap, ATA_BUSY, 5);
2843 if (status & ATA_BUSY) { 2843 if (status & ATA_BUSY) {
2844 msleep(2); 2844 msleep(2);
2845 status = ata_busy_wait(ap, ATA_BUSY, 10); 2845 status = ata_busy_wait(ap, ATA_BUSY, 10);
2846 if (status & ATA_BUSY) { 2846 if (status & ATA_BUSY) {
2847 ap->pio_task_state = PIO_ST_POLL; 2847 ap->hsm_task_state = HSM_ST_POLL;
2848 ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO; 2848 ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO;
2849 return; 2849 return;
2850 } 2850 }
@@ -2856,7 +2856,7 @@ static void ata_pio_block(struct ata_port *ap)
2856 if (is_atapi_taskfile(&qc->tf)) { 2856 if (is_atapi_taskfile(&qc->tf)) {
2857 /* no more data to transfer or unsupported ATAPI command */ 2857 /* no more data to transfer or unsupported ATAPI command */
2858 if ((status & ATA_DRQ) == 0) { 2858 if ((status & ATA_DRQ) == 0) {
2859 ap->pio_task_state = PIO_ST_LAST; 2859 ap->hsm_task_state = HSM_ST_LAST;
2860 return; 2860 return;
2861 } 2861 }
2862 2862
@@ -2864,7 +2864,7 @@ static void ata_pio_block(struct ata_port *ap)
2864 } else { 2864 } else {
2865 /* handle BSY=0, DRQ=0 as error */ 2865 /* handle BSY=0, DRQ=0 as error */
2866 if ((status & ATA_DRQ) == 0) { 2866 if ((status & ATA_DRQ) == 0) {
2867 ap->pio_task_state = PIO_ST_ERR; 2867 ap->hsm_task_state = HSM_ST_ERR;
2868 return; 2868 return;
2869 } 2869 }
2870 2870
@@ -2884,7 +2884,7 @@ static void ata_pio_error(struct ata_port *ap)
2884 printk(KERN_WARNING "ata%u: PIO error, drv_stat 0x%x\n", 2884 printk(KERN_WARNING "ata%u: PIO error, drv_stat 0x%x\n",
2885 ap->id, drv_stat); 2885 ap->id, drv_stat);
2886 2886
2887 ap->pio_task_state = PIO_ST_IDLE; 2887 ap->hsm_task_state = HSM_ST_IDLE;
2888 2888
2889 ata_poll_qc_complete(qc, drv_stat | ATA_ERR); 2889 ata_poll_qc_complete(qc, drv_stat | ATA_ERR);
2890} 2890}
@@ -2899,25 +2899,25 @@ fsm_start:
2899 timeout = 0; 2899 timeout = 0;
2900 qc_completed = 0; 2900 qc_completed = 0;
2901 2901
2902 switch (ap->pio_task_state) { 2902 switch (ap->hsm_task_state) {
2903 case PIO_ST_IDLE: 2903 case HSM_ST_IDLE:
2904 return; 2904 return;
2905 2905
2906 case PIO_ST: 2906 case HSM_ST:
2907 ata_pio_block(ap); 2907 ata_pio_block(ap);
2908 break; 2908 break;
2909 2909
2910 case PIO_ST_LAST: 2910 case HSM_ST_LAST:
2911 qc_completed = ata_pio_complete(ap); 2911 qc_completed = ata_pio_complete(ap);
2912 break; 2912 break;
2913 2913
2914 case PIO_ST_POLL: 2914 case HSM_ST_POLL:
2915 case PIO_ST_LAST_POLL: 2915 case HSM_ST_LAST_POLL:
2916 timeout = ata_pio_poll(ap); 2916 timeout = ata_pio_poll(ap);
2917 break; 2917 break;
2918 2918
2919 case PIO_ST_TMOUT: 2919 case HSM_ST_TMOUT:
2920 case PIO_ST_ERR: 2920 case HSM_ST_ERR:
2921 ata_pio_error(ap); 2921 ata_pio_error(ap);
2922 return; 2922 return;
2923 } 2923 }
@@ -3360,7 +3360,7 @@ int ata_qc_issue_prot(struct ata_queued_cmd *qc)
3360 case ATA_PROT_PIO: /* load tf registers, initiate polling pio */ 3360 case ATA_PROT_PIO: /* load tf registers, initiate polling pio */
3361 ata_qc_set_polling(qc); 3361 ata_qc_set_polling(qc);
3362 ata_tf_to_host_nolock(ap, &qc->tf); 3362 ata_tf_to_host_nolock(ap, &qc->tf);
3363 ap->pio_task_state = PIO_ST; 3363 ap->hsm_task_state = HSM_ST;
3364 queue_work(ata_wq, &ap->pio_task); 3364 queue_work(ata_wq, &ap->pio_task);
3365 break; 3365 break;
3366 3366
@@ -3806,7 +3806,7 @@ static void atapi_packet_task(void *_data)
3806 ata_data_xfer(ap, qc->cdb, ap->cdb_len, 1); 3806 ata_data_xfer(ap, qc->cdb, ap->cdb_len, 1);
3807 3807
3808 /* PIO commands are handled by polling */ 3808 /* PIO commands are handled by polling */
3809 ap->pio_task_state = PIO_ST; 3809 ap->hsm_task_state = HSM_ST;
3810 queue_work(ata_wq, &ap->pio_task); 3810 queue_work(ata_wq, &ap->pio_task);
3811 } 3811 }
3812 3812