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