1230557Sjimharris/*-
2230557Sjimharris * This file is provided under a dual BSD/GPLv2 license.  When using or
3230557Sjimharris * redistributing this file, you may do so under either license.
4230557Sjimharris *
5230557Sjimharris * GPL LICENSE SUMMARY
6230557Sjimharris *
7230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8230557Sjimharris *
9230557Sjimharris * This program is free software; you can redistribute it and/or modify
10230557Sjimharris * it under the terms of version 2 of the GNU General Public License as
11230557Sjimharris * published by the Free Software Foundation.
12230557Sjimharris *
13230557Sjimharris * This program is distributed in the hope that it will be useful, but
14230557Sjimharris * WITHOUT ANY WARRANTY; without even the implied warranty of
15230557Sjimharris * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16230557Sjimharris * General Public License for more details.
17230557Sjimharris *
18230557Sjimharris * You should have received a copy of the GNU General Public License
19230557Sjimharris * along with this program; if not, write to the Free Software
20230557Sjimharris * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21230557Sjimharris * The full GNU General Public License is included in this distribution
22230557Sjimharris * in the file called LICENSE.GPL.
23230557Sjimharris *
24230557Sjimharris * BSD LICENSE
25230557Sjimharris *
26230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27230557Sjimharris * All rights reserved.
28230557Sjimharris *
29230557Sjimharris * Redistribution and use in source and binary forms, with or without
30230557Sjimharris * modification, are permitted provided that the following conditions
31230557Sjimharris * are met:
32230557Sjimharris *
33230557Sjimharris *   * Redistributions of source code must retain the above copyright
34230557Sjimharris *     notice, this list of conditions and the following disclaimer.
35230557Sjimharris *   * Redistributions in binary form must reproduce the above copyright
36230557Sjimharris *     notice, this list of conditions and the following disclaimer in
37230557Sjimharris *     the documentation and/or other materials provided with the
38230557Sjimharris *     distribution.
39230557Sjimharris *
40230557Sjimharris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41230557Sjimharris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42230557Sjimharris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43230557Sjimharris * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44230557Sjimharris * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45230557Sjimharris * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46230557Sjimharris * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47230557Sjimharris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48230557Sjimharris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49230557Sjimharris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50230557Sjimharris * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51230557Sjimharris *
52230557Sjimharris * $FreeBSD$
53230557Sjimharris */
54230557Sjimharris#ifndef __SCU_REMOTE_NODE_CONTEXT_HEADER__
55230557Sjimharris#define __SCU_REMOTE_NODE_CONTEXT_HEADER__
56230557Sjimharris
57230557Sjimharris/**
58230557Sjimharris * @file
59230557Sjimharris *
60230557Sjimharris * @brief This file contains the structures and constatns used by the SCU
61230557Sjimharris * hardware to describe a remote node context.
62230557Sjimharris */
63230557Sjimharris
64230557Sjimharris#ifdef __cplusplus
65230557Sjimharrisextern "C" {
66230557Sjimharris#endif // __cplusplus
67230557Sjimharris
68230557Sjimharris#include <dev/isci/scil/sci_types.h>
69230557Sjimharris
70230557Sjimharris/**
71230557Sjimharris * @struct SSP_REMOTE_NODE_CONTEXT
72230557Sjimharris *
73230557Sjimharris * @brief This structure contains the SCU hardware definition for an SSP
74230557Sjimharris *       remote node.
75230557Sjimharris */
76230557Sjimharristypedef struct SSP_REMOTE_NODE_CONTEXT
77230557Sjimharris{
78230557Sjimharris   // WORD 0
79230557Sjimharris
80230557Sjimharris   /**
81230557Sjimharris    * This field is the remote node index assigned for this remote node. All
82230557Sjimharris    * remote nodes must have a unique remote node index. The value of the remote
83230557Sjimharris    * node index can not exceed the maximum number of remote nodes reported in
84230557Sjimharris    * the SCU device context capacity register.
85230557Sjimharris    */
86230557Sjimharris   U32 remote_node_index       :12;
87230557Sjimharris   U32 reserved0_1             : 4;
88230557Sjimharris
89230557Sjimharris   /**
90230557Sjimharris    * This field tells the SCU hardware how many simultaneous connections that
91230557Sjimharris    * this remote node will support.
92230557Sjimharris    */
93230557Sjimharris   U32 remote_node_port_width  : 4;
94230557Sjimharris
95230557Sjimharris   /**
96230557Sjimharris    * This field tells the SCU hardware which logical port to associate with this
97230557Sjimharris    * remote node.
98230557Sjimharris    */
99230557Sjimharris   U32 logical_port_index      : 3;
100230557Sjimharris   U32 reserved0_2             : 5;
101230557Sjimharris
102230557Sjimharris   /**
103230557Sjimharris    * This field will enable the I_T nexus loss timer for this remote node.
104230557Sjimharris    */
105230557Sjimharris   U32 nexus_loss_timer_enable : 1;
106230557Sjimharris
107230557Sjimharris   /**
108230557Sjimharris    * This field is the for driver debug only and is not used.
109230557Sjimharris    */
110230557Sjimharris   U32 check_bit               : 1;
111230557Sjimharris
112230557Sjimharris   /**
113230557Sjimharris    * This field must be set to TRUE when the hardware DMAs the remote node
114230557Sjimharris    * context to the hardware SRAM.  When the remote node is being invalidated
115230557Sjimharris    * this field must be set to FALSE.
116230557Sjimharris    */
117230557Sjimharris   U32 is_valid                : 1;
118230557Sjimharris
119230557Sjimharris   /**
120230557Sjimharris    * This field must be set to TRUE.
121230557Sjimharris    */
122230557Sjimharris   U32 is_remote_node_context  : 1;
123230557Sjimharris
124230557Sjimharris   // WORD 1 - 2
125230557Sjimharris
126230557Sjimharris   /**
127230557Sjimharris    * This is the low word of the remote device SAS Address
128230557Sjimharris    */
129230557Sjimharris   U32 remote_sas_address_lo;
130230557Sjimharris
131230557Sjimharris   /**
132230557Sjimharris    * This field is the high word of the remote device SAS Address
133230557Sjimharris    */
134230557Sjimharris   U32 remote_sas_address_hi;
135230557Sjimharris
136230557Sjimharris   // WORD 3
137230557Sjimharris   /**
138230557Sjimharris    * This field reprensets the function number assigned to this remote device.
139230557Sjimharris    * This value must match the virtual function number that is being used to
140230557Sjimharris    * communicate to the device.
141230557Sjimharris    */
142230557Sjimharris   U32 function_number         : 8;
143230557Sjimharris   U32 reserved3_1             : 8;
144230557Sjimharris
145230557Sjimharris   /**
146230557Sjimharris    * This field provides the driver a way to cheat on the arbitration wait time
147230557Sjimharris    * for this remote node.
148230557Sjimharris    */
149230557Sjimharris   U32 arbitration_wait_time   :16;
150230557Sjimharris
151230557Sjimharris   // WORD 4
152230557Sjimharris   /**
153230557Sjimharris    * This field tells the SCU hardware how long this device may occupy the
154230557Sjimharris    * connection before it must be closed.
155230557Sjimharris    */
156230557Sjimharris   U32 connection_occupancy_timeout  :16;
157230557Sjimharris
158230557Sjimharris   /**
159230557Sjimharris    * This field tells the SCU hardware how long to maintain a connection when
160230557Sjimharris    * there are no frames being transmitted on the link.
161230557Sjimharris    */
162230557Sjimharris   U32 connection_inactivity_timeout :16;
163230557Sjimharris
164230557Sjimharris   // WORD  5
165230557Sjimharris   /**
166230557Sjimharris    * This field allows the driver to cheat on the arbitration wait time for this
167230557Sjimharris    * remote node.
168230557Sjimharris    */
169230557Sjimharris   U32 initial_arbitration_wait_time :16;
170230557Sjimharris
171230557Sjimharris   /**
172230557Sjimharris    * This field is tells the hardware what to program for the connection rate in
173230557Sjimharris    * the open address frame.  See the SAS spec for valid values.
174230557Sjimharris    */
175230557Sjimharris   U32 oaf_connection_rate           : 4;
176230557Sjimharris
177230557Sjimharris   /**
178230557Sjimharris    * This field tells the SCU hardware what to program for the features in the
179230557Sjimharris    * open address frame.  See the SAS spec for valid values.
180230557Sjimharris    */
181230557Sjimharris   U32 oaf_features                  : 4;
182230557Sjimharris
183230557Sjimharris   /**
184230557Sjimharris    * This field tells the SCU hardware what to use for the source zone group in
185230557Sjimharris    * the open address frame.  See the SAS spec for more details on zoning.
186230557Sjimharris    */
187230557Sjimharris   U32 oaf_source_zone_group         : 8;
188230557Sjimharris
189230557Sjimharris   // WORD 6
190230557Sjimharris   /**
191230557Sjimharris    * This field tells the SCU hardware what to use as the more capibilities in
192230557Sjimharris    * the open address frame. See the SAS Spec for details.
193230557Sjimharris    */
194230557Sjimharris   U32 oaf_more_compatibility_features;
195230557Sjimharris
196230557Sjimharris   // WORD 7
197230557Sjimharris   U32 reserved7;
198230557Sjimharris
199230557Sjimharris} SSP_REMOTE_NODE_CONTEXT_T;
200230557Sjimharris
201230557Sjimharris/**
202230557Sjimharris * @struct STP_REMOTE_NODE_CONTEXT
203230557Sjimharris *
204230557Sjimharris * @brief This structure contains the SCU hardware definition for a STP remote
205230557Sjimharris *        node.
206230557Sjimharris *
207230557Sjimharris * @todo STP Targets are not yet supported so this definition is a placeholder
208230557Sjimharris *       until we do support them.
209230557Sjimharris */
210230557Sjimharristypedef struct STP_REMOTE_NODE_CONTEXT
211230557Sjimharris{
212230557Sjimharris   /**
213230557Sjimharris    * Placeholder data for the STP remote node.
214230557Sjimharris    */
215230557Sjimharris   U32 data[8];
216230557Sjimharris
217230557Sjimharris} STP_REMOTE_NODE_CONTEXT_T;
218230557Sjimharris
219230557Sjimharris/**
220230557Sjimharris * @union SCU_REMOTE_NODE_CONTEXT
221230557Sjimharris *
222230557Sjimharris * @brief This union combines the SAS and SATA remote node definitions.
223230557Sjimharris */
224230557Sjimharristypedef union SCU_REMOTE_NODE_CONTEXT
225230557Sjimharris{
226230557Sjimharris   /**
227230557Sjimharris    * SSP Remote Node
228230557Sjimharris    */
229230557Sjimharris   SSP_REMOTE_NODE_CONTEXT_T ssp;
230230557Sjimharris
231230557Sjimharris   /**
232230557Sjimharris    * STP Remote Node
233230557Sjimharris    */
234230557Sjimharris   STP_REMOTE_NODE_CONTEXT_T stp;
235230557Sjimharris
236230557Sjimharris} SCU_REMOTE_NODE_CONTEXT_T;
237230557Sjimharris
238230557Sjimharris#ifdef __cplusplus
239230557Sjimharris}
240230557Sjimharris#endif // __cplusplus
241230557Sjimharris
242230557Sjimharris#endif // __SCU_REMOTE_NODE_CONTEXT_HEADER__
243