1230557Sjimharris/*- 2230557Sjimharris * This file is provided under a dual BSD/GPLv2 license. When using or 3230557Sjimharris * redistributing this file, you may do so under either license. 4230557Sjimharris * 5230557Sjimharris * GPL LICENSE SUMMARY 6230557Sjimharris * 7230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8230557Sjimharris * 9230557Sjimharris * This program is free software; you can redistribute it and/or modify 10230557Sjimharris * it under the terms of version 2 of the GNU General Public License as 11230557Sjimharris * published by the Free Software Foundation. 12230557Sjimharris * 13230557Sjimharris * This program is distributed in the hope that it will be useful, but 14230557Sjimharris * WITHOUT ANY WARRANTY; without even the implied warranty of 15230557Sjimharris * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16230557Sjimharris * General Public License for more details. 17230557Sjimharris * 18230557Sjimharris * You should have received a copy of the GNU General Public License 19230557Sjimharris * along with this program; if not, write to the Free Software 20230557Sjimharris * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 21230557Sjimharris * The full GNU General Public License is included in this distribution 22230557Sjimharris * in the file called LICENSE.GPL. 23230557Sjimharris * 24230557Sjimharris * BSD LICENSE 25230557Sjimharris * 26230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 27230557Sjimharris * All rights reserved. 28230557Sjimharris * 29230557Sjimharris * Redistribution and use in source and binary forms, with or without 30230557Sjimharris * modification, are permitted provided that the following conditions 31230557Sjimharris * are met: 32230557Sjimharris * 33230557Sjimharris * * Redistributions of source code must retain the above copyright 34230557Sjimharris * notice, this list of conditions and the following disclaimer. 35230557Sjimharris * * Redistributions in binary form must reproduce the above copyright 36230557Sjimharris * notice, this list of conditions and the following disclaimer in 37230557Sjimharris * the documentation and/or other materials provided with the 38230557Sjimharris * distribution. 39230557Sjimharris * 40230557Sjimharris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41230557Sjimharris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42230557Sjimharris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 43230557Sjimharris * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 44230557Sjimharris * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45230557Sjimharris * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 46230557Sjimharris * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47230557Sjimharris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48230557Sjimharris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49230557Sjimharris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 50230557Sjimharris * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51230557Sjimharris * 52230557Sjimharris * $FreeBSD$ 53230557Sjimharris */ 54230557Sjimharris#ifndef _SCIF_LIBRARY_H_ 55230557Sjimharris#define _SCIF_LIBRARY_H_ 56230557Sjimharris 57230557Sjimharris/** 58230557Sjimharris * @file 59230557Sjimharris * 60230557Sjimharris * @brief This file contains all of the interface methods that can be called 61230557Sjimharris * by an SCI Framework user on the library object. The library is 62230557Sjimharris * the container of all other objects being managed (i.e. controllers, 63230557Sjimharris * target devices, sas ports, etc.) by SCIF. 64230557Sjimharris */ 65230557Sjimharris 66230557Sjimharris#ifdef __cplusplus 67230557Sjimharrisextern "C" { 68230557Sjimharris#endif // __cplusplus 69230557Sjimharris 70230557Sjimharris#include <dev/isci/scil/sci_types.h> 71230557Sjimharris#include <dev/isci/scil/sci_status.h> 72230557Sjimharris 73230557Sjimharris 74230557Sjimharris/** 75230557Sjimharris * @brief This method will contsruct the SCI framework library based on the 76230557Sjimharris * supplied parameter information. By default, libraries are 77230557Sjimharris * considered "ready" as soon as they are constructed. 78230557Sjimharris * 79230557Sjimharris * @param[in] library_memory_p a pointer to the memory at which the 80230557Sjimharris * library object is located. 81230557Sjimharris * @param[in] max_controller_count the maximum number of controllers that 82230557Sjimharris * this library can manage. 83230557Sjimharris * 84230557Sjimharris * @return An opaque library handle to be used by the SCI user for all 85230557Sjimharris * subsequent library operations. 86230557Sjimharris */ 87230557SjimharrisSCI_LIBRARY_HANDLE_T scif_library_construct( 88230557Sjimharris void * library_memory_p, 89230557Sjimharris U8 max_controller_count 90230557Sjimharris); 91230557Sjimharris 92230557Sjimharris/** 93230557Sjimharris * @brief This method returns the size of the framework library object. The 94230557Sjimharris * size of the framework library object includes the associated core 95230557Sjimharris * object. 96230557Sjimharris * 97230557Sjimharris * @param[in] max_controller_count the maximum number of controllers that 98230557Sjimharris * this library can manage. 99230557Sjimharris * 100230557Sjimharris * @return a positive integer value indicating the size (in bytes) of the 101230557Sjimharris * library object. 102230557Sjimharris */ 103230557SjimharrisU32 scif_library_get_object_size( 104230557Sjimharris U8 max_controller_count 105230557Sjimharris); 106230557Sjimharris 107230557Sjimharris/** 108230557Sjimharris * @brief This method will allocate the next available framework controller 109230557Sjimharris * object that can be managed by this framework library. 110230557Sjimharris * 111230557Sjimharris * @see For additional information please refer to: 112230557Sjimharris * scic_library_allocate_controller() 113230557Sjimharris * 114230557Sjimharris * @param[in] library the handle to the library object for which to allocate 115230557Sjimharris * a controller. 116230557Sjimharris * @param[out] new_controller_p This parameter specifies a pointer to the 117230557Sjimharris * controller handle that was added to the library. 118230557Sjimharris * 119230557Sjimharris * @return Indicate if the controller was successfully allocated or if iti 120230557Sjimharris * failed in some way. 121230557Sjimharris * @retval SCI_SUCCESS if the controller was successfully allocated. 122230557Sjimharris * @retval SCI_FAILURE_INSUFFICIENT_RESOURCES if the library has no more 123230557Sjimharris * available controller objects to allocate. 124230557Sjimharris */ 125230557SjimharrisSCI_STATUS scif_library_allocate_controller( 126230557Sjimharris SCI_LIBRARY_HANDLE_T library, 127230557Sjimharris SCI_CONTROLLER_HANDLE_T * new_controller_p 128230557Sjimharris); 129230557Sjimharris 130230557Sjimharris/** 131230557Sjimharris * @brief This method will attempt to free the supplied controller to the 132230557Sjimharris * library. 133230557Sjimharris * 134230557Sjimharris * @param[in] library the handle to the library object for which to free 135230557Sjimharris * a controller. 136230557Sjimharris * @param[in] controller the handle to the controller object to be freed 137230557Sjimharris * from the library. 138230557Sjimharris * 139230557Sjimharris * @return Indicate if the controller was successfully freed or if it failed 140230557Sjimharris * in some way. 141230557Sjimharris * @retval SCI_SUCCESS if the controller was successfully freed. 142230557Sjimharris * @retval SCI_FAILURE_CONTROLLER_NOT_FOUND if the supplied controller is 143230557Sjimharris * not managed by the supplied library. 144230557Sjimharris */ 145230557SjimharrisSCI_STATUS scif_library_free_controller( 146230557Sjimharris SCI_LIBRARY_HANDLE_T library, 147230557Sjimharris SCI_CONTROLLER_HANDLE_T controller 148230557Sjimharris); 149230557Sjimharris 150230557Sjimharris 151230557Sjimharris/** 152230557Sjimharris * @brief This method returns the SCI Core library handle 153230557Sjimharris * associated with this library. 154230557Sjimharris * 155230557Sjimharris * @param[in] scif_library the handle to the library 156230557Sjimharris * object for which to retrieve the core specific 157230557Sjimharris * library handle 158230557Sjimharris * 159230557Sjimharris * @return Return the SCI core library handle associated with 160230557Sjimharris * the supplied framework library. 161230557Sjimharris */ 162230557SjimharrisSCI_LIBRARY_HANDLE_T scif_library_get_scic_handle( 163230557Sjimharris SCI_LIBRARY_HANDLE_T scif_library 164230557Sjimharris); 165230557Sjimharris 166230557Sjimharris 167230557Sjimharris/** 168230557Sjimharris * @brief This method returns the minimum number of timers needed. If the 169230557Sjimharris * user supplies timers less then the number specified via this 170230557Sjimharris * call, then the user runs the risk of improper operation. This 171230557Sjimharris * call includes the minimum number of timers needed by the core. 172230557Sjimharris * 173230557Sjimharris * @return This method returns a value representing the minimum number of 174230557Sjimharris * timers required by this framework implementation 175230557Sjimharris */ 176230557SjimharrisU16 scif_library_get_min_timer_count( 177230557Sjimharris void 178230557Sjimharris); 179230557Sjimharris 180230557Sjimharris/** 181230557Sjimharris * @brief This method returns the maximum number of timers that could 182230557Sjimharris * be ever be in use by this component at a given time. 183230557Sjimharris * 184230557Sjimharris * @return This method returns a value representing the minimum number of 185230557Sjimharris * timers required by this framework implementation 186230557Sjimharris */ 187230557SjimharrisU16 scif_library_get_max_timer_count( 188230557Sjimharris void 189230557Sjimharris); 190230557Sjimharris 191230557Sjimharris#ifdef __cplusplus 192230557Sjimharris} 193230557Sjimharris#endif // __cplusplus 194230557Sjimharris 195230557Sjimharris#endif // _SCIF_LIBRARY_H_ 196230557Sjimharris 197