[PATCH] libata: implement PM EH actions
Implement two PM per-dev EH actions - ATA_EH_SUSPEND and ATA_EH_RESUME. Each action puts the target device into suspended mode and resumes from it respectively. Once a device is put to suspended mode, no EH operations other than RESUME is allowed on the device. The device will stay suspended till it gets resumed and thus reset and revalidated. To implement this, a new device state helper - ata_dev_ready() - is implemented and used in EH action implementations to make them operate only on attached & running devices. If all possible devices on a port are suspended, reset is skipped too. This prevents spurious events including hotplug events from disrupting suspended devices. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
parent
c0b6c0377c
commit
02670bf379
3 changed files with 198 additions and 4 deletions
|
@ -131,6 +131,7 @@ enum {
|
|||
ATA_DFLAG_CFG_MASK = (1 << 8) - 1,
|
||||
|
||||
ATA_DFLAG_PIO = (1 << 8), /* device currently in PIO mode */
|
||||
ATA_DFLAG_SUSPENDED = (1 << 9), /* device suspended */
|
||||
ATA_DFLAG_INIT_MASK = (1 << 16) - 1,
|
||||
|
||||
ATA_DFLAG_DETACH = (1 << 16),
|
||||
|
@ -253,9 +254,13 @@ enum {
|
|||
ATA_EH_REVALIDATE = (1 << 0),
|
||||
ATA_EH_SOFTRESET = (1 << 1),
|
||||
ATA_EH_HARDRESET = (1 << 2),
|
||||
ATA_EH_SUSPEND = (1 << 3),
|
||||
ATA_EH_RESUME = (1 << 4),
|
||||
ATA_EH_PM_FREEZE = (1 << 5),
|
||||
|
||||
ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
|
||||
ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE,
|
||||
ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE | ATA_EH_SUSPEND |
|
||||
ATA_EH_RESUME | ATA_EH_PM_FREEZE,
|
||||
|
||||
/* ata_eh_info->flags */
|
||||
ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */
|
||||
|
@ -944,6 +949,11 @@ static inline unsigned int ata_dev_absent(const struct ata_device *dev)
|
|||
return ata_class_absent(dev->class);
|
||||
}
|
||||
|
||||
static inline unsigned int ata_dev_ready(const struct ata_device *dev)
|
||||
{
|
||||
return ata_dev_enabled(dev) && !(dev->flags & ATA_DFLAG_SUSPENDED);
|
||||
}
|
||||
|
||||
/*
|
||||
* port helpers
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue