isci: kill sci_types.h
[deliverable/linux.git] / drivers / scsi / isci / core / scic_sds_stp_request.h
CommitLineData
6f231dda
DW
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 * * Neither the name of Intel Corporation nor the names of its
40 * contributors may be used to endorse or promote products derived
41 * from this software without specific prior written permission.
42 *
43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
44 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
45 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
46 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
47 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
50 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
51 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 */
55
56#ifndef _SCIC_SDS_STP_REQUEST_T_
57#define _SCIC_SDS_STP_REQUEST_T_
58
82d29928 59#include <linux/dma-mapping.h>
6f231dda 60#include "intel_sata.h"
6f231dda
DW
61#include "scic_sds_request.h"
62
63/**
64 * This structure represents the additional information that is required to
65 * handle SATA PIO requests.
66 *
67 *
68 */
69struct scic_sds_stp_request {
70 struct scic_sds_request parent;
71
72 struct sata_fis_reg_d2h d2h_reg_fis;
73
74 union {
75 u32 ncq;
76
77 u32 udma;
78
79 struct {
80 /**
81 * Total transfer for the entire PIO request recorded at request constuction
82 * time.
83 *
84 * @todo Should we just decrement this value for each byte of data transitted
85 * or received to elemenate the current_transfer_bytes field?
86 */
87 u32 total_transfer_bytes;
88
89 /**
90 * Total number of bytes received/transmitted in data frames since the start
91 * of the IO request. At the end of the IO request this should equal the
92 * total_transfer_bytes.
93 */
94 u32 current_transfer_bytes;
95
96 /**
97 * The number of bytes requested in the in the PIO setup.
98 */
99 u32 pio_transfer_bytes;
100
101 /**
102 * PIO Setup ending status value to tell us if we need to wait for another FIS
103 * or if the transfer is complete. On the receipt of a D2H FIS this will be
104 * the status field of that FIS.
105 */
106 u8 ending_status;
107
108 /**
109 * On receipt of a D2H FIS this will be the ending error field if the
110 * ending_status has the SATA_STATUS_ERR bit set.
111 */
112 u8 ending_error;
113
114 /**
115 * Protocol Type. This is filled in by core during IO Request construction type.
116 */
117 u8 sat_protocol;
118
119 struct {
120 struct scu_sgl_element_pair *sgl_pair;
121 u8 sgl_set;
122 u32 sgl_offset;
123 } request_current;
124 } pio;
125
126 struct {
127 /**
128 * The number of bytes requested in the PIO setup before CDB data frame.
129 */
130 u32 device_preferred_cdb_length;
131 } packet;
132 } type;
133
134};
135
136/**
137 * enum SCIC_SDS_STP_REQUEST_STARTED_UDMA_SUBSTATES - This enumeration depicts
138 * the various sub-states associated with a SATA/STP UDMA protocol operation.
139 *
140 *
141 */
142enum SCIC_SDS_STP_REQUEST_STARTED_UDMA_SUBSTATES {
143 SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE,
144 SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE,
145};
146
147/**
148 * enum SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_SUBSTATES - This enumeration
149 * depicts the various sub-states associated with a SATA/STP non-data
150 * protocol operation.
151 *
152 *
153 */
154enum SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_SUBSTATES {
155 SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE,
156 SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE,
157};
158
159/**
160 * enum SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_SUBSTATES - THis enumeration
161 * depicts the various sub-states associated with a SATA/STP soft reset
162 * operation.
163 *
164 *
165 */
166enum SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_SUBSTATES {
167 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE,
168 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE,
169 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE,
170};
171
172extern const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_udma_substate_handler_table[];
173
174extern const struct sci_base_state scic_sds_stp_request_started_udma_substate_table[];
175
176extern const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_non_data_substate_handler_table[];
177
178extern const struct sci_base_state scic_sds_stp_request_started_non_data_substate_table[];
179
180extern const struct scic_sds_io_request_state_handler scic_sds_stp_request_started_soft_reset_substate_handler_table[];
181
182extern const struct sci_base_state scic_sds_stp_request_started_soft_reset_substate_table[];
183
184/* --------------------------------------------------------------------------- */
185
186u32 scic_sds_stp_request_get_object_size(void);
187
188
189void scic_sds_stp_non_ncq_request_construct(
190 struct scic_sds_request *this_request);
191
192enum sci_status scic_sds_stp_pio_request_construct(
193 struct scic_sds_request *scic_io_request,
194 u8 sat_protocol,
195 bool copy_rx_frame);
196
197enum sci_status scic_sds_stp_pio_request_construct_pass_through(
198 struct scic_sds_request *scic_io_request,
199 struct scic_stp_passthru_request_callbacks *passthru_cb);
200
201enum sci_status scic_sds_stp_udma_request_construct(
202 struct scic_sds_request *this_request,
203 u32 transfer_length,
82d29928 204 enum dma_data_direction dir);
6f231dda
DW
205
206enum sci_status scic_sds_stp_non_data_request_construct(
207 struct scic_sds_request *this_request);
208
209enum sci_status scic_sds_stp_soft_reset_request_construct(
210 struct scic_sds_request *this_request);
211
212enum sci_status scic_sds_stp_ncq_request_construct(
213 struct scic_sds_request *this_request,
214 u32 transfer_length,
82d29928 215 enum dma_data_direction dir);
6f231dda
DW
216
217void scu_stp_raw_request_construct_task_context(
218 struct scic_sds_stp_request *this_request,
219 struct scu_task_context *task_context);
220
221#endif /* _SCIC_SDS_STP_REQUEST_T_ */
This page took 0.033287 seconds and 5 git commands to generate.