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