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.
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
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.
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.
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.
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
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
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.
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.
60 * This file contains all of the definitions relating to structures, constants,
61 * etc. defined by the SAS specification.
65 #include <linux/kernel.h>
66 #include "intel_scsi.h"
69 * struct sci_sas_address - This structure depicts how a SAS address is
74 struct sci_sas_address {
76 * This member contains the higher 32-bits of the SAS address.
81 * This member contains the lower 32-bits of the SAS address.
88 * struct sci_sas_identify_address_frame_protocols - This structure depicts the
89 * contents of bytes 2 and 3 in the SAS IDENTIFY ADDRESS FRAME (IAF).
91 * For specific information on each of these individual fields please reference
92 * the SAS specification Link layer section on address frames.
94 struct sci_sas_identify_address_frame_protocols {
115 * enum _SCI_SAS_TASK_ATTRIBUTE - This enumeration depicts the SAM/SAS
116 * specification defined task attribute values for a command information
121 enum sci_sas_task_attribute {
122 SCI_SAS_SIMPLE_ATTRIBUTE = 0,
123 SCI_SAS_HEAD_OF_QUEUE_ATTRIBUTE = 1,
124 SCI_SAS_ORDERED_ATTRIBUTE = 2,
125 SCI_SAS_ACA_ATTRIBUTE = 4,
129 * enum _SCI_SAS_TASK_MGMT_FUNCTION - This enumeration depicts the SAM/SAS
130 * specification defined task management functions.
132 * This HARD_RESET function listed here is not actually defined as a task
133 * management function in the industry standard.
135 enum sci_sas_task_mgmt_function {
136 SCI_SAS_ABORT_TASK = SCSI_TASK_REQUEST_ABORT_TASK,
137 SCI_SAS_ABORT_TASK_SET = SCSI_TASK_REQUEST_ABORT_TASK_SET,
138 SCI_SAS_CLEAR_TASK_SET = SCSI_TASK_REQUEST_CLEAR_TASK_SET,
139 SCI_SAS_LOGICAL_UNIT_RESET = SCSI_TASK_REQUEST_LOGICAL_UNIT_RESET,
140 SCI_SAS_I_T_NEXUS_RESET = SCSI_TASK_REQUEST_I_T_NEXUS_RESET,
141 SCI_SAS_CLEAR_ACA = SCSI_TASK_REQUEST_CLEAR_ACA,
142 SCI_SAS_QUERY_TASK = SCSI_TASK_REQUEST_QUERY_TASK,
143 SCI_SAS_QUERY_TASK_SET = SCSI_TASK_REQUEST_QUERY_TASK_SET,
144 SCI_SAS_QUERY_ASYNCHRONOUS_EVENT = SCSI_TASK_REQUEST_QUERY_UNIT_ATTENTION,
145 SCI_SAS_HARD_RESET = 0xFF
150 * enum _SCI_SAS_FRAME_TYPE - This enumeration depicts the SAS specification
151 * defined SSP frame types.
155 enum sci_sas_frame_type {
156 SCI_SAS_DATA_FRAME = 0x01,
157 SCI_SAS_XFER_RDY_FRAME = 0x05,
158 SCI_SAS_COMMAND_FRAME = 0x06,
159 SCI_SAS_RESPONSE_FRAME = 0x07,
160 SCI_SAS_TASK_FRAME = 0x16
164 * struct sci_ssp_frame_header - This structure depicts the contents of an SSP
165 * frame header. For specific information on the individual fields please
166 * reference the SAS specification transport layer SSP frame format.
170 struct sci_ssp_frame_header {
172 u32 hashed_destination_address:24;
176 u32 hashed_source_address:24;
184 u32 retry_data_frames:1;
186 u32 changing_data_pointer:1;
193 u16 target_port_transfer_tag;
202 * struct smp_response_header - This structure depicts the contents of the SAS
203 * SMP DISCOVER RESPONSE frame. For specific information on each of these
204 * individual fields please reference the SAS specification Link layer
205 * section on address frames.
209 struct smp_response_header {
210 u8 smp_frame_type; /* byte 0 */
211 u8 function; /* byte 1 */
212 u8 function_result; /* byte 2 */
213 u8 response_length; /* byte 3 */
218 * struct smp_response_report_general - This structure depicts the SMP Report
219 * General for expander devices. It adheres to the SAS-2.1 specification.
221 * For specific information on each of these individual fields please reference
222 * the SAS specification Application layer section on SMP.
224 struct smp_response_report_general {
225 u16 expander_change_count; /* byte 4-5 */
226 u16 expander_route_indexes; /* byte 6-7 */
228 u32 reserved_byte8:7; /* byte 8 bit 0-6 */
229 u32 long_response:1; /* byte 8 bit 7 */
231 u32 number_of_phys:8; /* byte 9 */
233 u32 configurable_route_table:1; /* byte 10 */
235 u32 configures_others:1;
236 u32 open_reject_retry_supported:1;
237 u32 stp_continue_awt:1;
238 u32 self_configuring:1;
239 u32 zone_configuring:1;
240 u32 table_to_table_supported:1;
242 u32 reserved_byte11:8; /* byte 11 */
244 u32 enclosure_logical_identifier_high; /* byte 12-15 */
245 u32 enclosure_logical_identifier_low; /* byte 16-19 */
247 u32 reserved_byte20_23;
248 u32 reserved_byte24_27;
252 struct smp_response_report_general_long {
253 struct smp_response_report_general sas1_1;
257 u16 stp_bus_inactivity_time_limit;
258 u16 stp_max_connect_time_limit;
259 u16 stp_smp_i_t_nexus_loss_time;
261 u32 zoning_enabled:1;
262 u32 zoning_supported:1;
263 u32 physicaL_presence_asserted:1;
266 u32 num_zone_groups:3;
267 u32 saving_zoning_enabled_supported:3;
268 u32 saving_zone_perms_table_supported:1;
269 u32 saving_zone_phy_info_supported:1;
270 u32 saving_zone_manager_password_supported:1;
273 u32 max_number_routed_sas_addresses:16;
275 struct sci_sas_address active_zone_manager_sas_address;
277 u16 zone_lock_inactivity_time_limit;
281 u8 first_enclosure_connector_element_index;
282 u8 number_of_enclosure_connector_element_indices;
286 u32 reduced_functionality:1;
287 u32 time_to_reduce_functionality:8;
288 u32 initial_time_to_reduce_functionality:8;
289 u8 max_reduced_functionality_time;
291 u16 last_self_config_status_descriptor_index;
292 u16 max_number_of_stored_self_config_status_descriptors;
294 u16 last_phy_event_list_descriptor_index;
295 u16 max_number_of_stored_phy_event_list_descriptors;
301 * struct smp_response_report_manufacturer_information - This structure depicts
302 * the SMP report manufacturer information for expander devices. It adheres
303 * to the SAS-2.1 specification.
305 * For specific information on each of these individual fields please reference
306 * the SAS specification Application layer section on SMP.
308 struct smp_response_report_manufacturer_information {
309 u32 expander_change_count:16; /* bytes 4-5 */
317 u8 product_revision_level[4];
318 u8 component_vendor_id[8];
320 u8 component_revision_level;
322 u8 vendor_specific[8];
327 * struct smp_response_report_phy_sata - This structure depicts the contents of
328 * the SAS SMP REPORT PHY SATA frame. For specific information on each of
329 * these individual fields please reference the SAS specification Link layer
330 * section on address frames.
334 struct smp_response_report_phy_sata {
335 u32 ignored_byte_4_7; /* bytes 4-7 */
337 u32 affiliations_valid:1;
338 u32 affiliations_supported:1;
339 u32 reserved_byte11:6; /* byte 11 */
340 u32 ignored_byte10:8; /* byte 10 */
341 u32 phy_identifier:8; /* byte 9 */
342 u32 reserved_byte_8:8; /* byte 8 */
345 u32 stp_sas_address[2];
346 u8 device_to_host_fis[20];
348 u32 affiliated_stp_initiator_sas_address[2];
352 #define SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH 1016
353 struct smp_response_vendor_specific {
354 u8 response_bytes[SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH];
357 union smp_response_body {
358 struct smp_response_report_general report_general;
359 struct smp_response_report_manufacturer_information report_manufacturer_information;
360 struct smp_response_report_phy_sata report_phy_sata;
361 struct smp_response_vendor_specific vendor_specific_response;
365 * struct smp_response - This structure simply unionizes the existing response
366 * structures into a common response type.
370 struct smp_response {
371 struct smp_response_header header;
373 union smp_response_body response;
377 #define SMP_FRAME_TYPE_REQUEST 0x40
378 #define SMP_FRAME_TYPE_RESPONSE 0x41
380 #define PHY_OPERATION_NOP 0x00
381 #define PHY_OPERATION_LINK_RESET 0x01
382 #define PHY_OPERATION_HARD_RESET 0x02
383 #define PHY_OPERATION_DISABLE 0x03
384 #define PHY_OPERATION_CLEAR_ERROR_LOG 0x05
385 #define PHY_OPERATION_CLEAR_AFFILIATION 0x06
387 #define NPLR_PHY_ENABLED_UNK_LINK_RATE 0x00
388 #define NPLR_PHY_DISABLED 0x01
389 #define NPLR_PHY_ENABLED_SPD_NEG_FAILED 0x02
390 #define NPLR_PHY_ENABLED_SATA_HOLD 0x03
391 #define NPLR_PHY_ENABLED_1_5G 0x08
392 #define NPLR_PHY_ENABLED_3_0G 0x09
394 /* SMP Function Result values. */
395 #define SMP_RESULT_FUNCTION_ACCEPTED 0x00
396 #define SMP_RESULT_UNKNOWN_FUNCTION 0x01
397 #define SMP_RESULT_FUNCTION_FAILED 0x02
398 #define SMP_RESULT_INVALID_REQUEST_FRAME_LEN 0x03
399 #define SMP_RESULT_INAVALID_EXPANDER_CHANGE_COUNT 0x04
400 #define SMP_RESULT_BUSY 0x05
401 #define SMP_RESULT_INCOMPLETE_DESCRIPTOR_LIST 0x06
402 #define SMP_RESULT_PHY_DOES_NOT_EXIST 0x10
403 #define SMP_RESULT_INDEX_DOES_NOT_EXIST 0x11
404 #define SMP_RESULT_PHY_DOES_NOT_SUPPORT_SATA 0x12
405 #define SMP_RESULT_UNKNOWN_PHY_OPERATION 0x13
406 #define SMP_RESULT_UNKNOWN_PHY_TEST_FUNCTION 0x14
407 #define SMP_RESULT_PHY_TEST_IN_PROGRESS 0x15
408 #define SMP_RESULT_PHY_VACANT 0x16
410 /* Attached Device Types */
411 #define SMP_NO_DEVICE_ATTACHED 0
412 #define SMP_END_DEVICE_ONLY 1
413 #define SMP_EDGE_EXPANDER_DEVICE 2
414 #define SMP_FANOUT_EXPANDER_DEVICE 3
416 /* Expander phy routine attribute */
417 #define DIRECT_ROUTING_ATTRIBUTE 0
418 #define SUBTRACTIVE_ROUTING_ATTRIBUTE 1
419 #define TABLE_ROUTING_ATTRIBUTE 2
421 #endif /* _INTEL_SAS_H_ */