1230557Sjimharris/*-
2230557Sjimharris * This file is provided under a dual BSD/GPLv2 license.  When using or
3230557Sjimharris * redistributing this file, you may do so under either license.
4230557Sjimharris *
5230557Sjimharris * GPL LICENSE SUMMARY
6230557Sjimharris *
7230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8230557Sjimharris *
9230557Sjimharris * This program is free software; you can redistribute it and/or modify
10230557Sjimharris * it under the terms of version 2 of the GNU General Public License as
11230557Sjimharris * published by the Free Software Foundation.
12230557Sjimharris *
13230557Sjimharris * This program is distributed in the hope that it will be useful, but
14230557Sjimharris * WITHOUT ANY WARRANTY; without even the implied warranty of
15230557Sjimharris * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16230557Sjimharris * General Public License for more details.
17230557Sjimharris *
18230557Sjimharris * You should have received a copy of the GNU General Public License
19230557Sjimharris * along with this program; if not, write to the Free Software
20230557Sjimharris * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21230557Sjimharris * The full GNU General Public License is included in this distribution
22230557Sjimharris * in the file called LICENSE.GPL.
23230557Sjimharris *
24230557Sjimharris * BSD LICENSE
25230557Sjimharris *
26230557Sjimharris * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
27230557Sjimharris * All rights reserved.
28230557Sjimharris *
29230557Sjimharris * Redistribution and use in source and binary forms, with or without
30230557Sjimharris * modification, are permitted provided that the following conditions
31230557Sjimharris * are met:
32230557Sjimharris *
33230557Sjimharris *   * Redistributions of source code must retain the above copyright
34230557Sjimharris *     notice, this list of conditions and the following disclaimer.
35230557Sjimharris *   * Redistributions in binary form must reproduce the above copyright
36230557Sjimharris *     notice, this list of conditions and the following disclaimer in
37230557Sjimharris *     the documentation and/or other materials provided with the
38230557Sjimharris *     distribution.
39230557Sjimharris *
40230557Sjimharris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41230557Sjimharris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42230557Sjimharris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43230557Sjimharris * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44230557Sjimharris * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45230557Sjimharris * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46230557Sjimharris * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47230557Sjimharris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48230557Sjimharris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49230557Sjimharris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50230557Sjimharris * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51230557Sjimharris *
52230557Sjimharris * $FreeBSD$
53230557Sjimharris */
54230557Sjimharris#ifndef _INTEL_SAS_H_
55230557Sjimharris#define _INTEL_SAS_H_
56230557Sjimharris
57230557Sjimharris/**
58230557Sjimharris * @file
59230557Sjimharris *
60230557Sjimharris * @brief This file contains all of the definitions relating to structures,
61230557Sjimharris *        constants, etc. defined by the SAS specification.
62230557Sjimharris */
63230557Sjimharris
64230557Sjimharris#include <dev/isci/types.h>
65230557Sjimharris#include <dev/isci/scil/intel_sata.h>
66230557Sjimharris#include <dev/isci/scil/intel_scsi.h>
67230557Sjimharris
68230557Sjimharris/**
69230557Sjimharris * @struct SCI_SAS_ADDRESS
70230557Sjimharris * @brief  This structure depicts how a SAS address is represented by SCI.
71230557Sjimharris */
72230557Sjimharristypedef struct SCI_SAS_ADDRESS
73230557Sjimharris{
74230557Sjimharris   /**
75230557Sjimharris    * This member contains the higher 32-bits of the SAS address.
76230557Sjimharris    */
77230557Sjimharris   U32 high;
78230557Sjimharris
79230557Sjimharris   /**
80230557Sjimharris    * This member contains the lower 32-bits of the SAS address.
81230557Sjimharris    */
82230557Sjimharris   U32 low;
83230557Sjimharris
84230557Sjimharris} SCI_SAS_ADDRESS_T;
85230557Sjimharris
86230557Sjimharris/**
87230557Sjimharris * @struct SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS
88230557Sjimharris * @brief  This structure depicts the contents of bytes 2 and 3 in the
89230557Sjimharris *         SAS IDENTIFY ADDRESS FRAME (IAF).
90230557Sjimharris *         @note For specific information on each of these
91230557Sjimharris *               individual fields please reference the SAS specification
92230557Sjimharris *               Link layer section on address frames.
93230557Sjimharris */
94230557Sjimharristypedef struct SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS
95230557Sjimharris{
96230557Sjimharris   union
97230557Sjimharris   {
98230557Sjimharris      struct
99230557Sjimharris      {
100230557Sjimharris         U16  restricted1        : 1;
101230557Sjimharris         U16  smp_initiator      : 1;
102230557Sjimharris         U16  stp_initiator      : 1;
103230557Sjimharris         U16  ssp_initiator      : 1;
104230557Sjimharris         U16  reserved3          : 4;
105230557Sjimharris         U16  restricted2        : 1;
106230557Sjimharris         U16  smp_target         : 1;
107230557Sjimharris         U16  stp_target         : 1;
108230557Sjimharris         U16  ssp_target         : 1;
109230557Sjimharris         U16  reserved4          : 4;
110230557Sjimharris      } bits;
111230557Sjimharris
112230557Sjimharris      U16 all;
113230557Sjimharris   } u;
114230557Sjimharris
115230557Sjimharris} SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS_T;
116230557Sjimharris
117230557Sjimharris/**
118230557Sjimharris * @struct SCI_SAS_IDENTIFY_ADDRESS_FRAME
119230557Sjimharris * @brief  This structure depicts the contents of the SAS IDENTIFY ADDRESS
120230557Sjimharris *         FRAME (IAF).
121230557Sjimharris *         @note For specific information on each of these
122230557Sjimharris *               individual fields please reference the SAS specification
123230557Sjimharris *               Link layer section on address frames.
124230557Sjimharris */
125230557Sjimharristypedef struct SCI_SAS_IDENTIFY_ADDRESS_FRAME
126230557Sjimharris{
127230557Sjimharris   U16  address_frame_type : 4;
128230557Sjimharris   U16  device_type        : 3;
129230557Sjimharris   U16  reserved1          : 1;
130230557Sjimharris   U16  reason             : 4;
131230557Sjimharris   U16  reserved2          : 4;
132230557Sjimharris
133230557Sjimharris   SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS_T protocols;
134230557Sjimharris
135230557Sjimharris   SCI_SAS_ADDRESS_T  device_name;
136230557Sjimharris   SCI_SAS_ADDRESS_T  sas_address;
137230557Sjimharris
138230557Sjimharris   U32  phy_identifier      : 8;
139230557Sjimharris   U32  break_reply_capable : 1;
140230557Sjimharris   U32  requested_in_zpsds  : 1;
141230557Sjimharris   U32  in_zpsds_persistent : 1;
142230557Sjimharris   U32  reserved5           : 21;
143230557Sjimharris
144230557Sjimharris   U32  reserved6[4];
145230557Sjimharris
146230557Sjimharris} SCI_SAS_IDENTIFY_ADDRESS_FRAME_T;
147230557Sjimharris
148230557Sjimharris/**
149230557Sjimharris * @struct SAS_CAPABILITIES
150230557Sjimharris * @brief  This structure depicts the various SAS capabilities supported
151230557Sjimharris *         by the directly attached target device.  For specific information
152230557Sjimharris *         on each of these individual fields please reference the SAS
153230557Sjimharris *         specification Phy layer section on speed negotiation windows.
154230557Sjimharris */
155230557Sjimharristypedef struct SAS_CAPABILITIES
156230557Sjimharris{
157230557Sjimharris   union
158230557Sjimharris   {
159230557Sjimharris#if defined (SCIC_SDS_4_ENABLED)
160230557Sjimharris      struct
161230557Sjimharris      {
162230557Sjimharris         /**
163230557Sjimharris          * The SAS specification indicates the start bit shall always be set to
164230557Sjimharris          * 1.  This implementation will have the start bit set to 0 if the
165230557Sjimharris          * PHY CAPABILITIES were either not received or speed negotiation failed.
166230557Sjimharris          */
167230557Sjimharris         U32  start                       : 1;
168230557Sjimharris         U32  tx_ssc_type                 : 1;
169230557Sjimharris         U32  reserved1                   : 2;
170230557Sjimharris         U32  requested_logical_link_rate : 4;
171230557Sjimharris
172230557Sjimharris         U32  gen1_without_ssc_supported  : 1;
173230557Sjimharris         U32  gen1_with_ssc_supported     : 1;
174230557Sjimharris         U32  gen2_without_ssc_supported  : 1;
175230557Sjimharris         U32  gen2_with_ssc_supported     : 1;
176230557Sjimharris         U32  gen3_without_ssc_supported  : 1;
177230557Sjimharris         U32  gen3_with_ssc_supported     : 1;
178230557Sjimharris         U32  reserved2                   : 17;
179230557Sjimharris         U32  parity                      : 1;
180230557Sjimharris      } bits;
181230557Sjimharris#endif // (SCIC_SDS_4_ENABLED)
182230557Sjimharris
183230557Sjimharris      U32 all;
184230557Sjimharris   } u;
185230557Sjimharris
186230557Sjimharris} SAS_CAPABILITIES_T;
187230557Sjimharris
188230557Sjimharris/**
189230557Sjimharris * @enum  _SCI_SAS_LINK_RATE
190230557Sjimharris * @brief This enumeration depicts the SAS specification defined link speeds.
191230557Sjimharris */
192230557Sjimharristypedef enum _SCI_SAS_LINK_RATE
193230557Sjimharris{
194230557Sjimharris   SCI_SAS_NO_LINK_RATE = 0,
195230557Sjimharris   SCI_SATA_SPINUP_HOLD = 0x3,
196230557Sjimharris   SCI_SAS_150_GB = 0x8,
197230557Sjimharris   SCI_SAS_300_GB = 0x9,
198230557Sjimharris   SCI_SAS_600_GB = 0xA
199230557Sjimharris} SCI_SAS_LINK_RATE;
200230557Sjimharris
201230557Sjimharris/**
202230557Sjimharris * @enum  _SCI_SAS_TASK_ATTRIBUTE
203230557Sjimharris * @brief This enumeration depicts the SAM/SAS specification defined task
204230557Sjimharris *        attribute values for a command information unit.
205230557Sjimharris */
206230557Sjimharristypedef enum _SCI_SAS_TASK_ATTRIBUTE
207230557Sjimharris{
208230557Sjimharris   SCI_SAS_SIMPLE_ATTRIBUTE = 0,
209230557Sjimharris   SCI_SAS_HEAD_OF_QUEUE_ATTRIBUTE = 1,
210230557Sjimharris   SCI_SAS_ORDERED_ATTRIBUTE = 2,
211230557Sjimharris   SCI_SAS_ACA_ATTRIBUTE = 4,
212230557Sjimharris} SCI_SAS_TASK_ATTRIBUTE;
213230557Sjimharris
214230557Sjimharris/**
215230557Sjimharris * @enum  _SCI_SAS_TASK_MGMT_FUNCTION
216230557Sjimharris * @brief This enumeration depicts the SAM/SAS specification defined task
217230557Sjimharris *        management functions.
218230557Sjimharris *        @note This HARD_RESET function listed here is not actually defined
219230557Sjimharris *              as a task management function in the industry standard.
220230557Sjimharris */
221230557Sjimharristypedef enum _SCI_SAS_TASK_MGMT_FUNCTION
222230557Sjimharris{
223230557Sjimharris   SCI_SAS_ABORT_TASK = SCSI_TASK_REQUEST_ABORT_TASK,
224230557Sjimharris   SCI_SAS_ABORT_TASK_SET = SCSI_TASK_REQUEST_ABORT_TASK_SET,
225230557Sjimharris   SCI_SAS_CLEAR_TASK_SET = SCSI_TASK_REQUEST_CLEAR_TASK_SET,
226230557Sjimharris   SCI_SAS_LOGICAL_UNIT_RESET = SCSI_TASK_REQUEST_LOGICAL_UNIT_RESET,
227230557Sjimharris   SCI_SAS_I_T_NEXUS_RESET = SCSI_TASK_REQUEST_I_T_NEXUS_RESET,
228230557Sjimharris   SCI_SAS_CLEAR_ACA = SCSI_TASK_REQUEST_CLEAR_ACA,
229230557Sjimharris   SCI_SAS_QUERY_TASK = SCSI_TASK_REQUEST_QUERY_TASK,
230230557Sjimharris   SCI_SAS_QUERY_TASK_SET = SCSI_TASK_REQUEST_QUERY_TASK_SET,
231230557Sjimharris   SCI_SAS_QUERY_ASYNCHRONOUS_EVENT = SCSI_TASK_REQUEST_QUERY_UNIT_ATTENTION,
232230557Sjimharris   SCI_SAS_HARD_RESET = 0xFF
233230557Sjimharris} SCI_SAS_TASK_MGMT_FUNCTION_T;
234230557Sjimharris
235230557Sjimharris
236230557Sjimharris/**
237230557Sjimharris * @enum  _SCI_SAS_FRAME_TYPE
238230557Sjimharris * @brief This enumeration depicts the SAS specification defined SSP frame
239230557Sjimharris *        types.
240230557Sjimharris */
241230557Sjimharristypedef enum _SCI_SAS_FRAME_TYPE
242230557Sjimharris{
243230557Sjimharris   SCI_SAS_DATA_FRAME = 0x01,
244230557Sjimharris   SCI_SAS_XFER_RDY_FRAME = 0x05,
245230557Sjimharris   SCI_SAS_COMMAND_FRAME = 0x06,
246230557Sjimharris   SCI_SAS_RESPONSE_FRAME = 0x07,
247230557Sjimharris   SCI_SAS_TASK_FRAME = 0x16
248230557Sjimharris} SCI_SAS_FRAME_TYPE_T;
249230557Sjimharris
250230557Sjimharris
251230557Sjimharris/**
252230557Sjimharris * @struct SCI_SSP_COMMAND_IU
253230557Sjimharris * @brief This structure depicts the contents of the SSP COMMAND
254230557Sjimharris *        INFORMATION UNIT. For specific information on each of these
255230557Sjimharris *        individual fields please reference the SAS specification SSP
256230557Sjimharris *        transport layer section.
257230557Sjimharris */
258230557Sjimharristypedef struct SCI_SSP_COMMAND_IU
259230557Sjimharris{
260230557Sjimharris
261230557Sjimharris   U32 lun[2];
262230557Sjimharris
263230557Sjimharris   U32 additional_cdb_length  : 6;
264230557Sjimharris   U32 reserved0              : 2;
265230557Sjimharris   U32 reserved1              : 8;
266230557Sjimharris   U32 enable_first_burst     : 1;
267230557Sjimharris   U32 task_priority          : 4;
268230557Sjimharris   U32 task_attribute         : 3;
269230557Sjimharris   U32 reserved2              : 8;
270230557Sjimharris
271230557Sjimharris   U32 cdb[4];
272230557Sjimharris
273230557Sjimharris} SCI_SSP_COMMAND_IU_T;
274230557Sjimharris
275230557Sjimharris/**
276230557Sjimharris * @struct SCI_SSP_TASK_IU
277230557Sjimharris * @brief This structure depicts the contents of the SSP TASK INFORMATION
278230557Sjimharris *        UNIT. For specific information on each of these individual fields
279230557Sjimharris *        please reference the SAS specification SSP transport layer
280230557Sjimharris *        section.
281230557Sjimharris */
282230557Sjimharristypedef struct SCI_SSP_TASK_IU
283230557Sjimharris{
284230557Sjimharris   U32 lun_upper;
285230557Sjimharris   U32 lun_lower;
286230557Sjimharris
287230557Sjimharris   U32 reserved0     : 8;
288230557Sjimharris   U32 task_function : 8;
289230557Sjimharris   U32 reserved1     : 8;
290230557Sjimharris   U32 reserved2     : 8;
291230557Sjimharris
292230557Sjimharris   U32 reserved3     : 16;
293230557Sjimharris   U32 task_tag      : 16;
294230557Sjimharris
295230557Sjimharris   U32 reserved4[3];
296230557Sjimharris
297230557Sjimharris} SCI_SSP_TASK_IU_T;
298230557Sjimharris
299230557Sjimharris#define SSP_RESPONSE_IU_MAX_DATA 64
300230557Sjimharris
301230557Sjimharris#define SCI_SSP_RESPONSE_IU_DATA_PRESENT_MASK   (0x03)
302230557Sjimharris
303230557Sjimharris/**
304230557Sjimharris * @struct SCI_SSP_RESPONSE_IU
305230557Sjimharris * @brief This structure depicts the contents of the SSP RESPONSE
306230557Sjimharris *        INFORMATION UNIT. For specific information on each of these
307230557Sjimharris *        individual fields please reference the SAS specification SSP
308230557Sjimharris *        transport layer section.
309230557Sjimharris */
310230557Sjimharristypedef struct SCI_SSP_RESPONSE_IU
311230557Sjimharris{
312230557Sjimharris   U8  reserved0[8];
313230557Sjimharris
314230557Sjimharris   U8  retry_delay_timer[2];
315230557Sjimharris   U8  data_present;
316230557Sjimharris   U8  status;
317230557Sjimharris
318230557Sjimharris   U8  reserved1[4];
319230557Sjimharris   U8  sense_data_length[4];
320230557Sjimharris   U8  response_data_length[4];
321230557Sjimharris
322230557Sjimharris   U32 data[SSP_RESPONSE_IU_MAX_DATA];
323230557Sjimharris
324230557Sjimharris} SCI_SSP_RESPONSE_IU_T;
325230557Sjimharris
326230557Sjimharris/**
327230557Sjimharris * @enum  _SCI_SAS_DATA_PRESENT_TYPE
328230557Sjimharris * @brief This enumeration depicts the SAS specification defined SSP data present
329230557Sjimharris *        types in SCI_SSP_RESPONSE_IU.
330230557Sjimharris */
331230557Sjimharristypedef enum _SCI_SSP_RESPONSE_IU_DATA_PRESENT_TYPE
332230557Sjimharris{
333230557Sjimharris   SCI_SSP_RESPONSE_IU_NO_DATA = 0x00,
334230557Sjimharris   SCI_SSP_RESPONSE_IU_RESPONSE_DATA = 0x01,
335230557Sjimharris   SCI_SSP_RESPONSE_IU_SENSE_DATA = 0x02
336230557Sjimharris} SCI_SSP_RESPONSE_IU_DATA_PRESENT_TYPE_T;
337230557Sjimharris
338230557Sjimharris/**
339230557Sjimharris * @struct SCI_SSP_FRAME_HEADER
340230557Sjimharris *
341230557Sjimharris * @brief This structure depicts the contents of an SSP frame header.  For
342230557Sjimharris *        specific information on the individual fields please reference
343230557Sjimharris *        the SAS specification transport layer SSP frame format.
344230557Sjimharris */
345230557Sjimharristypedef struct SCI_SSP_FRAME_HEADER
346230557Sjimharris{
347230557Sjimharris   // Word 0
348230557Sjimharris   U32 hashed_destination_address  :24;
349230557Sjimharris   U32 frame_type                  : 8;
350230557Sjimharris
351230557Sjimharris   // Word 1
352230557Sjimharris   U32 hashed_source_address       :24;
353230557Sjimharris   U32 reserved1_0                 : 8;
354230557Sjimharris
355230557Sjimharris   // Word 2
356230557Sjimharris   U32 reserved2_2                 : 6;
357230557Sjimharris   U32 fill_bytes                  : 2;
358230557Sjimharris   U32 reserved2_1                 : 3;
359230557Sjimharris   U32 tlr_control                 : 2;
360230557Sjimharris   U32 retry_data_frames           : 1;
361230557Sjimharris   U32 retransmit                  : 1;
362230557Sjimharris   U32 changing_data_pointer       : 1;
363230557Sjimharris   U32 reserved2_0                 :16;
364230557Sjimharris
365230557Sjimharris   // Word 3
366230557Sjimharris   U32 uiResv4;
367230557Sjimharris
368230557Sjimharris   // Word 4
369230557Sjimharris   U16 target_port_transfer_tag;
370230557Sjimharris   U16 tag;
371230557Sjimharris
372230557Sjimharris   // Word 5
373230557Sjimharris   U32 data_offset;
374230557Sjimharris
375230557Sjimharris} SCI_SSP_FRAME_HEADER_T;
376230557Sjimharris
377230557Sjimharris/**
378230557Sjimharris * @struct SMP_REQUEST_HEADER
379230557Sjimharris * @brief  This structure defines the contents of an SMP Request header.
380230557Sjimharris *         @note For specific information on each of these
381230557Sjimharris *               individual fields please reference the SAS specification.
382230557Sjimharris */
383230557Sjimharristypedef struct SMP_REQUEST_HEADER
384230557Sjimharris{
385230557Sjimharris   U8 smp_frame_type;                // byte 0
386230557Sjimharris   U8 function;                      // byte 1
387230557Sjimharris   U8 allocated_response_length;     // byte 2
388230557Sjimharris   U8 request_length;                // byte 3
389230557Sjimharris} SMP_REQUEST_HEADER_T;
390230557Sjimharris
391230557Sjimharris/**
392230557Sjimharris * @struct SMP_RESPONSE_HEADER
393230557Sjimharris * @brief  This structure depicts the contents of the SAS SMP DISCOVER
394230557Sjimharris *         RESPONSE frame.  For specific information on each of these
395230557Sjimharris *         individual fields please reference the SAS specification Link
396230557Sjimharris *         layer section on address frames.
397230557Sjimharris */
398230557Sjimharristypedef struct SMP_RESPONSE_HEADER
399230557Sjimharris{
400230557Sjimharris   U8 smp_frame_type;      // byte 0
401230557Sjimharris   U8 function;            // byte 1
402230557Sjimharris   U8 function_result;     // byte 2
403230557Sjimharris   U8 response_length;     // byte 3
404230557Sjimharris} SMP_RESPONSE_HEADER_T;
405230557Sjimharris
406230557Sjimharris/**
407230557Sjimharris * @struct SMP_REQUEST_GENERAL
408230557Sjimharris * @brief  This structure defines the contents of an SMP Request that
409230557Sjimharris *         is comprised of the SMP_REQUEST_HEADER and a CRC.
410230557Sjimharris *         @note For specific information on each of these
411230557Sjimharris *               individual fields please reference the SAS specification.
412230557Sjimharris */
413230557Sjimharristypedef struct SMP_REQUEST_GENERAL
414230557Sjimharris{
415230557Sjimharris  U32 crc;            // bytes 4-7
416230557Sjimharris
417230557Sjimharris} SMP_REQUEST_GENERAL_T;
418230557Sjimharris
419230557Sjimharris/**
420230557Sjimharris * @struct SMP_REQUEST_PHY_IDENTIFIER
421230557Sjimharris * @brief  This structure defines the contents of an SMP Request that
422230557Sjimharris *         is comprised of the SMP_REQUEST_HEADER and a phy identifier.
423230557Sjimharris *         Examples: SMP_REQUEST_DISCOVER, SMP_REQUEST_REPORT_PHY_SATA.
424230557Sjimharris *         @note For specific information on each of these
425230557Sjimharris *               individual fields please reference the SAS specification.
426230557Sjimharris */
427230557Sjimharristypedef struct SMP_REQUEST_PHY_IDENTIFIER
428230557Sjimharris{
429230557Sjimharris  U32 reserved_byte4_7;      // bytes 4-7
430230557Sjimharris
431230557Sjimharris  U32 ignore_zone_group:1;    // byte 8
432230557Sjimharris  U32 reserved_byte8:7;
433230557Sjimharris
434230557Sjimharris  U32 phy_identifier:8;       // byte 9
435230557Sjimharris  U32 reserved_byte10:8;      // byte 10
436230557Sjimharris  U32 reserved_byte11:8;      // byte 11
437230557Sjimharris
438230557Sjimharris} SMP_REQUEST_PHY_IDENTIFIER_T;
439230557Sjimharris
440230557Sjimharris/**
441230557Sjimharris * @struct SMP_REQUEST_CONFIGURE_ROUTE_INFORMATION
442230557Sjimharris * @brief  This structure defines the contents of an SMP Configure Route
443230557Sjimharris *         Information request.
444230557Sjimharris *         @note For specific information on each of these
445230557Sjimharris *               individual fields please reference the SAS specification.
446230557Sjimharris */
447230557Sjimharristypedef struct SMP_REQUEST_CONFIGURE_ROUTE_INFORMATION
448230557Sjimharris{
449230557Sjimharris  U32 expected_expander_change_count:16;    // bytes 4-5
450230557Sjimharris  U32 expander_route_index_high:8;
451230557Sjimharris  U32 expander_route_index:8;              // bytes 6-7
452230557Sjimharris
453230557Sjimharris  U32 reserved_byte8:8;           // bytes 8
454230557Sjimharris  U32 phy_identifier:8;           // bytes 9
455230557Sjimharris  U32 reserved_byte_10_11:16;     // bytes 10-11
456230557Sjimharris
457230557Sjimharris  U32 reserved_byte_12_bit_0_6:7;
458230557Sjimharris  U32 disable_route_entry:1;    // byte 12
459230557Sjimharris  U32 reserved_byte_13_15:24;   // bytes 13-15
460230557Sjimharris
461230557Sjimharris  U32 routed_sas_address[2];    // bytes 16-23
462230557Sjimharris  U8 reserved_byte_24_39[16];    // bytes 24-39
463230557Sjimharris
464230557Sjimharris} SMP_REQUEST_CONFIGURE_ROUTE_INFORMATION_T;
465230557Sjimharris
466230557Sjimharris/**
467230557Sjimharris * @struct SMP_REQUEST_PHY_CONTROL
468230557Sjimharris * @brief  This structure defines the contents of an SMP Phy Controler
469230557Sjimharris *         request.
470230557Sjimharris *         @note For specific information on each of these
471230557Sjimharris *               individual fields please reference the SAS specification.
472230557Sjimharris */
473230557Sjimharristypedef struct SMP_REQUEST_PHY_CONTROL
474230557Sjimharris{
475230557Sjimharris  U16 expected_expander_change_count;   // byte 4-5
476230557Sjimharris
477230557Sjimharris  U16 reserved_byte_6_7;   // byte 6-7
478230557Sjimharris  U8 reserved_byte_8;      // byte 8
479230557Sjimharris
480230557Sjimharris  U8 phy_identifier;       // byte 9
481230557Sjimharris  U8 phy_operation;        // byte 10
482230557Sjimharris
483230557Sjimharris  U8 update_partial_pathway_timeout_value:1;
484230557Sjimharris  U8 reserved_byte_11_bit_1_7:7;   // byte 11
485230557Sjimharris
486230557Sjimharris  U8 reserved_byte_12_23[12];      // byte 12-23
487230557Sjimharris
488230557Sjimharris  U8 attached_device_name[8];      // byte 24-31
489230557Sjimharris
490230557Sjimharris  U8 reserved_byte_32_bit_3_0:4;   // byte 32
491230557Sjimharris  U8 programmed_minimum_physical_link_rate:4;
492230557Sjimharris
493230557Sjimharris  U8 reserved_byte_33_bit_3_0:4;   // byte 33
494230557Sjimharris  U8 programmed_maximum_physical_link_rate:4;
495230557Sjimharris
496230557Sjimharris  U16 reserved_byte_34_35;      // byte 34-35
497230557Sjimharris
498230557Sjimharris  U8 partial_pathway_timeout_value:4;
499230557Sjimharris  U8 reserved_byte_36_bit_4_7:4;  // byte 36
500230557Sjimharris
501230557Sjimharris  U16 reserved_byte_37_38;  // byte 37-38
502230557Sjimharris  U8 reserved_byte_39;      // byte 39
503230557Sjimharris
504230557Sjimharris} SMP_REQUEST_PHY_CONTROL_T;
505230557Sjimharris
506230557Sjimharris/**
507230557Sjimharris * @struct SMP_REQUEST_VENDOR_SPECIFIC
508230557Sjimharris * @brief  This structure depicts the vendor specific space for SMP request.
509230557Sjimharris */
510230557Sjimharris #define SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH 1016
511230557Sjimharristypedef struct SMP_REQUEST_VENDOR_SPECIFIC
512230557Sjimharris{
513230557Sjimharris   U8 request_bytes[SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH];
514230557Sjimharris}SMP_REQUEST_VENDOR_SPECIFIC_T;
515230557Sjimharris
516230557Sjimharris/**
517230557Sjimharris * @struct SMP_REQUEST
518230557Sjimharris * @brief  This structure simply unionizes the existing request
519230557Sjimharris *         structures into a common request type.
520230557Sjimharris */
521230557Sjimharristypedef struct _SMP_REQUEST
522230557Sjimharris{
523230557Sjimharris  SMP_REQUEST_HEADER_T header;
524230557Sjimharris
525230557Sjimharris  union
526230557Sjimharris  {            // bytes 4-N
527230557Sjimharris    SMP_REQUEST_GENERAL_T                       report_general;
528230557Sjimharris    SMP_REQUEST_PHY_IDENTIFIER_T                discover;
529230557Sjimharris    SMP_REQUEST_GENERAL_T                       report_manufacturer_information;
530230557Sjimharris    SMP_REQUEST_PHY_IDENTIFIER_T                report_phy_sata;
531230557Sjimharris    SMP_REQUEST_PHY_CONTROL_T                   phy_control;
532230557Sjimharris    SMP_REQUEST_PHY_IDENTIFIER_T                report_phy_error_log;
533230557Sjimharris    SMP_REQUEST_PHY_IDENTIFIER_T                report_route_information;
534230557Sjimharris    SMP_REQUEST_CONFIGURE_ROUTE_INFORMATION_T   configure_route_information;
535230557Sjimharris    SMP_REQUEST_VENDOR_SPECIFIC_T               vendor_specific_request;
536230557Sjimharris  } request;
537230557Sjimharris
538230557Sjimharris} SMP_REQUEST_T;
539230557Sjimharris
540230557Sjimharris
541230557Sjimharris/**
542230557Sjimharris * @struct SMP_RESPONSE_REPORT_GENERAL
543230557Sjimharris * @brief  This structure depicts the SMP Report General for
544230557Sjimharris *         expander devices.  It adheres to the SAS-2.1 specification.
545230557Sjimharris *         @note For specific information on each of these
546230557Sjimharris *               individual fields please reference the SAS specification
547230557Sjimharris *               Application layer section on SMP.
548230557Sjimharris */
549230557Sjimharristypedef struct SMP_RESPONSE_REPORT_GENERAL
550230557Sjimharris{
551230557Sjimharris  U16 expander_change_count;  //byte 4-5
552230557Sjimharris  U16 expander_route_indexes; //byte 6-7
553230557Sjimharris
554230557Sjimharris  U32 reserved_byte8:7;        //byte 8 bit 0-6
555230557Sjimharris  U32 long_response:1;         //byte 8 bit 7
556230557Sjimharris
557230557Sjimharris  U32 number_of_phys:8;        //byte 9
558230557Sjimharris
559230557Sjimharris  U32 configurable_route_table:1; //byte 10
560230557Sjimharris  U32 configuring:1;
561230557Sjimharris  U32 configures_others:1;
562230557Sjimharris  U32 open_reject_retry_supported:1;
563230557Sjimharris  U32 stp_continue_awt:1;
564230557Sjimharris  U32 self_configuring:1;
565230557Sjimharris  U32 zone_configuring:1;
566230557Sjimharris  U32 table_to_table_supported:1;
567230557Sjimharris
568230557Sjimharris  U32 reserved_byte11:8;       //byte 11
569230557Sjimharris
570230557Sjimharris  U32 enclosure_logical_identifier_high; //byte 12-15
571230557Sjimharris  U32 enclosure_logical_identifier_low;  //byte 16-19
572230557Sjimharris
573230557Sjimharris  U32 reserved_byte20_23;
574230557Sjimharris  U32 reserved_byte24_27;
575230557Sjimharris
576230557Sjimharris} SMP_RESPONSE_REPORT_GENERAL_T;
577230557Sjimharris
578230557Sjimharristypedef struct SMP_RESPONSE_REPORT_GENERAL_LONG
579230557Sjimharris{
580230557Sjimharris   SMP_RESPONSE_REPORT_GENERAL_T sas1_1;
581230557Sjimharris
582230557Sjimharris   struct
583230557Sjimharris   {
584230557Sjimharris      U16 reserved1;
585230557Sjimharris      U16 stp_bus_inactivity_time_limit;
586230557Sjimharris      U16 stp_max_connect_time_limit;
587230557Sjimharris      U16 stp_smp_i_t_nexus_loss_time;
588230557Sjimharris
589230557Sjimharris      U32 zoning_enabled                         : 1;
590230557Sjimharris      U32 zoning_supported                       : 1;
591230557Sjimharris      U32 physicaL_presence_asserted             : 1;
592230557Sjimharris      U32 zone_locked                            : 1;
593230557Sjimharris      U32 reserved2                              : 1;
594230557Sjimharris      U32 num_zone_groups                        : 3;
595230557Sjimharris      U32 saving_zoning_enabled_supported        : 3;
596230557Sjimharris      U32 saving_zone_perms_table_supported      : 1;
597230557Sjimharris      U32 saving_zone_phy_info_supported         : 1;
598230557Sjimharris      U32 saving_zone_manager_password_supported : 1;
599230557Sjimharris      U32 saving                                 : 1;
600230557Sjimharris      U32 reserved3                              : 1;
601230557Sjimharris      U32 max_number_routed_sas_addresses        : 16;
602230557Sjimharris
603230557Sjimharris      SCI_SAS_ADDRESS_T active_zone_manager_sas_address;
604230557Sjimharris
605230557Sjimharris      U16 zone_lock_inactivity_time_limit;
606230557Sjimharris      U16 reserved4;
607230557Sjimharris
608230557Sjimharris      U8 reserved5;
609230557Sjimharris      U8 first_enclosure_connector_element_index;
610230557Sjimharris      U8 number_of_enclosure_connector_element_indices;
611230557Sjimharris      U8 reserved6;
612230557Sjimharris
613230557Sjimharris      U32 reserved7                            : 7;
614230557Sjimharris      U32 reduced_functionality                : 1;
615230557Sjimharris      U32 time_to_reduce_functionality         : 8;
616230557Sjimharris      U32 initial_time_to_reduce_functionality : 8;
617230557Sjimharris      U8  max_reduced_functionality_time;
618230557Sjimharris
619230557Sjimharris      U16 last_self_config_status_descriptor_index;
620230557Sjimharris      U16 max_number_of_stored_self_config_status_descriptors;
621230557Sjimharris
622230557Sjimharris      U16 last_phy_event_list_descriptor_index;
623230557Sjimharris      U16 max_number_of_stored_phy_event_list_descriptors;
624230557Sjimharris   } sas2;
625230557Sjimharris
626230557Sjimharris} SMP_RESPONSE_REPORT_GENERAL_LONG_T;
627230557Sjimharris
628230557Sjimharris/**
629230557Sjimharris * @struct SMP_RESPONSE_REPORT_MANUFACTURER_INFORMATION
630230557Sjimharris * @brief  This structure depicts the SMP report manufacturer
631230557Sjimharris *         information for expander devices.  It adheres to the
632230557Sjimharris *         SAS-2.1 specification.
633230557Sjimharris *         @note For specific information on each of these
634230557Sjimharris *               individual fields please reference the SAS specification
635230557Sjimharris *               Application layer section on SMP.
636230557Sjimharris */
637230557Sjimharristypedef struct SMP_RESPONSE_REPORT_MANUFACTURER_INFORMATION
638230557Sjimharris{
639230557Sjimharris  U32 expander_change_count : 16;    // bytes 4-5
640230557Sjimharris  U32 reserved1             : 16;
641230557Sjimharris
642230557Sjimharris  U32 sas1_1_format         : 1;
643230557Sjimharris  U32 reserved2             : 31;
644230557Sjimharris
645230557Sjimharris  U8  vendor_id[8];
646230557Sjimharris  U8  product_id[16];
647230557Sjimharris  U8  product_revision_level[4];
648230557Sjimharris  U8  component_vendor_id[8];
649230557Sjimharris  U8  component_id[2];
650230557Sjimharris  U8  component_revision_level;
651230557Sjimharris  U8  reserved3;
652230557Sjimharris  U8  vendor_specific[8];
653230557Sjimharris
654230557Sjimharris} SMP_RESPONSE_REPORT_MANUFACTURER_INFORMATION_T;
655230557Sjimharris
656230557Sjimharris#define SMP_RESPONSE_DISCOVER_FORMAT_1_1_SIZE 52
657230557Sjimharris#define SMP_RESPONSE_DISCOVER_FORMAT_2_SIZE   116
658230557Sjimharris
659230557Sjimharris/**
660230557Sjimharris * @struct SMP_DISCOVER_RESPONSE_PROTOCOLS
661230557Sjimharris * @brief  This structure depicts the discover response where the
662230557Sjimharris *         supported protocols by the remote phy are specified.
663230557Sjimharris *         @note For specific information on each of these
664230557Sjimharris *               individual fields please reference the SAS specification
665230557Sjimharris *               Link layer section on address frames.
666230557Sjimharris */
667230557Sjimharristypedef struct SMP_DISCOVER_RESPONSE_PROTOCOLS
668230557Sjimharris{
669230557Sjimharris   union
670230557Sjimharris   {
671230557Sjimharris      struct
672230557Sjimharris      {
673230557Sjimharris         U16  attached_sata_host           : 1;
674230557Sjimharris         U16  attached_smp_initiator       : 1;
675230557Sjimharris         U16  attached_stp_initiator       : 1;
676230557Sjimharris         U16  attached_ssp_initiator       : 1;
677230557Sjimharris         U16  reserved3                    : 4;
678230557Sjimharris         U16  attached_sata_device         : 1;
679230557Sjimharris         U16  attached_smp_target          : 1;
680230557Sjimharris         U16  attached_stp_target          : 1;
681230557Sjimharris         U16  attached_ssp_target          : 1;
682230557Sjimharris         U16  reserved4                    : 3;
683230557Sjimharris         U16  attached_sata_port_selector  : 1;
684230557Sjimharris      } bits;
685230557Sjimharris
686230557Sjimharris      U16 all;
687230557Sjimharris   } u;
688230557Sjimharris
689230557Sjimharris} SMP_DISCOVER_RESPONSE_PROTOCOLS_T;
690230557Sjimharris
691230557Sjimharris/**
692230557Sjimharris * @struct SMP_RESPONSE_DISCOVER_FORMAT
693230557Sjimharris * @brief  This structure defines the SMP phy discover response format.
694230557Sjimharris *         It handles both SAS1.1 and SAS 2 definitions.  The unions
695230557Sjimharris *         indicate locations where the SAS specification versions
696230557Sjimharris *         differ from one another.
697230557Sjimharris */
698230557Sjimharristypedef struct SMP_RESPONSE_DISCOVER
699230557Sjimharris{
700230557Sjimharris
701230557Sjimharris   union
702230557Sjimharris   {
703230557Sjimharris      struct
704230557Sjimharris      {
705230557Sjimharris         U8 reserved[2];
706230557Sjimharris      } sas1_1;
707230557Sjimharris
708230557Sjimharris      struct
709230557Sjimharris      {
710230557Sjimharris         U16  expander_change_count;
711230557Sjimharris      } sas2;
712230557Sjimharris
713230557Sjimharris   } u1;
714230557Sjimharris
715230557Sjimharris   U8   reserved1[3];
716230557Sjimharris   U8   phy_identifier;
717230557Sjimharris   U8   reserved2[2];
718230557Sjimharris
719230557Sjimharris   union
720230557Sjimharris   {
721230557Sjimharris      struct
722230557Sjimharris      {
723230557Sjimharris         U16  reserved1                     : 4;
724230557Sjimharris         U16  attached_device_type          : 3;
725230557Sjimharris         U16  reserved2                     : 1;
726230557Sjimharris         U16  negotiated_physical_link_rate : 4;
727230557Sjimharris         U16  reserved3                     : 4;
728230557Sjimharris      } sas1_1;
729230557Sjimharris
730230557Sjimharris      struct
731230557Sjimharris      {
732230557Sjimharris         U16  attached_reason              : 4;
733230557Sjimharris         U16  attached_device_type         : 3;
734230557Sjimharris         U16  reserved2                    : 1;
735230557Sjimharris         U16  negotiated_logical_link_rate : 4;
736230557Sjimharris         U16  reserved3                    : 4;
737230557Sjimharris      } sas2;
738230557Sjimharris
739230557Sjimharris   } u2;
740230557Sjimharris
741230557Sjimharris   SMP_DISCOVER_RESPONSE_PROTOCOLS_T protocols;
742230557Sjimharris   SCI_SAS_ADDRESS_T  sas_address;
743230557Sjimharris   SCI_SAS_ADDRESS_T  attached_sas_address;
744230557Sjimharris
745230557Sjimharris   U8   attached_phy_identifier;
746230557Sjimharris
747230557Sjimharris   union
748230557Sjimharris   {
749230557Sjimharris      struct
750230557Sjimharris      {
751230557Sjimharris         U8   reserved;
752230557Sjimharris      } sas1_1;
753230557Sjimharris
754230557Sjimharris      struct
755230557Sjimharris      {
756230557Sjimharris         U8   attached_break_reply_capable     : 1;
757230557Sjimharris         U8   attached_requested_inside_zpsds  : 1;
758230557Sjimharris         U8   attached_inside_zpsds_persistent : 1;
759230557Sjimharris         U8   reserved1                        : 5;
760230557Sjimharris      } sas2;
761230557Sjimharris
762230557Sjimharris   } u3;
763230557Sjimharris
764230557Sjimharris   U8   reserved_for_identify[6];
765230557Sjimharris
766230557Sjimharris   U32  hardware_min_physical_link_rate   : 4;
767230557Sjimharris   U32  programmed_min_physical_link_rate : 4;
768230557Sjimharris   U32  hardware_max_physical_link_rate   : 4;
769230557Sjimharris   U32  programmed_max_physical_link_rate : 4;
770230557Sjimharris   U32  phy_change_count                  : 8;
771230557Sjimharris   U32  partial_pathway_timeout_value     : 4;
772230557Sjimharris   U32  reserved5                         : 3;
773230557Sjimharris   U32  virtual_phy                       : 1;
774230557Sjimharris
775230557Sjimharris   U32  routing_attribute                 : 4;
776230557Sjimharris   U32  reserved6                         : 4;
777230557Sjimharris   U32  connector_type                    : 7;
778230557Sjimharris   U32  reserved7                         : 1;
779230557Sjimharris   U32  connector_element_index           : 8;
780230557Sjimharris   U32  connector_physical_link           : 8;
781230557Sjimharris
782230557Sjimharris   U16  reserved8;
783230557Sjimharris   U16  vendor_specific;
784230557Sjimharris
785230557Sjimharris   union
786230557Sjimharris   {
787230557Sjimharris      struct
788230557Sjimharris      {
789230557Sjimharris         /**
790230557Sjimharris          * In the SAS 1.1 specification this structure ends after 52 bytes.
791230557Sjimharris          * As a result, the contents of this field should never have a
792230557Sjimharris          * real value.  It is undefined.
793230557Sjimharris          */
794230557Sjimharris         U8 undefined[SMP_RESPONSE_DISCOVER_FORMAT_2_SIZE
795230557Sjimharris                      - SMP_RESPONSE_DISCOVER_FORMAT_1_1_SIZE];
796230557Sjimharris      } sas1_1;
797230557Sjimharris
798230557Sjimharris      struct
799230557Sjimharris      {
800230557Sjimharris         SCI_SAS_ADDRESS_T attached_device_name;
801230557Sjimharris
802230557Sjimharris         U32  zoning_enabled                             : 1;
803230557Sjimharris         U32  inside_zpsds                               : 1;
804230557Sjimharris         U32  zone_group_persistent                      : 1;
805230557Sjimharris         U32  reserved1                                  : 1;
806230557Sjimharris         U32  requested_inside_zpsds                     : 1;
807230557Sjimharris         U32  inside_zpsds_persistent                    : 1;
808230557Sjimharris         U32  requested_inside_zpsds_changed_by_expander : 1;
809230557Sjimharris         U32  reserved2                                  : 1;
810230557Sjimharris         U32  reserved_for_zoning_fields                 : 16;
811230557Sjimharris         U32  zone_group                                 : 8;
812230557Sjimharris
813230557Sjimharris         U8   self_configuration_status;
814230557Sjimharris         U8   self_configuration_levels_completed;
815230557Sjimharris         U16  reserved_for_self_config_fields;
816230557Sjimharris
817230557Sjimharris         SCI_SAS_ADDRESS_T self_configuration_sas_address;
818230557Sjimharris
819230557Sjimharris         U32  programmed_phy_capabilities;
820230557Sjimharris         U32  current_phy_capabilities;
821230557Sjimharris         U32  attached_phy_capabilities;
822230557Sjimharris
823230557Sjimharris         U32  reserved3;
824230557Sjimharris
825230557Sjimharris         U32  reserved4                     : 16;
826230557Sjimharris         U32  negotiated_physical_link_rate : 4;
827230557Sjimharris         U32  reason                        : 4;
828230557Sjimharris         U32  hardware_muxing_supported     : 1;
829230557Sjimharris         U32  negotiated_ssc                : 1;
830230557Sjimharris         U32  reserved5                     : 6;
831230557Sjimharris
832230557Sjimharris         U32  default_zoning_enabled          : 1;
833230557Sjimharris         U32  reserved6                       : 1;
834230557Sjimharris         U32  default_zone_group_persistent   : 1;
835230557Sjimharris         U32  reserved7                       : 1;
836230557Sjimharris         U32  default_requested_inside_zpsds  : 1;
837230557Sjimharris         U32  default_inside_zpsds_persistent : 1;
838230557Sjimharris         U32  reserved8                       : 2;
839230557Sjimharris         U32  reserved9                       : 16;
840230557Sjimharris         U32  default_zone_group              : 8;
841230557Sjimharris
842230557Sjimharris         U32  saved_zoning_enabled          : 1;
843230557Sjimharris         U32  reserved10                    : 1;
844230557Sjimharris         U32  saved_zone_group_persistent   : 1;
845230557Sjimharris         U32  reserved11                    : 1;
846230557Sjimharris         U32  saved_requested_inside_zpsds  : 1;
847230557Sjimharris         U32  saved_inside_zpsds_persistent : 1;
848230557Sjimharris         U32  reserved12                    : 18;
849230557Sjimharris         U32  saved_zone_group              : 8;
850230557Sjimharris
851230557Sjimharris         U32  reserved14                     : 2;
852230557Sjimharris         U32  shadow_zone_group_persistent   : 1;
853230557Sjimharris         U32  reserved15                     : 1;
854230557Sjimharris         U32  shadow_requested_inside_zpsds  : 1;
855230557Sjimharris         U32  shadow_inside_zpsds_persistent : 1;
856230557Sjimharris         U32  reserved16                     : 18;
857230557Sjimharris         U32  shadow_zone_group              : 8;
858230557Sjimharris
859230557Sjimharris         U8   device_slot_number;
860230557Sjimharris         U8   device_slot_group_number;
861230557Sjimharris         U8   device_slot_group_output_connector[6];
862230557Sjimharris      } sas2;
863230557Sjimharris
864230557Sjimharris   } u4;
865230557Sjimharris
866230557Sjimharris} SMP_RESPONSE_DISCOVER_T;
867230557Sjimharris
868230557Sjimharris/**
869230557Sjimharris * @struct SMP_RESPONSE_REPORT_PHY_SATA
870230557Sjimharris * @brief  This structure depicts the contents of the SAS SMP REPORT
871230557Sjimharris *         PHY SATA frame.  For specific information on each of these
872230557Sjimharris *         individual fields please reference the SAS specification Link
873230557Sjimharris *         layer section on address frames.
874230557Sjimharris */
875230557Sjimharristypedef struct SMP_RESPONSE_REPORT_PHY_SATA
876230557Sjimharris{
877230557Sjimharris  U32 ignored_byte_4_7;       // bytes 4-7
878230557Sjimharris
879230557Sjimharris  U32  affiliations_valid:1;
880230557Sjimharris  U32  affiliations_supported:1;
881230557Sjimharris  U32  reserved_byte11:6;     // byte 11
882230557Sjimharris  U32  ignored_byte10:8;      // byte 10
883230557Sjimharris  U32  phy_identifier:8;      // byte  9
884230557Sjimharris  U32  reserved_byte_8:8;     // byte  8
885230557Sjimharris
886230557Sjimharris  U32  reserved_12_15;
887230557Sjimharris  U32  stp_sas_address[2];
888230557Sjimharris  U8   device_to_host_fis[20];
889230557Sjimharris  U32  reserved_44_47;
890230557Sjimharris  U32  affiliated_stp_initiator_sas_address[2];
891230557Sjimharris
892230557Sjimharris} SMP_RESPONSE_REPORT_PHY_SATA_T;
893230557Sjimharris
894230557Sjimharristypedef struct SMP_RESPONSE_VENDOR_SPECIFIC
895230557Sjimharris{
896230557Sjimharris   U8 response_bytes[SMP_REQUEST_VENDOR_SPECIFIC_MAX_LENGTH];
897230557Sjimharris}SMP_RESPONSE_VENDOR_SPECIFIC_T;
898230557Sjimharris
899230557Sjimharristypedef union SMP_RESPONSE_BODY
900230557Sjimharris{
901230557Sjimharris   SMP_RESPONSE_REPORT_GENERAL_T report_general;
902230557Sjimharris   SMP_RESPONSE_REPORT_MANUFACTURER_INFORMATION_T report_manufacturer_information;
903230557Sjimharris   SMP_RESPONSE_DISCOVER_T discover;
904230557Sjimharris   SMP_RESPONSE_REPORT_PHY_SATA_T report_phy_sata;
905230557Sjimharris   SMP_RESPONSE_VENDOR_SPECIFIC_T vendor_specific_response;
906230557Sjimharris} SMP_RESPONSE_BODY_T;
907230557Sjimharris
908230557Sjimharris/**
909230557Sjimharris * @struct SMP_RESPONSE
910230557Sjimharris * @brief  This structure simply unionizes the existing response
911230557Sjimharris *         structures into a common response type.
912230557Sjimharris */
913230557Sjimharristypedef struct _SMP_RESPONSE
914230557Sjimharris{
915230557Sjimharris   SMP_RESPONSE_HEADER_T header;
916230557Sjimharris
917230557Sjimharris   SMP_RESPONSE_BODY_T   response;
918230557Sjimharris
919230557Sjimharris} SMP_RESPONSE_T;
920230557Sjimharris
921230557Sjimharris// SMP Request Functions
922230557Sjimharris#define SMP_FUNCTION_REPORT_GENERAL                   0x00
923230557Sjimharris#define SMP_FUNCTION_REPORT_MANUFACTURER_INFORMATION  0x01
924230557Sjimharris#define SMP_FUNCTION_DISCOVER                         0x10
925230557Sjimharris#define SMP_FUNCTION_REPORT_PHY_ERROR_LOG             0x11
926230557Sjimharris#define SMP_FUNCTION_REPORT_PHY_SATA                  0x12
927230557Sjimharris#define SMP_FUNCTION_REPORT_ROUTE_INFORMATION         0X13
928230557Sjimharris#define SMP_FUNCTION_CONFIGURE_ROUTE_INFORMATION      0X90
929230557Sjimharris#define SMP_FUNCTION_PHY_CONTROL                      0x91
930230557Sjimharris#define SMP_FUNCTION_PHY_TEST                         0x92
931230557Sjimharris
932230557Sjimharris#define SMP_FRAME_TYPE_REQUEST          0x40
933230557Sjimharris#define SMP_FRAME_TYPE_RESPONSE         0x41
934230557Sjimharris
935230557Sjimharris#define PHY_OPERATION_NOP               0x00
936230557Sjimharris#define PHY_OPERATION_LINK_RESET        0x01
937230557Sjimharris#define PHY_OPERATION_HARD_RESET        0x02
938230557Sjimharris#define PHY_OPERATION_DISABLE           0x03
939230557Sjimharris#define PHY_OPERATION_CLEAR_ERROR_LOG   0x05
940230557Sjimharris#define PHY_OPERATION_CLEAR_AFFILIATION 0x06
941230557Sjimharris
942230557Sjimharris#define NPLR_PHY_ENABLED_UNK_LINK_RATE 0x00
943230557Sjimharris#define NPLR_PHY_DISABLED     0x01
944230557Sjimharris#define NPLR_PHY_ENABLED_SPD_NEG_FAILED   0x02
945230557Sjimharris#define NPLR_PHY_ENABLED_SATA_HOLD  0x03
946230557Sjimharris#define NPLR_PHY_ENABLED_1_5G    0x08
947230557Sjimharris#define NPLR_PHY_ENABLED_3_0G    0x09
948230557Sjimharris
949230557Sjimharris// SMP Function Result values.
950230557Sjimharris#define SMP_RESULT_FUNCTION_ACCEPTED              0x00
951230557Sjimharris#define SMP_RESULT_UNKNOWN_FUNCTION               0x01
952230557Sjimharris#define SMP_RESULT_FUNCTION_FAILED                0x02
953230557Sjimharris#define SMP_RESULT_INVALID_REQUEST_FRAME_LEN      0x03
954230557Sjimharris#define SMP_RESULT_INAVALID_EXPANDER_CHANGE_COUNT 0x04
955230557Sjimharris#define SMP_RESULT_BUSY                           0x05
956230557Sjimharris#define SMP_RESULT_INCOMPLETE_DESCRIPTOR_LIST     0x06
957230557Sjimharris#define SMP_RESULT_PHY_DOES_NOT_EXIST             0x10
958230557Sjimharris#define SMP_RESULT_INDEX_DOES_NOT_EXIST           0x11
959230557Sjimharris#define SMP_RESULT_PHY_DOES_NOT_SUPPORT_SATA      0x12
960230557Sjimharris#define SMP_RESULT_UNKNOWN_PHY_OPERATION          0x13
961230557Sjimharris#define SMP_RESULT_UNKNOWN_PHY_TEST_FUNCTION      0x14
962230557Sjimharris#define SMP_RESULT_PHY_TEST_IN_PROGRESS           0x15
963230557Sjimharris#define SMP_RESULT_PHY_VACANT                     0x16
964230557Sjimharris
965230557Sjimharris/* Attached Device Types */
966230557Sjimharris#define SMP_NO_DEVICE_ATTACHED      0
967230557Sjimharris#define SMP_END_DEVICE_ONLY         1
968230557Sjimharris#define SMP_EDGE_EXPANDER_DEVICE    2
969230557Sjimharris#define SMP_FANOUT_EXPANDER_DEVICE  3
970230557Sjimharris
971230557Sjimharris/* Expander phy routine attribute */
972230557Sjimharris#define DIRECT_ROUTING_ATTRIBUTE        0
973230557Sjimharris#define SUBTRACTIVE_ROUTING_ATTRIBUTE   1
974230557Sjimharris#define TABLE_ROUTING_ATTRIBUTE         2
975230557Sjimharris
976230557Sjimharris#endif // _INTEL_SAS_H_
977230557Sjimharris
978