scic_phy.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. /*
  2. * This file is provided under a dual BSD/GPLv2 license. When using or
  3. * redistributing this file, you may do so under either license.
  4. *
  5. * GPL LICENSE SUMMARY
  6. *
  7. * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of version 2 of the GNU General Public License as
  11. * published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  21. * The full GNU General Public License is included in this distribution
  22. * in the file called LICENSE.GPL.
  23. *
  24. * BSD LICENSE
  25. *
  26. * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
  27. * All rights reserved.
  28. *
  29. * Redistribution and use in source and binary forms, with or without
  30. * modification, are permitted provided that the following conditions
  31. * are met:
  32. *
  33. * * Redistributions of source code must retain the above copyright
  34. * notice, this list of conditions and the following disclaimer.
  35. * * Redistributions in binary form must reproduce the above copyright
  36. * notice, this list of conditions and the following disclaimer in
  37. * the documentation and/or other materials provided with the
  38. * distribution.
  39. * * Neither the name of Intel Corporation nor the names of its
  40. * contributors may be used to endorse or promote products derived
  41. * from this software without specific prior written permission.
  42. *
  43. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  44. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  45. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  46. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  47. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  48. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  49. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  50. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  51. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  52. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  53. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  54. */
  55. #ifndef _SCIC_PHY_H_
  56. #define _SCIC_PHY_H_
  57. /**
  58. * This file contains all of the interface methods that can be called by an
  59. * SCIC user on a phy (SAS or SATA) object.
  60. *
  61. *
  62. */
  63. #include "sci_status.h"
  64. #include "intel_sata.h"
  65. #include "intel_sas.h"
  66. struct scic_sds_phy;
  67. struct scic_sds_port;
  68. enum sas_linkrate sci_phy_linkrate(struct scic_sds_phy *sci_phy);
  69. /**
  70. * struct scic_phy_properties - This structure defines the properties common to
  71. * all phys that can be retrieved.
  72. *
  73. *
  74. */
  75. struct scic_phy_properties {
  76. /**
  77. * This field specifies the port that currently contains the
  78. * supplied phy. This field may be set to NULL
  79. * if the phy is not currently contained in a port.
  80. */
  81. struct scic_sds_port *owning_port;
  82. /**
  83. * This field specifies the link rate at which the phy is
  84. * currently operating.
  85. */
  86. enum sci_sas_link_rate negotiated_link_rate;
  87. /**
  88. * This field indicates the protocols supported by the phy.
  89. */
  90. struct sci_sas_identify_address_frame_protocols protocols;
  91. /**
  92. * This field specifies the index of the phy in relation to other
  93. * phys within the controller. This index is zero relative.
  94. */
  95. u8 index;
  96. };
  97. /**
  98. * struct scic_sas_phy_properties - This structure defines the properties,
  99. * specific to a SAS phy, that can be retrieved.
  100. *
  101. *
  102. */
  103. struct scic_sas_phy_properties {
  104. /**
  105. * This field delineates the Identify Address Frame received
  106. * from the remote end point.
  107. */
  108. struct sci_sas_identify_address_frame received_iaf;
  109. /**
  110. * This field delineates the Phy capabilities structure received
  111. * from the remote end point.
  112. */
  113. struct sas_capabilities received_capabilities;
  114. };
  115. /**
  116. * struct scic_sata_phy_properties - This structure defines the properties,
  117. * specific to a SATA phy, that can be retrieved.
  118. *
  119. *
  120. */
  121. struct scic_sata_phy_properties {
  122. /**
  123. * This field delineates the signature FIS received from the
  124. * attached target.
  125. */
  126. struct sata_fis_reg_d2h signature_fis;
  127. /**
  128. * This field specifies to the user if a port selector is connected
  129. * on the specified phy.
  130. */
  131. bool is_port_selector_present;
  132. };
  133. /**
  134. * enum scic_phy_counter_id - This enumeration depicts the various pieces of
  135. * optional information that can be retrieved for a specific phy.
  136. *
  137. *
  138. */
  139. enum scic_phy_counter_id {
  140. /**
  141. * This PHY information field tracks the number of frames received.
  142. */
  143. SCIC_PHY_COUNTER_RECEIVED_FRAME,
  144. /**
  145. * This PHY information field tracks the number of frames transmitted.
  146. */
  147. SCIC_PHY_COUNTER_TRANSMITTED_FRAME,
  148. /**
  149. * This PHY information field tracks the number of DWORDs received.
  150. */
  151. SCIC_PHY_COUNTER_RECEIVED_FRAME_WORD,
  152. /**
  153. * This PHY information field tracks the number of DWORDs transmitted.
  154. */
  155. SCIC_PHY_COUNTER_TRANSMITTED_FRAME_DWORD,
  156. /**
  157. * This PHY information field tracks the number of times DWORD
  158. * synchronization was lost.
  159. */
  160. SCIC_PHY_COUNTER_LOSS_OF_SYNC_ERROR,
  161. /**
  162. * This PHY information field tracks the number of received DWORDs with
  163. * running disparity errors.
  164. */
  165. SCIC_PHY_COUNTER_RECEIVED_DISPARITY_ERROR,
  166. /**
  167. * This PHY information field tracks the number of received frames with a
  168. * CRC error (not including short or truncated frames).
  169. */
  170. SCIC_PHY_COUNTER_RECEIVED_FRAME_CRC_ERROR,
  171. /**
  172. * This PHY information field tracks the number of DONE (ACK/NAK TIMEOUT)
  173. * primitives received.
  174. */
  175. SCIC_PHY_COUNTER_RECEIVED_DONE_ACK_NAK_TIMEOUT,
  176. /**
  177. * This PHY information field tracks the number of DONE (ACK/NAK TIMEOUT)
  178. * primitives transmitted.
  179. */
  180. SCIC_PHY_COUNTER_TRANSMITTED_DONE_ACK_NAK_TIMEOUT,
  181. /**
  182. * This PHY information field tracks the number of times the inactivity
  183. * timer for connections on the phy has been utilized.
  184. */
  185. SCIC_PHY_COUNTER_INACTIVITY_TIMER_EXPIRED,
  186. /**
  187. * This PHY information field tracks the number of DONE (CREDIT TIMEOUT)
  188. * primitives received.
  189. */
  190. SCIC_PHY_COUNTER_RECEIVED_DONE_CREDIT_TIMEOUT,
  191. /**
  192. * This PHY information field tracks the number of DONE (CREDIT TIMEOUT)
  193. * primitives transmitted.
  194. */
  195. SCIC_PHY_COUNTER_TRANSMITTED_DONE_CREDIT_TIMEOUT,
  196. /**
  197. * This PHY information field tracks the number of CREDIT BLOCKED
  198. * primitives received.
  199. * @note Depending on remote device implementation, credit blocks
  200. * may occur regularly.
  201. */
  202. SCIC_PHY_COUNTER_RECEIVED_CREDIT_BLOCKED,
  203. /**
  204. * This PHY information field contains the number of short frames
  205. * received. A short frame is simply a frame smaller then what is
  206. * allowed by either the SAS or SATA specification.
  207. */
  208. SCIC_PHY_COUNTER_RECEIVED_SHORT_FRAME,
  209. /**
  210. * This PHY information field contains the number of frames received after
  211. * credit has been exhausted.
  212. */
  213. SCIC_PHY_COUNTER_RECEIVED_FRAME_WITHOUT_CREDIT,
  214. /**
  215. * This PHY information field contains the number of frames received after
  216. * a DONE has been received.
  217. */
  218. SCIC_PHY_COUNTER_RECEIVED_FRAME_AFTER_DONE,
  219. /**
  220. * This PHY information field contains the number of times the phy
  221. * failed to achieve DWORD synchronization during speed negotiation.
  222. */
  223. SCIC_PHY_COUNTER_SN_DWORD_SYNC_ERROR
  224. };
  225. /**
  226. * scic_sas_phy_get_properties() - This method will enable the user to retrieve
  227. * information specific to a SAS phy, such as: the received identify address
  228. * frame, received phy capabilities, etc.
  229. * @phy: this parameter specifies the phy for which to retrieve properties.
  230. * @properties: This parameter specifies the properties structure into which to
  231. * copy the requested information.
  232. *
  233. * This method returns an indication as to whether the SAS phy properties were
  234. * successfully retrieved. SCI_SUCCESS This value is returned if the SAS
  235. * properties are successfully retrieved. SCI_FAILURE This value is returned if
  236. * the SAS properties are not successfully retrieved (e.g. It's not a SAS Phy).
  237. */
  238. enum sci_status scic_sas_phy_get_properties(
  239. struct scic_sds_phy *phy,
  240. struct scic_sas_phy_properties *properties);
  241. /**
  242. * scic_sata_phy_get_properties() - This method will enable the user to
  243. * retrieve information specific to a SATA phy, such as: the received
  244. * signature FIS, if a port selector is present, etc.
  245. * @phy: this parameter specifies the phy for which to retrieve properties.
  246. * @properties: This parameter specifies the properties structure into which to
  247. * copy the requested information.
  248. *
  249. * This method returns an indication as to whether the SATA phy properties were
  250. * successfully retrieved. SCI_SUCCESS This value is returned if the SATA
  251. * properties are successfully retrieved. SCI_FAILURE This value is returned if
  252. * the SATA properties are not successfully retrieved (e.g. It's not a SATA
  253. * Phy).
  254. */
  255. enum sci_status scic_sata_phy_get_properties(
  256. struct scic_sds_phy *phy,
  257. struct scic_sata_phy_properties *properties);
  258. #endif /* _SCIC_PHY_H_ */