From: Jeff Garzik <jgarzik@pobox.com>
To: linux-ide@vger.kernel.org
Subject: [PATCH] libata atapi work #2.1
Date: Sat, 15 May 2004 18:12:51 -0400 [thread overview]
Message-ID: <40A695E3.6040707@pobox.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 366 bytes --]
Patch based on libata 20040515-1 patch just posted.
Now that the previous patches are flushed into the for-upstream queue,
this is the beginning of a new patch series. To reduce confusion, all
patches in this series are numbered 2.<n>.
If you have a bridge that requires DMADIR, you'll have to apply a
variant of the DMADIR patch to get your setup working.
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 3500 bytes --]
# ChangeSet
# 2004/05/15 18:07:32-04:00 jgarzik@redhat.com
# [libata] handle non-data ATAPI commands via interrupt
#
# It's easier to do it this way, than polling, at the moment.
#
# Also, fix a test in ata_scsi_translate that was incorrectly
# erroring-out non-data commands.
#
diff -Nru a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
--- a/drivers/scsi/libata-core.c Sat May 15 18:09:46 2004
+++ b/drivers/scsi/libata-core.c Sat May 15 18:09:46 2004
@@ -2677,6 +2677,7 @@
handled = 1;
break;
+ case ATA_PROT_ATAPI:
case ATA_PROT_NODATA: /* command completion, but no data xfer */
status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status);
@@ -2837,9 +2838,16 @@
qc->scsicmd->cmnd, ap->host->max_cmd_len / 4);
/* if we are DMA'ing, irq handler takes over from here */
- if (qc->tf.protocol == ATA_PROT_ATAPI_DMA) {
+ if (qc->tf.protocol == ATA_PROT_ATAPI_DMA)
ap->ops->bmdma_start(qc); /* initiate bmdma */
- } else {
+
+ /* non-data commands are also handled via irq */
+ else if (qc->scsicmd->sc_data_direction == SCSI_DATA_NONE) {
+ /* do nothing */
+ }
+
+ /* PIO commands are handled by polling */
+ else {
ap->pio_task_state = PIO_ST;
queue_work(ata_wq, &ap->pio_task);
}
diff -Nru a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
--- a/drivers/scsi/libata-scsi.c Sat May 15 18:09:46 2004
+++ b/drivers/scsi/libata-scsi.c Sat May 15 18:09:46 2004
@@ -46,8 +46,8 @@
* @geom: location to which geometry will be output
*
* Generic bios head/sector/cylinder calculator
- * used by sd. Most BIOSes nowadays expect a XXX/255/16 (CHS)
- * mapping. Some situations may arise where the disk is not
+ * used by sd. Most BIOSes nowadays expect a XXX/255/16 (CHS)
+ * mapping. Some situations may arise where the disk is not
* bootable if this is not used.
*
* LOCKING:
@@ -57,7 +57,7 @@
* Zero.
*/
int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev,
- sector_t capacity, int geom[])
+ sector_t capacity, int geom[])
{
geom[0] = 255;
geom[1] = 63;
@@ -362,19 +362,20 @@
VPRINTK("ENTER\n");
- if (unlikely(cmd->request_bufflen < 1)) {
- printk(KERN_WARNING "ata%u(%u): empty request buffer\n",
- ap->id, dev->devno);
- goto err_out;
- }
-
qc = ata_scsi_qc_new(ap, dev, cmd, done);
if (!qc)
return;
if (cmd->sc_data_direction == SCSI_DATA_READ ||
- cmd->sc_data_direction == SCSI_DATA_WRITE)
+ cmd->sc_data_direction == SCSI_DATA_WRITE) {
+ if (unlikely(cmd->request_bufflen < 1)) {
+ printk(KERN_WARNING "ata%u(%u): WARNING: zero len r/w req\n",
+ ap->id, dev->devno);
+ goto err_out;
+ }
+
qc->flags |= ATA_QCFLAG_SG; /* data is present; dma-map it */
+ }
if (xlat_func(qc, scsicmd))
goto err_out;
@@ -910,12 +911,18 @@
qc->tf.command = ATA_CMD_PACKET;
- if ((cmd->sc_data_direction == SCSI_DATA_NONE) ||
- ((qc->flags & ATA_QCFLAG_DMA) == 0)) {
+ /* no data - interrupt-driven */
+ if (cmd->sc_data_direction == SCSI_DATA_NONE)
+ qc->tf.protocol = ATA_PROT_ATAPI;
+
+ /* PIO data xfer - polling */
+ else if ((qc->flags & ATA_QCFLAG_DMA) == 0) {
ata_qc_set_polling(qc);
qc->tf.protocol = ATA_PROT_ATAPI;
qc->tf.lbam = (8 * 1024) & 0xff;
qc->tf.lbah = (8 * 1024) >> 8;
+
+ /* DMA data xfer - interrupt-driven */
} else {
qc->flags |= ATA_QCFLAG_SG; /* data is present; dma-map it */
qc->tf.protocol = ATA_PROT_ATAPI_DMA;
next reply other threads:[~2004-05-15 22:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-15 22:12 Jeff Garzik [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-05-16 15:39 [PATCH] libata atapi work #2.1 Pat LaVarre
2004-05-16 23:20 ` Jeff Garzik
2004-05-17 14:56 ` Pat LaVarre
2004-05-17 17:57 ` Jeff Garzik
2004-05-17 19:24 ` Pat LaVarre
2004-05-18 1:48 ` Pat LaVarre
2004-05-18 21:10 ` Pat LaVarre
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=40A695E3.6040707@pobox.com \
--to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox