libata-eh.c (bdcddf95e82b1c4e370fc1196b1f4f50f775dab4) | libata-eh.c (eab6ee1ce3c4678224d70338134f7a02005768cb) |
---|---|
1/* 2 * libata-eh.c - libata error handling 3 * 4 * Maintained by: Tejun Heo <tj@kernel.org> 5 * Please ALWAYS copy linux-ide@vger.kernel.org 6 * on emails. 7 * 8 * Copyright 2006 Tejun Heo <htejun@gmail.com> --- 1493 unchanged lines hidden (view full) --- 1502 * RETURNS: 1503 * 0 on success, AC_ERR_* mask otherwise. 1504 */ 1505unsigned int ata_read_log_page(struct ata_device *dev, u8 log, 1506 u8 page, void *buf, unsigned int sectors) 1507{ 1508 struct ata_taskfile tf; 1509 unsigned int err_mask; | 1/* 2 * libata-eh.c - libata error handling 3 * 4 * Maintained by: Tejun Heo <tj@kernel.org> 5 * Please ALWAYS copy linux-ide@vger.kernel.org 6 * on emails. 7 * 8 * Copyright 2006 Tejun Heo <htejun@gmail.com> --- 1493 unchanged lines hidden (view full) --- 1502 * RETURNS: 1503 * 0 on success, AC_ERR_* mask otherwise. 1504 */ 1505unsigned int ata_read_log_page(struct ata_device *dev, u8 log, 1506 u8 page, void *buf, unsigned int sectors) 1507{ 1508 struct ata_taskfile tf; 1509 unsigned int err_mask; |
1510 bool dma = false; |
|
1510 1511 DPRINTK("read log page - log 0x%x, page 0x%x\n", log, page); 1512 | 1511 1512 DPRINTK("read log page - log 0x%x, page 0x%x\n", log, page); 1513 |
1514retry: |
|
1513 ata_tf_init(dev, &tf); | 1515 ata_tf_init(dev, &tf); |
1514 if (dev->dma_mode && ata_id_has_read_log_dma_ext(dev->id)) { | 1516 if (dev->dma_mode && ata_id_has_read_log_dma_ext(dev->id) && 1517 !(dev->horkage & ATA_HORKAGE_NO_NCQ_LOG)) { |
1515 tf.command = ATA_CMD_READ_LOG_DMA_EXT; 1516 tf.protocol = ATA_PROT_DMA; | 1518 tf.command = ATA_CMD_READ_LOG_DMA_EXT; 1519 tf.protocol = ATA_PROT_DMA; |
1520 dma = true; |
|
1517 } else { 1518 tf.command = ATA_CMD_READ_LOG_EXT; 1519 tf.protocol = ATA_PROT_PIO; | 1521 } else { 1522 tf.command = ATA_CMD_READ_LOG_EXT; 1523 tf.protocol = ATA_PROT_PIO; |
1524 dma = false; |
|
1520 } 1521 tf.lbal = log; 1522 tf.lbam = page; 1523 tf.nsect = sectors; 1524 tf.hob_nsect = sectors >> 8; 1525 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE; 1526 1527 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE, 1528 buf, sectors * ATA_SECT_SIZE, 0); 1529 | 1525 } 1526 tf.lbal = log; 1527 tf.lbam = page; 1528 tf.nsect = sectors; 1529 tf.hob_nsect = sectors >> 8; 1530 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE; 1531 1532 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE, 1533 buf, sectors * ATA_SECT_SIZE, 0); 1534 |
1535 if (err_mask && dma) { 1536 dev->horkage |= ATA_HORKAGE_NO_NCQ_LOG; 1537 ata_dev_warn(dev, "READ LOG DMA EXT failed, trying unqueued\n"); 1538 goto retry; 1539 } 1540 |
|
1530 DPRINTK("EXIT, err_mask=%x\n", err_mask); 1531 return err_mask; 1532} 1533 1534/** 1535 * ata_eh_read_log_10h - Read log page 10h for NCQ error details 1536 * @dev: Device to read log page 10h from 1537 * @tag: Resulting tag of the failed command --- 2054 unchanged lines hidden (view full) --- 3592 "failed to enable DIPM, Emask 0x%x\n", 3593 err_mask); 3594 rc = -EIO; 3595 goto fail; 3596 } 3597 } 3598 } 3599 | 1541 DPRINTK("EXIT, err_mask=%x\n", err_mask); 1542 return err_mask; 1543} 1544 1545/** 1546 * ata_eh_read_log_10h - Read log page 10h for NCQ error details 1547 * @dev: Device to read log page 10h from 1548 * @tag: Resulting tag of the failed command --- 2054 unchanged lines hidden (view full) --- 3603 "failed to enable DIPM, Emask 0x%x\n", 3604 err_mask); 3605 rc = -EIO; 3606 goto fail; 3607 } 3608 } 3609 } 3610 |
3600 link->last_lpm_change = jiffies; 3601 link->flags |= ATA_LFLAG_CHANGED; 3602 | |
3603 return 0; 3604 3605fail: 3606 /* restore the old policy */ 3607 link->lpm_policy = old_policy; 3608 if (ap && ap->slave_link) 3609 ap->slave_link->lpm_policy = old_policy; 3610 --- 641 unchanged lines hidden --- | 3611 return 0; 3612 3613fail: 3614 /* restore the old policy */ 3615 link->lpm_policy = old_policy; 3616 if (ap && ap->slave_link) 3617 ap->slave_link->lpm_policy = old_policy; 3618 --- 641 unchanged lines hidden --- |