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