1162271Srwatson/*- 2162271Srwatson * This file is provided under a dual BSD/GPLv2 license. When using or 3172106Srwatson * redistributing this file, you may do so under either license. 4162271Srwatson * 5162271Srwatson * GPL LICENSE SUMMARY 6162271Srwatson * 7162271Srwatson * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8162271Srwatson * 9162271Srwatson * This program is free software; you can redistribute it and/or modify 10162271Srwatson * it under the terms of version 2 of the GNU General Public License as 11162271Srwatson * published by the Free Software Foundation. 12162271Srwatson * 13162271Srwatson * This program is distributed in the hope that it will be useful, but 14162271Srwatson * WITHOUT ANY WARRANTY; without even the implied warranty of 15162271Srwatson * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16162271Srwatson * General Public License for more details. 17162271Srwatson * 18162271Srwatson * You should have received a copy of the GNU General Public License 19162271Srwatson * along with this program; if not, write to the Free Software 20162271Srwatson * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 21162271Srwatson * The full GNU General Public License is included in this distribution 22162271Srwatson * in the file called LICENSE.GPL. 23162271Srwatson * 24162271Srwatson * BSD LICENSE 25162271Srwatson * 26162271Srwatson * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 27162271Srwatson * All rights reserved. 28162271Srwatson * 29162271Srwatson * Redistribution and use in source and binary forms, with or without 30162271Srwatson * modification, are permitted provided that the following conditions 31162271Srwatson * are met: 32162271Srwatson * 33162271Srwatson * * Redistributions of source code must retain the above copyright 34172106Srwatson * notice, this list of conditions and the following disclaimer. 35162271Srwatson * * Redistributions in binary form must reproduce the above copyright 36162271Srwatson * notice, this list of conditions and the following disclaimer in 37162271Srwatson * the documentation and/or other materials provided with the 38162271Srwatson * distribution. 39162271Srwatson * 40162271Srwatson * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41162271Srwatson * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42162271Srwatson * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 43162271Srwatson * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 44162271Srwatson * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45162271Srwatson * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 46172106Srwatson * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47172106Srwatson * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48172106Srwatson * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49172106Srwatson * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 50172106Srwatson * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51172106Srwatson * 52172106Srwatson * $FreeBSD$ 53162271Srwatson */ 54172106Srwatson#ifndef _SCIC_PORT_H_ 55162271Srwatson#define _SCIC_PORT_H_ 56162271Srwatson 57162271Srwatson/** 58162271Srwatson * @file 59172106Srwatson * 60172106Srwatson * @brief This file contains all of the interface methods that can be called 61172106Srwatson * by an SCI Core user on a SAS or SATA port. 62172106Srwatson */ 63172106Srwatson 64172106Srwatson#ifdef __cplusplus 65172106Srwatsonextern "C" { 66172106Srwatson#endif // __cplusplus 67172106Srwatson 68162271Srwatson#include <dev/isci/scil/sci_types.h> 69162271Srwatson#include <dev/isci/scil/sci_status.h> 70172106Srwatson#include <dev/isci/scil/intel_sas.h> 71172106Srwatson 72172106Srwatsonenum SCIC_PORT_NOT_READY_REASON_CODE 73172106Srwatson{ 74162271Srwatson SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS, 75 SCIC_PORT_NOT_READY_HARD_RESET_REQUESTED, 76 SCIC_PORT_NOT_READY_INVALID_PORT_CONFIGURATION, 77 SCIC_PORT_NOT_READY_RECONFIGURING, 78 79 SCIC_PORT_NOT_READY_REASON_CODE_MAX 80}; 81 82/** 83 * @struct SCIC_PORT_END_POINT_PROPERTIES 84 * @brief This structure defines the properties that can be retrieved 85 * for each end-point local or remote (attached) port in the 86 * controller. 87 */ 88typedef struct SCIC_PORT_END_POINT_PROPERTIES 89{ 90 /** 91 * This field indicates the SAS address for the associated end 92 * point in the port. 93 */ 94 SCI_SAS_ADDRESS_T sas_address; 95 96 /** 97 * This field indicates the protocols supported by the associated 98 * end-point in the port. 99 */ 100 SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS_T protocols; 101 102} SCIC_PORT_END_POINT_PROPERTIES_T; 103 104/** 105 * @struct SCIC_PORT_PROPERTIES 106 * @brief This structure defines the properties that can be retrieved 107 * for each port in the controller. 108 */ 109typedef struct SCIC_PORT_PROPERTIES 110{ 111 /** 112 * This field specifies the logical index of the port (0 relative). 113 */ 114 U32 index; 115 116 /** 117 * This field indicates the local end-point properties for port. 118 */ 119 SCIC_PORT_END_POINT_PROPERTIES_T local; 120 121 /** 122 * This field indicates the remote (attached) end-point properties 123 * for the port. 124 */ 125 SCIC_PORT_END_POINT_PROPERTIES_T remote; 126 127 /** 128 * This field specifies the phys contained inside the port. 129 */ 130 U32 phy_mask; 131 132} SCIC_PORT_PROPERTIES_T; 133 134/** 135 * @brief This method simply returns the properties regarding the 136 * port, such as: physical index, protocols, sas address, etc. 137 * 138 * @param[in] port this parameter specifies the port for which to retrieve 139 * the physical index. 140 * @param[out] properties This parameter specifies the properties 141 * structure into which to copy the requested information. 142 * 143 * @return Indicate if the user specified a valid port. 144 * @retval SCI_SUCCESS This value is returned if the specified port was valid. 145 * @retval SCI_FAILURE_INVALID_PORT This value is returned if the specified port 146 * is not valid. When this value is returned, no data is copied to the 147 * properties output parameter. 148 */ 149SCI_STATUS scic_port_get_properties( 150 SCI_PORT_HANDLE_T port, 151 SCIC_PORT_PROPERTIES_T * properties 152); 153 154/** 155 * @brief This method will add a phy to an existing port. 156 * 157 * @param[in] port This parameter specifies the port in which to add a new 158 * phy. 159 * @param[in] phy This parameter specifies the phy to be added to the port. 160 * 161 * @return Indicate if the phy was successfully added to the port. 162 * @retval SCI_SUCCESS This value is returned if the phy was successfully 163 * added to the port. 164 * @retval SCI_FAILURE_INVALID_PORT This value is returned if the supplied 165 * port is not valid. 166 * @retval SCI_FAILURE_INVALID_PHY This value is returned if the supplied 167 * phy is either invalid or already contained in another port. 168 */ 169SCI_STATUS scic_port_add_phy( 170 SCI_PORT_HANDLE_T port, 171 SCI_PHY_HANDLE_T phy 172); 173 174/** 175 * @brief This method will remove a phy from an existing port. 176 * 177 * @param[in] port This parameter specifies the port in which to remove a 178 * phy. 179 * @param[in] phy This parameter specifies the phy to be removed from the 180 * port. 181 * 182 * @return Indicate if the phy was successfully removed from the port. 183 * @retval SCI_SUCCESS This value is returned if the phy was successfully 184 * removed from the port. 185 * @retval SCI_FAILURE_INVALID_PORT This value is returned if the supplied 186 * port is not valid. 187 * @retval SCI_FAILURE_INVALID_PHY This value is returned if the supplied 188 * phy is either invalid or 189 * not contained in the port. 190 */ 191SCI_STATUS scic_port_remove_phy( 192 SCI_PORT_HANDLE_T port, 193 SCI_PHY_HANDLE_T phy 194); 195 196/** 197 * @brief This method will request the SCI implementation to perform a 198 * HARD RESET on the SAS Port. If/When the HARD RESET completes 199 * the SCI user will be notified via an SCI OS callback indicating 200 * a direct attached device was found. 201 * 202 * @note The SCI User callback in SCIC_USER_CALLBACKS_T will only be called 203 * once for each phy in the SAS Port at completion of the hard reset 204 * sequence. 205 * 206 * @param[in] port a handle corresponding to the SAS port to be 207 * hard reset. 208 * @param[in] reset_timeout This parameter specifies the number of 209 * milliseconds in which the port reset operation should complete. 210 * 211 * @return Return a status indicating whether the hard reset started 212 * successfully. 213 * @retval SCI_SUCCESS This value is returned if the hard reset operation 214 * started successfully. 215 */ 216SCI_STATUS scic_port_hard_reset( 217 SCI_PORT_HANDLE_T port, 218 U32 reset_timeout 219); 220 221/** 222 * @brief This API method enables the broadcast change notification from 223 * underneath hardware. 224 * 225 * @param[in] port The port upon which broadcast change notifications 226 * (BCN) are to be enabled. 227 * 228 * @return none 229 */ 230void scic_port_enable_broadcast_change_notification( 231 SCI_PORT_HANDLE_T port 232); 233 234#ifdef __cplusplus 235} 236#endif // __cplusplus 237 238#endif // _SCIC_PORT_H_ 239 240