2 * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
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.
9 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
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.
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.
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.
28 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
29 * All rights reserved.
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
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
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.
56 #ifndef _SCIC_SDS_STP_REQUEST_T_
57 #define _SCIC_SDS_STP_REQUEST_T_
63 #include <dev/isci/scil/intel_sata.h>
64 #include <dev/isci/scil/sci_types.h>
65 #include <dev/isci/scil/scic_sds_request.h>
70 * @brief This structure represents the additional information that is
71 * required to handle SATA PIO requests.
73 typedef struct SCIC_SDS_STP_REQUEST
75 SCIC_SDS_REQUEST_T parent;
77 SATA_FIS_REG_D2H_T d2h_reg_fis;
88 * Total transfer for the entire PIO request recorded at request construction
91 * @todo Should we just decrement this value for each byte of data transitted
92 * or received to elemenate the current_transfer_bytes field?
94 U32 total_transfer_bytes;
97 * Total number of bytes received/transmitted in data frames since the start
98 * of the IO request. At the end of the IO request this should equal the
99 * total_transfer_bytes.
101 U32 current_transfer_bytes;
104 * The number of bytes requested in the in the PIO setup.
106 U32 pio_transfer_bytes;
109 * PIO Setup ending status value to tell us if we need to wait for another FIS
110 * or if the transfer is complete. On the receipt of a D2H FIS this will be
111 * the status field of that FIS.
116 * On receipt of a D2H FIS this will be the ending error field if the
117 * ending_status has the SATA_STATUS_ERR bit set.
122 * Protocol Type. This is filled in by core during IO Request construction type.
127 * This field keeps track of sgl pair to be retrieved from OS memory for processing.
133 SCU_SGL_ELEMENT_PAIR_T * sgl_pair;
142 * The number of bytes requested in the PIO setup before CDB data frame.
144 U32 device_preferred_cdb_length;
148 } SCIC_SDS_STP_REQUEST_T;
151 * @enum SCIC_SDS_STP_REQUEST_STARTED_UDMA_SUBSTATES
153 * @brief This enumeration depicts the various sub-states associated with
154 * a SATA/STP UDMA protocol operation.
156 enum SCIC_SDS_STP_REQUEST_STARTED_UDMA_SUBSTATES
158 SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE,
159 SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE,
161 SCIC_SDS_STP_REQUEST_STARTED_UDMA_MAX_SUBSTATES
165 * @enum SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_SUBSTATES
167 * @brief This enumeration depicts the various sub-states associated with
168 * a SATA/STP non-data protocol operation.
170 enum SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_SUBSTATES
172 SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE,
173 SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE,
174 SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_MAX_SUBSTATES
178 * @enum SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_SUBSTATES
180 * @brief THis enumeration depicts the various sub-states associated with a
181 * SATA/STP soft reset operation.
183 enum SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_SUBSTATES
185 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE,
186 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE,
187 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE,
189 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_MAX_SUBSTATES
192 extern SCIC_SDS_IO_REQUEST_STATE_HANDLER_T
193 scic_sds_stp_request_started_udma_substate_handler_table
194 [SCIC_SDS_STP_REQUEST_STARTED_UDMA_MAX_SUBSTATES];
196 extern SCI_BASE_STATE_T
197 scic_sds_stp_request_started_udma_substate_table
198 [SCIC_SDS_STP_REQUEST_STARTED_UDMA_MAX_SUBSTATES];
200 extern SCIC_SDS_IO_REQUEST_STATE_HANDLER_T
201 scic_sds_stp_request_started_non_data_substate_handler_table
202 [SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_MAX_SUBSTATES];
204 extern SCI_BASE_STATE_T
205 scic_sds_stp_request_started_non_data_substate_table
206 [SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_MAX_SUBSTATES];
209 extern SCIC_SDS_IO_REQUEST_STATE_HANDLER_T
210 scic_sds_stp_request_started_soft_reset_substate_handler_table
211 [SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_MAX_SUBSTATES];
213 extern SCI_BASE_STATE_T
214 scic_sds_stp_request_started_soft_reset_substate_table
215 [SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_MAX_SUBSTATES];
217 // ---------------------------------------------------------------------------
219 U32 scic_sds_stp_request_get_object_size(void);
221 U32 scic_sds_stp_task_request_get_object_size(void);
223 void scu_sata_reqeust_construct_task_context(
224 SCIC_SDS_REQUEST_T * this_request,
225 SCU_TASK_CONTEXT_T * task_context
228 void scic_sds_stp_non_ncq_request_construct(
229 SCIC_SDS_REQUEST_T *this_request
232 SCI_STATUS scic_sds_stp_pio_request_construct(
233 SCIC_SDS_REQUEST_T * scic_io_request,
238 SCI_STATUS scic_sds_stp_pio_request_construct_pass_through (
239 SCIC_SDS_REQUEST_T * scic_io_request,
240 SCIC_STP_PASSTHRU_REQUEST_CALLBACKS_T *passthru_cb
243 SCI_STATUS scic_sds_stp_udma_request_construct(
244 SCIC_SDS_REQUEST_T * this_request,
246 SCI_IO_REQUEST_DATA_DIRECTION data_direction
249 SCI_STATUS scic_sds_stp_non_data_request_construct(
250 SCIC_SDS_REQUEST_T * this_request
253 SCI_STATUS scic_sds_stp_soft_reset_request_construct(
254 SCIC_SDS_REQUEST_T * this_request
257 SCI_STATUS scic_sds_stp_ncq_request_construct(
258 SCIC_SDS_REQUEST_T * this_request,
260 SCI_IO_REQUEST_DATA_DIRECTION data_direction
263 void scu_stp_raw_request_construct_task_context(
264 SCIC_SDS_STP_REQUEST_T * this_request,
265 SCU_TASK_CONTEXT_T * task_context
269 SCI_STATUS scic_sds_io_request_construct_sata(
270 SCIC_SDS_REQUEST_T * this_request,
273 SCI_IO_REQUEST_DATA_DIRECTION data_direction,
275 BOOL do_translate_sgl
280 #endif // __cplusplus
282 #endif // _SCIC_SDS_STP_REQUEST_T_