From: Albert Lee <albertcc@tw.ibm.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: IDE Linux <linux-ide@vger.kernel.org>
Subject: [PATCH 3/3] libata handle the case when device returns/needs extra data
Date: Mon, 01 Aug 2005 23:03:18 +0800 [thread overview]
Message-ID: <42EE39B6.5030702@tw.ibm.com> (raw)
In-Reply-To: <42EE37AB.2000006@tw.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 379 bytes --]
Jeff,
PATCH 3/3:
Sometimes the device returns/needs extra data than expected.
Changes:
- Modify __atapi_pio_bytes() to handle the case when device returns/needs extra data.
- for read case, discard trailing data from the device
- for write case, padding zero data to the device
For your review, thanks.
Albert
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
[-- Attachment #2: pio3.diff --]
[-- Type: text/plain, Size: 1006 bytes --]
--- 02_pio_odd/drivers/scsi/libata-core.c 2005-08-01 16:14:28.000000000 +0800
+++ 03_pio_extra_data/drivers/scsi/libata-core.c 2005-08-01 21:46:37.000000000 +0800
@@ -2722,6 +2722,29 @@
ap->pio_task_state = PIO_ST_LAST;
next_sg:
+ if (unlikely(qc->cursg >= qc->n_elem)) {
+ /*
+ * The end of qc->sg is reached and the device expects
+ * more data to transfer. In order not to overrun qc->sg
+ * and fulfill length specified in the byte count register,
+ * - for read case, discard trailing data from the device
+ * - for write case, padding zero data to the device
+ */
+ u16 pad_buf[1] = { 0 };
+ unsigned int words = bytes >> 1;
+ unsigned int i;
+
+ if (words) /* warning if bytes > 1 */
+ printk(KERN_WARNING "ata%u: %u bytes trailing data\n",
+ ap->id, bytes);
+
+ for (i = 0; i < words; i++)
+ ata_data_xfer(ap, (unsigned char*)pad_buf, 2, do_write);
+
+ ap->pio_task_state = PIO_ST_LAST;
+ return;
+ }
+
sg = &qc->sg[qc->cursg];
page = sg->page;
next prev parent reply other threads:[~2005-08-01 15:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-01 14:54 [PATCH 0/3] libata PIO fixes (revised) Albert Lee
2005-08-01 14:57 ` [PATCH 1/3] libata "if condition" enhancement Albert Lee
2005-08-01 15:00 ` [PATCH 2/3] libata ata_data_xfer() fix Albert Lee
2005-08-01 18:36 ` Jeff Garzik
2005-08-01 15:03 ` Albert Lee [this message]
2005-08-01 18:37 ` [PATCH 3/3] libata handle the case when device returns/needs extra data Jeff Garzik
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=42EE39B6.5030702@tw.ibm.com \
--to=albertcc@tw.ibm.com \
--cc=jgarzik@pobox.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.