isci: move stp request info to scic_sds_request
[linux-2.6/x86.git] / drivers / scsi / isci / core / scic_sds_stp_request.h
blob6d02030b6cd68250c003712c845331a62cc47577
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.
5 * GPL LICENSE SUMMARY
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.
24 * BSD LICENSE
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
31 * are met:
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.
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.
56 #ifndef _SCIC_SDS_STP_REQUEST_T_
57 #define _SCIC_SDS_STP_REQUEST_T_
59 #include <linux/dma-mapping.h>
60 #include <scsi/sas.h>
62 struct scic_sds_stp_request {
63 struct dev_to_host_fis d2h_reg_fis;
65 union {
66 u32 ncq;
68 u32 udma;
70 struct scic_sds_stp_pio_request {
71 /**
72 * Total transfer for the entire PIO request recorded at request constuction
73 * time.
75 * @todo Should we just decrement this value for each byte of data transitted
76 * or received to elemenate the current_transfer_bytes field?
78 u32 total_transfer_bytes;
80 /**
81 * Total number of bytes received/transmitted in data frames since the start
82 * of the IO request. At the end of the IO request this should equal the
83 * total_transfer_bytes.
85 u32 current_transfer_bytes;
87 /**
88 * The number of bytes requested in the in the PIO setup.
90 u32 pio_transfer_bytes;
92 /**
93 * PIO Setup ending status value to tell us if we need to wait for another FIS
94 * or if the transfer is complete. On the receipt of a D2H FIS this will be
95 * the status field of that FIS.
97 u8 ending_status;
99 /**
100 * On receipt of a D2H FIS this will be the ending error field if the
101 * ending_status has the SATA_STATUS_ERR bit set.
103 u8 ending_error;
105 struct scic_sds_request_pio_sgl {
106 struct scu_sgl_element_pair *sgl_pair;
107 u8 sgl_set;
108 u32 sgl_offset;
109 } request_current;
110 } pio;
112 struct {
114 * The number of bytes requested in the PIO setup before CDB data frame.
116 u32 device_preferred_cdb_length;
117 } packet;
118 } type;
122 * enum scic_sds_stp_request_started_udma_substates - This enumeration depicts
123 * the various sub-states associated with a SATA/STP UDMA protocol operation.
127 enum scic_sds_stp_request_started_udma_substates {
128 SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE,
129 SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE,
133 * enum scic_sds_stp_request_started_non_data_substates - This enumeration
134 * depicts the various sub-states associated with a SATA/STP non-data
135 * protocol operation.
139 enum scic_sds_stp_request_started_non_data_substates {
140 SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE,
141 SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE,
145 * enum scic_sds_stp_request_started_soft_reset_substates - THis enumeration
146 * depicts the various sub-states associated with a SATA/STP soft reset
147 * operation.
151 enum scic_sds_stp_request_started_soft_reset_substates {
152 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE,
153 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE,
154 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE,
157 u32 scic_sds_stp_request_get_object_size(void);
159 enum sci_status scic_sds_stp_pio_request_construct(
160 struct scic_sds_request *scic_io_request,
161 bool copy_rx_frame);
163 enum sci_status scic_sds_stp_udma_request_construct(
164 struct scic_sds_request *sci_req,
165 u32 transfer_length,
166 enum dma_data_direction dir);
168 enum sci_status scic_sds_stp_non_data_request_construct(
169 struct scic_sds_request *sci_req);
171 enum sci_status scic_sds_stp_soft_reset_request_construct(
172 struct scic_sds_request *sci_req);
174 enum sci_status scic_sds_stp_ncq_request_construct(
175 struct scic_sds_request *sci_req,
176 u32 transfer_length,
177 enum dma_data_direction dir);
180 #endif /* _SCIC_SDS_STP_REQUEST_T_ */