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