Lines Matching refs:rphy

163 	struct sas_rphy *rphy = target_to_rphy(sdev->sdev_target);  in sas_bitfield_name_search()  local
166 BUG_ON(rphy->identify.device_type != SAS_END_DEVICE); in sas_bitfield_name_search()
168 rdev = rphy_to_end_device(rphy); in sas_bitfield_name_search()
175 struct sas_rphy *rphy = NULL; in sas_smp_dispatch() local
178 rphy = dev_to_rphy(job->dev); in sas_smp_dispatch()
186 to_sas_internal(shost->transportt)->f->smp_handler(job, shost, rphy); in sas_smp_dispatch()
190 static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy) in sas_bsg_initialize() argument
199 if (rphy) { in sas_bsg_initialize()
200 q = bsg_setup_queue(&rphy->dev, dev_name(&rphy->dev), in sas_bsg_initialize()
204 rphy->q = q; in sas_bsg_initialize()
326 return rdev->rphy.identify.sas_address; in sas_get_address()
696 struct sas_rphy *rphy = dev_to_rphy(parent); in sas_phy_alloc() local
698 rphy->scsi_target_id, number); in sas_phy_alloc()
888 struct sas_rphy *rphy = dev_to_rphy(parent); in sas_port_alloc() local
890 rphy->scsi_target_id, port->port_identifier); in sas_port_alloc()
922 struct sas_rphy *rphy = dev_to_rphy(parent); in sas_port_alloc_num() local
923 struct sas_expander_device *exp = rphy_to_expander_device(rphy); in sas_port_alloc_num()
987 if (port->rphy) { in sas_port_delete()
988 sas_rphy_delete(port->rphy); in sas_port_delete()
989 port->rphy = NULL; in sas_port_delete()
1135 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1137 return snprintf(buf, 20, format_string, cast rphy->field); \
1142 static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \
1150 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1152 if (!rphy->field) \
1154 return get_sas_protocol_names(rphy->field, buf); \
1159 static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \
1166 struct sas_rphy *rphy = transport_class_to_rphy(dev); in show_sas_rphy_device_type() local
1168 if (!rphy->identify.device_type) in show_sas_rphy_device_type()
1171 rphy->identify.device_type, buf); in show_sas_rphy_device_type()
1174 static SAS_DEVICE_ATTR(rphy, device_type, S_IRUGO,
1181 struct sas_rphy *rphy = transport_class_to_rphy(dev); in show_sas_rphy_enclosure_identifier() local
1182 struct sas_phy *phy = dev_to_phy(rphy->dev.parent); in show_sas_rphy_enclosure_identifier()
1188 error = i->f->get_enclosure_identifier(rphy, &identifier); in show_sas_rphy_enclosure_identifier()
1194 static SAS_DEVICE_ATTR(rphy, enclosure_identifier, S_IRUGO,
1201 struct sas_rphy *rphy = transport_class_to_rphy(dev); in show_sas_rphy_bay_identifier() local
1202 struct sas_phy *phy = dev_to_phy(rphy->dev.parent); in show_sas_rphy_bay_identifier()
1207 val = i->f->get_bay_identifier(rphy); in show_sas_rphy_bay_identifier()
1213 static SAS_DEVICE_ATTR(rphy, bay_identifier, S_IRUGO,
1270 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1271 struct sas_end_device *rdev = rphy_to_end_device(rphy); \
1299 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1300 struct sas_expander_device *edev = rphy_to_expander_device(rphy); \
1347 struct sas_rphy *rphy; in sas_end_dev_match() local
1352 rphy = dev_to_rphy(dev); in sas_end_dev_match()
1362 rphy->identify.device_type == SAS_END_DEVICE; in sas_end_dev_match()
1370 struct sas_rphy *rphy; in sas_expander_match() local
1375 rphy = dev_to_rphy(dev); in sas_expander_match()
1385 (rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE || in sas_expander_match()
1386 rphy->identify.device_type == SAS_FANOUT_EXPANDER_DEVICE); in sas_expander_match()
1391 struct sas_rphy *rphy = dev_to_rphy(dev); in sas_expander_release() local
1392 struct sas_expander_device *edev = rphy_to_expander_device(rphy); in sas_expander_release()
1400 struct sas_rphy *rphy = dev_to_rphy(dev); in sas_end_device_release() local
1401 struct sas_end_device *edev = rphy_to_end_device(rphy); in sas_end_device_release()
1414 static void sas_rphy_initialize(struct sas_rphy *rphy) in sas_rphy_initialize() argument
1416 INIT_LIST_HEAD(&rphy->list); in sas_rphy_initialize()
1438 device_initialize(&rdev->rphy.dev); in sas_end_device_alloc()
1439 rdev->rphy.dev.parent = get_device(&parent->dev); in sas_end_device_alloc()
1440 rdev->rphy.dev.release = sas_end_device_release; in sas_end_device_alloc()
1442 struct sas_rphy *rphy = dev_to_rphy(parent->dev.parent); in sas_end_device_alloc() local
1443 dev_set_name(&rdev->rphy.dev, "end_device-%d:%d:%d", in sas_end_device_alloc()
1444 shost->host_no, rphy->scsi_target_id, in sas_end_device_alloc()
1447 dev_set_name(&rdev->rphy.dev, "end_device-%d:%d", in sas_end_device_alloc()
1449 rdev->rphy.identify.device_type = SAS_END_DEVICE; in sas_end_device_alloc()
1450 sas_rphy_initialize(&rdev->rphy); in sas_end_device_alloc()
1451 transport_setup_device(&rdev->rphy.dev); in sas_end_device_alloc()
1453 return &rdev->rphy; in sas_end_device_alloc()
1482 device_initialize(&rdev->rphy.dev); in sas_expander_alloc()
1483 rdev->rphy.dev.parent = get_device(&parent->dev); in sas_expander_alloc()
1484 rdev->rphy.dev.release = sas_expander_release; in sas_expander_alloc()
1486 rdev->rphy.scsi_target_id = sas_host->next_expander_id++; in sas_expander_alloc()
1488 dev_set_name(&rdev->rphy.dev, "expander-%d:%d", in sas_expander_alloc()
1489 shost->host_no, rdev->rphy.scsi_target_id); in sas_expander_alloc()
1490 rdev->rphy.identify.device_type = type; in sas_expander_alloc()
1491 sas_rphy_initialize(&rdev->rphy); in sas_expander_alloc()
1492 transport_setup_device(&rdev->rphy.dev); in sas_expander_alloc()
1494 return &rdev->rphy; in sas_expander_alloc()
1504 int sas_rphy_add(struct sas_rphy *rphy) in sas_rphy_add() argument
1506 struct sas_port *parent = dev_to_sas_port(rphy->dev.parent); in sas_rphy_add()
1509 struct sas_identify *identify = &rphy->identify; in sas_rphy_add()
1512 if (parent->rphy) in sas_rphy_add()
1514 parent->rphy = rphy; in sas_rphy_add()
1516 error = device_add(&rphy->dev); in sas_rphy_add()
1519 transport_add_device(&rphy->dev); in sas_rphy_add()
1520 transport_configure_device(&rphy->dev); in sas_rphy_add()
1521 if (sas_bsg_initialize(shost, rphy)) in sas_rphy_add()
1522 printk("fail to a bsg device %s\n", dev_name(&rphy->dev)); in sas_rphy_add()
1526 list_add_tail(&rphy->list, &sas_host->rphy_list); in sas_rphy_add()
1530 rphy->scsi_target_id = sas_host->next_target_id++; in sas_rphy_add()
1532 rphy->scsi_target_id = -1; in sas_rphy_add()
1536 rphy->scsi_target_id != -1) { in sas_rphy_add()
1544 scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, lun, in sas_rphy_add()
1563 void sas_rphy_free(struct sas_rphy *rphy) in sas_rphy_free() argument
1565 struct device *dev = &rphy->dev; in sas_rphy_free()
1566 struct Scsi_Host *shost = dev_to_shost(rphy->dev.parent->parent); in sas_rphy_free()
1570 list_del(&rphy->list); in sas_rphy_free()
1586 sas_rphy_delete(struct sas_rphy *rphy) in sas_rphy_delete() argument
1588 sas_rphy_remove(rphy); in sas_rphy_delete()
1589 sas_rphy_free(rphy); in sas_rphy_delete()
1599 void sas_rphy_unlink(struct sas_rphy *rphy) in sas_rphy_unlink() argument
1601 struct sas_port *parent = dev_to_sas_port(rphy->dev.parent); in sas_rphy_unlink()
1603 parent->rphy = NULL; in sas_rphy_unlink()
1614 sas_rphy_remove(struct sas_rphy *rphy) in sas_rphy_remove() argument
1616 struct device *dev = &rphy->dev; in sas_rphy_remove()
1618 switch (rphy->identify.device_type) { in sas_rphy_remove()
1630 sas_rphy_unlink(rphy); in sas_rphy_remove()
1631 bsg_remove_queue(rphy->q); in sas_rphy_remove()
1660 struct sas_rphy *rphy; in sas_user_scan() local
1663 list_for_each_entry(rphy, &sas_host->rphy_list, list) { in sas_user_scan()
1664 if (rphy->identify.device_type != SAS_END_DEVICE || in sas_user_scan()
1665 rphy->scsi_target_id == -1) in sas_user_scan()
1669 (id == SCAN_WILD_CARD || id == rphy->scsi_target_id)) { in sas_user_scan()
1670 scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, in sas_user_scan()