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 _SCIC_TASK_REQUEST_H_
55230557Sjimharris#define _SCIC_TASK_REQUEST_H_
56230557Sjimharris
57230557Sjimharris/**
58230557Sjimharris * @file
59230557Sjimharris *
60230557Sjimharris * @brief This file contains the structures and interface methods that
61230557Sjimharris *        can be referenced and used by the SCI user for to utilize
62230557Sjimharris *        task management requests.
63230557Sjimharris */
64230557Sjimharris
65230557Sjimharris#ifdef __cplusplus
66230557Sjimharrisextern "C" {
67230557Sjimharris#endif // __cplusplus
68230557Sjimharris
69230557Sjimharris#include <dev/isci/scil/sci_types.h>
70230557Sjimharris#include <dev/isci/scil/sci_status.h>
71230557Sjimharris
72230557Sjimharris#if !defined(DISABLE_TASK_MANAGEMENT)
73230557Sjimharris
74230557Sjimharris/**
75230557Sjimharris * @brief This method simply returns the size required to build an SCI
76230557Sjimharris *        based task managment request object.
77230557Sjimharris *
78230557Sjimharris * @return Return the size of the SCIC task request object.
79230557Sjimharris */
80230557SjimharrisU32 scic_task_request_get_object_size(
81230557Sjimharris   void
82230557Sjimharris);
83230557Sjimharris
84230557Sjimharris/**
85230557Sjimharris * @brief This method is called by the SCI user to construct all SCI Core
86230557Sjimharris *        task management requests, regardless of protocol.  Memory
87230557Sjimharris *        initialization and functionality common to all task request types
88230557Sjimharris *        is performed in this method.
89230557Sjimharris *
90230557Sjimharris * @note  The SCI core implementation will create an association between
91230557Sjimharris *        the user task request object and the core task request object.
92230557Sjimharris *
93230557Sjimharris * @param[in]  scic_controller the handle to the core controller object
94230557Sjimharris *             for which to build the task managmement request.
95230557Sjimharris * @param[in]  scic_remote_device the handle to the core remote device
96230557Sjimharris *             object for which to build the task management request.
97230557Sjimharris *             passed, then a copy of the request is built internally.  The
98230557Sjimharris *             request will be copied into the actual controller request
99230557Sjimharris *             memory when the task is allocated internally during the
100230557Sjimharris *             scic_controller_start_task() method.
101230557Sjimharris * @param[in]  io_tag This parameter specifies the IO tag to be associated
102230557Sjimharris *             with this request.  If SCI_CONTROLLER_INVALID_IO_TAG is
103230557Sjimharris *             passed, then a copy of the request is built internally.  The
104230557Sjimharris *             request will be copied into the actual controller request
105230557Sjimharris *             memory when the IO tag is allocated internally during the
106230557Sjimharris *             scic_controller_start_io() method.
107230557Sjimharris * @param[in]  user_task_request_object This parameter specifies the user
108230557Sjimharris *             task request to be utilized during construction.  This task
109230557Sjimharris *             pointer will become the associated object for the core
110230557Sjimharris *             task request object.
111230557Sjimharris * @param[in]  scic_task_request_memory This parameter specifies the memory
112230557Sjimharris *             location to be utilized when building the core request.
113230557Sjimharris * @param[out] new_scic_task_request_handle This parameter specifies a
114230557Sjimharris *             pointer to the handle the core will expect in further
115230557Sjimharris *             interactions with the core task request object.
116230557Sjimharris *
117230557Sjimharris * @return Indicate if the controller successfully built the task request.
118230557Sjimharris * @retval SCI_SUCCESS This value is returned if the task request was
119230557Sjimharris *         successfully built.
120230557Sjimharris */
121230557SjimharrisSCI_STATUS scic_task_request_construct(
122230557Sjimharris   SCI_CONTROLLER_HANDLE_T      scic_controller,
123230557Sjimharris   SCI_REMOTE_DEVICE_HANDLE_T   scic_remote_device,
124230557Sjimharris   U16                          io_tag,
125230557Sjimharris   void                       * user_task_request_object,
126230557Sjimharris   void                       * scic_task_request_memory,
127230557Sjimharris   SCI_TASK_REQUEST_HANDLE_T  * new_scic_task_request_handle
128230557Sjimharris);
129230557Sjimharris
130230557Sjimharris/**
131230557Sjimharris * @brief This method is called by the SCI user to construct all SCI Core
132230557Sjimharris *        SSP task management requests.  Memory initialization and
133230557Sjimharris *        functionality common to all task request types is performed in
134230557Sjimharris *        this method.
135230557Sjimharris *
136230557Sjimharris * @param[out] scic_task_request This parameter specifies the handle
137230557Sjimharris *             to the core task request object for which to construct
138230557Sjimharris *             a SATA specific task management request.
139230557Sjimharris *
140230557Sjimharris * @return Indicate if the controller successfully built the task request.
141230557Sjimharris * @retval SCI_SUCCESS This value is returned if the task request was
142230557Sjimharris *         successfully built.
143230557Sjimharris */
144230557SjimharrisSCI_STATUS scic_task_request_construct_ssp(
145230557Sjimharris   SCI_TASK_REQUEST_HANDLE_T  scic_task_request
146230557Sjimharris);
147230557Sjimharris
148230557Sjimharris/**
149230557Sjimharris * @brief This method is called by the SCI user to construct all SCI Core
150230557Sjimharris *        SATA task management requests.  Memory initialization and
151230557Sjimharris *        functionality common to all task request types is performed in
152230557Sjimharris *        this method.
153230557Sjimharris *
154230557Sjimharris * @param[out] scic_task_request_handle This parameter specifies the
155230557Sjimharris *             handle to the core task request object for which to construct
156230557Sjimharris *             a SATA specific task management request.
157230557Sjimharris *
158230557Sjimharris * @return Indicate if the controller successfully built the task request.
159230557Sjimharris * @retval SCI_SUCCESS This value is returned if the task request was
160230557Sjimharris *         successfully built.
161230557Sjimharris */
162230557SjimharrisSCI_STATUS scic_task_request_construct_sata(
163230557Sjimharris   SCI_TASK_REQUEST_HANDLE_T  scic_task_request_handle
164230557Sjimharris);
165230557Sjimharris
166230557Sjimharris#else // !defined(DISABLE_TASK_MANAGEMENT)
167230557Sjimharris
168230557Sjimharris#define scic_task_request_get_object_size() 0
169230557Sjimharris#define scic_task_request_construct(controller, dev, tag, task, mem, handle) \
170230557Sjimharris        SCI_FAILURE
171230557Sjimharris#define scic_task_request_construct_ssp(task) SCI_FAILURE
172230557Sjimharris#define scic_task_request_construct_sata(task) SCI_FAILURE
173230557Sjimharris
174230557Sjimharris#endif // !defined(DISABLE_TASK_MANAGEMENT)
175230557Sjimharris
176230557Sjimharris#ifdef __cplusplus
177230557Sjimharris}
178230557Sjimharris#endif // __cplusplus
179230557Sjimharris
180230557Sjimharris#endif // _SCIC_TASK_REQUEST_H_
181230557Sjimharris
182