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()
893 struct sas_rphy *rphy = dev_to_rphy(parent); in sas_port_alloc() local
895 rphy->scsi_target_id, port->port_identifier); in sas_port_alloc()
927 struct sas_rphy *rphy = dev_to_rphy(parent); in sas_port_alloc_num() local
928 struct sas_expander_device *exp = rphy_to_expander_device(rphy); in sas_port_alloc_num()
992 if (port->rphy) { in sas_port_delete()
993 sas_rphy_delete(port->rphy); in sas_port_delete()
994 port->rphy = NULL; in sas_port_delete()
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); in show_sas_rphy_device_type() local
1173 if (!rphy->identify.device_type) in show_sas_rphy_device_type()
1176 rphy->identify.device_type, buf); in show_sas_rphy_device_type()
1179 static SAS_DEVICE_ATTR(rphy, device_type, S_IRUGO,
1186 struct sas_rphy *rphy = transport_class_to_rphy(dev); in show_sas_rphy_enclosure_identifier() local
1187 struct sas_phy *phy = dev_to_phy(rphy->dev.parent); in show_sas_rphy_enclosure_identifier()
1193 error = i->f->get_enclosure_identifier(rphy, &identifier); in show_sas_rphy_enclosure_identifier()
1199 static SAS_DEVICE_ATTR(rphy, enclosure_identifier, S_IRUGO,
1206 struct sas_rphy *rphy = transport_class_to_rphy(dev); in show_sas_rphy_bay_identifier() local
1207 struct sas_phy *phy = dev_to_phy(rphy->dev.parent); in show_sas_rphy_bay_identifier()
1212 val = i->f->get_bay_identifier(rphy); in show_sas_rphy_bay_identifier()
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; in sas_end_dev_match() local
1356 rphy = dev_to_rphy(dev); in sas_end_dev_match()
1366 rphy->identify.device_type == SAS_END_DEVICE; in sas_end_dev_match()
1374 struct sas_rphy *rphy; in sas_expander_match() local
1379 rphy = dev_to_rphy(dev); in sas_expander_match()
1389 (rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE || in sas_expander_match()
1390 rphy->identify.device_type == SAS_FANOUT_EXPANDER_DEVICE); in sas_expander_match()
1395 struct sas_rphy *rphy = dev_to_rphy(dev); in sas_expander_release() local
1396 struct sas_expander_device *edev = rphy_to_expander_device(rphy); in sas_expander_release()
1404 struct sas_rphy *rphy = dev_to_rphy(dev); in sas_end_device_release() local
1405 struct sas_end_device *edev = rphy_to_end_device(rphy); in sas_end_device_release()
1418 static void sas_rphy_initialize(struct sas_rphy *rphy) in sas_rphy_initialize() argument
1420 INIT_LIST_HEAD(&rphy->list); in sas_rphy_initialize()
1442 device_initialize(&rdev->rphy.dev); in sas_end_device_alloc()
1443 rdev->rphy.dev.parent = get_device(&parent->dev); in sas_end_device_alloc()
1444 rdev->rphy.dev.release = sas_end_device_release; in sas_end_device_alloc()
1446 struct sas_rphy *rphy = dev_to_rphy(parent->dev.parent); in sas_end_device_alloc() local
1447 dev_set_name(&rdev->rphy.dev, "end_device-%d:%d:%d", in sas_end_device_alloc()
1448 shost->host_no, rphy->scsi_target_id, in sas_end_device_alloc()
1451 dev_set_name(&rdev->rphy.dev, "end_device-%d:%d", in sas_end_device_alloc()
1453 rdev->rphy.identify.device_type = SAS_END_DEVICE; in sas_end_device_alloc()
1454 sas_rphy_initialize(&rdev->rphy); in sas_end_device_alloc()
1455 transport_setup_device(&rdev->rphy.dev); in sas_end_device_alloc()
1457 return &rdev->rphy; in sas_end_device_alloc()
1486 device_initialize(&rdev->rphy.dev); in sas_expander_alloc()
1487 rdev->rphy.dev.parent = get_device(&parent->dev); in sas_expander_alloc()
1488 rdev->rphy.dev.release = sas_expander_release; in sas_expander_alloc()
1490 rdev->rphy.scsi_target_id = sas_host->next_expander_id++; in sas_expander_alloc()
1492 dev_set_name(&rdev->rphy.dev, "expander-%d:%d", in sas_expander_alloc()
1493 shost->host_no, rdev->rphy.scsi_target_id); in sas_expander_alloc()
1494 rdev->rphy.identify.device_type = type; in sas_expander_alloc()
1495 sas_rphy_initialize(&rdev->rphy); in sas_expander_alloc()
1496 transport_setup_device(&rdev->rphy.dev); in sas_expander_alloc()
1498 return &rdev->rphy; in sas_expander_alloc()
1508 int sas_rphy_add(struct sas_rphy *rphy) in sas_rphy_add() argument
1510 struct sas_port *parent = dev_to_sas_port(rphy->dev.parent); in sas_rphy_add()
1513 struct sas_identify *identify = &rphy->identify; in sas_rphy_add()
1516 if (parent->rphy) in sas_rphy_add()
1518 parent->rphy = rphy; in sas_rphy_add()
1520 error = device_add(&rphy->dev); in sas_rphy_add()
1523 transport_add_device(&rphy->dev); in sas_rphy_add()
1524 transport_configure_device(&rphy->dev); in sas_rphy_add()
1525 if (sas_bsg_initialize(shost, rphy)) in sas_rphy_add()
1526 printk("fail to a bsg device %s\n", dev_name(&rphy->dev)); in sas_rphy_add()
1530 list_add_tail(&rphy->list, &sas_host->rphy_list); in sas_rphy_add()
1534 rphy->scsi_target_id = sas_host->next_target_id++; in sas_rphy_add()
1536 rphy->scsi_target_id = -1; in sas_rphy_add()
1540 rphy->scsi_target_id != -1) { in sas_rphy_add()
1548 scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, lun, in sas_rphy_add()
1567 void sas_rphy_free(struct sas_rphy *rphy) in sas_rphy_free() argument
1569 struct device *dev = &rphy->dev; in sas_rphy_free()
1570 struct Scsi_Host *shost = dev_to_shost(rphy->dev.parent->parent); in sas_rphy_free()
1574 list_del(&rphy->list); in sas_rphy_free()
1590 sas_rphy_delete(struct sas_rphy *rphy) in sas_rphy_delete() argument
1592 sas_rphy_remove(rphy); in sas_rphy_delete()
1593 sas_rphy_free(rphy); in sas_rphy_delete()
1603 void sas_rphy_unlink(struct sas_rphy *rphy) in sas_rphy_unlink() argument
1605 struct sas_port *parent = dev_to_sas_port(rphy->dev.parent); in sas_rphy_unlink()
1607 parent->rphy = NULL; in sas_rphy_unlink()
1618 sas_rphy_remove(struct sas_rphy *rphy) in sas_rphy_remove() argument
1620 struct device *dev = &rphy->dev; in sas_rphy_remove()
1622 switch (rphy->identify.device_type) { in sas_rphy_remove()
1634 sas_rphy_unlink(rphy); in sas_rphy_remove()
1635 bsg_remove_queue(rphy->q); in sas_rphy_remove()
1664 struct sas_rphy *rphy; in sas_user_scan() local
1667 list_for_each_entry(rphy, &sas_host->rphy_list, list) { in sas_user_scan()
1668 if (rphy->identify.device_type != SAS_END_DEVICE || in sas_user_scan()
1669 rphy->scsi_target_id == -1) in sas_user_scan()
1673 (id == SCAN_WILD_CARD || id == rphy->scsi_target_id)) { in sas_user_scan()
1674 scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, in sas_user_scan()