1/*-
2 * This file is provided under a dual BSD/GPLv2 license.  When using or
3 * redistributing this file, you may do so under either license.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of version 2 of the GNU General Public License as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
23 *
24 * BSD LICENSE
25 *
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 *
33 *   * Redistributions of source code must retain the above copyright
34 *     notice, this list of conditions and the following disclaimer.
35 *   * Redistributions in binary form must reproduce the above copyright
36 *     notice, this list of conditions and the following disclaimer in
37 *     the documentation and/or other materials provided with the
38 *     distribution.
39 *
40 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 *
52 * $FreeBSD$
53 */
54#ifndef __SCU_REMOTE_NODE_CONTEXT_HEADER__
55#define __SCU_REMOTE_NODE_CONTEXT_HEADER__
56
57/**
58 * @file
59 *
60 * @brief This file contains the structures and constatns used by the SCU
61 * hardware to describe a remote node context.
62 */
63
64#ifdef __cplusplus
65extern "C" {
66#endif // __cplusplus
67
68#include <dev/isci/scil/sci_types.h>
69
70/**
71 * @struct SSP_REMOTE_NODE_CONTEXT
72 *
73 * @brief This structure contains the SCU hardware definition for an SSP
74 *       remote node.
75 */
76typedef struct SSP_REMOTE_NODE_CONTEXT
77{
78   // WORD 0
79
80   /**
81    * This field is the remote node index assigned for this remote node. All
82    * remote nodes must have a unique remote node index. The value of the remote
83    * node index can not exceed the maximum number of remote nodes reported in
84    * the SCU device context capacity register.
85    */
86   U32 remote_node_index       :12;
87   U32 reserved0_1             : 4;
88
89   /**
90    * This field tells the SCU hardware how many simultaneous connections that
91    * this remote node will support.
92    */
93   U32 remote_node_port_width  : 4;
94
95   /**
96    * This field tells the SCU hardware which logical port to associate with this
97    * remote node.
98    */
99   U32 logical_port_index      : 3;
100   U32 reserved0_2             : 5;
101
102   /**
103    * This field will enable the I_T nexus loss timer for this remote node.
104    */
105   U32 nexus_loss_timer_enable : 1;
106
107   /**
108    * This field is the for driver debug only and is not used.
109    */
110   U32 check_bit               : 1;
111
112   /**
113    * This field must be set to TRUE when the hardware DMAs the remote node
114    * context to the hardware SRAM.  When the remote node is being invalidated
115    * this field must be set to FALSE.
116    */
117   U32 is_valid                : 1;
118
119   /**
120    * This field must be set to TRUE.
121    */
122   U32 is_remote_node_context  : 1;
123
124   // WORD 1 - 2
125
126   /**
127    * This is the low word of the remote device SAS Address
128    */
129   U32 remote_sas_address_lo;
130
131   /**
132    * This field is the high word of the remote device SAS Address
133    */
134   U32 remote_sas_address_hi;
135
136   // WORD 3
137   /**
138    * This field reprensets the function number assigned to this remote device.
139    * This value must match the virtual function number that is being used to
140    * communicate to the device.
141    */
142   U32 function_number         : 8;
143   U32 reserved3_1             : 8;
144
145   /**
146    * This field provides the driver a way to cheat on the arbitration wait time
147    * for this remote node.
148    */
149   U32 arbitration_wait_time   :16;
150
151   // WORD 4
152   /**
153    * This field tells the SCU hardware how long this device may occupy the
154    * connection before it must be closed.
155    */
156   U32 connection_occupancy_timeout  :16;
157
158   /**
159    * This field tells the SCU hardware how long to maintain a connection when
160    * there are no frames being transmitted on the link.
161    */
162   U32 connection_inactivity_timeout :16;
163
164   // WORD  5
165   /**
166    * This field allows the driver to cheat on the arbitration wait time for this
167    * remote node.
168    */
169   U32 initial_arbitration_wait_time :16;
170
171   /**
172    * This field is tells the hardware what to program for the connection rate in
173    * the open address frame.  See the SAS spec for valid values.
174    */
175   U32 oaf_connection_rate           : 4;
176
177   /**
178    * This field tells the SCU hardware what to program for the features in the
179    * open address frame.  See the SAS spec for valid values.
180    */
181   U32 oaf_features                  : 4;
182
183   /**
184    * This field tells the SCU hardware what to use for the source zone group in
185    * the open address frame.  See the SAS spec for more details on zoning.
186    */
187   U32 oaf_source_zone_group         : 8;
188
189   // WORD 6
190   /**
191    * This field tells the SCU hardware what to use as the more capibilities in
192    * the open address frame. See the SAS Spec for details.
193    */
194   U32 oaf_more_compatibility_features;
195
196   // WORD 7
197   U32 reserved7;
198
199} SSP_REMOTE_NODE_CONTEXT_T;
200
201/**
202 * @struct STP_REMOTE_NODE_CONTEXT
203 *
204 * @brief This structure contains the SCU hardware definition for a STP remote
205 *        node.
206 *
207 * @todo STP Targets are not yet supported so this definition is a placeholder
208 *       until we do support them.
209 */
210typedef struct STP_REMOTE_NODE_CONTEXT
211{
212   /**
213    * Placeholder data for the STP remote node.
214    */
215   U32 data[8];
216
217} STP_REMOTE_NODE_CONTEXT_T;
218
219/**
220 * @union SCU_REMOTE_NODE_CONTEXT
221 *
222 * @brief This union combines the SAS and SATA remote node definitions.
223 */
224typedef union SCU_REMOTE_NODE_CONTEXT
225{
226   /**
227    * SSP Remote Node
228    */
229   SSP_REMOTE_NODE_CONTEXT_T ssp;
230
231   /**
232    * STP Remote Node
233    */
234   STP_REMOTE_NODE_CONTEXT_T stp;
235
236} SCU_REMOTE_NODE_CONTEXT_T;
237
238#ifdef __cplusplus
239}
240#endif // __cplusplus
241
242#endif // __SCU_REMOTE_NODE_CONTEXT_HEADER__
243