mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Tejun Heo <tj@kernel.org>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hannes Reinecke <hare@suse.de>
Subject: [PATCH 1/9] libata: use READ_LOG_DMA_EXT
Date: Fri, 27 Mar 2015 16:46:30 +0100	[thread overview]
Message-ID: <1427471198-62676-2-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1427471198-62676-1-git-send-email-hare@suse.de>

If READ_LOG_DMA_EXT is supported we should try to use it for
reading the log pages.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-eh.c | 9 +++++++--
 include/linux/ata.h     | 7 +++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index d2029a4..d35d7a7 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1510,13 +1510,18 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log,
 	DPRINTK("read log page - log 0x%x, page 0x%x\n", log, page);
 
 	ata_tf_init(dev, &tf);
-	tf.command = ATA_CMD_READ_LOG_EXT;
+	if (dev->dma_mode && ata_id_has_read_log_dma_ext(dev->id)) {
+		tf.command = ATA_CMD_READ_LOG_DMA_EXT;
+		tf.protocol = ATA_PROT_DMA;
+	} else {
+		tf.command = ATA_CMD_READ_LOG_EXT;
+		tf.protocol = ATA_PROT_PIO;
+	}
 	tf.lbal = log;
 	tf.lbam = page;
 	tf.nsect = sectors;
 	tf.hob_nsect = sectors >> 8;
 	tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE;
-	tf.protocol = ATA_PROT_PIO;
 
 	err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE,
 				     buf, sectors * ATA_SECT_SIZE, 0);
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 1648026..681520f 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -696,6 +696,13 @@ static inline bool ata_id_wcache_enabled(const u16 *id)
 	return id[ATA_ID_CFS_ENABLE_1] & (1 << 5);
 }
 
+static inline bool ata_id_has_read_log_dma_ext(const u16 *id)
+{
+	if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15)))
+		return false;
+	return id[ATA_ID_COMMAND_SET_3] & (1 << 3);
+}
+
 /**
  *	ata_id_major_version	-	get ATA level of drive
  *	@id: Identify data
-- 
1.8.5.2


  reply	other threads:[~2015-03-27 15:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27 15:46 [PATCH 0/9] libata sense code update Hannes Reinecke
2015-03-27 15:46 ` Hannes Reinecke [this message]
2015-03-27 15:46 ` [PATCH 2/9] libata: whitespace cleanup in ata_get_cmd_descript() Hannes Reinecke
2015-03-27 15:46 ` [PATCH 3/9] libata: whitespace fixes in ata_to_sense_error() Hannes Reinecke
2015-03-27 15:46 ` [PATCH 4/9] ide,ata: Rename ATA_IDX to ATA_SENSE Hannes Reinecke
2015-03-31 17:07   ` David Miller
2015-03-27 15:46 ` [PATCH 5/9] libata: use status bit definitions in ata_dump_status() Hannes Reinecke
2015-03-27 15:46 ` [PATCH 6/9] libata: Implement NCQ autosense Hannes Reinecke
2015-03-27 15:46 ` [PATCH 7/9] libata: Implement support for sense data reporting Hannes Reinecke
2015-03-27 15:46 ` [PATCH 8/9] libata-eh: Set 'information' field for autosense Hannes Reinecke
2015-03-27 15:46 ` [PATCH 9/9] libata: Add tracepoints Hannes Reinecke
2015-03-27 16:01 ` [PATCH 0/9] libata sense code update Tejun Heo

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=1427471198-62676-2-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®