diff options
author | Dan Williams <dan.j.williams@intel.com> | 2012-06-22 08:41:51 +0200 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-08-24 11:10:23 +0200 |
commit | 303694eeee5eacad5b84105a15afd9e351e1891b (patch) | |
tree | ba8e16274ffbde39b21100ced62b5b11e8c926d6 /drivers/scsi/libsas/sas_phy.c | |
parent | [SCSI] libata: export ata_port suspend/resume infrastructure for sas (diff) | |
download | linux-303694eeee5eacad5b84105a15afd9e351e1891b.tar.xz linux-303694eeee5eacad5b84105a15afd9e351e1891b.zip |
[SCSI] libsas: suspend / resume support
libsas power management routines to suspend and recover the sas domain
based on a model where the lldd is allowed and expected to be
"forgetful".
sas_suspend_ha - disable event processing allowing the lldd to take down
links without concern for causing hotplug events.
Regardless of whether the lldd actually posts link down
messages libsas notifies the lldd that all
domain_devices are gone.
sas_prep_resume_ha - on the way back up before the lldd starts link
training clean out any spurious events that were
generated on the way down, and re-enable event
processing
sas_resume_ha - after the lldd has started and decided that all phys
have posted link-up events this routine is called to let
libsas start it's own timeout of any phys that did not
resume. After the timeout an lldd can cancel the
phy teardown by posting a link-up event.
Storage for ex_change_count (u16) and phy_change_count (u8) are changed
to int so they can be set to -1 to indicate 'invalidated'.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Jacek Danecki <jacek.danecki@intel.com>
Tested-by: Maciej Patelczyk <maciej.patelczyk@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/libsas/sas_phy.c')
-rw-r--r-- | drivers/scsi/libsas/sas_phy.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/scsi/libsas/sas_phy.c b/drivers/scsi/libsas/sas_phy.c index 521422e857ab..cdee446c29e1 100644 --- a/drivers/scsi/libsas/sas_phy.c +++ b/drivers/scsi/libsas/sas_phy.c @@ -94,6 +94,25 @@ static void sas_phye_spinup_hold(struct work_struct *work) i->dft->lldd_control_phy(phy, PHY_FUNC_RELEASE_SPINUP_HOLD, NULL); } +static void sas_phye_resume_timeout(struct work_struct *work) +{ + struct asd_sas_event *ev = to_asd_sas_event(work); + struct asd_sas_phy *phy = ev->phy; + + clear_bit(PHYE_RESUME_TIMEOUT, &phy->phy_events_pending); + + /* phew, lldd got the phy back in the nick of time */ + if (!phy->suspended) { + dev_info(&phy->phy->dev, "resume timeout cancelled\n"); + return; + } + + phy->error = 0; + phy->suspended = 0; + sas_deform_port(phy, 1); +} + + /* ---------- Phy class registration ---------- */ int sas_register_phys(struct sas_ha_struct *sas_ha) @@ -105,6 +124,8 @@ int sas_register_phys(struct sas_ha_struct *sas_ha) [PHYE_OOB_DONE] = sas_phye_oob_done, [PHYE_OOB_ERROR] = sas_phye_oob_error, [PHYE_SPINUP_HOLD] = sas_phye_spinup_hold, + [PHYE_RESUME_TIMEOUT] = sas_phye_resume_timeout, + }; static const work_func_t sas_port_event_fns[PORT_NUM_EVENTS] = { |