/* LOCKING: the frame_rcvd_lock needs to be held since this parses the frame buffer.  */
static void pm8001_get_attached_sas_addr(struct pm8001_phy *phy, u8 *sas_addr)
/* LOCKING: the frame_rcvd_lock needs to be held since this parses the frame buffer.  */
static void pm8001_get_attached_sas_addr(struct pm8001_phy *phy, u8 *sas_addr)
{
	if (phy->sas_phy.frame_rcvd[0] == 0x34
		&& phy->sas_phy.oob_mode == SATA_OOB_MODE) {
		struct pm8001_hba_info *pm8001_ha = phy->sas_phy.ha->lldd_ha;
		u64 addr = be64_to_cpu(*(__be64 *)pm8001_ha->sas_addr);
		addr += phy->sas_phy.id;
		*(__be64 *)sas_addr = cpu_to_be64(addr);
	} else {
		struct sas_identify_frame *idframe =
			(void *) phy->sas_phy.frame_rcvd;
		memcpy(sas_addr, idframe->sas_addr, SAS_ADDR_SIZE);
	}
}