isci: Intel(R) C600 Series Chipset Storage Control Unit Driver
[firefly-linux-kernel-4.4.55.git] / drivers / scsi / isci / core / scu_remote_node_context.h
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  *   * Neither the name of Intel Corporation nor the names of its
40  *     contributors may be used to endorse or promote products derived
41  *     from this software without specific prior written permission.
42  *
43  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
44  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
45  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
46  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
47  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
50  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
51  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54  */
55
56 #ifndef __SCU_REMOTE_NODE_CONTEXT_HEADER__
57 #define __SCU_REMOTE_NODE_CONTEXT_HEADER__
58
59 /**
60  * This file contains the structures and constatns used by the SCU hardware to
61  *    describe a remote node context.
62  *
63  *
64  */
65 #include "sci_types.h"
66
67 /**
68  * struct ssp_remote_node_context - This structure contains the SCU hardware
69  *    definition for an SSP remote node.
70  *
71  *
72  */
73 struct ssp_remote_node_context {
74         /* WORD 0 */
75
76         /**
77          * This field is the remote node index assigned for this remote node. All
78          * remote nodes must have a unique remote node index. The value of the remote
79          * node index can not exceed the maximum number of remote nodes reported in
80          * the SCU device context capacity register.
81          */
82         u32 remote_node_index:12;
83         u32 reserved0_1:4;
84
85         /**
86          * This field tells the SCU hardware how many simultaneous connections that
87          * this remote node will support.
88          */
89         u32 remote_node_port_width:4;
90
91         /**
92          * This field tells the SCU hardware which logical port to associate with this
93          * remote node.
94          */
95         u32 logical_port_index:3;
96         u32 reserved0_2:5;
97
98         /**
99          * This field will enable the I_T nexus loss timer for this remote node.
100          */
101         u32 nexus_loss_timer_enable:1;
102
103         /**
104          * This field is the for driver debug only and is not used.
105          */
106         u32 check_bit:1;
107
108         /**
109          * This field must be set to true when the hardware DMAs the remote node
110          * context to the hardware SRAM.  When the remote node is being invalidated
111          * this field must be set to false.
112          */
113         u32 is_valid:1;
114
115         /**
116          * This field must be set to true.
117          */
118         u32 is_remote_node_context:1;
119
120         /* WORD 1 - 2 */
121
122         /**
123          * This is the low word of the remote device SAS Address
124          */
125         u32 remote_sas_address_lo;
126
127         /**
128          * This field is the high word of the remote device SAS Address
129          */
130         u32 remote_sas_address_hi;
131
132         /* WORD 3 */
133         /**
134          * This field reprensets the function number assigned to this remote device.
135          * This value must match the virtual function number that is being used to
136          * communicate to the device.
137          */
138         u32 function_number:8;
139         u32 reserved3_1:8;
140
141         /**
142          * This field provides the driver a way to cheat on the arbitration wait time
143          * for this remote node.
144          */
145         u32 arbitration_wait_time:16;
146
147         /* WORD 4 */
148         /**
149          * This field tells the SCU hardware how long this device may occupy the
150          * connection before it must be closed.
151          */
152         u32 connection_occupancy_timeout:16;
153
154         /**
155          * This field tells the SCU hardware how long to maintain a connection when
156          * there are no frames being transmitted on the link.
157          */
158         u32 connection_inactivity_timeout:16;
159
160         /* WORD  5 */
161         /**
162          * This field allows the driver to cheat on the arbitration wait time for this
163          * remote node.
164          */
165         u32 initial_arbitration_wait_time:16;
166
167         /**
168          * This field is tells the hardware what to program for the connection rate in
169          * the open address frame.  See the SAS spec for valid values.
170          */
171         u32 oaf_connection_rate:4;
172
173         /**
174          * This field tells the SCU hardware what to program for the features in the
175          * open address frame.  See the SAS spec for valid values.
176          */
177         u32 oaf_features:4;
178
179         /**
180          * This field tells the SCU hardware what to use for the source zone group in
181          * the open address frame.  See the SAS spec for more details on zoning.
182          */
183         u32 oaf_source_zone_group:8;
184
185         /* WORD 6 */
186         /**
187          * This field tells the SCU hardware what to use as the more capibilities in
188          * the open address frame. See the SAS Spec for details.
189          */
190         u32 oaf_more_compatibility_features;
191
192         /* WORD 7 */
193         u32 reserved7;
194
195 };
196
197 /**
198  * struct stp_remote_node_context - This structure contains the SCU hardware
199  *    definition for a STP remote node.
200  *
201  * STP Targets are not yet supported so this definition is a placeholder until
202  * we do support them.
203  */
204 struct stp_remote_node_context {
205         /**
206          * Placeholder data for the STP remote node.
207          */
208         u32 data[8];
209
210 };
211
212 /**
213  * This union combines the SAS and SATA remote node definitions.
214  *
215  * union scu_remote_node_context
216  */
217 union scu_remote_node_context {
218         /**
219          * SSP Remote Node
220          */
221         struct ssp_remote_node_context ssp;
222
223         /**
224          * STP Remote Node
225          */
226         struct stp_remote_node_context stp;
227
228 };
229
230 #endif /* __SCU_REMOTE_NODE_CONTEXT_HEADER__ */