diff options
-rw-r--r-- | drivers/ata/libata-eh.c | 9 | ||||
-rw-r--r-- | 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 d2029a462e2c..d35d7a76ecb2 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, | |||
1510 | DPRINTK("read log page - log 0x%x, page 0x%x\n", log, page); | 1510 | DPRINTK("read log page - log 0x%x, page 0x%x\n", log, page); |
1511 | 1511 | ||
1512 | ata_tf_init(dev, &tf); | 1512 | ata_tf_init(dev, &tf); |
1513 | tf.command = ATA_CMD_READ_LOG_EXT; | 1513 | if (dev->dma_mode && ata_id_has_read_log_dma_ext(dev->id)) { |
1514 | tf.command = ATA_CMD_READ_LOG_DMA_EXT; | ||
1515 | tf.protocol = ATA_PROT_DMA; | ||
1516 | } else { | ||
1517 | tf.command = ATA_CMD_READ_LOG_EXT; | ||
1518 | tf.protocol = ATA_PROT_PIO; | ||
1519 | } | ||
1514 | tf.lbal = log; | 1520 | tf.lbal = log; |
1515 | tf.lbam = page; | 1521 | tf.lbam = page; |
1516 | tf.nsect = sectors; | 1522 | tf.nsect = sectors; |
1517 | tf.hob_nsect = sectors >> 8; | 1523 | tf.hob_nsect = sectors >> 8; |
1518 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE; | 1524 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE; |
1519 | tf.protocol = ATA_PROT_PIO; | ||
1520 | 1525 | ||
1521 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE, | 1526 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE, |
1522 | buf, sectors * ATA_SECT_SIZE, 0); | 1527 | buf, sectors * ATA_SECT_SIZE, 0); |
diff --git a/include/linux/ata.h b/include/linux/ata.h index 1648026e06b4..681520f8a3de 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) | |||
696 | return id[ATA_ID_CFS_ENABLE_1] & (1 << 5); | 696 | return id[ATA_ID_CFS_ENABLE_1] & (1 << 5); |
697 | } | 697 | } |
698 | 698 | ||
699 | static inline bool ata_id_has_read_log_dma_ext(const u16 *id) | ||
700 | { | ||
701 | if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15))) | ||
702 | return false; | ||
703 | return id[ATA_ID_COMMAND_SET_3] & (1 << 3); | ||
704 | } | ||
705 | |||
699 | /** | 706 | /** |
700 | * ata_id_major_version - get ATA level of drive | 707 | * ata_id_major_version - get ATA level of drive |
701 | * @id: Identify data | 708 | * @id: Identify data |