From: Hannes Reinecke <hare@suse.de>
To: Tejun Heo <tj@kernel.org>
Cc: Damien Le Moal <damien.lemoal@hgst.com>,
linux-ide@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
Hannes Reinecke <hare@suse.com>
Subject: [PATCH 3/6] ata: add ata_is_fpdma() accessor
Date: Mon, 20 Jun 2016 13:39:13 +0200 [thread overview]
Message-ID: <1466422756-126637-4-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1466422756-126637-1-git-send-email-hare@suse.de>
Add an accessor ata_is_fpdma() and convert drivers to use it.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
drivers/ata/sata_fsl.c | 4 ++--
drivers/ata/sata_mv.c | 5 ++---
drivers/ata/sata_nv.c | 11 +++++------
include/linux/libata.h | 6 ++++++
4 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index a723ae9..acfb865 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -534,7 +534,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc)
VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n",
cd->cfis[0], cd->cfis[1], cd->cfis[2]);
- if (qc->tf.protocol == ATA_PROT_NCQ) {
+ if (ata_is_fpdma(qc->tf.protocol)) {
VPRINTK("FPDMA xfer,Sctor cnt[0:7],[8:15] = %d,%d\n",
cd->cfis[3], cd->cfis[11]);
}
@@ -551,7 +551,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc)
&ttl_dwords, cd_paddr,
host_priv->data_snoop);
- if (qc->tf.protocol == ATA_PROT_NCQ)
+ if (ata_is_fpdma(qc->tf.protocol))
desc_info |= FPDMA_QUEUED_CMD;
sata_fsl_setup_cmd_hdr_entry(pp, tag, desc_info, ttl_dwords,
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index bd74ee5..a81b1f8 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1173,7 +1173,7 @@ static void mv_set_irq_coalescing(struct ata_host *host,
static void mv_start_edma(struct ata_port *ap, void __iomem *port_mmio,
struct mv_port_priv *pp, u8 protocol)
{
- int want_ncq = (protocol == ATA_PROT_NCQ);
+ int want_ncq = (ata_is_fpdma(protocol));
if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) {
int using_ncq = ((pp->pp_flags & MV_PP_FLAG_NCQ_EN) != 0);
@@ -2156,8 +2156,7 @@ static void mv_qc_prep_iie(struct ata_queued_cmd *qc)
unsigned in_index;
u32 flags = 0;
- if ((tf->protocol != ATA_PROT_DMA) &&
- (tf->protocol != ATA_PROT_NCQ))
+ if (!ata_is_fpdma(tf->protocol))
return;
if (tf->command == ATA_CMD_DSM)
return; /* use bmdma for this */
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 734f563..89e36aa 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1407,7 +1407,7 @@ static void nv_adma_qc_prep(struct ata_queued_cmd *qc)
cpb->next_cpb_idx = 0;
/* turn on NCQ flags for NCQ commands */
- if (qc->tf.protocol == ATA_PROT_NCQ)
+ if (ata_is_fpdma(qc->tf.protocol))
ctl_flags |= NV_CPB_CTL_QUEUE | NV_CPB_CTL_FPDMA;
VPRINTK("qc->flags = 0x%lx\n", qc->flags);
@@ -1432,15 +1432,14 @@ static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc)
{
struct nv_adma_port_priv *pp = qc->ap->private_data;
void __iomem *mmio = pp->ctl_block;
- int curr_ncq = (qc->tf.protocol == ATA_PROT_NCQ);
+ int curr_ncq = ata_is_fpdma(qc->tf.protocol);
VPRINTK("ENTER\n");
/* We can't handle result taskfile with NCQ commands, since
retrieving the taskfile switches us out of ADMA mode and would abort
existing commands. */
- if (unlikely(qc->tf.protocol == ATA_PROT_NCQ &&
- (qc->flags & ATA_QCFLAG_RESULT_TF))) {
+ if (unlikely(curr_ncq && (qc->flags & ATA_QCFLAG_RESULT_TF))) {
ata_dev_err(qc->dev, "NCQ w/ RESULT_TF not allowed\n");
return AC_ERR_SYSTEM;
}
@@ -1991,7 +1990,7 @@ static int nv_swncq_port_start(struct ata_port *ap)
static void nv_swncq_qc_prep(struct ata_queued_cmd *qc)
{
- if (qc->tf.protocol != ATA_PROT_NCQ) {
+ if (!ata_is_fpdma(qc->tf.protocol)) {
ata_bmdma_qc_prep(qc);
return;
}
@@ -2067,7 +2066,7 @@ static unsigned int nv_swncq_qc_issue(struct ata_queued_cmd *qc)
struct ata_port *ap = qc->ap;
struct nv_swncq_port_priv *pp = ap->private_data;
- if (qc->tf.protocol != ATA_PROT_NCQ)
+ if (!ata_is_fpdma(qc->tf.protocol))
return ata_bmdma_qc_issue(qc);
DPRINTK("Enter\n");
diff --git a/include/linux/libata.h b/include/linux/libata.h
index d15c19e..264414c 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -152,6 +152,7 @@ enum {
ATA_PROT_FLAG_DATA = ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA,
ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */
ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */
+ ATA_PROT_FLAG_FPDMA = ATA_PROT_FLAG_NCQ | ATA_PROT_FLAG_DMA,
/* struct ata_device stuff */
ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */
@@ -1093,6 +1094,11 @@ static inline int ata_is_data(u8 prot)
return ata_prot_flags(prot) & ATA_PROT_FLAG_DATA;
}
+static inline int ata_is_fpdma(u8 prot)
+{
+ return ata_prot_flags(prot) & ATA_PROT_FLAG_FPDMA;
+}
+
static inline int is_multi_taskfile(struct ata_taskfile *tf)
{
return (tf->command == ATA_CMD_READ_MULTI) ||
--
1.8.5.6
next prev parent reply other threads:[~2016-06-20 11:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 11:39 [PATCH 0/6] libata: Fixup ATA NCQ NON-DATA commands Hannes Reinecke
2016-06-20 11:39 ` [PATCH 1/6] libata: use ata_is_ncq() accessors Hannes Reinecke
2016-06-20 11:39 ` [PATCH 2/6] libsas: use ata_is_ncq() and ata_has_dma() accessors Hannes Reinecke
2016-06-20 15:40 ` Tejun Heo
2016-06-21 5:44 ` Hannes Reinecke
2016-06-20 11:39 ` Hannes Reinecke [this message]
2016-06-20 15:42 ` [PATCH 3/6] ata: add ata_is_fpdma() accessor Tejun Heo
2016-06-21 5:49 ` Hannes Reinecke
2016-06-21 15:45 ` Tejun Heo
2016-06-20 11:39 ` [PATCH 4/6] ata: fixup ATA_PROT_NODATA Hannes Reinecke
2016-06-20 15:44 ` Tejun Heo
2016-06-21 5:52 ` Hannes Reinecke
2016-06-20 11:39 ` [PATCH 5/6] libata-eh: decode all taskfile protocols Hannes Reinecke
2016-06-20 11:39 ` [PATCH 6/6] ata: Handle ATA NCQ NO-DATA commands correctly Hannes Reinecke
2016-06-21 1:14 ` Damien Le Moal
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=1466422756-126637-4-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=damien.lemoal@hgst.com \
--cc=hare@suse.com \
--cc=linux-ide@vger.kernel.org \
--cc=tj@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.