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