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;
326 return rdev->rphy.identify.sas_address;
696 struct sas_rphy *rphy = dev_to_rphy(parent);
698 rphy->scsi_target_id, number);
893 struct sas_rphy *rphy = dev_to_rphy(parent);
895 rphy->scsi_target_id, port->port_identifier);
927 struct sas_rphy *rphy = dev_to_rphy(parent);
928 struct sas_expander_device *exp = rphy_to_expander_device(rphy);
992 if (port->rphy) {
993 sas_rphy_delete(port->rphy);
994 port->rphy = NULL;
1140 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1142 return snprintf(buf, 20, format_string, cast rphy->field); \
1147 static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \
1155 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1157 if (!rphy->field) \
1159 return get_sas_protocol_names(rphy->field, buf); \
1164 static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \
1171 struct sas_rphy *rphy = transport_class_to_rphy(dev);
1173 if (!rphy->identify.device_type)
1176 rphy->identify.device_type, buf);
1179 static SAS_DEVICE_ATTR(rphy, device_type, S_IRUGO,
1186 struct sas_rphy *rphy = transport_class_to_rphy(dev);
1187 struct sas_phy *phy = dev_to_phy(rphy->dev.parent);
1193 error = i->f->get_enclosure_identifier(rphy, &identifier);
1199 static SAS_DEVICE_ATTR(rphy, enclosure_identifier, S_IRUGO,
1206 struct sas_rphy *rphy = transport_class_to_rphy(dev);
1207 struct sas_phy *phy = dev_to_phy(rphy->dev.parent);
1212 val = i->f->get_bay_identifier(rphy);
1218 static SAS_DEVICE_ATTR(rphy, bay_identifier, S_IRUGO,
1274 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1275 struct sas_end_device *rdev = rphy_to_end_device(rphy); \
1303 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1304 struct sas_expander_device *edev = rphy_to_expander_device(rphy); \
1351 struct sas_rphy *rphy;
1356 rphy = dev_to_rphy(dev);
1366 rphy->identify.device_type == SAS_END_DEVICE;
1374 struct sas_rphy *rphy;
1379 rphy = dev_to_rphy(dev);
1389 (rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE ||
1390 rphy->identify.device_type == SAS_FANOUT_EXPANDER_DEVICE);
1395 struct sas_rphy *rphy = dev_to_rphy(dev);
1396 struct sas_expander_device *edev = rphy_to_expander_device(rphy);
1404 struct sas_rphy *rphy = dev_to_rphy(dev);
1405 struct sas_end_device *edev = rphy_to_end_device(rphy);
1412 * sas_rphy_initialize - common rphy initialization
1413 * @rphy: rphy to initialise
1416 * initialise the common rphy component of each.
1418 static void sas_rphy_initialize(struct sas_rphy *rphy)
1420 INIT_LIST_HEAD(&rphy->list);
1424 * sas_end_device_alloc - allocate an rphy for an end device
1442 device_initialize(&rdev->rphy.dev);
1443 rdev->rphy.dev.parent = get_device(&parent->dev);
1444 rdev->rphy.dev.release = sas_end_device_release;
1446 struct sas_rphy *rphy = dev_to_rphy(parent->dev.parent);
1447 dev_set_name(&rdev->rphy.dev, "end_device-%d:%d:%d",
1448 shost->host_no, rphy->scsi_target_id,
1451 dev_set_name(&rdev->rphy.dev, "end_device-%d:%d",
1453 rdev->rphy.identify.device_type = SAS_END_DEVICE;
1454 sas_rphy_initialize(&rdev->rphy);
1455 transport_setup_device(&rdev->rphy.dev);
1457 return &rdev->rphy;
1462 * sas_expander_alloc - allocate an rphy for an end device
1486 device_initialize(&rdev->rphy.dev);
1487 rdev->rphy.dev.parent = get_device(&parent->dev);
1488 rdev->rphy.dev.release = sas_expander_release;
1490 rdev->rphy.scsi_target_id = sas_host->next_expander_id++;
1492 dev_set_name(&rdev->rphy.dev, "expander-%d:%d",
1493 shost->host_no, rdev->rphy.scsi_target_id);
1494 rdev->rphy.identify.device_type = type;
1495 sas_rphy_initialize(&rdev->rphy);
1496 transport_setup_device(&rdev->rphy.dev);
1498 return &rdev->rphy;
1504 * @rphy: The remote PHY to be added
1508 int sas_rphy_add(struct sas_rphy *rphy)
1510 struct sas_port *parent = dev_to_sas_port(rphy->dev.parent);
1513 struct sas_identify *identify = &rphy->identify;
1516 if (parent->rphy)
1518 parent->rphy = rphy;
1520 error = device_add(&rphy->dev);
1523 transport_add_device(&rphy->dev);
1524 transport_configure_device(&rphy->dev);
1525 if (sas_bsg_initialize(shost, rphy))
1526 printk("fail to a bsg device %s\n", dev_name(&rphy->dev));
1530 list_add_tail(&rphy->list, &sas_host->rphy_list);
1534 rphy->scsi_target_id = sas_host->next_target_id++;
1536 rphy->scsi_target_id = -1;
1540 rphy->scsi_target_id != -1) {
1548 scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, lun,
1558 * @rphy: SAS remote PHY to free
1567 void sas_rphy_free(struct sas_rphy *rphy)
1569 struct device *dev = &rphy->dev;
1570 struct Scsi_Host *shost = dev_to_shost(rphy->dev.parent->parent);
1574 list_del(&rphy->list);
1585 * @rphy: SAS remote PHY to remove and free
1590 sas_rphy_delete(struct sas_rphy *rphy)
1592 sas_rphy_remove(rphy);
1593 sas_rphy_free(rphy);
1599 * @rphy: SAS remote phy to unlink from its parent port
1601 * Removes port reference to an rphy
1603 void sas_rphy_unlink(struct sas_rphy *rphy)
1605 struct sas_port *parent = dev_to_sas_port(rphy->dev.parent);
1607 parent->rphy = NULL;
1613 * @rphy: SAS remote phy to remove
1618 sas_rphy_remove(struct sas_rphy *rphy)
1620 struct device *dev = &rphy->dev;
1622 switch (rphy->identify.device_type) {
1634 sas_rphy_unlink(rphy);
1635 bsg_remove_queue(rphy->q);
1664 struct sas_rphy *rphy;
1667 list_for_each_entry(rphy, &sas_host->rphy_list, list) {
1668 if (rphy->identify.device_type != SAS_END_DEVICE ||
1669 rphy->scsi_target_id == -1)
1673 (id == SCAN_WILD_CARD || id == rphy->scsi_target_id)) {
1674 scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id,