Commit 9faa6438 authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Tejun Heo

libata: use READ_LOG_DMA_EXT

If READ_LOG_DMA_EXT is supported we should try to use it for
reading the log pages.
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 3a028243
...@@ -1510,13 +1510,18 @@ unsigned int ata_read_log_page(struct ata_device *dev, u8 log, ...@@ -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); DPRINTK("read log page - log 0x%x, page 0x%x\n", log, page);
ata_tf_init(dev, &tf); 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.lbal = log;
tf.lbam = page; tf.lbam = page;
tf.nsect = sectors; tf.nsect = sectors;
tf.hob_nsect = sectors >> 8; tf.hob_nsect = sectors >> 8;
tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE; 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, err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE,
buf, sectors * ATA_SECT_SIZE, 0); buf, sectors * ATA_SECT_SIZE, 0);
......
...@@ -696,6 +696,13 @@ static inline bool ata_id_wcache_enabled(const u16 *id) ...@@ -696,6 +696,13 @@ static inline bool ata_id_wcache_enabled(const u16 *id)
return id[ATA_ID_CFS_ENABLE_1] & (1 << 5); 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 * ata_id_major_version - get ATA level of drive
* @id: Identify data * @id: Identify data
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment