xref: /freebsd/sys/dev/isci/scil/scif_user_callback.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1f11c7f63SJim Harris /*-
2718cf2ccSPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
3718cf2ccSPedro F. Giffuni  *
4f11c7f63SJim Harris  * This file is provided under a dual BSD/GPLv2 license.  When using or
5f11c7f63SJim Harris  * redistributing this file, you may do so under either license.
6f11c7f63SJim Harris  *
7f11c7f63SJim Harris  * GPL LICENSE SUMMARY
8f11c7f63SJim Harris  *
9f11c7f63SJim Harris  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
10f11c7f63SJim Harris  *
11f11c7f63SJim Harris  * This program is free software; you can redistribute it and/or modify
12f11c7f63SJim Harris  * it under the terms of version 2 of the GNU General Public License as
13f11c7f63SJim Harris  * published by the Free Software Foundation.
14f11c7f63SJim Harris  *
15f11c7f63SJim Harris  * This program is distributed in the hope that it will be useful, but
16f11c7f63SJim Harris  * WITHOUT ANY WARRANTY; without even the implied warranty of
17f11c7f63SJim Harris  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18f11c7f63SJim Harris  * General Public License for more details.
19f11c7f63SJim Harris  *
20f11c7f63SJim Harris  * You should have received a copy of the GNU General Public License
21f11c7f63SJim Harris  * along with this program; if not, write to the Free Software
22f11c7f63SJim Harris  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
23f11c7f63SJim Harris  * The full GNU General Public License is included in this distribution
24f11c7f63SJim Harris  * in the file called LICENSE.GPL.
25f11c7f63SJim Harris  *
26f11c7f63SJim Harris  * BSD LICENSE
27f11c7f63SJim Harris  *
28f11c7f63SJim Harris  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
29f11c7f63SJim Harris  * All rights reserved.
30f11c7f63SJim Harris  *
31f11c7f63SJim Harris  * Redistribution and use in source and binary forms, with or without
32f11c7f63SJim Harris  * modification, are permitted provided that the following conditions
33f11c7f63SJim Harris  * are met:
34f11c7f63SJim Harris  *
35f11c7f63SJim Harris  *   * Redistributions of source code must retain the above copyright
36f11c7f63SJim Harris  *     notice, this list of conditions and the following disclaimer.
37f11c7f63SJim Harris  *   * Redistributions in binary form must reproduce the above copyright
38f11c7f63SJim Harris  *     notice, this list of conditions and the following disclaimer in
39f11c7f63SJim Harris  *     the documentation and/or other materials provided with the
40f11c7f63SJim Harris  *     distribution.
41f11c7f63SJim Harris  *
42f11c7f63SJim Harris  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43f11c7f63SJim Harris  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44f11c7f63SJim Harris  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45f11c7f63SJim Harris  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46f11c7f63SJim Harris  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47f11c7f63SJim Harris  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48f11c7f63SJim Harris  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49f11c7f63SJim Harris  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50f11c7f63SJim Harris  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51f11c7f63SJim Harris  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52f11c7f63SJim Harris  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53f11c7f63SJim Harris  */
54f11c7f63SJim Harris #ifndef _SCIF_USER_CALLBACK_H_
55f11c7f63SJim Harris #define _SCIF_USER_CALLBACK_H_
56f11c7f63SJim Harris 
57f11c7f63SJim Harris /**
58f11c7f63SJim Harris  * @file
59f11c7f63SJim Harris  *
60f11c7f63SJim Harris  * @brief This file contains all of the interface methods/macros that must
61f11c7f63SJim Harris  *        be implemented by an SCI Framework user.
62f11c7f63SJim Harris  */
63f11c7f63SJim Harris 
64f11c7f63SJim Harris 
65f11c7f63SJim Harris #ifdef __cplusplus
66f11c7f63SJim Harris extern "C" {
67f11c7f63SJim Harris #endif // __cplusplus
68f11c7f63SJim Harris 
69f11c7f63SJim Harris #include <dev/isci/scil/sci_types.h>
70f11c7f63SJim Harris #include <dev/isci/scil/sci_status.h>
71f11c7f63SJim Harris #include <dev/isci/scil/sci_controller.h>
72f11c7f63SJim Harris #include <dev/isci/scil/intel_sas.h>
73f11c7f63SJim Harris #include <dev/isci/scil/sci_memory_descriptor_list.h>
74f11c7f63SJim Harris 
75f11c7f63SJim Harris 
76f11c7f63SJim Harris /**
77f11c7f63SJim Harris  * @brief This callback method asks the user to create a timer and provide
78f11c7f63SJim Harris  *        a handle for this timer for use in further timer interactions.
79f11c7f63SJim Harris  *
80f11c7f63SJim Harris  * @warning The "timer_callback" method should be executed in a mutually
81*2dfcc3a9SGordon Bergling  *          exclusive manner from the controller completion handler
82f11c7f63SJim Harris  *          handler (refer to scic_controller_get_handler_methods()).
83f11c7f63SJim Harris  *
84f11c7f63SJim Harris  * @param[in]  timer_callback This parameter specifies the callback method
85f11c7f63SJim Harris  *             to be invoked whenever the timer expires.
86f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller with
87f11c7f63SJim Harris  *             which this timer is to be associated.
88f11c7f63SJim Harris  * @param[in]  cookie This parameter specifies a piece of information that
89f11c7f63SJim Harris  *             the user must retain.  This cookie is to be supplied by the
90f11c7f63SJim Harris  *             user anytime a timeout occurs for the created timer.
91f11c7f63SJim Harris  *
92f11c7f63SJim Harris  * @return This method returns a handle to a timer object created by the
93f11c7f63SJim Harris  *         user.  The handle will be utilized for all further interactions
94f11c7f63SJim Harris  *         relating to this timer.
95f11c7f63SJim Harris  */
96f11c7f63SJim Harris void * scif_cb_timer_create(
97f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T   controller,
98f11c7f63SJim Harris    SCI_TIMER_CALLBACK_T      timer_callback,
99f11c7f63SJim Harris    void                    * cookie
100f11c7f63SJim Harris );
101f11c7f63SJim Harris 
102f11c7f63SJim Harris /**
103453130d9SPedro F. Giffuni  * @brief This callback method asks the user to destroy the supplied timer.
104f11c7f63SJim Harris  *
105f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller with
106f11c7f63SJim Harris  *             which this timer is to associated.
107f11c7f63SJim Harris  * @param[in]  timer This parameter specifies the timer to be destroyed.
108f11c7f63SJim Harris  *
109f11c7f63SJim Harris  * @return none
110f11c7f63SJim Harris  */
111f11c7f63SJim Harris void scif_cb_timer_destroy(
112f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T   controller,
113f11c7f63SJim Harris    void                    * timer
114f11c7f63SJim Harris );
115f11c7f63SJim Harris 
116f11c7f63SJim Harris /**
117f11c7f63SJim Harris  * @brief This callback method asks the user to start the supplied timer.
118f11c7f63SJim Harris  *
119f11c7f63SJim Harris  * @warning All timers in the system started by the SCI Framework are one
120f11c7f63SJim Harris  *          shot timers.  Therefore, the SCI user should make sure that it
121f11c7f63SJim Harris  *          removes the timer from it's list when a timer actually fires.
122f11c7f63SJim Harris  *          Additionally, SCI Framework user's should be able to handle
123f11c7f63SJim Harris  *          calls from the SCI Framework to stop a timer that may already
124f11c7f63SJim Harris  *          be stopped.
125f11c7f63SJim Harris  *
126f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller with
127f11c7f63SJim Harris  *             which this timer is to associated.
128f11c7f63SJim Harris  * @param[in]  timer This parameter specifies the timer to be started.
129f11c7f63SJim Harris  * @param[in]  milliseconds This parameter specifies the number of
130f11c7f63SJim Harris  *             milliseconds for which to stall.  The operating system driver
131f11c7f63SJim Harris  *             is allowed to round this value up where necessary.
132f11c7f63SJim Harris  *
133f11c7f63SJim Harris  * @return none
134f11c7f63SJim Harris  */
135f11c7f63SJim Harris void scif_cb_timer_start(
136f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T   controller,
137f11c7f63SJim Harris    void                    * timer,
138f11c7f63SJim Harris    U32                       milliseconds
139f11c7f63SJim Harris );
140f11c7f63SJim Harris 
141f11c7f63SJim Harris /**
142f11c7f63SJim Harris  * @brief This callback method asks the user to stop the supplied timer.
143f11c7f63SJim Harris  *
144f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller with
145f11c7f63SJim Harris  *             which this timer is to associated.
146f11c7f63SJim Harris  * @param[in]  timer This parameter specifies the timer to be stopped.
147f11c7f63SJim Harris  *
148f11c7f63SJim Harris  * @return none
149f11c7f63SJim Harris  */
150f11c7f63SJim Harris void scif_cb_timer_stop(
151f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T   controller,
152f11c7f63SJim Harris    void                    * timer
153f11c7f63SJim Harris );
154f11c7f63SJim Harris 
155f11c7f63SJim Harris /**
156f11c7f63SJim Harris  * @brief This callback method asks the user to associate the supplied
157f11c7f63SJim Harris  *        lock with an operating environment specific locking construct.
158f11c7f63SJim Harris  *
159f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller with
160f11c7f63SJim Harris  *             which this lock is to be associated.
161f11c7f63SJim Harris  * @param[in]  lock This parameter specifies the lock for which the
162f11c7f63SJim Harris  *             user should associate an operating environment specific
163f11c7f63SJim Harris  *             locking object.
164f11c7f63SJim Harris  *
165f11c7f63SJim Harris  * @see The SCI_LOCK_LEVEL enumeration for more information.
166f11c7f63SJim Harris  *
167f11c7f63SJim Harris  * @return none.
168f11c7f63SJim Harris  */
169f11c7f63SJim Harris void scif_cb_lock_associate(
170f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T   controller,
171f11c7f63SJim Harris    SCI_LOCK_HANDLE_T         lock
172f11c7f63SJim Harris );
173f11c7f63SJim Harris 
174f11c7f63SJim Harris /**
175f11c7f63SJim Harris  * @brief This callback method asks the user to de-associate the supplied
176f11c7f63SJim Harris  *        lock with an operating environment specific locking construct.
177f11c7f63SJim Harris  *
178f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller with
179f11c7f63SJim Harris  *             which this lock is to be de-associated.
180f11c7f63SJim Harris  * @param[in]  lock This parameter specifies the lock for which the
181f11c7f63SJim Harris  *             user should de-associate an operating environment specific
182f11c7f63SJim Harris  *             locking object.
183f11c7f63SJim Harris  *
184f11c7f63SJim Harris  * @see The SCI_LOCK_LEVEL enumeration for more information.
185f11c7f63SJim Harris  *
186f11c7f63SJim Harris  * @return none.
187f11c7f63SJim Harris  */
188f11c7f63SJim Harris void scif_cb_lock_disassociate(
189f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T   controller,
190f11c7f63SJim Harris    SCI_LOCK_HANDLE_T         lock
191f11c7f63SJim Harris );
192f11c7f63SJim Harris 
193f11c7f63SJim Harris 
194f11c7f63SJim Harris /**
195f11c7f63SJim Harris  * @brief This callback method asks the user to acquire/get the lock.
196f11c7f63SJim Harris  *        This method should pend until the lock has been acquired.
197f11c7f63SJim Harris  *
198f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller with
199f11c7f63SJim Harris  *             which this lock is associated.
200f11c7f63SJim Harris  * @param[in]  lock This parameter specifies the lock to be acquired.
201f11c7f63SJim Harris  *
202f11c7f63SJim Harris  * @return none
203f11c7f63SJim Harris  */
204f11c7f63SJim Harris void scif_cb_lock_acquire(
205f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T   controller,
206f11c7f63SJim Harris    SCI_LOCK_HANDLE_T         lock
207f11c7f63SJim Harris );
208f11c7f63SJim Harris 
209f11c7f63SJim Harris /**
210f11c7f63SJim Harris  * @brief This callback method asks the user to release a lock.
211f11c7f63SJim Harris  *
212f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller with
213f11c7f63SJim Harris  *             which this lock is associated.
214f11c7f63SJim Harris  * @param[in]  lock This parameter specifies the lock to be released.
215f11c7f63SJim Harris  *
216f11c7f63SJim Harris  * @return none
217f11c7f63SJim Harris  */
218f11c7f63SJim Harris void scif_cb_lock_release(
219f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T   controller,
220f11c7f63SJim Harris    SCI_LOCK_HANDLE_T         lock
221f11c7f63SJim Harris );
222f11c7f63SJim Harris 
223f11c7f63SJim Harris /**
224f11c7f63SJim Harris  * @brief This user callback will inform the user that the controller has
225f11c7f63SJim Harris  *        had a serious unexpected error.  The user should not the error,
226f11c7f63SJim Harris  *        disable interrupts, and wait for current ongoing processing to
227f11c7f63SJim Harris  *        complete.  Subsequently, the user should reset the controller.
228f11c7f63SJim Harris  *
229f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller that had
230f11c7f63SJim Harris  *             an error.
231f11c7f63SJim Harris  *
232f11c7f63SJim Harris  * @return none
233f11c7f63SJim Harris  */
234f11c7f63SJim Harris void scif_cb_controller_error(
235f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T  controller,
236f11c7f63SJim Harris    SCI_CONTROLLER_ERROR error
237f11c7f63SJim Harris );
238f11c7f63SJim Harris 
239f11c7f63SJim Harris /**
240f11c7f63SJim Harris  * @brief This user callback will inform the user that the controller has
241f11c7f63SJim Harris  *        finished the start process.
242f11c7f63SJim Harris  *
243f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller that was
244f11c7f63SJim Harris  *             started.
245f11c7f63SJim Harris  * @param[in]  completion_status This parameter specifies the results of
246f11c7f63SJim Harris  *             the start operation.  SCI_SUCCESS indicates successful
247f11c7f63SJim Harris  *             completion.
248f11c7f63SJim Harris  *
249f11c7f63SJim Harris  * @return none
250f11c7f63SJim Harris  */
251f11c7f63SJim Harris void scif_cb_controller_start_complete(
252f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T  controller,
253f11c7f63SJim Harris    SCI_STATUS               completion_status
254f11c7f63SJim Harris );
255f11c7f63SJim Harris 
256f11c7f63SJim Harris /**
257f11c7f63SJim Harris  * @brief This user callback will inform the user that the controller has
258f11c7f63SJim Harris  *        finished the stop process. Note, after user calls
259f11c7f63SJim Harris  *        scif_controller_stop(), before user receives this controller stop
260f11c7f63SJim Harris  *        complete callback, user should not expect any callback from
261f11c7f63SJim Harris  *        framework, such like scif_cb_domain_change_notification().
262f11c7f63SJim Harris  *
263f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller that was
264f11c7f63SJim Harris  *             stopped.
265f11c7f63SJim Harris  * @param[in]  completion_status This parameter specifies the results of
266f11c7f63SJim Harris  *             the stop operation.  SCI_SUCCESS indicates successful
267f11c7f63SJim Harris  *             completion.
268f11c7f63SJim Harris  *
269f11c7f63SJim Harris  * @return none
270f11c7f63SJim Harris  */
271f11c7f63SJim Harris void scif_cb_controller_stop_complete(
272f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T  controller,
273f11c7f63SJim Harris    SCI_STATUS               completion_status
274f11c7f63SJim Harris );
275f11c7f63SJim Harris 
276f11c7f63SJim Harris /**
277f11c7f63SJim Harris  * @brief This method simply returns the virtual address associated
278f11c7f63SJim Harris  *        with the scsi_io and byte_offset supplied parameters.
279f11c7f63SJim Harris  *
280f11c7f63SJim Harris  * @note This callback is not utilized in the fast path.  The expectation
281f11c7f63SJim Harris  *       is that this method is utilized for items such as SCSI to ATA
282f11c7f63SJim Harris  *       translation for commands like INQUIRY, READ CAPACITY, etc.
283f11c7f63SJim Harris  *
284f11c7f63SJim Harris  * @param[in] scif_user_io_request This parameter points to the user's
285f11c7f63SJim Harris  *            IO request object.  It is a cookie that allows the user to
286f11c7f63SJim Harris  *            provide the necessary information for this callback.
287f11c7f63SJim Harris  * @param[in] byte_offset This parameter specifies the offset into the data
288f11c7f63SJim Harris  *            buffers pointed to by the SGL.  The byte offset starts at 0
289f11c7f63SJim Harris  *            and continues until the last byte pointed to be the last SGL
290f11c7f63SJim Harris  *            element.
291f11c7f63SJim Harris  *
292f11c7f63SJim Harris  * @return A virtual address pointer to the location specified by the
293f11c7f63SJim Harris  *         parameters.
294f11c7f63SJim Harris  */
295f11c7f63SJim Harris U8 * scif_cb_io_request_get_virtual_address_from_sgl(
296f11c7f63SJim Harris    void * scif_user_io_request,
297f11c7f63SJim Harris    U32    byte_offset
298f11c7f63SJim Harris );
299f11c7f63SJim Harris 
300f11c7f63SJim Harris #ifdef ENABLE_OSSL_COPY_BUFFER
301f11c7f63SJim Harris /**
302f11c7f63SJim Harris  * @brief This method is presently utilized in the PIO path,
303f11c7f63SJim Harris  *        copies from UF buffer to the SGL buffer. This method
304f11c7f63SJim Harris  *        can be served for other OS related copies.
305f11c7f63SJim Harris  *
306f11c7f63SJim Harris  * @param[in] user_io_request. This parameter points to the user's
307f11c7f63SJim Harris  *            IO request object.  It is a cookie that allows the user to
308f11c7f63SJim Harris  *            provide the necessary information for this callback.
309f11c7f63SJim Harris  * @param[in] source addr. Address of UF buffer.
310f11c7f63SJim Harris  * @param[in] offset. This parameter specifies the offset into the data
311f11c7f63SJim Harris  *            buffers pointed to by the SGL.  The byte offset starts at 0
312f11c7f63SJim Harris  *            and continues until the last byte pointed to be the last SGL
313f11c7f63SJim Harris  *            element.
314f11c7f63SJim Harris  * @param[in] length.
315f11c7f63SJim Harris  *
316f11c7f63SJim Harris  * @return    None
317f11c7f63SJim Harris  */
318f11c7f63SJim Harris void scif_cb_io_request_copy_buffer(
319f11c7f63SJim Harris    void * scic_user_io_request,
320f11c7f63SJim Harris    U8   *source_addr,
321f11c7f63SJim Harris    U32   offset,
322f11c7f63SJim Harris    U32   length
323f11c7f63SJim Harris );
324f11c7f63SJim Harris #endif
325f11c7f63SJim Harris 
326f11c7f63SJim Harris /**
327f11c7f63SJim Harris  * @brief This user callback will inform the user that an IO request has
328f11c7f63SJim Harris  *        completed.
329f11c7f63SJim Harris  *
330f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller on
331f11c7f63SJim Harris  *             which the IO request is completing.
332f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device on
333f11c7f63SJim Harris  *             which this request is completing.
334f11c7f63SJim Harris  * @param[in]  io_request This parameter specifies the IO request that has
335f11c7f63SJim Harris  *             completed.
336f11c7f63SJim Harris  * @param[in]  completion_status This parameter specifies the results of
337f11c7f63SJim Harris  *             the IO request operation.  SCI_IO_SUCCESS indicates
338f11c7f63SJim Harris  *             successful completion.
339f11c7f63SJim Harris  *
340f11c7f63SJim Harris  * @return none
341f11c7f63SJim Harris  */
342f11c7f63SJim Harris void scif_cb_io_request_complete(
343f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T     controller,
344f11c7f63SJim Harris    SCI_REMOTE_DEVICE_HANDLE_T  remote_device,
345f11c7f63SJim Harris    SCI_IO_REQUEST_HANDLE_T     io_request,
346f11c7f63SJim Harris    SCI_IO_STATUS               completion_status
347f11c7f63SJim Harris );
348f11c7f63SJim Harris 
349f11c7f63SJim Harris /**
350f11c7f63SJim Harris  * @brief This user callback will inform the user that a task management
351f11c7f63SJim Harris  *        request completed.
352f11c7f63SJim Harris  *
353f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller on
354f11c7f63SJim Harris  *             which the task management request is completing.
355f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the remote device on
356f11c7f63SJim Harris  *             which this task management request is completing.
357f11c7f63SJim Harris  * @param[in]  task_request This parameter specifies the task management
358f11c7f63SJim Harris  *             request that has completed.
359f11c7f63SJim Harris  * @param[in]  completion_status This parameter specifies the results of
360f11c7f63SJim Harris  *             the IO request operation.  SCI_TASK_SUCCESS indicates
361f11c7f63SJim Harris  *             successful completion.
362f11c7f63SJim Harris  *
363f11c7f63SJim Harris  * @return none
364f11c7f63SJim Harris  */
365f11c7f63SJim Harris void scif_cb_task_request_complete(
366f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T     controller,
367f11c7f63SJim Harris    SCI_REMOTE_DEVICE_HANDLE_T  remote_device,
368f11c7f63SJim Harris    SCI_TASK_REQUEST_HANDLE_T   task_request,
369f11c7f63SJim Harris    SCI_TASK_STATUS             completion_status
370f11c7f63SJim Harris );
371f11c7f63SJim Harris 
372f11c7f63SJim Harris /**
373f11c7f63SJim Harris  * @brief This callback method asks the user to provide the number of
374453130d9SPedro F. Giffuni  *        bytes to be transferred as part of this request.
375f11c7f63SJim Harris  *
376f11c7f63SJim Harris  * @param[in] scif_user_io_request This parameter points to the user's
377f11c7f63SJim Harris  *            IO request object.  It is a cookie that allows the user to
378f11c7f63SJim Harris  *            provide the necessary information for this callback.
379f11c7f63SJim Harris  *
380f11c7f63SJim Harris  * @return This method returns the number of payload data bytes to be
381453130d9SPedro F. Giffuni  *         transferred for this IO request.
382f11c7f63SJim Harris  */
383f11c7f63SJim Harris U32 scif_cb_io_request_get_transfer_length(
384f11c7f63SJim Harris    void * scif_user_io_request
385f11c7f63SJim Harris );
386f11c7f63SJim Harris 
387f11c7f63SJim Harris /**
388f11c7f63SJim Harris  * @brief This callback method asks the user to provide the data direction
389f11c7f63SJim Harris  *        for this request.
390f11c7f63SJim Harris  *
391f11c7f63SJim Harris  * @param[in] scif_user_io_request This parameter points to the user's
392f11c7f63SJim Harris  *            IO request object.  It is a cookie that allows the user to
393f11c7f63SJim Harris  *            provide the necessary information for this callback.
394f11c7f63SJim Harris  *
395f11c7f63SJim Harris  * @return This method returns the value of SCI_IO_REQUEST_DATA_OUT,
396f11c7f63SJim Harris  *         SCI_IO_REQUEST_DATA_IN, or SCI_IO_REQUEST_NO_DATA.
397f11c7f63SJim Harris  */
398f11c7f63SJim Harris SCI_IO_REQUEST_DATA_DIRECTION scif_cb_io_request_get_data_direction(
399f11c7f63SJim Harris    void * scif_user_io_request
400f11c7f63SJim Harris );
401f11c7f63SJim Harris 
402f11c7f63SJim Harris #ifndef SCI_SGL_OPTIMIZATION_ENABLED
403f11c7f63SJim Harris /**
404f11c7f63SJim Harris  * @brief This callback method asks the user to provide the address
405f11c7f63SJim Harris  *        to where the next Scatter-Gather Element is located.
406f11c7f63SJim Harris  *
407f11c7f63SJim Harris  * Details regarding usage:
408f11c7f63SJim Harris  *   - Regarding the first SGE: the user should initialize an index,
409f11c7f63SJim Harris  *     or a pointer, prior to construction of the request that will
410f11c7f63SJim Harris  *     reference the very first scatter-gather element.  This is
411f11c7f63SJim Harris  *     important since this method is called for every scatter-gather
412f11c7f63SJim Harris  *     element, including the first element.
413f11c7f63SJim Harris  *   - Regarding the last SGE: the user should return NULL from this
414f11c7f63SJim Harris  *     method when this method is called and the SGL has exhausted
415f11c7f63SJim Harris  *     all elements.
416f11c7f63SJim Harris  *
417f11c7f63SJim Harris  * @param[in] scif_user_io_request This parameter points to the user's
418f11c7f63SJim Harris  *            IO request object.  It is a cookie that allows the user to
419f11c7f63SJim Harris  *            provide the necessary information for this callback.
420f11c7f63SJim Harris  * @param[in] current_sge_address This parameter specifies the address for
421f11c7f63SJim Harris  *            the current SGE (i.e. the one that has just processed).
422f11c7f63SJim Harris  * @param[out] next_sge An address specifying the location for the next scatter
423f11c7f63SJim Harris  *         gather element to be processed.
424f11c7f63SJim Harris  *
425f11c7f63SJim Harris  * @return None.
426f11c7f63SJim Harris  */
427f11c7f63SJim Harris void scif_cb_io_request_get_next_sge(
428f11c7f63SJim Harris    void * scif_user_io_request,
429f11c7f63SJim Harris    void * current_sge_address,
430f11c7f63SJim Harris    void ** next_sge
431f11c7f63SJim Harris );
432f11c7f63SJim Harris #endif
433f11c7f63SJim Harris 
434f11c7f63SJim Harris /**
435f11c7f63SJim Harris  * @brief This callback method asks the user to provide the contents of the
436f11c7f63SJim Harris  *        "address" field in the Scatter-Gather Element.
437f11c7f63SJim Harris  *
438f11c7f63SJim Harris  * @param[in] scif_user_io_request This parameter points to the user's
439f11c7f63SJim Harris  *            IO request object.  It is a cookie that allows the user to
440f11c7f63SJim Harris  *            provide the necessary information for this callback.
441f11c7f63SJim Harris  * @param[in] sge_address This parameter specifies the address for the
442f11c7f63SJim Harris  *            SGE from which to retrieve the address field.
443f11c7f63SJim Harris  *
444f11c7f63SJim Harris  * @return A physical address specifying the contents of the SGE's address
445f11c7f63SJim Harris  *         field.
446f11c7f63SJim Harris  */
447f11c7f63SJim Harris SCI_PHYSICAL_ADDRESS scif_cb_sge_get_address_field(
448f11c7f63SJim Harris    void * scif_user_io_request,
449f11c7f63SJim Harris    void * sge_address
450f11c7f63SJim Harris );
451f11c7f63SJim Harris 
452f11c7f63SJim Harris /**
453f11c7f63SJim Harris  * @brief This callback method asks the user to provide the contents of the
454f11c7f63SJim Harris  *        "length" field in the Scatter-Gather Element.
455f11c7f63SJim Harris  *
456f11c7f63SJim Harris  * @param[in] scif_user_io_request This parameter points to the user's
457f11c7f63SJim Harris  *            IO request object.  It is a cookie that allows the user to
458f11c7f63SJim Harris  *            provide the necessary information for this callback.
459f11c7f63SJim Harris  * @param[in] sge_address This parameter specifies the address for the
460f11c7f63SJim Harris  *            SGE from which to retrieve the address field.
461f11c7f63SJim Harris  *
462f11c7f63SJim Harris  * @return This method returns the length field specified inside the SGE
463f11c7f63SJim Harris  *         referenced by the sge_address parameter.
464f11c7f63SJim Harris  */
465f11c7f63SJim Harris U32 scif_cb_sge_get_length_field(
466f11c7f63SJim Harris    void * scif_user_io_request,
467f11c7f63SJim Harris    void * sge_address
468f11c7f63SJim Harris );
469f11c7f63SJim Harris 
470f11c7f63SJim Harris /**
471f11c7f63SJim Harris  * @brief This callback method asks the user to provide the address for
472f11c7f63SJim Harris  *        the command descriptor block (CDB) associated with this IO request.
473f11c7f63SJim Harris  *
474f11c7f63SJim Harris  * @param[in] scif_user_io_request This parameter points to the user's
475f11c7f63SJim Harris  *            IO request object.  It is a cookie that allows the user to
476f11c7f63SJim Harris  *            provide the necessary information for this callback.
477f11c7f63SJim Harris  *
478f11c7f63SJim Harris  * @return This method returns the virtual address of the CDB.
479f11c7f63SJim Harris  */
480f11c7f63SJim Harris void * scif_cb_io_request_get_cdb_address(
481f11c7f63SJim Harris    void * scif_user_io_request
482f11c7f63SJim Harris );
483f11c7f63SJim Harris 
484f11c7f63SJim Harris /**
485f11c7f63SJim Harris  * @brief This callback method asks the user to provide the length of
486f11c7f63SJim Harris  *        the command descriptor block (CDB) associated with this IO request.
487f11c7f63SJim Harris  *
488f11c7f63SJim Harris  * @param[in] scif_user_io_request This parameter points to the user's
489f11c7f63SJim Harris  *            IO request object.  It is a cookie that allows the user to
490f11c7f63SJim Harris  *            provide the necessary information for this callback.
491f11c7f63SJim Harris  *
492f11c7f63SJim Harris  * @return This method returns the length of the CDB.
493f11c7f63SJim Harris  */
494f11c7f63SJim Harris U32 scif_cb_io_request_get_cdb_length(
495f11c7f63SJim Harris    void * scif_user_io_request
496f11c7f63SJim Harris );
497f11c7f63SJim Harris 
498f11c7f63SJim Harris /**
499f11c7f63SJim Harris  * @brief This callback method asks the user to provide the Logical Unit (LUN)
500f11c7f63SJim Harris  *        associated with this IO request.
501f11c7f63SJim Harris  *
502f11c7f63SJim Harris  * @note The contents of the value returned from this callback are defined
503f11c7f63SJim Harris  *       by the protocol standard (e.g. T10 SAS specification).  Please
504f11c7f63SJim Harris  *       refer to the transport command information unit description
505f11c7f63SJim Harris  *       in the associated standard.
506f11c7f63SJim Harris  *
507f11c7f63SJim Harris  * @param[in] scif_user_io_request This parameter points to the user's
508f11c7f63SJim Harris  *            IO request object.  It is a cookie that allows the user to
509f11c7f63SJim Harris  *            provide the necessary information for this callback.
510f11c7f63SJim Harris  *
511f11c7f63SJim Harris  * @return This method returns the LUN associated with this request.
512f11c7f63SJim Harris  */
513f11c7f63SJim Harris U32 scif_cb_io_request_get_lun(
514f11c7f63SJim Harris    void * scif_user_io_request
515f11c7f63SJim Harris );
516f11c7f63SJim Harris 
517f11c7f63SJim Harris /**
518f11c7f63SJim Harris  * @brief This callback method asks the user to provide the task attribute
519f11c7f63SJim Harris  *        associated with this IO request.
520f11c7f63SJim Harris  *
521f11c7f63SJim Harris  * @note The contents of the value returned from this callback are defined
522f11c7f63SJim Harris  *       by the protocol standard (e.g. T10 SAS specification).  Please
523f11c7f63SJim Harris  *       refer to the transport command information unit description
524f11c7f63SJim Harris  *       in the associated standard.
525f11c7f63SJim Harris  *
526f11c7f63SJim Harris  * @param[in] scif_user_io_request This parameter points to the user's
527f11c7f63SJim Harris  *            IO request object.  It is a cookie that allows the user to
528f11c7f63SJim Harris  *            provide the necessary information for this callback.
529f11c7f63SJim Harris  *
530f11c7f63SJim Harris  * @return This method returns the task attribute associated with this
531f11c7f63SJim Harris  *         IO request.
532f11c7f63SJim Harris  */
533f11c7f63SJim Harris U32 scif_cb_io_request_get_task_attribute(
534f11c7f63SJim Harris    void * scif_user_io_request
535f11c7f63SJim Harris );
536f11c7f63SJim Harris 
537f11c7f63SJim Harris /**
538f11c7f63SJim Harris  * @brief This callback method asks the user to provide the command priority
539f11c7f63SJim Harris  *        associated with this IO request.
540f11c7f63SJim Harris  *
541f11c7f63SJim Harris  * @note The contents of the value returned from this callback are defined
542f11c7f63SJim Harris  *       by the protocol standard (e.g. T10 SAS specification).  Please
543f11c7f63SJim Harris  *       refer to the transport command information unit description
544f11c7f63SJim Harris  *       in the associated standard.
545f11c7f63SJim Harris  *
546f11c7f63SJim Harris  * @param[in] scif_user_io_request This parameter points to the user's
547f11c7f63SJim Harris  *            IO request object.  It is a cookie that allows the user to
548f11c7f63SJim Harris  *            provide the necessary information for this callback.
549f11c7f63SJim Harris  *
550f11c7f63SJim Harris  * @return This method returns the command priority associated with this
551f11c7f63SJim Harris  *         IO request.
552f11c7f63SJim Harris  */
553f11c7f63SJim Harris U32 scif_cb_io_request_get_command_priority(
554f11c7f63SJim Harris    void * scif_user_io_request
555f11c7f63SJim Harris );
556f11c7f63SJim Harris 
557f11c7f63SJim Harris /**
558f11c7f63SJim Harris  * @brief This method returns the Logical Unit to be utilized for this
559f11c7f63SJim Harris  *        task management request.
560f11c7f63SJim Harris  *
561f11c7f63SJim Harris  * @note The contents of the value returned from this callback are defined
562f11c7f63SJim Harris  *       by the protocol standard (e.g. T10 SAS specification).  Please
563f11c7f63SJim Harris  *       refer to the transport task information unit description
564f11c7f63SJim Harris  *       in the associated standard.
565f11c7f63SJim Harris  *
566f11c7f63SJim Harris  * @param[in] scif_user_task_request This parameter points to the user's
567f11c7f63SJim Harris  *            task request object.  It is a cookie that allows the user to
568f11c7f63SJim Harris  *            provide the necessary information for this callback.
569f11c7f63SJim Harris  *
570f11c7f63SJim Harris  * @return This method returns the LUN associated with this request.
571f11c7f63SJim Harris  * @todo This should be U64?
572f11c7f63SJim Harris  */
573f11c7f63SJim Harris U32 scif_cb_task_request_get_lun(
574f11c7f63SJim Harris    void * scif_user_task_request
575f11c7f63SJim Harris );
576f11c7f63SJim Harris 
577f11c7f63SJim Harris /**
578f11c7f63SJim Harris  * @brief This method returns the task management function to be utilized
579f11c7f63SJim Harris  *        for this task request.
580f11c7f63SJim Harris  *
581f11c7f63SJim Harris  * @note The contents of the value returned from this callback are defined
582f11c7f63SJim Harris  *       by the protocol standard (e.g. T10 SAS specification).  Please
583f11c7f63SJim Harris  *       refer to the transport task information unit description
584f11c7f63SJim Harris  *       in the associated standard.
585f11c7f63SJim Harris  *
586f11c7f63SJim Harris  * @param[in] scif_user_task_request This parameter points to the user's
587f11c7f63SJim Harris  *            task request object.  It is a cookie that allows the user to
588f11c7f63SJim Harris  *            provide the necessary information for this callback.
589f11c7f63SJim Harris  *
590f11c7f63SJim Harris  * @return This method returns an unsigned byte representing the task
591f11c7f63SJim Harris  *         management function to be performed.
592f11c7f63SJim Harris  */
593f11c7f63SJim Harris U8 scif_cb_task_request_get_function(
594f11c7f63SJim Harris    void * scif_user_task_request
595f11c7f63SJim Harris );
596f11c7f63SJim Harris 
597f11c7f63SJim Harris /**
598f11c7f63SJim Harris  * @brief This method returns the task management IO tag to be managed.
599f11c7f63SJim Harris  *        Depending upon the task management function the value returned
600f11c7f63SJim Harris  *        from this method may be ignored.
601f11c7f63SJim Harris  *
602f11c7f63SJim Harris  * @param[in] scif_user_task_request This parameter points to the user's
603f11c7f63SJim Harris  *            task request object.  It is a cookie that allows the user to
604f11c7f63SJim Harris  *            provide the necessary information for this callback.
605f11c7f63SJim Harris  *
606f11c7f63SJim Harris  * @return This method returns an unsigned 16-bit word depicting the IO
607f11c7f63SJim Harris  *         tag to be managed.
608f11c7f63SJim Harris  */
609f11c7f63SJim Harris U16 scif_cb_task_request_get_io_tag_to_manage(
610f11c7f63SJim Harris    void * scif_user_task_request
611f11c7f63SJim Harris );
612f11c7f63SJim Harris 
613f11c7f63SJim Harris /**
614f11c7f63SJim Harris  * @brief This callback method asks the user to provide the virtual
615f11c7f63SJim Harris  *        address of the response data buffer for the supplied IO request.
616f11c7f63SJim Harris  *
617f11c7f63SJim Harris  * @param[in] scif_user_task_request This parameter points to the user's
618f11c7f63SJim Harris  *            task request object.  It is a cookie that allows the user to
619f11c7f63SJim Harris  *            provide the necessary information for this callback.
620f11c7f63SJim Harris  *
621f11c7f63SJim Harris  * @return This method returns the virtual address for the response data buffer
622f11c7f63SJim Harris  *         associated with this IO request.
623f11c7f63SJim Harris  */
624f11c7f63SJim Harris void * scif_cb_task_request_get_response_data_address(
625f11c7f63SJim Harris    void * scif_user_task_request
626f11c7f63SJim Harris );
627f11c7f63SJim Harris 
628f11c7f63SJim Harris /**
629f11c7f63SJim Harris  * @brief This callback method asks the user to provide the length of the
630f11c7f63SJim Harris  *        response data buffer for the supplied IO request.
631f11c7f63SJim Harris  *
632f11c7f63SJim Harris  * @param[in] scif_user_task_request This parameter points to the user's
633f11c7f63SJim Harris  *            task request object.  It is a cookie that allows the user to
634f11c7f63SJim Harris  *            provide the necessary information for this callback.
635f11c7f63SJim Harris  *
636f11c7f63SJim Harris  * @return This method returns the length of the response buffer data
637f11c7f63SJim Harris  *         associated with this IO request.
638f11c7f63SJim Harris  */
639f11c7f63SJim Harris U32 scif_cb_task_request_get_response_data_length(
640f11c7f63SJim Harris    void * scif_user_task_request
641f11c7f63SJim Harris );
642f11c7f63SJim Harris 
643f11c7f63SJim Harris /**
644f11c7f63SJim Harris  * @brief In this method the user is expected to log the supplied
645f11c7f63SJim Harris  *        error information.  The user must be capable of handling variable
646f11c7f63SJim Harris  *        length argument lists and should consider prepending the fact
647f11c7f63SJim Harris  *        that this is an error from the framework.
648f11c7f63SJim Harris  *
649f11c7f63SJim Harris  * @param[in]  logger_object This parameter specifies the logger object
650f11c7f63SJim Harris  *             associated with this message.
651f11c7f63SJim Harris  * @param[in]  log_object_mask This parameter specifies the log objects
652f11c7f63SJim Harris  *             for which this message is being generated.
653f11c7f63SJim Harris  * @param[in]  log_message This parameter specifies the message to be logged.
654f11c7f63SJim Harris  *
655f11c7f63SJim Harris  * @return none
656f11c7f63SJim Harris  */
657f11c7f63SJim Harris void scif_cb_logger_log_error(
658f11c7f63SJim Harris    SCI_LOGGER_HANDLE_T   logger_object,
659f11c7f63SJim Harris    U32                   log_object_mask,
660f11c7f63SJim Harris    char                * log_message,
661f11c7f63SJim Harris    ...
662f11c7f63SJim Harris );
663f11c7f63SJim Harris 
664f11c7f63SJim Harris /**
665f11c7f63SJim Harris  * @brief In this method the user is expected to log the supplied warning
666f11c7f63SJim Harris  *        information.  The user must be capable of handling variable
667f11c7f63SJim Harris  *        length argument lists and should consider prepending the fact
668f11c7f63SJim Harris  *        that this is a warning from the framework.
669f11c7f63SJim Harris  *
670f11c7f63SJim Harris  * @param[in]  logger_object This parameter specifies the logger object
671f11c7f63SJim Harris  *             associated with this message.
672f11c7f63SJim Harris  * @param[in]  log_object_mask This parameter specifies the log objects
673f11c7f63SJim Harris  *             for which this message is being generated.
674f11c7f63SJim Harris  * @param[in]  log_message This parameter specifies the message to be logged.
675f11c7f63SJim Harris  *
676f11c7f63SJim Harris  * @return none
677f11c7f63SJim Harris  */
678f11c7f63SJim Harris void scif_cb_logger_log_warning(
679f11c7f63SJim Harris    SCI_LOGGER_HANDLE_T   logger_object,
680f11c7f63SJim Harris    U32                   log_object_mask,
681f11c7f63SJim Harris    char                * log_message,
682f11c7f63SJim Harris    ...
683f11c7f63SJim Harris );
684f11c7f63SJim Harris 
685f11c7f63SJim Harris /**
686f11c7f63SJim Harris  * @brief In this method the user is expected to log the supplied debug
687f11c7f63SJim Harris  *        information.  The user must be capable of handling variable
688f11c7f63SJim Harris  *        length argument lists and should consider prepending the fact
689f11c7f63SJim Harris  *        that this is a debug message from the framework.
690f11c7f63SJim Harris  *
691f11c7f63SJim Harris  * @param[in]  logger_object This parameter specifies the logger object
692f11c7f63SJim Harris  *             associated with this message.
693f11c7f63SJim Harris  * @param[in]  log_object_mask This parameter specifies the log objects
694f11c7f63SJim Harris  *             for which this message is being generated.
695f11c7f63SJim Harris  * @param[in]  log_message This parameter specifies the message to be logged.
696f11c7f63SJim Harris  *
697f11c7f63SJim Harris  * @return none
698f11c7f63SJim Harris  */
699f11c7f63SJim Harris void scif_cb_logger_log_info(
700f11c7f63SJim Harris    SCI_LOGGER_HANDLE_T   logger_object,
701f11c7f63SJim Harris    U32                   log_object_mask,
702f11c7f63SJim Harris    char                * log_message,
703f11c7f63SJim Harris    ...
704f11c7f63SJim Harris );
705f11c7f63SJim Harris 
706f11c7f63SJim Harris 
707f11c7f63SJim Harris /**
708f11c7f63SJim Harris  * @brief In this method the user is expected to log the supplied function
709f11c7f63SJim Harris  *        trace information.  The user must be capable of handling variable
710f11c7f63SJim Harris  *        length argument lists and should consider prepending the fact
711f11c7f63SJim Harris  *        that this is a function trace (i.e. entry/exit) message from the
712f11c7f63SJim Harris  *        framework.
713f11c7f63SJim Harris  *
714f11c7f63SJim Harris  * @param[in]  logger_object This parameter specifies the logger object
715f11c7f63SJim Harris  *             associated with this message.
716f11c7f63SJim Harris  * @param[in]  log_object_mask This parameter specifies the log objects
717f11c7f63SJim Harris  *             for which this message is being generated.
718f11c7f63SJim Harris  * @param[in]  log_message This parameter specifies the message to be logged.
719f11c7f63SJim Harris  *
720f11c7f63SJim Harris  * @return none
721f11c7f63SJim Harris  */
722f11c7f63SJim Harris void scif_cb_logger_log_trace(
723f11c7f63SJim Harris    SCI_LOGGER_HANDLE_T   logger_object,
724f11c7f63SJim Harris    U32                   log_object_mask,
725f11c7f63SJim Harris    char                * log_message,
726f11c7f63SJim Harris    ...
727f11c7f63SJim Harris );
728f11c7f63SJim Harris 
729f11c7f63SJim Harris 
730f11c7f63SJim Harris /**
731f11c7f63SJim Harris  * @brief In this method the user is expected to log the supplied state
732f11c7f63SJim Harris  *        transition information.  The user must be capable of handling
733f11c7f63SJim Harris  *        variable length argument lists and should consider prepending the
734f11c7f63SJim Harris  *        fact that this is an error from the framework.
735f11c7f63SJim Harris  *
736f11c7f63SJim Harris  * @param[in]  logger_object This parameter specifies the logger object
737f11c7f63SJim Harris  *             associated with this message.
738f11c7f63SJim Harris  * @param[in]  log_object_mask This parameter specifies the log objects
739f11c7f63SJim Harris  *             for which this message is being generated.
740f11c7f63SJim Harris  * @param[in]  log_message This parameter specifies the message to be logged.
741f11c7f63SJim Harris  *
742f11c7f63SJim Harris  * @return none
743f11c7f63SJim Harris  */
744f11c7f63SJim Harris void scif_cb_logger_log_states(
745f11c7f63SJim Harris    SCI_LOGGER_HANDLE_T   logger_object,
746f11c7f63SJim Harris    U32                   log_object_mask,
747f11c7f63SJim Harris    char                * log_message,
748f11c7f63SJim Harris    ...
749f11c7f63SJim Harris );
750f11c7f63SJim Harris 
751f11c7f63SJim Harris 
752f11c7f63SJim Harris /**
753f11c7f63SJim Harris  * @brief This callback method informs the framework user that something
754f11c7f63SJim Harris  *        in the supplied domain has changed (e.g. a device was added or
755f11c7f63SJim Harris  *        removed).
756f11c7f63SJim Harris  *
757f11c7f63SJim Harris  * This callback is called by the framework outside of discovery or
758f11c7f63SJim Harris  * target reset processes.  Specifically, domain changes occurring
759f11c7f63SJim Harris  * during these processes are handled by the framework.  For example,
760f11c7f63SJim Harris  * in the case of Serial Attached SCSI, reception of a BROADCAST (CHANGE)
761f11c7f63SJim Harris  * during discovery will cause discovery to restart.  Thus, discovery
762f11c7f63SJim Harris  * does not complete until all BCNs are processed. Note, during controller
763f11c7f63SJim Harris  * stopping/reset process, the framework user should not expect this call
764f11c7f63SJim Harris  * back.
765f11c7f63SJim Harris  *
766f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller object
767f11c7f63SJim Harris  *             with which this callback is associated.
768f11c7f63SJim Harris  * @param[in]  domain This parameter specifies the domain object with
769f11c7f63SJim Harris  *             which this callback is associated.
770f11c7f63SJim Harris  *
771f11c7f63SJim Harris  * @return none
772f11c7f63SJim Harris  */
773f11c7f63SJim Harris void scif_cb_domain_change_notification(
774f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T  controller,
775f11c7f63SJim Harris    SCI_DOMAIN_HANDLE_T      domain
776f11c7f63SJim Harris );
777f11c7f63SJim Harris 
778f11c7f63SJim Harris 
779f11c7f63SJim Harris /**
780f11c7f63SJim Harris  * @brief This callback method informs the framework user that a previously
781f11c7f63SJim Harris  *        requested discovery operation on the domain has completed.
782f11c7f63SJim Harris  *
783f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller object
784f11c7f63SJim Harris  *             with which this callback is associated.
785f11c7f63SJim Harris  * @param[in]  domain This parameter specifies the domain object with
786f11c7f63SJim Harris  *             which this callback is associated.
787f11c7f63SJim Harris  * @param[in]  completion_status This parameter indicates the results of the
788f11c7f63SJim Harris  *             discovery operation.
789f11c7f63SJim Harris  *
790f11c7f63SJim Harris  * @return none
791f11c7f63SJim Harris  */
792f11c7f63SJim Harris void scif_cb_domain_discovery_complete(
793f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T  controller,
794f11c7f63SJim Harris    SCI_DOMAIN_HANDLE_T      domain,
795f11c7f63SJim Harris    SCI_STATUS               completion_status
796f11c7f63SJim Harris );
797f11c7f63SJim Harris 
798f11c7f63SJim Harris /**
799f11c7f63SJim Harris  * @brief This callback method informs the framework user that a previously
800f11c7f63SJim Harris  *        requested reset operation on the domain has completed.
801f11c7f63SJim Harris  *
802f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller object
803f11c7f63SJim Harris  *             with which this callback is associated.
804f11c7f63SJim Harris  * @param[in]  domain This parameter specifies the domain object with
805f11c7f63SJim Harris  *             which this callback is associated.
806f11c7f63SJim Harris  * @param[in]  completion_status This parameter indicates the results of the
807f11c7f63SJim Harris  *             reset operation.
808f11c7f63SJim Harris  *
809f11c7f63SJim Harris  * @return none
810f11c7f63SJim Harris  */
811f11c7f63SJim Harris void scif_cb_domain_reset_complete(
812f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T  controller,
813f11c7f63SJim Harris    SCI_DOMAIN_HANDLE_T      domain,
814f11c7f63SJim Harris    SCI_STATUS               completion_status
815f11c7f63SJim Harris );
816f11c7f63SJim Harris 
817f11c7f63SJim Harris /**
818f11c7f63SJim Harris  * @brief This callback method informs the framework user that the domain
819f11c7f63SJim Harris  *        is ready and capable of processing IO requests for devices found
820f11c7f63SJim Harris  *        inside it.
821f11c7f63SJim Harris  *
822f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller object
823f11c7f63SJim Harris  *             with which this callback is associated.
824f11c7f63SJim Harris  * @param[in]  domain This parameter specifies the domain object with
825f11c7f63SJim Harris  *             which this callback is associated.
826f11c7f63SJim Harris  *
827f11c7f63SJim Harris  * @return none
828f11c7f63SJim Harris  */
829f11c7f63SJim Harris void scif_cb_domain_ready(
830f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T  controller,
831f11c7f63SJim Harris    SCI_DOMAIN_HANDLE_T      domain
832f11c7f63SJim Harris );
833f11c7f63SJim Harris 
834f11c7f63SJim Harris /**
835f11c7f63SJim Harris  * @brief This callback method informs the framework user that the domain
836f11c7f63SJim Harris  *        is no longer ready. Thus, it is incapable of processing IO
837f11c7f63SJim Harris  *        requests for devices found inside it.
838f11c7f63SJim Harris  *
839f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller object
840f11c7f63SJim Harris  *             with which this callback is associated.
841f11c7f63SJim Harris  * @param[in]  domain This parameter specifies the domain object with
842f11c7f63SJim Harris  *             which this callback is associated.
843f11c7f63SJim Harris  *
844f11c7f63SJim Harris  * @return none
845f11c7f63SJim Harris  */
846f11c7f63SJim Harris void scif_cb_domain_not_ready(
847f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T  controller,
848f11c7f63SJim Harris    SCI_DOMAIN_HANDLE_T      domain
849f11c7f63SJim Harris );
850f11c7f63SJim Harris 
851f11c7f63SJim Harris /**
852f11c7f63SJim Harris  * @brief This callback method informs the framework user that a new
853f11c7f63SJim Harris  *        direct attached device was found in the domain.
854f11c7f63SJim Harris  *
855f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller object
856f11c7f63SJim Harris  *             with which this callback is associated.
857f11c7f63SJim Harris  * @param[in]  domain This parameter specifies the domain object with
858f11c7f63SJim Harris  *             which this callback is associated.
859f11c7f63SJim Harris  * @param[in]  sas_address This parameter specifies the SAS address of
860f11c7f63SJim Harris  *             the new device.
861f11c7f63SJim Harris  * @param[in]  protocols This parameter specifies the protocols
862f11c7f63SJim Harris  *             supported by the newly discovered device.
863f11c7f63SJim Harris  *
864f11c7f63SJim Harris  * @return none
865f11c7f63SJim Harris  */
866f11c7f63SJim Harris void scif_cb_domain_da_device_added(
867f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T                      controller,
868f11c7f63SJim Harris    SCI_DOMAIN_HANDLE_T                          domain,
869f11c7f63SJim Harris    SCI_SAS_ADDRESS_T                          * sas_address,
870f11c7f63SJim Harris    SCI_SAS_IDENTIFY_ADDRESS_FRAME_PROTOCOLS_T * protocols
871f11c7f63SJim Harris );
872f11c7f63SJim Harris 
873f11c7f63SJim Harris /**
874f11c7f63SJim Harris  * @brief This callback method informs the framework user that a new
875f11c7f63SJim Harris  *        expander attached device was found in the domain.
876f11c7f63SJim Harris  *
877f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller object
878f11c7f63SJim Harris  *             with which this callback is associated.
879f11c7f63SJim Harris  * @param[in]  domain This parameter specifies the domain object with
880f11c7f63SJim Harris  *             which this callback is associated.
881f11c7f63SJim Harris  * @param[in]  containing_device This parameter specifies the remote
882f11c7f63SJim Harris  *             device that contains the device that was added.
883f11c7f63SJim Harris  * @param[in]  smp_response This parameter specifies the SMP response
884f11c7f63SJim Harris  *             data associated with the newly discovered device.
885f11c7f63SJim Harris  *
886f11c7f63SJim Harris  * @return none
887f11c7f63SJim Harris  */
888f11c7f63SJim Harris void scif_cb_domain_ea_device_added(
889f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T      controller,
890f11c7f63SJim Harris    SCI_DOMAIN_HANDLE_T          domain,
891f11c7f63SJim Harris    SCI_REMOTE_DEVICE_HANDLE_T   containing_device,
892f11c7f63SJim Harris    SMP_RESPONSE_DISCOVER_T    * smp_response
893f11c7f63SJim Harris );
894f11c7f63SJim Harris 
895f11c7f63SJim Harris /**
896f11c7f63SJim Harris  * @brief This callback method informs the framework user that a device
897f11c7f63SJim Harris  *        has been removed from the domain.
898f11c7f63SJim Harris  *
899f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller object
900f11c7f63SJim Harris  *             with which this callback is associated.
901f11c7f63SJim Harris  * @param[in]  domain This parameter specifies the domain object with
902f11c7f63SJim Harris  *             which this callback is associated.
903f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the device object with
904f11c7f63SJim Harris  *             which this callback is associated.
905f11c7f63SJim Harris  *
906f11c7f63SJim Harris  * @return none
907f11c7f63SJim Harris  */
908f11c7f63SJim Harris void scif_cb_domain_device_removed(
909f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T     controller,
910f11c7f63SJim Harris    SCI_DOMAIN_HANDLE_T         domain,
911f11c7f63SJim Harris    SCI_REMOTE_DEVICE_HANDLE_T  remote_device
912f11c7f63SJim Harris );
913f11c7f63SJim Harris 
914f11c7f63SJim Harris /**
915f11c7f63SJim Harris  * @brief This callback method informs the framework user that the remote
916f11c7f63SJim Harris  *        device is ready and capable of processing IO requests.
917f11c7f63SJim Harris  *
918f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller object
919f11c7f63SJim Harris  *             with which this callback is associated.
920f11c7f63SJim Harris  * @param[in]  domain This parameter specifies the domain object with
921f11c7f63SJim Harris  *             which this callback is associated.
922f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the device object with
923f11c7f63SJim Harris  *             which this callback is associated.
924f11c7f63SJim Harris  *
925f11c7f63SJim Harris  * @return none
926f11c7f63SJim Harris  */
927f11c7f63SJim Harris void scif_cb_remote_device_ready(
928f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T     controller,
929f11c7f63SJim Harris    SCI_DOMAIN_HANDLE_T         domain,
930f11c7f63SJim Harris    SCI_REMOTE_DEVICE_HANDLE_T  remote_device
931f11c7f63SJim Harris );
932f11c7f63SJim Harris 
933f11c7f63SJim Harris /**
934f11c7f63SJim Harris  * @brief This callback method informs the framework user that the remote
935f11c7f63SJim Harris  *        device is not ready.  Thus, it is incapable of processing IO
936f11c7f63SJim Harris  *        requests.
937f11c7f63SJim Harris  *
938f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller object
939f11c7f63SJim Harris  *             with which this callback is associated.
940f11c7f63SJim Harris  * @param[in]  domain This parameter specifies the domain object with
941f11c7f63SJim Harris  *             which this callback is associated.
942f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the device object with
943f11c7f63SJim Harris  *             which this callback is associated.
944f11c7f63SJim Harris  *
945f11c7f63SJim Harris  * @return none
946f11c7f63SJim Harris  */
947f11c7f63SJim Harris void scif_cb_remote_device_not_ready(
948f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T     controller,
949f11c7f63SJim Harris    SCI_DOMAIN_HANDLE_T         domain,
950f11c7f63SJim Harris    SCI_REMOTE_DEVICE_HANDLE_T  remote_device
951f11c7f63SJim Harris );
952f11c7f63SJim Harris 
953f11c7f63SJim Harris /**
954f11c7f63SJim Harris  * @brief This callback method informs the framework user that the remote
955f11c7f63SJim Harris  *        device failed.  This typically occurs shortly after the device
956f11c7f63SJim Harris  *        has been discovered, during the configuration phase for the device.
957f11c7f63SJim Harris  *
958f11c7f63SJim Harris  * @param[in]  controller This parameter specifies the controller object
959f11c7f63SJim Harris  *             with which this callback is associated.
960f11c7f63SJim Harris  * @param[in]  domain This parameter specifies the domain object with
961f11c7f63SJim Harris  *             which this callback is associated.
962f11c7f63SJim Harris  * @param[in]  remote_device This parameter specifies the device object with
963f11c7f63SJim Harris  *             which this callback is associated.
964f11c7f63SJim Harris  * @param[in]  status This parameter specifies the specific failure condition
965f11c7f63SJim Harris  *             associated with this device failure.
966f11c7f63SJim Harris  *
967f11c7f63SJim Harris  * @return none
968f11c7f63SJim Harris  */
969f11c7f63SJim Harris void scif_cb_remote_device_failed(
970f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T     controller,
971f11c7f63SJim Harris    SCI_DOMAIN_HANDLE_T         domain,
972f11c7f63SJim Harris    SCI_REMOTE_DEVICE_HANDLE_T  remote_device,
973f11c7f63SJim Harris    SCI_STATUS                  status
974f11c7f63SJim Harris );
975f11c7f63SJim Harris 
976f11c7f63SJim Harris 
977f11c7f63SJim Harris 
978f11c7f63SJim Harris /**
979f11c7f63SJim Harris  * @brief This callback method creates an OS specific deferred task
980f11c7f63SJim Harris  *        for internal usage. The handler to deferred task is stored by OS
981f11c7f63SJim Harris  *        driver.
982f11c7f63SJim Harris  *
983f11c7f63SJim Harris  * @param[in] controller This parameter specifies the controller object
984f11c7f63SJim Harris  *            with which this callback is associated.
985f11c7f63SJim Harris  *
986f11c7f63SJim Harris  * @return none
987f11c7f63SJim Harris  */
988f11c7f63SJim Harris void scif_cb_start_internal_io_task_create(
989f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T controller
990f11c7f63SJim Harris );
991f11c7f63SJim Harris 
992f11c7f63SJim Harris 
993f11c7f63SJim Harris /**
994f11c7f63SJim Harris  * @brief This callback method schedules a OS specific deferred task.
995f11c7f63SJim Harris  *
996f11c7f63SJim Harris  * @param[in] controller This parameter specifies the controller
997f11c7f63SJim Harris  *            object with which this callback is associated.
998f11c7f63SJim Harris  * @param[in] start_internal_io_task_routine This parameter specifies the
999f11c7f63SJim Harris  *            sci start_internal_io routine.
1000f11c7f63SJim Harris  * @param[in] context This parameter specifies a handle to a parameter
1001f11c7f63SJim Harris  *            that will be passed into the "start_internal_io_task_routine"
1002f11c7f63SJim Harris  *            when it is invoked.
1003f11c7f63SJim Harris  *
1004f11c7f63SJim Harris  * @return none
1005f11c7f63SJim Harris  */
1006f11c7f63SJim Harris void scif_cb_start_internal_io_task_schedule(
1007f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T controller,
1008f11c7f63SJim Harris    FUNCPTR                 start_internal_io_task_routine,
1009f11c7f63SJim Harris    void                  * context
1010f11c7f63SJim Harris );
1011f11c7f63SJim Harris 
1012f11c7f63SJim Harris /**
1013f11c7f63SJim Harris  * @brief This method will be invoked to allocate memory dynamically.
1014f11c7f63SJim Harris  *
1015f11c7f63SJim Harris  * @param[in]  controller This parameter represents the controller
1016f11c7f63SJim Harris  *             object for which to allocate memory.
1017f11c7f63SJim Harris  * @param[out] mde This parameter represents the memory descriptor to
1018f11c7f63SJim Harris  *             be filled in by the user that will reference the newly
1019f11c7f63SJim Harris  *             allocated memory.
1020f11c7f63SJim Harris  *
1021f11c7f63SJim Harris  * @return none
1022f11c7f63SJim Harris  */
1023f11c7f63SJim Harris void scif_cb_controller_allocate_memory(
1024f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T            controller,
1025f11c7f63SJim Harris    SCI_PHYSICAL_MEMORY_DESCRIPTOR_T * mde
1026f11c7f63SJim Harris );
1027f11c7f63SJim Harris 
1028f11c7f63SJim Harris /**
1029f11c7f63SJim Harris  * @brief This method will be invoked to allocate memory dynamically.
1030f11c7f63SJim Harris  *
1031f11c7f63SJim Harris  * @param[in]  controller This parameter represents the controller
1032f11c7f63SJim Harris  *             object for which to allocate memory.
1033f11c7f63SJim Harris  * @param[out] mde This parameter represents the memory descriptor to
1034f11c7f63SJim Harris  *             be filled in by the user that will reference the newly
1035f11c7f63SJim Harris  *             allocated memory.
1036f11c7f63SJim Harris  *
1037f11c7f63SJim Harris  * @return none
1038f11c7f63SJim Harris  */
1039f11c7f63SJim Harris void scif_cb_controller_free_memory(
1040f11c7f63SJim Harris    SCI_CONTROLLER_HANDLE_T            controller,
1041f11c7f63SJim Harris    SCI_PHYSICAL_MEMORY_DESCRIPTOR_T * mde
1042f11c7f63SJim Harris );
1043f11c7f63SJim Harris 
1044f11c7f63SJim Harris #ifdef __cplusplus
1045f11c7f63SJim Harris }
1046f11c7f63SJim Harris #endif // __cplusplus
1047f11c7f63SJim Harris 
1048f11c7f63SJim Harris #endif // _SCIF_USER_CALLBACK_H_
1049f11c7f63SJim Harris 
1050