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()
332 return rdev->rphy.identify.sas_address; in sas_get_address()
702 struct sas_rphy *rphy = dev_to_rphy(parent); in sas_phy_alloc() local
704 rphy->scsi_target_id, number); in sas_phy_alloc()
899 struct sas_rphy *rphy = dev_to_rphy(parent); in sas_port_alloc() local
901 rphy->scsi_target_id, port->port_identifier); in sas_port_alloc()
933 struct sas_rphy *rphy = dev_to_rphy(parent); in sas_port_alloc_num() local
934 struct sas_expander_device *exp = rphy_to_expander_device(rphy); in sas_port_alloc_num()
998 if (port->rphy) { in sas_port_delete()
999 sas_rphy_delete(port->rphy); in sas_port_delete()
1000 port->rphy = NULL; in sas_port_delete()
1146 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1148 return snprintf(buf, 20, format_string, cast rphy->field); \
1153 static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \
1161 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1163 if (!rphy->field) \
1165 return get_sas_protocol_names(rphy->field, buf); \
1170 static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \
1177 struct sas_rphy *rphy = transport_class_to_rphy(dev); in show_sas_rphy_device_type() local
1179 if (!rphy->identify.device_type) in show_sas_rphy_device_type()
1182 rphy->identify.device_type, buf); in show_sas_rphy_device_type()
1185 static SAS_DEVICE_ATTR(rphy, device_type, S_IRUGO,
1192 struct sas_rphy *rphy = transport_class_to_rphy(dev); in show_sas_rphy_enclosure_identifier() local
1193 struct sas_phy *phy = dev_to_phy(rphy->dev.parent); in show_sas_rphy_enclosure_identifier()
1199 error = i->f->get_enclosure_identifier(rphy, &identifier); in show_sas_rphy_enclosure_identifier()
1205 static SAS_DEVICE_ATTR(rphy, enclosure_identifier, S_IRUGO,
1212 struct sas_rphy *rphy = transport_class_to_rphy(dev); in show_sas_rphy_bay_identifier() local
1213 struct sas_phy *phy = dev_to_phy(rphy->dev.parent); in show_sas_rphy_bay_identifier()
1218 val = i->f->get_bay_identifier(rphy); in show_sas_rphy_bay_identifier()
1224 static SAS_DEVICE_ATTR(rphy, bay_identifier, S_IRUGO,
1280 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1281 struct sas_end_device *rdev = rphy_to_end_device(rphy); \
1309 struct sas_rphy *rphy = transport_class_to_rphy(dev); \
1310 struct sas_expander_device *edev = rphy_to_expander_device(rphy); \
1357 struct sas_rphy *rphy; in sas_end_dev_match() local
1362 rphy = dev_to_rphy(dev); in sas_end_dev_match()
1372 rphy->identify.device_type == SAS_END_DEVICE; in sas_end_dev_match()
1380 struct sas_rphy *rphy; in sas_expander_match() local
1385 rphy = dev_to_rphy(dev); in sas_expander_match()
1395 (rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE || in sas_expander_match()
1396 rphy->identify.device_type == SAS_FANOUT_EXPANDER_DEVICE); in sas_expander_match()
1401 struct sas_rphy *rphy = dev_to_rphy(dev); in sas_expander_release() local
1402 struct sas_expander_device *edev = rphy_to_expander_device(rphy); in sas_expander_release()
1410 struct sas_rphy *rphy = dev_to_rphy(dev); in sas_end_device_release() local
1411 struct sas_end_device *edev = rphy_to_end_device(rphy); in sas_end_device_release()
1424 static void sas_rphy_initialize(struct sas_rphy *rphy) in sas_rphy_initialize() argument
1426 INIT_LIST_HEAD(&rphy->list); in sas_rphy_initialize()
1448 device_initialize(&rdev->rphy.dev); in sas_end_device_alloc()
1449 rdev->rphy.dev.parent = get_device(&parent->dev); in sas_end_device_alloc()
1450 rdev->rphy.dev.release = sas_end_device_release; in sas_end_device_alloc()
1452 struct sas_rphy *rphy = dev_to_rphy(parent->dev.parent); in sas_end_device_alloc() local
1453 dev_set_name(&rdev->rphy.dev, "end_device-%d:%d:%d", in sas_end_device_alloc()
1454 shost->host_no, rphy->scsi_target_id, in sas_end_device_alloc()
1457 dev_set_name(&rdev->rphy.dev, "end_device-%d:%d", in sas_end_device_alloc()
1459 rdev->rphy.identify.device_type = SAS_END_DEVICE; in sas_end_device_alloc()
1460 sas_rphy_initialize(&rdev->rphy); in sas_end_device_alloc()
1461 transport_setup_device(&rdev->rphy.dev); in sas_end_device_alloc()
1463 return &rdev->rphy; in sas_end_device_alloc()
1492 device_initialize(&rdev->rphy.dev); in sas_expander_alloc()
1493 rdev->rphy.dev.parent = get_device(&parent->dev); in sas_expander_alloc()
1494 rdev->rphy.dev.release = sas_expander_release; in sas_expander_alloc()
1496 rdev->rphy.scsi_target_id = sas_host->next_expander_id++; in sas_expander_alloc()
1498 dev_set_name(&rdev->rphy.dev, "expander-%d:%d", in sas_expander_alloc()
1499 shost->host_no, rdev->rphy.scsi_target_id); in sas_expander_alloc()
1500 rdev->rphy.identify.device_type = type; in sas_expander_alloc()
1501 sas_rphy_initialize(&rdev->rphy); in sas_expander_alloc()
1502 transport_setup_device(&rdev->rphy.dev); in sas_expander_alloc()
1504 return &rdev->rphy; in sas_expander_alloc()
1514 int sas_rphy_add(struct sas_rphy *rphy) in sas_rphy_add() argument
1516 struct sas_port *parent = dev_to_sas_port(rphy->dev.parent); in sas_rphy_add()
1519 struct sas_identify *identify = &rphy->identify; in sas_rphy_add()
1522 if (parent->rphy) in sas_rphy_add()
1524 parent->rphy = rphy; in sas_rphy_add()
1526 error = device_add(&rphy->dev); in sas_rphy_add()
1529 transport_add_device(&rphy->dev); in sas_rphy_add()
1530 transport_configure_device(&rphy->dev); in sas_rphy_add()
1531 if (sas_bsg_initialize(shost, rphy)) in sas_rphy_add()
1532 printk("fail to a bsg device %s\n", dev_name(&rphy->dev)); in sas_rphy_add()
1536 list_add_tail(&rphy->list, &sas_host->rphy_list); in sas_rphy_add()
1540 rphy->scsi_target_id = sas_host->next_target_id++; in sas_rphy_add()
1542 rphy->scsi_target_id = -1; in sas_rphy_add()
1546 rphy->scsi_target_id != -1) { in sas_rphy_add()
1554 scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, lun, in sas_rphy_add()
1573 void sas_rphy_free(struct sas_rphy *rphy) in sas_rphy_free() argument
1575 struct device *dev = &rphy->dev; in sas_rphy_free()
1576 struct Scsi_Host *shost = dev_to_shost(rphy->dev.parent->parent); in sas_rphy_free()
1580 list_del(&rphy->list); in sas_rphy_free()
1596 sas_rphy_delete(struct sas_rphy *rphy) in sas_rphy_delete() argument
1598 sas_rphy_remove(rphy); in sas_rphy_delete()
1599 sas_rphy_free(rphy); in sas_rphy_delete()
1609 void sas_rphy_unlink(struct sas_rphy *rphy) in sas_rphy_unlink() argument
1611 struct sas_port *parent = dev_to_sas_port(rphy->dev.parent); in sas_rphy_unlink()
1613 parent->rphy = NULL; in sas_rphy_unlink()
1624 sas_rphy_remove(struct sas_rphy *rphy) in sas_rphy_remove() argument
1626 struct device *dev = &rphy->dev; in sas_rphy_remove()
1628 switch (rphy->identify.device_type) { in sas_rphy_remove()
1640 sas_rphy_unlink(rphy); in sas_rphy_remove()
1641 bsg_remove_queue(rphy->q); in sas_rphy_remove()
1670 struct sas_rphy *rphy; in sas_user_scan() local
1673 list_for_each_entry(rphy, &sas_host->rphy_list, list) { in sas_user_scan()
1674 if (rphy->identify.device_type != SAS_END_DEVICE || in sas_user_scan()
1675 rphy->scsi_target_id == -1) in sas_user_scan()
1679 (id == SCAN_WILD_CARD || id == rphy->scsi_target_id)) { in sas_user_scan()
1680 scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, in sas_user_scan()