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.
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
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.
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.
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.
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
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
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.
54 #ifndef _SCIC_SDS_STP_REQUEST_T_
55 #define _SCIC_SDS_STP_REQUEST_T_
61 #include <dev/isci/scil/intel_sata.h>
62 #include <dev/isci/scil/sci_types.h>
63 #include <dev/isci/scil/scic_sds_request.h>
68 * @brief This structure represents the additional information that is
69 * required to handle SATA PIO requests.
71 typedef struct SCIC_SDS_STP_REQUEST
73 SCIC_SDS_REQUEST_T parent;
75 SATA_FIS_REG_D2H_T d2h_reg_fis;
86 * Total transfer for the entire PIO request recorded at request constuction
89 * @todo Should we just decrement this value for each byte of data transitted
90 * or received to elemenate the current_transfer_bytes field?
92 U32 total_transfer_bytes;
95 * Total number of bytes received/transmitted in data frames since the start
96 * of the IO request. At the end of the IO request this should equal the
97 * total_transfer_bytes.
99 U32 current_transfer_bytes;
102 * The number of bytes requested in the in the PIO setup.
104 U32 pio_transfer_bytes;
107 * PIO Setup ending status value to tell us if we need to wait for another FIS
108 * or if the transfer is complete. On the receipt of a D2H FIS this will be
109 * the status field of that FIS.
114 * On receipt of a D2H FIS this will be the ending error field if the
115 * ending_status has the SATA_STATUS_ERR bit set.
120 * Protocol Type. This is filled in by core during IO Request construction type.
125 * This field keeps track of sgl pair to be retrieved from OS memory for processing.
131 SCU_SGL_ELEMENT_PAIR_T * sgl_pair;
140 * The number of bytes requested in the PIO setup before CDB data frame.
142 U32 device_preferred_cdb_length;
146 } SCIC_SDS_STP_REQUEST_T;
149 * @enum SCIC_SDS_STP_REQUEST_STARTED_UDMA_SUBSTATES
151 * @brief This enumeration depicts the various sub-states associated with
152 * a SATA/STP UDMA protocol operation.
154 enum SCIC_SDS_STP_REQUEST_STARTED_UDMA_SUBSTATES
156 SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE,
157 SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE,
159 SCIC_SDS_STP_REQUEST_STARTED_UDMA_MAX_SUBSTATES
163 * @enum SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_SUBSTATES
165 * @brief This enumeration depicts the various sub-states associated with
166 * a SATA/STP non-data protocol operation.
168 enum SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_SUBSTATES
170 SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE,
171 SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE,
172 SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_MAX_SUBSTATES
176 * @enum SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_SUBSTATES
178 * @brief THis enumeration depicts the various sub-states associated with a
179 * SATA/STP soft reset operation.
181 enum SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_SUBSTATES
183 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE,
184 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE,
185 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE,
187 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_MAX_SUBSTATES
190 extern SCIC_SDS_IO_REQUEST_STATE_HANDLER_T
191 scic_sds_stp_request_started_udma_substate_handler_table
192 [SCIC_SDS_STP_REQUEST_STARTED_UDMA_MAX_SUBSTATES];
194 extern SCI_BASE_STATE_T
195 scic_sds_stp_request_started_udma_substate_table
196 [SCIC_SDS_STP_REQUEST_STARTED_UDMA_MAX_SUBSTATES];
198 extern SCIC_SDS_IO_REQUEST_STATE_HANDLER_T
199 scic_sds_stp_request_started_non_data_substate_handler_table
200 [SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_MAX_SUBSTATES];
202 extern SCI_BASE_STATE_T
203 scic_sds_stp_request_started_non_data_substate_table
204 [SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_MAX_SUBSTATES];
207 extern SCIC_SDS_IO_REQUEST_STATE_HANDLER_T
208 scic_sds_stp_request_started_soft_reset_substate_handler_table
209 [SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_MAX_SUBSTATES];
211 extern SCI_BASE_STATE_T
212 scic_sds_stp_request_started_soft_reset_substate_table
213 [SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_MAX_SUBSTATES];
215 // ---------------------------------------------------------------------------
217 U32 scic_sds_stp_request_get_object_size(void);
219 U32 scic_sds_stp_task_request_get_object_size(void);
221 void scu_sata_reqeust_construct_task_context(
222 SCIC_SDS_REQUEST_T * this_request,
223 SCU_TASK_CONTEXT_T * task_context
226 void scic_sds_stp_non_ncq_request_construct(
227 SCIC_SDS_REQUEST_T *this_request
230 SCI_STATUS scic_sds_stp_pio_request_construct(
231 SCIC_SDS_REQUEST_T * scic_io_request,
236 SCI_STATUS scic_sds_stp_pio_request_construct_pass_through (
237 SCIC_SDS_REQUEST_T * scic_io_request,
238 SCIC_STP_PASSTHRU_REQUEST_CALLBACKS_T *passthru_cb
241 SCI_STATUS scic_sds_stp_udma_request_construct(
242 SCIC_SDS_REQUEST_T * this_request,
244 SCI_IO_REQUEST_DATA_DIRECTION data_direction
247 SCI_STATUS scic_sds_stp_non_data_request_construct(
248 SCIC_SDS_REQUEST_T * this_request
251 SCI_STATUS scic_sds_stp_soft_reset_request_construct(
252 SCIC_SDS_REQUEST_T * this_request
255 SCI_STATUS scic_sds_stp_ncq_request_construct(
256 SCIC_SDS_REQUEST_T * this_request,
258 SCI_IO_REQUEST_DATA_DIRECTION data_direction
261 void scu_stp_raw_request_construct_task_context(
262 SCIC_SDS_STP_REQUEST_T * this_request,
263 SCU_TASK_CONTEXT_T * task_context
267 SCI_STATUS scic_sds_io_request_construct_sata(
268 SCIC_SDS_REQUEST_T * this_request,
271 SCI_IO_REQUEST_DATA_DIRECTION data_direction,
273 BOOL do_translate_sgl
278 #endif // __cplusplus
280 #endif // _SCIC_SDS_STP_REQUEST_T_