Lines Matching defs:phy
180 static int sas_get_linkerrors(struct sas_phy *phy)
182 if (scsi_is_sas_phy_local(phy)) {
183 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
185 struct asd_sas_phy *asd_phy = sas_ha->sas_phy[phy->number];
192 return sas_smp_get_phy_events(phy);
217 * transport_sas_phy_reset - reset a phy and permit libata to manage the link
219 * phy reset request via sysfs in host workqueue context so we know we
222 static int transport_sas_phy_reset(struct sas_phy *phy, int hard_reset)
231 if (scsi_is_sas_phy_local(phy)) {
232 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
234 struct asd_sas_phy *asd_phy = sas_ha->sas_phy[phy->number];
242 struct sas_rphy *rphy = dev_to_rphy(phy->dev.parent);
244 struct domain_device *ata_dev = sas_ex_to_ata(ddev, phy->number);
251 return sas_smp_phy_control(ddev, phy->number, reset_type, NULL);
255 static int sas_phy_enable(struct sas_phy *phy, int enable)
265 if (scsi_is_sas_phy_local(phy)) {
266 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
268 struct asd_sas_phy *asd_phy = sas_ha->sas_phy[phy->number];
273 ret = transport_sas_phy_reset(phy, 0);
277 struct sas_rphy *rphy = dev_to_rphy(phy->dev.parent);
281 ret = transport_sas_phy_reset(phy, 0);
283 ret = sas_smp_phy_control(ddev, phy->number, cmd, NULL);
288 int sas_phy_reset(struct sas_phy *phy, int hard_reset)
293 if (!phy->enabled)
301 if (scsi_is_sas_phy_local(phy)) {
302 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
304 struct asd_sas_phy *asd_phy = sas_ha->sas_phy[phy->number];
310 struct sas_rphy *rphy = dev_to_rphy(phy->dev.parent);
312 ret = sas_smp_phy_control(ddev, phy->number, reset_type, NULL);
317 int sas_set_phy_speed(struct sas_phy *phy,
323 rates->minimum_linkrate > phy->maximum_linkrate) ||
325 rates->maximum_linkrate < phy->minimum_linkrate))
329 rates->minimum_linkrate < phy->minimum_linkrate_hw)
330 rates->minimum_linkrate = phy->minimum_linkrate_hw;
333 rates->maximum_linkrate > phy->maximum_linkrate_hw)
334 rates->maximum_linkrate = phy->maximum_linkrate_hw;
336 if (scsi_is_sas_phy_local(phy)) {
337 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
339 struct asd_sas_phy *asd_phy = sas_ha->sas_phy[phy->number];
346 struct sas_rphy *rphy = dev_to_rphy(phy->dev.parent);
348 ret = sas_smp_phy_control(ddev, phy->number,
364 struct asd_sas_phy *phy = ha->sas_phy[i];
366 memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
367 phy->frame_rcvd_size = 0;
377 struct asd_sas_phy *phy = ha->sas_phy[i];
379 if (phy->suspended)
392 * at this point we may be racing the phy coming back (as posted
394 * libsas context check that the phy remains suspended before
399 dev_info(ha->dev, "waiting up to 25 seconds for %d phy%s to resume\n",
403 struct asd_sas_phy *phy = ha->sas_phy[i];
405 if (phy->suspended) {
406 dev_warn(&phy->phy->dev, "resume timeout\n");
407 sas_notify_phy_event(phy, PHYE_RESUME_TIMEOUT);
438 static void sas_phy_release(struct sas_phy *phy)
440 kfree(phy->hostdata);
441 phy->hostdata = NULL;
448 d->reset_result = transport_sas_phy_reset(d->phy, d->hard_reset);
455 d->enable_result = sas_phy_enable(d->phy, d->enable);
458 static int sas_phy_setup(struct sas_phy *phy)
468 d->phy = phy;
469 phy->hostdata = d;
474 static int queue_phy_reset(struct sas_phy *phy, int hard_reset)
476 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
478 struct sas_phy_data *d = phy->hostdata;
501 static int queue_phy_enable(struct sas_phy *phy, int enable)
503 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
505 struct sas_phy_data *d = phy->hostdata;
587 static struct asd_sas_event *__sas_alloc_event(struct asd_sas_phy *phy,
591 struct sas_ha_struct *sas_ha = phy->ha;
599 atomic_inc(&phy->event_nr);
601 if (atomic_read(&phy->event_nr) > phy->ha->event_thres) {
603 if (cmpxchg(&phy->in_shutdown, 0, 1) == 0) {
604 pr_notice("The phy%d bursting events, shut it down.\n",
605 phy->id);
606 sas_notify_phy_event_gfp(phy, PHYE_SHUTDOWN,
613 atomic_dec(&phy->event_nr);
621 struct asd_sas_event *sas_alloc_event(struct asd_sas_phy *phy)
623 return __sas_alloc_event(phy, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
626 struct asd_sas_event *sas_alloc_event_gfp(struct asd_sas_phy *phy,
629 return __sas_alloc_event(phy, gfp_flags);
634 struct asd_sas_phy *phy = event->phy;
637 atomic_dec(&phy->event_nr);