xref: /freebsd/sys/dev/isci/scil/scic_config_parameters.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 _SCIC_SDS_USER_PARAMETERS_H_
55f11c7f63SJim Harris #define _SCIC_SDS_USER_PARAMETERS_H_
56f11c7f63SJim Harris 
57f11c7f63SJim Harris /**
58f11c7f63SJim Harris  * @file
59f11c7f63SJim Harris  *
60f11c7f63SJim Harris  * @brief This file contains all of the structure definitions and interface
61f11c7f63SJim Harris  *        methods that can be called by a SCIC user on the SCU Driver
62f11c7f63SJim Harris  *        Standard (SCIC_SDS_USER_PARAMETERS_T) user parameter block.
63f11c7f63SJim Harris  */
64f11c7f63SJim Harris 
65f11c7f63SJim Harris #ifdef __cplusplus
66f11c7f63SJim Harris extern "C" {
67f11c7f63SJim Harris #endif // __cplusplus
68f11c7f63SJim Harris 
69f11c7f63SJim Harris #include <dev/isci/scil/sci_types.h>
70f11c7f63SJim Harris #include <dev/isci/scil/sci_status.h>
71f11c7f63SJim Harris #include <dev/isci/scil/intel_sas.h>
72f11c7f63SJim Harris #include <dev/isci/scil/sci_controller_constants.h>
73f11c7f63SJim Harris #include <dev/isci/scil/scu_bios_definitions.h>
74f11c7f63SJim Harris 
75f11c7f63SJim Harris /**
76f11c7f63SJim Harris  * @name SCIC_SDS_PARM_PHY_SPEED
77f11c7f63SJim Harris  *
78f11c7f63SJim Harris  * These constants define the speeds utilized for a phy/port.
79f11c7f63SJim Harris  */
80f11c7f63SJim Harris /*@{*/
81f11c7f63SJim Harris #define SCIC_SDS_PARM_NO_SPEED   0
82f11c7f63SJim Harris 
83f11c7f63SJim Harris /**
84f11c7f63SJim Harris  * This value of 1 indicates generation 1 (i.e. 1.5 Gb/s).
85f11c7f63SJim Harris  */
86f11c7f63SJim Harris #define SCIC_SDS_PARM_GEN1_SPEED 1
87f11c7f63SJim Harris 
88f11c7f63SJim Harris /**
89f11c7f63SJim Harris  * This value of 2 indicates generation 2 (i.e. 3.0 Gb/s).
90f11c7f63SJim Harris  */
91f11c7f63SJim Harris #define SCIC_SDS_PARM_GEN2_SPEED 2
92f11c7f63SJim Harris 
93f11c7f63SJim Harris /**
94f11c7f63SJim Harris  * This value of 3 indicates generation 3 (i.e. 6.0 Gb/s).
95f11c7f63SJim Harris  */
96f11c7f63SJim Harris #define SCIC_SDS_PARM_GEN3_SPEED 3
97f11c7f63SJim Harris 
98f11c7f63SJim Harris /**
99f11c7f63SJim Harris  * For range checks, the max speed generation
100f11c7f63SJim Harris  */
101f11c7f63SJim Harris #define SCIC_SDS_PARM_MAX_SPEED SCIC_SDS_PARM_GEN3_SPEED
102f11c7f63SJim Harris /*@}*/
103f11c7f63SJim Harris 
104f11c7f63SJim Harris /**
105f11c7f63SJim Harris  * @struct SCIC_SDS_USER_PARAMETERS
106f11c7f63SJim Harris  *
107f11c7f63SJim Harris  * @brief This structure delineates the various user parameters that can be
108f11c7f63SJim Harris  *        changed by the core user.
109f11c7f63SJim Harris  */
110f11c7f63SJim Harris typedef struct SCIC_SDS_USER_PARAMETERS
111f11c7f63SJim Harris {
112f11c7f63SJim Harris    struct
113f11c7f63SJim Harris    {
114f11c7f63SJim Harris       /**
115f11c7f63SJim Harris        * This field specifies the NOTIFY (ENABLE SPIN UP) primitive
116f11c7f63SJim Harris        * insertion frequency for this phy index.
117f11c7f63SJim Harris        */
118f11c7f63SJim Harris       U32  notify_enable_spin_up_insertion_frequency;
119f11c7f63SJim Harris 
120f11c7f63SJim Harris       /**
121f11c7f63SJim Harris        * This method specifies the number of transmitted DWORDs within which
122f11c7f63SJim Harris        * to transmit a single ALIGN primitive.  This value applies regardless
123f11c7f63SJim Harris        * of what type of device is attached or connection state.  A value of
124f11c7f63SJim Harris        * 0 indicates that no ALIGN primitives will be inserted.
125f11c7f63SJim Harris        */
126f11c7f63SJim Harris       U16  align_insertion_frequency;
127f11c7f63SJim Harris 
128f11c7f63SJim Harris       /**
129f11c7f63SJim Harris        * This method specifies the number of transmitted DWORDs within which
130f11c7f63SJim Harris        * to transmit 2 ALIGN primitives.  This applies for SAS connections
131f11c7f63SJim Harris        * only.  A minimum value of 3 is required for this field.
132f11c7f63SJim Harris        */
133f11c7f63SJim Harris       U16  in_connection_align_insertion_frequency;
134f11c7f63SJim Harris 
135f11c7f63SJim Harris       /**
136f11c7f63SJim Harris        * This field indicates the maximum speed generation to be utilized
137f11c7f63SJim Harris        * by phys in the supplied port.
138f11c7f63SJim Harris        * - A value of 1 indicates generation 1 (i.e. 1.5 Gb/s).
139f11c7f63SJim Harris        * - A value of 2 indicates generation 2 (i.e. 3.0 Gb/s).
140f11c7f63SJim Harris        * - A value of 3 indicates generation 3 (i.e. 6.0 Gb/s).
141f11c7f63SJim Harris        */
142f11c7f63SJim Harris       U8 max_speed_generation;
143f11c7f63SJim Harris 
144f11c7f63SJim Harris    } phys[SCI_MAX_PHYS];
145f11c7f63SJim Harris 
146f11c7f63SJim Harris 
147f11c7f63SJim Harris    /**
148f11c7f63SJim Harris     * This field specifies the number of seconds to allow a phy to consume
149f11c7f63SJim Harris     * power before yielding to another phy.
150f11c7f63SJim Harris     *
151f11c7f63SJim Harris     */
152f11c7f63SJim Harris    U8  phy_spin_up_delay_interval;
153f11c7f63SJim Harris 
154f11c7f63SJim Harris    /**
155f11c7f63SJim Harris    * These timer values specifies how long a link will remain open with no
156f11c7f63SJim Harris    * activity in increments of a microsecond, it can be in increments of
157f11c7f63SJim Harris    * 100 microseconds if the upper most bit is set.
158f11c7f63SJim Harris    *
159f11c7f63SJim Harris    */
160f11c7f63SJim Harris    U16 stp_inactivity_timeout;
161f11c7f63SJim Harris    U16 ssp_inactivity_timeout;
162f11c7f63SJim Harris 
163f11c7f63SJim Harris    /**
164f11c7f63SJim Harris    * These timer values specifies how long a link will remain open in increments
165f11c7f63SJim Harris    * of 100 microseconds.
166f11c7f63SJim Harris    *
167f11c7f63SJim Harris    */
168f11c7f63SJim Harris    U16 stp_max_occupancy_timeout;
169f11c7f63SJim Harris    U16 ssp_max_occupancy_timeout;
170f11c7f63SJim Harris 
171f11c7f63SJim Harris    /**
172f11c7f63SJim Harris    * This timer value specifies how long a link will remain open with no
173f11c7f63SJim Harris    * outbound traffic in increments of a microsecond.
174f11c7f63SJim Harris    *
175f11c7f63SJim Harris    */
176f11c7f63SJim Harris    U8 no_outbound_task_timeout;
177f11c7f63SJim Harris 
178f11c7f63SJim Harris } SCIC_SDS_USER_PARAMETERS_T;
179f11c7f63SJim Harris 
180f11c7f63SJim Harris /**
181f11c7f63SJim Harris  * @union SCIC_USER_PARAMETERS
182f11c7f63SJim Harris  * @brief This structure/union specifies the various different user
183f11c7f63SJim Harris  *        parameter sets available.  Each type is specific to a hardware
184f11c7f63SJim Harris  *        controller version.
185f11c7f63SJim Harris  */
186f11c7f63SJim Harris typedef union SCIC_USER_PARAMETERS
187f11c7f63SJim Harris {
188f11c7f63SJim Harris    /**
189f11c7f63SJim Harris     * This field specifies the user parameters specific to the
190f11c7f63SJim Harris     * Storage Controller Unit (SCU) Driver Standard (SDS) version
191f11c7f63SJim Harris     * 1.
192f11c7f63SJim Harris     */
193f11c7f63SJim Harris    SCIC_SDS_USER_PARAMETERS_T sds1;
194f11c7f63SJim Harris 
195f11c7f63SJim Harris } SCIC_USER_PARAMETERS_T;
196f11c7f63SJim Harris 
197f11c7f63SJim Harris 
198f11c7f63SJim Harris /**
199f11c7f63SJim Harris  * @name SCIC_SDS_OEM_PHY_MASK
200f11c7f63SJim Harris  *
201f11c7f63SJim Harris  * These constants define the valid values for phy_mask
202f11c7f63SJim Harris  */
203f11c7f63SJim Harris /*@{*/
204f11c7f63SJim Harris 
205f11c7f63SJim Harris /**
206f11c7f63SJim Harris  * This is the min value assignable to a port's phy mask
207f11c7f63SJim Harris  */
208f11c7f63SJim Harris #define SCIC_SDS_PARM_PHY_MASK_MIN 0x0
209f11c7f63SJim Harris 
210f11c7f63SJim Harris /**
211f11c7f63SJim Harris  * This is the max value assignable to a port's phy mask
212f11c7f63SJim Harris  */
213f11c7f63SJim Harris #define SCIC_SDS_PARM_PHY_MASK_MAX 0xF
214f11c7f63SJim Harris /*@}*/
215f11c7f63SJim Harris 
216f11c7f63SJim Harris #define MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT 4
217f11c7f63SJim Harris 
218f11c7f63SJim Harris typedef SCI_BIOS_OEM_PARAM_ELEMENT_v_1_3_T SCIC_SDS_OEM_PARAMETERS_T;
219f11c7f63SJim Harris 
220f11c7f63SJim Harris /**
221f11c7f63SJim Harris  * @union SCIC_OEM_PARAMETERS
222f11c7f63SJim Harris  *
223f11c7f63SJim Harris  * @brief This structure/union specifies the various different OEM
224f11c7f63SJim Harris  *        parameter sets available.  Each type is specific to a hardware
225f11c7f63SJim Harris  *        controller version.
226f11c7f63SJim Harris  */
227f11c7f63SJim Harris typedef union SCIC_OEM_PARAMETERS
228f11c7f63SJim Harris {
229f11c7f63SJim Harris    /**
230f11c7f63SJim Harris     * This field specifies the OEM parameters specific to the
231f11c7f63SJim Harris     * Storage Controller Unit (SCU) Driver Standard (SDS) version
232f11c7f63SJim Harris     * 1.
233f11c7f63SJim Harris     */
234f11c7f63SJim Harris    SCIC_SDS_OEM_PARAMETERS_T sds1;
235f11c7f63SJim Harris 
236f11c7f63SJim Harris } SCIC_OEM_PARAMETERS_T;
237f11c7f63SJim Harris 
238f11c7f63SJim Harris /**
239f11c7f63SJim Harris  * @union OEM_SSC_DATA
240f11c7f63SJim Harris  *
241f11c7f63SJim Harris  * @brief This typedef provides a means to convert from the original
242f11c7f63SJim Harris  *        1.0 version of the OEM PARAMETER do_enable_ssc to the more
243f11c7f63SJim Harris  *        comprehensive 1.1 version of enabling SSC parameters.
244f11c7f63SJim Harris  *        For the definition of the field members see scu_bios_definitions.h
245f11c7f63SJim Harris  *        header file or refer to the SCU BIOS Writers Guide.
246f11c7f63SJim Harris  */
247f11c7f63SJim Harris typedef union OEM_SSC_PARAMETERS
248f11c7f63SJim Harris {
249f11c7f63SJim Harris    struct
250f11c7f63SJim Harris    {
251f11c7f63SJim Harris       U8 ssc_sata_tx_spread_level : 4;
252f11c7f63SJim Harris       U8 ssc_sas_tx_spread_level : 3;
253f11c7f63SJim Harris       U8 ssc_sas_tx_type : 1;
254f11c7f63SJim Harris    } bf;
255f11c7f63SJim Harris 
256f11c7f63SJim Harris    U8 do_enable_ssc;
257f11c7f63SJim Harris 
258f11c7f63SJim Harris } OEM_SSC_PARAMETERS_T;
259f11c7f63SJim Harris 
260f11c7f63SJim Harris /**
261f11c7f63SJim Harris  * @brief This method allows the user to attempt to change the user
262f11c7f63SJim Harris  *        parameters utilized by the controller.
263f11c7f63SJim Harris  *
264f11c7f63SJim Harris  * @param[in] controller This parameter specifies the controller on which
265f11c7f63SJim Harris  *            to set the user parameters.
266f11c7f63SJim Harris  * @param[in] user_parameters This parameter specifies the USER_PARAMETERS
267f11c7f63SJim Harris  *            object containing the potential new values.
268f11c7f63SJim Harris  *
269f11c7f63SJim Harris  * @return Indicate if the update of the user parameters was successful.
270f11c7f63SJim Harris  * @retval SCI_SUCCESS This value is returned if the operation succeeded.
271f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_STATE This value is returned if the attempt
272f11c7f63SJim Harris  *         to change the user parameter failed, because changing one of
273f11c7f63SJim Harris  *         the parameters is not currently allowed.
274f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_PARAMETER_VALUE This value is returned if the
275f11c7f63SJim Harris  *         user supplied an invalid interrupt coalescence time, spin up
276f11c7f63SJim Harris  *         delay interval, etc.
277f11c7f63SJim Harris  */
278f11c7f63SJim Harris SCI_STATUS scic_user_parameters_set(
279f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T   controller,
280f11c7f63SJim Harris    SCIC_USER_PARAMETERS_T  * user_parameters
281f11c7f63SJim Harris );
282f11c7f63SJim Harris 
283f11c7f63SJim Harris /**
284f11c7f63SJim Harris  * @brief This method allows the user to retrieve the user parameters
285f11c7f63SJim Harris  *        utilized by the controller.
286f11c7f63SJim Harris  *
287f11c7f63SJim Harris  * @param[in] controller This parameter specifies the controller on which
288f11c7f63SJim Harris  *            to set the user parameters.
289f11c7f63SJim Harris  * @param[in] user_parameters This parameter specifies the USER_PARAMETERS
290f11c7f63SJim Harris  *            object into which the framework shall save it's parameters.
291f11c7f63SJim Harris  *
292f11c7f63SJim Harris  * @return none
293f11c7f63SJim Harris  */
294f11c7f63SJim Harris void scic_user_parameters_get(
295f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T   controller,
296f11c7f63SJim Harris    SCIC_USER_PARAMETERS_T  * user_parameters
297f11c7f63SJim Harris );
298f11c7f63SJim Harris 
299f11c7f63SJim Harris /**
300f11c7f63SJim Harris  * @brief This method allows the user to attempt to change the OEM
301f11c7f63SJim Harris  *        parameters utilized by the controller.
302f11c7f63SJim Harris  *
303f11c7f63SJim Harris  * @param[in] controller This parameter specifies the controller on which
304f11c7f63SJim Harris  *            to set the user parameters.
305f11c7f63SJim Harris  * @param[in] oem_parameters This parameter specifies the OEM parameters
306f11c7f63SJim Harris  *            object containing the potential new values.
307f11c7f63SJim Harris  * @param[in] oem_parameters_version This parameter is the OEM block version
308f11c7f63SJim Harris  *            value indicating the format of the data associated with
309f11c7f63SJim Harris  *            oem_parameters.
310f11c7f63SJim Harris  *
311f11c7f63SJim Harris  * @return Indicate if the update of the user parameters was successful.
312f11c7f63SJim Harris  * @retval SCI_SUCCESS This value is returned if the operation succeeded.
313f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_STATE This value is returned if the attempt
314f11c7f63SJim Harris  *         to change the user parameter failed, because changing one of
315f11c7f63SJim Harris  *         the parameters is not currently allowed.
316f11c7f63SJim Harris  * @retval SCI_FAILURE_INVALID_PARAMETER_VALUE This value is returned if the
317f11c7f63SJim Harris  *         user supplied an unsupported value for one of the OEM parameters.
318f11c7f63SJim Harris  */
319f11c7f63SJim Harris SCI_STATUS scic_oem_parameters_set(
320f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T   controller,
321f11c7f63SJim Harris    SCIC_OEM_PARAMETERS_T   * oem_parameters,
322f11c7f63SJim Harris    U8 oem_parameters_version
323f11c7f63SJim Harris );
324f11c7f63SJim Harris 
325f11c7f63SJim Harris /**
326453130d9SPedro F. Giffuni  * @brief This method allows the user to retrieve the OEM
327f11c7f63SJim Harris  *        parameters utilized by the controller.
328f11c7f63SJim Harris  *
329f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller on which
330f11c7f63SJim Harris  *             to set the user parameters.
331f11c7f63SJim Harris  * @param[out] oem_parameters This parameter specifies the OEM parameters
332f11c7f63SJim Harris  *             object in which to write the core's OEM parameters.
333f11c7f63SJim Harris  *
334f11c7f63SJim Harris  * @return none
335f11c7f63SJim Harris  */
336f11c7f63SJim Harris void scic_oem_parameters_get(
337f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T   controller,
338f11c7f63SJim Harris    SCIC_OEM_PARAMETERS_T   * oem_parameters
339f11c7f63SJim Harris );
340f11c7f63SJim Harris 
341f11c7f63SJim Harris #ifdef __cplusplus
342f11c7f63SJim Harris }
343f11c7f63SJim Harris #endif // __cplusplus
344f11c7f63SJim Harris 
345f11c7f63SJim Harris #endif // _SCIC_SDS_USER_PARAMETERS_H_
346f11c7f63SJim Harris 
347