From: Mark Lord <liml@rtr.ca>
To: Jeff Garzik <jgarzik@pobox.com>,
IDE/ATA development list <linux-ide@vger.kernel.org>
Subject: [PATCH 05/13] sata_mv ncq Add want ncq parameter for EDMA configuration
Date: Sat, 26 Jan 2008 18:31:33 -0500 [thread overview]
Message-ID: <479BC2D5.5010705@rtr.ca> (raw)
In-Reply-To: <479BC217.60709@rtr.ca>
An extra EDMA config bit is required for NCQ operation.
So set/clear it as needed, and cache current setting in port_priv.
For now though, it will always be "off" (0).
Signed-off-by: Mark Lord <mlord@pobox.com>
--- old/drivers/ata/sata_mv.c 2008-01-24 12:12:37.000000000 -0500
+++ new/drivers/ata/sata_mv.c 2008-01-24 12:07:16.000000000 -0500
@@ -331,6 +331,7 @@
/* Port private flags (pp_flags) */
MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */
+ MV_PP_FLAG_NCQ_EN = (1 << 1), /* is EDMA set up for NCQ? */
MV_PP_FLAG_HAD_A_RESET = (1 << 2), /* 1st hard reset complete? */
};
@@ -471,8 +472,9 @@
static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio);
static void mv_channel_reset(struct mv_host_priv *hpriv, void __iomem *mmio,
unsigned int port_no);
-static void mv_edma_cfg(struct ata_port *ap, struct mv_host_priv *hpriv,
- void __iomem *port_mmio);
+static void mv_edma_cfg(struct mv_port_priv *pp, struct mv_host_priv *hpriv,
+ void __iomem *port_mmio, int want_ncq);
+static int __mv_stop_dma(struct ata_port *ap);
static struct scsi_host_template mv5_sht = {
.module = THIS_MODULE,
@@ -838,8 +840,15 @@
* Inherited from caller.
*/
static void mv_start_dma(struct ata_port *ap, void __iomem *port_mmio,
- struct mv_port_priv *pp)
+ struct mv_port_priv *pp, u8 protocol)
{
+ int want_ncq = (protocol == ATA_PROT_NCQ);
+
+ if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) {
+ int using_ncq = ((pp->pp_flags & MV_PP_FLAG_NCQ_EN) != 0);
+ if (want_ncq != using_ncq)
+ __mv_stop_dma(ap);
+ }
if (!(pp->pp_flags & MV_PP_FLAG_EDMA_EN)) {
struct mv_host_priv *hpriv = ap->host->private_data;
int hard_port = mv_hardport_from_port(ap->port_no);
@@ -859,7 +868,7 @@
hc_mmio + HC_IRQ_CAUSE_OFS);
}
- mv_edma_cfg(ap, hpriv, port_mmio);
+ mv_edma_cfg(pp, hpriv, port_mmio, want_ncq);
/* clear FIS IRQ Cause */
writelfl(0, port_mmio + SATA_FIS_IRQ_CAUSE_OFS);
@@ -1045,8 +1054,8 @@
return -EINVAL;
}
-static void mv_edma_cfg(struct ata_port *ap, struct mv_host_priv *hpriv,
- void __iomem *port_mmio)
+static void mv_edma_cfg(struct mv_port_priv *pp, struct mv_host_priv *hpriv,
+ void __iomem *port_mmio, int want_ncq)
{
u32 cfg;
@@ -1066,6 +1075,12 @@
cfg |= (1 << 17); /* enab cut-through (dis stor&forwrd) */
}
+ if (want_ncq) {
+ cfg |= EDMA_CFG_NCQ;
+ pp->pp_flags |= MV_PP_FLAG_NCQ_EN;
+ } else
+ pp->pp_flags &= ~MV_PP_FLAG_NCQ_EN;
+
writelfl(cfg, port_mmio + EDMA_CFG_OFS);
}
@@ -1128,7 +1143,7 @@
spin_lock_irqsave(&ap->host->lock, flags);
- mv_edma_cfg(ap, hpriv, port_mmio);
+ mv_edma_cfg(pp, hpriv, port_mmio, 0);
mv_set_edma_ptrs(port_mmio, hpriv, pp);
@@ -1396,7 +1411,7 @@
return ata_qc_issue_prot(qc);
}
- mv_start_dma(ap, port_mmio, pp);
+ mv_start_dma(ap, port_mmio, pp, qc->tf.protocol);
in_index = pp->req_idx & MV_MAX_Q_DEPTH_MASK;
next prev parent reply other threads:[~2008-01-26 23:31 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-26 23:28 [PATCH 01/13] sata_mv ncq EH fixes Mark Lord
2008-01-26 23:30 ` [PATCH 02/13] sata_mv ncq Mask transient IRQs Mark Lord
2008-01-26 23:31 ` [PATCH 03/13] sata_mv ncq Rename base to port mmio Mark Lord
2008-01-26 23:31 ` [PATCH 04/13] sata_mv ncq Fix EDMA configuration Mark Lord
2008-01-26 23:31 ` Mark Lord [this message]
2008-01-26 23:31 ` [PATCH 06/13] sata_mv ncq Use hqtag instead of ioid Mark Lord
2008-01-26 23:32 ` [PATCH 07/13] sata_mv ncq Ignore response status LSB on NCQ Mark Lord
2008-01-26 23:32 ` [PATCH 08/13] sata_mv ncq Restrict max sectors to 8-bits on GenII NCQ Mark Lord
2008-01-26 23:32 ` [PATCH 09/13] sata_mv ncq Use DMA memory pools for hardware memory tables Mark Lord
2008-01-29 17:10 ` Jeff Garzik
2008-01-29 18:24 ` Mark Lord
2008-01-30 9:54 ` Jeff Garzik
2008-01-30 16:40 ` Mark Lord
2008-01-30 17:08 ` Jeff Garzik
2008-01-30 17:19 ` Mark Lord
2008-01-30 17:45 ` Jeff Garzik
2008-01-30 18:57 ` Mark Lord
2008-01-31 3:23 ` Tejun Heo
2008-01-31 3:31 ` Tejun Heo
2008-01-31 3:59 ` Mark Lord
2008-01-31 9:00 ` Mikael Pettersson
2008-01-26 23:32 ` [PATCH 10/13] sata_mv ncq Introduce per-tag SG tables Mark Lord
2008-01-30 9:50 ` Jeff Garzik
2008-01-26 23:33 ` [PATCH 11/13] sata_mv ncq Enable NCQ operation Mark Lord
2008-01-26 23:33 ` [PATCH 12/13] sata_mv ncq Remove post internal cmd op Mark Lord
2008-01-26 23:33 ` [PATCH 13/13] sata_mv ncq Comments and version bump 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=479BC2D5.5010705@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 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).