All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Lord <liml@rtr.ca>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: IDE/ATA development list <linux-ide@vger.kernel.org>
Subject: [PATCH 03/07] sata_mv: restructure mv_qc_issue
Date: Fri, 30 Jan 2009 18:48:41 -0500	[thread overview]
Message-ID: <498391D9.2000403@rtr.ca> (raw)
In-Reply-To: <498391A7.1090209@rtr.ca>

Rearrange logic in mv_qc_issue() to handle protocols
other than ATA_PROT_DMA, ATA_PROT_NCQ, and ATA_PROT_PIO.
This is in preparation for later enabling ATAPI support.

Signed-off-by: Mark Lord <mlord@pobox.com>

--- old/drivers/ata/sata_mv.c	2009-01-30 18:21:49.000000000 -0500
+++ linux/drivers/ata/sata_mv.c	2009-01-30 18:23:22.000000000 -0500
@@ -1565,14 +1565,26 @@
  */
 static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)
 {
+	static int limit_warnings = 10;
 	struct ata_port *ap = qc->ap;
 	void __iomem *port_mmio = mv_ap_base(ap);
 	struct mv_port_priv *pp = ap->private_data;
 	u32 in_index;
+	unsigned int port_irqs = DONE_IRQ | ERR_IRQ;
 
-	if ((qc->tf.protocol != ATA_PROT_DMA) &&
-	    (qc->tf.protocol != ATA_PROT_NCQ)) {
-		static int limit_warnings = 10;
+	switch (qc->tf.protocol) {
+	case ATA_PROT_DMA:
+	case ATA_PROT_NCQ:
+		mv_start_edma(ap, port_mmio, pp, qc->tf.protocol);
+		pp->req_idx = (pp->req_idx + 1) & MV_MAX_Q_DEPTH_MASK;
+		in_index = pp->req_idx << EDMA_REQ_Q_PTR_SHIFT;
+
+		/* Write the request in pointer to kick the EDMA to life */
+		writelfl((pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK) | in_index,
+					port_mmio + EDMA_REQ_Q_IN_PTR_OFS);
+		return 0;
+
+	case ATA_PROT_PIO:
 		/*
 		 * Errata SATA#16, SATA#24: warn if multiple DRQs expected.
 		 *
@@ -1590,27 +1602,22 @@
 					": attempting PIO w/multiple DRQ: "
 					"this may fail due to h/w errata\n");
 		}
+		/* drop through */
+	case ATAPI_PROT_PIO:
+		port_irqs = ERR_IRQ;	/* leave DONE_IRQ masked for PIO */
+		/* drop through */
+	default:
 		/*
 		 * We're about to send a non-EDMA capable command to the
 		 * port.  Turn off EDMA so there won't be problems accessing
 		 * shadow block, etc registers.
 		 */
 		mv_stop_edma(ap);
-		mv_enable_port_irqs(ap, ERR_IRQ);
+		mv_edma_cfg(ap, 0, 0);
+		mv_clear_and_enable_port_irqs(ap, mv_ap_base(ap), port_irqs);
 		mv_pmp_select(ap, qc->dev->link->pmp);
 		return ata_sff_qc_issue(qc);
 	}
-
-	mv_start_edma(ap, port_mmio, pp, qc->tf.protocol);
-
-	pp->req_idx = (pp->req_idx + 1) & MV_MAX_Q_DEPTH_MASK;
-	in_index = pp->req_idx << EDMA_REQ_Q_PTR_SHIFT;
-
-	/* and write the request in pointer to kick the EDMA to life */
-	writelfl((pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK) | in_index,
-		 port_mmio + EDMA_REQ_Q_IN_PTR_OFS);
-
-	return 0;
 }
 
 static struct ata_queued_cmd *mv_get_active_qc(struct ata_port *ap)

  reply	other threads:[~2009-01-30 23:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-30 23:45 [PATCH 00/07] sata_mv: ATAPI patchset Mark Lord
2009-01-30 23:46 ` [PATCH 01/07] sata_mv: cleanup chipset GENeration FLAGS Mark Lord
2009-01-30 23:47   ` [PATCH 02/07] sata_mv: rearrange mv_start_dma() and friends Mark Lord
2009-01-30 23:48     ` Mark Lord [this message]
2009-01-30 23:49       ` [PATCH 04/07] sata_mv: update ata_qc_from_tag Mark Lord
2009-01-30 23:50         ` [PATCH 05/07] sata_mv: mv_fill_sg fixes Mark Lord
2009-01-30 23:51           ` [PATCH 06/07] sata_mv: introduce support for ATAPI devices Mark Lord
2009-01-30 23:52             ` [PATCH 07/07] sata_mv: optimize use of mv_edma_cfg Mark Lord
2009-02-03  4:19             ` [PATCH 06/07] sata_mv: introduce support for ATAPI devices Jeff Garzik
2009-02-01 20:55           ` [PATCH 05/07] sata_mv: mv_fill_sg fixes Grant Grundler
2009-02-01 21:46             ` Mark Lord
2009-02-01 21:50             ` [PATCH 05/07] sata_mv: mv_fill_sg fixes v2 Mark Lord
2009-01-31  2:40         ` [PATCH 08/07] sata_mv: remove leftovers Mark Lord
2009-02-01 20:49         ` [PATCH 04/07] sata_mv: update ata_qc_from_tag Grant Grundler
2009-02-01 21:45           ` Mark Lord
2009-02-03  4:14       ` [PATCH 03/07] sata_mv: restructure mv_qc_issue Jeff Garzik
2009-02-03  4:12   ` [PATCH 01/07] sata_mv: cleanup chipset GENeration FLAGS Jeff Garzik
2009-01-31  0:04 ` [PATCH 00/07] sata_mv: ATAPI patchset Mark Lord

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=498391D9.2000403@rtr.ca \
    --to=liml@rtr.ca \
    --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.