blob: 2f8c719840a6e742cc5d9bbc6d21f2fd79e66975 [file] [log] [blame]
Thomas Gleixner1a59d1b82019-05-27 08:55:05 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Darrick J. Wong338ec572006-10-18 14:43:37 -07002/*
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
Darrick J. Wong338ec572006-10-18 14:43:37 -07008 */
9
10#ifndef _SAS_ATA_H_
11#define _SAS_ATA_H_
12
13#include <linux/libata.h>
14#include <scsi/libsas.h>
15
James Bottomleyb9142172007-07-22 13:15:55 -050016#ifdef CONFIG_SCSI_SAS_ATA
17
Darrick J. Wong338ec572006-10-18 14:43:37 -070018static inline int dev_is_sata(struct domain_device *dev)
19{
James Bottomleyaa9f8322013-05-07 14:44:06 -070020 return dev->dev_type == SAS_SATA_DEV || dev->dev_type == SAS_SATA_PM ||
21 dev->dev_type == SAS_SATA_PM_PORT || dev->dev_type == SAS_SATA_PENDING;
Darrick J. Wong338ec572006-10-18 14:43:37 -070022}
23
Dan Williams354cf822012-01-12 17:57:35 -080024int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy);
Dan Williamsb2024452012-03-21 21:09:07 -070025int sas_ata_init(struct domain_device *dev);
Darrick J. Wong3a2755a2007-01-30 01:18:58 -080026void sas_ata_task_abort(struct sas_task *task);
James Bottomley00dd4992011-01-23 09:44:12 -060027void sas_ata_strategy_handler(struct Scsi_Host *shost);
Xiang Chen3a20e642022-02-11 14:42:57 +080028void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q);
Dan Williamsb52df412011-11-30 23:23:33 -080029void sas_ata_schedule_reset(struct domain_device *dev);
Dan Williams81c757b2011-12-02 16:07:01 -080030void sas_ata_wait_eh(struct domain_device *dev);
Dan Williams9508a662012-01-18 20:47:01 -080031void sas_probe_sata(struct asd_sas_port *port);
Dan Williams303694e2012-06-21 23:41:51 -070032void sas_suspend_sata(struct asd_sas_port *port);
33void sas_resume_sata(struct asd_sas_port *port);
Dan Williamse4a9c372012-06-21 23:25:27 -070034void sas_ata_end_eh(struct ata_port *ap);
John Garry44112922022-10-17 17:20:28 +080035void sas_ata_device_link_abort(struct domain_device *dev, bool force_reset);
John Garry3f2e2522022-02-22 20:50:59 +080036int sas_execute_ata_cmd(struct domain_device *device, u8 *fis,
37 int force_phy_id);
Jie Zhan9181ce32022-11-18 16:37:12 +080038int smp_ata_check_ready_type(struct ata_link *link);
Jason Yanffebb382022-12-14 21:38:05 +080039int sas_discover_sata(struct domain_device *dev);
Jason Yan7cc76462022-12-14 21:38:07 +080040int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *phy,
41 struct domain_device *child, int phy_id);
James Bottomleyb9142172007-07-22 13:15:55 -050042#else
43
Jason Yanffebb382022-12-14 21:38:05 +080044static inline void sas_ata_disabled_notice(void)
45{
46 pr_notice_once("ATA device seen but CONFIG_SCSI_SAS_ATA=N\n");
47}
James Bottomleyb9142172007-07-22 13:15:55 -050048
49static inline int dev_is_sata(struct domain_device *dev)
50{
51 return 0;
52}
Dan Williamsb2024452012-03-21 21:09:07 -070053static inline int sas_ata_init(struct domain_device *dev)
James Bottomleyb9142172007-07-22 13:15:55 -050054{
55 return 0;
56}
James Bottomley79bc1482008-04-03 09:04:31 -050057static inline void sas_ata_task_abort(struct sas_task *task)
James Bottomleyb9142172007-07-22 13:15:55 -050058{
59}
James Bottomley00dd4992011-01-23 09:44:12 -060060
61static inline void sas_ata_strategy_handler(struct Scsi_Host *shost)
62{
63}
64
Xiang Chen3a20e642022-02-11 14:42:57 +080065static inline void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q)
James Bottomley00dd4992011-01-23 09:44:12 -060066{
James Bottomley00dd4992011-01-23 09:44:12 -060067}
68
Dan Williamsb52df412011-11-30 23:23:33 -080069static inline void sas_ata_schedule_reset(struct domain_device *dev)
70{
71}
72
Dan Williams81c757b2011-12-02 16:07:01 -080073static inline void sas_ata_wait_eh(struct domain_device *dev)
74{
75}
Dan Williams354cf822012-01-12 17:57:35 -080076
Dan Williams9508a662012-01-18 20:47:01 -080077static inline void sas_probe_sata(struct asd_sas_port *port)
78{
79}
80
Dan Williams303694e2012-06-21 23:41:51 -070081static inline void sas_suspend_sata(struct asd_sas_port *port)
82{
83}
84
85static inline void sas_resume_sata(struct asd_sas_port *port)
86{
87}
88
Dan Williams354cf822012-01-12 17:57:35 -080089static inline int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy)
90{
91 return 0;
92}
Dan Williamse4a9c372012-06-21 23:25:27 -070093
94static inline void sas_ata_end_eh(struct ata_port *ap)
95{
96}
John Garry3f2e2522022-02-22 20:50:59 +080097
John Garry44112922022-10-17 17:20:28 +080098static inline void sas_ata_device_link_abort(struct domain_device *dev,
99 bool force_reset)
100{
101}
102
John Garry3f2e2522022-02-22 20:50:59 +0800103static inline int sas_execute_ata_cmd(struct domain_device *device, u8 *fis,
104 int force_phy_id)
105{
106 return 0;
107}
John Garry057e5fc2022-05-12 19:15:32 +0800108
Jie Zhan9181ce32022-11-18 16:37:12 +0800109static inline int smp_ata_check_ready_type(struct ata_link *link)
110{
111 return 0;
112}
Jason Yanffebb382022-12-14 21:38:05 +0800113
114static inline int sas_discover_sata(struct domain_device *dev)
115{
116 sas_ata_disabled_notice();
117 return -ENXIO;
118}
Jason Yan7cc76462022-12-14 21:38:07 +0800119
120static inline int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *phy,
121 struct domain_device *child, int phy_id)
122{
123 sas_ata_disabled_notice();
124 return -ENODEV;
125}
James Bottomleyb9142172007-07-22 13:15:55 -0500126#endif
127
Darrick J. Wong338ec572006-10-18 14:43:37 -0700128#endif /* _SAS_ATA_H_ */