Lines Matching refs:rphy

161 	struct sas_rphy *rphy = target_to_rphy(sdev->sdev_target);  in sas_bitfield_name_search()  local
164 BUG_ON(rphy->identify.device_type != SAS_END_DEVICE); in sas_bitfield_name_search()
166 rdev = rphy_to_end_device(rphy); in sas_bitfield_name_search()
171 struct sas_rphy *rphy) in sas_smp_request() argument
181 ret = handler(shost, rphy, req); in sas_smp_request()
197 struct sas_rphy *rphy = q->queuedata; in sas_non_host_smp_request() local
198 sas_smp_request(q, rphy_to_shost(rphy), rphy); in sas_non_host_smp_request()
211 static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy) in sas_bsg_initialize() argument
225 if (rphy) { in sas_bsg_initialize()
227 dev = &rphy->dev; in sas_bsg_initialize()
247 if (rphy) in sas_bsg_initialize()
248 rphy->q = q; in sas_bsg_initialize()
252 if (rphy) in sas_bsg_initialize()
253 q->queuedata = rphy; in sas_bsg_initialize()
261 static void sas_bsg_remove(struct Scsi_Host *shost, struct sas_rphy *rphy) in sas_bsg_remove() argument
265 if (rphy) in sas_bsg_remove()
266 q = rphy->q; in sas_bsg_remove()
733 struct sas_rphy *rphy = dev_to_rphy(parent); in sas_phy_alloc() local
735 rphy->scsi_target_id, number); in sas_phy_alloc()
925 struct sas_rphy *rphy = dev_to_rphy(parent); in sas_port_alloc() local
927 rphy->scsi_target_id, port->port_identifier); in sas_port_alloc()
959 struct sas_rphy *rphy = dev_to_rphy(parent); in sas_port_alloc_num() local
960 struct sas_expander_device *exp = rphy_to_expander_device(rphy); in sas_port_alloc_num()
1024 if (port->rphy) { in sas_port_delete()
1025 sas_rphy_delete(port->rphy); in sas_port_delete()
1026 port->rphy = NULL; in sas_port_delete()
1172 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1174 return snprintf(buf, 20, format_string, cast rphy->field); \
1179 static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \
1187 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1189 if (!rphy->field) \
1191 return get_sas_protocol_names(rphy->field, buf); \
1196 static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \
1203 struct sas_rphy *rphy = transport_class_to_rphy(dev); in show_sas_rphy_device_type() local
1205 if (!rphy->identify.device_type) in show_sas_rphy_device_type()
1208 rphy->identify.device_type, buf); in show_sas_rphy_device_type()
1211 static SAS_DEVICE_ATTR(rphy, device_type, S_IRUGO,
1218 struct sas_rphy *rphy = transport_class_to_rphy(dev); in show_sas_rphy_enclosure_identifier() local
1219 struct sas_phy *phy = dev_to_phy(rphy->dev.parent); in show_sas_rphy_enclosure_identifier()
1225 error = i->f->get_enclosure_identifier(rphy, &identifier); in show_sas_rphy_enclosure_identifier()
1231 static SAS_DEVICE_ATTR(rphy, enclosure_identifier, S_IRUGO,
1238 struct sas_rphy *rphy = transport_class_to_rphy(dev); in show_sas_rphy_bay_identifier() local
1239 struct sas_phy *phy = dev_to_phy(rphy->dev.parent); in show_sas_rphy_bay_identifier()
1244 val = i->f->get_bay_identifier(rphy); in show_sas_rphy_bay_identifier()
1250 static SAS_DEVICE_ATTR(rphy, bay_identifier, S_IRUGO,
1306 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1307 struct sas_end_device *rdev = rphy_to_end_device(rphy); \
1335 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1336 struct sas_expander_device *edev = rphy_to_expander_device(rphy); \
1383 struct sas_rphy *rphy; in sas_end_dev_match() local
1388 rphy = dev_to_rphy(dev); in sas_end_dev_match()
1398 rphy->identify.device_type == SAS_END_DEVICE; in sas_end_dev_match()
1406 struct sas_rphy *rphy; in sas_expander_match() local
1411 rphy = dev_to_rphy(dev); in sas_expander_match()
1421 (rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE || in sas_expander_match()
1422 rphy->identify.device_type == SAS_FANOUT_EXPANDER_DEVICE); in sas_expander_match()
1427 struct sas_rphy *rphy = dev_to_rphy(dev); in sas_expander_release() local
1428 struct sas_expander_device *edev = rphy_to_expander_device(rphy); in sas_expander_release()
1430 if (rphy->q) in sas_expander_release()
1431 blk_cleanup_queue(rphy->q); in sas_expander_release()
1439 struct sas_rphy *rphy = dev_to_rphy(dev); in sas_end_device_release() local
1440 struct sas_end_device *edev = rphy_to_end_device(rphy); in sas_end_device_release()
1442 if (rphy->q) in sas_end_device_release()
1443 blk_cleanup_queue(rphy->q); in sas_end_device_release()
1456 static void sas_rphy_initialize(struct sas_rphy *rphy) in sas_rphy_initialize() argument
1458 INIT_LIST_HEAD(&rphy->list); in sas_rphy_initialize()
1480 device_initialize(&rdev->rphy.dev); in sas_end_device_alloc()
1481 rdev->rphy.dev.parent = get_device(&parent->dev); in sas_end_device_alloc()
1482 rdev->rphy.dev.release = sas_end_device_release; in sas_end_device_alloc()
1484 struct sas_rphy *rphy = dev_to_rphy(parent->dev.parent); in sas_end_device_alloc() local
1485 dev_set_name(&rdev->rphy.dev, "end_device-%d:%d:%d", in sas_end_device_alloc()
1486 shost->host_no, rphy->scsi_target_id, in sas_end_device_alloc()
1489 dev_set_name(&rdev->rphy.dev, "end_device-%d:%d", in sas_end_device_alloc()
1491 rdev->rphy.identify.device_type = SAS_END_DEVICE; in sas_end_device_alloc()
1492 sas_rphy_initialize(&rdev->rphy); in sas_end_device_alloc()
1493 transport_setup_device(&rdev->rphy.dev); in sas_end_device_alloc()
1495 return &rdev->rphy; in sas_end_device_alloc()
1524 device_initialize(&rdev->rphy.dev); in sas_expander_alloc()
1525 rdev->rphy.dev.parent = get_device(&parent->dev); in sas_expander_alloc()
1526 rdev->rphy.dev.release = sas_expander_release; in sas_expander_alloc()
1528 rdev->rphy.scsi_target_id = sas_host->next_expander_id++; in sas_expander_alloc()
1530 dev_set_name(&rdev->rphy.dev, "expander-%d:%d", in sas_expander_alloc()
1531 shost->host_no, rdev->rphy.scsi_target_id); in sas_expander_alloc()
1532 rdev->rphy.identify.device_type = type; in sas_expander_alloc()
1533 sas_rphy_initialize(&rdev->rphy); in sas_expander_alloc()
1534 transport_setup_device(&rdev->rphy.dev); in sas_expander_alloc()
1536 return &rdev->rphy; in sas_expander_alloc()
1546 int sas_rphy_add(struct sas_rphy *rphy) in sas_rphy_add() argument
1548 struct sas_port *parent = dev_to_sas_port(rphy->dev.parent); in sas_rphy_add()
1551 struct sas_identify *identify = &rphy->identify; in sas_rphy_add()
1554 if (parent->rphy) in sas_rphy_add()
1556 parent->rphy = rphy; in sas_rphy_add()
1558 error = device_add(&rphy->dev); in sas_rphy_add()
1561 transport_add_device(&rphy->dev); in sas_rphy_add()
1562 transport_configure_device(&rphy->dev); in sas_rphy_add()
1563 if (sas_bsg_initialize(shost, rphy)) in sas_rphy_add()
1564 printk("fail to a bsg device %s\n", dev_name(&rphy->dev)); in sas_rphy_add()
1568 list_add_tail(&rphy->list, &sas_host->rphy_list); in sas_rphy_add()
1572 rphy->scsi_target_id = sas_host->next_target_id++; in sas_rphy_add()
1574 rphy->scsi_target_id = -1; in sas_rphy_add()
1578 rphy->scsi_target_id != -1) { in sas_rphy_add()
1586 scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, lun, 0); in sas_rphy_add()
1604 void sas_rphy_free(struct sas_rphy *rphy) in sas_rphy_free() argument
1606 struct device *dev = &rphy->dev; in sas_rphy_free()
1607 struct Scsi_Host *shost = dev_to_shost(rphy->dev.parent->parent); in sas_rphy_free()
1611 list_del(&rphy->list); in sas_rphy_free()
1627 sas_rphy_delete(struct sas_rphy *rphy) in sas_rphy_delete() argument
1629 sas_rphy_remove(rphy); in sas_rphy_delete()
1630 sas_rphy_free(rphy); in sas_rphy_delete()
1640 void sas_rphy_unlink(struct sas_rphy *rphy) in sas_rphy_unlink() argument
1642 struct sas_port *parent = dev_to_sas_port(rphy->dev.parent); in sas_rphy_unlink()
1644 parent->rphy = NULL; in sas_rphy_unlink()
1655 sas_rphy_remove(struct sas_rphy *rphy) in sas_rphy_remove() argument
1657 struct device *dev = &rphy->dev; in sas_rphy_remove()
1659 switch (rphy->identify.device_type) { in sas_rphy_remove()
1671 sas_rphy_unlink(rphy); in sas_rphy_remove()
1672 sas_bsg_remove(NULL, rphy); in sas_rphy_remove()
1701 struct sas_rphy *rphy; in sas_user_scan() local
1704 list_for_each_entry(rphy, &sas_host->rphy_list, list) { in sas_user_scan()
1705 if (rphy->identify.device_type != SAS_END_DEVICE || in sas_user_scan()
1706 rphy->scsi_target_id == -1) in sas_user_scan()
1710 (id == SCAN_WILD_CARD || id == rphy->scsi_target_id)) { in sas_user_scan()
1711 scsi_scan_target(&rphy->dev, 0, in sas_user_scan()
1712 rphy->scsi_target_id, lun, 1); in sas_user_scan()