xref: /freebsd/sys/dev/isci/scil/scic_task_request.h (revision ebacd8013fe5f7fdf9f6a5b286f6680dd2891036)
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_TASK_REQUEST_H_
57 #define _SCIC_TASK_REQUEST_H_
58 
59 /**
60  * @file
61  *
62  * @brief This file contains the structures and interface methods that
63  *        can be referenced and used by the SCI user for to utilize
64  *        task management requests.
65  */
66 
67 #ifdef __cplusplus
68 extern "C" {
69 #endif // __cplusplus
70 
71 #include <dev/isci/scil/sci_types.h>
72 #include <dev/isci/scil/sci_status.h>
73 
74 #if !defined(DISABLE_TASK_MANAGEMENT)
75 
76 /**
77  * @brief This method simply returns the size required to build an SCI
78  *        based task management request object.
79  *
80  * @return Return the size of the SCIC task request object.
81  */
82 U32 scic_task_request_get_object_size(
83    void
84 );
85 
86 /**
87  * @brief This method is called by the SCI user to construct all SCI Core
88  *        task management requests, regardless of protocol.  Memory
89  *        initialization and functionality common to all task request types
90  *        is performed in this method.
91  *
92  * @note  The SCI core implementation will create an association between
93  *        the user task request object and the core task request object.
94  *
95  * @param[in]  scic_controller the handle to the core controller object
96  *             for which to build the task managmement request.
97  * @param[in]  scic_remote_device the handle to the core remote device
98  *             object for which to build the task management request.
99  *             passed, then a copy of the request is built internally.  The
100  *             request will be copied into the actual controller request
101  *             memory when the task is allocated internally during the
102  *             scic_controller_start_task() method.
103  * @param[in]  io_tag This parameter specifies the IO tag to be associated
104  *             with this request.  If SCI_CONTROLLER_INVALID_IO_TAG is
105  *             passed, then a copy of the request is built internally.  The
106  *             request will be copied into the actual controller request
107  *             memory when the IO tag is allocated internally during the
108  *             scic_controller_start_io() method.
109  * @param[in]  user_task_request_object This parameter specifies the user
110  *             task request to be utilized during construction.  This task
111  *             pointer will become the associated object for the core
112  *             task request object.
113  * @param[in]  scic_task_request_memory This parameter specifies the memory
114  *             location to be utilized when building the core request.
115  * @param[out] new_scic_task_request_handle This parameter specifies a
116  *             pointer to the handle the core will expect in further
117  *             interactions with the core task request object.
118  *
119  * @return Indicate if the controller successfully built the task request.
120  * @retval SCI_SUCCESS This value is returned if the task request was
121  *         successfully built.
122  */
123 SCI_STATUS scic_task_request_construct(
124    SCI_CONTROLLER_HANDLE_T      scic_controller,
125    SCI_REMOTE_DEVICE_HANDLE_T   scic_remote_device,
126    U16                          io_tag,
127    void                       * user_task_request_object,
128    void                       * scic_task_request_memory,
129    SCI_TASK_REQUEST_HANDLE_T  * new_scic_task_request_handle
130 );
131 
132 /**
133  * @brief This method is called by the SCI user to construct all SCI Core
134  *        SSP task management requests.  Memory initialization and
135  *        functionality common to all task request types is performed in
136  *        this method.
137  *
138  * @param[out] scic_task_request This parameter specifies the handle
139  *             to the core task request object for which to construct
140  *             a SATA specific task management request.
141  *
142  * @return Indicate if the controller successfully built the task request.
143  * @retval SCI_SUCCESS This value is returned if the task request was
144  *         successfully built.
145  */
146 SCI_STATUS scic_task_request_construct_ssp(
147    SCI_TASK_REQUEST_HANDLE_T  scic_task_request
148 );
149 
150 /**
151  * @brief This method is called by the SCI user to construct all SCI Core
152  *        SATA task management requests.  Memory initialization and
153  *        functionality common to all task request types is performed in
154  *        this method.
155  *
156  * @param[out] scic_task_request_handle This parameter specifies the
157  *             handle to the core task request object for which to construct
158  *             a SATA specific task management request.
159  *
160  * @return Indicate if the controller successfully built the task request.
161  * @retval SCI_SUCCESS This value is returned if the task request was
162  *         successfully built.
163  */
164 SCI_STATUS scic_task_request_construct_sata(
165    SCI_TASK_REQUEST_HANDLE_T  scic_task_request_handle
166 );
167 
168 #else // !defined(DISABLE_TASK_MANAGEMENT)
169 
170 #define scic_task_request_get_object_size() 0
171 #define scic_task_request_construct(controller, dev, tag, task, mem, handle) \
172         SCI_FAILURE
173 #define scic_task_request_construct_ssp(task) SCI_FAILURE
174 #define scic_task_request_construct_sata(task) SCI_FAILURE
175 
176 #endif // !defined(DISABLE_TASK_MANAGEMENT)
177 
178 #ifdef __cplusplus
179 }
180 #endif // __cplusplus
181 
182 #endif // _SCIC_TASK_REQUEST_H_
183 
184