intel_sas.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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 _INTEL_SAS_H_
  56. #define _INTEL_SAS_H_
  57. /**
  58. * This file contains all of the definitions relating to structures, constants,
  59. * etc. defined by the SAS specification.
  60. *
  61. *
  62. */
  63. #include <linux/kernel.h>
  64. #include "intel_scsi.h"
  65. /**
  66. * struct sci_sas_address - This structure depicts how a SAS address is
  67. * represented by SCI.
  68. *
  69. *
  70. */
  71. struct sci_sas_address {
  72. /**
  73. * This member contains the higher 32-bits of the SAS address.
  74. */
  75. u32 high;
  76. /**
  77. * This member contains the lower 32-bits of the SAS address.
  78. */
  79. u32 low;
  80. };
  81. /**
  82. * struct sci_sas_identify_address_frame_protocols - This structure depicts the
  83. * contents of bytes 2 and 3 in the SAS IDENTIFY ADDRESS FRAME (IAF).
  84. *
  85. * For specific information on each of these individual fields please reference
  86. * the SAS specification Link layer section on address frames.
  87. */
  88. struct sci_sas_identify_address_frame_protocols {
  89. union {
  90. struct {
  91. u16 restricted1:1;
  92. u16 smp_initiator:1;
  93. u16 stp_initiator:1;
  94. u16 ssp_initiator:1;
  95. u16 reserved3:4;
  96. u16 restricted2:1;
  97. u16 smp_target:1;
  98. u16 stp_target:1;
  99. u16 ssp_target:1;
  100. u16 reserved4:4;
  101. } bits;
  102. u16 all;
  103. } u;
  104. };
  105. /**
  106. * enum _SCI_SAS_TASK_ATTRIBUTE - This enumeration depicts the SAM/SAS
  107. * specification defined task attribute values for a command information
  108. * unit.
  109. *
  110. *
  111. */
  112. enum sci_sas_task_attribute {
  113. SCI_SAS_SIMPLE_ATTRIBUTE = 0,
  114. SCI_SAS_HEAD_OF_QUEUE_ATTRIBUTE = 1,
  115. SCI_SAS_ORDERED_ATTRIBUTE = 2,
  116. SCI_SAS_ACA_ATTRIBUTE = 4,
  117. };
  118. /**
  119. * enum _SCI_SAS_TASK_MGMT_FUNCTION - This enumeration depicts the SAM/SAS
  120. * specification defined task management functions.
  121. *
  122. * This HARD_RESET function listed here is not actually defined as a task
  123. * management function in the industry standard.
  124. */
  125. enum sci_sas_task_mgmt_function {
  126. SCI_SAS_ABORT_TASK = SCSI_TASK_REQUEST_ABORT_TASK,
  127. SCI_SAS_ABORT_TASK_SET = SCSI_TASK_REQUEST_ABORT_TASK_SET,
  128. SCI_SAS_CLEAR_TASK_SET = SCSI_TASK_REQUEST_CLEAR_TASK_SET,
  129. SCI_SAS_LOGICAL_UNIT_RESET = SCSI_TASK_REQUEST_LOGICAL_UNIT_RESET,
  130. SCI_SAS_I_T_NEXUS_RESET = SCSI_TASK_REQUEST_I_T_NEXUS_RESET,
  131. SCI_SAS_CLEAR_ACA = SCSI_TASK_REQUEST_CLEAR_ACA,
  132. SCI_SAS_QUERY_TASK = SCSI_TASK_REQUEST_QUERY_TASK,
  133. SCI_SAS_QUERY_TASK_SET = SCSI_TASK_REQUEST_QUERY_TASK_SET,
  134. SCI_SAS_QUERY_ASYNCHRONOUS_EVENT = SCSI_TASK_REQUEST_QUERY_UNIT_ATTENTION,
  135. SCI_SAS_HARD_RESET = 0xFF
  136. };
  137. /**
  138. * enum _SCI_SAS_FRAME_TYPE - This enumeration depicts the SAS specification
  139. * defined SSP frame types.
  140. *
  141. *
  142. */
  143. enum sci_sas_frame_type {
  144. SCI_SAS_DATA_FRAME = 0x01,
  145. SCI_SAS_XFER_RDY_FRAME = 0x05,
  146. SCI_SAS_COMMAND_FRAME = 0x06,
  147. SCI_SAS_RESPONSE_FRAME = 0x07,
  148. SCI_SAS_TASK_FRAME = 0x16
  149. };
  150. /**
  151. * struct sci_ssp_frame_header - This structure depicts the contents of an SSP
  152. * frame header. For specific information on the individual fields please
  153. * reference the SAS specification transport layer SSP frame format.
  154. *
  155. *
  156. */
  157. struct sci_ssp_frame_header {
  158. /* Word 0 */
  159. u32 hashed_destination_address:24;
  160. u32 frame_type:8;
  161. /* Word 1 */
  162. u32 hashed_source_address:24;
  163. u32 reserved1_0:8;
  164. /* Word 2 */
  165. u32 reserved2_2:6;
  166. u32 fill_bytes:2;
  167. u32 reserved2_1:3;
  168. u32 tlr_control:2;
  169. u32 retry_data_frames:1;
  170. u32 retransmit:1;
  171. u32 changing_data_pointer:1;
  172. u32 reserved2_0:16;
  173. /* Word 3 */
  174. u32 uiResv4;
  175. /* Word 4 */
  176. u16 target_port_transfer_tag;
  177. u16 tag;
  178. /* Word 5 */
  179. u32 data_offset;
  180. };
  181. #define PHY_OPERATION_NOP 0x00
  182. #define PHY_OPERATION_LINK_RESET 0x01
  183. #define PHY_OPERATION_HARD_RESET 0x02
  184. #define PHY_OPERATION_DISABLE 0x03
  185. #define PHY_OPERATION_CLEAR_ERROR_LOG 0x05
  186. #define PHY_OPERATION_CLEAR_AFFILIATION 0x06
  187. #define NPLR_PHY_ENABLED_UNK_LINK_RATE 0x00
  188. #define NPLR_PHY_DISABLED 0x01
  189. #define NPLR_PHY_ENABLED_SPD_NEG_FAILED 0x02
  190. #define NPLR_PHY_ENABLED_SATA_HOLD 0x03
  191. #define NPLR_PHY_ENABLED_1_5G 0x08
  192. #define NPLR_PHY_ENABLED_3_0G 0x09
  193. /* SMP Function Result values. */
  194. #define SMP_RESULT_FUNCTION_ACCEPTED 0x00
  195. #define SMP_RESULT_UNKNOWN_FUNCTION 0x01
  196. #define SMP_RESULT_FUNCTION_FAILED 0x02
  197. #define SMP_RESULT_INVALID_REQUEST_FRAME_LEN 0x03
  198. #define SMP_RESULT_INAVALID_EXPANDER_CHANGE_COUNT 0x04
  199. #define SMP_RESULT_BUSY 0x05
  200. #define SMP_RESULT_INCOMPLETE_DESCRIPTOR_LIST 0x06
  201. #define SMP_RESULT_PHY_DOES_NOT_EXIST 0x10
  202. #define SMP_RESULT_INDEX_DOES_NOT_EXIST 0x11
  203. #define SMP_RESULT_PHY_DOES_NOT_SUPPORT_SATA 0x12
  204. #define SMP_RESULT_UNKNOWN_PHY_OPERATION 0x13
  205. #define SMP_RESULT_UNKNOWN_PHY_TEST_FUNCTION 0x14
  206. #define SMP_RESULT_PHY_TEST_IN_PROGRESS 0x15
  207. #define SMP_RESULT_PHY_VACANT 0x16
  208. /* Attached Device Types */
  209. #define SMP_NO_DEVICE_ATTACHED 0
  210. #define SMP_END_DEVICE_ONLY 1
  211. #define SMP_EDGE_EXPANDER_DEVICE 2
  212. #define SMP_FANOUT_EXPANDER_DEVICE 3
  213. /* Expander phy routine attribute */
  214. #define DIRECT_ROUTING_ATTRIBUTE 0
  215. #define SUBTRACTIVE_ROUTING_ATTRIBUTE 1
  216. #define TABLE_ROUTING_ATTRIBUTE 2
  217. #endif /* _INTEL_SAS_H_ */