xref: /freebsd/sys/dev/isci/scil/scic_config_parameters.h (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
3  *
4  * This file is provided under a dual BSD/GPLv2 license.  When using or
5  * redistributing this file, you may do so under either license.
6  *
7  * GPL LICENSE SUMMARY
8  *
9  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of version 2 of the GNU General Public License as
13  * published by the Free Software Foundation.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
23  * The full GNU General Public License is included in this distribution
24  * in the file called LICENSE.GPL.
25  *
26  * BSD LICENSE
27  *
28  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
29  * All rights reserved.
30  *
31  * Redistribution and use in source and binary forms, with or without
32  * modification, are permitted provided that the following conditions
33  * are met:
34  *
35  *   * Redistributions of source code must retain the above copyright
36  *     notice, this list of conditions and the following disclaimer.
37  *   * Redistributions in binary form must reproduce the above copyright
38  *     notice, this list of conditions and the following disclaimer in
39  *     the documentation and/or other materials provided with the
40  *     distribution.
41  *
42  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53  *
54  * $FreeBSD$
55  */
56 #ifndef _SCIC_SDS_USER_PARAMETERS_H_
57 #define _SCIC_SDS_USER_PARAMETERS_H_
58 
59 /**
60  * @file
61  *
62  * @brief This file contains all of the structure definitions and interface
63  *        methods that can be called by a SCIC user on the SCU Driver
64  *        Standard (SCIC_SDS_USER_PARAMETERS_T) user parameter block.
65  */
66 
67 #ifdef __cplusplus
68 extern "C" {
69 #endif // __cplusplus
70 
71 #include <dev/isci/scil/sci_types.h>
72 #include <dev/isci/scil/sci_status.h>
73 #include <dev/isci/scil/intel_sas.h>
74 #include <dev/isci/scil/sci_controller_constants.h>
75 #include <dev/isci/scil/scu_bios_definitions.h>
76 
77 /**
78  * @name SCIC_SDS_PARM_PHY_SPEED
79  *
80  * These constants define the speeds utilized for a phy/port.
81  */
82 /*@{*/
83 #define SCIC_SDS_PARM_NO_SPEED   0
84 
85 /**
86  * This value of 1 indicates generation 1 (i.e. 1.5 Gb/s).
87  */
88 #define SCIC_SDS_PARM_GEN1_SPEED 1
89 
90 /**
91  * This value of 2 indicates generation 2 (i.e. 3.0 Gb/s).
92  */
93 #define SCIC_SDS_PARM_GEN2_SPEED 2
94 
95 /**
96  * This value of 3 indicates generation 3 (i.e. 6.0 Gb/s).
97  */
98 #define SCIC_SDS_PARM_GEN3_SPEED 3
99 
100 /**
101  * For range checks, the max speed generation
102  */
103 #define SCIC_SDS_PARM_MAX_SPEED SCIC_SDS_PARM_GEN3_SPEED
104 /*@}*/
105 
106 /**
107  * @struct SCIC_SDS_USER_PARAMETERS
108  *
109  * @brief This structure delineates the various user parameters that can be
110  *        changed by the core user.
111  */
112 typedef struct SCIC_SDS_USER_PARAMETERS
113 {
114    struct
115    {
116       /**
117        * This field specifies the NOTIFY (ENABLE SPIN UP) primitive
118        * insertion frequency for this phy index.
119        */
120       U32  notify_enable_spin_up_insertion_frequency;
121 
122       /**
123        * This method specifies the number of transmitted DWORDs within which
124        * to transmit a single ALIGN primitive.  This value applies regardless
125        * of what type of device is attached or connection state.  A value of
126        * 0 indicates that no ALIGN primitives will be inserted.
127        */
128       U16  align_insertion_frequency;
129 
130       /**
131        * This method specifies the number of transmitted DWORDs within which
132        * to transmit 2 ALIGN primitives.  This applies for SAS connections
133        * only.  A minimum value of 3 is required for this field.
134        */
135       U16  in_connection_align_insertion_frequency;
136 
137       /**
138        * This field indicates the maximum speed generation to be utilized
139        * by phys in the supplied port.
140        * - A value of 1 indicates generation 1 (i.e. 1.5 Gb/s).
141        * - A value of 2 indicates generation 2 (i.e. 3.0 Gb/s).
142        * - A value of 3 indicates generation 3 (i.e. 6.0 Gb/s).
143        */
144       U8 max_speed_generation;
145 
146    } phys[SCI_MAX_PHYS];
147 
148 
149    /**
150     * This field specifies the number of seconds to allow a phy to consume
151     * power before yielding to another phy.
152     *
153     */
154    U8  phy_spin_up_delay_interval;
155 
156    /**
157    * These timer values specifies how long a link will remain open with no
158    * activity in increments of a microsecond, it can be in increments of
159    * 100 microseconds if the upper most bit is set.
160    *
161    */
162    U16 stp_inactivity_timeout;
163    U16 ssp_inactivity_timeout;
164 
165    /**
166    * These timer values specifies how long a link will remain open in increments
167    * of 100 microseconds.
168    *
169    */
170    U16 stp_max_occupancy_timeout;
171    U16 ssp_max_occupancy_timeout;
172 
173    /**
174    * This timer value specifies how long a link will remain open with no
175    * outbound traffic in increments of a microsecond.
176    *
177    */
178    U8 no_outbound_task_timeout;
179 
180 } SCIC_SDS_USER_PARAMETERS_T;
181 
182 /**
183  * @union SCIC_USER_PARAMETERS
184  * @brief This structure/union specifies the various different user
185  *        parameter sets available.  Each type is specific to a hardware
186  *        controller version.
187  */
188 typedef union SCIC_USER_PARAMETERS
189 {
190    /**
191     * This field specifies the user parameters specific to the
192     * Storage Controller Unit (SCU) Driver Standard (SDS) version
193     * 1.
194     */
195    SCIC_SDS_USER_PARAMETERS_T sds1;
196 
197 } SCIC_USER_PARAMETERS_T;
198 
199 
200 /**
201  * @name SCIC_SDS_OEM_PHY_MASK
202  *
203  * These constants define the valid values for phy_mask
204  */
205 /*@{*/
206 
207 /**
208  * This is the min value assignable to a port's phy mask
209  */
210 #define SCIC_SDS_PARM_PHY_MASK_MIN 0x0
211 
212 /**
213  * This is the max value assignable to a port's phy mask
214  */
215 #define SCIC_SDS_PARM_PHY_MASK_MAX 0xF
216 /*@}*/
217 
218 #define MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT 4
219 
220 typedef SCI_BIOS_OEM_PARAM_ELEMENT_v_1_3_T SCIC_SDS_OEM_PARAMETERS_T;
221 
222 /**
223  * @union SCIC_OEM_PARAMETERS
224  *
225  * @brief This structure/union specifies the various different OEM
226  *        parameter sets available.  Each type is specific to a hardware
227  *        controller version.
228  */
229 typedef union SCIC_OEM_PARAMETERS
230 {
231    /**
232     * This field specifies the OEM parameters specific to the
233     * Storage Controller Unit (SCU) Driver Standard (SDS) version
234     * 1.
235     */
236    SCIC_SDS_OEM_PARAMETERS_T sds1;
237 
238 } SCIC_OEM_PARAMETERS_T;
239 
240 /**
241  * @union OEM_SSC_DATA
242  *
243  * @brief This typedef provides a means to convert from the original
244  *        1.0 version of the OEM PARAMETER do_enable_ssc to the more
245  *        comprehensive 1.1 version of enabling SSC parameters.
246  *        For the definition of the field members see scu_bios_definitions.h
247  *        header file or refer to the SCU BIOS Writers Guide.
248  */
249 typedef union OEM_SSC_PARAMETERS
250 {
251    struct
252    {
253       U8 ssc_sata_tx_spread_level : 4;
254       U8 ssc_sas_tx_spread_level : 3;
255       U8 ssc_sas_tx_type : 1;
256    } bf;
257 
258    U8 do_enable_ssc;
259 
260 } OEM_SSC_PARAMETERS_T;
261 
262 /**
263  * @brief This method allows the user to attempt to change the user
264  *        parameters utilized by the controller.
265  *
266  * @param[in] controller This parameter specifies the controller on which
267  *            to set the user parameters.
268  * @param[in] user_parameters This parameter specifies the USER_PARAMETERS
269  *            object containing the potential new values.
270  *
271  * @return Indicate if the update of the user parameters was successful.
272  * @retval SCI_SUCCESS This value is returned if the operation succeeded.
273  * @retval SCI_FAILURE_INVALID_STATE This value is returned if the attempt
274  *         to change the user parameter failed, because changing one of
275  *         the parameters is not currently allowed.
276  * @retval SCI_FAILURE_INVALID_PARAMETER_VALUE This value is returned if the
277  *         user supplied an invalid interrupt coalescence time, spin up
278  *         delay interval, etc.
279  */
280 SCI_STATUS scic_user_parameters_set(
281    SCI_CONTROLLER_HANDLE_T   controller,
282    SCIC_USER_PARAMETERS_T  * user_parameters
283 );
284 
285 /**
286  * @brief This method allows the user to retrieve the user parameters
287  *        utilized by the controller.
288  *
289  * @param[in] controller This parameter specifies the controller on which
290  *            to set the user parameters.
291  * @param[in] user_parameters This parameter specifies the USER_PARAMETERS
292  *            object into which the framework shall save it's parameters.
293  *
294  * @return none
295  */
296 void scic_user_parameters_get(
297    SCI_CONTROLLER_HANDLE_T   controller,
298    SCIC_USER_PARAMETERS_T  * user_parameters
299 );
300 
301 /**
302  * @brief This method allows the user to attempt to change the OEM
303  *        parameters utilized by the controller.
304  *
305  * @param[in] controller This parameter specifies the controller on which
306  *            to set the user parameters.
307  * @param[in] oem_parameters This parameter specifies the OEM parameters
308  *            object containing the potential new values.
309  * @param[in] oem_parameters_version This parameter is the OEM block version
310  *            value indicating the format of the data associated with
311  *            oem_parameters.
312  *
313  * @return Indicate if the update of the user parameters was successful.
314  * @retval SCI_SUCCESS This value is returned if the operation succeeded.
315  * @retval SCI_FAILURE_INVALID_STATE This value is returned if the attempt
316  *         to change the user parameter failed, because changing one of
317  *         the parameters is not currently allowed.
318  * @retval SCI_FAILURE_INVALID_PARAMETER_VALUE This value is returned if the
319  *         user supplied an unsupported value for one of the OEM parameters.
320  */
321 SCI_STATUS scic_oem_parameters_set(
322    SCI_CONTROLLER_HANDLE_T   controller,
323    SCIC_OEM_PARAMETERS_T   * oem_parameters,
324    U8 oem_parameters_version
325 );
326 
327 /**
328  * @brief This method allows the user to retrieve the OEM
329  *        parameters utilized by the controller.
330  *
331  * @param[in]  controller This parameter specifies the controller on which
332  *             to set the user parameters.
333  * @param[out] oem_parameters This parameter specifies the OEM parameters
334  *             object in which to write the core's OEM parameters.
335  *
336  * @return none
337  */
338 void scic_oem_parameters_get(
339    SCI_CONTROLLER_HANDLE_T   controller,
340    SCIC_OEM_PARAMETERS_T   * oem_parameters
341 );
342 
343 #ifdef __cplusplus
344 }
345 #endif // __cplusplus
346 
347 #endif // _SCIC_SDS_USER_PARAMETERS_H_
348 
349