Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: libsas: Add smp_ata_check_ready_type()

Create function smp_ata_check_ready_type() for LLDDs to wait for SATA
devices to come up after a link reset.

Signed-off-by: Jie Zhan <zhanjie9@hisilicon.com>
Link: https://lore.kernel.org/r/20221118083714.4034612-4-zhanjie9@hisilicon.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Jie Zhan and committed by
Martin K. Petersen
9181ce3c 94a3555d

+35 -2
+25
drivers/scsi/libsas/sas_ata.c
··· 287 287 return 1; 288 288 } 289 289 290 + int smp_ata_check_ready_type(struct ata_link *link) 291 + { 292 + struct domain_device *dev = link->ap->private_data; 293 + struct sas_phy *phy = sas_get_local_phy(dev); 294 + struct domain_device *ex_dev = dev->parent; 295 + enum sas_device_type type = SAS_PHY_UNUSED; 296 + u8 sas_addr[SAS_ADDR_SIZE]; 297 + int res; 298 + 299 + res = sas_get_phy_attached_dev(ex_dev, phy->number, sas_addr, &type); 300 + sas_put_local_phy(phy); 301 + if (res) 302 + return res; 303 + 304 + switch (type) { 305 + case SAS_SATA_PENDING: 306 + return 0; 307 + case SAS_END_DEVICE: 308 + return 1; 309 + default: 310 + return -ENODEV; 311 + } 312 + } 313 + EXPORT_SYMBOL_GPL(smp_ata_check_ready_type); 314 + 290 315 static int smp_ata_check_ready(struct ata_link *link) 291 316 { 292 317 int res;
+2 -2
drivers/scsi/libsas/sas_expander.c
··· 1688 1688 return res; 1689 1689 } 1690 1690 1691 - static int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id, 1692 - u8 *sas_addr, enum sas_device_type *type) 1691 + int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id, 1692 + u8 *sas_addr, enum sas_device_type *type) 1693 1693 { 1694 1694 int res; 1695 1695 struct smp_disc_resp *disc_resp;
+2
drivers/scsi/libsas/sas_internal.h
··· 88 88 int sas_ex_phy_discover(struct domain_device *dev, int single); 89 89 int sas_get_report_phy_sata(struct domain_device *dev, int phy_id, 90 90 struct smp_rps_resp *rps_resp); 91 + int sas_get_phy_attached_dev(struct domain_device *dev, int phy_id, 92 + u8 *sas_addr, enum sas_device_type *type); 91 93 int sas_try_ata_reset(struct asd_sas_phy *phy); 92 94 void sas_hae_reset(struct work_struct *work); 93 95
+6
include/scsi/sas_ata.h
··· 36 36 int sas_execute_ata_cmd(struct domain_device *device, u8 *fis, 37 37 int force_phy_id); 38 38 int sas_ata_wait_after_reset(struct domain_device *dev, unsigned long deadline); 39 + int smp_ata_check_ready_type(struct ata_link *link); 39 40 #else 40 41 41 42 ··· 104 103 unsigned long deadline) 105 104 { 106 105 return -ETIMEDOUT; 106 + } 107 + 108 + static inline int smp_ata_check_ready_type(struct ata_link *link) 109 + { 110 + return 0; 107 111 } 108 112 #endif 109 113