1f11c7f63SJim Harris /*- 2718cf2ccSPedro F. Giffuni * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0 3718cf2ccSPedro 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_CONTROLLER_H_ 55f11c7f63SJim Harris #define _SCIC_CONTROLLER_H_ 56f11c7f63SJim Harris 57f11c7f63SJim Harris /** 58f11c7f63SJim Harris * @file 59f11c7f63SJim Harris * 60f11c7f63SJim Harris * @brief This file contains all of the interface methods that can be called 61f11c7f63SJim Harris * by an SCIC user on a controller object. 62f11c7f63SJim Harris */ 63f11c7f63SJim Harris 64f11c7f63SJim Harris #ifdef __cplusplus 65f11c7f63SJim Harris extern "C" { 66f11c7f63SJim Harris #endif // __cplusplus 67f11c7f63SJim Harris 68f11c7f63SJim Harris #include <dev/isci/scil/sci_types.h> 69f11c7f63SJim Harris #include <dev/isci/scil/sci_status.h> 70f11c7f63SJim Harris #include <dev/isci/scil/sci_controller.h> 71f11c7f63SJim Harris #include <dev/isci/scil/scic_config_parameters.h> 72f11c7f63SJim Harris 73f11c7f63SJim Harris /** 74f11c7f63SJim Harris * @enum 75f11c7f63SJim Harris * 76f11c7f63SJim Harris * Allowed PORT configuration modes 77f11c7f63SJim Harris * 78f11c7f63SJim Harris * APC Automatic PORT configuration mode is defined by the OEM configuration 79f11c7f63SJim Harris * parameters providing no PHY_MASK parameters for any PORT. i.e. There are 80f11c7f63SJim Harris * no phys assigned to any of the ports at start. 81f11c7f63SJim Harris * 82f11c7f63SJim Harris * MPC Manual PORT configuration mode is defined by the OEM configuration 83f11c7f63SJim Harris * parameters providing a PHY_MASK value for any PORT. It is assumed that 84f11c7f63SJim Harris * any PORT with no PHY_MASK is an invalid port and not all PHYs must be 85f11c7f63SJim Harris * assigned. A PORT_PHY mask that assigns just a single PHY to a port and no 86f11c7f63SJim Harris * other PHYs being assigned is sufficient to declare manual PORT configuration. 87f11c7f63SJim Harris */ 88f11c7f63SJim Harris enum SCIC_PORT_CONFIGURATION_MODE 89f11c7f63SJim Harris { 90f11c7f63SJim Harris SCIC_PORT_MANUAL_CONFIGURATION_MODE, 91f11c7f63SJim Harris SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE 92f11c7f63SJim Harris }; 93f11c7f63SJim Harris 94f11c7f63SJim Harris /** 95f11c7f63SJim Harris * @enum _SCIC_INTERRUPT_TYPE 96f11c7f63SJim Harris * 97f11c7f63SJim Harris * @brief This enumeration depicts the various types of interrupts that 98f11c7f63SJim Harris * are potentially supported by a SCI Core implementation. 99f11c7f63SJim Harris */ 100f11c7f63SJim Harris typedef enum _SCIC_INTERRUPT_TYPE 101f11c7f63SJim Harris { 102f11c7f63SJim Harris SCIC_LEGACY_LINE_INTERRUPT_TYPE, 103f11c7f63SJim Harris SCIC_MSIX_INTERRUPT_TYPE, 104f11c7f63SJim Harris 105f11c7f63SJim Harris /** 106f11c7f63SJim Harris * This enumeration value indicates the use of polling. 107f11c7f63SJim Harris */ 108f11c7f63SJim Harris SCIC_NO_INTERRUPTS 109f11c7f63SJim Harris 110f11c7f63SJim Harris } SCIC_INTERRUPT_TYPE; 111f11c7f63SJim Harris 112f11c7f63SJim Harris /** 113f11c7f63SJim Harris * @typedef SCIC_CONTROLLER_INTERRUPT_HANDLER 114f11c7f63SJim Harris * 115f11c7f63SJim Harris * @brief This method is called by the SCI user in order to have the SCI 116f11c7f63SJim Harris * implementation handle the interrupt. This method performs 117f11c7f63SJim Harris * minimal processing to allow for streamlined interrupt time usage. 118f11c7f63SJim Harris * @note 119f11c7f63SJim Harris * TRUE: returned if there is an interrupt to process and it was 120f11c7f63SJim Harris * processed. 121f11c7f63SJim Harris * FALSE: returned if no interrupt was processed. 122f11c7f63SJim Harris * 123f11c7f63SJim Harris */ 124f11c7f63SJim Harris typedef BOOL (*SCIC_CONTROLLER_INTERRUPT_HANDLER)( 125f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller 126f11c7f63SJim Harris ); 127f11c7f63SJim Harris 128f11c7f63SJim Harris /** 129f11c7f63SJim Harris * @brief This method is called by the SCI user to process completions 130f11c7f63SJim Harris * generated as a result of a previously handled interrupt. This 131f11c7f63SJim Harris * method will result in the completion of IO requests and handling 132f11c7f63SJim Harris * of other controller generated events. This method should be 133f11c7f63SJim Harris * called some time after the interrupt handler. 134f11c7f63SJim Harris * 135f11c7f63SJim Harris * @note Most, if not all, of the user callback APIs are invoked from within 136453130d9SPedro F. Giffuni * this API. As a result, the user should be cognizant of the operating 137f11c7f63SJim Harris * level at which they invoke this API. 138f11c7f63SJim Harris * 139f11c7f63SJim Harris */ 140f11c7f63SJim Harris typedef void (*SCIC_CONTROLLER_COMPLETION_HANDLER)( 141f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller 142f11c7f63SJim Harris ); 143f11c7f63SJim Harris 144f11c7f63SJim Harris /** 145f11c7f63SJim Harris * @struct SCIC_CONTROLLER_HANDLER_METHODS 146f11c7f63SJim Harris * 147f11c7f63SJim Harris * @brief This structure contains an interrupt handler and completion 148f11c7f63SJim Harris * handler function pointers. 149f11c7f63SJim Harris */ 150f11c7f63SJim Harris typedef struct SCIC_CONTROLLER_HANDLER_METHODS 151f11c7f63SJim Harris { 152f11c7f63SJim Harris SCIC_CONTROLLER_INTERRUPT_HANDLER interrupt_handler; 153f11c7f63SJim Harris SCIC_CONTROLLER_COMPLETION_HANDLER completion_handler; 154f11c7f63SJim Harris 155f11c7f63SJim Harris } SCIC_CONTROLLER_HANDLER_METHODS_T; 156f11c7f63SJim Harris 157f11c7f63SJim Harris /** 158f11c7f63SJim Harris * @brief This method will attempt to construct a controller object 159f11c7f63SJim Harris * utilizing the supplied parameter information. 160f11c7f63SJim Harris * 161f11c7f63SJim Harris * @param[in] library This parameter specifies the handle to the library 162f11c7f63SJim Harris * object associated with the controller being constructed. 163f11c7f63SJim Harris * @param[in] controller This parameter specifies the controller to be 164f11c7f63SJim Harris * constructed. 165f11c7f63SJim Harris * @param[in] user_object This parameter is a reference to the SCIL users 166f11c7f63SJim Harris * controller object and will be used to associate with the core 167f11c7f63SJim Harris * controller. 168f11c7f63SJim Harris * 169f11c7f63SJim Harris * @return Indicate if the controller was successfully constructed or if 170f11c7f63SJim Harris * it failed in some way. 171f11c7f63SJim Harris * @retval SCI_SUCCESS This value is returned if the controller was 172f11c7f63SJim Harris * successfully constructed. 173f11c7f63SJim Harris * @retval SCI_WARNING_TIMER_CONFLICT This value is returned if the 174f11c7f63SJim Harris * interrupt coalescence timer may cause SAS compliance issues 175f11c7f63SJim Harris * for SMP Target mode response processing. 176f11c7f63SJim Harris * @retval SCI_FAILURE_UNSUPPORTED_CONTROLLER_TYPE This value is returned if 177f11c7f63SJim Harris * the controller does not support the supplied type. 178f11c7f63SJim Harris * @retval SCI_FAILURE_UNSUPPORTED_INIT_DATA_VERSION This value is returned 179f11c7f63SJim Harris * if the controller does not support the supplied initialization 180f11c7f63SJim Harris * data version. 181f11c7f63SJim Harris */ 182f11c7f63SJim Harris SCI_STATUS scic_controller_construct( 183f11c7f63SJim Harris SCI_LIBRARY_HANDLE_T library, 184f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 185f11c7f63SJim Harris void * user_object 186f11c7f63SJim Harris ); 187f11c7f63SJim Harris 188f11c7f63SJim Harris /** 189f11c7f63SJim Harris * @brief This method will enable all controller interrupts. 190f11c7f63SJim Harris * 191f11c7f63SJim Harris * @param[in] controller This parameter specifies the controller for which 192f11c7f63SJim Harris * to enable interrupts. 193f11c7f63SJim Harris * 194f11c7f63SJim Harris * @return none 195f11c7f63SJim Harris */ 196f11c7f63SJim Harris void scic_controller_enable_interrupts( 197f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller 198f11c7f63SJim Harris ); 199f11c7f63SJim Harris 200f11c7f63SJim Harris /** 201f11c7f63SJim Harris * @brief This method will disable all controller interrupts. 202f11c7f63SJim Harris * 203f11c7f63SJim Harris * @param[in] controller This parameter specifies the controller for which 204f11c7f63SJim Harris * to disable interrupts. 205f11c7f63SJim Harris * 206f11c7f63SJim Harris * @return none 207f11c7f63SJim Harris */ 208f11c7f63SJim Harris void scic_controller_disable_interrupts( 209f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller 210f11c7f63SJim Harris ); 211f11c7f63SJim Harris 212f11c7f63SJim Harris /** 213f11c7f63SJim Harris * @brief This method will return provide function pointers for the 214f11c7f63SJim Harris * interrupt handler and completion handler. The interrupt handler 215f11c7f63SJim Harris * is expected to be invoked at interrupt time. The completion 216f11c7f63SJim Harris * handler is scheduled to run as a result of the interrupt handler. 217f11c7f63SJim Harris * The completion handler performs the bulk work for processing 218f11c7f63SJim Harris * silicon events. 219f11c7f63SJim Harris * 220f11c7f63SJim Harris * @param[in] interrupt_type This parameter informs the core which type 221f11c7f63SJim Harris * of interrupt/completion methods are being requested. These 222f11c7f63SJim Harris * are the types: SCIC_LEGACY_LINE_INTERRUPT_TYPE, 223f11c7f63SJim Harris * SCIC_MSIX_INTERRUPT_TYPE, SCIC_NO_INTERRUPTS (POLLING) 224f11c7f63SJim Harris * @param[in] message_count This parameter informs the core the 225f11c7f63SJim Harris * number of MSI-X messages to be utilized. This parameter must 226f11c7f63SJim Harris * be 0 when requesting legacy line based handlers. 227f11c7f63SJim Harris * @param[in] handler_methods The caller provides a pointer to a buffer of 228f11c7f63SJim Harris * type SCIC_CONTROLLER_HANDLER_METHODS_T. The size depends on 229f11c7f63SJim Harris * the combination of the interrupt_type and message_count input 230f11c7f63SJim Harris * parameters: 231f11c7f63SJim Harris * SCIC_LEGACY_LINE_INTERRUPT_TYPE: 232f11c7f63SJim Harris * - size = sizeof(SCIC_CONTROLLER_HANDLER_METHODS_T) 233f11c7f63SJim Harris * SCIC_MSIX_INTERRUPT_TYPE: 234f11c7f63SJim Harris * - size = message_count*sizeof(SCIC_CONTROLLER_HANDLER_METHODS_T) 235f11c7f63SJim Harris * @param[out] handler_methods SCIC fills out the caller's buffer with the 236f11c7f63SJim Harris * appropriate interrupt and completion handlers based on the info 237f11c7f63SJim Harris * provided in the interrupt_type and message_count input 238f11c7f63SJim Harris * parameters. For SCIC_LEGACY_LINE_INTERRUPT_TYPE, the buffer 239f11c7f63SJim Harris * receives a single SCIC_CONTROLLER_HANDLER_METHODS_T element 240f11c7f63SJim Harris * regardless that the message_count parameter is zero. 241f11c7f63SJim Harris * For SCIC_MSIX_INTERRUPT_TYPE, the buffer receives an array of 242f11c7f63SJim Harris * elements of type SCIC_CONTROLLER_HANDLER_METHODS_T where the 243f11c7f63SJim Harris * array size is equivalent to the message_count parameter. The 244f11c7f63SJim Harris * array is zero-relative where entry zero corresponds to 245f11c7f63SJim Harris * message-vector zero, entry one corresponds to message-vector one, 246f11c7f63SJim Harris * and so forth. 247f11c7f63SJim Harris * 248f11c7f63SJim Harris * @return Indicate if the handler retrieval operation was successful. 249f11c7f63SJim Harris * @retval SCI_SUCCESS This value is returned if retrieval succeeded. 250f11c7f63SJim Harris * @retval SCI_FAILURE_UNSUPPORTED_MESSAGE_COUNT This value is returned 251f11c7f63SJim Harris * if the user supplied an unsupported number of MSI-X messages. 252f11c7f63SJim Harris * For legacy line interrupts the only valid value is 0. 253f11c7f63SJim Harris */ 254f11c7f63SJim Harris SCI_STATUS scic_controller_get_handler_methods( 255f11c7f63SJim Harris SCIC_INTERRUPT_TYPE interrupt_type, 256f11c7f63SJim Harris U16 message_count, 257f11c7f63SJim Harris SCIC_CONTROLLER_HANDLER_METHODS_T * handler_methods 258f11c7f63SJim Harris ); 259f11c7f63SJim Harris 260f11c7f63SJim Harris /** 261f11c7f63SJim Harris * @brief This method will initialize the controller hardware managed by 262f11c7f63SJim Harris * the supplied core controller object. This method will bring the 263f11c7f63SJim Harris * physical controller hardware out of reset and enable the core to 264f11c7f63SJim Harris * determine the capabilities of the hardware being managed. Thus, 265f11c7f63SJim Harris * the core controller can determine it's exact physical (DMA capable) 266f11c7f63SJim Harris * memory requirements. 267f11c7f63SJim Harris * 268f11c7f63SJim Harris * @pre The SCI Core user must have called scic_controller_construct() 269f11c7f63SJim Harris * on the supplied controller object previously. 270f11c7f63SJim Harris * 271f11c7f63SJim Harris * @param[in] controller This parameter specifies the controller to be 272f11c7f63SJim Harris * initialized. 273f11c7f63SJim Harris * 274f11c7f63SJim Harris * @return Indicate if the controller was successfully initialized or if 275f11c7f63SJim Harris * it failed in some way. 276f11c7f63SJim Harris * @retval SCI_SUCCESS This value is returned if the controller hardware 277f11c7f63SJim Harris * was successfully initialized. 278f11c7f63SJim Harris */ 279f11c7f63SJim Harris SCI_STATUS scic_controller_initialize( 280f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller 281f11c7f63SJim Harris ); 282f11c7f63SJim Harris 283f11c7f63SJim Harris /** 284f11c7f63SJim Harris * @brief This method returns the suggested scic_controller_start() 285f11c7f63SJim Harris * timeout amount. The user is free to use any timeout value, 286f11c7f63SJim Harris * but this method provides the suggested minimum start timeout 287f11c7f63SJim Harris * value. The returned value is based upon empirical information 288f11c7f63SJim Harris * determined as a result of interoperability testing. 289f11c7f63SJim Harris * 290f11c7f63SJim Harris * @param[in] controller the handle to the controller object for which 291f11c7f63SJim Harris * to return the suggested start timeout. 292f11c7f63SJim Harris * 293f11c7f63SJim Harris * @return This method returns the number of milliseconds for the 294f11c7f63SJim Harris * suggested start operation timeout. 295f11c7f63SJim Harris */ 296f11c7f63SJim Harris U32 scic_controller_get_suggested_start_timeout( 297f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller 298f11c7f63SJim Harris ); 299f11c7f63SJim Harris 300f11c7f63SJim Harris /** 301f11c7f63SJim Harris * @brief This method will start the supplied core controller. This method 302f11c7f63SJim Harris * will start the staggered spin up operation. The SCI User completion 303f11c7f63SJim Harris * callback is called when the following conditions are met: 304f11c7f63SJim Harris * -# the return status of this method is SCI_SUCCESS. 305f11c7f63SJim Harris * -# after all of the phys have successfully started or been given 306f11c7f63SJim Harris * the opportunity to start. 307f11c7f63SJim Harris * 308f11c7f63SJim Harris * @pre The SCI Core user must have filled in the physical memory 309f11c7f63SJim Harris * descriptor structure via the 310f11c7f63SJim Harris * sci_controller_get_memory_descriptor_list() method. 311f11c7f63SJim Harris * @pre The SCI Core user must have invoked the scic_controller_initialize() 312f11c7f63SJim Harris * method prior to invoking this method. 313f11c7f63SJim Harris * 314f11c7f63SJim Harris * @pre The controller must be in the INITIALIZED or STARTED state. 315f11c7f63SJim Harris * 316f11c7f63SJim Harris * @param[in] controller the handle to the controller object to start. 317f11c7f63SJim Harris * @param[in] timeout This parameter specifies the number of milliseconds 318f11c7f63SJim Harris * in which the start operation should complete. 319f11c7f63SJim Harris * 320f11c7f63SJim Harris * @return Indicate if the controller start method succeeded or failed in 321f11c7f63SJim Harris * some way. 322f11c7f63SJim Harris * @retval SCI_SUCCESS if the start operation succeeded. 323f11c7f63SJim Harris * @retval SCI_WARNING_ALREADY_IN_STATE if the controller is already in 324f11c7f63SJim Harris * the STARTED state. 325f11c7f63SJim Harris * @retval SCI_FAILURE_INVALID_STATE if the controller is not either in 326f11c7f63SJim Harris * the INITIALIZED or STARTED states. 327f11c7f63SJim Harris * @retval SCI_FAILURE_INVALID_MEMORY_DESCRIPTOR if there are 328f11c7f63SJim Harris * inconsistent or invalid values in the supplied 329f11c7f63SJim Harris * SCI_PHYSICAL_MEMORY_DESCRIPTOR array. 330f11c7f63SJim Harris */ 331f11c7f63SJim Harris SCI_STATUS scic_controller_start( 332f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 333f11c7f63SJim Harris U32 timeout 334f11c7f63SJim Harris ); 335f11c7f63SJim Harris 336f11c7f63SJim Harris /** 337f11c7f63SJim Harris * @brief This method will stop an individual controller object.This method 338f11c7f63SJim Harris * will invoke the associated user callback upon completion. The 339f11c7f63SJim Harris * completion callback is called when the following conditions are met: 340f11c7f63SJim Harris * -# the method return status is SCI_SUCCESS. 341f11c7f63SJim Harris * -# the controller has been quiesced. 342f11c7f63SJim Harris * This method will ensure that all IO requests are quiesced, phys 343f11c7f63SJim Harris * are stopped, and all additional operation by the hardware is halted. 344f11c7f63SJim Harris * 345f11c7f63SJim Harris * @pre The controller must be in the STARTED or STOPPED state. 346f11c7f63SJim Harris * 347f11c7f63SJim Harris * @param[in] controller the handle to the controller object to stop. 348f11c7f63SJim Harris * @param[in] timeout This parameter specifies the number of milliseconds 349f11c7f63SJim Harris * in which the stop operation should complete. 350f11c7f63SJim Harris * 351f11c7f63SJim Harris * @return Indicate if the controller stop method succeeded or failed in 352f11c7f63SJim Harris * some way. 353f11c7f63SJim Harris * @retval SCI_SUCCESS if the stop operation successfully began. 354f11c7f63SJim Harris * @retval SCI_WARNING_ALREADY_IN_STATE if the controller is already in 355f11c7f63SJim Harris * the STOPPED state. 356f11c7f63SJim Harris * @retval SCI_FAILURE_INVALID_STATE if the controller is not either in 357f11c7f63SJim Harris * the STARTED or STOPPED states. 358f11c7f63SJim Harris */ 359f11c7f63SJim Harris SCI_STATUS scic_controller_stop( 360f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 361f11c7f63SJim Harris U32 timeout 362f11c7f63SJim Harris ); 363f11c7f63SJim Harris 364f11c7f63SJim Harris /** 365f11c7f63SJim Harris * @brief This method will reset the supplied core controller regardless of 366f11c7f63SJim Harris * the state of said controller. This operation is considered 367f11c7f63SJim Harris * destructive. In other words, all current operations are wiped 368f11c7f63SJim Harris * out. No IO completions for outstanding devices occur. Outstanding 369f11c7f63SJim Harris * IO requests are not aborted or completed at the actual remote 370f11c7f63SJim Harris * device. 371f11c7f63SJim Harris * 372f11c7f63SJim Harris * @param[in] controller the handle to the controller object to reset. 373f11c7f63SJim Harris * 374f11c7f63SJim Harris * @return Indicate if the controller reset method succeeded or failed in 375f11c7f63SJim Harris * some way. 376f11c7f63SJim Harris * @retval SCI_SUCCESS if the reset operation successfully started. 377f11c7f63SJim Harris * @retval SCI_FATAL_ERROR if the controller reset operation is unable to 378f11c7f63SJim Harris * complete. 379f11c7f63SJim Harris */ 380f11c7f63SJim Harris SCI_STATUS scic_controller_reset( 381f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller 382f11c7f63SJim Harris ); 383f11c7f63SJim Harris 384f11c7f63SJim Harris /** 385f11c7f63SJim Harris * @brief This method is called by the SCI user to send/start an IO request. 386f11c7f63SJim Harris * If the method invocation is successful, then the IO request has 387f11c7f63SJim Harris * been queued to the hardware for processing. 388f11c7f63SJim Harris * 389f11c7f63SJim Harris * @warning 390f11c7f63SJim Harris * - IO tags are a protected resource. It is incumbent upon the 391f11c7f63SJim Harris * SCI Core user to ensure that each of the methods that may 392f11c7f63SJim Harris * allocate or free available IO tags are handled in a mutually 393f11c7f63SJim Harris * exclusive manner. This method is one of said methods requiring 394f11c7f63SJim Harris * proper critical code section protection (e.g. semaphore, 395f11c7f63SJim Harris * spin-lock, etc.). 396f11c7f63SJim Harris * - For SATA, the user is required to manage NCQ tags. As a 397f11c7f63SJim Harris * result, it is expected the user will have set the NCQ tag 398f11c7f63SJim Harris * field in the host to device register FIS prior to calling 399f11c7f63SJim Harris * this method. There is also a requirement for the user 400f11c7f63SJim Harris * to call scic_stp_io_set_ncq_tag() prior to invoking the 401f11c7f63SJim Harris * scic_controller_start_io() method. 402f11c7f63SJim Harris * 403f11c7f63SJim Harris * @param[in] controller the handle to the controller object for which 404f11c7f63SJim Harris * to start an IO request. 405f11c7f63SJim Harris * @param[in] remote_device the handle to the remote device object for which 406f11c7f63SJim Harris * to start an IO request. 407f11c7f63SJim Harris * @param[in] io_request the handle to the io request object to start. 408f11c7f63SJim Harris * @param[in] io_tag This parameter specifies a previously allocated IO tag 409f11c7f63SJim Harris * that the user desires to be utilized for this request. 410f11c7f63SJim Harris * This parameter is optional. The user is allowed to supply 411f11c7f63SJim Harris * SCI_CONTROLLER_INVALID_IO_TAG as the value for this parameter. 412f11c7f63SJim Harris * @see scic_controller_allocate_tag() for more information 413f11c7f63SJim Harris * on allocating a tag. 414f11c7f63SJim Harris * 415f11c7f63SJim Harris * @return Indicate if the controller successfully started the IO request. 416f11c7f63SJim Harris * @retval SCI_IO_SUCCESS if the IO request was successfully started. 417f11c7f63SJim Harris * 418f11c7f63SJim Harris * @todo Determine the failure situations and return values. 419f11c7f63SJim Harris */ 420f11c7f63SJim Harris SCI_IO_STATUS scic_controller_start_io( 421f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 422f11c7f63SJim Harris SCI_REMOTE_DEVICE_HANDLE_T remote_device, 423f11c7f63SJim Harris SCI_IO_REQUEST_HANDLE_T io_request, 424f11c7f63SJim Harris U16 io_tag 425f11c7f63SJim Harris ); 426f11c7f63SJim Harris 427f11c7f63SJim Harris #if !defined(DISABLE_TASK_MANAGEMENT) 428f11c7f63SJim Harris 429f11c7f63SJim Harris /** 430f11c7f63SJim Harris * @brief This method is called by the SCIC user to send/start a framework 431f11c7f63SJim Harris * task management request. 432f11c7f63SJim Harris * 433f11c7f63SJim Harris * @warning 434f11c7f63SJim Harris * - IO tags are a protected resource. It is incumbent upon the 435f11c7f63SJim Harris * SCI Core user to ensure that each of the methods that may 436f11c7f63SJim Harris * allocate or free available IO tags are handled in a mutually 437f11c7f63SJim Harris * exclusive manner. This method is one of said methods requiring 438f11c7f63SJim Harris * proper critical code section protection (e.g. semaphore, 439f11c7f63SJim Harris * spin-lock, etc.). 440f11c7f63SJim Harris * - The user must synchronize this task with completion queue 441f11c7f63SJim Harris * processing. If they are not synchronized then it is possible 442f11c7f63SJim Harris * for the io requests that are being managed by the task request 443f11c7f63SJim Harris * can complete before starting the task request. 444f11c7f63SJim Harris * 445f11c7f63SJim Harris * @param[in] controller the handle to the controller object for which 446f11c7f63SJim Harris * to start the task management request. 447f11c7f63SJim Harris * @param[in] remote_device the handle to the remote device object for which 448f11c7f63SJim Harris * to start the task management request. 449f11c7f63SJim Harris * @param[in] task_request the handle to the task request object to start. 450f11c7f63SJim Harris * @param[in] io_tag This parameter specifies a previously allocated IO tag 451f11c7f63SJim Harris * that the user desires to be utilized for this request. Note 452f11c7f63SJim Harris * this not the io_tag of the request being managed. It is to 453f11c7f63SJim Harris * be utilized for the task request itself. 454f11c7f63SJim Harris * This parameter is optional. The user is allowed to supply 455f11c7f63SJim Harris * SCI_CONTROLLER_INVALID_IO_TAG as the value for this parameter. 456f11c7f63SJim Harris * @see scic_controller_allocate_tag() for more information 457f11c7f63SJim Harris * on allocating a tag. 458f11c7f63SJim Harris * 459f11c7f63SJim Harris * @return Indicate if the controller successfully started the IO request. 460f11c7f63SJim Harris * @retval SCI_TASK_SUCCESS if the task request was successfully started. 461f11c7f63SJim Harris * @retval SCI_TASK_FAILURE_REQUIRES_SCSI_ABORT This value is returned if 462f11c7f63SJim Harris * there is/are task(s) outstanding that require termination or 463f11c7f63SJim Harris * completion before this request can succeed. 464f11c7f63SJim Harris */ 465f11c7f63SJim Harris SCI_TASK_STATUS scic_controller_start_task( 466f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 467f11c7f63SJim Harris SCI_REMOTE_DEVICE_HANDLE_T remote_device, 468f11c7f63SJim Harris SCI_TASK_REQUEST_HANDLE_T task_request, 469f11c7f63SJim Harris U16 io_tag 470f11c7f63SJim Harris ); 471f11c7f63SJim Harris 472f11c7f63SJim Harris /** 473f11c7f63SJim Harris * @brief This method will perform core specific completion operations for 474f11c7f63SJim Harris * task management request. After this method is invoked, the user should 475f11c7f63SJim Harris * consider the task request as invalid until it is properly reused 476f11c7f63SJim Harris * (i.e. re-constructed). 477f11c7f63SJim Harris * 478f11c7f63SJim Harris * @param[in] controller The handle to the controller object for which 479f11c7f63SJim Harris * to complete the task management request. 480f11c7f63SJim Harris * @param[in] remote_device The handle to the remote device object for which 481f11c7f63SJim Harris * to complete the task management request. 482f11c7f63SJim Harris * @param[in] task_request the handle to the task management request object 483f11c7f63SJim Harris * to complete. 484f11c7f63SJim Harris * 485f11c7f63SJim Harris * @return Indicate if the controller successfully completed the task 486f11c7f63SJim Harris * management request. 487f11c7f63SJim Harris * @retval SCI_SUCCESS if the completion process was successful. 488f11c7f63SJim Harris */ 489f11c7f63SJim Harris SCI_STATUS scic_controller_complete_task( 490f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 491f11c7f63SJim Harris SCI_REMOTE_DEVICE_HANDLE_T remote_device, 492f11c7f63SJim Harris SCI_TASK_REQUEST_HANDLE_T task_request 493f11c7f63SJim Harris ); 494f11c7f63SJim Harris 495f11c7f63SJim Harris #else // !defined(DISABLE_TASK_MANAGEMENT) 496f11c7f63SJim Harris 497f11c7f63SJim Harris #define scic_controller_start_task(controller, dev, task, tag) SCI_TASK_FAILURE 498f11c7f63SJim Harris #define scic_controller_complete_task(controller, dev, task) SCI_FAILURE 499f11c7f63SJim Harris 500f11c7f63SJim Harris #endif // !defined(DISABLE_TASK_MANAGEMENT) 501f11c7f63SJim Harris 502f11c7f63SJim Harris /** 503f11c7f63SJim Harris * @brief This method is called by the SCI Core user to terminate an ongoing 504f11c7f63SJim Harris * (i.e. started) core IO request. This does not abort the IO request 505f11c7f63SJim Harris * at the target, but rather removes the IO request from the host 506f11c7f63SJim Harris * controller. 507f11c7f63SJim Harris * 508f11c7f63SJim Harris * @param[in] controller the handle to the controller object for which 509f11c7f63SJim Harris * to terminate a request. 510f11c7f63SJim Harris * @param[in] remote_device the handle to the remote device object for which 511f11c7f63SJim Harris * to terminate a request. 512f11c7f63SJim Harris * @param[in] request the handle to the io or task management request 513f11c7f63SJim Harris * object to terminate. 514f11c7f63SJim Harris * 515f11c7f63SJim Harris * @return Indicate if the controller successfully began the terminate process 516f11c7f63SJim Harris * for the IO request. 517f11c7f63SJim Harris * @retval SCI_SUCCESS if the terminate process was successfully started for 518f11c7f63SJim Harris * the request. 519f11c7f63SJim Harris * 520f11c7f63SJim Harris * @todo Determine the failure situations and return values. 521f11c7f63SJim Harris */ 522f11c7f63SJim Harris SCI_STATUS scic_controller_terminate_request( 523f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 524f11c7f63SJim Harris SCI_REMOTE_DEVICE_HANDLE_T remote_device, 525f11c7f63SJim Harris SCI_IO_REQUEST_HANDLE_T request 526f11c7f63SJim Harris ); 527f11c7f63SJim Harris 528f11c7f63SJim Harris /** 529f11c7f63SJim Harris * @brief This method will perform core specific completion operations for 530f11c7f63SJim Harris * an IO request. After this method is invoked, the user should 531f11c7f63SJim Harris * consider the IO request as invalid until it is properly reused 532f11c7f63SJim Harris * (i.e. re-constructed). 533f11c7f63SJim Harris * 534f11c7f63SJim Harris * @warning 535f11c7f63SJim Harris * - IO tags are a protected resource. It is incumbent upon the 536f11c7f63SJim Harris * SCI Core user to ensure that each of the methods that may 537f11c7f63SJim Harris * allocate or free available IO tags are handled in a mutually 538f11c7f63SJim Harris * exclusive manner. This method is one of said methods requiring 539f11c7f63SJim Harris * proper critical code section protection (e.g. semaphore, 540f11c7f63SJim Harris * spin-lock, etc.). 541f11c7f63SJim Harris * - If the IO tag for a request was allocated, by the SCI Core user, 542f11c7f63SJim Harris * using the scic_controller_allocate_io_tag() method, then it is 543f11c7f63SJim Harris * the responsibility of the caller to invoke the 544f11c7f63SJim Harris * scic_controller_free_io_tag() method to free the tag (i.e. this 545f11c7f63SJim Harris * method will not free the IO tag). 546f11c7f63SJim Harris * 547f11c7f63SJim Harris * @param[in] controller The handle to the controller object for which 548f11c7f63SJim Harris * to complete the IO request. 549f11c7f63SJim Harris * @param[in] remote_device The handle to the remote device object for which 550f11c7f63SJim Harris * to complete the IO request. 551f11c7f63SJim Harris * @param[in] io_request the handle to the io request object to complete. 552f11c7f63SJim Harris * 553f11c7f63SJim Harris * @return Indicate if the controller successfully completed the IO request. 554f11c7f63SJim Harris * @retval SCI_SUCCESS if the completion process was successful. 555f11c7f63SJim Harris */ 556f11c7f63SJim Harris SCI_STATUS scic_controller_complete_io( 557f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 558f11c7f63SJim Harris SCI_REMOTE_DEVICE_HANDLE_T remote_device, 559f11c7f63SJim Harris SCI_IO_REQUEST_HANDLE_T io_request 560f11c7f63SJim Harris ); 561f11c7f63SJim Harris 562f11c7f63SJim Harris 563f11c7f63SJim Harris /** 564f11c7f63SJim Harris * @brief This method simply provides the user with a unique handle for a 565f11c7f63SJim Harris * given SAS/SATA core port index. 566f11c7f63SJim Harris * 567f11c7f63SJim Harris * @param[in] controller This parameter represents the handle to the 568f11c7f63SJim Harris * controller object from which to retrieve a port (SAS or 569f11c7f63SJim Harris * SATA) handle. 570f11c7f63SJim Harris * @param[in] port_index This parameter specifies the port index in 571f11c7f63SJim Harris * the controller for which to retrieve the port handle. 572f11c7f63SJim Harris * 0 <= port_index < maximum number of phys. 573f11c7f63SJim Harris * @param[out] port_handle This parameter specifies the retrieved port handle 574f11c7f63SJim Harris * to be provided to the caller. 575f11c7f63SJim Harris * 576f11c7f63SJim Harris * @return Indicate if the retrieval of the port handle was successful. 577f11c7f63SJim Harris * @retval SCI_SUCCESS This value is returned if the retrieval was successful. 578f11c7f63SJim Harris * @retval SCI_FAILURE_INVALID_PORT This value is returned if the supplied 579f11c7f63SJim Harris * port id is not in the supported range. 580f11c7f63SJim Harris */ 581f11c7f63SJim Harris SCI_STATUS scic_controller_get_port_handle( 582f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 583f11c7f63SJim Harris U8 port_index, 584f11c7f63SJim Harris SCI_PORT_HANDLE_T * port_handle 585f11c7f63SJim Harris ); 586f11c7f63SJim Harris 587f11c7f63SJim Harris /** 588f11c7f63SJim Harris * @brief This method simply provides the user with a unique handle for a 589f11c7f63SJim Harris * given SAS/SATA phy index/identifier. 590f11c7f63SJim Harris * 591f11c7f63SJim Harris * @param[in] controller This parameter represents the handle to the 592f11c7f63SJim Harris * controller object from which to retrieve a phy (SAS or 593f11c7f63SJim Harris * SATA) handle. 594f11c7f63SJim Harris * @param[in] phy_index This parameter specifies the phy index in 595f11c7f63SJim Harris * the controller for which to retrieve the phy handle. 596f11c7f63SJim Harris * 0 <= phy_index < maximum number of phys. 597f11c7f63SJim Harris * @param[out] phy_handle This parameter specifies the retrieved phy handle 598f11c7f63SJim Harris * to be provided to the caller. 599f11c7f63SJim Harris * 600f11c7f63SJim Harris * @return Indicate if the retrieval of the phy handle was successful. 601f11c7f63SJim Harris * @retval SCI_SUCCESS This value is returned if the retrieval was successful. 602f11c7f63SJim Harris * @retval SCI_FAILURE_INVALID_PHY This value is returned if the supplied phy 603f11c7f63SJim Harris * id is not in the supported range. 604f11c7f63SJim Harris */ 605f11c7f63SJim Harris SCI_STATUS scic_controller_get_phy_handle( 606f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 607f11c7f63SJim Harris U8 phy_index, 608f11c7f63SJim Harris SCI_PHY_HANDLE_T * phy_handle 609f11c7f63SJim Harris ); 610f11c7f63SJim Harris 611f11c7f63SJim Harris /** 612f11c7f63SJim Harris * @brief This method will allocate a tag from the pool of free IO tags. 613f11c7f63SJim Harris * Direct allocation of IO tags by the SCI Core user is optional. 614f11c7f63SJim Harris * The scic_controller_start_io() method will allocate an IO 615f11c7f63SJim Harris * tag if this method is not utilized and the tag is not 616f11c7f63SJim Harris * supplied to the IO construct routine. Direct allocation of IO tags 617f11c7f63SJim Harris * may provide additional performance improvements in environments 618f11c7f63SJim Harris * capable of supporting this usage model. Additionally, direct 619f11c7f63SJim Harris * allocation of IO tags also provides additional flexibility to the 620f11c7f63SJim Harris * SCI Core user. Specifically, the user may retain IO tags across 621f11c7f63SJim Harris * the lives of multiple IO requests. 622f11c7f63SJim Harris * 623f11c7f63SJim Harris * @warning IO tags are a protected resource. It is incumbent upon the 624f11c7f63SJim Harris * SCI Core user to ensure that each of the methods that may 625f11c7f63SJim Harris * allocate or free available IO tags are handled in a mutually 626f11c7f63SJim Harris * exclusive manner. This method is one of said methods requiring 627f11c7f63SJim Harris * proper critical code section protection (e.g. semaphore, 628f11c7f63SJim Harris * spin-lock, etc.). 629f11c7f63SJim Harris * 630f11c7f63SJim Harris * @param[in] controller the handle to the controller object for which to 631f11c7f63SJim Harris * allocate the tag. 632f11c7f63SJim Harris * 633f11c7f63SJim Harris * @return An unsigned integer representing an available IO tag. 634f11c7f63SJim Harris * @retval SCI_CONTROLLER_INVALID_IO_TAG This value is returned if there 635f11c7f63SJim Harris * are no currently available tags to be allocated. 636f11c7f63SJim Harris * @retval All return other values indicate a legitimate tag. 637f11c7f63SJim Harris */ 638f11c7f63SJim Harris U16 scic_controller_allocate_io_tag( 639f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller 640f11c7f63SJim Harris ); 641f11c7f63SJim Harris 642f11c7f63SJim Harris /** 643f11c7f63SJim Harris * @brief This method will free an IO tag to the pool of free IO tags. 644f11c7f63SJim Harris * This method provides the SCI Core user more flexibility with 645f11c7f63SJim Harris * regards to IO tags. The user may desire to keep an IO tag after 646f11c7f63SJim Harris * an IO request has completed, because they plan on re-using the 647f11c7f63SJim Harris * tag for a subsequent IO request. This method is only legal if 648f11c7f63SJim Harris * the tag was allocated via scic_controller_allocate_io_tag(). 649f11c7f63SJim Harris * 650f11c7f63SJim Harris * @warning 651f11c7f63SJim Harris * - IO tags are a protected resource. It is incumbent upon the 652f11c7f63SJim Harris * SCI Core user to ensure that each of the methods that may 653f11c7f63SJim Harris * allocate or free available IO tags are handled in a mutually 654f11c7f63SJim Harris * exclusive manner. This method is one of said methods requiring 655f11c7f63SJim Harris * proper critical code section protection (e.g. semaphore, 656f11c7f63SJim Harris * spin-lock, etc.). 657f11c7f63SJim Harris * - If the IO tag for a request was allocated, by the SCI Core user, 658f11c7f63SJim Harris * using the scic_controller_allocate_io_tag() method, then it is 659f11c7f63SJim Harris * the responsibility of the caller to invoke this method to free 660f11c7f63SJim Harris * the tag. 661f11c7f63SJim Harris * 662f11c7f63SJim Harris * @param[in] controller This parameter specifies the handle to the 663f11c7f63SJim Harris * controller object for which to free/return the tag. 664f11c7f63SJim Harris * @param[in] io_tag This parameter represents the tag to be freed to the 665f11c7f63SJim Harris * pool of available tags. 666f11c7f63SJim Harris * 667f11c7f63SJim Harris * @return This method returns an indication of whether the tag was 668f11c7f63SJim Harris * successfully put back (freed) to the pool of available tags. 669f11c7f63SJim Harris * @retval SCI_SUCCESS This return value indicates the tag was successfully 670f11c7f63SJim Harris * placed into the pool of available IO tags. 671f11c7f63SJim Harris * @retval SCI_FAILURE_INVALID_IO_TAG This value is returned if the supplied 672f11c7f63SJim Harris * tag is not a valid IO tag value. 673f11c7f63SJim Harris */ 674f11c7f63SJim Harris SCI_STATUS scic_controller_free_io_tag( 675f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 676f11c7f63SJim Harris U16 io_tag 677f11c7f63SJim Harris ); 678f11c7f63SJim Harris 679f11c7f63SJim Harris /** 680f11c7f63SJim Harris * @brief This method returns the size of the core's scratch RAM. 681f11c7f63SJim Harris * 682f11c7f63SJim Harris * @return Size of the scratch RAM in dwords. 683f11c7f63SJim Harris */ 684f11c7f63SJim Harris U32 scic_controller_get_scratch_ram_size( 685f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller 686f11c7f63SJim Harris ); 687f11c7f63SJim Harris 688f11c7f63SJim Harris /** 689f11c7f63SJim Harris * @brief This method allows the user to read a U32 from the core's 690f11c7f63SJim Harris * scratch RAM. 691f11c7f63SJim Harris * 692f11c7f63SJim Harris * @param[in] controller This parameter represents the handle to the 693f11c7f63SJim Harris * controller object for which to read scratch RAM. 694f11c7f63SJim Harris * @param[in] offset The offset (in dwords) into the scratch RAM. 695f11c7f63SJim Harris * @param[out] value The location where the read value should be stored. 696f11c7f63SJim Harris * 697f11c7f63SJim Harris * @return Indicate if the user specified a valid offset into the 698f11c7f63SJim Harris * scratch RAM. 699f11c7f63SJim Harris * @retval SCI_SUCCESS The scratch RAM was successfully read. 700f11c7f63SJim Harris * @retval SCI_FAILURE_INVALID_PARAMETER_VALUE The user specified an 701f11c7f63SJim Harris * invalid offset. 702f11c7f63SJim Harris */ 703f11c7f63SJim Harris SCI_STATUS scic_controller_read_scratch_ram_dword( 704f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 705f11c7f63SJim Harris U32 offset, 706f11c7f63SJim Harris U32 * value 707f11c7f63SJim Harris ); 708f11c7f63SJim Harris 709f11c7f63SJim Harris /** 710f11c7f63SJim Harris * @brief This method allows the user to write a U32 to the core's 711f11c7f63SJim Harris * scratch RAM. 712f11c7f63SJim Harris * 713f11c7f63SJim Harris * @param[in] controller This parameter represents the handle to the 714f11c7f63SJim Harris * controller object for which to write scratch RAM. 715f11c7f63SJim Harris * @param[in] offset The offset (in dwords) into the scratch RAM. 716f11c7f63SJim Harris * @param[out] value The value to be written to scratch RAM. 717f11c7f63SJim Harris * 718f11c7f63SJim Harris * @return Indicate if the user specified a valid offset into the 719f11c7f63SJim Harris * scratch RAM. 720f11c7f63SJim Harris * @retval SCI_SUCCESS The scratch RAM was successfully written. 721f11c7f63SJim Harris * @retval SCI_FAILURE_INVALID_PARAMETER_VALUE The user specified an 722f11c7f63SJim Harris * invalid offset. 723f11c7f63SJim Harris */ 724f11c7f63SJim Harris SCI_STATUS scic_controller_write_scratch_ram_dword( 725f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 726f11c7f63SJim Harris U32 offset, 727f11c7f63SJim Harris U32 value 728f11c7f63SJim Harris ); 729f11c7f63SJim Harris 730f11c7f63SJim Harris /** 731f11c7f63SJim Harris * @brief This method allows the user to configure the SCI core into 732f11c7f63SJim Harris * either a performance mode or a memory savings mode. 733f11c7f63SJim Harris * 734f11c7f63SJim Harris * @param[in] controller This parameter represents the handle to the 735f11c7f63SJim Harris * controller object for which to update the operating 736f11c7f63SJim Harris * mode. 737f11c7f63SJim Harris * @param[in] mode This parameter specifies the new mode for the 738f11c7f63SJim Harris * controller. 739f11c7f63SJim Harris * 740f11c7f63SJim Harris * @return Indicate if the user successfully change the operating mode 741f11c7f63SJim Harris * of the controller. 742f11c7f63SJim Harris * @retval SCI_SUCCESS The user successfully updated the mode. 743f11c7f63SJim Harris */ 744f11c7f63SJim Harris SCI_STATUS scic_controller_set_mode( 745f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 746f11c7f63SJim Harris SCI_CONTROLLER_MODE mode 747f11c7f63SJim Harris ); 748f11c7f63SJim Harris 749f11c7f63SJim Harris 750f11c7f63SJim Harris #if !defined(DISABLE_INTERRUPTS) 751f11c7f63SJim Harris /** 752f11c7f63SJim Harris * @brief This method allows the user to configure the interrupt coalescence. 753f11c7f63SJim Harris * 754f11c7f63SJim Harris * @param[in] controller This parameter represents the handle to the 755f11c7f63SJim Harris * controller object for which its interrupt coalesce register 756f11c7f63SJim Harris * is overridden. 757f11c7f63SJim Harris * 758f11c7f63SJim Harris * @param[in] coalesce_number Used to control the number of entries in the 759f11c7f63SJim Harris * Completion Queue before an interrupt is generated. If the 760f11c7f63SJim Harris * number of entries exceed this number, an interrupt will be 761f11c7f63SJim Harris * generated. The valid range of the input is [0, 256]. 762f11c7f63SJim Harris * A setting of 0 results in coalescing being disabled. 763f11c7f63SJim Harris * @param[in] coalesce_timeout Timeout value in microseconds. The valid range 764f11c7f63SJim Harris * of the input is [0, 2700000] . A setting of 0 is allowed and 765f11c7f63SJim Harris * results in no interrupt coalescing timeout. 766f11c7f63SJim Harris * 767f11c7f63SJim Harris * @return Indicate if the user successfully set the interrupt coalesce parameters. 768*5014dc95SGordon Bergling * @retval SCI_SUCCESS The user successfully updated the interrupt coalescence. 769f11c7f63SJim Harris * @retval SCI_FAILURE_INVALID_PARAMETER_VALUE The user input value is out of range. 770f11c7f63SJim Harris */ 771f11c7f63SJim Harris SCI_STATUS scic_controller_set_interrupt_coalescence( 772f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 773f11c7f63SJim Harris U32 coalesce_number, 774f11c7f63SJim Harris U32 coalesce_timeout 775f11c7f63SJim Harris ); 776f11c7f63SJim Harris 777f11c7f63SJim Harris /** 778f11c7f63SJim Harris * @brief This method retrieves the interrupt coalescing values 779f11c7f63SJim Harris * 780f11c7f63SJim Harris * @param[in] controller This parameter specifies the controller for 781f11c7f63SJim Harris * which its interrupt coalescing number is read. 782f11c7f63SJim Harris * 783f11c7f63SJim Harris * @param[out] coalesce_number, interrupt coalescing number read from controller. 784f11c7f63SJim Harris * 785f11c7f63SJim Harris * @param[out] coalesce_timeout, timeout value in microseconds. 786f11c7f63SJim Harris * 787f11c7f63SJim Harris * @return None 788f11c7f63SJim Harris */ 789f11c7f63SJim Harris void scic_controller_get_interrupt_coalescence( 790f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 791f11c7f63SJim Harris U32 * coalesce_number, 792f11c7f63SJim Harris U32 * coalesce_timeout 793f11c7f63SJim Harris ); 794f11c7f63SJim Harris #else // !defined(DISABLE_INTERRUPTS) 795f11c7f63SJim Harris #define scic_controller_set_interrupt_coalescence(controller, num, timeout) \ 796f11c7f63SJim Harris SCI_FAILURE 797f11c7f63SJim Harris #define scic_controller_get_interrupt_coalescence(controller, num, timeout) 798f11c7f63SJim Harris #endif // !defined(DISABLE_INTERRUPTS) 799f11c7f63SJim Harris 800f11c7f63SJim Harris 801f11c7f63SJim Harris /** 802f11c7f63SJim Harris * @brief This method suspend the controller, reinitialize RAMs, then resume 803f11c7f63SJim Harris * the controller. 804f11c7f63SJim Harris * 805f11c7f63SJim Harris * @param[in] controller This parameter specifies the controller which is transitioning. 806f11c7f63SJim Harris * 807f11c7f63SJim Harris * @param[in] restrict_completions This parameter specifies whether the controller should 808f11c7f63SJim Harris * ignore completion processing for non-fastpath events. This will cause 809f11c7f63SJim Harris * the completions to be thrown away. 810f11c7f63SJim Harris * 811f11c7f63SJim Harris * @return SCI_STATUS The status of controller transition. 812f11c7f63SJim Harris */ 813f11c7f63SJim Harris SCI_STATUS scic_controller_transition( 814f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 815f11c7f63SJim Harris BOOL restrict_completions 816f11c7f63SJim Harris ); 817f11c7f63SJim Harris 818f11c7f63SJim Harris 819f11c7f63SJim Harris /** 820f11c7f63SJim Harris * @brief This method suspends the controller. 821f11c7f63SJim Harris * 822f11c7f63SJim Harris * @param[in] controller This parameter specifies the controller which is to be suspended. 823f11c7f63SJim Harris * 824f11c7f63SJim Harris * @return SCI_STATUS The status of controller suspend. 825f11c7f63SJim Harris */ 826f11c7f63SJim Harris SCI_STATUS scic_controller_suspend( 827f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller 828f11c7f63SJim Harris ); 829f11c7f63SJim Harris 830f11c7f63SJim Harris /** 831f11c7f63SJim Harris * @brief This method resumes the controller. 832f11c7f63SJim Harris * 833f11c7f63SJim Harris * @param[in] controller This parameter specifies the controller which is to be resumed. 834f11c7f63SJim Harris * 835f11c7f63SJim Harris * @return SCI_STATUS The status of controller resume. 836f11c7f63SJim Harris */ 837f11c7f63SJim Harris SCI_STATUS scic_controller_resume( 838f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller 839f11c7f63SJim Harris ); 840f11c7f63SJim Harris 841f11c7f63SJim Harris SCI_STATUS scic_controller_get_max_ports( 842f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 843f11c7f63SJim Harris U8 * count 844f11c7f63SJim Harris ); 845f11c7f63SJim Harris 846f11c7f63SJim Harris SCI_STATUS scic_controller_get_max_phys( 847f11c7f63SJim Harris SCI_CONTROLLER_HANDLE_T controller, 848f11c7f63SJim Harris U8 * count 849f11c7f63SJim Harris ); 850f11c7f63SJim Harris 851f11c7f63SJim Harris #ifdef __cplusplus 852f11c7f63SJim Harris } 853f11c7f63SJim Harris #endif // __cplusplus 854f11c7f63SJim Harris 855f11c7f63SJim Harris #endif // _SCIC_CONTROLLER_H_ 856f11c7f63SJim Harris 857