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