1118611Snjl/*-
2118611Snjl * This file is provided under a dual BSD/GPLv2 license.  When using or
3118611Snjl * redistributing this file, you may do so under either license.
4151937Sjkim *
5118611Snjl * GPL LICENSE SUMMARY
6118611Snjl *
7118611Snjl * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8118611Snjl *
9118611Snjl * This program is free software; you can redistribute it and/or modify
10118611Snjl * it under the terms of version 2 of the GNU General Public License as
11118611Snjl * published by the Free Software Foundation.
12202771Sjkim *
13118611Snjl * This program is distributed in the hope that it will be useful, but
14118611Snjl * WITHOUT ANY WARRANTY; without even the implied warranty of
15118611Snjl * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16118611Snjl * General Public License for more details.
17118611Snjl *
18118611Snjl * You should have received a copy of the GNU General Public License
19118611Snjl * along with this program; if not, write to the Free Software
20118611Snjl * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21118611Snjl * The full GNU General Public License is included in this distribution
22118611Snjl * in the file called LICENSE.GPL.
23118611Snjl *
24118611Snjl * BSD LICENSE
25118611Snjl *
26118611Snjl * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
27118611Snjl * All rights reserved.
28118611Snjl *
29118611Snjl * Redistribution and use in source and binary forms, with or without
30118611Snjl * modification, are permitted provided that the following conditions
31118611Snjl * are met:
32118611Snjl *
33118611Snjl *   * Redistributions of source code must retain the above copyright
34118611Snjl *     notice, this list of conditions and the following disclaimer.
35118611Snjl *   * Redistributions in binary form must reproduce the above copyright
36118611Snjl *     notice, this list of conditions and the following disclaimer in
37118611Snjl *     the documentation and/or other materials provided with the
38118611Snjl *     distribution.
39118611Snjl *
40118611Snjl * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41118611Snjl * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42118611Snjl * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43118611Snjl * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44118611Snjl * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45118611Snjl * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46118611Snjl * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47118611Snjl * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48118611Snjl * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49118611Snjl * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50118611Snjl * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51118611Snjl *
52118611Snjl * $FreeBSD$
53118611Snjl */
54118611Snjl#ifndef _INTEL_SAS_H_
55118611Snjl#define _INTEL_SAS_H_
56118611Snjl
57118611Snjl/**
58118611Snjl * @file
59118611Snjl *
60118611Snjl * @brief This file contains all of the definitions relating to structures,
61118611Snjl *        constants, etc. defined by the SAS specification.
62118611Snjl */
63118611Snjl
64118611Snjl#include <dev/isci/types.h>
65118611Snjl#include <dev/isci/scil/intel_sata.h>
66118611Snjl#include <dev/isci/scil/intel_scsi.h>
67118611Snjl
68118611Snjl/**
69118611Snjl * @struct SCI_SAS_ADDRESS
70118611Snjl * @brief  This structure depicts how a SAS address is represented by SCI.
71118611Snjl */
72118611Snjltypedef struct SCI_SAS_ADDRESS
73118611Snjl{
74118611Snjl   /**
75118611Snjl    * This member contains the higher 32-bits of the SAS address.
76118611Snjl    */
77118611Snjl   U32 high;
78118611Snjl
79118611Snjl   /**
80118611Snjl    * This member contains the lower 32-bits of the SAS address.
81118611Snjl    */
82118611Snjl   U32 low;
83118611Snjl
84118611Snjl} SCI_SAS_ADDRESS_T;
85118611Snjl
86118611Snjl/**
87118611Snjl * @struct SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS
88118611Snjl * @brief  This structure depicts the contents of bytes 2 and 3 in the
89118611Snjl *         SAS IDENTIFY ADDRESS FRAME (IAF).
90118611Snjl *         @note For specific information on each of these
91118611Snjl *               individual fields please reference the SAS specification
92118611Snjl *               Link layer section on address frames.
93118611Snjl */
94118611Snjltypedef struct SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS
95118611Snjl{
96118611Snjl   union
97118611Snjl   {
98118611Snjl      struct
99118611Snjl      {
100118611Snjl         U16  restricted1        : 1;
101118611Snjl         U16  smp_initiator      : 1;
102118611Snjl         U16  stp_initiator      : 1;
103118611Snjl         U16  ssp_initiator      : 1;
104118611Snjl         U16  reserved3          : 4;
105118611Snjl         U16  restricted2        : 1;
106118611Snjl         U16  smp_target         : 1;
107118611Snjl         U16  stp_target         : 1;
108118611Snjl         U16  ssp_target         : 1;
109118611Snjl         U16  reserved4          : 4;
110118611Snjl      } bits;
111118611Snjl
112118611Snjl      U16 all;
113118611Snjl   } u;
114118611Snjl
115118611Snjl} SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS_T;
116118611Snjl
117118611Snjl/**
118118611Snjl * @struct SCI_SAS_IDENTIFY_ADDRESS_FRAME
119118611Snjl * @brief  This structure depicts the contents of the SAS IDENTIFY ADDRESS
120118611Snjl *         FRAME (IAF).
121118611Snjl *         @note For specific information on each of these
122118611Snjl *               individual fields please reference the SAS specification
123118611Snjl *               Link layer section on address frames.
124118611Snjl */
125118611Snjltypedef struct SCI_SAS_IDENTIFY_ADDRESS_FRAME
126118611Snjl{
127118611Snjl   U16  address_frame_type : 4;
128118611Snjl   U16  device_type        : 3;
129118611Snjl   U16  reserved1          : 1;
130118611Snjl   U16  reason             : 4;
131118611Snjl   U16  reserved2          : 4;
132118611Snjl
133118611Snjl   SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS_T protocols;
134118611Snjl
135118611Snjl   SCI_SAS_ADDRESS_T  device_name;
136118611Snjl   SCI_SAS_ADDRESS_T  sas_address;
137118611Snjl
138118611Snjl   U32  phy_identifier      : 8;
139118611Snjl   U32  break_reply_capable : 1;
140118611Snjl   U32  requested_in_zpsds  : 1;
141193529Sjkim   U32  in_zpsds_persistent : 1;
142193529Sjkim   U32  reserved5           : 21;
143193529Sjkim
144193529Sjkim   U32  reserved6[4];
145118611Snjl
146151937Sjkim} SCI_SAS_IDENTIFY_ADDRESS_FRAME_T;
147118611Snjl
148151937Sjkim/**
149151937Sjkim * @struct SAS_CAPABILITIES
150151937Sjkim * @brief  This structure depicts the various SAS capabilities supported
151118611Snjl *         by the directly attached target device.  For specific information
152118611Snjl *         on each of these individual fields please reference the SAS
153118611Snjl *         specification Phy layer section on speed negotiation windows.
154118611Snjl */
155118611Snjltypedef struct SAS_CAPABILITIES
156118611Snjl{
157118611Snjl   union
158118611Snjl   {
159151937Sjkim#if defined (SCIC_SDS_4_ENABLED)
160151937Sjkim      struct
161151937Sjkim      {
162118611Snjl         /**
163118611Snjl          * The SAS specification indicates the start bit shall always be set to
164118611Snjl          * 1.  This implementation will have the start bit set to 0 if the
165118611Snjl          * PHY CAPABILITIES were either not received or speed negotiation failed.
166118611Snjl          */
167118611Snjl         U32  start                       : 1;
168118611Snjl         U32  tx_ssc_type                 : 1;
169118611Snjl         U32  reserved1                   : 2;
170118611Snjl         U32  requested_logical_link_rate : 4;
171118611Snjl
172118611Snjl         U32  gen1_without_ssc_supported  : 1;
173118611Snjl         U32  gen1_with_ssc_supported     : 1;
174118611Snjl         U32  gen2_without_ssc_supported  : 1;
175118611Snjl         U32  gen2_with_ssc_supported     : 1;
176118611Snjl         U32  gen3_without_ssc_supported  : 1;
177118611Snjl         U32  gen3_with_ssc_supported     : 1;
178118611Snjl         U32  reserved2                   : 17;
179118611Snjl         U32  parity                      : 1;
180118611Snjl      } bits;
181118611Snjl#endif // (SCIC_SDS_4_ENABLED)
182118611Snjl
183118611Snjl      U32 all;
184118611Snjl   } u;
185118611Snjl
186118611Snjl} SAS_CAPABILITIES_T;
187118611Snjl
188118611Snjl/**
189118611Snjl * @enum  _SCI_SAS_LINK_RATE
190118611Snjl * @brief This enumeration depicts the SAS specification defined link speeds.
191193529Sjkim */
192209746Sjkimtypedef enum _SCI_SAS_LINK_RATE
193193529Sjkim{
194209746Sjkim   SCI_SAS_NO_LINK_RATE = 0,
195209746Sjkim   SCI_SATA_SPINUP_HOLD = 0x3,
196209746Sjkim   SCI_SAS_150_GB = 0x8,
197209746Sjkim   SCI_SAS_300_GB = 0x9,
198210976Sjkim   SCI_SAS_600_GB = 0xA
199210976Sjkim} SCI_SAS_LINK_RATE;
200210976Sjkim
201210976Sjkim/**
202193529Sjkim * @enum  _SCI_SAS_TASK_ATTRIBUTE
203193529Sjkim * @brief This enumeration depicts the SAM/SAS specification defined task
204210976Sjkim *        attribute values for a command information unit.
205210976Sjkim */
206118611Snjltypedef enum _SCI_SAS_TASK_ATTRIBUTE
207193529Sjkim{
208193529Sjkim   SCI_SAS_SIMPLE_ATTRIBUTE = 0,
209193529Sjkim   SCI_SAS_HEAD_OF_QUEUE_ATTRIBUTE = 1,
210193529Sjkim   SCI_SAS_ORDERED_ATTRIBUTE = 2,
211151937Sjkim   SCI_SAS_ACA_ATTRIBUTE = 4,
212151937Sjkim} SCI_SAS_TASK_ATTRIBUTE;
213151937Sjkim
214118611Snjl/**
215118611Snjl * @enum  _SCI_SAS_TASK_MGMT_FUNCTION
216118611Snjl * @brief This enumeration depicts the SAM/SAS specification defined task
217118611Snjl *        management functions.
218118611Snjl *        @note This HARD_RESET function listed here is not actually defined
219118611Snjl *              as a task management function in the industry standard.
220118611Snjl */
221118611Snjltypedef enum _SCI_SAS_TASK_MGMT_FUNCTION
222151937Sjkim{
223151937Sjkim   SCI_SAS_ABORT_TASK = SCSI_TASK_REQUEST_ABORT_TASK,
224151937Sjkim   SCI_SAS_ABORT_TASK_SET = SCSI_TASK_REQUEST_ABORT_TASK_SET,
225151937Sjkim   SCI_SAS_CLEAR_TASK_SET = SCSI_TASK_REQUEST_CLEAR_TASK_SET,
226118611Snjl   SCI_SAS_LOGICAL_UNIT_RESET = SCSI_TASK_REQUEST_LOGICAL_UNIT_RESET,
227151937Sjkim   SCI_SAS_I_T_NEXUS_RESET = SCSI_TASK_REQUEST_I_T_NEXUS_RESET,
228151937Sjkim   SCI_SAS_CLEAR_ACA = SCSI_TASK_REQUEST_CLEAR_ACA,
229118611Snjl   SCI_SAS_QUERY_TASK = SCSI_TASK_REQUEST_QUERY_TASK,
230151937Sjkim   SCI_SAS_QUERY_TASK_SET = SCSI_TASK_REQUEST_QUERY_TASK_SET,
231151937Sjkim   SCI_SAS_QUERY_ASYNCHRONOUS_EVENT = SCSI_TASK_REQUEST_QUERY_UNIT_ATTENTION,
232151937Sjkim   SCI_SAS_HARD_RESET = 0xFF
233118611Snjl} SCI_SAS_TASK_MGMT_FUNCTION_T;
234209746Sjkim
235209746Sjkim
236209746Sjkim/**
237118611Snjl * @enum  _SCI_SAS_FRAME_TYPE
238209746Sjkim * @brief This enumeration depicts the SAS specification defined SSP frame
239151937Sjkim *        types.
240151937Sjkim */
241151937Sjkimtypedef enum _SCI_SAS_FRAME_TYPE
242151937Sjkim{
243151937Sjkim   SCI_SAS_DATA_FRAME = 0x01,
244151937Sjkim   SCI_SAS_XFER_RDY_FRAME = 0x05,
245151937Sjkim   SCI_SAS_COMMAND_FRAME = 0x06,
246151937Sjkim   SCI_SAS_RESPONSE_FRAME = 0x07,
247118611Snjl   SCI_SAS_TASK_FRAME = 0x16
248151937Sjkim} SCI_SAS_FRAME_TYPE_T;
249151937Sjkim
250151937Sjkim
251151937Sjkim/**
252151937Sjkim * @struct SCI_SSP_COMMAND_IU
253118611Snjl * @brief This structure depicts the contents of the SSP COMMAND
254151937Sjkim *        INFORMATION UNIT. For specific information on each of these
255151937Sjkim *        individual fields please reference the SAS specification SSP
256151937Sjkim *        transport layer section.
257151937Sjkim */
258151937Sjkimtypedef struct SCI_SSP_COMMAND_IU
259118611Snjl{
260151937Sjkim
261151937Sjkim   U32 lun[2];
262151937Sjkim
263151937Sjkim   U32 additional_cdb_length  : 6;
264151937Sjkim   U32 reserved0              : 2;
265118611Snjl   U32 reserved1              : 8;
266151937Sjkim   U32 enable_first_burst     : 1;
267151937Sjkim   U32 task_priority          : 4;
268151937Sjkim   U32 task_attribute         : 3;
269151937Sjkim   U32 reserved2              : 8;
270151937Sjkim
271118611Snjl   U32 cdb[4];
272151937Sjkim
273151937Sjkim} SCI_SSP_COMMAND_IU_T;
274151937Sjkim
275151937Sjkim/**
276151937Sjkim * @struct SCI_SSP_TASK_IU
277118611Snjl * @brief This structure depicts the contents of the SSP TASK INFORMATION
278151937Sjkim *        UNIT. For specific information on each of these individual fields
279151937Sjkim *        please reference the SAS specification SSP transport layer
280151937Sjkim *        section.
281151937Sjkim */
282151937Sjkimtypedef struct SCI_SSP_TASK_IU
283118611Snjl{
284151937Sjkim   U32 lun_upper;
285151937Sjkim   U32 lun_lower;
286151937Sjkim
287151937Sjkim   U32 reserved0     : 8;
288151937Sjkim   U32 task_function : 8;
289118611Snjl   U32 reserved1     : 8;
290151937Sjkim   U32 reserved2     : 8;
291151937Sjkim
292151937Sjkim   U32 reserved3     : 16;
293151937Sjkim   U32 task_tag      : 16;
294118611Snjl
295118611Snjl   U32 reserved4[3];
296118611Snjl
297118611Snjl} SCI_SSP_TASK_IU_T;
298118611Snjl
299118611Snjl#define SSP_RESPONSE_IU_MAX_DATA 64
300118611Snjl
301118611Snjl#define SCI_SSP_RESPONSE_IU_DATA_PRESENT_MASK   (0x03)
302118611Snjl
303118611Snjl/**
304118611Snjl * @struct SCI_SSP_RESPONSE_IU
305118611Snjl * @brief This structure depicts the contents of the SSP RESPONSE
306118611Snjl *        INFORMATION UNIT. For specific information on each of these
307118611Snjl *        individual fields please reference the SAS specification SSP
308151937Sjkim *        transport layer section.
309151937Sjkim */
310151937Sjkimtypedef struct SCI_SSP_RESPONSE_IU
311151937Sjkim{
312118611Snjl   U8  reserved0[8];
313118611Snjl
314118611Snjl   U8  retry_delay_timer[2];
315118611Snjl   U8  data_present;
316118611Snjl   U8  status;
317118611Snjl
318118611Snjl   U8  reserved1[4];
319118611Snjl   U8  sense_data_length[4];
320118611Snjl   U8  response_data_length[4];
321118611Snjl
322118611Snjl   U32 data[SSP_RESPONSE_IU_MAX_DATA];
323118611Snjl
324118611Snjl} SCI_SSP_RESPONSE_IU_T;
325118611Snjl
326118611Snjl/**
327118611Snjl * @enum  _SCI_SAS_DATA_PRESENT_TYPE
328118611Snjl * @brief This enumeration depicts the SAS specification defined SSP data present
329118611Snjl *        types in SCI_SSP_RESPONSE_IU.
330118611Snjl */
331118611Snjltypedef enum _SCI_SSP_RESPONSE_IU_DATA_PRESENT_TYPE
332118611Snjl{
333193529Sjkim   SCI_SSP_RESPONSE_IU_NO_DATA = 0x00,
334193529Sjkim   SCI_SSP_RESPONSE_IU_RESPONSE_DATA = 0x01,
335193529Sjkim   SCI_SSP_RESPONSE_IU_SENSE_DATA = 0x02
336193529Sjkim} SCI_SSP_RESPONSE_IU_DATA_PRESENT_TYPE_T;
337167802Sjkim
338118611Snjl/**
339167802Sjkim * @struct SCI_SSP_FRAME_HEADER
340118611Snjl *
341118611Snjl * @brief This structure depicts the contents of an SSP frame header.  For
342151937Sjkim *        specific information on the individual fields please reference
343151937Sjkim *        the SAS specification transport layer SSP frame format.
344151937Sjkim */
345118611Snjltypedef struct SCI_SSP_FRAME_HEADER
346151937Sjkim{
347151937Sjkim   // Word 0
348118611Snjl   U32 hashed_destination_address  :24;
349118611Snjl   U32 frame_type                  : 8;
350118611Snjl
351118611Snjl   // Word 1
352118611Snjl   U32 hashed_source_address       :24;
353118611Snjl   U32 reserved1_0                 : 8;
354118611Snjl
355118611Snjl   // Word 2
356118611Snjl   U32 reserved2_2                 : 6;
357118611Snjl   U32 fill_bytes                  : 2;
358118611Snjl   U32 reserved2_1                 : 3;
359118611Snjl   U32 tlr_control                 : 2;
360118611Snjl   U32 retry_data_frames           : 1;
361118611Snjl   U32 retransmit                  : 1;
362167802Sjkim   U32 changing_data_pointer       : 1;
363167802Sjkim   U32 reserved2_0                 :16;
364167802Sjkim
365118611Snjl   // Word 3
366151937Sjkim   U32 uiResv4;
367151937Sjkim
368151937Sjkim   // Word 4
369151937Sjkim   U16 target_port_transfer_tag;
370151937Sjkim   U16 tag;
371151937Sjkim
372151937Sjkim   // Word 5
373151937Sjkim   U32 data_offset;
374118611Snjl
375118611Snjl} SCI_SSP_FRAME_HEADER_T;
376118611Snjl
377118611Snjl/**
378118611Snjl * @struct SMP_REQUEST_HEADER
379118611Snjl * @brief  This structure defines the contents of an SMP Request header.
380118611Snjl *         @note For specific information on each of these
381118611Snjl *               individual fields please reference the SAS specification.
382118611Snjl */
383118611Snjltypedef struct SMP_REQUEST_HEADER
384118611Snjl{
385118611Snjl   U8 smp_frame_type;                // byte 0
386151937Sjkim   U8 function;                      // byte 1
387118611Snjl   U8 allocated_response_length;     // byte 2
388118611Snjl   U8 request_length;                // byte 3
389118611Snjl} SMP_REQUEST_HEADER_T;
390118611Snjl
391118611Snjl/**
392118611Snjl * @struct SMP_RESPONSE_HEADER
393118611Snjl * @brief  This structure depicts the contents of the SAS SMP DISCOVER
394118611Snjl *         RESPONSE frame.  For specific information on each of these
395118611Snjl *         individual fields please reference the SAS specification Link
396118611Snjl *         layer section on address frames.
397118611Snjl */
398118611Snjltypedef struct SMP_RESPONSE_HEADER
399118611Snjl{
400118611Snjl   U8 smp_frame_type;      // byte 0
401118611Snjl   U8 function;            // byte 1
402118611Snjl   U8 function_result;     // byte 2
403151937Sjkim   U8 response_length;     // byte 3
404118611Snjl} SMP_RESPONSE_HEADER_T;
405118611Snjl
406118611Snjl/**
407151937Sjkim * @struct SMP_REQUEST_GENERAL
408151937Sjkim * @brief  This structure defines the contents of an SMP Request that
409151937Sjkim *         is comprised of the SMP_REQUEST_HEADER and a CRC.
410151937Sjkim *         @note For specific information on each of these
411118611Snjl *               individual fields please reference the SAS specification.
412118611Snjl */
413118611Snjltypedef struct SMP_REQUEST_GENERAL
414118611Snjl{
415118611Snjl  U32 crc;            // bytes 4-7
416118611Snjl
417118611Snjl} SMP_REQUEST_GENERAL_T;
418118611Snjl
419118611Snjl/**
420118611Snjl * @struct SMP_REQUEST_PHY_IDENTIFIER
421118611Snjl * @brief  This structure defines the contents of an SMP Request that
422118611Snjl *         is comprised of the SMP_REQUEST_HEADER and a phy identifier.
423118611Snjl *         Examples: SMP_REQUEST_DISCOVER, SMP_REQUEST_REPORT_PHY_SATA.
424118611Snjl *         @note For specific information on each of these
425118611Snjl *               individual fields please reference the SAS specification.
426118611Snjl */
427118611Snjltypedef struct SMP_REQUEST_PHY_IDENTIFIER
428118611Snjl{
429118611Snjl  U32 reserved_byte4_7;      // bytes 4-7
430118611Snjl
431118611Snjl  U32 ignore_zone_group:1;    // byte 8
432118611Snjl  U32 reserved_byte8:7;
433118611Snjl
434151937Sjkim  U32 phy_identifier:8;       // byte 9
435118611Snjl  U32 reserved_byte10:8;      // byte 10
436118611Snjl  U32 reserved_byte11:8;      // byte 11
437151937Sjkim
438151937Sjkim} SMP_REQUEST_PHY_IDENTIFIER_T;
439118611Snjl
440118611Snjl/**
441151937Sjkim * @struct SMP_REQUEST_CONFIGURE_ROUTE_INFORMATION
442209746Sjkim * @brief  This structure defines the contents of an SMP Configure Route
443209746Sjkim *         Information request.
444209746Sjkim *         @note For specific information on each of these
445209746Sjkim *               individual fields please reference the SAS specification.
446209746Sjkim */
447209746Sjkimtypedef struct SMP_REQUEST_CONFIGURE_ROUTE_INFORMATION
448209746Sjkim{
449209746Sjkim  U32 expected_expander_change_count:16;    // bytes 4-5
450209746Sjkim  U32 expander_route_index_high:8;
451209746Sjkim  U32 expander_route_index:8;              // bytes 6-7
452151937Sjkim
453151937Sjkim  U32 reserved_byte8:8;           // bytes 8
454118611Snjl  U32 phy_identifier:8;           // bytes 9
455118611Snjl  U32 reserved_byte_10_11:16;     // bytes 10-11
456118611Snjl
457118611Snjl  U32 reserved_byte_12_bit_0_6:7;
458118611Snjl  U32 disable_route_entry:1;    // byte 12
459118611Snjl  U32 reserved_byte_13_15:24;   // bytes 13-15
460118611Snjl
461118611Snjl  U32 routed_sas_address[2];    // bytes 16-23
462118611Snjl  U8 reserved_byte_24_39[16];    // bytes 24-39
463118611Snjl
464118611Snjl} SMP_REQUEST_CONFIGURE_ROUTE_INFORMATION_T;
465118611Snjl
466118611Snjl/**
467151937Sjkim * @struct SMP_REQUEST_PHY_CONTROL
468151937Sjkim * @brief  This structure defines the contents of an SMP Phy Controler
469118611Snjl *         request.
470118611Snjl *         @note For specific information on each of these
471118611Snjl *               individual fields please reference the SAS specification.
472151937Sjkim */
473118611Snjltypedef struct SMP_REQUEST_PHY_CONTROL
474118611Snjl{
475118611Snjl  U16 expected_expander_change_count;   // byte 4-5
476118611Snjl
477118611Snjl  U16 reserved_byte_6_7;   // byte 6-7
478204773Sjkim  U8 reserved_byte_8;      // byte 8
479204773Sjkim
480204773Sjkim  U8 phy_identifier;       // byte 9
481204773Sjkim  U8 phy_operation;        // byte 10
482151937Sjkim
483204773Sjkim  U8 update_partial_pathway_timeout_value:1;
484204773Sjkim  U8 reserved_byte_11_bit_1_7:7;   // byte 11
485204773Sjkim
486204773Sjkim  U8 reserved_byte_12_23[12];      // byte 12-23
487206117Sjkim
488206117Sjkim  U8 attached_device_name[8];      // byte 24-31
489206117Sjkim
490206117Sjkim  U8 reserved_byte_32_bit_3_0:4;   // byte 32
491206117Sjkim  U8 programmed_minimum_physical_link_rate:4;
492204773Sjkim
493204773Sjkim  U8 reserved_byte_33_bit_3_0:4;   // byte 33
494204773Sjkim  U8 programmed_maximum_physical_link_rate:4;
495204773Sjkim
496204773Sjkim  U16 reserved_byte_34_35;      // byte 34-35
497204773Sjkim
498204773Sjkim  U8 partial_pathway_timeout_value:4;
499204773Sjkim  U8 reserved_byte_36_bit_4_7:4;  // byte 36
500204773Sjkim
501204773Sjkim  U16 reserved_byte_37_38;  // byte 37-38
502204773Sjkim  U8 reserved_byte_39;      // byte 39
503204773Sjkim
504151937Sjkim} SMP_REQUEST_PHY_CONTROL_T;
505151937Sjkim
506151937Sjkim/**
507118611Snjl * @struct SMP_REQUEST_VENDOR_SPECIFIC
508118611Snjl * @brief  This structure depicts the vendor specific space for SMP request.
509118611Snjl */
510118611Snjl #define SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH 1016
511118611Snjltypedef struct SMP_REQUEST_VENDOR_SPECIFIC
512118611Snjl{
513118611Snjl   U8 request_bytes[SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH];
514118611Snjl}SMP_REQUEST_VENDOR_SPECIFIC_T;
515118611Snjl
516118611Snjl/**
517118611Snjl * @struct SMP_REQUEST
518118611Snjl * @brief  This structure simply unionizes the existing request
519118611Snjl *         structures into a common request type.
520118611Snjl */
521118611Snjltypedef struct _SMP_REQUEST
522118611Snjl{
523118611Snjl  SMP_REQUEST_HEADER_T header;
524118611Snjl
525118611Snjl  union
526118611Snjl  {            // bytes 4-N
527118611Snjl    SMP_REQUEST_GENERAL_T                       report_general;
528118611Snjl    SMP_REQUEST_PHY_IDENTIFIER_T                discover;
529118611Snjl    SMP_REQUEST_GENERAL_T                       report_manufacturer_information;
530118611Snjl    SMP_REQUEST_PHY_IDENTIFIER_T                report_phy_sata;
531118611Snjl    SMP_REQUEST_PHY_CONTROL_T                   phy_control;
532118611Snjl    SMP_REQUEST_PHY_IDENTIFIER_T                report_phy_error_log;
533118611Snjl    SMP_REQUEST_PHY_IDENTIFIER_T                report_route_information;
534118611Snjl    SMP_REQUEST_CONFIGURE_ROUTE_INFORMATION_T   configure_route_information;
535151937Sjkim    SMP_REQUEST_VENDOR_SPECIFIC_T               vendor_specific_request;
536151937Sjkim  } request;
537151937Sjkim
538118611Snjl} SMP_REQUEST_T;
539151937Sjkim
540151937Sjkim
541151937Sjkim/**
542151937Sjkim * @struct SMP_RESPONSE_REPORT_GENERAL
543118611Snjl * @brief  This structure depicts the SMP Report General for
544118611Snjl *         expander devices.  It adheres to the SAS-2.1 specification.
545118611Snjl *         @note For specific information on each of these
546118611Snjl *               individual fields please reference the SAS specification
547118611Snjl *               Application layer section on SMP.
548118611Snjl */
549118611Snjltypedef struct SMP_RESPONSE_REPORT_GENERAL
550118611Snjl{
551118611Snjl  U16 expander_change_count;  //byte 4-5
552118611Snjl  U16 expander_route_indexes; //byte 6-7
553118611Snjl
554118611Snjl  U32 reserved_byte8:7;        //byte 8 bit 0-6
555118611Snjl  U32 long_response:1;         //byte 8 bit 7
556118611Snjl
557118611Snjl  U32 number_of_phys:8;        //byte 9
558118611Snjl
559118611Snjl  U32 configurable_route_table:1; //byte 10
560118611Snjl  U32 configuring:1;
561202771Sjkim  U32 configures_others:1;
562118611Snjl  U32 open_reject_retry_supported:1;
563118611Snjl  U32 stp_continue_awt:1;
564118611Snjl  U32 self_configuring:1;
565118611Snjl  U32 zone_configuring:1;
566118611Snjl  U32 table_to_table_supported:1;
567118611Snjl
568118611Snjl  U32 reserved_byte11:8;       //byte 11
569118611Snjl
570118611Snjl  U32 enclosure_logical_identifier_high; //byte 12-15
571118611Snjl  U32 enclosure_logical_identifier_low;  //byte 16-19
572118611Snjl
573118611Snjl  U32 reserved_byte20_23;
574151937Sjkim  U32 reserved_byte24_27;
575151937Sjkim
576118611Snjl} SMP_RESPONSE_REPORT_GENERAL_T;
577118611Snjl
578118611Snjltypedef struct SMP_RESPONSE_REPORT_GENERAL_LONG
579118611Snjl{
580118611Snjl   SMP_RESPONSE_REPORT_GENERAL_T sas1_1;
581118611Snjl
582118611Snjl   struct
583118611Snjl   {
584118611Snjl      U16 reserved1;
585118611Snjl      U16 stp_bus_inactivity_time_limit;
586118611Snjl      U16 stp_max_connect_time_limit;
587118611Snjl      U16 stp_smp_i_t_nexus_loss_time;
588118611Snjl
589118611Snjl      U32 zoning_enabled                         : 1;
590118611Snjl      U32 zoning_supported                       : 1;
591118611Snjl      U32 physicaL_presence_asserted             : 1;
592118611Snjl      U32 zone_locked                            : 1;
593118611Snjl      U32 reserved2                              : 1;
594118611Snjl      U32 num_zone_groups                        : 3;
595118611Snjl      U32 saving_zoning_enabled_supported        : 3;
596118611Snjl      U32 saving_zone_perms_table_supported      : 1;
597118611Snjl      U32 saving_zone_phy_info_supported         : 1;
598118611Snjl      U32 saving_zone_manager_password_supported : 1;
599118611Snjl      U32 saving                                 : 1;
600118611Snjl      U32 reserved3                              : 1;
601118611Snjl      U32 max_number_routed_sas_addresses        : 16;
602151937Sjkim
603151937Sjkim      SCI_SAS_ADDRESS_T active_zone_manager_sas_address;
604118611Snjl
605118611Snjl      U16 zone_lock_inactivity_time_limit;
606197104Sjkim      U16 reserved4;
607197104Sjkim
608197104Sjkim      U8 reserved5;
609197104Sjkim      U8 first_enclosure_connector_element_index;
610118611Snjl      U8 number_of_enclosure_connector_element_indices;
611118611Snjl      U8 reserved6;
612118611Snjl
613118611Snjl      U32 reserved7                            : 7;
614118611Snjl      U32 reduced_functionality                : 1;
615118611Snjl      U32 time_to_reduce_functionality         : 8;
616118611Snjl      U32 initial_time_to_reduce_functionality : 8;
617118611Snjl      U8  max_reduced_functionality_time;
618207344Sjkim
619207344Sjkim      U16 last_self_config_status_descriptor_index;
620207344Sjkim      U16 max_number_of_stored_self_config_status_descriptors;
621207344Sjkim
622118611Snjl      U16 last_phy_event_list_descriptor_index;
623118611Snjl      U16 max_number_of_stored_phy_event_list_descriptors;
624118611Snjl   } sas2;
625118611Snjl
626118611Snjl} SMP_RESPONSE_REPORT_GENERAL_LONG_T;
627118611Snjl
628118611Snjl/**
629118611Snjl * @struct SMP_RESPONSE_REPORT_MANUFACTURER_INFORMATION
630118611Snjl * @brief  This structure depicts the SMP report manufacturer
631118611Snjl *         information for expander devices.  It adheres to the
632118611Snjl *         SAS-2.1 specification.
633118611Snjl *         @note For specific information on each of these
634118611Snjl *               individual fields please reference the SAS specification
635118611Snjl *               Application layer section on SMP.
636118611Snjl */
637118611Snjltypedef struct SMP_RESPONSE_REPORT_MANUFACTURER_INFORMATION
638118611Snjl{
639118611Snjl  U32 expander_change_count : 16;    // bytes 4-5
640118611Snjl  U32 reserved1             : 16;
641118611Snjl
642118611Snjl  U32 sas1_1_format         : 1;
643118611Snjl  U32 reserved2             : 31;
644118611Snjl
645118611Snjl  U8  vendor_id[8];
646118611Snjl  U8  product_id[16];
647118611Snjl  U8  product_revision_level[4];
648118611Snjl  U8  component_vendor_id[8];
649118611Snjl  U8  component_id[2];
650118611Snjl  U8  component_revision_level;
651118611Snjl  U8  reserved3;
652118611Snjl  U8  vendor_specific[8];
653118611Snjl
654118611Snjl} SMP_RESPONSE_REPORT_MANUFACTURER_INFORMATION_T;
655118611Snjl
656118611Snjl#define SMP_RESPONSE_DISCOVER_FORMAT_1_1_SIZE 52
657118611Snjl#define SMP_RESPONSE_DISCOVER_FORMAT_2_SIZE   116
658118611Snjl
659118611Snjl/**
660118611Snjl * @struct SMP_DISCOVER_RESPONSE_PROTOCOLS
661118611Snjl * @brief  This structure depicts the discover response where the
662118611Snjl *         supported protocols by the remote phy are specified.
663118611Snjl *         @note For specific information on each of these
664118611Snjl *               individual fields please reference the SAS specification
665118611Snjl *               Link layer section on address frames.
666151937Sjkim */
667151937Sjkimtypedef struct SMP_DISCOVER_RESPONSE_PROTOCOLS
668151937Sjkim{
669118611Snjl   union
670118611Snjl   {
671118611Snjl      struct
672118611Snjl      {
673118611Snjl         U16  attached_sata_host           : 1;
674151937Sjkim         U16  attached_smp_initiator       : 1;
675151937Sjkim         U16  attached_stp_initiator       : 1;
676151937Sjkim         U16  attached_ssp_initiator       : 1;
677118611Snjl         U16  reserved3                    : 4;
678151937Sjkim         U16  attached_sata_device         : 1;
679151937Sjkim         U16  attached_smp_target          : 1;
680118611Snjl         U16  attached_stp_target          : 1;
681167802Sjkim         U16  attached_ssp_target          : 1;
682167802Sjkim         U16  reserved4                    : 3;
683167802Sjkim         U16  attached_sata_port_selector  : 1;
684167802Sjkim      } bits;
685118611Snjl
686118611Snjl      U16 all;
687118611Snjl   } u;
688118611Snjl
689118611Snjl} SMP_DISCOVER_RESPONSE_PROTOCOLS_T;
690151937Sjkim
691151937Sjkim/**
692151937Sjkim * @struct SMP_RESPONSE_DISCOVER_FORMAT
693151937Sjkim * @brief  This structure defines the SMP phy discover response format.
694151937Sjkim *         It handles both SAS1.1 and SAS 2 definitions.  The unions
695151937Sjkim *         indicate locations where the SAS specification versions
696151937Sjkim *         differ from one another.
697151937Sjkim */
698118611Snjltypedef struct SMP_RESPONSE_DISCOVER
699151937Sjkim{
700118611Snjl
701151937Sjkim   union
702151937Sjkim   {
703151937Sjkim      struct
704151937Sjkim      {
705118611Snjl         U8 reserved[2];
706209746Sjkim      } sas1_1;
707209746Sjkim
708209746Sjkim      struct
709209746Sjkim      {
710118611Snjl         U16  expander_change_count;
711118611Snjl      } sas2;
712118611Snjl
713151937Sjkim   } u1;
714118611Snjl
715118611Snjl   U8   reserved1[3];
716118611Snjl   U8   phy_identifier;
717118611Snjl   U8   reserved2[2];
718118611Snjl
719151937Sjkim   union
720118611Snjl   {
721118611Snjl      struct
722118611Snjl      {
723118611Snjl         U16  reserved1                     : 4;
724118611Snjl         U16  attached_device_type          : 3;
725118611Snjl         U16  reserved2                     : 1;
726118611Snjl         U16  negotiated_physical_link_rate : 4;
727118611Snjl         U16  reserved3                     : 4;
728118611Snjl      } sas1_1;
729118611Snjl
730118611Snjl      struct
731118611Snjl      {
732118611Snjl         U16  attached_reason              : 4;
733118611Snjl         U16  attached_device_type         : 3;
734118611Snjl         U16  reserved2                    : 1;
735118611Snjl         U16  negotiated_logical_link_rate : 4;
736151937Sjkim         U16  reserved3                    : 4;
737118611Snjl      } sas2;
738118611Snjl
739118611Snjl   } u2;
740118611Snjl
741118611Snjl   SMP_DISCOVER_RESPONSE_PROTOCOLS_T protocols;
742118611Snjl   SCI_SAS_ADDRESS_T  sas_address;
743118611Snjl   SCI_SAS_ADDRESS_T  attached_sas_address;
744118611Snjl
745118611Snjl   U8   attached_phy_identifier;
746118611Snjl
747118611Snjl   union
748118611Snjl   {
749118611Snjl      struct
750118611Snjl      {
751118611Snjl         U8   reserved;
752118611Snjl      } sas1_1;
753118611Snjl
754118611Snjl      struct
755118611Snjl      {
756118611Snjl         U8   attached_break_reply_capable     : 1;
757118611Snjl         U8   attached_requested_inside_zpsds  : 1;
758118611Snjl         U8   attached_inside_zpsds_persistent : 1;
759118611Snjl         U8   reserved1                        : 5;
760118611Snjl      } sas2;
761118611Snjl
762118611Snjl   } u3;
763118611Snjl
764118611Snjl   U8   reserved_for_identify[6];
765118611Snjl
766118611Snjl   U32  hardware_min_physical_link_rate   : 4;
767118611Snjl   U32  programmed_min_physical_link_rate : 4;
768118611Snjl   U32  hardware_max_physical_link_rate   : 4;
769118611Snjl   U32  programmed_max_physical_link_rate : 4;
770118611Snjl   U32  phy_change_count                  : 8;
771118611Snjl   U32  partial_pathway_timeout_value     : 4;
772118611Snjl   U32  reserved5                         : 3;
773118611Snjl   U32  virtual_phy                       : 1;
774118611Snjl
775118611Snjl   U32  routing_attribute                 : 4;
776202771Sjkim   U32  reserved6                         : 4;
777118611Snjl   U32  connector_type                    : 7;
778118611Snjl   U32  reserved7                         : 1;
779118611Snjl   U32  connector_element_index           : 8;
780118611Snjl   U32  connector_physical_link           : 8;
781118611Snjl
782151937Sjkim   U16  reserved8;
783118611Snjl   U16  vendor_specific;
784207344Sjkim
785207344Sjkim   union
786207344Sjkim   {
787207344Sjkim      struct
788207344Sjkim      {
789207344Sjkim         /**
790207344Sjkim          * In the SAS 1.1 specification this structure ends after 52 bytes.
791207344Sjkim          * As a result, the contents of this field should never have a
792207344Sjkim          * real value.  It is undefined.
793207344Sjkim          */
794207344Sjkim         U8 undefined[SMP_RESPONSE_DISCOVER_FORMAT_2_SIZE
795207344Sjkim                      - SMP_RESPONSE_DISCOVER_FORMAT_1_1_SIZE];
796207344Sjkim      } sas1_1;
797207344Sjkim
798207344Sjkim      struct
799207344Sjkim      {
800207344Sjkim         SCI_SAS_ADDRESS_T attached_device_name;
801207344Sjkim
802207344Sjkim         U32  zoning_enabled                             : 1;
803207344Sjkim         U32  inside_zpsds                               : 1;
804207344Sjkim         U32  zone_group_persistent                      : 1;
805207344Sjkim         U32  reserved1                                  : 1;
806207344Sjkim         U32  requested_inside_zpsds                     : 1;
807207344Sjkim         U32  inside_zpsds_persistent                    : 1;
808207344Sjkim         U32  requested_inside_zpsds_changed_by_expander : 1;
809207344Sjkim         U32  reserved2                                  : 1;
810207344Sjkim         U32  reserved_for_zoning_fields                 : 16;
811207344Sjkim         U32  zone_group                                 : 8;
812118611Snjl
813118611Snjl         U8   self_configuration_status;
814118611Snjl         U8   self_configuration_levels_completed;
815118611Snjl         U16  reserved_for_self_config_fields;
816151937Sjkim
817118611Snjl         SCI_SAS_ADDRESS_T self_configuration_sas_address;
818118611Snjl
819118611Snjl         U32  programmed_phy_capabilities;
820118611Snjl         U32  current_phy_capabilities;
821118611Snjl         U32  attached_phy_capabilities;
822118611Snjl
823118611Snjl         U32  reserved3;
824118611Snjl
825118611Snjl         U32  reserved4                     : 16;
826118611Snjl         U32  negotiated_physical_link_rate : 4;
827118611Snjl         U32  reason                        : 4;
828118611Snjl         U32  hardware_muxing_supported     : 1;
829118611Snjl         U32  negotiated_ssc                : 1;
830118611Snjl         U32  reserved5                     : 6;
831118611Snjl
832118611Snjl         U32  default_zoning_enabled          : 1;
833118611Snjl         U32  reserved6                       : 1;
834118611Snjl         U32  default_zone_group_persistent   : 1;
835118611Snjl         U32  reserved7                       : 1;
836118611Snjl         U32  default_requested_inside_zpsds  : 1;
837118611Snjl         U32  default_inside_zpsds_persistent : 1;
838118611Snjl         U32  reserved8                       : 2;
839118611Snjl         U32  reserved9                       : 16;
840151937Sjkim         U32  default_zone_group              : 8;
841151937Sjkim
842151937Sjkim         U32  saved_zoning_enabled          : 1;
843151937Sjkim         U32  reserved10                    : 1;
844118611Snjl         U32  saved_zone_group_persistent   : 1;
845118611Snjl         U32  reserved11                    : 1;
846118611Snjl         U32  saved_requested_inside_zpsds  : 1;
847118611Snjl         U32  saved_inside_zpsds_persistent : 1;
848118611Snjl         U32  reserved12                    : 18;
849118611Snjl         U32  saved_zone_group              : 8;
850151937Sjkim
851151937Sjkim         U32  reserved14                     : 2;
852118611Snjl         U32  shadow_zone_group_persistent   : 1;
853118611Snjl         U32  reserved15                     : 1;
854118611Snjl         U32  shadow_requested_inside_zpsds  : 1;
855118611Snjl         U32  shadow_inside_zpsds_persistent : 1;
856118611Snjl         U32  reserved16                     : 18;
857118611Snjl         U32  shadow_zone_group              : 8;
858118611Snjl
859118611Snjl         U8   device_slot_number;
860118611Snjl         U8   device_slot_group_number;
861151937Sjkim         U8   device_slot_group_output_connector[6];
862151937Sjkim      } sas2;
863151937Sjkim
864118611Snjl   } u4;
865151937Sjkim
866118611Snjl} SMP_RESPONSE_DISCOVER_T;
867207344Sjkim
868118611Snjl/**
869118611Snjl * @struct SMP_RESPONSE_REPORT_PHY_SATA
870167802Sjkim * @brief  This structure depicts the contents of the SAS SMP REPORT
871167802Sjkim *         PHY SATA frame.  For specific information on each of these
872167802Sjkim *         individual fields please reference the SAS specification Link
873167802Sjkim *         layer section on address frames.
874167802Sjkim */
875207344Sjkimtypedef struct SMP_RESPONSE_REPORT_PHY_SATA
876118611Snjl{
877118611Snjl  U32 ignored_byte_4_7;       // bytes 4-7
878118611Snjl
879118611Snjl  U32  affiliations_valid:1;
880207344Sjkim  U32  affiliations_supported:1;
881118611Snjl  U32  reserved_byte11:6;     // byte 11
882118611Snjl  U32  ignored_byte10:8;      // byte 10
883118611Snjl  U32  phy_identifier:8;      // byte  9
884118611Snjl  U32  reserved_byte_8:8;     // byte  8
885207344Sjkim
886118611Snjl  U32  reserved_12_15;
887118611Snjl  U32  stp_sas_address[2];
888118611Snjl  U8   device_to_host_fis[20];
889118611Snjl  U32  reserved_44_47;
890207344Sjkim  U32  affiliated_stp_initiator_sas_address[2];
891118611Snjl
892118611Snjl} SMP_RESPONSE_REPORT_PHY_SATA_T;
893118611Snjl
894118611Snjltypedef struct SMP_RESPONSE_VENDOR_SPECIFIC
895207344Sjkim{
896118611Snjl   U8 response_bytes[SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH];
897118611Snjl}SMP_RESPONSE_VENDOR_SPECIFIC_T;
898118611Snjl
899118611Snjltypedef union SMP_RESPONSE_BODY
900207344Sjkim{
901118611Snjl   SMP_RESPONSE_REPORT_GENERAL_T report_general;
902118611Snjl   SMP_RESPONSE_REPORT_MANUFACTURER_INFORMATION_T report_manufacturer_information;
903118611Snjl   SMP_RESPONSE_DISCOVER_T discover;
904118611Snjl   SMP_RESPONSE_REPORT_PHY_SATA_T report_phy_sata;
905207344Sjkim   SMP_RESPONSE_VENDOR_SPECIFIC_T vendor_specific_response;
906118611Snjl} SMP_RESPONSE_BODY_T;
907118611Snjl
908118611Snjl/**
909207344Sjkim * @struct SMP_RESPONSE
910207344Sjkim * @brief  This structure simply unionizes the existing response
911207344Sjkim *         structures into a common response type.
912207344Sjkim */
913118611Snjltypedef struct _SMP_RESPONSE
914207344Sjkim{
915118611Snjl   SMP_RESPONSE_HEADER_T header;
916118611Snjl
917118611Snjl   SMP_RESPONSE_BODY_T   response;
918118611Snjl
919207344Sjkim} SMP_RESPONSE_T;
920118611Snjl
921118611Snjl// SMP Request Functions
922118611Snjl#define SMP_FUNCTION_REPORT_GENERAL                   0x00
923118611Snjl#define SMP_FUNCTION_REPORT_MANUFACTURER_INFORMATION  0x01
924207344Sjkim#define SMP_FUNCTION_DISCOVER                         0x10
925118611Snjl#define SMP_FUNCTION_REPORT_PHY_ERROR_LOG             0x11
926118611Snjl#define SMP_FUNCTION_REPORT_PHY_SATA                  0x12
927118611Snjl#define SMP_FUNCTION_REPORT_ROUTE_INFORMATION         0X13
928118611Snjl#define SMP_FUNCTION_CONFIGURE_ROUTE_INFORMATION      0X90
929207344Sjkim#define SMP_FUNCTION_PHY_CONTROL                      0x91
930118611Snjl#define SMP_FUNCTION_PHY_TEST                         0x92
931118611Snjl
932118611Snjl#define SMP_FRAME_TYPE_REQUEST          0x40
933118611Snjl#define SMP_FRAME_TYPE_RESPONSE         0x41
934207344Sjkim
935118611Snjl#define PHY_OPERATION_NOP               0x00
936118611Snjl#define PHY_OPERATION_LINK_RESET        0x01
937118611Snjl#define PHY_OPERATION_HARD_RESET        0x02
938118611Snjl#define PHY_OPERATION_DISABLE           0x03
939118611Snjl#define PHY_OPERATION_CLEAR_ERROR_LOG   0x05
940207344Sjkim#define PHY_OPERATION_CLEAR_AFFILIATION 0x06
941118611Snjl
942151937Sjkim#define NPLR_PHY_ENABLED_UNK_LINK_RATE 0x00
943151937Sjkim#define NPLR_PHY_DISABLED     0x01
944151937Sjkim#define NPLR_PHY_ENABLED_SPD_NEG_FAILED   0x02
945151937Sjkim#define NPLR_PHY_ENABLED_SATA_HOLD  0x03
946118611Snjl#define NPLR_PHY_ENABLED_1_5G    0x08
947118611Snjl#define NPLR_PHY_ENABLED_3_0G    0x09
948207344Sjkim
949207344Sjkim// SMP Function Result values.
950207344Sjkim#define SMP_RESULT_FUNCTION_ACCEPTED              0x00
951207344Sjkim#define SMP_RESULT_UNKNOWN_FUNCTION               0x01
952207344Sjkim#define SMP_RESULT_FUNCTION_FAILED                0x02
953207344Sjkim#define SMP_RESULT_INVALID_REQUEST_FRAME_LEN      0x03
954207344Sjkim#define SMP_RESULT_INAVALID_EXPANDER_CHANGE_COUNT 0x04
955207344Sjkim#define SMP_RESULT_BUSY                           0x05
956207344Sjkim#define SMP_RESULT_INCOMPLETE_DESCRIPTOR_LIST     0x06
957207344Sjkim#define SMP_RESULT_PHY_DOES_NOT_EXIST             0x10
958207344Sjkim#define SMP_RESULT_INDEX_DOES_NOT_EXIST           0x11
959207344Sjkim#define SMP_RESULT_PHY_DOES_NOT_SUPPORT_SATA      0x12
960207344Sjkim#define SMP_RESULT_UNKNOWN_PHY_OPERATION          0x13
961207344Sjkim#define SMP_RESULT_UNKNOWN_PHY_TEST_FUNCTION      0x14
962118611Snjl#define SMP_RESULT_PHY_TEST_IN_PROGRESS           0x15
963118611Snjl#define SMP_RESULT_PHY_VACANT                     0x16
964118611Snjl
965118611Snjl/* Attached Device Types */
966118611Snjl#define SMP_NO_DEVICE_ATTACHED      0
967118611Snjl#define SMP_END_DEVICE_ONLY         1
968118611Snjl#define SMP_EDGE_EXPANDER_DEVICE    2
969118611Snjl#define SMP_FANOUT_EXPANDER_DEVICE  3
970118611Snjl
971118611Snjl/* Expander phy routine attribute */
972151937Sjkim#define DIRECT_ROUTING_ATTRIBUTE        0
973151937Sjkim#define SUBTRACTIVE_ROUTING_ATTRIBUTE   1
974151937Sjkim#define TABLE_ROUTING_ATTRIBUTE         2
975151937Sjkim
976207344Sjkim#endif // _INTEL_SAS_H_
977207344Sjkim
978207344Sjkim