Commit bc14e871 authored by Gabriele Mazzotta's avatar Gabriele Mazzotta Committed by Ben Hutchings

libata: Add helper to determine when PHY events should be ignored

commit 8393b811 upstream.

This is a preparation commit that will allow to add other criteria
according to which PHY events should be dropped.
Signed-off-by: default avatarGabriele Mazzotta <gabriele.mzt@gmail.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 57279928
...@@ -1668,8 +1668,7 @@ static void ahci_port_intr(struct ata_port *ap) ...@@ -1668,8 +1668,7 @@ static void ahci_port_intr(struct ata_port *ap)
if (unlikely(resetting)) if (unlikely(resetting))
status &= ~PORT_IRQ_BAD_PMP; status &= ~PORT_IRQ_BAD_PMP;
/* if LPM is enabled, PHYRDY doesn't mean anything */ if (sata_lpm_ignore_phy_events(&ap->link)) {
if (ap->link.lpm_policy > ATA_LPM_MAX_POWER) {
status &= ~PORT_IRQ_PHYRDY; status &= ~PORT_IRQ_PHYRDY;
ahci_scr_write(&ap->link, SCR_ERROR, SERR_PHYRDY_CHG); ahci_scr_write(&ap->link, SCR_ERROR, SERR_PHYRDY_CHG);
} }
......
...@@ -6615,6 +6615,25 @@ u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, u32 val, ...@@ -6615,6 +6615,25 @@ u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, u32 val,
return tmp; return tmp;
} }
/**
* sata_lpm_ignore_phy_events - test if PHY event should be ignored
* @link: Link receiving the event
*
* Test whether the received PHY event has to be ignored or not.
*
* LOCKING:
* None:
*
* RETURNS:
* True if the event has to be ignored.
*/
bool sata_lpm_ignore_phy_events(struct ata_link *link)
{
/* if LPM is enabled, PHYRDY doesn't mean anything */
return !!(link->lpm_policy > ATA_LPM_MAX_POWER);
}
EXPORT_SYMBOL_GPL(sata_lpm_ignore_phy_events);
/* /*
* Dummy port_ops * Dummy port_ops
*/ */
......
...@@ -1064,6 +1064,7 @@ extern struct ata_device *ata_dev_pair(struct ata_device *adev); ...@@ -1064,6 +1064,7 @@ extern struct ata_device *ata_dev_pair(struct ata_device *adev);
extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap); extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap);
extern void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, struct list_head *eh_q); extern void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, struct list_head *eh_q);
extern bool sata_lpm_ignore_phy_events(struct ata_link *link);
extern int ata_cable_40wire(struct ata_port *ap); extern int ata_cable_40wire(struct ata_port *ap);
extern int ata_cable_80wire(struct ata_port *ap); extern int ata_cable_80wire(struct ata_port *ap);
......
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