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()
1232 error = i->f->get_enclosure_identifier(rphy, &identifier); in show_sas_rphy_enclosure_identifier()
1238 static SAS_DEVICE_ATTR(rphy, enclosure_identifier, S_IRUGO,
1245 struct sas_rphy *rphy = transport_class_to_rphy(dev); in show_sas_rphy_bay_identifier() local
1246 struct sas_phy *phy = dev_to_phy(rphy->dev.parent); in show_sas_rphy_bay_identifier()
1254 val = i->f->get_bay_identifier(rphy); in show_sas_rphy_bay_identifier()
1260 static SAS_DEVICE_ATTR(rphy, bay_identifier, S_IRUGO,
1316 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1317 struct sas_end_device *rdev = rphy_to_end_device(rphy); \
1345 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1346 struct sas_expander_device *edev = rphy_to_expander_device(rphy); \
1393 struct sas_rphy *rphy; in sas_end_dev_match() local
1398 rphy = dev_to_rphy(dev); in sas_end_dev_match()
1408 rphy->identify.device_type == SAS_END_DEVICE; in sas_end_dev_match()
1416 struct sas_rphy *rphy; in sas_expander_match() local
1421 rphy = dev_to_rphy(dev); in sas_expander_match()
1431 (rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE || in sas_expander_match()
1432 rphy->identify.device_type == SAS_FANOUT_EXPANDER_DEVICE); in sas_expander_match()
1437 struct sas_rphy *rphy = dev_to_rphy(dev); in sas_expander_release() local
1438 struct sas_expander_device *edev = rphy_to_expander_device(rphy); in sas_expander_release()
1440 if (rphy->q) in sas_expander_release()
1441 blk_cleanup_queue(rphy->q); in sas_expander_release()
1449 struct sas_rphy *rphy = dev_to_rphy(dev); in sas_end_device_release() local
1450 struct sas_end_device *edev = rphy_to_end_device(rphy); in sas_end_device_release()
1452 if (rphy->q) in sas_end_device_release()
1453 blk_cleanup_queue(rphy->q); in sas_end_device_release()
1466 static void sas_rphy_initialize(struct sas_rphy *rphy) in sas_rphy_initialize() argument
1468 INIT_LIST_HEAD(&rphy->list); in sas_rphy_initialize()
1490 device_initialize(&rdev->rphy.dev); in sas_end_device_alloc()
1491 rdev->rphy.dev.parent = get_device(&parent->dev); in sas_end_device_alloc()
1492 rdev->rphy.dev.release = sas_end_device_release; in sas_end_device_alloc()
1494 struct sas_rphy *rphy = dev_to_rphy(parent->dev.parent); in sas_end_device_alloc() local
1495 dev_set_name(&rdev->rphy.dev, "end_device-%d:%d:%d", in sas_end_device_alloc()
1496 shost->host_no, rphy->scsi_target_id, in sas_end_device_alloc()
1499 dev_set_name(&rdev->rphy.dev, "end_device-%d:%d", in sas_end_device_alloc()
1501 rdev->rphy.identify.device_type = SAS_END_DEVICE; in sas_end_device_alloc()
1502 sas_rphy_initialize(&rdev->rphy); in sas_end_device_alloc()
1503 transport_setup_device(&rdev->rphy.dev); in sas_end_device_alloc()
1505 return &rdev->rphy; in sas_end_device_alloc()
1534 device_initialize(&rdev->rphy.dev); in sas_expander_alloc()
1535 rdev->rphy.dev.parent = get_device(&parent->dev); in sas_expander_alloc()
1536 rdev->rphy.dev.release = sas_expander_release; in sas_expander_alloc()
1538 rdev->rphy.scsi_target_id = sas_host->next_expander_id++; in sas_expander_alloc()
1540 dev_set_name(&rdev->rphy.dev, "expander-%d:%d", in sas_expander_alloc()
1541 shost->host_no, rdev->rphy.scsi_target_id); in sas_expander_alloc()
1542 rdev->rphy.identify.device_type = type; in sas_expander_alloc()
1543 sas_rphy_initialize(&rdev->rphy); in sas_expander_alloc()
1544 transport_setup_device(&rdev->rphy.dev); in sas_expander_alloc()
1546 return &rdev->rphy; in sas_expander_alloc()
1556 int sas_rphy_add(struct sas_rphy *rphy) in sas_rphy_add() argument
1558 struct sas_port *parent = dev_to_sas_port(rphy->dev.parent); in sas_rphy_add()
1561 struct sas_identify *identify = &rphy->identify; in sas_rphy_add()
1564 if (parent->rphy) in sas_rphy_add()
1566 parent->rphy = rphy; in sas_rphy_add()
1568 error = device_add(&rphy->dev); in sas_rphy_add()
1571 transport_add_device(&rphy->dev); in sas_rphy_add()
1572 transport_configure_device(&rphy->dev); in sas_rphy_add()
1573 if (sas_bsg_initialize(shost, rphy)) in sas_rphy_add()
1574 printk("fail to a bsg device %s\n", dev_name(&rphy->dev)); in sas_rphy_add()
1578 list_add_tail(&rphy->list, &sas_host->rphy_list); in sas_rphy_add()
1582 rphy->scsi_target_id = sas_host->next_target_id++; in sas_rphy_add()
1584 rphy->scsi_target_id = -1; in sas_rphy_add()
1588 rphy->scsi_target_id != -1) { in sas_rphy_add()
1596 scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, lun, 0); in sas_rphy_add()
1614 void sas_rphy_free(struct sas_rphy *rphy) in sas_rphy_free() argument
1616 struct device *dev = &rphy->dev; in sas_rphy_free()
1617 struct Scsi_Host *shost = dev_to_shost(rphy->dev.parent->parent); in sas_rphy_free()
1621 list_del(&rphy->list); in sas_rphy_free()
1637 sas_rphy_delete(struct sas_rphy *rphy) in sas_rphy_delete() argument
1639 sas_rphy_remove(rphy); in sas_rphy_delete()
1640 sas_rphy_free(rphy); in sas_rphy_delete()
1650 void sas_rphy_unlink(struct sas_rphy *rphy) in sas_rphy_unlink() argument
1652 struct sas_port *parent = dev_to_sas_port(rphy->dev.parent); in sas_rphy_unlink()
1654 parent->rphy = NULL; in sas_rphy_unlink()
1665 sas_rphy_remove(struct sas_rphy *rphy) in sas_rphy_remove() argument
1667 struct device *dev = &rphy->dev; in sas_rphy_remove()
1669 switch (rphy->identify.device_type) { in sas_rphy_remove()
1681 sas_rphy_unlink(rphy); in sas_rphy_remove()
1682 sas_bsg_remove(NULL, rphy); in sas_rphy_remove()
1711 struct sas_rphy *rphy; in sas_user_scan() local
1714 list_for_each_entry(rphy, &sas_host->rphy_list, list) { in sas_user_scan()
1715 if (rphy->identify.device_type != SAS_END_DEVICE || in sas_user_scan()
1716 rphy->scsi_target_id == -1) in sas_user_scan()
1720 (id == SCAN_WILD_CARD || id == rphy->scsi_target_id)) { in sas_user_scan()
1721 scsi_scan_target(&rphy->dev, 0, in sas_user_scan()
1722 rphy->scsi_target_id, lun, 1); in sas_user_scan()