1 /*- 2 * This file is provided under a dual BSD/GPLv2 license. When using or 3 * redistributing this file, you may do so under either license. 4 * 5 * GPL LICENSE SUMMARY 6 * 7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of version 2 of the GNU General Public License as 11 * published by the Free Software Foundation. 12 * 13 * This program is distributed in the hope that it will be useful, but 14 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 21 * The full GNU General Public License is included in this distribution 22 * in the file called LICENSE.GPL. 23 * 24 * BSD LICENSE 25 * 26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 27 * All rights reserved. 28 * 29 * Redistribution and use in source and binary forms, with or without 30 * modification, are permitted provided that the following conditions 31 * are met: 32 * 33 * * Redistributions of source code must retain the above copyright 34 * notice, this list of conditions and the following disclaimer. 35 * * Redistributions in binary form must reproduce the above copyright 36 * notice, this list of conditions and the following disclaimer in 37 * the documentation and/or other materials provided with the 38 * distribution. 39 * 40 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 43 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 44 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 46 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 50 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51 * 52 * $FreeBSD$ 53 */ 54 #ifndef _SCIF_DOMAIN_H_ 55 #define _SCIF_DOMAIN_H_ 56 57 /** 58 * @file 59 * 60 * @brief This file contains all of the interface methods that can be called 61 * by an SCI Framework user on the SAS/SATA domain object. 62 */ 63 64 #ifdef __cplusplus 65 extern "C" { 66 #endif // __cplusplus 67 68 #include <dev/isci/scil/sci_types.h> 69 #include <dev/isci/scil/sci_status.h> 70 #include <dev/isci/scil/intel_sas.h> 71 72 73 /** 74 * @brief This method enables the framework user to find the SCI Core Port 75 * object through which the supplied domain is accessed. 76 * 77 * @param[in] domain This parameter specifies the framework domain object 78 * for which to return the corresponding SCI Core port object. 79 * 80 * @return Return a handle to the SCI Core port through which the supplied 81 * domain is accessed. 82 * @retval SCI_INVALID_HANDLE This value is returned if the core port 83 * object can not be retrieved. 84 */ 85 SCI_PORT_HANDLE_T scif_domain_get_scic_port_handle( 86 SCI_DOMAIN_HANDLE_T domain 87 ); 88 89 /** 90 * @brief This method will find and retrieve the device associated with the 91 * supplied SAS address if such a device exists. 92 * 93 * @param[in] domain This parameter specifies the framework domain object 94 * on which to discover devices. 95 * @param[in] sas_address This parameter specifies the SAS address of the 96 * object to locate in this domain. 97 * 98 * @return Indicate if the device was successfully found in the domain. 99 * @retval SCI_INVALID_HANDLE This value is returned if the device is not 100 * found in the domain. 101 * @retval All other values indicate a valid remote device being found. 102 */ 103 SCI_REMOTE_DEVICE_HANDLE_T scif_domain_get_device_by_sas_address( 104 SCI_DOMAIN_HANDLE_T domain, 105 SCI_SAS_ADDRESS_T * sas_address 106 ); 107 108 /** 109 * @brief This method will attempt to discover the supplied domain. 110 * 111 * @warning This method must be synchronized with the controller completion 112 * handler (see scic_controller_get_handler_methods()). The user 113 * may call this method from within the completion handler in which 114 * case, no synchronization is necessary. 115 * 116 * @note 117 * - IO requests from the OS driver are held off until discovery 118 * of the domain is complete. 119 * - Discovery may perform SSP or STP IO requests to configure 120 * remote devices prior to informing the SCIF User of their 121 * existence via the remote_device_ready user callback. 122 * 123 * @param[in] domain This parameter specifies the framework domain object 124 * on which to discover devices. 125 * @param[in] discover_timeout This parameter specifies the number of 126 * milliseconds in which the domain discovery operation should 127 * complete. 128 * @param[in] device_timeout This parameter specifies the number of 129 * milliseconds in which the device configuration and/or reset 130 * operations should complete. Logically, the device_timeout 131 * parameter should be shorter then the domain_timeout value. 132 * Especially considering the domain could be made up of "n" 133 * different devices. 134 * 135 * @return Indicate if the discover operation started successfully. 136 * @retval SCI_SUCCESS This value is returned if the discover operation 137 * started successfully. 138 * @retval SCI_WARNING_TIMER_CONFLICT This value is returned if the SCI 139 * implementation doesn't support the desired timeout amounts or if 140 * the desired timeout amounts conflict in some manner. 141 */ 142 SCI_STATUS scif_domain_discover( 143 SCI_DOMAIN_HANDLE_T domain, 144 U32 discover_timeout, 145 U32 device_timeout 146 ); 147 148 #if !defined(DISABLE_SCI_ITERATORS) 149 /** 150 * @brief This method gets an iterator for the list of remote devices in the 151 * specified domain. 152 * 153 * @param[in] domain: This parameter specifies the framework domain handle 154 * @param[in] iterator_buffer: This parameters specifies the memory buffer that 155 * will be used to construct the iterator. 156 * 157 * @retval Handle to the remote device list iterator. 158 */ 159 SCI_ITERATOR_HANDLE_T scif_domain_get_remote_device_iterator( 160 SCI_DOMAIN_HANDLE_T domain, 161 void * iterator_buffer 162 ); 163 #else // !defined(DISABLE_SCI_ITERATORS) 164 #define scif_domain_get_remote_device_iterator(the_domain, the_buffer) \ 165 SCI_INVALID_HANDLE 166 #endif // !defined(DISABLE_SCI_ITERATORS) 167 168 /** 169 * @brief This method simply returns a suggest timeout value for discovery. 170 * 171 * @param[in] domain The handle to the domain whose discover activity is to 172 * be started. 173 * 174 * @return The suggested timeout value for domain discover in milli-seconds. 175 */ 176 U32 scif_domain_get_suggested_discover_timeout( 177 SCI_DOMAIN_HANDLE_T domain 178 ); 179 180 #ifdef __cplusplus 181 } 182 #endif // __cplusplus 183 184 #endif // _SCIF_DOMAIN_H_ 185 186