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 _SCIC_SDS_USER_PARAMETERS_H_
55230557Sjimharris#define _SCIC_SDS_USER_PARAMETERS_H_
56230557Sjimharris
57230557Sjimharris/**
58230557Sjimharris * @file
59230557Sjimharris *
60230557Sjimharris * @brief This file contains all of the structure definitions and interface
61230557Sjimharris *        methods that can be called by a SCIC user on the SCU Driver
62230557Sjimharris *        Standard (SCIC_SDS_USER_PARAMETERS_T) user parameter block.
63230557Sjimharris */
64230557Sjimharris
65230557Sjimharris#ifdef __cplusplus
66230557Sjimharrisextern "C" {
67230557Sjimharris#endif // __cplusplus
68230557Sjimharris
69230557Sjimharris#include <dev/isci/scil/sci_types.h>
70230557Sjimharris#include <dev/isci/scil/sci_status.h>
71230557Sjimharris#include <dev/isci/scil/intel_sas.h>
72230557Sjimharris#include <dev/isci/scil/sci_controller_constants.h>
73230557Sjimharris#include <dev/isci/scil/scu_bios_definitions.h>
74230557Sjimharris
75230557Sjimharris/**
76230557Sjimharris * @name SCIC_SDS_PARM_PHY_SPEED
77230557Sjimharris *
78230557Sjimharris * These constants define the speeds utilized for a phy/port.
79230557Sjimharris */
80230557Sjimharris/*@{*/
81230557Sjimharris#define SCIC_SDS_PARM_NO_SPEED   0
82230557Sjimharris
83230557Sjimharris/**
84230557Sjimharris * This value of 1 indicates generation 1 (i.e. 1.5 Gb/s).
85230557Sjimharris */
86230557Sjimharris#define SCIC_SDS_PARM_GEN1_SPEED 1
87230557Sjimharris
88230557Sjimharris/**
89230557Sjimharris * This value of 2 indicates generation 2 (i.e. 3.0 Gb/s).
90230557Sjimharris */
91230557Sjimharris#define SCIC_SDS_PARM_GEN2_SPEED 2
92230557Sjimharris
93230557Sjimharris/**
94230557Sjimharris * This value of 3 indicates generation 3 (i.e. 6.0 Gb/s).
95230557Sjimharris */
96230557Sjimharris#define SCIC_SDS_PARM_GEN3_SPEED 3
97230557Sjimharris
98230557Sjimharris/**
99230557Sjimharris * For range checks, the max speed generation
100230557Sjimharris */
101230557Sjimharris#define SCIC_SDS_PARM_MAX_SPEED SCIC_SDS_PARM_GEN3_SPEED
102230557Sjimharris/*@}*/
103230557Sjimharris
104230557Sjimharris/**
105230557Sjimharris * @struct SCIC_SDS_USER_PARAMETERS
106230557Sjimharris *
107230557Sjimharris * @brief This structure delineates the various user parameters that can be
108230557Sjimharris *        changed by the core user.
109230557Sjimharris */
110230557Sjimharristypedef struct SCIC_SDS_USER_PARAMETERS
111230557Sjimharris{
112230557Sjimharris   struct
113230557Sjimharris   {
114230557Sjimharris      /**
115230557Sjimharris       * This field specifies the NOTIFY (ENABLE SPIN UP) primitive
116230557Sjimharris       * insertion frequency for this phy index.
117230557Sjimharris       */
118230557Sjimharris      U32  notify_enable_spin_up_insertion_frequency;
119230557Sjimharris
120230557Sjimharris      /**
121230557Sjimharris       * This method specifies the number of transmitted DWORDs within which
122230557Sjimharris       * to transmit a single ALIGN primitive.  This value applies regardless
123230557Sjimharris       * of what type of device is attached or connection state.  A value of
124230557Sjimharris       * 0 indicates that no ALIGN primitives will be inserted.
125230557Sjimharris       */
126230557Sjimharris      U16  align_insertion_frequency;
127230557Sjimharris
128230557Sjimharris      /**
129230557Sjimharris       * This method specifies the number of transmitted DWORDs within which
130230557Sjimharris       * to transmit 2 ALIGN primitives.  This applies for SAS connections
131230557Sjimharris       * only.  A minimum value of 3 is required for this field.
132230557Sjimharris       */
133230557Sjimharris      U16  in_connection_align_insertion_frequency;
134230557Sjimharris
135230557Sjimharris      /**
136230557Sjimharris       * This field indicates the maximum speed generation to be utilized
137230557Sjimharris       * by phys in the supplied port.
138230557Sjimharris       * - A value of 1 indicates generation 1 (i.e. 1.5 Gb/s).
139230557Sjimharris       * - A value of 2 indicates generation 2 (i.e. 3.0 Gb/s).
140230557Sjimharris       * - A value of 3 indicates generation 3 (i.e. 6.0 Gb/s).
141230557Sjimharris       */
142230557Sjimharris      U8 max_speed_generation;
143230557Sjimharris
144230557Sjimharris   } phys[SCI_MAX_PHYS];
145230557Sjimharris
146230557Sjimharris
147230557Sjimharris   /**
148230557Sjimharris    * This field specifies the number of seconds to allow a phy to consume
149230557Sjimharris    * power before yielding to another phy.
150230557Sjimharris    *
151230557Sjimharris    */
152230557Sjimharris   U8  phy_spin_up_delay_interval;
153230557Sjimharris
154230557Sjimharris   /**
155230557Sjimharris   * These timer values specifies how long a link will remain open with no
156230557Sjimharris   * activity in increments of a microsecond, it can be in increments of
157230557Sjimharris   * 100 microseconds if the upper most bit is set.
158230557Sjimharris   *
159230557Sjimharris   */
160230557Sjimharris   U16 stp_inactivity_timeout;
161230557Sjimharris   U16 ssp_inactivity_timeout;
162230557Sjimharris
163230557Sjimharris   /**
164230557Sjimharris   * These timer values specifies how long a link will remain open in increments
165230557Sjimharris   * of 100 microseconds.
166230557Sjimharris   *
167230557Sjimharris   */
168230557Sjimharris   U16 stp_max_occupancy_timeout;
169230557Sjimharris   U16 ssp_max_occupancy_timeout;
170230557Sjimharris
171230557Sjimharris   /**
172230557Sjimharris   * This timer value specifies how long a link will remain open with no
173230557Sjimharris   * outbound traffic in increments of a microsecond.
174230557Sjimharris   *
175230557Sjimharris   */
176230557Sjimharris   U8 no_outbound_task_timeout;
177230557Sjimharris
178230557Sjimharris} SCIC_SDS_USER_PARAMETERS_T;
179230557Sjimharris
180230557Sjimharris/**
181230557Sjimharris * @union SCIC_USER_PARAMETERS
182230557Sjimharris * @brief This structure/union specifies the various different user
183230557Sjimharris *        parameter sets available.  Each type is specific to a hardware
184230557Sjimharris *        controller version.
185230557Sjimharris */
186230557Sjimharristypedef union SCIC_USER_PARAMETERS
187230557Sjimharris{
188230557Sjimharris   /**
189230557Sjimharris    * This field specifies the user parameters specific to the
190230557Sjimharris    * Storage Controller Unit (SCU) Driver Standard (SDS) version
191230557Sjimharris    * 1.
192230557Sjimharris    */
193230557Sjimharris   SCIC_SDS_USER_PARAMETERS_T sds1;
194230557Sjimharris
195230557Sjimharris} SCIC_USER_PARAMETERS_T;
196230557Sjimharris
197230557Sjimharris
198230557Sjimharris/**
199230557Sjimharris * @name SCIC_SDS_OEM_PHY_MASK
200230557Sjimharris *
201230557Sjimharris * These constants define the valid values for phy_mask
202230557Sjimharris */
203230557Sjimharris/*@{*/
204230557Sjimharris
205230557Sjimharris/**
206230557Sjimharris * This is the min value assignable to a port's phy mask
207230557Sjimharris */
208230557Sjimharris#define SCIC_SDS_PARM_PHY_MASK_MIN 0x0
209230557Sjimharris
210230557Sjimharris/**
211230557Sjimharris * This is the max value assignable to a port's phy mask
212230557Sjimharris */
213230557Sjimharris#define SCIC_SDS_PARM_PHY_MASK_MAX 0xF
214230557Sjimharris/*@}*/
215230557Sjimharris
216230557Sjimharris#define MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT 4
217230557Sjimharris
218230557Sjimharristypedef SCI_BIOS_OEM_PARAM_ELEMENT_v_1_3_T SCIC_SDS_OEM_PARAMETERS_T;
219230557Sjimharris
220230557Sjimharris/**
221230557Sjimharris * @union SCIC_OEM_PARAMETERS
222230557Sjimharris *
223230557Sjimharris * @brief This structure/union specifies the various different OEM
224230557Sjimharris *        parameter sets available.  Each type is specific to a hardware
225230557Sjimharris *        controller version.
226230557Sjimharris */
227230557Sjimharristypedef union SCIC_OEM_PARAMETERS
228230557Sjimharris{
229230557Sjimharris   /**
230230557Sjimharris    * This field specifies the OEM parameters specific to the
231230557Sjimharris    * Storage Controller Unit (SCU) Driver Standard (SDS) version
232230557Sjimharris    * 1.
233230557Sjimharris    */
234230557Sjimharris   SCIC_SDS_OEM_PARAMETERS_T sds1;
235230557Sjimharris
236230557Sjimharris} SCIC_OEM_PARAMETERS_T;
237230557Sjimharris
238230557Sjimharris/**
239230557Sjimharris * @union OEM_SSC_DATA
240230557Sjimharris *
241230557Sjimharris * @brief This typedef provides a means to convert from the original
242230557Sjimharris *        1.0 version of the OEM PARAMETER do_enable_ssc to the more
243230557Sjimharris *        comprehensive 1.1 version of enabling SSC parameters.
244230557Sjimharris *        For the definition of the field members see scu_bios_definitions.h
245230557Sjimharris *        header file or refer to the SCU BIOS Writers Guide.
246230557Sjimharris */
247230557Sjimharristypedef union OEM_SSC_PARAMETERS
248230557Sjimharris{
249230557Sjimharris   struct
250230557Sjimharris   {
251230557Sjimharris      U8 ssc_sata_tx_spread_level : 4;
252230557Sjimharris      U8 ssc_sas_tx_spread_level : 3;
253230557Sjimharris      U8 ssc_sas_tx_type : 1;
254230557Sjimharris   } bf;
255230557Sjimharris
256230557Sjimharris   U8 do_enable_ssc;
257230557Sjimharris
258230557Sjimharris} OEM_SSC_PARAMETERS_T;
259230557Sjimharris
260230557Sjimharris/**
261230557Sjimharris * @brief This method allows the user to attempt to change the user
262230557Sjimharris *        parameters utilized by the controller.
263230557Sjimharris *
264230557Sjimharris * @param[in] controller This parameter specifies the controller on which
265230557Sjimharris *            to set the user parameters.
266230557Sjimharris * @param[in] user_parameters This parameter specifies the USER_PARAMETERS
267230557Sjimharris *            object containing the potential new values.
268230557Sjimharris *
269230557Sjimharris * @return Indicate if the update of the user parameters was successful.
270230557Sjimharris * @retval SCI_SUCCESS This value is returned if the operation succeeded.
271230557Sjimharris * @retval SCI_FAILURE_INVALID_STATE This value is returned if the attempt
272230557Sjimharris *         to change the user parameter failed, because changing one of
273230557Sjimharris *         the parameters is not currently allowed.
274230557Sjimharris * @retval SCI_FAILURE_INVALID_PARAMETER_VALUE This value is returned if the
275230557Sjimharris *         user supplied an invalid interrupt coalescence time, spin up
276230557Sjimharris *         delay interval, etc.
277230557Sjimharris */
278230557SjimharrisSCI_STATUS scic_user_parameters_set(
279230557Sjimharris   SCI_CONTROLLER_HANDLE_T   controller,
280230557Sjimharris   SCIC_USER_PARAMETERS_T  * user_parameters
281230557Sjimharris);
282230557Sjimharris
283230557Sjimharris/**
284230557Sjimharris * @brief This method allows the user to retrieve the user parameters
285230557Sjimharris *        utilized by the controller.
286230557Sjimharris *
287230557Sjimharris * @param[in] controller This parameter specifies the controller on which
288230557Sjimharris *            to set the user parameters.
289230557Sjimharris * @param[in] user_parameters This parameter specifies the USER_PARAMETERS
290230557Sjimharris *            object into which the framework shall save it's parameters.
291230557Sjimharris *
292230557Sjimharris * @return none
293230557Sjimharris */
294230557Sjimharrisvoid scic_user_parameters_get(
295230557Sjimharris   SCI_CONTROLLER_HANDLE_T   controller,
296230557Sjimharris   SCIC_USER_PARAMETERS_T  * user_parameters
297230557Sjimharris);
298230557Sjimharris
299230557Sjimharris/**
300230557Sjimharris * @brief This method allows the user to attempt to change the OEM
301230557Sjimharris *        parameters utilized by the controller.
302230557Sjimharris *
303230557Sjimharris * @param[in] controller This parameter specifies the controller on which
304230557Sjimharris *            to set the user parameters.
305230557Sjimharris * @param[in] oem_parameters This parameter specifies the OEM parameters
306230557Sjimharris *            object containing the potential new values.
307230557Sjimharris * @param[in] oem_parameters_version This parameter is the OEM block version
308230557Sjimharris *            value indicating the format of the data associated with
309230557Sjimharris *            oem_parameters.
310230557Sjimharris *
311230557Sjimharris * @return Indicate if the update of the user parameters was successful.
312230557Sjimharris * @retval SCI_SUCCESS This value is returned if the operation succeeded.
313230557Sjimharris * @retval SCI_FAILURE_INVALID_STATE This value is returned if the attempt
314230557Sjimharris *         to change the user parameter failed, because changing one of
315230557Sjimharris *         the parameters is not currently allowed.
316230557Sjimharris * @retval SCI_FAILURE_INVALID_PARAMETER_VALUE This value is returned if the
317230557Sjimharris *         user supplied an unsupported value for one of the OEM parameters.
318230557Sjimharris */
319230557SjimharrisSCI_STATUS scic_oem_parameters_set(
320230557Sjimharris   SCI_CONTROLLER_HANDLE_T   controller,
321230557Sjimharris   SCIC_OEM_PARAMETERS_T   * oem_parameters,
322230557Sjimharris   U8 oem_parameters_version
323230557Sjimharris);
324230557Sjimharris
325230557Sjimharris/**
326298955Spfg * @brief This method allows the user to retrieve the OEM
327230557Sjimharris *        parameters utilized by the controller.
328230557Sjimharris *
329230557Sjimharris * @param[in]  controller This parameter specifies the controller on which
330230557Sjimharris *             to set the user parameters.
331230557Sjimharris * @param[out] oem_parameters This parameter specifies the OEM parameters
332230557Sjimharris *             object in which to write the core's OEM parameters.
333230557Sjimharris *
334230557Sjimharris * @return none
335230557Sjimharris */
336230557Sjimharrisvoid scic_oem_parameters_get(
337230557Sjimharris   SCI_CONTROLLER_HANDLE_T   controller,
338230557Sjimharris   SCIC_OEM_PARAMETERS_T   * oem_parameters
339230557Sjimharris);
340230557Sjimharris
341230557Sjimharris#ifdef __cplusplus
342230557Sjimharris}
343230557Sjimharris#endif // __cplusplus
344230557Sjimharris
345230557Sjimharris#endif // _SCIC_SDS_USER_PARAMETERS_H_
346230557Sjimharris
347