From: "Albert Lee" <albertcc@tw.ibm.com>
To: Doug Maxey <dwm@maxeymade.com>, IDE Linux <linux-ide@vger.kernel.org>
Subject: [PATCH] libata PIO error handling fix
Date: Mon, 6 Dec 2004 16:46:05 +0800 [thread overview]
Message-ID: <00bc01c4db70$07599cf0$a3564109@tw.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2188 bytes --]
Hi, Jeff:
I tried to burn CD-RW with libata-dev-2.6 and cdrecord:
1. ATAPI DMA mode - test OK
2. ATAPI PIO mode - test failed when cdrecord finishes burning and issues MODE_SELECT to the device.
After checking the log, it shows that MODE_SELECT causes ata_pio_complete() to return error.
However, the error is not handled by ata_pio_task().
Attached please find the patch for ata_pio_task() error handling for your review.
(The patch is against the libata-dev-2.6 tree. )
Changes in the patch:
1. End the PIO task when PIO_ST_IDLE state is entered
2. End the PIO task after PIO_ST_TMOUT and PIO_ST_ERR state handled by ata_pio_error()
3. Remove the first "if" statement to handle the error condition returned from
ata_pio_block(), ata_pio_complete() and ata_pio_poll().
Change #2 is not necessary since ata_pio_error() will put the cmd to PIO_ST_IDLE state
after the error condition is handled. The change just saves a function call to queue_work().
Tested OK on on my machine with pdc20275 and ASUS CD-RW drive.
Albert
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
------------------------------------------------------------------------------------
diff -Nru libata-dev-2.6-ori/drivers/scsi/libata-core.c libata-dev-2.6/drivers/scsi/libata-core.c
--- libata-dev-2.6-ori/drivers/scsi/libata-core.c 2004-11-30 12:52:28.000000000 +0800
+++ libata-dev-2.6/drivers/scsi/libata-core.c 2004-12-02 18:57:48.719220063 +0800
@@ -2399,6 +2399,9 @@
unsigned long timeout = 0;
switch (ap->pio_task_state) {
+ case PIO_ST_IDLE:
+ return;
+
case PIO_ST:
ata_pio_block(ap);
break;
@@ -2415,18 +2418,14 @@
case PIO_ST_TMOUT:
case PIO_ST_ERR:
ata_pio_error(ap);
- break;
+ return;
}
- if ((ap->pio_task_state != PIO_ST_IDLE) &&
- (ap->pio_task_state != PIO_ST_TMOUT) &&
- (ap->pio_task_state != PIO_ST_ERR)) {
- if (timeout)
- queue_delayed_work(ata_wq, &ap->pio_task,
- timeout);
- else
- queue_work(ata_wq, &ap->pio_task);
- }
+ if (timeout)
+ queue_delayed_work(ata_wq, &ap->pio_task,
+ timeout);
+ else
+ queue_work(ata_wq, &ap->pio_task);
}
static void atapi_request_sense(struct ata_port *ap, struct ata_device *dev,
[-- Attachment #2: ata_pio_task.patch --]
[-- Type: application/octet-stream, Size: 1055 bytes --]
diff -Nru libata-dev-2.6-ori/drivers/scsi/libata-core.c libata-dev-2.6/drivers/scsi/libata-core.c
--- libata-dev-2.6-ori/drivers/scsi/libata-core.c 2004-11-30 12:52:28.000000000 +0800
+++ libata-dev-2.6/drivers/scsi/libata-core.c 2004-12-02 18:57:48.719220063 +0800
@@ -2399,6 +2399,9 @@
unsigned long timeout = 0;
switch (ap->pio_task_state) {
+ case PIO_ST_IDLE:
+ return;
+
case PIO_ST:
ata_pio_block(ap);
break;
@@ -2415,18 +2418,14 @@
case PIO_ST_TMOUT:
case PIO_ST_ERR:
ata_pio_error(ap);
- break;
+ return;
}
- if ((ap->pio_task_state != PIO_ST_IDLE) &&
- (ap->pio_task_state != PIO_ST_TMOUT) &&
- (ap->pio_task_state != PIO_ST_ERR)) {
- if (timeout)
- queue_delayed_work(ata_wq, &ap->pio_task,
- timeout);
- else
- queue_work(ata_wq, &ap->pio_task);
- }
+ if (timeout)
+ queue_delayed_work(ata_wq, &ap->pio_task,
+ timeout);
+ else
+ queue_work(ata_wq, &ap->pio_task);
}
static void atapi_request_sense(struct ata_port *ap, struct ata_device *dev,
[-- Attachment #3: ata_pio_complete.log --]
[-- Type: application/octet-stream, Size: 2938 bytes --]
Dec 2 15:42:54 p4ht-s kernel: ata_scsi_dump_cdb: CDB (1:0,0,0) 35 00 00 00 00 00 00 00 00
Dec 2 15:42:54 p4ht-s kernel: ata_scsi_translate: ENTER
Dec 2 15:42:54 p4ht-s kernel: ata_dev_select: ENTER, ata1: device 0, wait 1
Dec 2 15:42:54 p4ht-s kernel: ata_tf_load_pio: feat 0x0 nsect 0x0 lba 0x0 0x0 0x20
Dec 2 15:42:54 p4ht-s kernel: ata_tf_load_pio: device 0xA0
Dec 2 15:42:54 p4ht-s kernel: ata_exec_command_pio: ata1: cmd 0xA0
Dec 2 15:42:54 p4ht-s kernel: ata_scsi_translate: EXIT
Dec 2 15:42:54 p4ht-s kernel: atapi_packet_task: busy wait
Dec 2 15:42:54 p4ht-s kernel: atapi_packet_task: send cdb
Dec 2 15:42:54 p4ht-s kernel: ata_host_intr: ata1: protocol 6 (dev_stat 0x50)
Dec 2 15:42:54 p4ht-s kernel: ata_qc_complete: EXIT
Dec 2 15:42:54 p4ht-s kernel: ata_scsi_dump_cdb: CDB (1:0,0,0) 00 00 00 00 00 00 00 00 00
Dec 2 15:42:54 p4ht-s kernel: ata_scsi_translate: ENTER
Dec 2 15:42:54 p4ht-s kernel: ata_dev_select: ENTER, ata1: device 0, wait 1
Dec 2 15:42:54 p4ht-s kernel: ata_tf_load_pio: feat 0x0 nsect 0x0 lba 0x0 0x0 0x20
Dec 2 15:42:54 p4ht-s kernel: ata_tf_load_pio: device 0xA0
Dec 2 15:42:54 p4ht-s kernel: ata_exec_command_pio: ata1: cmd 0xA0
Dec 2 15:42:54 p4ht-s kernel: ata_scsi_translate: EXIT
Dec 2 15:42:54 p4ht-s kernel: atapi_packet_task: busy wait
Dec 2 15:42:54 p4ht-s kernel: atapi_packet_task: send cdb
Dec 2 15:42:54 p4ht-s kernel: ata_host_intr: ata1: protocol 6 (dev_stat 0x50)
Dec 2 15:42:54 p4ht-s kernel: ata_qc_complete: EXIT
Dec 2 15:42:54 p4ht-s kernel: ata_scsi_dump_cdb: CDB (1:0,0,0) 55 10 00 00 00 00 00 00 10
Dec 2 15:42:54 p4ht-s kernel: ata_scsi_translate: ENTER
Dec 2 15:42:54 p4ht-s kernel: atapi_xlat: direction: write
Dec 2 15:42:54 p4ht-s kernel: ata_sg_setup: ENTER, ata1
Dec 2 15:42:54 p4ht-s kernel: ata_sg_setup: 1 sg elements mapped
Dec 2 15:42:54 p4ht-s kernel: ata_fill_sg: PRD[0] = (0x10922000, 0x10)
Dec 2 15:42:54 p4ht-s kernel: ata_dev_select: ENTER, ata1: device 0, wait 1
Dec 2 15:42:54 p4ht-s kernel: ata_tf_load_pio: feat 0x0 nsect 0x0 lba 0x0 0x0 0x20
Dec 2 15:42:54 p4ht-s kernel: ata_tf_load_pio: device 0xA0
Dec 2 15:42:54 p4ht-s kernel: ata_exec_command_pio: ata1: cmd 0xA0
Dec 2 15:42:54 p4ht-s kernel: ata_scsi_translate: EXIT
Dec 2 15:42:54 p4ht-s kernel: atapi_packet_task: busy wait
Dec 2 15:42:54 p4ht-s kernel: atapi_packet_task: send cdb
Dec 2 15:42:54 p4ht-s kernel: ata_pio_task: pio_task_state: 4
Dec 2 15:42:54 p4ht-s kernel: __atapi_pio_bytes: 16 bytes data write
Dec 2 15:42:54 p4ht-s kernel: ata_pio_task: Exit
Dec 2 15:42:54 p4ht-s kernel: ata_pio_task: pio_task_state: 5
Dec 2 15:42:54 p4ht-s kernel: ata_pio_complete: Enter
Dec 2 15:42:54 p4ht-s kernel: ata_pio_complete: Exit with dev error, drv_stat [51]
<= ata_pio_task exits without handling error from ata_pio_complete
Dec 2 15:42:54 p4ht-s kernel: ata_pio_task: Exit
reply other threads:[~2004-12-06 8:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='00bc01c4db70$07599cf0$a3564109@tw.ibm.com' \
--to=albertcc@tw.ibm.com \
--cc=dwm@maxeymade.com \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.