Skip to content

Commit

Permalink
scsi_transport_sas: add function to get SAS endpoint address
Browse files Browse the repository at this point in the history
For a device known to be SAS connected, this will return the endpoint
address.  This is useful for getting the SAS address of SATA devices.

Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
  • Loading branch information
James Bottomley authored and James Bottomley committed Dec 19, 2015
1 parent 3b91d09 commit bcf508c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions drivers/scsi/scsi_transport_sas.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,20 @@ void sas_remove_host(struct Scsi_Host *shost)
}
EXPORT_SYMBOL(sas_remove_host);

/**
* sas_get_address - return the SAS address of the device
* @sdev: scsi device
*
* Returns the SAS address of the scsi device
*/
u64 sas_get_address(struct scsi_device *sdev)
{
struct sas_end_device *rdev = sas_sdev_to_rdev(sdev);

return rdev->rphy.identify.sas_address;
}
EXPORT_SYMBOL(sas_get_address);

/**
* sas_tlr_supported - checking TLR bit in vpd 0x90
* @sdev: scsi device struct
Expand Down
1 change: 1 addition & 0 deletions include/scsi/scsi_transport_sas.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ extern int sas_phy_add(struct sas_phy *);
extern void sas_phy_delete(struct sas_phy *);
extern int scsi_is_sas_phy(const struct device *);

u64 sas_get_address(struct scsi_device *);
unsigned int sas_tlr_supported(struct scsi_device *);
unsigned int sas_is_tlr_enabled(struct scsi_device *);
void sas_disable_tlr(struct scsi_device *);
Expand Down

0 comments on commit bcf508c

Please sign in to comment.