aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/request.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-05-10 05:28:49 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:47 -0400
commit5dec6f4e41340196d223caf922578c44dfe2295a (patch)
treedf5c8395f8cbabd1f4b77200b7e339cfbcd72e11 /drivers/scsi/isci/request.h
parentc72086e3c2897eaca5b99c005dd9844fdc784981 (diff)
isci: merge stp request substates into primary state machine
Remove usage of the request substate machine for stp requests, and kill the request substate infrastructure. Similar to the previous conversions this adds the substates to the primary state machine and arranges for the 'started' state to transition to the proper stp substate. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/request.h')
-rw-r--r--drivers/scsi/isci/request.h113
1 files changed, 95 insertions, 18 deletions
diff --git a/drivers/scsi/isci/request.h b/drivers/scsi/isci/request.h
index d090cb1a14d6..95b65891fc41 100644
--- a/drivers/scsi/isci/request.h
+++ b/drivers/scsi/isci/request.h
@@ -59,7 +59,6 @@
59#include "isci.h" 59#include "isci.h"
60#include "host.h" 60#include "host.h"
61#include "scu_task_context.h" 61#include "scu_task_context.h"
62#include "stp_request.h"
63 62
64/** 63/**
65 * struct isci_request_status - This enum defines the possible states of an I/O 64 * struct isci_request_status - This enum defines the possible states of an I/O
@@ -90,6 +89,63 @@ enum sci_request_protocol {
90 SCIC_STP_PROTOCOL 89 SCIC_STP_PROTOCOL
91}; /* XXX remove me, use sas_task.{dev|task_proto} instead */; 90}; /* XXX remove me, use sas_task.{dev|task_proto} instead */;
92 91
92struct scic_sds_stp_request {
93 union {
94 u32 ncq;
95
96 u32 udma;
97
98 struct scic_sds_stp_pio_request {
99 /**
100 * Total transfer for the entire PIO request recorded at request constuction
101 * time.
102 *
103 * @todo Should we just decrement this value for each byte of data transitted
104 * or received to elemenate the current_transfer_bytes field?
105 */
106 u32 total_transfer_bytes;
107
108 /**
109 * Total number of bytes received/transmitted in data frames since the start
110 * of the IO request. At the end of the IO request this should equal the
111 * total_transfer_bytes.
112 */
113 u32 current_transfer_bytes;
114
115 /**
116 * The number of bytes requested in the in the PIO setup.
117 */
118 u32 pio_transfer_bytes;
119
120 /**
121 * PIO Setup ending status value to tell us if we need to wait for another FIS
122 * or if the transfer is complete. On the receipt of a D2H FIS this will be
123 * the status field of that FIS.
124 */
125 u8 ending_status;
126
127 /**
128 * On receipt of a D2H FIS this will be the ending error field if the
129 * ending_status has the SATA_STATUS_ERR bit set.
130 */
131 u8 ending_error;
132
133 struct scic_sds_request_pio_sgl {
134 struct scu_sgl_element_pair *sgl_pair;
135 u8 sgl_set;
136 u32 sgl_offset;
137 } request_current;
138 } pio;
139
140 struct {
141 /**
142 * The number of bytes requested in the PIO setup before CDB data frame.
143 */
144 u32 device_preferred_cdb_length;
145 } packet;
146 } type;
147};
148
93struct scic_sds_request { 149struct scic_sds_request {
94 /** 150 /**
95 * This field contains the information for the base request state machine. 151 * This field contains the information for the base request state machine.
@@ -159,12 +215,6 @@ struct scic_sds_request {
159 bool is_task_management_request; 215 bool is_task_management_request;
160 216
161 /** 217 /**
162 * This field indicates that this request contains an initialized started
163 * substate machine.
164 */
165 bool has_started_substate_machine;
166
167 /**
168 * This field is a pointer to the stored rx frame data. It is used in STP 218 * This field is a pointer to the stored rx frame data. It is used in STP
169 * internal requests and SMP response frames. If this field is non-NULL the 219 * internal requests and SMP response frames. If this field is non-NULL the
170 * saved frame must be released on IO request completion. 220 * saved frame must be released on IO request completion.
@@ -174,12 +224,6 @@ struct scic_sds_request {
174 u32 saved_rx_frame_index; 224 u32 saved_rx_frame_index;
175 225
176 /** 226 /**
177 * This field specifies the data necessary to manage the sub-state
178 * machine executed while in the SCI_BASE_REQUEST_STATE_STARTED state.
179 */
180 struct sci_base_state_machine started_substate_machine;
181
182 /**
183 * This field specifies the current state handlers in place for this 227 * This field specifies the current state handlers in place for this
184 * IO Request object. This field is updated each time the request 228 * IO Request object. This field is updated each time the request
185 * changes state. 229 * changes state.
@@ -295,6 +339,41 @@ enum sci_base_request_states {
295 */ 339 */
296 SCI_BASE_REQUEST_STATE_STARTED, 340 SCI_BASE_REQUEST_STATE_STARTED,
297 341
342 SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE,
343 SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE,
344
345 SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE,
346 SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE,
347
348 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE,
349 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE,
350 SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE,
351
352 /**
353 * While in this state the IO request object is waiting for the TC completion
354 * notification for the H2D Register FIS
355 */
356 SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE,
357
358 /**
359 * While in this state the IO request object is waiting for either a PIO Setup
360 * FIS or a D2H register FIS. The type of frame received is based on the
361 * result of the prior frame and line conditions.
362 */
363 SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE,
364
365 /**
366 * While in this state the IO request object is waiting for a DATA frame from
367 * the device.
368 */
369 SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE,
370
371 /**
372 * While in this state the IO request object is waiting to transmit the next data
373 * frame to the device.
374 */
375 SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE,
376
298 /** 377 /**
299 * The AWAIT_TC_COMPLETION sub-state indicates that the started raw 378 * The AWAIT_TC_COMPLETION sub-state indicates that the started raw
300 * task management request is waiting for the transmission of the 379 * task management request is waiting for the transmission of the
@@ -383,8 +462,6 @@ struct scic_sds_io_request_state_handler {
383 462
384}; 463};
385 464
386extern const struct sci_base_state scic_sds_io_request_started_task_mgmt_substate_table[];
387
388/** 465/**
389 * scic_sds_request_get_controller() - 466 * scic_sds_request_get_controller() -
390 * 467 *
@@ -473,7 +550,6 @@ scic_sds_io_request_tc_completion(struct scic_sds_request *request, u32 completi
473 (scu_sge).address_modifier = 0; \ 550 (scu_sge).address_modifier = 0; \
474 } 551 }
475 552
476void scic_sds_request_build_sgl(struct scic_sds_request *sci_req);
477enum sci_status scic_sds_request_start(struct scic_sds_request *sci_req); 553enum sci_status scic_sds_request_start(struct scic_sds_request *sci_req);
478enum sci_status scic_sds_io_request_terminate(struct scic_sds_request *sci_req); 554enum sci_status scic_sds_io_request_terminate(struct scic_sds_request *sci_req);
479enum sci_status scic_sds_io_request_event_handler(struct scic_sds_request *sci_req, 555enum sci_status scic_sds_io_request_event_handler(struct scic_sds_request *sci_req,
@@ -481,8 +557,6 @@ enum sci_status scic_sds_io_request_event_handler(struct scic_sds_request *sci_r
481enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_req, 557enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_req,
482 u32 frame_index); 558 u32 frame_index);
483enum sci_status scic_sds_task_request_terminate(struct scic_sds_request *sci_req); 559enum sci_status scic_sds_task_request_terminate(struct scic_sds_request *sci_req);
484enum sci_status scic_sds_request_started_state_abort_handler(struct scic_sds_request *sci_req);
485
486 560
487/* XXX open code in caller */ 561/* XXX open code in caller */
488static inline void *scic_request_get_virt_addr(struct scic_sds_request *sci_req, 562static inline void *scic_request_get_virt_addr(struct scic_sds_request *sci_req,
@@ -778,6 +852,9 @@ enum sci_status scic_task_request_construct(struct scic_sds_controller *scic,
778 struct scic_sds_request *sci_req); 852 struct scic_sds_request *sci_req);
779enum sci_status scic_task_request_construct_ssp(struct scic_sds_request *sci_req); 853enum sci_status scic_task_request_construct_ssp(struct scic_sds_request *sci_req);
780enum sci_status scic_task_request_construct_sata(struct scic_sds_request *sci_req); 854enum sci_status scic_task_request_construct_sata(struct scic_sds_request *sci_req);
855enum sci_status scic_sds_stp_udma_request_construct(struct scic_sds_request *sci_req,
856 u32 transfer_length,
857 enum dma_data_direction dir);
781void scic_stp_io_request_set_ncq_tag(struct scic_sds_request *sci_req, u16 ncq_tag); 858void scic_stp_io_request_set_ncq_tag(struct scic_sds_request *sci_req, u16 ncq_tag);
782void scic_sds_smp_request_copy_response(struct scic_sds_request *sci_req); 859void scic_sds_smp_request_copy_response(struct scic_sds_request *sci_req);
783#endif /* !defined(_ISCI_REQUEST_H_) */ 860#endif /* !defined(_ISCI_REQUEST_H_) */