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 * $FreeBSD$ 55 */ 56 #ifndef _SCIC_PORT_H_ 57 #define _SCIC_PORT_H_ 58 59 /** 60 * @file 61 * 62 * @brief This file contains all of the interface methods that can be called 63 * by an SCI Core user on a SAS or SATA port. 64 */ 65 66 #ifdef __cplusplus 67 extern "C" { 68 #endif // __cplusplus 69 70 #include <dev/isci/scil/sci_types.h> 71 #include <dev/isci/scil/sci_status.h> 72 #include <dev/isci/scil/intel_sas.h> 73 74 enum SCIC_PORT_NOT_READY_REASON_CODE 75 { 76 SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS, 77 SCIC_PORT_NOT_READY_HARD_RESET_REQUESTED, 78 SCIC_PORT_NOT_READY_INVALID_PORT_CONFIGURATION, 79 SCIC_PORT_NOT_READY_RECONFIGURING, 80 81 SCIC_PORT_NOT_READY_REASON_CODE_MAX 82 }; 83 84 /** 85 * @struct SCIC_PORT_END_POINT_PROPERTIES 86 * @brief This structure defines the properties that can be retrieved 87 * for each end-point local or remote (attached) port in the 88 * controller. 89 */ 90 typedef struct SCIC_PORT_END_POINT_PROPERTIES 91 { 92 /** 93 * This field indicates the SAS address for the associated end 94 * point in the port. 95 */ 96 SCI_SAS_ADDRESS_T sas_address; 97 98 /** 99 * This field indicates the protocols supported by the associated 100 * end-point in the port. 101 */ 102 SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS_T protocols; 103 104 } SCIC_PORT_END_POINT_PROPERTIES_T; 105 106 /** 107 * @struct SCIC_PORT_PROPERTIES 108 * @brief This structure defines the properties that can be retrieved 109 * for each port in the controller. 110 */ 111 typedef struct SCIC_PORT_PROPERTIES 112 { 113 /** 114 * This field specifies the logical index of the port (0 relative). 115 */ 116 U32 index; 117 118 /** 119 * This field indicates the local end-point properties for port. 120 */ 121 SCIC_PORT_END_POINT_PROPERTIES_T local; 122 123 /** 124 * This field indicates the remote (attached) end-point properties 125 * for the port. 126 */ 127 SCIC_PORT_END_POINT_PROPERTIES_T remote; 128 129 /** 130 * This field specifies the phys contained inside the port. 131 */ 132 U32 phy_mask; 133 134 } SCIC_PORT_PROPERTIES_T; 135 136 /** 137 * @brief This method simply returns the properties regarding the 138 * port, such as: physical index, protocols, sas address, etc. 139 * 140 * @param[in] port this parameter specifies the port for which to retrieve 141 * the physical index. 142 * @param[out] properties This parameter specifies the properties 143 * structure into which to copy the requested information. 144 * 145 * @return Indicate if the user specified a valid port. 146 * @retval SCI_SUCCESS This value is returned if the specified port was valid. 147 * @retval SCI_FAILURE_INVALID_PORT This value is returned if the specified port 148 * is not valid. When this value is returned, no data is copied to the 149 * properties output parameter. 150 */ 151 SCI_STATUS scic_port_get_properties( 152 SCI_PORT_HANDLE_T port, 153 SCIC_PORT_PROPERTIES_T * properties 154 ); 155 156 /** 157 * @brief This method will add a phy to an existing port. 158 * 159 * @param[in] port This parameter specifies the port in which to add a new 160 * phy. 161 * @param[in] phy This parameter specifies the phy to be added to the port. 162 * 163 * @return Indicate if the phy was successfully added to the port. 164 * @retval SCI_SUCCESS This value is returned if the phy was successfully 165 * added to the port. 166 * @retval SCI_FAILURE_INVALID_PORT This value is returned if the supplied 167 * port is not valid. 168 * @retval SCI_FAILURE_INVALID_PHY This value is returned if the supplied 169 * phy is either invalid or already contained in another port. 170 */ 171 SCI_STATUS scic_port_add_phy( 172 SCI_PORT_HANDLE_T port, 173 SCI_PHY_HANDLE_T phy 174 ); 175 176 /** 177 * @brief This method will remove a phy from an existing port. 178 * 179 * @param[in] port This parameter specifies the port in which to remove a 180 * phy. 181 * @param[in] phy This parameter specifies the phy to be removed from the 182 * port. 183 * 184 * @return Indicate if the phy was successfully removed from the port. 185 * @retval SCI_SUCCESS This value is returned if the phy was successfully 186 * removed from the port. 187 * @retval SCI_FAILURE_INVALID_PORT This value is returned if the supplied 188 * port is not valid. 189 * @retval SCI_FAILURE_INVALID_PHY This value is returned if the supplied 190 * phy is either invalid or 191 * not contained in the port. 192 */ 193 SCI_STATUS scic_port_remove_phy( 194 SCI_PORT_HANDLE_T port, 195 SCI_PHY_HANDLE_T phy 196 ); 197 198 /** 199 * @brief This method will request the SCI implementation to perform a 200 * HARD RESET on the SAS Port. If/When the HARD RESET completes 201 * the SCI user will be notified via an SCI OS callback indicating 202 * a direct attached device was found. 203 * 204 * @note The SCI User callback in SCIC_USER_CALLBACKS_T will only be called 205 * once for each phy in the SAS Port at completion of the hard reset 206 * sequence. 207 * 208 * @param[in] port a handle corresponding to the SAS port to be 209 * hard reset. 210 * @param[in] reset_timeout This parameter specifies the number of 211 * milliseconds in which the port reset operation should complete. 212 * 213 * @return Return a status indicating whether the hard reset started 214 * successfully. 215 * @retval SCI_SUCCESS This value is returned if the hard reset operation 216 * started successfully. 217 */ 218 SCI_STATUS scic_port_hard_reset( 219 SCI_PORT_HANDLE_T port, 220 U32 reset_timeout 221 ); 222 223 /** 224 * @brief This API method enables the broadcast change notification from 225 * underneath hardware. 226 * 227 * @param[in] port The port upon which broadcast change notifications 228 * (BCN) are to be enabled. 229 * 230 * @return none 231 */ 232 void scic_port_enable_broadcast_change_notification( 233 SCI_PORT_HANDLE_T port 234 ); 235 236 #ifdef __cplusplus 237 } 238 #endif // __cplusplus 239 240 #endif // _SCIC_PORT_H_ 241 242