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