xref: /freebsd/sys/dev/isci/scil/intel_sas.h (revision f11c7f63056671247335df83a3fe80b94c6616ac)
1*f11c7f63SJim Harris /*-
2*f11c7f63SJim Harris  * This file is provided under a dual BSD/GPLv2 license.  When using or
3*f11c7f63SJim Harris  * redistributing this file, you may do so under either license.
4*f11c7f63SJim Harris  *
5*f11c7f63SJim Harris  * GPL LICENSE SUMMARY
6*f11c7f63SJim Harris  *
7*f11c7f63SJim Harris  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8*f11c7f63SJim Harris  *
9*f11c7f63SJim Harris  * This program is free software; you can redistribute it and/or modify
10*f11c7f63SJim Harris  * it under the terms of version 2 of the GNU General Public License as
11*f11c7f63SJim Harris  * published by the Free Software Foundation.
12*f11c7f63SJim Harris  *
13*f11c7f63SJim Harris  * This program is distributed in the hope that it will be useful, but
14*f11c7f63SJim Harris  * WITHOUT ANY WARRANTY; without even the implied warranty of
15*f11c7f63SJim Harris  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16*f11c7f63SJim Harris  * General Public License for more details.
17*f11c7f63SJim Harris  *
18*f11c7f63SJim Harris  * You should have received a copy of the GNU General Public License
19*f11c7f63SJim Harris  * along with this program; if not, write to the Free Software
20*f11c7f63SJim Harris  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21*f11c7f63SJim Harris  * The full GNU General Public License is included in this distribution
22*f11c7f63SJim Harris  * in the file called LICENSE.GPL.
23*f11c7f63SJim Harris  *
24*f11c7f63SJim Harris  * BSD LICENSE
25*f11c7f63SJim Harris  *
26*f11c7f63SJim Harris  * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
27*f11c7f63SJim Harris  * All rights reserved.
28*f11c7f63SJim Harris  *
29*f11c7f63SJim Harris  * Redistribution and use in source and binary forms, with or without
30*f11c7f63SJim Harris  * modification, are permitted provided that the following conditions
31*f11c7f63SJim Harris  * are met:
32*f11c7f63SJim Harris  *
33*f11c7f63SJim Harris  *   * Redistributions of source code must retain the above copyright
34*f11c7f63SJim Harris  *     notice, this list of conditions and the following disclaimer.
35*f11c7f63SJim Harris  *   * Redistributions in binary form must reproduce the above copyright
36*f11c7f63SJim Harris  *     notice, this list of conditions and the following disclaimer in
37*f11c7f63SJim Harris  *     the documentation and/or other materials provided with the
38*f11c7f63SJim Harris  *     distribution.
39*f11c7f63SJim Harris  *
40*f11c7f63SJim Harris  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41*f11c7f63SJim Harris  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42*f11c7f63SJim Harris  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43*f11c7f63SJim Harris  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44*f11c7f63SJim Harris  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45*f11c7f63SJim Harris  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46*f11c7f63SJim Harris  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47*f11c7f63SJim Harris  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48*f11c7f63SJim Harris  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49*f11c7f63SJim Harris  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50*f11c7f63SJim Harris  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51*f11c7f63SJim Harris  *
52*f11c7f63SJim Harris  * $FreeBSD$
53*f11c7f63SJim Harris  */
54*f11c7f63SJim Harris #ifndef _INTEL_SAS_H_
55*f11c7f63SJim Harris #define _INTEL_SAS_H_
56*f11c7f63SJim Harris 
57*f11c7f63SJim Harris /**
58*f11c7f63SJim Harris  * @file
59*f11c7f63SJim Harris  *
60*f11c7f63SJim Harris  * @brief This file contains all of the definitions relating to structures,
61*f11c7f63SJim Harris  *        constants, etc. defined by the SAS specification.
62*f11c7f63SJim Harris  */
63*f11c7f63SJim Harris 
64*f11c7f63SJim Harris #include <dev/isci/types.h>
65*f11c7f63SJim Harris #include <dev/isci/scil/intel_sata.h>
66*f11c7f63SJim Harris #include <dev/isci/scil/intel_scsi.h>
67*f11c7f63SJim Harris 
68*f11c7f63SJim Harris /**
69*f11c7f63SJim Harris  * @struct SCI_SAS_ADDRESS
70*f11c7f63SJim Harris  * @brief  This structure depicts how a SAS address is represented by SCI.
71*f11c7f63SJim Harris  */
72*f11c7f63SJim Harris typedef struct SCI_SAS_ADDRESS
73*f11c7f63SJim Harris {
74*f11c7f63SJim Harris    /**
75*f11c7f63SJim Harris     * This member contains the higher 32-bits of the SAS address.
76*f11c7f63SJim Harris     */
77*f11c7f63SJim Harris    U32 high;
78*f11c7f63SJim Harris 
79*f11c7f63SJim Harris    /**
80*f11c7f63SJim Harris     * This member contains the lower 32-bits of the SAS address.
81*f11c7f63SJim Harris     */
82*f11c7f63SJim Harris    U32 low;
83*f11c7f63SJim Harris 
84*f11c7f63SJim Harris } SCI_SAS_ADDRESS_T;
85*f11c7f63SJim Harris 
86*f11c7f63SJim Harris /**
87*f11c7f63SJim Harris  * @struct SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS
88*f11c7f63SJim Harris  * @brief  This structure depicts the contents of bytes 2 and 3 in the
89*f11c7f63SJim Harris  *         SAS IDENTIFY ADDRESS FRAME (IAF).
90*f11c7f63SJim Harris  *         @note For specific information on each of these
91*f11c7f63SJim Harris  *               individual fields please reference the SAS specification
92*f11c7f63SJim Harris  *               Link layer section on address frames.
93*f11c7f63SJim Harris  */
94*f11c7f63SJim Harris typedef struct SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS
95*f11c7f63SJim Harris {
96*f11c7f63SJim Harris    union
97*f11c7f63SJim Harris    {
98*f11c7f63SJim Harris       struct
99*f11c7f63SJim Harris       {
100*f11c7f63SJim Harris          U16  restricted1        : 1;
101*f11c7f63SJim Harris          U16  smp_initiator      : 1;
102*f11c7f63SJim Harris          U16  stp_initiator      : 1;
103*f11c7f63SJim Harris          U16  ssp_initiator      : 1;
104*f11c7f63SJim Harris          U16  reserved3          : 4;
105*f11c7f63SJim Harris          U16  restricted2        : 1;
106*f11c7f63SJim Harris          U16  smp_target         : 1;
107*f11c7f63SJim Harris          U16  stp_target         : 1;
108*f11c7f63SJim Harris          U16  ssp_target         : 1;
109*f11c7f63SJim Harris          U16  reserved4          : 4;
110*f11c7f63SJim Harris       } bits;
111*f11c7f63SJim Harris 
112*f11c7f63SJim Harris       U16 all;
113*f11c7f63SJim Harris    } u;
114*f11c7f63SJim Harris 
115*f11c7f63SJim Harris } SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS_T;
116*f11c7f63SJim Harris 
117*f11c7f63SJim Harris /**
118*f11c7f63SJim Harris  * @struct SCI_SAS_IDENTIFY_ADDRESS_FRAME
119*f11c7f63SJim Harris  * @brief  This structure depicts the contents of the SAS IDENTIFY ADDRESS
120*f11c7f63SJim Harris  *         FRAME (IAF).
121*f11c7f63SJim Harris  *         @note For specific information on each of these
122*f11c7f63SJim Harris  *               individual fields please reference the SAS specification
123*f11c7f63SJim Harris  *               Link layer section on address frames.
124*f11c7f63SJim Harris  */
125*f11c7f63SJim Harris typedef struct SCI_SAS_IDENTIFY_ADDRESS_FRAME
126*f11c7f63SJim Harris {
127*f11c7f63SJim Harris    U16  address_frame_type : 4;
128*f11c7f63SJim Harris    U16  device_type        : 3;
129*f11c7f63SJim Harris    U16  reserved1          : 1;
130*f11c7f63SJim Harris    U16  reason             : 4;
131*f11c7f63SJim Harris    U16  reserved2          : 4;
132*f11c7f63SJim Harris 
133*f11c7f63SJim Harris    SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS_T protocols;
134*f11c7f63SJim Harris 
135*f11c7f63SJim Harris    SCI_SAS_ADDRESS_T  device_name;
136*f11c7f63SJim Harris    SCI_SAS_ADDRESS_T  sas_address;
137*f11c7f63SJim Harris 
138*f11c7f63SJim Harris    U32  phy_identifier      : 8;
139*f11c7f63SJim Harris    U32  break_reply_capable : 1;
140*f11c7f63SJim Harris    U32  requested_in_zpsds  : 1;
141*f11c7f63SJim Harris    U32  in_zpsds_persistent : 1;
142*f11c7f63SJim Harris    U32  reserved5           : 21;
143*f11c7f63SJim Harris 
144*f11c7f63SJim Harris    U32  reserved6[4];
145*f11c7f63SJim Harris 
146*f11c7f63SJim Harris } SCI_SAS_IDENTIFY_ADDRESS_FRAME_T;
147*f11c7f63SJim Harris 
148*f11c7f63SJim Harris /**
149*f11c7f63SJim Harris  * @struct SAS_CAPABILITIES
150*f11c7f63SJim Harris  * @brief  This structure depicts the various SAS capabilities supported
151*f11c7f63SJim Harris  *         by the directly attached target device.  For specific information
152*f11c7f63SJim Harris  *         on each of these individual fields please reference the SAS
153*f11c7f63SJim Harris  *         specification Phy layer section on speed negotiation windows.
154*f11c7f63SJim Harris  */
155*f11c7f63SJim Harris typedef struct SAS_CAPABILITIES
156*f11c7f63SJim Harris {
157*f11c7f63SJim Harris    union
158*f11c7f63SJim Harris    {
159*f11c7f63SJim Harris #if defined (SCIC_SDS_4_ENABLED)
160*f11c7f63SJim Harris       struct
161*f11c7f63SJim Harris       {
162*f11c7f63SJim Harris          /**
163*f11c7f63SJim Harris           * The SAS specification indicates the start bit shall always be set to
164*f11c7f63SJim Harris           * 1.  This implementation will have the start bit set to 0 if the
165*f11c7f63SJim Harris           * PHY CAPABILITIES were either not received or speed negotiation failed.
166*f11c7f63SJim Harris           */
167*f11c7f63SJim Harris          U32  start                       : 1;
168*f11c7f63SJim Harris          U32  tx_ssc_type                 : 1;
169*f11c7f63SJim Harris          U32  reserved1                   : 2;
170*f11c7f63SJim Harris          U32  requested_logical_link_rate : 4;
171*f11c7f63SJim Harris 
172*f11c7f63SJim Harris          U32  gen1_without_ssc_supported  : 1;
173*f11c7f63SJim Harris          U32  gen1_with_ssc_supported     : 1;
174*f11c7f63SJim Harris          U32  gen2_without_ssc_supported  : 1;
175*f11c7f63SJim Harris          U32  gen2_with_ssc_supported     : 1;
176*f11c7f63SJim Harris          U32  gen3_without_ssc_supported  : 1;
177*f11c7f63SJim Harris          U32  gen3_with_ssc_supported     : 1;
178*f11c7f63SJim Harris          U32  reserved2                   : 17;
179*f11c7f63SJim Harris          U32  parity                      : 1;
180*f11c7f63SJim Harris       } bits;
181*f11c7f63SJim Harris #endif // (SCIC_SDS_4_ENABLED)
182*f11c7f63SJim Harris 
183*f11c7f63SJim Harris       U32 all;
184*f11c7f63SJim Harris    } u;
185*f11c7f63SJim Harris 
186*f11c7f63SJim Harris } SAS_CAPABILITIES_T;
187*f11c7f63SJim Harris 
188*f11c7f63SJim Harris /**
189*f11c7f63SJim Harris  * @enum  _SCI_SAS_LINK_RATE
190*f11c7f63SJim Harris  * @brief This enumeration depicts the SAS specification defined link speeds.
191*f11c7f63SJim Harris  */
192*f11c7f63SJim Harris typedef enum _SCI_SAS_LINK_RATE
193*f11c7f63SJim Harris {
194*f11c7f63SJim Harris    SCI_SAS_NO_LINK_RATE = 0,
195*f11c7f63SJim Harris    SCI_SATA_SPINUP_HOLD = 0x3,
196*f11c7f63SJim Harris    SCI_SAS_150_GB = 0x8,
197*f11c7f63SJim Harris    SCI_SAS_300_GB = 0x9,
198*f11c7f63SJim Harris    SCI_SAS_600_GB = 0xA
199*f11c7f63SJim Harris } SCI_SAS_LINK_RATE;
200*f11c7f63SJim Harris 
201*f11c7f63SJim Harris /**
202*f11c7f63SJim Harris  * @enum  _SCI_SAS_TASK_ATTRIBUTE
203*f11c7f63SJim Harris  * @brief This enumeration depicts the SAM/SAS specification defined task
204*f11c7f63SJim Harris  *        attribute values for a command information unit.
205*f11c7f63SJim Harris  */
206*f11c7f63SJim Harris typedef enum _SCI_SAS_TASK_ATTRIBUTE
207*f11c7f63SJim Harris {
208*f11c7f63SJim Harris    SCI_SAS_SIMPLE_ATTRIBUTE = 0,
209*f11c7f63SJim Harris    SCI_SAS_HEAD_OF_QUEUE_ATTRIBUTE = 1,
210*f11c7f63SJim Harris    SCI_SAS_ORDERED_ATTRIBUTE = 2,
211*f11c7f63SJim Harris    SCI_SAS_ACA_ATTRIBUTE = 4,
212*f11c7f63SJim Harris } SCI_SAS_TASK_ATTRIBUTE;
213*f11c7f63SJim Harris 
214*f11c7f63SJim Harris /**
215*f11c7f63SJim Harris  * @enum  _SCI_SAS_TASK_MGMT_FUNCTION
216*f11c7f63SJim Harris  * @brief This enumeration depicts the SAM/SAS specification defined task
217*f11c7f63SJim Harris  *        management functions.
218*f11c7f63SJim Harris  *        @note This HARD_RESET function listed here is not actually defined
219*f11c7f63SJim Harris  *              as a task management function in the industry standard.
220*f11c7f63SJim Harris  */
221*f11c7f63SJim Harris typedef enum _SCI_SAS_TASK_MGMT_FUNCTION
222*f11c7f63SJim Harris {
223*f11c7f63SJim Harris    SCI_SAS_ABORT_TASK = SCSI_TASK_REQUEST_ABORT_TASK,
224*f11c7f63SJim Harris    SCI_SAS_ABORT_TASK_SET = SCSI_TASK_REQUEST_ABORT_TASK_SET,
225*f11c7f63SJim Harris    SCI_SAS_CLEAR_TASK_SET = SCSI_TASK_REQUEST_CLEAR_TASK_SET,
226*f11c7f63SJim Harris    SCI_SAS_LOGICAL_UNIT_RESET = SCSI_TASK_REQUEST_LOGICAL_UNIT_RESET,
227*f11c7f63SJim Harris    SCI_SAS_I_T_NEXUS_RESET = SCSI_TASK_REQUEST_I_T_NEXUS_RESET,
228*f11c7f63SJim Harris    SCI_SAS_CLEAR_ACA = SCSI_TASK_REQUEST_CLEAR_ACA,
229*f11c7f63SJim Harris    SCI_SAS_QUERY_TASK = SCSI_TASK_REQUEST_QUERY_TASK,
230*f11c7f63SJim Harris    SCI_SAS_QUERY_TASK_SET = SCSI_TASK_REQUEST_QUERY_TASK_SET,
231*f11c7f63SJim Harris    SCI_SAS_QUERY_ASYNCHRONOUS_EVENT = SCSI_TASK_REQUEST_QUERY_UNIT_ATTENTION,
232*f11c7f63SJim Harris    SCI_SAS_HARD_RESET = 0xFF
233*f11c7f63SJim Harris } SCI_SAS_TASK_MGMT_FUNCTION_T;
234*f11c7f63SJim Harris 
235*f11c7f63SJim Harris 
236*f11c7f63SJim Harris /**
237*f11c7f63SJim Harris  * @enum  _SCI_SAS_FRAME_TYPE
238*f11c7f63SJim Harris  * @brief This enumeration depicts the SAS specification defined SSP frame
239*f11c7f63SJim Harris  *        types.
240*f11c7f63SJim Harris  */
241*f11c7f63SJim Harris typedef enum _SCI_SAS_FRAME_TYPE
242*f11c7f63SJim Harris {
243*f11c7f63SJim Harris    SCI_SAS_DATA_FRAME = 0x01,
244*f11c7f63SJim Harris    SCI_SAS_XFER_RDY_FRAME = 0x05,
245*f11c7f63SJim Harris    SCI_SAS_COMMAND_FRAME = 0x06,
246*f11c7f63SJim Harris    SCI_SAS_RESPONSE_FRAME = 0x07,
247*f11c7f63SJim Harris    SCI_SAS_TASK_FRAME = 0x16
248*f11c7f63SJim Harris } SCI_SAS_FRAME_TYPE_T;
249*f11c7f63SJim Harris 
250*f11c7f63SJim Harris 
251*f11c7f63SJim Harris /**
252*f11c7f63SJim Harris  * @struct SCI_SSP_COMMAND_IU
253*f11c7f63SJim Harris  * @brief This structure depicts the contents of the SSP COMMAND
254*f11c7f63SJim Harris  *        INFORMATION UNIT. For specific information on each of these
255*f11c7f63SJim Harris  *        individual fields please reference the SAS specification SSP
256*f11c7f63SJim Harris  *        transport layer section.
257*f11c7f63SJim Harris  */
258*f11c7f63SJim Harris typedef struct SCI_SSP_COMMAND_IU
259*f11c7f63SJim Harris {
260*f11c7f63SJim Harris 
261*f11c7f63SJim Harris    U32 lun[2];
262*f11c7f63SJim Harris 
263*f11c7f63SJim Harris    U32 additional_cdb_length  : 6;
264*f11c7f63SJim Harris    U32 reserved0              : 2;
265*f11c7f63SJim Harris    U32 reserved1              : 8;
266*f11c7f63SJim Harris    U32 enable_first_burst     : 1;
267*f11c7f63SJim Harris    U32 task_priority          : 4;
268*f11c7f63SJim Harris    U32 task_attribute         : 3;
269*f11c7f63SJim Harris    U32 reserved2              : 8;
270*f11c7f63SJim Harris 
271*f11c7f63SJim Harris    U32 cdb[4];
272*f11c7f63SJim Harris 
273*f11c7f63SJim Harris } SCI_SSP_COMMAND_IU_T;
274*f11c7f63SJim Harris 
275*f11c7f63SJim Harris /**
276*f11c7f63SJim Harris  * @struct SCI_SSP_TASK_IU
277*f11c7f63SJim Harris  * @brief This structure depicts the contents of the SSP TASK INFORMATION
278*f11c7f63SJim Harris  *        UNIT. For specific information on each of these individual fields
279*f11c7f63SJim Harris  *        please reference the SAS specification SSP transport layer
280*f11c7f63SJim Harris  *        section.
281*f11c7f63SJim Harris  */
282*f11c7f63SJim Harris typedef struct SCI_SSP_TASK_IU
283*f11c7f63SJim Harris {
284*f11c7f63SJim Harris    U32 lun_upper;
285*f11c7f63SJim Harris    U32 lun_lower;
286*f11c7f63SJim Harris 
287*f11c7f63SJim Harris    U32 reserved0     : 8;
288*f11c7f63SJim Harris    U32 task_function : 8;
289*f11c7f63SJim Harris    U32 reserved1     : 8;
290*f11c7f63SJim Harris    U32 reserved2     : 8;
291*f11c7f63SJim Harris 
292*f11c7f63SJim Harris    U32 reserved3     : 16;
293*f11c7f63SJim Harris    U32 task_tag      : 16;
294*f11c7f63SJim Harris 
295*f11c7f63SJim Harris    U32 reserved4[3];
296*f11c7f63SJim Harris 
297*f11c7f63SJim Harris } SCI_SSP_TASK_IU_T;
298*f11c7f63SJim Harris 
299*f11c7f63SJim Harris #define SSP_RESPONSE_IU_MAX_DATA 64
300*f11c7f63SJim Harris 
301*f11c7f63SJim Harris #define SCI_SSP_RESPONSE_IU_DATA_PRESENT_MASK   (0x03)
302*f11c7f63SJim Harris 
303*f11c7f63SJim Harris /**
304*f11c7f63SJim Harris  * @struct SCI_SSP_RESPONSE_IU
305*f11c7f63SJim Harris  * @brief This structure depicts the contents of the SSP RESPONSE
306*f11c7f63SJim Harris  *        INFORMATION UNIT. For specific information on each of these
307*f11c7f63SJim Harris  *        individual fields please reference the SAS specification SSP
308*f11c7f63SJim Harris  *        transport layer section.
309*f11c7f63SJim Harris  */
310*f11c7f63SJim Harris typedef struct SCI_SSP_RESPONSE_IU
311*f11c7f63SJim Harris {
312*f11c7f63SJim Harris    U8  reserved0[8];
313*f11c7f63SJim Harris 
314*f11c7f63SJim Harris    U8  retry_delay_timer[2];
315*f11c7f63SJim Harris    U8  data_present;
316*f11c7f63SJim Harris    U8  status;
317*f11c7f63SJim Harris 
318*f11c7f63SJim Harris    U8  reserved1[4];
319*f11c7f63SJim Harris    U8  sense_data_length[4];
320*f11c7f63SJim Harris    U8  response_data_length[4];
321*f11c7f63SJim Harris 
322*f11c7f63SJim Harris    U32 data[SSP_RESPONSE_IU_MAX_DATA];
323*f11c7f63SJim Harris 
324*f11c7f63SJim Harris } SCI_SSP_RESPONSE_IU_T;
325*f11c7f63SJim Harris 
326*f11c7f63SJim Harris /**
327*f11c7f63SJim Harris  * @enum  _SCI_SAS_DATA_PRESENT_TYPE
328*f11c7f63SJim Harris  * @brief This enumeration depicts the SAS specification defined SSP data present
329*f11c7f63SJim Harris  *        types in SCI_SSP_RESPONSE_IU.
330*f11c7f63SJim Harris  */
331*f11c7f63SJim Harris typedef enum _SCI_SSP_RESPONSE_IU_DATA_PRESENT_TYPE
332*f11c7f63SJim Harris {
333*f11c7f63SJim Harris    SCI_SSP_RESPONSE_IU_NO_DATA = 0x00,
334*f11c7f63SJim Harris    SCI_SSP_RESPONSE_IU_RESPONSE_DATA = 0x01,
335*f11c7f63SJim Harris    SCI_SSP_RESPONSE_IU_SENSE_DATA = 0x02
336*f11c7f63SJim Harris } SCI_SSP_RESPONSE_IU_DATA_PRESENT_TYPE_T;
337*f11c7f63SJim Harris 
338*f11c7f63SJim Harris /**
339*f11c7f63SJim Harris  * @struct SCI_SSP_FRAME_HEADER
340*f11c7f63SJim Harris  *
341*f11c7f63SJim Harris  * @brief This structure depicts the contents of an SSP frame header.  For
342*f11c7f63SJim Harris  *        specific information on the individual fields please reference
343*f11c7f63SJim Harris  *        the SAS specification transport layer SSP frame format.
344*f11c7f63SJim Harris  */
345*f11c7f63SJim Harris typedef struct SCI_SSP_FRAME_HEADER
346*f11c7f63SJim Harris {
347*f11c7f63SJim Harris    // Word 0
348*f11c7f63SJim Harris    U32 hashed_destination_address  :24;
349*f11c7f63SJim Harris    U32 frame_type                  : 8;
350*f11c7f63SJim Harris 
351*f11c7f63SJim Harris    // Word 1
352*f11c7f63SJim Harris    U32 hashed_source_address       :24;
353*f11c7f63SJim Harris    U32 reserved1_0                 : 8;
354*f11c7f63SJim Harris 
355*f11c7f63SJim Harris    // Word 2
356*f11c7f63SJim Harris    U32 reserved2_2                 : 6;
357*f11c7f63SJim Harris    U32 fill_bytes                  : 2;
358*f11c7f63SJim Harris    U32 reserved2_1                 : 3;
359*f11c7f63SJim Harris    U32 tlr_control                 : 2;
360*f11c7f63SJim Harris    U32 retry_data_frames           : 1;
361*f11c7f63SJim Harris    U32 retransmit                  : 1;
362*f11c7f63SJim Harris    U32 changing_data_pointer       : 1;
363*f11c7f63SJim Harris    U32 reserved2_0                 :16;
364*f11c7f63SJim Harris 
365*f11c7f63SJim Harris    // Word 3
366*f11c7f63SJim Harris    U32 uiResv4;
367*f11c7f63SJim Harris 
368*f11c7f63SJim Harris    // Word 4
369*f11c7f63SJim Harris    U16 target_port_transfer_tag;
370*f11c7f63SJim Harris    U16 tag;
371*f11c7f63SJim Harris 
372*f11c7f63SJim Harris    // Word 5
373*f11c7f63SJim Harris    U32 data_offset;
374*f11c7f63SJim Harris 
375*f11c7f63SJim Harris } SCI_SSP_FRAME_HEADER_T;
376*f11c7f63SJim Harris 
377*f11c7f63SJim Harris /**
378*f11c7f63SJim Harris  * @struct SMP_REQUEST_HEADER
379*f11c7f63SJim Harris  * @brief  This structure defines the contents of an SMP Request header.
380*f11c7f63SJim Harris  *         @note For specific information on each of these
381*f11c7f63SJim Harris  *               individual fields please reference the SAS specification.
382*f11c7f63SJim Harris  */
383*f11c7f63SJim Harris typedef struct SMP_REQUEST_HEADER
384*f11c7f63SJim Harris {
385*f11c7f63SJim Harris    U8 smp_frame_type;                // byte 0
386*f11c7f63SJim Harris    U8 function;                      // byte 1
387*f11c7f63SJim Harris    U8 allocated_response_length;     // byte 2
388*f11c7f63SJim Harris    U8 request_length;                // byte 3
389*f11c7f63SJim Harris } SMP_REQUEST_HEADER_T;
390*f11c7f63SJim Harris 
391*f11c7f63SJim Harris /**
392*f11c7f63SJim Harris  * @struct SMP_RESPONSE_HEADER
393*f11c7f63SJim Harris  * @brief  This structure depicts the contents of the SAS SMP DISCOVER
394*f11c7f63SJim Harris  *         RESPONSE frame.  For specific information on each of these
395*f11c7f63SJim Harris  *         individual fields please reference the SAS specification Link
396*f11c7f63SJim Harris  *         layer section on address frames.
397*f11c7f63SJim Harris  */
398*f11c7f63SJim Harris typedef struct SMP_RESPONSE_HEADER
399*f11c7f63SJim Harris {
400*f11c7f63SJim Harris    U8 smp_frame_type;      // byte 0
401*f11c7f63SJim Harris    U8 function;            // byte 1
402*f11c7f63SJim Harris    U8 function_result;     // byte 2
403*f11c7f63SJim Harris    U8 response_length;     // byte 3
404*f11c7f63SJim Harris } SMP_RESPONSE_HEADER_T;
405*f11c7f63SJim Harris 
406*f11c7f63SJim Harris /**
407*f11c7f63SJim Harris  * @struct SMP_REQUEST_GENERAL
408*f11c7f63SJim Harris  * @brief  This structure defines the contents of an SMP Request that
409*f11c7f63SJim Harris  *         is comprised of the SMP_REQUEST_HEADER and a CRC.
410*f11c7f63SJim Harris  *         @note For specific information on each of these
411*f11c7f63SJim Harris  *               individual fields please reference the SAS specification.
412*f11c7f63SJim Harris  */
413*f11c7f63SJim Harris typedef struct SMP_REQUEST_GENERAL
414*f11c7f63SJim Harris {
415*f11c7f63SJim Harris   U32 crc;            // bytes 4-7
416*f11c7f63SJim Harris 
417*f11c7f63SJim Harris } SMP_REQUEST_GENERAL_T;
418*f11c7f63SJim Harris 
419*f11c7f63SJim Harris /**
420*f11c7f63SJim Harris  * @struct SMP_REQUEST_PHY_IDENTIFIER
421*f11c7f63SJim Harris  * @brief  This structure defines the contents of an SMP Request that
422*f11c7f63SJim Harris  *         is comprised of the SMP_REQUEST_HEADER and a phy identifier.
423*f11c7f63SJim Harris  *         Examples: SMP_REQUEST_DISCOVER, SMP_REQUEST_REPORT_PHY_SATA.
424*f11c7f63SJim Harris  *         @note For specific information on each of these
425*f11c7f63SJim Harris  *               individual fields please reference the SAS specification.
426*f11c7f63SJim Harris  */
427*f11c7f63SJim Harris typedef struct SMP_REQUEST_PHY_IDENTIFIER
428*f11c7f63SJim Harris {
429*f11c7f63SJim Harris   U32 reserved_byte4_7;      // bytes 4-7
430*f11c7f63SJim Harris 
431*f11c7f63SJim Harris   U32 ignore_zone_group:1;    // byte 8
432*f11c7f63SJim Harris   U32 reserved_byte8:7;
433*f11c7f63SJim Harris 
434*f11c7f63SJim Harris   U32 phy_identifier:8;       // byte 9
435*f11c7f63SJim Harris   U32 reserved_byte10:8;      // byte 10
436*f11c7f63SJim Harris   U32 reserved_byte11:8;      // byte 11
437*f11c7f63SJim Harris 
438*f11c7f63SJim Harris } SMP_REQUEST_PHY_IDENTIFIER_T;
439*f11c7f63SJim Harris 
440*f11c7f63SJim Harris /**
441*f11c7f63SJim Harris  * @struct SMP_REQUEST_CONFIGURE_ROUTE_INFORMATION
442*f11c7f63SJim Harris  * @brief  This structure defines the contents of an SMP Configure Route
443*f11c7f63SJim Harris  *         Information request.
444*f11c7f63SJim Harris  *         @note For specific information on each of these
445*f11c7f63SJim Harris  *               individual fields please reference the SAS specification.
446*f11c7f63SJim Harris  */
447*f11c7f63SJim Harris typedef struct SMP_REQUEST_CONFIGURE_ROUTE_INFORMATION
448*f11c7f63SJim Harris {
449*f11c7f63SJim Harris   U32 expected_expander_change_count:16;    // bytes 4-5
450*f11c7f63SJim Harris   U32 expander_route_index_high:8;
451*f11c7f63SJim Harris   U32 expander_route_index:8;              // bytes 6-7
452*f11c7f63SJim Harris 
453*f11c7f63SJim Harris   U32 reserved_byte8:8;           // bytes 8
454*f11c7f63SJim Harris   U32 phy_identifier:8;           // bytes 9
455*f11c7f63SJim Harris   U32 reserved_byte_10_11:16;     // bytes 10-11
456*f11c7f63SJim Harris 
457*f11c7f63SJim Harris   U32 reserved_byte_12_bit_0_6:7;
458*f11c7f63SJim Harris   U32 disable_route_entry:1;    // byte 12
459*f11c7f63SJim Harris   U32 reserved_byte_13_15:24;   // bytes 13-15
460*f11c7f63SJim Harris 
461*f11c7f63SJim Harris   U32 routed_sas_address[2];    // bytes 16-23
462*f11c7f63SJim Harris   U8 reserved_byte_24_39[16];    // bytes 24-39
463*f11c7f63SJim Harris 
464*f11c7f63SJim Harris } SMP_REQUEST_CONFIGURE_ROUTE_INFORMATION_T;
465*f11c7f63SJim Harris 
466*f11c7f63SJim Harris /**
467*f11c7f63SJim Harris  * @struct SMP_REQUEST_PHY_CONTROL
468*f11c7f63SJim Harris  * @brief  This structure defines the contents of an SMP Phy Controler
469*f11c7f63SJim Harris  *         request.
470*f11c7f63SJim Harris  *         @note For specific information on each of these
471*f11c7f63SJim Harris  *               individual fields please reference the SAS specification.
472*f11c7f63SJim Harris  */
473*f11c7f63SJim Harris typedef struct SMP_REQUEST_PHY_CONTROL
474*f11c7f63SJim Harris {
475*f11c7f63SJim Harris   U16 expected_expander_change_count;   // byte 4-5
476*f11c7f63SJim Harris 
477*f11c7f63SJim Harris   U16 reserved_byte_6_7;   // byte 6-7
478*f11c7f63SJim Harris   U8 reserved_byte_8;      // byte 8
479*f11c7f63SJim Harris 
480*f11c7f63SJim Harris   U8 phy_identifier;       // byte 9
481*f11c7f63SJim Harris   U8 phy_operation;        // byte 10
482*f11c7f63SJim Harris 
483*f11c7f63SJim Harris   U8 update_partial_pathway_timeout_value:1;
484*f11c7f63SJim Harris   U8 reserved_byte_11_bit_1_7:7;   // byte 11
485*f11c7f63SJim Harris 
486*f11c7f63SJim Harris   U8 reserved_byte_12_23[12];      // byte 12-23
487*f11c7f63SJim Harris 
488*f11c7f63SJim Harris   U8 attached_device_name[8];      // byte 24-31
489*f11c7f63SJim Harris 
490*f11c7f63SJim Harris   U8 reserved_byte_32_bit_3_0:4;   // byte 32
491*f11c7f63SJim Harris   U8 programmed_minimum_physical_link_rate:4;
492*f11c7f63SJim Harris 
493*f11c7f63SJim Harris   U8 reserved_byte_33_bit_3_0:4;   // byte 33
494*f11c7f63SJim Harris   U8 programmed_maximum_physical_link_rate:4;
495*f11c7f63SJim Harris 
496*f11c7f63SJim Harris   U16 reserved_byte_34_35;      // byte 34-35
497*f11c7f63SJim Harris 
498*f11c7f63SJim Harris   U8 partial_pathway_timeout_value:4;
499*f11c7f63SJim Harris   U8 reserved_byte_36_bit_4_7:4;  // byte 36
500*f11c7f63SJim Harris 
501*f11c7f63SJim Harris   U16 reserved_byte_37_38;  // byte 37-38
502*f11c7f63SJim Harris   U8 reserved_byte_39;      // byte 39
503*f11c7f63SJim Harris 
504*f11c7f63SJim Harris } SMP_REQUEST_PHY_CONTROL_T;
505*f11c7f63SJim Harris 
506*f11c7f63SJim Harris /**
507*f11c7f63SJim Harris  * @struct SMP_REQUEST_VENDOR_SPECIFIC
508*f11c7f63SJim Harris  * @brief  This structure depicts the vendor specific space for SMP request.
509*f11c7f63SJim Harris  */
510*f11c7f63SJim Harris  #define SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH 1016
511*f11c7f63SJim Harris typedef struct SMP_REQUEST_VENDOR_SPECIFIC
512*f11c7f63SJim Harris {
513*f11c7f63SJim Harris    U8 request_bytes[SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH];
514*f11c7f63SJim Harris }SMP_REQUEST_VENDOR_SPECIFIC_T;
515*f11c7f63SJim Harris 
516*f11c7f63SJim Harris /**
517*f11c7f63SJim Harris  * @struct SMP_REQUEST
518*f11c7f63SJim Harris  * @brief  This structure simply unionizes the existing request
519*f11c7f63SJim Harris  *         structures into a common request type.
520*f11c7f63SJim Harris  */
521*f11c7f63SJim Harris typedef struct _SMP_REQUEST
522*f11c7f63SJim Harris {
523*f11c7f63SJim Harris   SMP_REQUEST_HEADER_T header;
524*f11c7f63SJim Harris 
525*f11c7f63SJim Harris   union
526*f11c7f63SJim Harris   {            // bytes 4-N
527*f11c7f63SJim Harris     SMP_REQUEST_GENERAL_T                       report_general;
528*f11c7f63SJim Harris     SMP_REQUEST_PHY_IDENTIFIER_T                discover;
529*f11c7f63SJim Harris     SMP_REQUEST_GENERAL_T                       report_manufacturer_information;
530*f11c7f63SJim Harris     SMP_REQUEST_PHY_IDENTIFIER_T                report_phy_sata;
531*f11c7f63SJim Harris     SMP_REQUEST_PHY_CONTROL_T                   phy_control;
532*f11c7f63SJim Harris     SMP_REQUEST_PHY_IDENTIFIER_T                report_phy_error_log;
533*f11c7f63SJim Harris     SMP_REQUEST_PHY_IDENTIFIER_T                report_route_information;
534*f11c7f63SJim Harris     SMP_REQUEST_CONFIGURE_ROUTE_INFORMATION_T   configure_route_information;
535*f11c7f63SJim Harris     SMP_REQUEST_VENDOR_SPECIFIC_T               vendor_specific_request;
536*f11c7f63SJim Harris   } request;
537*f11c7f63SJim Harris 
538*f11c7f63SJim Harris } SMP_REQUEST_T;
539*f11c7f63SJim Harris 
540*f11c7f63SJim Harris 
541*f11c7f63SJim Harris /**
542*f11c7f63SJim Harris  * @struct SMP_RESPONSE_REPORT_GENERAL
543*f11c7f63SJim Harris  * @brief  This structure depicts the SMP Report General for
544*f11c7f63SJim Harris  *         expander devices.  It adheres to the SAS-2.1 specification.
545*f11c7f63SJim Harris  *         @note For specific information on each of these
546*f11c7f63SJim Harris  *               individual fields please reference the SAS specification
547*f11c7f63SJim Harris  *               Application layer section on SMP.
548*f11c7f63SJim Harris  */
549*f11c7f63SJim Harris typedef struct SMP_RESPONSE_REPORT_GENERAL
550*f11c7f63SJim Harris {
551*f11c7f63SJim Harris   U16 expander_change_count;  //byte 4-5
552*f11c7f63SJim Harris   U16 expander_route_indexes; //byte 6-7
553*f11c7f63SJim Harris 
554*f11c7f63SJim Harris   U32 reserved_byte8:7;        //byte 8 bit 0-6
555*f11c7f63SJim Harris   U32 long_response:1;         //byte 8 bit 7
556*f11c7f63SJim Harris 
557*f11c7f63SJim Harris   U32 number_of_phys:8;        //byte 9
558*f11c7f63SJim Harris 
559*f11c7f63SJim Harris   U32 configurable_route_table:1; //byte 10
560*f11c7f63SJim Harris   U32 configuring:1;
561*f11c7f63SJim Harris   U32 configures_others:1;
562*f11c7f63SJim Harris   U32 open_reject_retry_supported:1;
563*f11c7f63SJim Harris   U32 stp_continue_awt:1;
564*f11c7f63SJim Harris   U32 self_configuring:1;
565*f11c7f63SJim Harris   U32 zone_configuring:1;
566*f11c7f63SJim Harris   U32 table_to_table_supported:1;
567*f11c7f63SJim Harris 
568*f11c7f63SJim Harris   U32 reserved_byte11:8;       //byte 11
569*f11c7f63SJim Harris 
570*f11c7f63SJim Harris   U32 enclosure_logical_identifier_high; //byte 12-15
571*f11c7f63SJim Harris   U32 enclosure_logical_identifier_low;  //byte 16-19
572*f11c7f63SJim Harris 
573*f11c7f63SJim Harris   U32 reserved_byte20_23;
574*f11c7f63SJim Harris   U32 reserved_byte24_27;
575*f11c7f63SJim Harris 
576*f11c7f63SJim Harris } SMP_RESPONSE_REPORT_GENERAL_T;
577*f11c7f63SJim Harris 
578*f11c7f63SJim Harris typedef struct SMP_RESPONSE_REPORT_GENERAL_LONG
579*f11c7f63SJim Harris {
580*f11c7f63SJim Harris    SMP_RESPONSE_REPORT_GENERAL_T sas1_1;
581*f11c7f63SJim Harris 
582*f11c7f63SJim Harris    struct
583*f11c7f63SJim Harris    {
584*f11c7f63SJim Harris       U16 reserved1;
585*f11c7f63SJim Harris       U16 stp_bus_inactivity_time_limit;
586*f11c7f63SJim Harris       U16 stp_max_connect_time_limit;
587*f11c7f63SJim Harris       U16 stp_smp_i_t_nexus_loss_time;
588*f11c7f63SJim Harris 
589*f11c7f63SJim Harris       U32 zoning_enabled                         : 1;
590*f11c7f63SJim Harris       U32 zoning_supported                       : 1;
591*f11c7f63SJim Harris       U32 physicaL_presence_asserted             : 1;
592*f11c7f63SJim Harris       U32 zone_locked                            : 1;
593*f11c7f63SJim Harris       U32 reserved2                              : 1;
594*f11c7f63SJim Harris       U32 num_zone_groups                        : 3;
595*f11c7f63SJim Harris       U32 saving_zoning_enabled_supported        : 3;
596*f11c7f63SJim Harris       U32 saving_zone_perms_table_supported      : 1;
597*f11c7f63SJim Harris       U32 saving_zone_phy_info_supported         : 1;
598*f11c7f63SJim Harris       U32 saving_zone_manager_password_supported : 1;
599*f11c7f63SJim Harris       U32 saving                                 : 1;
600*f11c7f63SJim Harris       U32 reserved3                              : 1;
601*f11c7f63SJim Harris       U32 max_number_routed_sas_addresses        : 16;
602*f11c7f63SJim Harris 
603*f11c7f63SJim Harris       SCI_SAS_ADDRESS_T active_zone_manager_sas_address;
604*f11c7f63SJim Harris 
605*f11c7f63SJim Harris       U16 zone_lock_inactivity_time_limit;
606*f11c7f63SJim Harris       U16 reserved4;
607*f11c7f63SJim Harris 
608*f11c7f63SJim Harris       U8 reserved5;
609*f11c7f63SJim Harris       U8 first_enclosure_connector_element_index;
610*f11c7f63SJim Harris       U8 number_of_enclosure_connector_element_indices;
611*f11c7f63SJim Harris       U8 reserved6;
612*f11c7f63SJim Harris 
613*f11c7f63SJim Harris       U32 reserved7                            : 7;
614*f11c7f63SJim Harris       U32 reduced_functionality                : 1;
615*f11c7f63SJim Harris       U32 time_to_reduce_functionality         : 8;
616*f11c7f63SJim Harris       U32 initial_time_to_reduce_functionality : 8;
617*f11c7f63SJim Harris       U8  max_reduced_functionality_time;
618*f11c7f63SJim Harris 
619*f11c7f63SJim Harris       U16 last_self_config_status_descriptor_index;
620*f11c7f63SJim Harris       U16 max_number_of_stored_self_config_status_descriptors;
621*f11c7f63SJim Harris 
622*f11c7f63SJim Harris       U16 last_phy_event_list_descriptor_index;
623*f11c7f63SJim Harris       U16 max_number_of_stored_phy_event_list_descriptors;
624*f11c7f63SJim Harris    } sas2;
625*f11c7f63SJim Harris 
626*f11c7f63SJim Harris } SMP_RESPONSE_REPORT_GENERAL_LONG_T;
627*f11c7f63SJim Harris 
628*f11c7f63SJim Harris /**
629*f11c7f63SJim Harris  * @struct SMP_RESPONSE_REPORT_MANUFACTURER_INFORMATION
630*f11c7f63SJim Harris  * @brief  This structure depicts the SMP report manufacturer
631*f11c7f63SJim Harris  *         information for expander devices.  It adheres to the
632*f11c7f63SJim Harris  *         SAS-2.1 specification.
633*f11c7f63SJim Harris  *         @note For specific information on each of these
634*f11c7f63SJim Harris  *               individual fields please reference the SAS specification
635*f11c7f63SJim Harris  *               Application layer section on SMP.
636*f11c7f63SJim Harris  */
637*f11c7f63SJim Harris typedef struct SMP_RESPONSE_REPORT_MANUFACTURER_INFORMATION
638*f11c7f63SJim Harris {
639*f11c7f63SJim Harris   U32 expander_change_count : 16;    // bytes 4-5
640*f11c7f63SJim Harris   U32 reserved1             : 16;
641*f11c7f63SJim Harris 
642*f11c7f63SJim Harris   U32 sas1_1_format         : 1;
643*f11c7f63SJim Harris   U32 reserved2             : 31;
644*f11c7f63SJim Harris 
645*f11c7f63SJim Harris   U8  vendor_id[8];
646*f11c7f63SJim Harris   U8  product_id[16];
647*f11c7f63SJim Harris   U8  product_revision_level[4];
648*f11c7f63SJim Harris   U8  component_vendor_id[8];
649*f11c7f63SJim Harris   U8  component_id[2];
650*f11c7f63SJim Harris   U8  component_revision_level;
651*f11c7f63SJim Harris   U8  reserved3;
652*f11c7f63SJim Harris   U8  vendor_specific[8];
653*f11c7f63SJim Harris 
654*f11c7f63SJim Harris } SMP_RESPONSE_REPORT_MANUFACTURER_INFORMATION_T;
655*f11c7f63SJim Harris 
656*f11c7f63SJim Harris #define SMP_RESPONSE_DISCOVER_FORMAT_1_1_SIZE 52
657*f11c7f63SJim Harris #define SMP_RESPONSE_DISCOVER_FORMAT_2_SIZE   116
658*f11c7f63SJim Harris 
659*f11c7f63SJim Harris /**
660*f11c7f63SJim Harris  * @struct SMP_DISCOVER_RESPONSE_PROTOCOLS
661*f11c7f63SJim Harris  * @brief  This structure depicts the discover response where the
662*f11c7f63SJim Harris  *         supported protocols by the remote phy are specified.
663*f11c7f63SJim Harris  *         @note For specific information on each of these
664*f11c7f63SJim Harris  *               individual fields please reference the SAS specification
665*f11c7f63SJim Harris  *               Link layer section on address frames.
666*f11c7f63SJim Harris  */
667*f11c7f63SJim Harris typedef struct SMP_DISCOVER_RESPONSE_PROTOCOLS
668*f11c7f63SJim Harris {
669*f11c7f63SJim Harris    union
670*f11c7f63SJim Harris    {
671*f11c7f63SJim Harris       struct
672*f11c7f63SJim Harris       {
673*f11c7f63SJim Harris          U16  attached_sata_host           : 1;
674*f11c7f63SJim Harris          U16  attached_smp_initiator       : 1;
675*f11c7f63SJim Harris          U16  attached_stp_initiator       : 1;
676*f11c7f63SJim Harris          U16  attached_ssp_initiator       : 1;
677*f11c7f63SJim Harris          U16  reserved3                    : 4;
678*f11c7f63SJim Harris          U16  attached_sata_device         : 1;
679*f11c7f63SJim Harris          U16  attached_smp_target          : 1;
680*f11c7f63SJim Harris          U16  attached_stp_target          : 1;
681*f11c7f63SJim Harris          U16  attached_ssp_target          : 1;
682*f11c7f63SJim Harris          U16  reserved4                    : 3;
683*f11c7f63SJim Harris          U16  attached_sata_port_selector  : 1;
684*f11c7f63SJim Harris       } bits;
685*f11c7f63SJim Harris 
686*f11c7f63SJim Harris       U16 all;
687*f11c7f63SJim Harris    } u;
688*f11c7f63SJim Harris 
689*f11c7f63SJim Harris } SMP_DISCOVER_RESPONSE_PROTOCOLS_T;
690*f11c7f63SJim Harris 
691*f11c7f63SJim Harris /**
692*f11c7f63SJim Harris  * @struct SMP_RESPONSE_DISCOVER_FORMAT
693*f11c7f63SJim Harris  * @brief  This structure defines the SMP phy discover response format.
694*f11c7f63SJim Harris  *         It handles both SAS1.1 and SAS 2 definitions.  The unions
695*f11c7f63SJim Harris  *         indicate locations where the SAS specification versions
696*f11c7f63SJim Harris  *         differ from one another.
697*f11c7f63SJim Harris  */
698*f11c7f63SJim Harris typedef struct SMP_RESPONSE_DISCOVER
699*f11c7f63SJim Harris {
700*f11c7f63SJim Harris 
701*f11c7f63SJim Harris    union
702*f11c7f63SJim Harris    {
703*f11c7f63SJim Harris       struct
704*f11c7f63SJim Harris       {
705*f11c7f63SJim Harris          U8 reserved[2];
706*f11c7f63SJim Harris       } sas1_1;
707*f11c7f63SJim Harris 
708*f11c7f63SJim Harris       struct
709*f11c7f63SJim Harris       {
710*f11c7f63SJim Harris          U16  expander_change_count;
711*f11c7f63SJim Harris       } sas2;
712*f11c7f63SJim Harris 
713*f11c7f63SJim Harris    } u1;
714*f11c7f63SJim Harris 
715*f11c7f63SJim Harris    U8   reserved1[3];
716*f11c7f63SJim Harris    U8   phy_identifier;
717*f11c7f63SJim Harris    U8   reserved2[2];
718*f11c7f63SJim Harris 
719*f11c7f63SJim Harris    union
720*f11c7f63SJim Harris    {
721*f11c7f63SJim Harris       struct
722*f11c7f63SJim Harris       {
723*f11c7f63SJim Harris          U16  reserved1                     : 4;
724*f11c7f63SJim Harris          U16  attached_device_type          : 3;
725*f11c7f63SJim Harris          U16  reserved2                     : 1;
726*f11c7f63SJim Harris          U16  negotiated_physical_link_rate : 4;
727*f11c7f63SJim Harris          U16  reserved3                     : 4;
728*f11c7f63SJim Harris       } sas1_1;
729*f11c7f63SJim Harris 
730*f11c7f63SJim Harris       struct
731*f11c7f63SJim Harris       {
732*f11c7f63SJim Harris          U16  attached_reason              : 4;
733*f11c7f63SJim Harris          U16  attached_device_type         : 3;
734*f11c7f63SJim Harris          U16  reserved2                    : 1;
735*f11c7f63SJim Harris          U16  negotiated_logical_link_rate : 4;
736*f11c7f63SJim Harris          U16  reserved3                    : 4;
737*f11c7f63SJim Harris       } sas2;
738*f11c7f63SJim Harris 
739*f11c7f63SJim Harris    } u2;
740*f11c7f63SJim Harris 
741*f11c7f63SJim Harris    SMP_DISCOVER_RESPONSE_PROTOCOLS_T protocols;
742*f11c7f63SJim Harris    SCI_SAS_ADDRESS_T  sas_address;
743*f11c7f63SJim Harris    SCI_SAS_ADDRESS_T  attached_sas_address;
744*f11c7f63SJim Harris 
745*f11c7f63SJim Harris    U8   attached_phy_identifier;
746*f11c7f63SJim Harris 
747*f11c7f63SJim Harris    union
748*f11c7f63SJim Harris    {
749*f11c7f63SJim Harris       struct
750*f11c7f63SJim Harris       {
751*f11c7f63SJim Harris          U8   reserved;
752*f11c7f63SJim Harris       } sas1_1;
753*f11c7f63SJim Harris 
754*f11c7f63SJim Harris       struct
755*f11c7f63SJim Harris       {
756*f11c7f63SJim Harris          U8   attached_break_reply_capable     : 1;
757*f11c7f63SJim Harris          U8   attached_requested_inside_zpsds  : 1;
758*f11c7f63SJim Harris          U8   attached_inside_zpsds_persistent : 1;
759*f11c7f63SJim Harris          U8   reserved1                        : 5;
760*f11c7f63SJim Harris       } sas2;
761*f11c7f63SJim Harris 
762*f11c7f63SJim Harris    } u3;
763*f11c7f63SJim Harris 
764*f11c7f63SJim Harris    U8   reserved_for_identify[6];
765*f11c7f63SJim Harris 
766*f11c7f63SJim Harris    U32  hardware_min_physical_link_rate   : 4;
767*f11c7f63SJim Harris    U32  programmed_min_physical_link_rate : 4;
768*f11c7f63SJim Harris    U32  hardware_max_physical_link_rate   : 4;
769*f11c7f63SJim Harris    U32  programmed_max_physical_link_rate : 4;
770*f11c7f63SJim Harris    U32  phy_change_count                  : 8;
771*f11c7f63SJim Harris    U32  partial_pathway_timeout_value     : 4;
772*f11c7f63SJim Harris    U32  reserved5                         : 3;
773*f11c7f63SJim Harris    U32  virtual_phy                       : 1;
774*f11c7f63SJim Harris 
775*f11c7f63SJim Harris    U32  routing_attribute                 : 4;
776*f11c7f63SJim Harris    U32  reserved6                         : 4;
777*f11c7f63SJim Harris    U32  connector_type                    : 7;
778*f11c7f63SJim Harris    U32  reserved7                         : 1;
779*f11c7f63SJim Harris    U32  connector_element_index           : 8;
780*f11c7f63SJim Harris    U32  connector_physical_link           : 8;
781*f11c7f63SJim Harris 
782*f11c7f63SJim Harris    U16  reserved8;
783*f11c7f63SJim Harris    U16  vendor_specific;
784*f11c7f63SJim Harris 
785*f11c7f63SJim Harris    union
786*f11c7f63SJim Harris    {
787*f11c7f63SJim Harris       struct
788*f11c7f63SJim Harris       {
789*f11c7f63SJim Harris          /**
790*f11c7f63SJim Harris           * In the SAS 1.1 specification this structure ends after 52 bytes.
791*f11c7f63SJim Harris           * As a result, the contents of this field should never have a
792*f11c7f63SJim Harris           * real value.  It is undefined.
793*f11c7f63SJim Harris           */
794*f11c7f63SJim Harris          U8 undefined[SMP_RESPONSE_DISCOVER_FORMAT_2_SIZE
795*f11c7f63SJim Harris                       - SMP_RESPONSE_DISCOVER_FORMAT_1_1_SIZE];
796*f11c7f63SJim Harris       } sas1_1;
797*f11c7f63SJim Harris 
798*f11c7f63SJim Harris       struct
799*f11c7f63SJim Harris       {
800*f11c7f63SJim Harris          SCI_SAS_ADDRESS_T attached_device_name;
801*f11c7f63SJim Harris 
802*f11c7f63SJim Harris          U32  zoning_enabled                             : 1;
803*f11c7f63SJim Harris          U32  inside_zpsds                               : 1;
804*f11c7f63SJim Harris          U32  zone_group_persistent                      : 1;
805*f11c7f63SJim Harris          U32  reserved1                                  : 1;
806*f11c7f63SJim Harris          U32  requested_inside_zpsds                     : 1;
807*f11c7f63SJim Harris          U32  inside_zpsds_persistent                    : 1;
808*f11c7f63SJim Harris          U32  requested_inside_zpsds_changed_by_expander : 1;
809*f11c7f63SJim Harris          U32  reserved2                                  : 1;
810*f11c7f63SJim Harris          U32  reserved_for_zoning_fields                 : 16;
811*f11c7f63SJim Harris          U32  zone_group                                 : 8;
812*f11c7f63SJim Harris 
813*f11c7f63SJim Harris          U8   self_configuration_status;
814*f11c7f63SJim Harris          U8   self_configuration_levels_completed;
815*f11c7f63SJim Harris          U16  reserved_for_self_config_fields;
816*f11c7f63SJim Harris 
817*f11c7f63SJim Harris          SCI_SAS_ADDRESS_T self_configuration_sas_address;
818*f11c7f63SJim Harris 
819*f11c7f63SJim Harris          U32  programmed_phy_capabilities;
820*f11c7f63SJim Harris          U32  current_phy_capabilities;
821*f11c7f63SJim Harris          U32  attached_phy_capabilities;
822*f11c7f63SJim Harris 
823*f11c7f63SJim Harris          U32  reserved3;
824*f11c7f63SJim Harris 
825*f11c7f63SJim Harris          U32  reserved4                     : 16;
826*f11c7f63SJim Harris          U32  negotiated_physical_link_rate : 4;
827*f11c7f63SJim Harris          U32  reason                        : 4;
828*f11c7f63SJim Harris          U32  hardware_muxing_supported     : 1;
829*f11c7f63SJim Harris          U32  negotiated_ssc                : 1;
830*f11c7f63SJim Harris          U32  reserved5                     : 6;
831*f11c7f63SJim Harris 
832*f11c7f63SJim Harris          U32  default_zoning_enabled          : 1;
833*f11c7f63SJim Harris          U32  reserved6                       : 1;
834*f11c7f63SJim Harris          U32  default_zone_group_persistent   : 1;
835*f11c7f63SJim Harris          U32  reserved7                       : 1;
836*f11c7f63SJim Harris          U32  default_requested_inside_zpsds  : 1;
837*f11c7f63SJim Harris          U32  default_inside_zpsds_persistent : 1;
838*f11c7f63SJim Harris          U32  reserved8                       : 2;
839*f11c7f63SJim Harris          U32  reserved9                       : 16;
840*f11c7f63SJim Harris          U32  default_zone_group              : 8;
841*f11c7f63SJim Harris 
842*f11c7f63SJim Harris          U32  saved_zoning_enabled          : 1;
843*f11c7f63SJim Harris          U32  reserved10                    : 1;
844*f11c7f63SJim Harris          U32  saved_zone_group_persistent   : 1;
845*f11c7f63SJim Harris          U32  reserved11                    : 1;
846*f11c7f63SJim Harris          U32  saved_requested_inside_zpsds  : 1;
847*f11c7f63SJim Harris          U32  saved_inside_zpsds_persistent : 1;
848*f11c7f63SJim Harris          U32  reserved12                    : 18;
849*f11c7f63SJim Harris          U32  saved_zone_group              : 8;
850*f11c7f63SJim Harris 
851*f11c7f63SJim Harris          U32  reserved14                     : 2;
852*f11c7f63SJim Harris          U32  shadow_zone_group_persistent   : 1;
853*f11c7f63SJim Harris          U32  reserved15                     : 1;
854*f11c7f63SJim Harris          U32  shadow_requested_inside_zpsds  : 1;
855*f11c7f63SJim Harris          U32  shadow_inside_zpsds_persistent : 1;
856*f11c7f63SJim Harris          U32  reserved16                     : 18;
857*f11c7f63SJim Harris          U32  shadow_zone_group              : 8;
858*f11c7f63SJim Harris 
859*f11c7f63SJim Harris          U8   device_slot_number;
860*f11c7f63SJim Harris          U8   device_slot_group_number;
861*f11c7f63SJim Harris          U8   device_slot_group_output_connector[6];
862*f11c7f63SJim Harris       } sas2;
863*f11c7f63SJim Harris 
864*f11c7f63SJim Harris    } u4;
865*f11c7f63SJim Harris 
866*f11c7f63SJim Harris } SMP_RESPONSE_DISCOVER_T;
867*f11c7f63SJim Harris 
868*f11c7f63SJim Harris /**
869*f11c7f63SJim Harris  * @struct SMP_RESPONSE_REPORT_PHY_SATA
870*f11c7f63SJim Harris  * @brief  This structure depicts the contents of the SAS SMP REPORT
871*f11c7f63SJim Harris  *         PHY SATA frame.  For specific information on each of these
872*f11c7f63SJim Harris  *         individual fields please reference the SAS specification Link
873*f11c7f63SJim Harris  *         layer section on address frames.
874*f11c7f63SJim Harris  */
875*f11c7f63SJim Harris typedef struct SMP_RESPONSE_REPORT_PHY_SATA
876*f11c7f63SJim Harris {
877*f11c7f63SJim Harris   U32 ignored_byte_4_7;       // bytes 4-7
878*f11c7f63SJim Harris 
879*f11c7f63SJim Harris   U32  affiliations_valid:1;
880*f11c7f63SJim Harris   U32  affiliations_supported:1;
881*f11c7f63SJim Harris   U32  reserved_byte11:6;     // byte 11
882*f11c7f63SJim Harris   U32  ignored_byte10:8;      // byte 10
883*f11c7f63SJim Harris   U32  phy_identifier:8;      // byte  9
884*f11c7f63SJim Harris   U32  reserved_byte_8:8;     // byte  8
885*f11c7f63SJim Harris 
886*f11c7f63SJim Harris   U32  reserved_12_15;
887*f11c7f63SJim Harris   U32  stp_sas_address[2];
888*f11c7f63SJim Harris   U8   device_to_host_fis[20];
889*f11c7f63SJim Harris   U32  reserved_44_47;
890*f11c7f63SJim Harris   U32  affiliated_stp_initiator_sas_address[2];
891*f11c7f63SJim Harris 
892*f11c7f63SJim Harris } SMP_RESPONSE_REPORT_PHY_SATA_T;
893*f11c7f63SJim Harris 
894*f11c7f63SJim Harris typedef struct SMP_RESPONSE_VENDOR_SPECIFIC
895*f11c7f63SJim Harris {
896*f11c7f63SJim Harris    U8 response_bytes[SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH];
897*f11c7f63SJim Harris }SMP_RESPONSE_VENDOR_SPECIFIC_T;
898*f11c7f63SJim Harris 
899*f11c7f63SJim Harris typedef union SMP_RESPONSE_BODY
900*f11c7f63SJim Harris {
901*f11c7f63SJim Harris    SMP_RESPONSE_REPORT_GENERAL_T report_general;
902*f11c7f63SJim Harris    SMP_RESPONSE_REPORT_MANUFACTURER_INFORMATION_T report_manufacturer_information;
903*f11c7f63SJim Harris    SMP_RESPONSE_DISCOVER_T discover;
904*f11c7f63SJim Harris    SMP_RESPONSE_REPORT_PHY_SATA_T report_phy_sata;
905*f11c7f63SJim Harris    SMP_RESPONSE_VENDOR_SPECIFIC_T vendor_specific_response;
906*f11c7f63SJim Harris } SMP_RESPONSE_BODY_T;
907*f11c7f63SJim Harris 
908*f11c7f63SJim Harris /**
909*f11c7f63SJim Harris  * @struct SMP_RESPONSE
910*f11c7f63SJim Harris  * @brief  This structure simply unionizes the existing response
911*f11c7f63SJim Harris  *         structures into a common response type.
912*f11c7f63SJim Harris  */
913*f11c7f63SJim Harris typedef struct _SMP_RESPONSE
914*f11c7f63SJim Harris {
915*f11c7f63SJim Harris    SMP_RESPONSE_HEADER_T header;
916*f11c7f63SJim Harris 
917*f11c7f63SJim Harris    SMP_RESPONSE_BODY_T   response;
918*f11c7f63SJim Harris 
919*f11c7f63SJim Harris } SMP_RESPONSE_T;
920*f11c7f63SJim Harris 
921*f11c7f63SJim Harris // SMP Request Functions
922*f11c7f63SJim Harris #define SMP_FUNCTION_REPORT_GENERAL                   0x00
923*f11c7f63SJim Harris #define SMP_FUNCTION_REPORT_MANUFACTURER_INFORMATION  0x01
924*f11c7f63SJim Harris #define SMP_FUNCTION_DISCOVER                         0x10
925*f11c7f63SJim Harris #define SMP_FUNCTION_REPORT_PHY_ERROR_LOG             0x11
926*f11c7f63SJim Harris #define SMP_FUNCTION_REPORT_PHY_SATA                  0x12
927*f11c7f63SJim Harris #define SMP_FUNCTION_REPORT_ROUTE_INFORMATION         0X13
928*f11c7f63SJim Harris #define SMP_FUNCTION_CONFIGURE_ROUTE_INFORMATION      0X90
929*f11c7f63SJim Harris #define SMP_FUNCTION_PHY_CONTROL                      0x91
930*f11c7f63SJim Harris #define SMP_FUNCTION_PHY_TEST                         0x92
931*f11c7f63SJim Harris 
932*f11c7f63SJim Harris #define SMP_FRAME_TYPE_REQUEST          0x40
933*f11c7f63SJim Harris #define SMP_FRAME_TYPE_RESPONSE         0x41
934*f11c7f63SJim Harris 
935*f11c7f63SJim Harris #define PHY_OPERATION_NOP               0x00
936*f11c7f63SJim Harris #define PHY_OPERATION_LINK_RESET        0x01
937*f11c7f63SJim Harris #define PHY_OPERATION_HARD_RESET        0x02
938*f11c7f63SJim Harris #define PHY_OPERATION_DISABLE           0x03
939*f11c7f63SJim Harris #define PHY_OPERATION_CLEAR_ERROR_LOG   0x05
940*f11c7f63SJim Harris #define PHY_OPERATION_CLEAR_AFFILIATION 0x06
941*f11c7f63SJim Harris 
942*f11c7f63SJim Harris #define NPLR_PHY_ENABLED_UNK_LINK_RATE 0x00
943*f11c7f63SJim Harris #define NPLR_PHY_DISABLED     0x01
944*f11c7f63SJim Harris #define NPLR_PHY_ENABLED_SPD_NEG_FAILED   0x02
945*f11c7f63SJim Harris #define NPLR_PHY_ENABLED_SATA_HOLD  0x03
946*f11c7f63SJim Harris #define NPLR_PHY_ENABLED_1_5G    0x08
947*f11c7f63SJim Harris #define NPLR_PHY_ENABLED_3_0G    0x09
948*f11c7f63SJim Harris 
949*f11c7f63SJim Harris // SMP Function Result values.
950*f11c7f63SJim Harris #define SMP_RESULT_FUNCTION_ACCEPTED              0x00
951*f11c7f63SJim Harris #define SMP_RESULT_UNKNOWN_FUNCTION               0x01
952*f11c7f63SJim Harris #define SMP_RESULT_FUNCTION_FAILED                0x02
953*f11c7f63SJim Harris #define SMP_RESULT_INVALID_REQUEST_FRAME_LEN      0x03
954*f11c7f63SJim Harris #define SMP_RESULT_INAVALID_EXPANDER_CHANGE_COUNT 0x04
955*f11c7f63SJim Harris #define SMP_RESULT_BUSY                           0x05
956*f11c7f63SJim Harris #define SMP_RESULT_INCOMPLETE_DESCRIPTOR_LIST     0x06
957*f11c7f63SJim Harris #define SMP_RESULT_PHY_DOES_NOT_EXIST             0x10
958*f11c7f63SJim Harris #define SMP_RESULT_INDEX_DOES_NOT_EXIST           0x11
959*f11c7f63SJim Harris #define SMP_RESULT_PHY_DOES_NOT_SUPPORT_SATA      0x12
960*f11c7f63SJim Harris #define SMP_RESULT_UNKNOWN_PHY_OPERATION          0x13
961*f11c7f63SJim Harris #define SMP_RESULT_UNKNOWN_PHY_TEST_FUNCTION      0x14
962*f11c7f63SJim Harris #define SMP_RESULT_PHY_TEST_IN_PROGRESS           0x15
963*f11c7f63SJim Harris #define SMP_RESULT_PHY_VACANT                     0x16
964*f11c7f63SJim Harris 
965*f11c7f63SJim Harris /* Attached Device Types */
966*f11c7f63SJim Harris #define SMP_NO_DEVICE_ATTACHED      0
967*f11c7f63SJim Harris #define SMP_END_DEVICE_ONLY         1
968*f11c7f63SJim Harris #define SMP_EDGE_EXPANDER_DEVICE    2
969*f11c7f63SJim Harris #define SMP_FANOUT_EXPANDER_DEVICE  3
970*f11c7f63SJim Harris 
971*f11c7f63SJim Harris /* Expander phy routine attribute */
972*f11c7f63SJim Harris #define DIRECT_ROUTING_ATTRIBUTE        0
973*f11c7f63SJim Harris #define SUBTRACTIVE_ROUTING_ATTRIBUTE   1
974*f11c7f63SJim Harris #define TABLE_ROUTING_ATTRIBUTE         2
975*f11c7f63SJim Harris 
976*f11c7f63SJim Harris #endif // _INTEL_SAS_H_
977*f11c7f63SJim Harris 
978