intel_sas.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948
  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 "intel_sata.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. * struct sci_sas_identify_address_frame - This structure depicts the contents
  107. * of the SAS IDENTIFY ADDRESS FRAME (IAF).
  108. *
  109. * For specific information on each of these individual fields please reference
  110. * the SAS specification Link layer section on address frames.
  111. */
  112. struct sci_sas_identify_address_frame {
  113. u16 address_frame_type:4;
  114. u16 device_type:3;
  115. u16 reserved1:1;
  116. u16 reason:4;
  117. u16 reserved2:4;
  118. struct sci_sas_identify_address_frame_protocols protocols;
  119. struct sci_sas_address device_name;
  120. struct sci_sas_address sas_address;
  121. u32 phy_identifier:8;
  122. u32 break_reply_capable:1;
  123. u32 requested_in_zpsds:1;
  124. u32 in_zpsds_persistent:1;
  125. u32 reserved5:21;
  126. u32 reserved6[4];
  127. };
  128. /**
  129. * struct sas_capabilities - This structure depicts the various SAS
  130. * capabilities supported by the directly attached target device. For
  131. * specific information on each of these individual fields please reference
  132. * the SAS specification Phy layer section on speed negotiation windows.
  133. *
  134. *
  135. */
  136. struct sas_capabilities {
  137. union {
  138. #if defined (SCIC_SDS_4_ENABLED)
  139. struct {
  140. /**
  141. * The SAS specification indicates the start bit shall always be set to
  142. * 1. This implementation will have the start bit set to 0 if the
  143. * PHY CAPABILITIES were either not received or speed negotiation failed.
  144. */
  145. u32 start:1;
  146. u32 tx_ssc_type:1;
  147. u32 reserved1:2;
  148. u32 requested_logical_link_rate:4;
  149. u32 gen1_without_ssc_supported:1;
  150. u32 gen1_with_ssc_supported:1;
  151. u32 gen2_without_ssc_supported:1;
  152. u32 gen2_with_ssc_supported:1;
  153. u32 gen3_without_ssc_supported:1;
  154. u32 gen3_with_ssc_supported:1;
  155. u32 reserved2:17;
  156. u32 parity:1;
  157. } bits;
  158. #endif /* (SCIC_SDS_4_ENABLED) */
  159. u32 all;
  160. } u;
  161. };
  162. /**
  163. * enum _SCI_SAS_LINK_RATE - This enumeration depicts the SAS specification
  164. * defined link speeds.
  165. *
  166. *
  167. */
  168. enum sci_sas_link_rate {
  169. SCI_SAS_NO_LINK_RATE = 0,
  170. SCI_SATA_SPINUP_HOLD = 0x3,
  171. SCI_SAS_150_GB = 0x8,
  172. SCI_SAS_300_GB = 0x9,
  173. SCI_SAS_600_GB = 0xA
  174. };
  175. /**
  176. * enum _SCI_SAS_TASK_ATTRIBUTE - This enumeration depicts the SAM/SAS
  177. * specification defined task attribute values for a command information
  178. * unit.
  179. *
  180. *
  181. */
  182. enum sci_sas_task_attribute {
  183. SCI_SAS_SIMPLE_ATTRIBUTE = 0,
  184. SCI_SAS_HEAD_OF_QUEUE_ATTRIBUTE = 1,
  185. SCI_SAS_ORDERED_ATTRIBUTE = 2,
  186. SCI_SAS_ACA_ATTRIBUTE = 4,
  187. };
  188. /**
  189. * enum _SCI_SAS_TASK_MGMT_FUNCTION - This enumeration depicts the SAM/SAS
  190. * specification defined task management functions.
  191. *
  192. * This HARD_RESET function listed here is not actually defined as a task
  193. * management function in the industry standard.
  194. */
  195. enum sci_sas_task_mgmt_function {
  196. SCI_SAS_ABORT_TASK = SCSI_TASK_REQUEST_ABORT_TASK,
  197. SCI_SAS_ABORT_TASK_SET = SCSI_TASK_REQUEST_ABORT_TASK_SET,
  198. SCI_SAS_CLEAR_TASK_SET = SCSI_TASK_REQUEST_CLEAR_TASK_SET,
  199. SCI_SAS_LOGICAL_UNIT_RESET = SCSI_TASK_REQUEST_LOGICAL_UNIT_RESET,
  200. SCI_SAS_I_T_NEXUS_RESET = SCSI_TASK_REQUEST_I_T_NEXUS_RESET,
  201. SCI_SAS_CLEAR_ACA = SCSI_TASK_REQUEST_CLEAR_ACA,
  202. SCI_SAS_QUERY_TASK = SCSI_TASK_REQUEST_QUERY_TASK,
  203. SCI_SAS_QUERY_TASK_SET = SCSI_TASK_REQUEST_QUERY_TASK_SET,
  204. SCI_SAS_QUERY_ASYNCHRONOUS_EVENT = SCSI_TASK_REQUEST_QUERY_UNIT_ATTENTION,
  205. SCI_SAS_HARD_RESET = 0xFF
  206. };
  207. /**
  208. * enum _SCI_SAS_FRAME_TYPE - This enumeration depicts the SAS specification
  209. * defined SSP frame types.
  210. *
  211. *
  212. */
  213. enum sci_sas_frame_type {
  214. SCI_SAS_DATA_FRAME = 0x01,
  215. SCI_SAS_XFER_RDY_FRAME = 0x05,
  216. SCI_SAS_COMMAND_FRAME = 0x06,
  217. SCI_SAS_RESPONSE_FRAME = 0x07,
  218. SCI_SAS_TASK_FRAME = 0x16
  219. };
  220. /**
  221. * struct sci_ssp_command_iu - This structure depicts the contents of the SSP
  222. * COMMAND INFORMATION UNIT. For specific information on each of these
  223. * individual fields please reference the SAS specification SSP transport
  224. * layer section.
  225. *
  226. *
  227. */
  228. struct sci_ssp_command_iu {
  229. u32 lun_upper;
  230. u32 lun_lower;
  231. u32 additional_cdb_length:6;
  232. u32 reserved0:2;
  233. u32 reserved1:8;
  234. u32 enable_first_burst:1;
  235. u32 task_priority:4;
  236. u32 task_attribute:3;
  237. u32 reserved2:8;
  238. u32 cdb[4];
  239. };
  240. /**
  241. * struct sci_ssp_task_iu - This structure depicts the contents of the SSP TASK
  242. * INFORMATION UNIT. For specific information on each of these individual
  243. * fields please reference the SAS specification SSP transport layer section.
  244. *
  245. *
  246. */
  247. struct sci_ssp_task_iu {
  248. u32 lun_upper;
  249. u32 lun_lower;
  250. u32 reserved0:8;
  251. u32 task_function:8;
  252. u32 reserved1:8;
  253. u32 reserved2:8;
  254. u32 reserved3:16;
  255. u32 task_tag:16;
  256. u32 reserved4[3];
  257. };
  258. #define SSP_RESPONSE_IU_MAX_DATA 64
  259. #define SCI_SSP_RESPONSE_IU_DATA_PRESENT_MASK (0x03)
  260. #define sci_ssp_get_sense_data_length(sense_data_length_buffer) \
  261. SCIC_BUILD_DWORD(sense_data_length_buffer)
  262. #define sci_ssp_get_response_data_length(response_data_length_buffer) \
  263. SCIC_BUILD_DWORD(response_data_length_buffer)
  264. /**
  265. * struct sci_ssp_response_iu - This structure depicts the contents of the SSP
  266. * RESPONSE INFORMATION UNIT. For specific information on each of these
  267. * individual fields please reference the SAS specification SSP transport
  268. * layer section.
  269. *
  270. *
  271. */
  272. struct sci_ssp_response_iu {
  273. u8 reserved0[8];
  274. u8 retry_delay_timer[2];
  275. u8 data_present;
  276. u8 status;
  277. u8 reserved1[4];
  278. u8 sense_data_length[4];
  279. u8 response_data_length[4];
  280. u32 data[SSP_RESPONSE_IU_MAX_DATA];
  281. };
  282. /**
  283. * enum _SCI_SAS_DATA_PRESENT_TYPE - This enumeration depicts the SAS
  284. * specification defined SSP data present types in struct sci_ssp_response_iu.
  285. *
  286. *
  287. */
  288. enum sci_ssp_response_iu_data_present_type {
  289. SCI_SSP_RESPONSE_IU_NO_DATA = 0x00,
  290. SCI_SSP_RESPONSE_IU_RESPONSE_DATA = 0x01,
  291. SCI_SSP_RESPONSE_IU_SENSE_DATA = 0x02
  292. };
  293. /**
  294. * struct sci_ssp_frame_header - This structure depicts the contents of an SSP
  295. * frame header. For specific information on the individual fields please
  296. * reference the SAS specification transport layer SSP frame format.
  297. *
  298. *
  299. */
  300. struct sci_ssp_frame_header {
  301. /* Word 0 */
  302. u32 hashed_destination_address:24;
  303. u32 frame_type:8;
  304. /* Word 1 */
  305. u32 hashed_source_address:24;
  306. u32 reserved1_0:8;
  307. /* Word 2 */
  308. u32 reserved2_2:6;
  309. u32 fill_bytes:2;
  310. u32 reserved2_1:3;
  311. u32 tlr_control:2;
  312. u32 retry_data_frames:1;
  313. u32 retransmit:1;
  314. u32 changing_data_pointer:1;
  315. u32 reserved2_0:16;
  316. /* Word 3 */
  317. u32 uiResv4;
  318. /* Word 4 */
  319. u16 target_port_transfer_tag;
  320. u16 tag;
  321. /* Word 5 */
  322. u32 data_offset;
  323. };
  324. /**
  325. * struct smp_request_header - This structure defines the contents of an SMP
  326. * Request header.
  327. *
  328. * For specific information on each of these individual fields please reference
  329. * the SAS specification.
  330. */
  331. struct smp_request_header {
  332. u8 smp_frame_type; /* byte 0 */
  333. u8 function; /* byte 1 */
  334. u8 allocated_response_length; /* byte 2 */
  335. u8 request_length; /* byte 3 */
  336. };
  337. /**
  338. * struct smp_response_header - This structure depicts the contents of the SAS
  339. * SMP DISCOVER RESPONSE frame. For specific information on each of these
  340. * individual fields please reference the SAS specification Link layer
  341. * section on address frames.
  342. *
  343. *
  344. */
  345. struct smp_response_header {
  346. u8 smp_frame_type; /* byte 0 */
  347. u8 function; /* byte 1 */
  348. u8 function_result; /* byte 2 */
  349. u8 response_length; /* byte 3 */
  350. };
  351. /**
  352. * struct smp_request_general - This structure defines the contents of an SMP
  353. * Request that is comprised of the struct smp_request_header and a CRC.
  354. *
  355. * For specific information on each of these individual fields please reference
  356. * the SAS specification.
  357. */
  358. struct smp_request_general {
  359. u32 crc; /* bytes 4-7 */
  360. };
  361. /**
  362. * struct smp_request_phy_identifier - This structure defines the contents of
  363. * an SMP Request that is comprised of the struct smp_request_header and a phy
  364. * identifier. Examples: SMP_REQUEST_DISCOVER, SMP_REQUEST_REPORT_PHY_SATA.
  365. *
  366. * For specific information on each of these individual fields please reference
  367. * the SAS specification.
  368. */
  369. struct smp_request_phy_identifier {
  370. u32 reserved_byte4_7; /* bytes 4-7 */
  371. u32 ignore_zone_group:1; /* byte 8 */
  372. u32 reserved_byte8:7;
  373. u32 phy_identifier:8; /* byte 9 */
  374. u32 reserved_byte10:8; /* byte 10 */
  375. u32 reserved_byte11:8; /* byte 11 */
  376. };
  377. /**
  378. * struct smp_request_configure_route_information - This structure defines the
  379. * contents of an SMP Configure Route Information request.
  380. *
  381. * For specific information on each of these individual fields please reference
  382. * the SAS specification.
  383. */
  384. struct smp_request_configure_route_information {
  385. u32 expected_expander_change_count:16; /* bytes 4-5 */
  386. u32 expander_route_index_high:8;
  387. u32 expander_route_index:8; /* bytes 6-7 */
  388. u32 reserved_byte8:8; /* bytes 8 */
  389. u32 phy_identifier:8; /* bytes 9 */
  390. u32 reserved_byte_10_11:16; /* bytes 10-11 */
  391. u32 reserved_byte_12_bit_0_6:7;
  392. u32 disable_route_entry:1; /* byte 12 */
  393. u32 reserved_byte_13_15:24; /* bytes 13-15 */
  394. u32 routed_sas_address[2]; /* bytes 16-23 */
  395. u8 reserved_byte_24_39[16]; /* bytes 24-39 */
  396. };
  397. /**
  398. * struct smp_request_phy_control - This structure defines the contents of an
  399. * SMP Phy Controler request.
  400. *
  401. * For specific information on each of these individual fields please reference
  402. * the SAS specification.
  403. */
  404. struct smp_request_phy_control {
  405. u16 expected_expander_change_count; /* byte 4-5 */
  406. u16 reserved_byte_6_7; /* byte 6-7 */
  407. u8 reserved_byte_8; /* byte 8 */
  408. u8 phy_identifier; /* byte 9 */
  409. u8 phy_operation; /* byte 10 */
  410. u8 update_partial_pathway_timeout_value:1;
  411. u8 reserved_byte_11_bit_1_7:7; /* byte 11 */
  412. u8 reserved_byte_12_23[12]; /* byte 12-23 */
  413. u8 attached_device_name[8]; /* byte 24-31 */
  414. u8 reserved_byte_32_bit_3_0:4; /* byte 32 */
  415. u8 programmed_minimum_physical_link_rate:4;
  416. u8 reserved_byte_33_bit_3_0:4; /* byte 33 */
  417. u8 programmed_maximum_physical_link_rate:4;
  418. u16 reserved_byte_34_35; /* byte 34-35 */
  419. u8 partial_pathway_timeout_value:4;
  420. u8 reserved_byte_36_bit_4_7:4; /* byte 36 */
  421. u16 reserved_byte_37_38; /* byte 37-38 */
  422. u8 reserved_byte_39; /* byte 39 */
  423. };
  424. /**
  425. * struct smp_request_vendor_specific - This structure depicts the vendor
  426. * specific space for SMP request.
  427. *
  428. *
  429. */
  430. #define SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH 1016
  431. struct smp_request_vendor_specific {
  432. u8 request_bytes[SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH];
  433. };
  434. /**
  435. * struct smp_request - This structure simply unionizes the existing request
  436. * structures into a common request type.
  437. *
  438. *
  439. */
  440. struct smp_request {
  441. struct smp_request_header header;
  442. union { /* bytes 4-N */
  443. struct smp_request_general report_general;
  444. struct smp_request_phy_identifier discover;
  445. struct smp_request_general report_manufacturer_information;
  446. struct smp_request_phy_identifier report_phy_sata;
  447. struct smp_request_phy_control phy_control;
  448. struct smp_request_phy_identifier report_phy_error_log;
  449. struct smp_request_phy_identifier report_route_information;
  450. struct smp_request_configure_route_information configure_route_information;
  451. struct smp_request_vendor_specific vendor_specific_request;
  452. } request;
  453. };
  454. /**
  455. * struct smp_response_report_general - This structure depicts the SMP Report
  456. * General for expander devices. It adheres to the SAS-2.1 specification.
  457. *
  458. * For specific information on each of these individual fields please reference
  459. * the SAS specification Application layer section on SMP.
  460. */
  461. struct smp_response_report_general {
  462. u16 expander_change_count; /* byte 4-5 */
  463. u16 expander_route_indexes; /* byte 6-7 */
  464. u32 reserved_byte8:7; /* byte 8 bit 0-6 */
  465. u32 long_response:1; /* byte 8 bit 7 */
  466. u32 number_of_phys:8; /* byte 9 */
  467. u32 configurable_route_table:1; /* byte 10 */
  468. u32 configuring:1;
  469. u32 configures_others:1;
  470. u32 open_reject_retry_supported:1;
  471. u32 stp_continue_awt:1;
  472. u32 self_configuring:1;
  473. u32 zone_configuring:1;
  474. u32 table_to_table_supported:1;
  475. u32 reserved_byte11:8; /* byte 11 */
  476. u32 enclosure_logical_identifier_high; /* byte 12-15 */
  477. u32 enclosure_logical_identifier_low; /* byte 16-19 */
  478. u32 reserved_byte20_23;
  479. u32 reserved_byte24_27;
  480. };
  481. struct smp_response_report_general_long {
  482. struct smp_response_report_general sas1_1;
  483. struct {
  484. u16 reserved1;
  485. u16 stp_bus_inactivity_time_limit;
  486. u16 stp_max_connect_time_limit;
  487. u16 stp_smp_i_t_nexus_loss_time;
  488. u32 zoning_enabled:1;
  489. u32 zoning_supported:1;
  490. u32 physicaL_presence_asserted:1;
  491. u32 zone_locked:1;
  492. u32 reserved2:1;
  493. u32 num_zone_groups:3;
  494. u32 saving_zoning_enabled_supported:3;
  495. u32 saving_zone_perms_table_supported:1;
  496. u32 saving_zone_phy_info_supported:1;
  497. u32 saving_zone_manager_password_supported:1;
  498. u32 saving:1;
  499. u32 reserved3:1;
  500. u32 max_number_routed_sas_addresses:16;
  501. struct sci_sas_address active_zone_manager_sas_address;
  502. u16 zone_lock_inactivity_time_limit;
  503. u16 reserved4;
  504. u8 reserved5;
  505. u8 first_enclosure_connector_element_index;
  506. u8 number_of_enclosure_connector_element_indices;
  507. u8 reserved6;
  508. u32 reserved7:7;
  509. u32 reduced_functionality:1;
  510. u32 time_to_reduce_functionality:8;
  511. u32 initial_time_to_reduce_functionality:8;
  512. u8 max_reduced_functionality_time;
  513. u16 last_self_config_status_descriptor_index;
  514. u16 max_number_of_stored_self_config_status_descriptors;
  515. u16 last_phy_event_list_descriptor_index;
  516. u16 max_number_of_stored_phy_event_list_descriptors;
  517. } sas2;
  518. };
  519. /**
  520. * struct smp_response_report_manufacturer_information - This structure depicts
  521. * the SMP report manufacturer information for expander devices. It adheres
  522. * to the SAS-2.1 specification.
  523. *
  524. * For specific information on each of these individual fields please reference
  525. * the SAS specification Application layer section on SMP.
  526. */
  527. struct smp_response_report_manufacturer_information {
  528. u32 expander_change_count:16; /* bytes 4-5 */
  529. u32 reserved1:16;
  530. u32 sas1_1_format:1;
  531. u32 reserved2:31;
  532. u8 vendor_id[8];
  533. u8 product_id[16];
  534. u8 product_revision_level[4];
  535. u8 component_vendor_id[8];
  536. u8 component_id[2];
  537. u8 component_revision_level;
  538. u8 reserved3;
  539. u8 vendor_specific[8];
  540. };
  541. #define SMP_RESPONSE_DISCOVER_FORMAT_1_1_SIZE 52
  542. #define SMP_RESPONSE_DISCOVER_FORMAT_2_SIZE 116
  543. /**
  544. * struct smp_discover_response_protocols - This structure depicts the discover
  545. * response where the supported protocols by the remote phy are specified.
  546. *
  547. * For specific information on each of these individual fields please reference
  548. * the SAS specification Link layer section on address frames.
  549. */
  550. struct smp_discover_response_protocols {
  551. union {
  552. struct {
  553. u16 attached_sata_host:1;
  554. u16 attached_smp_initiator:1;
  555. u16 attached_stp_initiator:1;
  556. u16 attached_ssp_initiator:1;
  557. u16 reserved3:4;
  558. u16 attached_sata_device:1;
  559. u16 attached_smp_target:1;
  560. u16 attached_stp_target:1;
  561. u16 attached_ssp_target:1;
  562. u16 reserved4:3;
  563. u16 attached_sata_port_selector:1;
  564. } bits;
  565. u16 all;
  566. } u;
  567. };
  568. /**
  569. * struct SMP_RESPONSE_DISCOVER_FORMAT - This structure defines the SMP phy
  570. * discover response format. It handles both SAS1.1 and SAS 2 definitions.
  571. * The unions indicate locations where the SAS specification versions differ
  572. * from one another.
  573. *
  574. *
  575. */
  576. struct smp_response_discover {
  577. union {
  578. struct {
  579. u8 reserved[2];
  580. } sas1_1;
  581. struct {
  582. u16 expander_change_count;
  583. } sas2;
  584. } u1;
  585. u8 reserved1[3];
  586. u8 phy_identifier;
  587. u8 reserved2[2];
  588. union {
  589. struct {
  590. u16 reserved1:4;
  591. u16 attached_device_type:3;
  592. u16 reserved2:1;
  593. u16 negotiated_physical_link_rate:4;
  594. u16 reserved3:4;
  595. } sas1_1;
  596. struct {
  597. u16 attached_reason:4;
  598. u16 attached_device_type:3;
  599. u16 reserved2:1;
  600. u16 negotiated_logical_link_rate:4;
  601. u16 reserved3:4;
  602. } sas2;
  603. } u2;
  604. struct smp_discover_response_protocols protocols;
  605. struct sci_sas_address sas_address;
  606. struct sci_sas_address attached_sas_address;
  607. u8 attached_phy_identifier;
  608. union {
  609. struct {
  610. u8 reserved;
  611. } sas1_1;
  612. struct {
  613. u8 attached_break_reply_capable:1;
  614. u8 attached_requested_inside_zpsds:1;
  615. u8 attached_inside_zpsds_persistent:1;
  616. u8 reserved1:5;
  617. } sas2;
  618. } u3;
  619. u8 reserved_for_identify[6];
  620. u32 hardware_min_physical_link_rate:4;
  621. u32 programmed_min_physical_link_rate:4;
  622. u32 hardware_max_physical_link_rate:4;
  623. u32 programmed_max_physical_link_rate:4;
  624. u32 phy_change_count:8;
  625. u32 partial_pathway_timeout_value:4;
  626. u32 reserved5:3;
  627. u32 virtual_phy:1;
  628. u32 routing_attribute:4;
  629. u32 reserved6:4;
  630. u32 connector_type:7;
  631. u32 reserved7:1;
  632. u32 connector_element_index:8;
  633. u32 connector_physical_link:8;
  634. u16 reserved8;
  635. u16 vendor_specific;
  636. union {
  637. struct {
  638. /**
  639. * In the SAS 1.1 specification this structure ends after 52 bytes.
  640. * As a result, the contents of this field should never have a
  641. * real value. It is undefined.
  642. */
  643. u8 undefined[SMP_RESPONSE_DISCOVER_FORMAT_2_SIZE
  644. - SMP_RESPONSE_DISCOVER_FORMAT_1_1_SIZE];
  645. } sas1_1;
  646. struct {
  647. struct sci_sas_address attached_device_name;
  648. u32 zoning_enabled:1;
  649. u32 inside_zpsds:1;
  650. u32 zone_group_persistent:1;
  651. u32 reserved1:1;
  652. u32 requested_inside_zpsds:1;
  653. u32 inside_zpsds_persistent:1;
  654. u32 requested_inside_zpsds_changed_by_expander:1;
  655. u32 reserved2:1;
  656. u32 reserved_for_zoning_fields:16;
  657. u32 zone_group:8;
  658. u8 self_configuration_status;
  659. u8 self_configuration_levels_completed;
  660. u16 reserved_for_self_config_fields;
  661. struct sci_sas_address self_configuration_sas_address;
  662. u32 programmed_phy_capabilities;
  663. u32 current_phy_capabilities;
  664. u32 attached_phy_capabilities;
  665. u32 reserved3;
  666. u32 reserved4:16;
  667. u32 negotiated_physical_link_rate:4;
  668. u32 reason:4;
  669. u32 hardware_muxing_supported:1;
  670. u32 negotiated_ssc:1;
  671. u32 reserved5:6;
  672. u32 default_zoning_enabled:1;
  673. u32 reserved6:1;
  674. u32 default_zone_group_persistent:1;
  675. u32 reserved7:1;
  676. u32 default_requested_inside_zpsds:1;
  677. u32 default_inside_zpsds_persistent:1;
  678. u32 reserved8:2;
  679. u32 reserved9:16;
  680. u32 default_zone_group:8;
  681. u32 saved_zoning_enabled:1;
  682. u32 reserved10:1;
  683. u32 saved_zone_group_persistent:1;
  684. u32 reserved11:1;
  685. u32 saved_requested_inside_zpsds:1;
  686. u32 saved_inside_zpsds_persistent:1;
  687. u32 reserved12:18;
  688. u32 saved_zone_group:8;
  689. u32 reserved14:2;
  690. u32 shadow_zone_group_persistent:1;
  691. u32 reserved15:1;
  692. u32 shadow_requested_inside_zpsds:1;
  693. u32 shadow_inside_zpsds_persistent:1;
  694. u32 reserved16:18;
  695. u32 shadow_zone_group:8;
  696. u8 device_slot_number;
  697. u8 device_slot_group_number;
  698. u8 device_slot_group_output_connector[6];
  699. } sas2;
  700. } u4;
  701. };
  702. /**
  703. * struct smp_response_report_phy_sata - This structure depicts the contents of
  704. * the SAS SMP REPORT PHY SATA frame. For specific information on each of
  705. * these individual fields please reference the SAS specification Link layer
  706. * section on address frames.
  707. *
  708. *
  709. */
  710. struct smp_response_report_phy_sata {
  711. u32 ignored_byte_4_7; /* bytes 4-7 */
  712. u32 affiliations_valid:1;
  713. u32 affiliations_supported:1;
  714. u32 reserved_byte11:6; /* byte 11 */
  715. u32 ignored_byte10:8; /* byte 10 */
  716. u32 phy_identifier:8; /* byte 9 */
  717. u32 reserved_byte_8:8; /* byte 8 */
  718. u32 reserved_12_15;
  719. u32 stp_sas_address[2];
  720. u8 device_to_host_fis[20];
  721. u32 reserved_44_47;
  722. u32 affiliated_stp_initiator_sas_address[2];
  723. };
  724. struct smp_response_vendor_specific {
  725. u8 response_bytes[SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH];
  726. };
  727. union smp_response_body {
  728. struct smp_response_report_general report_general;
  729. struct smp_response_report_manufacturer_information report_manufacturer_information;
  730. struct smp_response_discover discover;
  731. struct smp_response_report_phy_sata report_phy_sata;
  732. struct smp_response_vendor_specific vendor_specific_response;
  733. };
  734. /**
  735. * struct smp_response - This structure simply unionizes the existing response
  736. * structures into a common response type.
  737. *
  738. *
  739. */
  740. struct smp_response {
  741. struct smp_response_header header;
  742. union smp_response_body response;
  743. };
  744. /* SMP Request Functions */
  745. #define SMP_FUNCTION_REPORT_GENERAL 0x00
  746. #define SMP_FUNCTION_REPORT_MANUFACTURER_INFORMATION 0x01
  747. #define SMP_FUNCTION_DISCOVER 0x10
  748. #define SMP_FUNCTION_REPORT_PHY_ERROR_LOG 0x11
  749. #define SMP_FUNCTION_REPORT_PHY_SATA 0x12
  750. #define SMP_FUNCTION_REPORT_ROUTE_INFORMATION 0X13
  751. #define SMP_FUNCTION_CONFIGURE_ROUTE_INFORMATION 0X90
  752. #define SMP_FUNCTION_PHY_CONTROL 0x91
  753. #define SMP_FUNCTION_PHY_TEST 0x92
  754. #define SMP_FRAME_TYPE_REQUEST 0x40
  755. #define SMP_FRAME_TYPE_RESPONSE 0x41
  756. #define PHY_OPERATION_NOP 0x00
  757. #define PHY_OPERATION_LINK_RESET 0x01
  758. #define PHY_OPERATION_HARD_RESET 0x02
  759. #define PHY_OPERATION_DISABLE 0x03
  760. #define PHY_OPERATION_CLEAR_ERROR_LOG 0x05
  761. #define PHY_OPERATION_CLEAR_AFFILIATION 0x06
  762. #define NPLR_PHY_ENABLED_UNK_LINK_RATE 0x00
  763. #define NPLR_PHY_DISABLED 0x01
  764. #define NPLR_PHY_ENABLED_SPD_NEG_FAILED 0x02
  765. #define NPLR_PHY_ENABLED_SATA_HOLD 0x03
  766. #define NPLR_PHY_ENABLED_1_5G 0x08
  767. #define NPLR_PHY_ENABLED_3_0G 0x09
  768. /* SMP Function Result values. */
  769. #define SMP_RESULT_FUNCTION_ACCEPTED 0x00
  770. #define SMP_RESULT_UNKNOWN_FUNCTION 0x01
  771. #define SMP_RESULT_FUNCTION_FAILED 0x02
  772. #define SMP_RESULT_INVALID_REQUEST_FRAME_LEN 0x03
  773. #define SMP_RESULT_INAVALID_EXPANDER_CHANGE_COUNT 0x04
  774. #define SMP_RESULT_BUSY 0x05
  775. #define SMP_RESULT_INCOMPLETE_DESCRIPTOR_LIST 0x06
  776. #define SMP_RESULT_PHY_DOES_NOT_EXIST 0x10
  777. #define SMP_RESULT_INDEX_DOES_NOT_EXIST 0x11
  778. #define SMP_RESULT_PHY_DOES_NOT_SUPPORT_SATA 0x12
  779. #define SMP_RESULT_UNKNOWN_PHY_OPERATION 0x13
  780. #define SMP_RESULT_UNKNOWN_PHY_TEST_FUNCTION 0x14
  781. #define SMP_RESULT_PHY_TEST_IN_PROGRESS 0x15
  782. #define SMP_RESULT_PHY_VACANT 0x16
  783. /* Attached Device Types */
  784. #define SMP_NO_DEVICE_ATTACHED 0
  785. #define SMP_END_DEVICE_ONLY 1
  786. #define SMP_EDGE_EXPANDER_DEVICE 2
  787. #define SMP_FANOUT_EXPANDER_DEVICE 3
  788. /* Expander phy routine attribute */
  789. #define DIRECT_ROUTING_ATTRIBUTE 0
  790. #define SUBTRACTIVE_ROUTING_ATTRIBUTE 1
  791. #define TABLE_ROUTING_ATTRIBUTE 2
  792. #endif /* _INTEL_SAS_H_ */