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