Lines Matching refs:rphy
163 struct sas_rphy *rphy = target_to_rphy(sdev->sdev_target);
166 BUG_ON(rphy->identify.device_type != SAS_END_DEVICE);
168 rdev = rphy_to_end_device(rphy);
175 struct sas_rphy *rphy = NULL;
178 rphy = dev_to_rphy(job->dev);
186 to_sas_internal(shost->transportt)->f->smp_handler(job, shost, rphy);
190 static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy)
199 if (rphy) {
200 q = bsg_setup_queue(&rphy->dev, dev_name(&rphy->dev),
204 rphy->q = q;
332 return rdev->rphy.identify.sas_address;
702 struct sas_rphy *rphy = dev_to_rphy(parent);
704 rphy->scsi_target_id, number);
899 struct sas_rphy *rphy = dev_to_rphy(parent);
901 rphy->scsi_target_id, port->port_identifier);
933 struct sas_rphy *rphy = dev_to_rphy(parent);
934 struct sas_expander_device *exp = rphy_to_expander_device(rphy);
998 if (port->rphy) {
999 sas_rphy_delete(port->rphy);
1000 port->rphy = NULL;
1146 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1148 return snprintf(buf, 20, format_string, cast rphy->field); \
1153 static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \
1161 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1163 if (!rphy->field) \
1165 return get_sas_protocol_names(rphy->field, buf); \
1170 static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \
1177 struct sas_rphy *rphy = transport_class_to_rphy(dev);
1179 if (!rphy->identify.device_type)
1182 rphy->identify.device_type, buf);
1185 static SAS_DEVICE_ATTR(rphy, device_type, S_IRUGO,
1192 struct sas_rphy *rphy = transport_class_to_rphy(dev);
1193 struct sas_phy *phy = dev_to_phy(rphy->dev.parent);
1199 error = i->f->get_enclosure_identifier(rphy, &identifier);
1205 static SAS_DEVICE_ATTR(rphy, enclosure_identifier, S_IRUGO,
1212 struct sas_rphy *rphy = transport_class_to_rphy(dev);
1213 struct sas_phy *phy = dev_to_phy(rphy->dev.parent);
1218 val = i->f->get_bay_identifier(rphy);
1224 static SAS_DEVICE_ATTR(rphy, bay_identifier, S_IRUGO,
1280 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1281 struct sas_end_device *rdev = rphy_to_end_device(rphy); \
1309 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1310 struct sas_expander_device *edev = rphy_to_expander_device(rphy); \
1357 struct sas_rphy *rphy;
1362 rphy = dev_to_rphy(dev);
1372 rphy->identify.device_type == SAS_END_DEVICE;
1380 struct sas_rphy *rphy;
1385 rphy = dev_to_rphy(dev);
1395 (rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE ||
1396 rphy->identify.device_type == SAS_FANOUT_EXPANDER_DEVICE);
1401 struct sas_rphy *rphy = dev_to_rphy(dev);
1402 struct sas_expander_device *edev = rphy_to_expander_device(rphy);
1410 struct sas_rphy *rphy = dev_to_rphy(dev);
1411 struct sas_end_device *edev = rphy_to_end_device(rphy);
1418 * sas_rphy_initialize - common rphy initialization
1419 * @rphy: rphy to initialise
1422 * initialise the common rphy component of each.
1424 static void sas_rphy_initialize(struct sas_rphy *rphy)
1426 INIT_LIST_HEAD(&rphy->list);
1430 * sas_end_device_alloc - allocate an rphy for an end device
1448 device_initialize(&rdev->rphy.dev);
1449 rdev->rphy.dev.parent = get_device(&parent->dev);
1450 rdev->rphy.dev.release = sas_end_device_release;
1452 struct sas_rphy *rphy = dev_to_rphy(parent->dev.parent);
1453 dev_set_name(&rdev->rphy.dev, "end_device-%d:%d:%d",
1454 shost->host_no, rphy->scsi_target_id,
1457 dev_set_name(&rdev->rphy.dev, "end_device-%d:%d",
1459 rdev->rphy.identify.device_type = SAS_END_DEVICE;
1460 sas_rphy_initialize(&rdev->rphy);
1461 transport_setup_device(&rdev->rphy.dev);
1463 return &rdev->rphy;
1468 * sas_expander_alloc - allocate an rphy for an end device
1492 device_initialize(&rdev->rphy.dev);
1493 rdev->rphy.dev.parent = get_device(&parent->dev);
1494 rdev->rphy.dev.release = sas_expander_release;
1496 rdev->rphy.scsi_target_id = sas_host->next_expander_id++;
1498 dev_set_name(&rdev->rphy.dev, "expander-%d:%d",
1499 shost->host_no, rdev->rphy.scsi_target_id);
1500 rdev->rphy.identify.device_type = type;
1501 sas_rphy_initialize(&rdev->rphy);
1502 transport_setup_device(&rdev->rphy.dev);
1504 return &rdev->rphy;
1510 * @rphy: The remote PHY to be added
1514 int sas_rphy_add(struct sas_rphy *rphy)
1516 struct sas_port *parent = dev_to_sas_port(rphy->dev.parent);
1519 struct sas_identify *identify = &rphy->identify;
1522 if (parent->rphy)
1524 parent->rphy = rphy;
1526 error = device_add(&rphy->dev);
1529 transport_add_device(&rphy->dev);
1530 transport_configure_device(&rphy->dev);
1531 if (sas_bsg_initialize(shost, rphy))
1532 printk("fail to a bsg device %s\n", dev_name(&rphy->dev));
1536 list_add_tail(&rphy->list, &sas_host->rphy_list);
1540 rphy->scsi_target_id = sas_host->next_target_id++;
1542 rphy->scsi_target_id = -1;
1546 rphy->scsi_target_id != -1) {
1554 scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, lun,
1564 * @rphy: SAS remote PHY to free
1573 void sas_rphy_free(struct sas_rphy *rphy)
1575 struct device *dev = &rphy->dev;
1576 struct Scsi_Host *shost = dev_to_shost(rphy->dev.parent->parent);
1580 list_del(&rphy->list);
1591 * @rphy: SAS remote PHY to remove and free
1596 sas_rphy_delete(struct sas_rphy *rphy)
1598 sas_rphy_remove(rphy);
1599 sas_rphy_free(rphy);
1605 * @rphy: SAS remote phy to unlink from its parent port
1607 * Removes port reference to an rphy
1609 void sas_rphy_unlink(struct sas_rphy *rphy)
1611 struct sas_port *parent = dev_to_sas_port(rphy->dev.parent);
1613 parent->rphy = NULL;
1619 * @rphy: SAS remote phy to remove
1624 sas_rphy_remove(struct sas_rphy *rphy)
1626 struct device *dev = &rphy->dev;
1628 switch (rphy->identify.device_type) {
1640 sas_rphy_unlink(rphy);
1641 bsg_remove_queue(rphy->q);
1670 struct sas_rphy *rphy;
1673 list_for_each_entry(rphy, &sas_host->rphy_list, list) {
1674 if (rphy->identify.device_type != SAS_END_DEVICE ||
1675 rphy->scsi_target_id == -1)
1679 (id == SCAN_WILD_CARD || id == rphy->scsi_target_id)) {
1680 scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id,