aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriele Mazzotta <gabriele.mzt@gmail.com>2015-04-25 13:52:36 -0400
committerTejun Heo <tj@kernel.org>2015-04-25 16:50:14 -0400
commit8393b811f38acdf7fd8da2028708edad3e68ce1f (patch)
tree416d3ec188647783e4364f162a793ef3369aabc0
parente0e2674b92056c24c69940d5f405ea4aef5e4010 (diff)
libata: Add helper to determine when PHY events should be ignored
This is a preparation commit that will allow to add other criteria according to which PHY events should be dropped. Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: stable@vger.kernel.org
-rw-r--r--drivers/ata/libahci.c3
-rw-r--r--drivers/ata/libata-core.c19
-rw-r--r--include/linux/libata.h1
3 files changed, 21 insertions, 2 deletions
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 61a9c07e0dff..287c4ba0219f 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1707,8 +1707,7 @@ static void ahci_handle_port_interrupt(struct ata_port *ap,
1707 if (unlikely(resetting)) 1707 if (unlikely(resetting))
1708 status &= ~PORT_IRQ_BAD_PMP; 1708 status &= ~PORT_IRQ_BAD_PMP;
1709 1709
1710 /* if LPM is enabled, PHYRDY doesn't mean anything */ 1710 if (sata_lpm_ignore_phy_events(&ap->link)) {
1711 if (ap->link.lpm_policy > ATA_LPM_MAX_POWER) {
1712 status &= ~PORT_IRQ_PHYRDY; 1711 status &= ~PORT_IRQ_PHYRDY;
1713 ahci_scr_write(&ap->link, SCR_ERROR, SERR_PHYRDY_CHG); 1712 ahci_scr_write(&ap->link, SCR_ERROR, SERR_PHYRDY_CHG);
1714 } 1713 }
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index f6cb1f1b30b7..12adcf78f94b 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6752,6 +6752,25 @@ u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, u32 val,
6752 return tmp; 6752 return tmp;
6753} 6753}
6754 6754
6755/**
6756 * sata_lpm_ignore_phy_events - test if PHY event should be ignored
6757 * @link: Link receiving the event
6758 *
6759 * Test whether the received PHY event has to be ignored or not.
6760 *
6761 * LOCKING:
6762 * None:
6763 *
6764 * RETURNS:
6765 * True if the event has to be ignored.
6766 */
6767bool sata_lpm_ignore_phy_events(struct ata_link *link)
6768{
6769 /* if LPM is enabled, PHYRDY doesn't mean anything */
6770 return !!(link->lpm_policy > ATA_LPM_MAX_POWER);
6771}
6772EXPORT_SYMBOL_GPL(sata_lpm_ignore_phy_events);
6773
6755/* 6774/*
6756 * Dummy port_ops 6775 * Dummy port_ops
6757 */ 6776 */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 8dad4a307bb8..6138d87277af 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1201,6 +1201,7 @@ extern struct ata_device *ata_dev_pair(struct ata_device *adev);
1201extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); 1201extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
1202extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap); 1202extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap);
1203extern void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, struct list_head *eh_q); 1203extern void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, struct list_head *eh_q);
1204extern bool sata_lpm_ignore_phy_events(struct ata_link *link);
1204 1205
1205extern int ata_cable_40wire(struct ata_port *ap); 1206extern int ata_cable_40wire(struct ata_port *ap);
1206extern int ata_cable_80wire(struct ata_port *ap); 1207extern int ata_cable_80wire(struct ata_port *ap);