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