xref: /openbmc/linux/drivers/scsi/isci/request.h (revision 209fae14fabfd48525e5630bebbbd4ca15090c60)
16f231ddaSDan Williams /*
26f231ddaSDan Williams  * This file is provided under a dual BSD/GPLv2 license.  When using or
36f231ddaSDan Williams  * redistributing this file, you may do so under either license.
46f231ddaSDan Williams  *
56f231ddaSDan Williams  * GPL LICENSE SUMMARY
66f231ddaSDan Williams  *
76f231ddaSDan Williams  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
86f231ddaSDan Williams  *
96f231ddaSDan Williams  * This program is free software; you can redistribute it and/or modify
106f231ddaSDan Williams  * it under the terms of version 2 of the GNU General Public License as
116f231ddaSDan Williams  * published by the Free Software Foundation.
126f231ddaSDan Williams  *
136f231ddaSDan Williams  * This program is distributed in the hope that it will be useful, but
146f231ddaSDan Williams  * WITHOUT ANY WARRANTY; without even the implied warranty of
156f231ddaSDan Williams  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
166f231ddaSDan Williams  * General Public License for more details.
176f231ddaSDan Williams  *
186f231ddaSDan Williams  * You should have received a copy of the GNU General Public License
196f231ddaSDan Williams  * along with this program; if not, write to the Free Software
206f231ddaSDan Williams  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
216f231ddaSDan Williams  * The full GNU General Public License is included in this distribution
226f231ddaSDan Williams  * in the file called LICENSE.GPL.
236f231ddaSDan Williams  *
246f231ddaSDan Williams  * BSD LICENSE
256f231ddaSDan Williams  *
266f231ddaSDan Williams  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
276f231ddaSDan Williams  * All rights reserved.
286f231ddaSDan Williams  *
296f231ddaSDan Williams  * Redistribution and use in source and binary forms, with or without
306f231ddaSDan Williams  * modification, are permitted provided that the following conditions
316f231ddaSDan Williams  * are met:
326f231ddaSDan Williams  *
336f231ddaSDan Williams  *   * Redistributions of source code must retain the above copyright
346f231ddaSDan Williams  *     notice, this list of conditions and the following disclaimer.
356f231ddaSDan Williams  *   * Redistributions in binary form must reproduce the above copyright
366f231ddaSDan Williams  *     notice, this list of conditions and the following disclaimer in
376f231ddaSDan Williams  *     the documentation and/or other materials provided with the
386f231ddaSDan Williams  *     distribution.
396f231ddaSDan Williams  *   * Neither the name of Intel Corporation nor the names of its
406f231ddaSDan Williams  *     contributors may be used to endorse or promote products derived
416f231ddaSDan Williams  *     from this software without specific prior written permission.
426f231ddaSDan Williams  *
436f231ddaSDan Williams  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
446f231ddaSDan Williams  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
456f231ddaSDan Williams  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
466f231ddaSDan Williams  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
476f231ddaSDan Williams  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
486f231ddaSDan Williams  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
496f231ddaSDan Williams  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
506f231ddaSDan Williams  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
516f231ddaSDan Williams  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
526f231ddaSDan Williams  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
536f231ddaSDan Williams  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
546f231ddaSDan Williams  */
556f231ddaSDan Williams 
560d84366fSDan Williams #ifndef _ISCI_REQUEST_H_
576f231ddaSDan Williams #define _ISCI_REQUEST_H_
586f231ddaSDan Williams 
596f231ddaSDan Williams #include "isci.h"
60ce2b3261SDan Williams #include "host.h"
61f1f52e75SDan Williams #include "scu_task_context.h"
626f231ddaSDan Williams 
636f231ddaSDan Williams /**
646f231ddaSDan Williams  * struct isci_request_status - This enum defines the possible states of an I/O
656f231ddaSDan Williams  *    request.
666f231ddaSDan Williams  *
676f231ddaSDan Williams  *
686f231ddaSDan Williams  */
696f231ddaSDan Williams enum isci_request_status {
706f231ddaSDan Williams 	unallocated = 0x00,
716f231ddaSDan Williams 	allocated   = 0x01,
726f231ddaSDan Williams 	started     = 0x02,
736f231ddaSDan Williams 	completed   = 0x03,
746f231ddaSDan Williams 	aborting    = 0x04,
756f231ddaSDan Williams 	aborted     = 0x05,
764dc043c4SJeff Skirvin 	terminating = 0x06,
774dc043c4SJeff Skirvin 	dead        = 0x07
786f231ddaSDan Williams };
796f231ddaSDan Williams 
806f231ddaSDan Williams enum task_type {
816f231ddaSDan Williams 	io_task  = 0,
826f231ddaSDan Williams 	tmf_task = 1
836f231ddaSDan Williams };
846f231ddaSDan Williams 
85f1f52e75SDan Williams enum sci_request_protocol {
86f1f52e75SDan Williams 	SCIC_NO_PROTOCOL,
87f1f52e75SDan Williams 	SCIC_SMP_PROTOCOL,
88f1f52e75SDan Williams 	SCIC_SSP_PROTOCOL,
89f1f52e75SDan Williams 	SCIC_STP_PROTOCOL
90c72086e3SDan Williams }; /* XXX remove me, use sas_task.{dev|task_proto} instead */;
91f1f52e75SDan Williams 
925dec6f4eSDan Williams struct scic_sds_stp_request {
935dec6f4eSDan Williams 	union {
945dec6f4eSDan Williams 		u32 ncq;
955dec6f4eSDan Williams 
965dec6f4eSDan Williams 		u32 udma;
975dec6f4eSDan Williams 
985dec6f4eSDan Williams 		struct scic_sds_stp_pio_request {
99e301370aSEdmund Nadolski 			/*
100e301370aSEdmund Nadolski 			 * Total transfer for the entire PIO request recorded
101e301370aSEdmund Nadolski 			 * at request constuction time.
1025dec6f4eSDan Williams 			 *
103e301370aSEdmund Nadolski 			 * @todo Should we just decrement this value for each
104e301370aSEdmund Nadolski 			 * byte of data transitted or received to elemenate
105e301370aSEdmund Nadolski 			 * the current_transfer_bytes field?
1065dec6f4eSDan Williams 			 */
1075dec6f4eSDan Williams 			u32 total_transfer_bytes;
1085dec6f4eSDan Williams 
109e301370aSEdmund Nadolski 			/*
110e301370aSEdmund Nadolski 			 * Total number of bytes received/transmitted in data
111e301370aSEdmund Nadolski 			 * frames since the start of the IO request.  At the
112e301370aSEdmund Nadolski 			 * end of the IO request this should equal the
1135dec6f4eSDan Williams 			 * total_transfer_bytes.
1145dec6f4eSDan Williams 			 */
1155dec6f4eSDan Williams 			u32 current_transfer_bytes;
1165dec6f4eSDan Williams 
117e301370aSEdmund Nadolski 			/*
118e301370aSEdmund Nadolski 			 * The number of bytes requested in the in the PIO
119e301370aSEdmund Nadolski 			 * setup.
1205dec6f4eSDan Williams 			 */
1215dec6f4eSDan Williams 			u32 pio_transfer_bytes;
1225dec6f4eSDan Williams 
123e301370aSEdmund Nadolski 			/*
124e301370aSEdmund Nadolski 			 * PIO Setup ending status value to tell us if we need
125e301370aSEdmund Nadolski 			 * to wait for another FIS or if the transfer is
126e301370aSEdmund Nadolski 			 * complete. On the receipt of a D2H FIS this will be
1275dec6f4eSDan Williams 			 * the status field of that FIS.
1285dec6f4eSDan Williams 			 */
1295dec6f4eSDan Williams 			u8 ending_status;
1305dec6f4eSDan Williams 
131e301370aSEdmund Nadolski 			/*
132e301370aSEdmund Nadolski 			 * On receipt of a D2H FIS this will be the ending
133e301370aSEdmund Nadolski 			 * error field if the ending_status has the
134e301370aSEdmund Nadolski 			 * SATA_STATUS_ERR bit set.
1355dec6f4eSDan Williams 			 */
1365dec6f4eSDan Williams 			u8 ending_error;
1375dec6f4eSDan Williams 
1385dec6f4eSDan Williams 			struct scic_sds_request_pio_sgl {
1395dec6f4eSDan Williams 				struct scu_sgl_element_pair *sgl_pair;
1405dec6f4eSDan Williams 				u8 sgl_set;
1415dec6f4eSDan Williams 				u32 sgl_offset;
1425dec6f4eSDan Williams 			} request_current;
1435dec6f4eSDan Williams 		} pio;
1445dec6f4eSDan Williams 
1455dec6f4eSDan Williams 		struct {
146e301370aSEdmund Nadolski 			/*
147e301370aSEdmund Nadolski 			 * The number of bytes requested in the PIO setup
148e301370aSEdmund Nadolski 			 * before CDB data frame.
1495dec6f4eSDan Williams 			 */
1505dec6f4eSDan Williams 			u32 device_preferred_cdb_length;
1515dec6f4eSDan Williams 		} packet;
1525dec6f4eSDan Williams 	} type;
1535dec6f4eSDan Williams };
1545dec6f4eSDan Williams 
155f1f52e75SDan Williams struct scic_sds_request {
156e301370aSEdmund Nadolski 	/*
157e301370aSEdmund Nadolski 	 * This field contains the information for the base request state
158e301370aSEdmund Nadolski 	 * machine.
159f1f52e75SDan Williams 	 */
160e301370aSEdmund Nadolski 	struct sci_base_state_machine sm;
161f1f52e75SDan Williams 
162e301370aSEdmund Nadolski 	/*
163f1f52e75SDan Williams 	 * This field simply points to the controller to which this IO request
164f1f52e75SDan Williams 	 * is associated.
165f1f52e75SDan Williams 	 */
166f1f52e75SDan Williams 	struct scic_sds_controller *owning_controller;
167f1f52e75SDan Williams 
168e301370aSEdmund Nadolski 	/*
169e301370aSEdmund Nadolski 	 * This field simply points to the remote device to which this IO
170e301370aSEdmund Nadolski 	 * request is associated.
171f1f52e75SDan Williams 	 */
172f1f52e75SDan Williams 	struct scic_sds_remote_device *target_device;
173f1f52e75SDan Williams 
174e301370aSEdmund Nadolski 	/*
175f1f52e75SDan Williams 	 * This field is utilized to determine if the SCI user is managing
176f1f52e75SDan Williams 	 * the IO tag for this request or if the core is managing it.
177f1f52e75SDan Williams 	 */
178f1f52e75SDan Williams 	bool was_tag_assigned_by_user;
179f1f52e75SDan Williams 
180e301370aSEdmund Nadolski 	/*
181f1f52e75SDan Williams 	 * This field indicates the IO tag for this request.  The IO tag is
182f1f52e75SDan Williams 	 * comprised of the task_index and a sequence count. The sequence count
183f1f52e75SDan Williams 	 * is utilized to help identify tasks from one life to another.
184f1f52e75SDan Williams 	 */
185f1f52e75SDan Williams 	u16 io_tag;
186f1f52e75SDan Williams 
187e301370aSEdmund Nadolski 	/*
188f1f52e75SDan Williams 	 * This field specifies the protocol being utilized for this
189f1f52e75SDan Williams 	 * IO request.
190f1f52e75SDan Williams 	 */
191f1f52e75SDan Williams 	enum sci_request_protocol protocol;
192f1f52e75SDan Williams 
193e301370aSEdmund Nadolski 	/*
194f1f52e75SDan Williams 	 * This field indicates the completion status taken from the SCUs
195e301370aSEdmund Nadolski 	 * completion code.  It indicates the completion result for the SCU
196e301370aSEdmund Nadolski 	 * hardware.
197f1f52e75SDan Williams 	 */
198f1f52e75SDan Williams 	u32 scu_status;
199f1f52e75SDan Williams 
200e301370aSEdmund Nadolski 	/*
201e301370aSEdmund Nadolski 	 * This field indicates the completion status returned to the SCI user.
202e301370aSEdmund Nadolski 	 * It indicates the users view of the io request completion.
203f1f52e75SDan Williams 	 */
204f1f52e75SDan Williams 	u32 sci_status;
205f1f52e75SDan Williams 
206e301370aSEdmund Nadolski 	/*
207e301370aSEdmund Nadolski 	 * This field contains the value to be utilized when posting
208e301370aSEdmund Nadolski 	 * (e.g. Post_TC, * Post_TC_Abort) this request to the silicon.
209f1f52e75SDan Williams 	 */
210f1f52e75SDan Williams 	u32 post_context;
211f1f52e75SDan Williams 
212f1f52e75SDan Williams 	struct scu_task_context *task_context_buffer;
213f1f52e75SDan Williams 	struct scu_task_context tc ____cacheline_aligned;
214f1f52e75SDan Williams 
215f1f52e75SDan Williams 	/* could be larger with sg chaining */
2167c78da31SDan Williams 	#define SCU_SGL_SIZE ((SCI_MAX_SCATTER_GATHER_ELEMENTS + 1) / 2)
217f1f52e75SDan Williams 	struct scu_sgl_element_pair sg_table[SCU_SGL_SIZE] __attribute__ ((aligned(32)));
218f1f52e75SDan Williams 
219e301370aSEdmund Nadolski 	/*
220f1f52e75SDan Williams 	 * This field indicates if this request is a task management request or
221f1f52e75SDan Williams 	 * normal IO request.
222f1f52e75SDan Williams 	 */
223f1f52e75SDan Williams 	bool is_task_management_request;
224f1f52e75SDan Williams 
225e301370aSEdmund Nadolski 	/*
226e301370aSEdmund Nadolski 	 * This field is a pointer to the stored rx frame data.  It is used in
227e301370aSEdmund Nadolski 	 * STP internal requests and SMP response frames.  If this field is
228e301370aSEdmund Nadolski 	 * non-NULL the saved frame must be released on IO request completion.
229f1f52e75SDan Williams 	 *
230f1f52e75SDan Williams 	 * @todo In the future do we want to keep a list of RX frame buffers?
231f1f52e75SDan Williams 	 */
232f1f52e75SDan Williams 	u32 saved_rx_frame_index;
233f1f52e75SDan Williams 
234e301370aSEdmund Nadolski 	/*
235e301370aSEdmund Nadolski 	 * This field in the recorded device sequence for the io request.
236e301370aSEdmund Nadolski 	 * This is recorded during the build operation and is compared in the
237e301370aSEdmund Nadolski 	 * start operation.  If the sequence is different then there was a
238e301370aSEdmund Nadolski 	 * change of devices from the build to start operations.
239f1f52e75SDan Williams 	 */
240f1f52e75SDan Williams 	u8 device_sequence;
241f1f52e75SDan Williams 
242f1f52e75SDan Williams 	union {
243f1f52e75SDan Williams 		struct {
244f1f52e75SDan Williams 			union {
245f1f52e75SDan Williams 				struct ssp_cmd_iu cmd;
246f1f52e75SDan Williams 				struct ssp_task_iu tmf;
247f1f52e75SDan Williams 			};
248f1f52e75SDan Williams 			union {
249f1f52e75SDan Williams 				struct ssp_response_iu rsp;
250f1f52e75SDan Williams 				u8 rsp_buf[SSP_RESP_IU_MAX_SIZE];
251f1f52e75SDan Williams 			};
252f1f52e75SDan Williams 		} ssp;
253f1f52e75SDan Williams 
254f1f52e75SDan Williams 		struct {
255f1f52e75SDan Williams 			struct smp_req cmd;
256f1f52e75SDan Williams 			struct smp_resp rsp;
257f1f52e75SDan Williams 		} smp;
258f1f52e75SDan Williams 
259f1f52e75SDan Williams 		struct {
260f1f52e75SDan Williams 			struct scic_sds_stp_request req;
261f1f52e75SDan Williams 			struct host_to_dev_fis cmd;
262f1f52e75SDan Williams 			struct dev_to_host_fis rsp;
263f1f52e75SDan Williams 		} stp;
264f1f52e75SDan Williams 	};
265f1f52e75SDan Williams 
266f1f52e75SDan Williams };
267f1f52e75SDan Williams 
268f1f52e75SDan Williams static inline struct scic_sds_request *to_sci_req(struct scic_sds_stp_request *stp_req)
269f1f52e75SDan Williams {
270f1f52e75SDan Williams 	struct scic_sds_request *sci_req;
271f1f52e75SDan Williams 
272f1f52e75SDan Williams 	sci_req = container_of(stp_req, typeof(*sci_req), stp.req);
273f1f52e75SDan Williams 	return sci_req;
274f1f52e75SDan Williams }
275f1f52e75SDan Williams 
2766f231ddaSDan Williams struct isci_request {
2776f231ddaSDan Williams 	enum isci_request_status status;
2786f231ddaSDan Williams 	enum task_type ttype;
2796f231ddaSDan Williams 	unsigned short io_tag;
2806f231ddaSDan Williams 	bool complete_in_target;
28167ea838dSDan Williams 	bool terminated;
2826f231ddaSDan Williams 
2836f231ddaSDan Williams 	union ttype_ptr_union {
2846f231ddaSDan Williams 		struct sas_task *io_task_ptr;   /* When ttype==io_task  */
2856f231ddaSDan Williams 		struct isci_tmf *tmf_task_ptr;  /* When ttype==tmf_task */
2866f231ddaSDan Williams 	} ttype_ptr;
2876f231ddaSDan Williams 	struct isci_host *isci_host;
2886f231ddaSDan Williams 	/* For use in the requests_to_{complete|abort} lists: */
2896f231ddaSDan Williams 	struct list_head completed_node;
2906f231ddaSDan Williams 	/* For use in the reqs_in_process list: */
2916f231ddaSDan Williams 	struct list_head dev_node;
2926f231ddaSDan Williams 	spinlock_t state_lock;
2936f231ddaSDan Williams 	dma_addr_t request_daddr;
2946f231ddaSDan Williams 	dma_addr_t zero_scatter_daddr;
2956f231ddaSDan Williams 
2966f231ddaSDan Williams 	unsigned int num_sg_entries;			/* returned by pci_alloc_sg */
2976f231ddaSDan Williams 
2986f231ddaSDan Williams 	/** Note: "io_request_completion" is completed in two different ways
2996f231ddaSDan Williams 	 * depending on whether this is a TMF or regular request.
3006f231ddaSDan Williams 	 * - TMF requests are completed in the thread that started them;
3016f231ddaSDan Williams 	 * - regular requests are completed in the request completion callback
3026f231ddaSDan Williams 	 *   function.
3036f231ddaSDan Williams 	 * This difference in operation allows the aborter of a TMF request
3046f231ddaSDan Williams 	 * to be sure that once the TMF request completes, the I/O that the
3056f231ddaSDan Williams 	 * TMF was aborting is guaranteed to have completed.
3066f231ddaSDan Williams 	 */
3076f231ddaSDan Williams 	struct completion *io_request_completion;
30867ea838dSDan Williams 	struct scic_sds_request sci;
3096f231ddaSDan Williams };
3106f231ddaSDan Williams 
31167ea838dSDan Williams static inline struct isci_request *sci_req_to_ireq(struct scic_sds_request *sci_req)
31267ea838dSDan Williams {
31367ea838dSDan Williams 	struct isci_request *ireq = container_of(sci_req, typeof(*ireq), sci);
31467ea838dSDan Williams 
31567ea838dSDan Williams 	return ireq;
31667ea838dSDan Williams }
31767ea838dSDan Williams 
3186f231ddaSDan Williams /**
319f1f52e75SDan Williams  * enum sci_base_request_states - This enumeration depicts all the states for
320f1f52e75SDan Williams  *    the common request state machine.
321f1f52e75SDan Williams  *
322f1f52e75SDan Williams  *
323f1f52e75SDan Williams  */
324f1f52e75SDan Williams enum sci_base_request_states {
325e301370aSEdmund Nadolski 	/*
326f1f52e75SDan Williams 	 * Simply the initial state for the base request state machine.
327f1f52e75SDan Williams 	 */
328e301370aSEdmund Nadolski 	SCI_REQ_INIT,
329f1f52e75SDan Williams 
330e301370aSEdmund Nadolski 	/*
331e301370aSEdmund Nadolski 	 * This state indicates that the request has been constructed.
332e301370aSEdmund Nadolski 	 * This state is entered from the INITIAL state.
333f1f52e75SDan Williams 	 */
334e301370aSEdmund Nadolski 	SCI_REQ_CONSTRUCTED,
335f1f52e75SDan Williams 
336e301370aSEdmund Nadolski 	/*
337e301370aSEdmund Nadolski 	 * This state indicates that the request has been started. This state
338e301370aSEdmund Nadolski 	 * is entered from the CONSTRUCTED state.
339f1f52e75SDan Williams 	 */
340e301370aSEdmund Nadolski 	SCI_REQ_STARTED,
341f1f52e75SDan Williams 
342e301370aSEdmund Nadolski 	SCI_REQ_STP_UDMA_WAIT_TC_COMP,
343e301370aSEdmund Nadolski 	SCI_REQ_STP_UDMA_WAIT_D2H,
3445dec6f4eSDan Williams 
345e301370aSEdmund Nadolski 	SCI_REQ_STP_NON_DATA_WAIT_H2D,
346e301370aSEdmund Nadolski 	SCI_REQ_STP_NON_DATA_WAIT_D2H,
3475dec6f4eSDan Williams 
348e301370aSEdmund Nadolski 	SCI_REQ_STP_SOFT_RESET_WAIT_H2D_ASSERTED,
349e301370aSEdmund Nadolski 	SCI_REQ_STP_SOFT_RESET_WAIT_H2D_DIAG,
350e301370aSEdmund Nadolski 	SCI_REQ_STP_SOFT_RESET_WAIT_D2H,
3515dec6f4eSDan Williams 
352e301370aSEdmund Nadolski 	/*
353e301370aSEdmund Nadolski 	 * While in this state the IO request object is waiting for the TC
354e301370aSEdmund Nadolski 	 * completion notification for the H2D Register FIS
3555dec6f4eSDan Williams 	 */
356e301370aSEdmund Nadolski 	SCI_REQ_STP_PIO_WAIT_H2D,
3575dec6f4eSDan Williams 
358e301370aSEdmund Nadolski 	/*
359e301370aSEdmund Nadolski 	 * While in this state the IO request object is waiting for either a
360e301370aSEdmund Nadolski 	 * PIO Setup FIS or a D2H register FIS.  The type of frame received is
361e301370aSEdmund Nadolski 	 * based on the result of the prior frame and line conditions.
3625dec6f4eSDan Williams 	 */
363e301370aSEdmund Nadolski 	SCI_REQ_STP_PIO_WAIT_FRAME,
3645dec6f4eSDan Williams 
365e301370aSEdmund Nadolski 	/*
366e301370aSEdmund Nadolski 	 * While in this state the IO request object is waiting for a DATA
367e301370aSEdmund Nadolski 	 * frame from the device.
3685dec6f4eSDan Williams 	 */
369e301370aSEdmund Nadolski 	SCI_REQ_STP_PIO_DATA_IN,
3705dec6f4eSDan Williams 
371e301370aSEdmund Nadolski 	/*
372e301370aSEdmund Nadolski 	 * While in this state the IO request object is waiting to transmit
373e301370aSEdmund Nadolski 	 * the next data frame to the device.
3745dec6f4eSDan Williams 	 */
375e301370aSEdmund Nadolski 	SCI_REQ_STP_PIO_DATA_OUT,
3765dec6f4eSDan Williams 
377e301370aSEdmund Nadolski 	/*
378f139303dSDan Williams 	 * The AWAIT_TC_COMPLETION sub-state indicates that the started raw
379f139303dSDan Williams 	 * task management request is waiting for the transmission of the
380f139303dSDan Williams 	 * initial frame (i.e. command, task, etc.).
381f139303dSDan Williams 	 */
382e301370aSEdmund Nadolski 	SCI_REQ_TASK_WAIT_TC_COMP,
383f139303dSDan Williams 
384e301370aSEdmund Nadolski 	/*
385f139303dSDan Williams 	 * This sub-state indicates that the started task management request
386f139303dSDan Williams 	 * is waiting for the reception of an unsolicited frame
387f139303dSDan Williams 	 * (i.e. response IU).
388f139303dSDan Williams 	 */
389e301370aSEdmund Nadolski 	SCI_REQ_TASK_WAIT_TC_RESP,
390f139303dSDan Williams 
391e301370aSEdmund Nadolski 	/*
392c72086e3SDan Williams 	 * This sub-state indicates that the started task management request
393c72086e3SDan Williams 	 * is waiting for the reception of an unsolicited frame
394c72086e3SDan Williams 	 * (i.e. response IU).
395c72086e3SDan Williams 	 */
396e301370aSEdmund Nadolski 	SCI_REQ_SMP_WAIT_RESP,
397c72086e3SDan Williams 
398e301370aSEdmund Nadolski 	/*
399e301370aSEdmund Nadolski 	 * The AWAIT_TC_COMPLETION sub-state indicates that the started SMP
400e301370aSEdmund Nadolski 	 * request is waiting for the transmission of the initial frame
401e301370aSEdmund Nadolski 	 * (i.e. command, task, etc.).
402c72086e3SDan Williams 	 */
403e301370aSEdmund Nadolski 	SCI_REQ_SMP_WAIT_TC_COMP,
404c72086e3SDan Williams 
405e301370aSEdmund Nadolski 	/*
406f1f52e75SDan Williams 	 * This state indicates that the request has completed.
407e301370aSEdmund Nadolski 	 * This state is entered from the STARTED state. This state is entered
408e301370aSEdmund Nadolski 	 * from the ABORTING state.
409f1f52e75SDan Williams 	 */
410e301370aSEdmund Nadolski 	SCI_REQ_COMPLETED,
411f1f52e75SDan Williams 
412e301370aSEdmund Nadolski 	/*
413f1f52e75SDan Williams 	 * This state indicates that the request is in the process of being
414f1f52e75SDan Williams 	 * terminated/aborted.
415f1f52e75SDan Williams 	 * This state is entered from the CONSTRUCTED state.
416f1f52e75SDan Williams 	 * This state is entered from the STARTED state.
417f1f52e75SDan Williams 	 */
418e301370aSEdmund Nadolski 	SCI_REQ_ABORTING,
419f1f52e75SDan Williams 
420e301370aSEdmund Nadolski 	/*
421f1f52e75SDan Williams 	 * Simply the final state for the base request state machine.
422f1f52e75SDan Williams 	 */
423e301370aSEdmund Nadolski 	SCI_REQ_FINAL,
424f1f52e75SDan Williams };
425f1f52e75SDan Williams 
426f1f52e75SDan Williams /**
427f1f52e75SDan Williams  * scic_sds_request_get_controller() -
428f1f52e75SDan Williams  *
429f1f52e75SDan Williams  * This macro will return the controller for this io request object
430f1f52e75SDan Williams  */
431f1f52e75SDan Williams #define scic_sds_request_get_controller(sci_req) \
432f1f52e75SDan Williams 	((sci_req)->owning_controller)
433f1f52e75SDan Williams 
434f1f52e75SDan Williams /**
435f1f52e75SDan Williams  * scic_sds_request_get_device() -
436f1f52e75SDan Williams  *
437f1f52e75SDan Williams  * This macro will return the device for this io request object
438f1f52e75SDan Williams  */
439f1f52e75SDan Williams #define scic_sds_request_get_device(sci_req) \
440f1f52e75SDan Williams 	((sci_req)->target_device)
441f1f52e75SDan Williams 
442f1f52e75SDan Williams /**
443f1f52e75SDan Williams  * scic_sds_request_get_port() -
444f1f52e75SDan Williams  *
445f1f52e75SDan Williams  * This macro will return the port for this io request object
446f1f52e75SDan Williams  */
447f1f52e75SDan Williams #define scic_sds_request_get_port(sci_req)	\
448f1f52e75SDan Williams 	scic_sds_remote_device_get_port(scic_sds_request_get_device(sci_req))
449f1f52e75SDan Williams 
450f1f52e75SDan Williams /**
451f1f52e75SDan Williams  * scic_sds_request_get_post_context() -
452f1f52e75SDan Williams  *
453f1f52e75SDan Williams  * This macro returns the constructed post context result for the io request.
454f1f52e75SDan Williams  */
455f1f52e75SDan Williams #define scic_sds_request_get_post_context(sci_req)	\
456f1f52e75SDan Williams 	((sci_req)->post_context)
457f1f52e75SDan Williams 
458f1f52e75SDan Williams /**
459f1f52e75SDan Williams  * scic_sds_request_get_task_context() -
460f1f52e75SDan Williams  *
461f1f52e75SDan Williams  * This is a helper macro to return the os handle for this request object.
462f1f52e75SDan Williams  */
463f1f52e75SDan Williams #define scic_sds_request_get_task_context(request) \
464f1f52e75SDan Williams 	((request)->task_context_buffer)
465f1f52e75SDan Williams 
466f1f52e75SDan Williams /**
467f1f52e75SDan Williams  * scic_sds_request_set_status() -
468f1f52e75SDan Williams  *
469f1f52e75SDan Williams  * This macro will set the scu hardware status and sci request completion
470f1f52e75SDan Williams  * status for an io request.
471f1f52e75SDan Williams  */
472f1f52e75SDan Williams #define scic_sds_request_set_status(request, scu_status_code, sci_status_code) \
473f1f52e75SDan Williams 	{ \
474f1f52e75SDan Williams 		(request)->scu_status = (scu_status_code); \
475f1f52e75SDan Williams 		(request)->sci_status = (sci_status_code); \
476f1f52e75SDan Williams 	}
477f1f52e75SDan Williams 
478f1f52e75SDan Williams /**
479f1f52e75SDan Williams  * SCU_SGL_ZERO() -
480f1f52e75SDan Williams  *
481f1f52e75SDan Williams  * This macro zeros the hardware SGL element data
482f1f52e75SDan Williams  */
483f1f52e75SDan Williams #define SCU_SGL_ZERO(scu_sge) \
484f1f52e75SDan Williams 	{ \
485f1f52e75SDan Williams 		(scu_sge).length = 0; \
486f1f52e75SDan Williams 		(scu_sge).address_lower = 0; \
487f1f52e75SDan Williams 		(scu_sge).address_upper = 0; \
488f1f52e75SDan Williams 		(scu_sge).address_modifier = 0;	\
489f1f52e75SDan Williams 	}
490f1f52e75SDan Williams 
491f1f52e75SDan Williams /**
492f1f52e75SDan Williams  * SCU_SGL_COPY() -
493f1f52e75SDan Williams  *
494f1f52e75SDan Williams  * This macro copys the SGL Element data from the host os to the hardware SGL
495f1f52e75SDan Williams  * elment data
496f1f52e75SDan Williams  */
497f1f52e75SDan Williams #define SCU_SGL_COPY(scu_sge, os_sge) \
498f1f52e75SDan Williams 	{ \
499f1f52e75SDan Williams 		(scu_sge).length = sg_dma_len(sg); \
500f1f52e75SDan Williams 		(scu_sge).address_upper = \
501f1f52e75SDan Williams 			upper_32_bits(sg_dma_address(sg)); \
502f1f52e75SDan Williams 		(scu_sge).address_lower = \
503f1f52e75SDan Williams 			lower_32_bits(sg_dma_address(sg)); \
504f1f52e75SDan Williams 		(scu_sge).address_modifier = 0;	\
505f1f52e75SDan Williams 	}
506f1f52e75SDan Williams 
507f1f52e75SDan Williams enum sci_status scic_sds_request_start(struct scic_sds_request *sci_req);
508f1f52e75SDan Williams enum sci_status scic_sds_io_request_terminate(struct scic_sds_request *sci_req);
509e301370aSEdmund Nadolski enum sci_status
510e301370aSEdmund Nadolski scic_sds_io_request_event_handler(struct scic_sds_request *sci_req,
511f1f52e75SDan Williams 				  u32 event_code);
512e301370aSEdmund Nadolski enum sci_status
513e301370aSEdmund Nadolski scic_sds_io_request_frame_handler(struct scic_sds_request *sci_req,
514f1f52e75SDan Williams 				  u32 frame_index);
515e301370aSEdmund Nadolski enum sci_status
516e301370aSEdmund Nadolski scic_sds_task_request_terminate(struct scic_sds_request *sci_req);
517e301370aSEdmund Nadolski extern enum sci_status
518e301370aSEdmund Nadolski scic_sds_request_complete(struct scic_sds_request *sci_req);
519e301370aSEdmund Nadolski extern enum sci_status
520e301370aSEdmund Nadolski scic_sds_io_request_tc_completion(struct scic_sds_request *sci_req, u32 code);
521f1f52e75SDan Williams 
522f1f52e75SDan Williams /* XXX open code in caller */
523f1f52e75SDan Williams static inline void *scic_request_get_virt_addr(struct scic_sds_request *sci_req,
524f1f52e75SDan Williams 					       dma_addr_t phys_addr)
525f1f52e75SDan Williams {
526f1f52e75SDan Williams 	struct isci_request *ireq = sci_req_to_ireq(sci_req);
527f1f52e75SDan Williams 	dma_addr_t offset;
528f1f52e75SDan Williams 
529f1f52e75SDan Williams 	BUG_ON(phys_addr < ireq->request_daddr);
530f1f52e75SDan Williams 
531f1f52e75SDan Williams 	offset = phys_addr - ireq->request_daddr;
532f1f52e75SDan Williams 
533f1f52e75SDan Williams 	BUG_ON(offset >= sizeof(*ireq));
534f1f52e75SDan Williams 
535f1f52e75SDan Williams 	return (char *)ireq + offset;
536f1f52e75SDan Williams }
537f1f52e75SDan Williams 
538f1f52e75SDan Williams /* XXX open code in caller */
539e301370aSEdmund Nadolski static inline dma_addr_t
540e301370aSEdmund Nadolski scic_io_request_get_dma_addr(struct scic_sds_request *sci_req, void *virt_addr)
541f1f52e75SDan Williams {
542f1f52e75SDan Williams 	struct isci_request *ireq = sci_req_to_ireq(sci_req);
543f1f52e75SDan Williams 
544f1f52e75SDan Williams 	char *requested_addr = (char *)virt_addr;
545f1f52e75SDan Williams 	char *base_addr = (char *)ireq;
546f1f52e75SDan Williams 
547f1f52e75SDan Williams 	BUG_ON(requested_addr < base_addr);
548f1f52e75SDan Williams 	BUG_ON((requested_addr - base_addr) >= sizeof(*ireq));
549f1f52e75SDan Williams 
550f1f52e75SDan Williams 	return ireq->request_daddr + (requested_addr - base_addr);
551f1f52e75SDan Williams }
552f1f52e75SDan Williams 
553f1f52e75SDan Williams /**
5546f231ddaSDan Williams  * This function gets the status of the request object.
5556f231ddaSDan Williams  * @request: This parameter points to the isci_request object
5566f231ddaSDan Williams  *
5576f231ddaSDan Williams  * status of the object as a isci_request_status enum.
5586f231ddaSDan Williams  */
559e301370aSEdmund Nadolski static inline enum isci_request_status
560e301370aSEdmund Nadolski isci_request_get_state(struct isci_request *isci_request)
5616f231ddaSDan Williams {
5626f231ddaSDan Williams 	BUG_ON(isci_request == NULL);
5636f231ddaSDan Williams 
5646f231ddaSDan Williams 	/*probably a bad sign...	*/
5656f231ddaSDan Williams 	if (isci_request->status == unallocated)
5666f231ddaSDan Williams 		dev_warn(&isci_request->isci_host->pdev->dev,
5676f231ddaSDan Williams 			 "%s: isci_request->status == unallocated\n",
5686f231ddaSDan Williams 			 __func__);
5696f231ddaSDan Williams 
5706f231ddaSDan Williams 	return isci_request->status;
5716f231ddaSDan Williams }
5726f231ddaSDan Williams 
5736f231ddaSDan Williams 
5746f231ddaSDan Williams /**
5756f231ddaSDan Williams  * isci_request_change_state() - This function sets the status of the request
5766f231ddaSDan Williams  *    object.
5776f231ddaSDan Williams  * @request: This parameter points to the isci_request object
5786f231ddaSDan Williams  * @status: This Parameter is the new status of the object
5796f231ddaSDan Williams  *
5806f231ddaSDan Williams  */
581e301370aSEdmund Nadolski static inline enum isci_request_status
582e301370aSEdmund Nadolski isci_request_change_state(struct isci_request *isci_request,
5836f231ddaSDan Williams 			  enum isci_request_status status)
5846f231ddaSDan Williams {
5856f231ddaSDan Williams 	enum isci_request_status old_state;
5866f231ddaSDan Williams 	unsigned long flags;
5876f231ddaSDan Williams 
5886f231ddaSDan Williams 	dev_dbg(&isci_request->isci_host->pdev->dev,
5896f231ddaSDan Williams 		"%s: isci_request = %p, state = 0x%x\n",
5906f231ddaSDan Williams 		__func__,
5916f231ddaSDan Williams 		isci_request,
5926f231ddaSDan Williams 		status);
5936f231ddaSDan Williams 
5946f231ddaSDan Williams 	BUG_ON(isci_request == NULL);
5956f231ddaSDan Williams 
5966f231ddaSDan Williams 	spin_lock_irqsave(&isci_request->state_lock, flags);
5976f231ddaSDan Williams 	old_state = isci_request->status;
5986f231ddaSDan Williams 	isci_request->status = status;
5996f231ddaSDan Williams 	spin_unlock_irqrestore(&isci_request->state_lock, flags);
6006f231ddaSDan Williams 
6016f231ddaSDan Williams 	return old_state;
6026f231ddaSDan Williams }
6036f231ddaSDan Williams 
6046f231ddaSDan Williams /**
6056f231ddaSDan Williams  * isci_request_change_started_to_newstate() - This function sets the status of
6066f231ddaSDan Williams  *    the request object.
6076f231ddaSDan Williams  * @request: This parameter points to the isci_request object
6086f231ddaSDan Williams  * @status: This Parameter is the new status of the object
6096f231ddaSDan Williams  *
6106f231ddaSDan Williams  * state previous to any change.
6116f231ddaSDan Williams  */
612e301370aSEdmund Nadolski static inline enum isci_request_status
613e301370aSEdmund Nadolski isci_request_change_started_to_newstate(struct isci_request *isci_request,
6146f231ddaSDan Williams 					struct completion *completion_ptr,
6156f231ddaSDan Williams 					enum isci_request_status newstate)
6166f231ddaSDan Williams {
6176f231ddaSDan Williams 	enum isci_request_status old_state;
6186f231ddaSDan Williams 	unsigned long flags;
6196f231ddaSDan Williams 
6206f231ddaSDan Williams 	spin_lock_irqsave(&isci_request->state_lock, flags);
6216f231ddaSDan Williams 
6226f231ddaSDan Williams 	old_state = isci_request->status;
6236f231ddaSDan Williams 
624f219f010SJeff Skirvin 	if (old_state == started || old_state == aborting) {
6256f231ddaSDan Williams 		BUG_ON(isci_request->io_request_completion != NULL);
6266f231ddaSDan Williams 
6276f231ddaSDan Williams 		isci_request->io_request_completion = completion_ptr;
6286f231ddaSDan Williams 		isci_request->status = newstate;
6296f231ddaSDan Williams 	}
630e301370aSEdmund Nadolski 
6316f231ddaSDan Williams 	spin_unlock_irqrestore(&isci_request->state_lock, flags);
6326f231ddaSDan Williams 
6336f231ddaSDan Williams 	dev_dbg(&isci_request->isci_host->pdev->dev,
6346f231ddaSDan Williams 		"%s: isci_request = %p, old_state = 0x%x\n",
6356f231ddaSDan Williams 		__func__,
6366f231ddaSDan Williams 		isci_request,
6376f231ddaSDan Williams 		old_state);
6386f231ddaSDan Williams 
6396f231ddaSDan Williams 	return old_state;
6406f231ddaSDan Williams }
6416f231ddaSDan Williams 
6426f231ddaSDan Williams /**
6436f231ddaSDan Williams  * isci_request_change_started_to_aborted() - This function sets the status of
6446f231ddaSDan Williams  *    the request object.
6456f231ddaSDan Williams  * @request: This parameter points to the isci_request object
6466f231ddaSDan Williams  * @completion_ptr: This parameter is saved as the kernel completion structure
6476f231ddaSDan Williams  *    signalled when the old request completes.
6486f231ddaSDan Williams  *
6496f231ddaSDan Williams  * state previous to any change.
6506f231ddaSDan Williams  */
651e301370aSEdmund Nadolski static inline enum isci_request_status
652e301370aSEdmund Nadolski isci_request_change_started_to_aborted(struct isci_request *isci_request,
6536f231ddaSDan Williams 				       struct completion *completion_ptr)
6546f231ddaSDan Williams {
655e301370aSEdmund Nadolski 	return isci_request_change_started_to_newstate(isci_request,
656e301370aSEdmund Nadolski 						       completion_ptr,
657e301370aSEdmund Nadolski 						       aborted);
6586f231ddaSDan Williams }
6596f231ddaSDan Williams /**
6606f231ddaSDan Williams  * isci_request_free() - This function frees the request object.
6616f231ddaSDan Williams  * @isci_host: This parameter specifies the ISCI host object
6626f231ddaSDan Williams  * @isci_request: This parameter points to the isci_request object
6636f231ddaSDan Williams  *
6646f231ddaSDan Williams  */
665e301370aSEdmund Nadolski static inline void isci_request_free(struct isci_host *isci_host,
6666f231ddaSDan Williams 				     struct isci_request *isci_request)
6676f231ddaSDan Williams {
6686cb4d6b3SBartosz Barcinski 	if (!isci_request)
6696cb4d6b3SBartosz Barcinski 		return;
6706f231ddaSDan Williams 
6716f231ddaSDan Williams 	/* release the dma memory if we fail. */
672e301370aSEdmund Nadolski 	dma_pool_free(isci_host->dma_pool,
673e301370aSEdmund Nadolski 		      isci_request,
6746f231ddaSDan Williams 		      isci_request->request_daddr);
6756f231ddaSDan Williams }
6766f231ddaSDan Williams 
677e301370aSEdmund Nadolski #define isci_request_access_task(req) ((req)->ttype_ptr.io_task_ptr)
6786f231ddaSDan Williams 
679e301370aSEdmund Nadolski #define isci_request_access_tmf(req) ((req)->ttype_ptr.tmf_task_ptr)
6806f231ddaSDan Williams 
6810d0cf14cSDan Williams struct isci_request *isci_request_alloc_tmf(struct isci_host *ihost,
6826f231ddaSDan Williams 					    struct isci_tmf *isci_tmf,
6836f231ddaSDan Williams 					    gfp_t gfp_flags);
6846f231ddaSDan Williams 
685*209fae14SDan Williams int isci_request_execute(struct isci_host *ihost, struct isci_remote_device *idev,
686*209fae14SDan Williams 			 struct sas_task *task, gfp_t gfp_flags);
6876f231ddaSDan Williams 
6886f231ddaSDan Williams /**
6896f231ddaSDan Williams  * isci_request_unmap_sgl() - This function unmaps the DMA address of a given
6906f231ddaSDan Williams  *    sgl
6916f231ddaSDan Williams  * @request: This parameter points to the isci_request object
6926f231ddaSDan Williams  * @*pdev: This Parameter is the pci_device struct for the controller
6936f231ddaSDan Williams  *
6946f231ddaSDan Williams  */
695e301370aSEdmund Nadolski static inline void
696e301370aSEdmund Nadolski isci_request_unmap_sgl(struct isci_request *request, struct pci_dev *pdev)
6976f231ddaSDan Williams {
6986f231ddaSDan Williams 	struct sas_task *task = isci_request_access_task(request);
6996f231ddaSDan Williams 
7006f231ddaSDan Williams 	dev_dbg(&request->isci_host->pdev->dev,
7016f231ddaSDan Williams 		"%s: request = %p, task = %p,\n"
7026f231ddaSDan Williams 		"task->data_dir = %d, is_sata = %d\n ",
7036f231ddaSDan Williams 		__func__,
7046f231ddaSDan Williams 		request,
7056f231ddaSDan Williams 		task,
7066f231ddaSDan Williams 		task->data_dir,
7076f231ddaSDan Williams 		sas_protocol_ata(task->task_proto));
7086f231ddaSDan Williams 
7096f231ddaSDan Williams 	if ((task->data_dir != PCI_DMA_NONE) &&
7106f231ddaSDan Williams 	    !sas_protocol_ata(task->task_proto)) {
7116f231ddaSDan Williams 		if (task->num_scatter == 0)
7126f231ddaSDan Williams 			/* 0 indicates a single dma address */
7136f231ddaSDan Williams 			dma_unmap_single(
7146f231ddaSDan Williams 				&pdev->dev,
7156f231ddaSDan Williams 				request->zero_scatter_daddr,
7166f231ddaSDan Williams 				task->total_xfer_len,
7176f231ddaSDan Williams 				task->data_dir
7186f231ddaSDan Williams 				);
7196f231ddaSDan Williams 
7206f231ddaSDan Williams 		else  /* unmap the sgl dma addresses */
7216f231ddaSDan Williams 			dma_unmap_sg(
7226f231ddaSDan Williams 				&pdev->dev,
7236f231ddaSDan Williams 				task->scatter,
7246f231ddaSDan Williams 				request->num_sg_entries,
7256f231ddaSDan Williams 				task->data_dir
7266f231ddaSDan Williams 				);
7276f231ddaSDan Williams 	}
7286f231ddaSDan Williams }
7296f231ddaSDan Williams 
7306f231ddaSDan Williams /**
7316f231ddaSDan Williams  * isci_request_io_request_get_next_sge() - This function is called by the sci
7326f231ddaSDan Williams  *    core to retrieve the next sge for a given request.
7336f231ddaSDan Williams  * @request: This parameter is the isci_request object.
7346f231ddaSDan Williams  * @current_sge_address: This parameter is the last sge retrieved by the sci
7356f231ddaSDan Williams  *    core for this request.
7366f231ddaSDan Williams  *
7376f231ddaSDan Williams  * pointer to the next sge for specified request.
7386f231ddaSDan Williams  */
739e301370aSEdmund Nadolski static inline void *
740e301370aSEdmund Nadolski isci_request_io_request_get_next_sge(struct isci_request *request,
7416f231ddaSDan Williams 				     void *current_sge_address)
7426f231ddaSDan Williams {
7436f231ddaSDan Williams 	struct sas_task *task = isci_request_access_task(request);
7446f231ddaSDan Williams 	void *ret = NULL;
7456f231ddaSDan Williams 
7466f231ddaSDan Williams 	dev_dbg(&request->isci_host->pdev->dev,
7476f231ddaSDan Williams 		"%s: request = %p, "
7486f231ddaSDan Williams 		"current_sge_address = %p, "
7496f231ddaSDan Williams 		"num_scatter = %d\n",
7506f231ddaSDan Williams 		__func__,
7516f231ddaSDan Williams 		request,
7526f231ddaSDan Williams 		current_sge_address,
7536f231ddaSDan Williams 		task->num_scatter);
7546f231ddaSDan Williams 
7556f231ddaSDan Williams 	if (!current_sge_address)	/* First time through.. */
7566f231ddaSDan Williams 		ret = task->scatter;    /* always task->scatter */
7576f231ddaSDan Williams 	else if (task->num_scatter == 0) /* Next element, if num_scatter == 0 */
7586f231ddaSDan Williams 		ret = NULL;              /* there is only one element. */
7596f231ddaSDan Williams 	else
7606f231ddaSDan Williams 		ret = sg_next(current_sge_address);     /* sg_next returns NULL
7616f231ddaSDan Williams 							 * for the last element
7626f231ddaSDan Williams 							 */
7636f231ddaSDan Williams 
7646f231ddaSDan Williams 	dev_dbg(&request->isci_host->pdev->dev,
7656f231ddaSDan Williams 		"%s: next sge address = %p\n",
7666f231ddaSDan Williams 		__func__,
7676f231ddaSDan Williams 		ret);
7686f231ddaSDan Williams 
7696f231ddaSDan Williams 	return ret;
7706f231ddaSDan Williams }
7716f231ddaSDan Williams 
772e301370aSEdmund Nadolski void
773980d3aebSDan Williams isci_terminate_pending_requests(struct isci_host *ihost,
774980d3aebSDan Williams 				struct isci_remote_device *idev);
775e301370aSEdmund Nadolski enum sci_status
776e301370aSEdmund Nadolski scic_task_request_construct(struct scic_sds_controller *scic,
777f1f52e75SDan Williams 			    struct scic_sds_remote_device *sci_dev,
778f1f52e75SDan Williams 			    u16 io_tag,
779f1f52e75SDan Williams 			    struct scic_sds_request *sci_req);
780e301370aSEdmund Nadolski enum sci_status
781e301370aSEdmund Nadolski scic_task_request_construct_ssp(struct scic_sds_request *sci_req);
782e301370aSEdmund Nadolski enum sci_status
783e301370aSEdmund Nadolski scic_task_request_construct_sata(struct scic_sds_request *sci_req);
784e301370aSEdmund Nadolski void
785e301370aSEdmund Nadolski scic_stp_io_request_set_ncq_tag(struct scic_sds_request *sci_req, u16 ncq_tag);
786f1f52e75SDan Williams void scic_sds_smp_request_copy_response(struct scic_sds_request *sci_req);
7876f231ddaSDan Williams #endif /* !defined(_ISCI_REQUEST_H_) */
788