sas_ata.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. #ifndef _SAS_ATA_H_
  10. #define _SAS_ATA_H_
  11. #include <linux/libata.h>
  12. #include <scsi/libsas.h>
  13. #ifdef CONFIG_SCSI_SAS_ATA
  14. static inline int dev_is_sata(struct domain_device *dev)
  15. {
  16. return dev->dev_type == SAS_SATA_DEV || dev->dev_type == SAS_SATA_PM ||
  17. dev->dev_type == SAS_SATA_PM_PORT || dev->dev_type == SAS_SATA_PENDING;
  18. }
  19. int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy);
  20. int sas_ata_init(struct domain_device *dev);
  21. void sas_ata_task_abort(struct sas_task *task);
  22. void sas_ata_strategy_handler(struct Scsi_Host *shost);
  23. void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q);
  24. void sas_ata_schedule_reset(struct domain_device *dev);
  25. void sas_ata_wait_eh(struct domain_device *dev);
  26. void sas_probe_sata(struct asd_sas_port *port);
  27. void sas_suspend_sata(struct asd_sas_port *port);
  28. void sas_resume_sata(struct asd_sas_port *port);
  29. void sas_ata_end_eh(struct ata_port *ap);
  30. void sas_ata_device_link_abort(struct domain_device *dev, bool force_reset);
  31. int sas_execute_ata_cmd(struct domain_device *device, u8 *fis,
  32. int force_phy_id);
  33. int smp_ata_check_ready_type(struct ata_link *link);
  34. int sas_discover_sata(struct domain_device *dev);
  35. int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *phy,
  36. struct domain_device *child, int phy_id);
  37. extern const struct attribute_group sas_ata_sdev_attr_group;
  38. #else
  39. static inline void sas_ata_disabled_notice(void)
  40. {
  41. pr_notice_once("ATA device seen but CONFIG_SCSI_SAS_ATA=N\n");
  42. }
  43. static inline int dev_is_sata(struct domain_device *dev)
  44. {
  45. return 0;
  46. }
  47. static inline int sas_ata_init(struct domain_device *dev)
  48. {
  49. return 0;
  50. }
  51. static inline void sas_ata_task_abort(struct sas_task *task)
  52. {
  53. }
  54. static inline void sas_ata_strategy_handler(struct Scsi_Host *shost)
  55. {
  56. }
  57. static inline void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q)
  58. {
  59. }
  60. static inline void sas_ata_schedule_reset(struct domain_device *dev)
  61. {
  62. }
  63. static inline void sas_ata_wait_eh(struct domain_device *dev)
  64. {
  65. }
  66. static inline void sas_probe_sata(struct asd_sas_port *port)
  67. {
  68. }
  69. static inline void sas_suspend_sata(struct asd_sas_port *port)
  70. {
  71. }
  72. static inline void sas_resume_sata(struct asd_sas_port *port)
  73. {
  74. }
  75. static inline int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy)
  76. {
  77. return 0;
  78. }
  79. static inline void sas_ata_end_eh(struct ata_port *ap)
  80. {
  81. }
  82. static inline void sas_ata_device_link_abort(struct domain_device *dev,
  83. bool force_reset)
  84. {
  85. }
  86. static inline int sas_execute_ata_cmd(struct domain_device *device, u8 *fis,
  87. int force_phy_id)
  88. {
  89. return 0;
  90. }
  91. static inline int smp_ata_check_ready_type(struct ata_link *link)
  92. {
  93. return 0;
  94. }
  95. static inline int sas_discover_sata(struct domain_device *dev)
  96. {
  97. sas_ata_disabled_notice();
  98. return -ENXIO;
  99. }
  100. static inline int sas_ata_add_dev(struct domain_device *parent, struct ex_phy *phy,
  101. struct domain_device *child, int phy_id)
  102. {
  103. sas_ata_disabled_notice();
  104. return -ENODEV;
  105. }
  106. #define sas_ata_sdev_attr_group ((struct attribute_group) {})
  107. #endif
  108. #endif /* _SAS_ATA_H_ */