1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * Support for SATA devices on Serial Attached SCSI (SAS) controllers
4 *
5 * Copyright (C) 2006 IBM Corporation
6 *
7 * Written by: Darrick J. Wong <djwong@us.ibm.com>, IBM Corporation
8 */
9
10 #ifndef _SAS_ATA_H_
11 #define _SAS_ATA_H_
12
13 #include <linux/libata.h>
14 #include <scsi/libsas.h>
15
16 #ifdef CONFIG_SCSI_SAS_ATA
17
dev_is_sata(struct domain_device * dev)18 static inline bool dev_is_sata(struct domain_device *dev)
19 {
20 switch (dev->dev_type) {
21 case SAS_SATA_DEV:
22 case SAS_SATA_PENDING:
23 case SAS_SATA_PM:
24 case SAS_SATA_PM_PORT:
25 return true;
26 default:
27 return false;
28 }
29 }
30
31 void sas_ata_schedule_reset(struct domain_device *dev);
32 void sas_ata_device_link_abort(struct domain_device *dev, bool force_reset);
33 int sas_execute_ata_cmd(struct domain_device *device, u8 *fis, int force_phy_id);
34 int smp_ata_check_ready_type(struct ata_link *link);
35
36 extern const struct attribute_group sas_ata_sdev_attr_group;
37
38 #else
39
dev_is_sata(struct domain_device * dev)40 static inline bool dev_is_sata(struct domain_device *dev)
41 {
42 return false;
43 }
44
sas_ata_schedule_reset(struct domain_device * dev)45 static inline void sas_ata_schedule_reset(struct domain_device *dev)
46 {
47 }
48
sas_ata_device_link_abort(struct domain_device * dev,bool force_reset)49 static inline void sas_ata_device_link_abort(struct domain_device *dev,
50 bool force_reset)
51 {
52 }
53
sas_execute_ata_cmd(struct domain_device * device,u8 * fis,int force_phy_id)54 static inline int sas_execute_ata_cmd(struct domain_device *device, u8 *fis,
55 int force_phy_id)
56 {
57 return 0;
58 }
59
smp_ata_check_ready_type(struct ata_link * link)60 static inline int smp_ata_check_ready_type(struct ata_link *link)
61 {
62 return 0;
63 }
64
65 #define sas_ata_sdev_attr_group ((struct attribute_group) {})
66
67 #endif
68
69 #endif /* _SAS_ATA_H_ */
70