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.
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
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.
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.
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.
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
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
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.
54 #ifndef _SCIF_LIBRARY_H_
55 #define _SCIF_LIBRARY_H_
60 * @brief This file contains all of the interface methods that can be called
61 * by an SCI Framework user on the library object. The library is
62 * the container of all other objects being managed (i.e. controllers,
63 * target devices, sas ports, etc.) by SCIF.
70 #include <dev/isci/scil/sci_types.h>
71 #include <dev/isci/scil/sci_status.h>
75 * @brief This method will contsruct the SCI framework library based on the
76 * supplied parameter information. By default, libraries are
77 * considered "ready" as soon as they are constructed.
79 * @param[in] library_memory_p a pointer to the memory at which the
80 * library object is located.
81 * @param[in] max_controller_count the maximum number of controllers that
82 * this library can manage.
84 * @return An opaque library handle to be used by the SCI user for all
85 * subsequent library operations.
87 SCI_LIBRARY_HANDLE_T scif_library_construct(
88 void * library_memory_p,
89 U8 max_controller_count
93 * @brief This method returns the size of the framework library object. The
94 * size of the framework library object includes the associated core
97 * @param[in] max_controller_count the maximum number of controllers that
98 * this library can manage.
100 * @return a positive integer value indicating the size (in bytes) of the
103 U32 scif_library_get_object_size(
104 U8 max_controller_count
108 * @brief This method will allocate the next available framework controller
109 * object that can be managed by this framework library.
111 * @see For additional information please refer to:
112 * scic_library_allocate_controller()
114 * @param[in] library the handle to the library object for which to allocate
116 * @param[out] new_controller_p This parameter specifies a pointer to the
117 * controller handle that was added to the library.
119 * @return Indicate if the controller was successfully allocated or if iti
120 * failed in some way.
121 * @retval SCI_SUCCESS if the controller was successfully allocated.
122 * @retval SCI_FAILURE_INSUFFICIENT_RESOURCES if the library has no more
123 * available controller objects to allocate.
125 SCI_STATUS scif_library_allocate_controller(
126 SCI_LIBRARY_HANDLE_T library,
127 SCI_CONTROLLER_HANDLE_T * new_controller_p
131 * @brief This method will attempt to free the supplied controller to the
134 * @param[in] library the handle to the library object for which to free
136 * @param[in] controller the handle to the controller object to be freed
139 * @return Indicate if the controller was successfully freed or if it failed
141 * @retval SCI_SUCCESS if the controller was successfully freed.
142 * @retval SCI_FAILURE_CONTROLLER_NOT_FOUND if the supplied controller is
143 * not managed by the supplied library.
145 SCI_STATUS scif_library_free_controller(
146 SCI_LIBRARY_HANDLE_T library,
147 SCI_CONTROLLER_HANDLE_T controller
152 * @brief This method returns the SCI Core library handle
153 * associated with this library.
155 * @param[in] scif_library the handle to the library
156 * object for which to retrieve the core specific
159 * @return Return the SCI core library handle associated with
160 * the supplied framework library.
162 SCI_LIBRARY_HANDLE_T scif_library_get_scic_handle(
163 SCI_LIBRARY_HANDLE_T scif_library
168 * @brief This method returns the minimum number of timers needed. If the
169 * user supplies timers less then the number specified via this
170 * call, then the user runs the risk of improper operation. This
171 * call includes the minimum number of timers needed by the core.
173 * @return This method returns a value representing the minimum number of
174 * timers required by this framework implementation
176 U16 scif_library_get_min_timer_count(
181 * @brief This method returns the maximum number of timers that could
182 * be ever be in use by this component at a given time.
184 * @return This method returns a value representing the minimum number of
185 * timers required by this framework implementation
187 U16 scif_library_get_max_timer_count(
193 #endif // __cplusplus
195 #endif // _SCIF_LIBRARY_H_