Thomas Gleixner | 1a59d1b8 | 2019-05-27 08:55:05 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Darrick J. Wong | 338ec57 | 2006-10-18 14:43:37 -0700 | [diff] [blame] | 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 |
Darrick J. Wong | 338ec57 | 2006-10-18 14:43:37 -0700 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #ifndef _SAS_ATA_H_ |
| 11 | #define _SAS_ATA_H_ |
| 12 | |
| 13 | #include <linux/libata.h> |
| 14 | #include <scsi/libsas.h> |
| 15 | |
James Bottomley | b914217 | 2007-07-22 13:15:55 -0500 | [diff] [blame] | 16 | #ifdef CONFIG_SCSI_SAS_ATA |
| 17 | |
Darrick J. Wong | 338ec57 | 2006-10-18 14:43:37 -0700 | [diff] [blame] | 18 | static inline int dev_is_sata(struct domain_device *dev) |
| 19 | { |
James Bottomley | aa9f832 | 2013-05-07 14:44:06 -0700 | [diff] [blame] | 20 | 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. Wong | 338ec57 | 2006-10-18 14:43:37 -0700 | [diff] [blame] | 22 | } |
| 23 | |
Dan Williams | 354cf82 | 2012-01-12 17:57:35 -0800 | [diff] [blame] | 24 | int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy); |
Dan Williams | b202445 | 2012-03-21 21:09:07 -0700 | [diff] [blame] | 25 | int sas_ata_init(struct domain_device *dev); |
Darrick J. Wong | 3a2755a | 2007-01-30 01:18:58 -0800 | [diff] [blame] | 26 | void sas_ata_task_abort(struct sas_task *task); |
James Bottomley | 00dd499 | 2011-01-23 09:44:12 -0600 | [diff] [blame] | 27 | void sas_ata_strategy_handler(struct Scsi_Host *shost); |
Xiang Chen | 3a20e64 | 2022-02-11 14:42:57 +0800 | [diff] [blame] | 28 | void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q); |
Dan Williams | b52df41 | 2011-11-30 23:23:33 -0800 | [diff] [blame] | 29 | void sas_ata_schedule_reset(struct domain_device *dev); |
Dan Williams | 81c757b | 2011-12-02 16:07:01 -0800 | [diff] [blame] | 30 | void sas_ata_wait_eh(struct domain_device *dev); |
Dan Williams | 9508a66 | 2012-01-18 20:47:01 -0800 | [diff] [blame] | 31 | void sas_probe_sata(struct asd_sas_port *port); |
Dan Williams | 303694e | 2012-06-21 23:41:51 -0700 | [diff] [blame] | 32 | void sas_suspend_sata(struct asd_sas_port *port); |
| 33 | void sas_resume_sata(struct asd_sas_port *port); |
Dan Williams | e4a9c37 | 2012-06-21 23:25:27 -0700 | [diff] [blame] | 34 | void sas_ata_end_eh(struct ata_port *ap); |
John Garry | 4411292 | 2022-10-17 17:20:28 +0800 | [diff] [blame] | 35 | void sas_ata_device_link_abort(struct domain_device *dev, bool force_reset); |
John Garry | 3f2e252 | 2022-02-22 20:50:59 +0800 | [diff] [blame] | 36 | int sas_execute_ata_cmd(struct domain_device *device, u8 *fis, |
| 37 | int force_phy_id); |
Jie Zhan | 9181ce3 | 2022-11-18 16:37:12 +0800 | [diff] [blame] | 38 | int smp_ata_check_ready_type(struct ata_link *link); |
Jason Yan | ffebb38 | 2022-12-14 21:38:05 +0800 | [diff] [blame] | 39 | int sas_discover_sata(struct domain_device *dev); |
Jason Yan | 7cc7646 | 2022-12-14 21:38:07 +0800 | [diff] [blame] | 40 | int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *phy, |
| 41 | struct domain_device *child, int phy_id); |
James Bottomley | b914217 | 2007-07-22 13:15:55 -0500 | [diff] [blame] | 42 | #else |
| 43 | |
Jason Yan | ffebb38 | 2022-12-14 21:38:05 +0800 | [diff] [blame] | 44 | static inline void sas_ata_disabled_notice(void) |
| 45 | { |
| 46 | pr_notice_once("ATA device seen but CONFIG_SCSI_SAS_ATA=N\n"); |
| 47 | } |
James Bottomley | b914217 | 2007-07-22 13:15:55 -0500 | [diff] [blame] | 48 | |
| 49 | static inline int dev_is_sata(struct domain_device *dev) |
| 50 | { |
| 51 | return 0; |
| 52 | } |
Dan Williams | b202445 | 2012-03-21 21:09:07 -0700 | [diff] [blame] | 53 | static inline int sas_ata_init(struct domain_device *dev) |
James Bottomley | b914217 | 2007-07-22 13:15:55 -0500 | [diff] [blame] | 54 | { |
| 55 | return 0; |
| 56 | } |
James Bottomley | 79bc148 | 2008-04-03 09:04:31 -0500 | [diff] [blame] | 57 | static inline void sas_ata_task_abort(struct sas_task *task) |
James Bottomley | b914217 | 2007-07-22 13:15:55 -0500 | [diff] [blame] | 58 | { |
| 59 | } |
James Bottomley | 00dd499 | 2011-01-23 09:44:12 -0600 | [diff] [blame] | 60 | |
| 61 | static inline void sas_ata_strategy_handler(struct Scsi_Host *shost) |
| 62 | { |
| 63 | } |
| 64 | |
Xiang Chen | 3a20e64 | 2022-02-11 14:42:57 +0800 | [diff] [blame] | 65 | static inline void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q) |
James Bottomley | 00dd499 | 2011-01-23 09:44:12 -0600 | [diff] [blame] | 66 | { |
James Bottomley | 00dd499 | 2011-01-23 09:44:12 -0600 | [diff] [blame] | 67 | } |
| 68 | |
Dan Williams | b52df41 | 2011-11-30 23:23:33 -0800 | [diff] [blame] | 69 | static inline void sas_ata_schedule_reset(struct domain_device *dev) |
| 70 | { |
| 71 | } |
| 72 | |
Dan Williams | 81c757b | 2011-12-02 16:07:01 -0800 | [diff] [blame] | 73 | static inline void sas_ata_wait_eh(struct domain_device *dev) |
| 74 | { |
| 75 | } |
Dan Williams | 354cf82 | 2012-01-12 17:57:35 -0800 | [diff] [blame] | 76 | |
Dan Williams | 9508a66 | 2012-01-18 20:47:01 -0800 | [diff] [blame] | 77 | static inline void sas_probe_sata(struct asd_sas_port *port) |
| 78 | { |
| 79 | } |
| 80 | |
Dan Williams | 303694e | 2012-06-21 23:41:51 -0700 | [diff] [blame] | 81 | static inline void sas_suspend_sata(struct asd_sas_port *port) |
| 82 | { |
| 83 | } |
| 84 | |
| 85 | static inline void sas_resume_sata(struct asd_sas_port *port) |
| 86 | { |
| 87 | } |
| 88 | |
Dan Williams | 354cf82 | 2012-01-12 17:57:35 -0800 | [diff] [blame] | 89 | static inline int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy) |
| 90 | { |
| 91 | return 0; |
| 92 | } |
Dan Williams | e4a9c37 | 2012-06-21 23:25:27 -0700 | [diff] [blame] | 93 | |
| 94 | static inline void sas_ata_end_eh(struct ata_port *ap) |
| 95 | { |
| 96 | } |
John Garry | 3f2e252 | 2022-02-22 20:50:59 +0800 | [diff] [blame] | 97 | |
John Garry | 4411292 | 2022-10-17 17:20:28 +0800 | [diff] [blame] | 98 | static inline void sas_ata_device_link_abort(struct domain_device *dev, |
| 99 | bool force_reset) |
| 100 | { |
| 101 | } |
| 102 | |
John Garry | 3f2e252 | 2022-02-22 20:50:59 +0800 | [diff] [blame] | 103 | static inline int sas_execute_ata_cmd(struct domain_device *device, u8 *fis, |
| 104 | int force_phy_id) |
| 105 | { |
| 106 | return 0; |
| 107 | } |
John Garry | 057e5fc | 2022-05-12 19:15:32 +0800 | [diff] [blame] | 108 | |
Jie Zhan | 9181ce3 | 2022-11-18 16:37:12 +0800 | [diff] [blame] | 109 | static inline int smp_ata_check_ready_type(struct ata_link *link) |
| 110 | { |
| 111 | return 0; |
| 112 | } |
Jason Yan | ffebb38 | 2022-12-14 21:38:05 +0800 | [diff] [blame] | 113 | |
| 114 | static inline int sas_discover_sata(struct domain_device *dev) |
| 115 | { |
| 116 | sas_ata_disabled_notice(); |
| 117 | return -ENXIO; |
| 118 | } |
Jason Yan | 7cc7646 | 2022-12-14 21:38:07 +0800 | [diff] [blame] | 119 | |
| 120 | static 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 Bottomley | b914217 | 2007-07-22 13:15:55 -0500 | [diff] [blame] | 126 | #endif |
| 127 | |
Darrick J. Wong | 338ec57 | 2006-10-18 14:43:37 -0700 | [diff] [blame] | 128 | #endif /* _SAS_ATA_H_ */ |