[SCSI] aci94xx: implement link rate setting
This patch implements the ability to set the minimum and maximum linkrates for both libsas (for expanders) and aic94xx (for the host phys). It also tidies up the setting of the hardware min and max to make sure they're updated when the expander emits a change broadcast. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
committed by
James Bottomley
parent
d24e1eeb3a
commit
a01e70e570
@@ -159,17 +159,57 @@ static int sas_phy_reset(struct sas_phy *phy, int hard_reset)
|
||||
struct sas_internal *i =
|
||||
to_sas_internal(sas_ha->core.shost->transportt);
|
||||
|
||||
ret = i->dft->lldd_control_phy(asd_phy, reset_type);
|
||||
ret = i->dft->lldd_control_phy(asd_phy, reset_type, NULL);
|
||||
} else {
|
||||
struct sas_rphy *rphy = dev_to_rphy(phy->dev.parent);
|
||||
struct domain_device *ddev = sas_find_dev_by_rphy(rphy);
|
||||
ret = sas_smp_phy_control(ddev, phy->number, reset_type);
|
||||
ret = sas_smp_phy_control(ddev, phy->number, reset_type, NULL);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sas_set_phy_speed(struct sas_phy *phy,
|
||||
struct sas_phy_linkrates *rates)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if ((rates->minimum_linkrate &&
|
||||
rates->minimum_linkrate > phy->maximum_linkrate) ||
|
||||
(rates->maximum_linkrate &&
|
||||
rates->maximum_linkrate < phy->minimum_linkrate))
|
||||
return -EINVAL;
|
||||
|
||||
if (rates->minimum_linkrate &&
|
||||
rates->minimum_linkrate < phy->minimum_linkrate_hw)
|
||||
rates->minimum_linkrate = phy->minimum_linkrate_hw;
|
||||
|
||||
if (rates->maximum_linkrate &&
|
||||
rates->maximum_linkrate > phy->maximum_linkrate_hw)
|
||||
rates->maximum_linkrate = phy->maximum_linkrate_hw;
|
||||
|
||||
if (scsi_is_sas_phy_local(phy)) {
|
||||
struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
|
||||
struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost);
|
||||
struct asd_sas_phy *asd_phy = sas_ha->sas_phy[phy->number];
|
||||
struct sas_internal *i =
|
||||
to_sas_internal(sas_ha->core.shost->transportt);
|
||||
|
||||
ret = i->dft->lldd_control_phy(asd_phy, PHY_FUNC_SET_LINK_RATE,
|
||||
rates);
|
||||
} else {
|
||||
struct sas_rphy *rphy = dev_to_rphy(phy->dev.parent);
|
||||
struct domain_device *ddev = sas_find_dev_by_rphy(rphy);
|
||||
ret = sas_smp_phy_control(ddev, phy->number,
|
||||
PHY_FUNC_LINK_RESET, rates);
|
||||
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct sas_function_template sft = {
|
||||
.phy_reset = sas_phy_reset,
|
||||
.set_phy_speed = sas_set_phy_speed,
|
||||
.get_linkerrors = sas_get_linkerrors,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user