xref: /openbmc/linux/include/scsi/sas_ata.h (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
11a59d1b8SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2338ec570SDarrick J. Wong /*
3338ec570SDarrick J. Wong  * Support for SATA devices on Serial Attached SCSI (SAS) controllers
4338ec570SDarrick J. Wong  *
5338ec570SDarrick J. Wong  * Copyright (C) 2006 IBM Corporation
6338ec570SDarrick J. Wong  *
7338ec570SDarrick J. Wong  * Written by: Darrick J. Wong <djwong@us.ibm.com>, IBM Corporation
8338ec570SDarrick J. Wong  */
9338ec570SDarrick J. Wong 
10338ec570SDarrick J. Wong #ifndef _SAS_ATA_H_
11338ec570SDarrick J. Wong #define _SAS_ATA_H_
12338ec570SDarrick J. Wong 
13338ec570SDarrick J. Wong #include <linux/libata.h>
14338ec570SDarrick J. Wong #include <scsi/libsas.h>
15338ec570SDarrick J. Wong 
16b9142174SJames Bottomley #ifdef CONFIG_SCSI_SAS_ATA
17b9142174SJames Bottomley 
dev_is_sata(struct domain_device * dev)18338ec570SDarrick J. Wong static inline int dev_is_sata(struct domain_device *dev)
19338ec570SDarrick J. Wong {
20aa9f8328SJames Bottomley 	return dev->dev_type == SAS_SATA_DEV || dev->dev_type == SAS_SATA_PM ||
21aa9f8328SJames Bottomley 	       dev->dev_type == SAS_SATA_PM_PORT || dev->dev_type == SAS_SATA_PENDING;
22338ec570SDarrick J. Wong }
23338ec570SDarrick J. Wong 
24354cf829SDan Williams int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy);
25b2024459SDan Williams int sas_ata_init(struct domain_device *dev);
263a2755afSDarrick J. Wong void sas_ata_task_abort(struct sas_task *task);
2700dd4998SJames Bottomley void sas_ata_strategy_handler(struct Scsi_Host *shost);
283a20e642SXiang Chen void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q);
29b52df417SDan Williams void sas_ata_schedule_reset(struct domain_device *dev);
3081c757bcSDan Williams void sas_ata_wait_eh(struct domain_device *dev);
319508a66fSDan Williams void sas_probe_sata(struct asd_sas_port *port);
32303694eeSDan Williams void sas_suspend_sata(struct asd_sas_port *port);
33303694eeSDan Williams void sas_resume_sata(struct asd_sas_port *port);
34e4a9c373SDan Williams void sas_ata_end_eh(struct ata_port *ap);
3544112922SJohn Garry void sas_ata_device_link_abort(struct domain_device *dev, bool force_reset);
363f2e252eSJohn Garry int sas_execute_ata_cmd(struct domain_device *device, u8 *fis,
373f2e252eSJohn Garry 			int force_phy_id);
389181ce3cSJie Zhan int smp_ata_check_ready_type(struct ata_link *link);
39ffebb38eSJason Yan int sas_discover_sata(struct domain_device *dev);
40*7cc7646bSJason Yan int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *phy,
41*7cc7646bSJason Yan 		    struct domain_device *child, int phy_id);
42b9142174SJames Bottomley #else
43b9142174SJames Bottomley 
sas_ata_disabled_notice(void)44ffebb38eSJason Yan static inline void sas_ata_disabled_notice(void)
45ffebb38eSJason Yan {
46ffebb38eSJason Yan 	pr_notice_once("ATA device seen but CONFIG_SCSI_SAS_ATA=N\n");
47ffebb38eSJason Yan }
48b9142174SJames Bottomley 
dev_is_sata(struct domain_device * dev)49b9142174SJames Bottomley static inline int dev_is_sata(struct domain_device *dev)
50b9142174SJames Bottomley {
51b9142174SJames Bottomley 	return 0;
52b9142174SJames Bottomley }
sas_ata_init(struct domain_device * dev)53b2024459SDan Williams static inline int sas_ata_init(struct domain_device *dev)
54b9142174SJames Bottomley {
55b9142174SJames Bottomley 	return 0;
56b9142174SJames Bottomley }
sas_ata_task_abort(struct sas_task * task)5779bc1481SJames Bottomley static inline void sas_ata_task_abort(struct sas_task *task)
58b9142174SJames Bottomley {
59b9142174SJames Bottomley }
6000dd4998SJames Bottomley 
sas_ata_strategy_handler(struct Scsi_Host * shost)6100dd4998SJames Bottomley static inline void sas_ata_strategy_handler(struct Scsi_Host *shost)
6200dd4998SJames Bottomley {
6300dd4998SJames Bottomley }
6400dd4998SJames Bottomley 
sas_ata_eh(struct Scsi_Host * shost,struct list_head * work_q)653a20e642SXiang Chen static inline void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q)
6600dd4998SJames Bottomley {
6700dd4998SJames Bottomley }
6800dd4998SJames Bottomley 
sas_ata_schedule_reset(struct domain_device * dev)69b52df417SDan Williams static inline void sas_ata_schedule_reset(struct domain_device *dev)
70b52df417SDan Williams {
71b52df417SDan Williams }
72b52df417SDan Williams 
sas_ata_wait_eh(struct domain_device * dev)7381c757bcSDan Williams static inline void sas_ata_wait_eh(struct domain_device *dev)
7481c757bcSDan Williams {
7581c757bcSDan Williams }
76354cf829SDan Williams 
sas_probe_sata(struct asd_sas_port * port)779508a66fSDan Williams static inline void sas_probe_sata(struct asd_sas_port *port)
789508a66fSDan Williams {
799508a66fSDan Williams }
809508a66fSDan Williams 
sas_suspend_sata(struct asd_sas_port * port)81303694eeSDan Williams static inline void sas_suspend_sata(struct asd_sas_port *port)
82303694eeSDan Williams {
83303694eeSDan Williams }
84303694eeSDan Williams 
sas_resume_sata(struct asd_sas_port * port)85303694eeSDan Williams static inline void sas_resume_sata(struct asd_sas_port *port)
86303694eeSDan Williams {
87303694eeSDan Williams }
88303694eeSDan Williams 
sas_get_ata_info(struct domain_device * dev,struct ex_phy * phy)89354cf829SDan Williams static inline int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy)
90354cf829SDan Williams {
91354cf829SDan Williams 	return 0;
92354cf829SDan Williams }
93e4a9c373SDan Williams 
sas_ata_end_eh(struct ata_port * ap)94e4a9c373SDan Williams static inline void sas_ata_end_eh(struct ata_port *ap)
95e4a9c373SDan Williams {
96e4a9c373SDan Williams }
973f2e252eSJohn Garry 
sas_ata_device_link_abort(struct domain_device * dev,bool force_reset)9844112922SJohn Garry static inline void sas_ata_device_link_abort(struct domain_device *dev,
9944112922SJohn Garry 					     bool force_reset)
10044112922SJohn Garry {
10144112922SJohn Garry }
10244112922SJohn Garry 
sas_execute_ata_cmd(struct domain_device * device,u8 * fis,int force_phy_id)1033f2e252eSJohn Garry static inline int sas_execute_ata_cmd(struct domain_device *device, u8 *fis,
1043f2e252eSJohn Garry 				      int force_phy_id)
1053f2e252eSJohn Garry {
1063f2e252eSJohn Garry 	return 0;
1073f2e252eSJohn Garry }
108057e5fc0SJohn Garry 
smp_ata_check_ready_type(struct ata_link * link)1099181ce3cSJie Zhan static inline int smp_ata_check_ready_type(struct ata_link *link)
1109181ce3cSJie Zhan {
1119181ce3cSJie Zhan 	return 0;
1129181ce3cSJie Zhan }
113ffebb38eSJason Yan 
sas_discover_sata(struct domain_device * dev)114ffebb38eSJason Yan static inline int sas_discover_sata(struct domain_device *dev)
115ffebb38eSJason Yan {
116ffebb38eSJason Yan 	sas_ata_disabled_notice();
117ffebb38eSJason Yan 	return -ENXIO;
118ffebb38eSJason Yan }
119*7cc7646bSJason Yan 
sas_ata_add_dev(struct domain_device * parent,struct ex_phy * phy,struct domain_device * child,int phy_id)120*7cc7646bSJason Yan static inline int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *phy,
121*7cc7646bSJason Yan 				  struct domain_device *child, int phy_id)
122*7cc7646bSJason Yan {
123*7cc7646bSJason Yan 	sas_ata_disabled_notice();
124*7cc7646bSJason Yan 	return -ENODEV;
125*7cc7646bSJason Yan }
126b9142174SJames Bottomley #endif
127b9142174SJames Bottomley 
128338ec570SDarrick J. Wong #endif /* _SAS_ATA_H_ */
129