From: Albert Lee <albertcc@tw.ibm.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Doug Maxey <dwm@maxeymade.com>,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
Mark Lord <mlord@pobox.com>,
Linux IDE <linux-ide@vger.kernel.org>
Subject: [PATCH/RFC 4/4] irq-pio: add read/write multiple support
Date: Tue, 01 Nov 2005 19:33:20 +0800 [thread overview]
Message-ID: <43675280.2050400@tw.ibm.com> (raw)
In-Reply-To: <43674D9A.9010007@tw.ibm.com>
patch 4/4:
add read/write multiple support
Changes:
- add is_multi_taskfile() to ata.h
- initialize ata_device->multi_count with device identify data
- use ata_pio_sectors() to support r/w multiple commands
For your review, thanks.
Albert
Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
========
--- linux-ori/include/linux/ata.h 2005-11-01 17:22:45.000000000 +0800
+++ id4/include/linux/ata.h 2005-11-01 18:27:08.000000000 +0800
@@ -293,6 +293,14 @@ static inline int is_atapi_taskfile(cons
(tf->protocol == ATA_PROT_ATAPI_DMA);
}
+static inline int is_multi_taskfile(struct ata_taskfile *tf)
+{
+ return (tf->command == ATA_CMD_READ_MULTI) ||
+ (tf->command == ATA_CMD_WRITE_MULTI) ||
+ (tf->command == ATA_CMD_READ_MULTI_EXT) ||
+ (tf->command == ATA_CMD_WRITE_MULTI_EXT);
+}
+
static inline int ata_ok(u8 status)
{
return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR))
--- id3/drivers/scsi/libata-core.c 2005-11-01 18:45:50.000000000 +0800
+++ id4/drivers/scsi/libata-core.c 2005-11-01 18:36:08.000000000 +0800
@@ -1261,6 +1261,12 @@ retry:
}
+ if (dev->id[59] & 0x100) {
+ dev->multi_count = dev->id[59] & 0xff;
+ DPRINTK("ata%u: dev %u multi count %u\n",
+ ap->id, device, dev->multi_count);
+ }
+
ap->host->max_cmd_len = 16;
}
@@ -2711,7 +2717,7 @@ static int ata_pio_complete (struct ata_
* 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
* msecs, then chk-status again. If still busy, fall back to
- * HSM_ST_POLL state.
+ * HSM_ST_LAST_POLL state.
*/
drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10);
if (drv_stat & (ATA_BUSY | ATA_DRQ)) {
@@ -2928,6 +2934,32 @@ static void ata_pio_sector(struct ata_qu
}
/**
+ * ata_pio_sectors - Transfer one or many 512-byte sectors.
+ * @qc: Command on going
+ *
+ * Transfer one or many ATA_SECT_SIZE of data from/to the
+ * ATA device for the DRQ request.
+ *
+ * LOCKING:
+ * Inherited from caller.
+ */
+
+static void ata_pio_sectors(struct ata_queued_cmd *qc)
+{
+ if (is_multi_taskfile(&qc->tf)) {
+ /* READ/WRITE MULTIPLE */
+ unsigned int nsect;
+
+ assert(qc->dev->multi_count);
+
+ nsect = min(qc->nsect - qc->cursect, qc->dev->multi_count);
+ while (nsect--)
+ ata_pio_sector(qc);
+ } else
+ ata_pio_sector(qc);
+}
+
+/**
* atapi_send_cdb - Write CDB bytes to hardware
* @ap: Port to which ATAPI device is attached.
* @qc: Taskfile currently active
@@ -3025,11 +3057,11 @@ static int ata_pio_first_block(struct at
* send first data block.
*/
- /* ata_pio_sector() might change the state to HSM_ST_LAST.
- * so, the state is changed here before ata_pio_sector().
+ /* ata_pio_sectors() might change the state to HSM_ST_LAST.
+ * so, the state is changed here before ata_pio_sectors().
*/
ap->hsm_task_state = HSM_ST;
- ata_pio_sector(qc);
+ ata_pio_sectors(qc);
ata_altstatus(ap); /* flush */
} else
/* send CDB */
@@ -3234,7 +3266,7 @@ static void ata_pio_block(struct ata_por
return;
}
- ata_pio_sector(qc);
+ ata_pio_sectors(qc);
}
ata_altstatus(ap); /* flush */
@@ -4120,7 +4152,7 @@ fsm_start:
goto fsm_start;
}
- ata_pio_sector(qc);
+ ata_pio_sectors(qc);
if (ap->hsm_task_state == HSM_ST_LAST &&
(!(qc->tf.flags & ATA_TFLAG_WRITE))) {
next prev parent reply other threads:[~2005-11-01 11:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-01 11:12 [PATCH/RFC 0/4] libata: more irq driven pio follow-up patches Albert Lee
2005-11-01 11:19 ` [PATCH/RFC 1/4] irq-pio: misc fixes Albert Lee
2005-11-09 6:22 ` Jeff Garzik
2005-11-01 11:24 ` [PATCH/RFC 2/4] irq-pio: merge the ata_dataout_task workqueue with ata_pio_task workqueue Albert Lee
2005-11-01 11:30 ` [PATCH/RFC 3/4] irq-pio: eliminate unnecessary queuing in ata_pio_first_block() Albert Lee
2005-11-01 11:33 ` Albert Lee [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-09-09 16:14 [PATCH RFC] libata: interrupt driven pio Albert Lee
2005-09-09 17:35 ` Jeff Garzik
2005-09-22 4:00 ` [PATCH/RFC 0/3] libata: interrupt driven pio (revised) Albert Lee
2005-09-23 9:46 ` Jeff Garzik
2005-09-27 9:31 ` [PATCH/RFC 0/4] libata: interrupt driven pio (revised 2) Albert Lee
2005-09-27 9:38 ` [PATCH/RFC 3/4] libata: interrupt driven pio for libata-core Albert Lee
2005-09-29 10:08 ` Bartlomiej Zolnierkiewicz
2005-09-30 11:04 ` [PATCH/RFC 0/4] libata: irq driven pio follow-up patches Albert Lee
2005-09-30 11:21 ` Jeff Garzik
2005-10-03 11:46 ` [PATCH/RFC 0/4] libata: more " Albert Lee
2005-10-03 13:19 ` [PATCH/RFC 4/4] irq-pio: add read/write multiple support Albert Lee
2005-10-03 13:35 ` Mark Lord
2005-10-04 9:43 ` Jeff Garzik
2005-10-04 12:00 ` Albert Lee
2005-10-04 12:07 ` Jeff Garzik
2005-10-04 10:19 ` 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=43675280.2050400@tw.ibm.com \
--to=albertcc@tw.ibm.com \
--cc=bzolnier@gmail.com \
--cc=dwm@maxeymade.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=mlord@pobox.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).