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
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.
57 #include "intel_sas.h"
58 #include "intel_sata.h"
59 #include "intel_sat.h"
60 #include "sci_base_request.h"
61 #include "scic_controller.h"
62 #include "scic_io_request.h"
63 #include "scic_remote_device.h"
64 #include "scic_sds_controller.h"
65 #include "scic_sds_controller_registers.h"
66 #include "scic_sds_pci.h"
67 #include "scic_sds_port.h"
68 #include "scic_sds_remote_device.h"
69 #include "scic_sds_request.h"
70 #include "scic_sds_smp_request.h"
71 #include "scic_sds_stp_request.h"
72 #include "scic_sds_unsolicited_frame_control.h"
73 #include "scic_user_callback.h"
74 #include "sci_environment.h"
76 #include "scu_completion_codes.h"
77 #include "scu_constants.h"
78 #include "scu_task_context.h"
80 #if !defined(DISABLE_ATAPI)
81 #include "scic_sds_stp_packet_request.h"
85 * ****************************************************************************
86 * * SCIC SDS IO REQUEST CONSTANTS
87 * **************************************************************************** */
92 * We have no timer requirements for IO requests right now
94 #define SCIC_SDS_IO_REQUEST_MINIMUM_TIMER_COUNT (0)
95 #define SCIC_SDS_IO_REQUEST_MAXIMUM_TIMER_COUNT (0)
98 * ****************************************************************************
99 * * SCIC SDS IO REQUEST MACROS
100 * **************************************************************************** */
103 * scic_ssp_io_request_get_object_size() -
105 * This macro returns the sizeof memory required to store the an SSP IO
106 * request. This does not include the size of the SGL or SCU Task Context
109 #define scic_ssp_io_request_get_object_size() \
111 sizeof(struct sci_ssp_command_iu) \
112 + sizeof(struct sci_ssp_response_iu) \
116 * scic_sds_ssp_request_get_command_buffer() -
118 * This macro returns the address of the ssp command buffer in the io request
121 #define scic_sds_ssp_request_get_command_buffer(memory) \
122 ((struct sci_ssp_command_iu *)(\
123 ((char *)(memory)) + sizeof(struct scic_sds_request) \
127 * scic_sds_ssp_request_get_response_buffer() -
129 * This macro returns the address of the ssp response buffer in the io request
132 #define scic_sds_ssp_request_get_response_buffer(memory) \
133 ((struct sci_ssp_response_iu *)(\
134 ((char *)(scic_sds_ssp_request_get_command_buffer(memory))) \
135 + sizeof(struct sci_ssp_command_iu) \
139 * scic_sds_ssp_request_get_task_context_buffer() -
141 * This macro returns the address of the task context buffer in the io request
144 #define scic_sds_ssp_request_get_task_context_buffer(memory) \
145 ((struct scu_task_context *)(\
146 ((char *)(scic_sds_ssp_request_get_response_buffer(memory))) \
147 + sizeof(struct sci_ssp_response_iu) \
151 * scic_sds_ssp_request_get_sgl_element_buffer() -
153 * This macro returns the address of the sgl elment pairs in the io request
156 #define scic_sds_ssp_request_get_sgl_element_buffer(memory) \
157 ((struct scu_sgl_element_pair *)(\
158 ((char *)(scic_sds_ssp_request_get_task_context_buffer(memory))) \
159 + sizeof(struct scu_task_context) \
164 * scic_ssp_task_request_get_object_size() -
166 * This macro returns the sizeof of memory required to store an SSP Task
167 * request. This does not include the size of the SCU Task Context memory.
169 #define scic_ssp_task_request_get_object_size() \
171 sizeof(struct sci_ssp_task_iu) \
172 + sizeof(struct sci_ssp_response_iu) \
176 * scic_sds_ssp_task_request_get_command_buffer() -
178 * This macro returns the address of the ssp command buffer in the task request
179 * memory. Yes its the same as the above macro except for the name.
181 #define scic_sds_ssp_task_request_get_command_buffer(memory) \
182 ((struct sci_ssp_task_iu *)(\
183 ((char *)(memory)) + sizeof(struct scic_sds_request) \
187 * scic_sds_ssp_task_request_get_response_buffer() -
189 * This macro returns the address of the ssp response buffer in the task
192 #define scic_sds_ssp_task_request_get_response_buffer(memory) \
193 ((struct sci_ssp_response_iu *)(\
194 ((char *)(scic_sds_ssp_task_request_get_command_buffer(memory))) \
195 + sizeof(struct sci_ssp_task_iu) \
199 * scic_sds_ssp_task_request_get_task_context_buffer() -
201 * This macro returs the task context buffer for the SSP task request.
203 #define scic_sds_ssp_task_request_get_task_context_buffer(memory) \
204 ((struct scu_task_context *)(\
205 ((char *)(scic_sds_ssp_task_request_get_response_buffer(memory))) \
206 + sizeof(struct sci_ssp_response_iu) \
212 * ****************************************************************************
213 * * SCIC SDS IO REQUEST PRIVATE METHODS
214 * **************************************************************************** */
219 * This method returns the size required to store an SSP IO request object. u32
221 static u32 scic_sds_ssp_request_get_object_size(void)
223 return sizeof(struct scic_sds_request)
224 + scic_ssp_io_request_get_object_size()
225 + sizeof(struct scu_task_context)
227 + sizeof(struct scu_sgl_element_pair) * SCU_MAX_SGL_ELEMENT_PAIRS;
231 * This method returns the sgl element pair for the specificed sgl_pair index.
232 * @this_request: This parameter specifies the IO request for which to retrieve
233 * the Scatter-Gather List element pair.
234 * @sgl_pair_index: This parameter specifies the index into the SGL element
235 * pair to be retrieved.
237 * This method returns a pointer to an struct scu_sgl_element_pair.
239 static struct scu_sgl_element_pair *scic_sds_request_get_sgl_element_pair(
240 struct scic_sds_request *this_request,
243 struct scu_task_context *task_context;
245 task_context = (struct scu_task_context *)this_request->task_context_buffer;
247 if (sgl_pair_index == 0) {
248 return &task_context->sgl_pair_ab;
249 } else if (sgl_pair_index == 1) {
250 return &task_context->sgl_pair_cd;
253 return &this_request->sgl_element_pair_buffer[sgl_pair_index - 2];
257 * This function will build the SGL list for an IO request.
258 * @this_request: This parameter specifies the IO request for which to build
259 * the Scatter-Gather List.
262 void scic_sds_request_build_sgl(
263 struct scic_sds_request *this_request)
267 dma_addr_t physical_address;
268 u32 sgl_pair_index = 0;
269 struct scu_sgl_element_pair *scu_sgl_list = NULL;
270 struct scu_sgl_element_pair *previous_pair = NULL;
272 os_handle = scic_sds_request_get_user_request(this_request);
273 scic_cb_io_request_get_next_sge(os_handle, NULL, &os_sge);
275 while (os_sge != NULL) {
277 scic_sds_request_get_sgl_element_pair(this_request, sgl_pair_index);
279 SCU_SGL_COPY(os_handle, scu_sgl_list->A, os_sge);
281 scic_cb_io_request_get_next_sge(os_handle, os_sge, &os_sge);
283 if (os_sge != NULL) {
284 SCU_SGL_COPY(os_handle, scu_sgl_list->B, os_sge);
286 scic_cb_io_request_get_next_sge(os_handle, os_sge, &os_sge);
288 SCU_SGL_ZERO(scu_sgl_list->B);
291 if (previous_pair != NULL) {
292 scic_cb_io_request_get_physical_address(
293 scic_sds_request_get_controller(this_request),
299 previous_pair->next_pair_upper =
300 upper_32_bits(physical_address);
301 previous_pair->next_pair_lower =
302 lower_32_bits(physical_address);
305 previous_pair = scu_sgl_list;
309 if (scu_sgl_list != NULL) {
310 scu_sgl_list->next_pair_upper = 0;
311 scu_sgl_list->next_pair_lower = 0;
316 * This method initializes common portions of the io request object. This
317 * includes construction of the struct sci_base_request parent.
318 * @the_controller: This parameter specifies the controller for which the
319 * request is being constructed.
320 * @the_target: This parameter specifies the remote device for which the
321 * request is being constructed.
322 * @io_tag: This parameter specifies the IO tag to be utilized for this
323 * request. This parameter can be set to SCI_CONTROLLER_INVALID_IO_TAG.
324 * @user_io_request_object: This parameter specifies the user request object
325 * for which the request is being constructed.
326 * @this_request: This parameter specifies the request being constructed.
329 static void scic_sds_general_request_construct(
330 struct scic_sds_controller *the_controller,
331 struct scic_sds_remote_device *the_target,
333 void *user_io_request_object,
334 struct scic_sds_request *this_request)
336 sci_base_request_construct(
337 &this_request->parent,
338 scic_sds_request_state_table
341 this_request->io_tag = io_tag;
342 this_request->user_request = user_io_request_object;
343 this_request->owning_controller = the_controller;
344 this_request->target_device = the_target;
345 this_request->has_started_substate_machine = false;
346 this_request->protocol = SCIC_NO_PROTOCOL;
347 this_request->saved_rx_frame_index = SCU_INVALID_FRAME_INDEX;
348 this_request->device_sequence = scic_sds_remote_device_get_sequence(the_target);
350 this_request->sci_status = SCI_SUCCESS;
351 this_request->scu_status = 0;
352 this_request->post_context = 0xFFFFFFFF;
354 this_request->is_task_management_request = false;
356 if (io_tag == SCI_CONTROLLER_INVALID_IO_TAG) {
357 this_request->was_tag_assigned_by_user = false;
358 this_request->task_context_buffer = NULL;
360 this_request->was_tag_assigned_by_user = true;
362 this_request->task_context_buffer =
363 scic_sds_controller_get_task_context_buffer(
364 this_request->owning_controller, io_tag);
369 * This method build the remainder of the IO request object.
370 * @this_request: This parameter specifies the request object being constructed.
372 * The scic_sds_general_request_construct() must be called before this call is
375 static void scic_sds_ssp_io_request_assign_buffers(
376 struct scic_sds_request *this_request)
378 this_request->command_buffer =
379 scic_sds_ssp_request_get_command_buffer(this_request);
380 this_request->response_buffer =
381 scic_sds_ssp_request_get_response_buffer(this_request);
382 this_request->sgl_element_pair_buffer =
383 scic_sds_ssp_request_get_sgl_element_buffer(this_request);
384 this_request->sgl_element_pair_buffer =
385 scic_sds_request_align_sgl_element_buffer(this_request->sgl_element_pair_buffer);
387 if (this_request->was_tag_assigned_by_user == false) {
388 this_request->task_context_buffer =
389 scic_sds_ssp_request_get_task_context_buffer(this_request);
390 this_request->task_context_buffer =
391 scic_sds_request_align_task_context_buffer(this_request->task_context_buffer);
396 * This method constructs the SSP Command IU data for this io request object.
397 * @this_request: This parameter specifies the request object for which the SSP
398 * command information unit is being built.
401 static void scic_sds_io_request_build_ssp_command_iu(
402 struct scic_sds_request *this_request)
404 struct sci_ssp_command_iu *command_frame;
410 (struct sci_ssp_command_iu *)this_request->command_buffer;
412 os_handle = scic_sds_request_get_user_request(this_request);
414 command_frame->lun_upper = 0;
415 command_frame->lun_lower = scic_cb_ssp_io_request_get_lun(os_handle);
417 ((u32 *)command_frame)[2] = 0;
419 cdb_length = scic_cb_ssp_io_request_get_cdb_length(os_handle);
420 cdb_buffer = (u32 *)scic_cb_ssp_io_request_get_cdb_address(os_handle);
422 if (cdb_length > 16) {
423 command_frame->additional_cdb_length = cdb_length - 16;
426 /* / @todo Is it ok to leave junk at the end of the cdb buffer? */
427 scic_word_copy_with_swap(
428 (u32 *)(&command_frame->cdb),
430 (cdb_length + 3) / sizeof(u32)
433 command_frame->enable_first_burst = 0;
434 command_frame->task_priority =
435 scic_cb_ssp_io_request_get_command_priority(os_handle);
436 command_frame->task_attribute =
437 scic_cb_ssp_io_request_get_task_attribute(os_handle);
442 * This method constructs the SSP Task IU data for this io request object.
446 static void scic_sds_task_request_build_ssp_task_iu(
447 struct scic_sds_request *this_request)
449 struct sci_ssp_task_iu *command_frame;
453 (struct sci_ssp_task_iu *)this_request->command_buffer;
455 os_handle = scic_sds_request_get_user_request(this_request);
457 command_frame->lun_upper = 0;
458 command_frame->lun_lower = scic_cb_ssp_task_request_get_lun(os_handle);
460 ((u32 *)command_frame)[2] = 0;
462 command_frame->task_function =
463 scic_cb_ssp_task_request_get_function(os_handle);
464 command_frame->task_tag =
465 scic_cb_ssp_task_request_get_io_tag_to_manage(os_handle);
470 * This method is will fill in the SCU Task Context for any type of SSP request.
475 static void scu_ssp_reqeust_construct_task_context(
476 struct scic_sds_request *this_request,
477 struct scu_task_context *task_context)
479 dma_addr_t physical_address;
480 struct scic_sds_controller *owning_controller;
481 struct scic_sds_remote_device *target_device;
482 struct scic_sds_port *target_port;
484 owning_controller = scic_sds_request_get_controller(this_request);
485 target_device = scic_sds_request_get_device(this_request);
486 target_port = scic_sds_request_get_port(this_request);
488 /* Fill in the TC with the its required data */
489 task_context->abort = 0;
490 task_context->priority = 0;
491 task_context->initiator_request = 1;
492 task_context->connection_rate =
493 scic_remote_device_get_connection_rate(target_device);
494 task_context->protocol_engine_index =
495 scic_sds_controller_get_protocol_engine_group(owning_controller);
496 task_context->logical_port_index =
497 scic_sds_port_get_index(target_port);
498 task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_SSP;
499 task_context->valid = SCU_TASK_CONTEXT_VALID;
500 task_context->context_type = SCU_TASK_CONTEXT_TYPE;
502 task_context->remote_node_index =
503 scic_sds_remote_device_get_index(this_request->target_device);
504 task_context->command_code = 0;
506 task_context->link_layer_control = 0;
507 task_context->do_not_dma_ssp_good_response = 1;
508 task_context->strict_ordering = 0;
509 task_context->control_frame = 0;
510 task_context->timeout_enable = 0;
511 task_context->block_guard_enable = 0;
513 task_context->address_modifier = 0;
515 /* task_context->type.ssp.tag = this_request->io_tag; */
516 task_context->task_phase = 0x01;
518 if (this_request->was_tag_assigned_by_user) {
519 /* Build the task context now since we have already read the data */
520 this_request->post_context = (
521 SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC
523 scic_sds_controller_get_protocol_engine_group(owning_controller)
524 << SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT
527 scic_sds_port_get_index(target_port)
528 << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT
530 | scic_sds_io_tag_get_index(this_request->io_tag)
533 /* Build the task context now since we have already read the data */
534 this_request->post_context = (
535 SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC
537 scic_sds_controller_get_protocol_engine_group(owning_controller)
538 << SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT
541 scic_sds_port_get_index(target_port)
542 << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT
544 /* This is not assigned because we have to wait until we get a TCi */
548 /* Copy the physical address for the command buffer to the SCU Task Context */
549 scic_cb_io_request_get_physical_address(
550 scic_sds_request_get_controller(this_request),
552 this_request->command_buffer,
556 task_context->command_iu_upper =
557 upper_32_bits(physical_address);
558 task_context->command_iu_lower =
559 lower_32_bits(physical_address);
561 /* Copy the physical address for the response buffer to the SCU Task Context */
562 scic_cb_io_request_get_physical_address(
563 scic_sds_request_get_controller(this_request),
565 this_request->response_buffer,
569 task_context->response_iu_upper =
570 upper_32_bits(physical_address);
571 task_context->response_iu_lower =
572 lower_32_bits(physical_address);
576 * This method is will fill in the SCU Task Context for a SSP IO request.
580 static void scu_ssp_io_request_construct_task_context(
581 struct scic_sds_request *sci_req,
582 enum dma_data_direction dir,
585 struct scu_task_context *task_context;
587 task_context = scic_sds_request_get_task_context(sci_req);
589 scu_ssp_reqeust_construct_task_context(sci_req, task_context);
591 task_context->ssp_command_iu_length = sizeof(struct sci_ssp_command_iu) / sizeof(u32);
592 task_context->type.ssp.frame_type = SCI_SAS_COMMAND_FRAME;
595 case DMA_FROM_DEVICE:
598 task_context->task_type = SCU_TASK_TYPE_IOREAD;
601 task_context->task_type = SCU_TASK_TYPE_IOWRITE;
605 task_context->transfer_length_bytes = len;
607 if (task_context->transfer_length_bytes > 0)
608 scic_sds_request_build_sgl(sci_req);
613 * This method will fill in the remainder of the io request object for SSP Task
618 static void scic_sds_ssp_task_request_assign_buffers(
619 struct scic_sds_request *this_request)
621 /* Assign all of the buffer pointers */
622 this_request->command_buffer =
623 scic_sds_ssp_task_request_get_command_buffer(this_request);
624 this_request->response_buffer =
625 scic_sds_ssp_task_request_get_response_buffer(this_request);
626 this_request->sgl_element_pair_buffer = NULL;
628 if (this_request->was_tag_assigned_by_user == false) {
629 this_request->task_context_buffer =
630 scic_sds_ssp_task_request_get_task_context_buffer(this_request);
631 this_request->task_context_buffer =
632 scic_sds_request_align_task_context_buffer(this_request->task_context_buffer);
637 * This method will fill in the SCU Task Context for a SSP Task request. The
638 * following important settings are utilized: -# priority ==
639 * SCU_TASK_PRIORITY_HIGH. This ensures that the task request is issued
640 * ahead of other task destined for the same Remote Node. -# task_type ==
641 * SCU_TASK_TYPE_IOREAD. This simply indicates that a normal request type
642 * (i.e. non-raw frame) is being utilized to perform task management. -#
643 * control_frame == 1. This ensures that the proper endianess is set so
644 * that the bytes are transmitted in the right order for a task frame.
645 * @this_request: This parameter specifies the task request object being
649 static void scu_ssp_task_request_construct_task_context(
650 struct scic_sds_request *this_request)
652 struct scu_task_context *task_context;
654 task_context = scic_sds_request_get_task_context(this_request);
656 scu_ssp_reqeust_construct_task_context(this_request, task_context);
658 task_context->control_frame = 1;
659 task_context->priority = SCU_TASK_PRIORITY_HIGH;
660 task_context->task_type = SCU_TASK_TYPE_RAW_FRAME;
661 task_context->transfer_length_bytes = 0;
662 task_context->type.ssp.frame_type = SCI_SAS_TASK_FRAME;
663 task_context->ssp_command_iu_length = sizeof(struct sci_ssp_task_iu) / sizeof(u32);
668 * This method constructs the SSP Command IU data for this ssp passthrough
669 * comand request object.
670 * @this_request: This parameter specifies the request object for which the SSP
671 * command information unit is being built.
673 * enum sci_status, returns invalid parameter is cdb > 16
678 * This method constructs the SATA request object.
687 static enum sci_status scic_io_request_construct_sata(struct scic_sds_request *sci_req,
689 enum dma_data_direction dir,
692 enum sci_status status = SCI_SUCCESS;
695 case SAT_PROTOCOL_PIO_DATA_IN:
696 case SAT_PROTOCOL_PIO_DATA_OUT:
697 status = scic_sds_stp_pio_request_construct(sci_req, proto, copy);
700 case SAT_PROTOCOL_UDMA_DATA_IN:
701 case SAT_PROTOCOL_UDMA_DATA_OUT:
702 status = scic_sds_stp_udma_request_construct(sci_req, len, dir);
705 case SAT_PROTOCOL_ATA_HARD_RESET:
706 case SAT_PROTOCOL_SOFT_RESET:
707 status = scic_sds_stp_soft_reset_request_construct(sci_req);
710 case SAT_PROTOCOL_NON_DATA:
711 status = scic_sds_stp_non_data_request_construct(sci_req);
714 case SAT_PROTOCOL_FPDMA:
715 status = scic_sds_stp_ncq_request_construct(sci_req, len, dir);
718 #if !defined(DISABLE_ATAPI)
719 case SAT_PROTOCOL_PACKET_NON_DATA:
720 case SAT_PROTOCOL_PACKET_DMA_DATA_IN:
721 case SAT_PROTOCOL_PACKET_DMA_DATA_OUT:
722 case SAT_PROTOCOL_PACKET_PIO_DATA_IN:
723 case SAT_PROTOCOL_PACKET_PIO_DATA_OUT:
724 status = scic_sds_stp_packet_request_construct(sci_req);
728 case SAT_PROTOCOL_DMA_QUEUED:
729 case SAT_PROTOCOL_DMA:
730 case SAT_PROTOCOL_DEVICE_DIAGNOSTIC:
731 case SAT_PROTOCOL_DEVICE_RESET:
732 case SAT_PROTOCOL_RETURN_RESPONSE_INFO:
734 dev_err(scic_to_dev(sci_req->owning_controller),
735 "%s: SCIC IO Request 0x%p received un-handled "
737 __func__, sci_req, proto);
739 status = SCI_FAILURE;
747 * ****************************************************************************
748 * * SCIC Interface Implementation
749 * **************************************************************************** */
754 /* --------------------------------------------------------------------------- */
756 u32 scic_io_request_get_object_size(void)
758 u32 ssp_request_size;
759 u32 stp_request_size;
760 u32 smp_request_size;
762 ssp_request_size = scic_sds_ssp_request_get_object_size();
763 stp_request_size = scic_sds_stp_request_get_object_size();
764 smp_request_size = scic_sds_smp_request_get_object_size();
766 return max(ssp_request_size, max(stp_request_size, smp_request_size));
769 /* --------------------------------------------------------------------------- */
772 /* --------------------------------------------------------------------------- */
775 /* --------------------------------------------------------------------------- */
778 /* --------------------------------------------------------------------------- */
780 enum sci_status scic_io_request_construct(
781 struct scic_sds_controller *scic_controller,
782 struct scic_sds_remote_device *scic_remote_device,
784 void *user_io_request_object,
785 void *scic_io_request_memory,
786 struct scic_sds_request **new_scic_io_request_handle)
788 enum sci_status status = SCI_SUCCESS;
789 struct scic_sds_request *this_request;
790 struct smp_discover_response_protocols device_protocol;
792 this_request = (struct scic_sds_request *)scic_io_request_memory;
794 /* Build the common part of the request */
795 scic_sds_general_request_construct(
796 (struct scic_sds_controller *)scic_controller,
797 (struct scic_sds_remote_device *)scic_remote_device,
799 user_io_request_object,
804 scic_sds_remote_device_get_index((struct scic_sds_remote_device *)scic_remote_device)
805 == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX
807 return SCI_FAILURE_INVALID_REMOTE_DEVICE;
810 scic_remote_device_get_protocols(scic_remote_device, &device_protocol);
812 if (device_protocol.u.bits.attached_ssp_target) {
813 scic_sds_ssp_io_request_assign_buffers(this_request);
814 } else if (device_protocol.u.bits.attached_stp_target) {
815 scic_sds_stp_request_assign_buffers(this_request);
816 memset(this_request->command_buffer, 0, sizeof(struct sata_fis_reg_h2d));
817 } else if (device_protocol.u.bits.attached_smp_target) {
818 scic_sds_smp_request_assign_buffers(this_request);
819 memset(this_request->command_buffer, 0, sizeof(struct smp_request));
821 status = SCI_FAILURE_UNSUPPORTED_PROTOCOL;
824 if (status == SCI_SUCCESS) {
826 this_request->task_context_buffer,
828 SCI_FIELD_OFFSET(struct scu_task_context, sgl_pair_ab)
830 *new_scic_io_request_handle = scic_io_request_memory;
836 /* --------------------------------------------------------------------------- */
839 enum sci_status scic_task_request_construct(
840 struct scic_sds_controller *controller,
841 struct scic_sds_remote_device *remote_device,
843 void *user_io_request_object,
844 void *scic_task_request_memory,
845 struct scic_sds_request **new_scic_task_request_handle)
847 enum sci_status status = SCI_SUCCESS;
848 struct scic_sds_request *this_request = (struct scic_sds_request *)
849 scic_task_request_memory;
850 struct smp_discover_response_protocols device_protocol;
852 /* Build the common part of the request */
853 scic_sds_general_request_construct(
854 (struct scic_sds_controller *)controller,
855 (struct scic_sds_remote_device *)remote_device,
857 user_io_request_object,
861 scic_remote_device_get_protocols(remote_device, &device_protocol);
863 if (device_protocol.u.bits.attached_ssp_target) {
864 scic_sds_ssp_task_request_assign_buffers(this_request);
866 this_request->has_started_substate_machine = true;
868 /* Construct the started sub-state machine. */
869 sci_base_state_machine_construct(
870 &this_request->started_substate_machine,
871 &this_request->parent.parent,
872 scic_sds_io_request_started_task_mgmt_substate_table,
873 SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION
875 } else if (device_protocol.u.bits.attached_stp_target) {
876 scic_sds_stp_request_assign_buffers(this_request);
878 status = SCI_FAILURE_UNSUPPORTED_PROTOCOL;
881 if (status == SCI_SUCCESS) {
882 this_request->is_task_management_request = true;
883 memset(this_request->task_context_buffer, 0x00, sizeof(struct scu_task_context));
884 *new_scic_task_request_handle = scic_task_request_memory;
891 enum sci_status scic_io_request_construct_basic_ssp(
892 struct scic_sds_request *sci_req)
896 sci_req->protocol = SCIC_SSP_PROTOCOL;
898 os_handle = scic_sds_request_get_user_request(sci_req);
900 scu_ssp_io_request_construct_task_context(
902 scic_cb_io_request_get_data_direction(os_handle),
903 scic_cb_io_request_get_transfer_length(os_handle)
907 scic_sds_io_request_build_ssp_command_iu(sci_req);
909 sci_base_state_machine_change_state(
910 &sci_req->parent.state_machine,
911 SCI_BASE_REQUEST_STATE_CONSTRUCTED
918 enum sci_status scic_task_request_construct_ssp(
919 struct scic_sds_request *sci_req)
921 /* Construct the SSP Task SCU Task Context */
922 scu_ssp_task_request_construct_task_context(sci_req);
924 /* Fill in the SSP Task IU */
925 scic_sds_task_request_build_ssp_task_iu(sci_req);
927 sci_base_state_machine_change_state(
928 &sci_req->parent.state_machine,
929 SCI_BASE_REQUEST_STATE_CONSTRUCTED
936 enum sci_status scic_io_request_construct_basic_sata(struct scic_sds_request *sci_req)
938 enum sci_status status;
939 struct scic_sds_stp_request *stp_req;
942 enum dma_data_direction dir;
945 stp_req = container_of(sci_req, typeof(*stp_req), parent);
947 sci_req->protocol = SCIC_STP_PROTOCOL;
949 len = scic_cb_io_request_get_transfer_length(sci_req->user_request);
950 dir = scic_cb_io_request_get_data_direction(sci_req->user_request);
951 proto = scic_cb_request_get_sat_protocol(sci_req->user_request);
952 copy = scic_cb_io_request_do_copy_rx_frames(stp_req->parent.user_request);
954 status = scic_io_request_construct_sata(sci_req, proto, len, dir, copy);
956 if (status == SCI_SUCCESS)
957 sci_base_state_machine_change_state(
958 &sci_req->parent.state_machine,
959 SCI_BASE_REQUEST_STATE_CONSTRUCTED
966 enum sci_status scic_task_request_construct_sata(
967 struct scic_sds_request *sci_req)
969 enum sci_status status;
970 u8 sat_protocol = scic_cb_request_get_sat_protocol(sci_req->user_request);
972 switch (sat_protocol) {
973 case SAT_PROTOCOL_ATA_HARD_RESET:
974 case SAT_PROTOCOL_SOFT_RESET:
975 status = scic_sds_stp_soft_reset_request_construct(sci_req);
979 dev_err(scic_to_dev(sci_req->owning_controller),
980 "%s: SCIC IO Request 0x%p received un-handled SAT "
986 status = SCI_FAILURE;
990 if (status == SCI_SUCCESS)
991 sci_base_state_machine_change_state(
992 &sci_req->parent.state_machine,
993 SCI_BASE_REQUEST_STATE_CONSTRUCTED
1000 u16 scic_io_request_get_io_tag(
1001 struct scic_sds_request *sci_req)
1003 return sci_req->io_tag;
1007 u32 scic_request_get_controller_status(
1008 struct scic_sds_request *sci_req)
1010 return sci_req->scu_status;
1014 void *scic_io_request_get_command_iu_address(
1015 struct scic_sds_request *sci_req)
1017 return sci_req->command_buffer;
1021 void *scic_io_request_get_response_iu_address(
1022 struct scic_sds_request *sci_req)
1024 return sci_req->response_buffer;
1028 #define SCU_TASK_CONTEXT_SRAM 0x200000
1029 u32 scic_io_request_get_number_of_bytes_transferred(
1030 struct scic_sds_request *scic_sds_request)
1034 if (SMU_AMR_READ(scic_sds_request->owning_controller) == 0) {
1036 * get the bytes of data from the Address == BAR1 + 20002Ch + (256*TCi) where
1037 * BAR1 is the scu_registers
1038 * 0x20002C = 0x200000 + 0x2c
1039 * = start of task context SRAM + offset of (type.ssp.data_offset)
1040 * TCi is the io_tag of struct scic_sds_request */
1041 ret_val = scic_sds_pci_read_scu_dword(
1042 scic_sds_request->owning_controller,
1044 (u8 *)scic_sds_request->owning_controller->scu_registers +
1045 (SCU_TASK_CONTEXT_SRAM + SCI_FIELD_OFFSET(struct scu_task_context, type.ssp.data_offset)) +
1046 ((sizeof(struct scu_task_context)) * scic_sds_io_tag_get_index(scic_sds_request->io_tag))
1056 * ****************************************************************************
1057 * * SCIC SDS Interface Implementation
1058 * **************************************************************************** */
1062 * @this_request: The SCIC_SDS_IO_REQUEST_T object for which the start
1063 * operation is to be executed.
1065 * This method invokes the base state start request handler for the
1066 * SCIC_SDS_IO_REQUEST_T object. enum sci_status
1068 enum sci_status scic_sds_request_start(
1069 struct scic_sds_request *this_request)
1072 this_request->device_sequence
1073 == scic_sds_remote_device_get_sequence(this_request->target_device)
1075 return this_request->state_handlers->parent.start_handler(
1076 &this_request->parent
1085 * @this_request: The SCIC_SDS_IO_REQUEST_T object for which the start
1086 * operation is to be executed.
1088 * This method invokes the base state terminate request handber for the
1089 * SCIC_SDS_IO_REQUEST_T object. enum sci_status
1091 enum sci_status scic_sds_io_request_terminate(
1092 struct scic_sds_request *this_request)
1094 return this_request->state_handlers->parent.abort_handler(
1095 &this_request->parent);
1100 * @this_request: The SCIC_SDS_IO_REQUEST_T object for which the start
1101 * operation is to be executed.
1103 * This method invokes the base state request completion handler for the
1104 * SCIC_SDS_IO_REQUEST_T object. enum sci_status
1106 enum sci_status scic_sds_io_request_complete(
1107 struct scic_sds_request *this_request)
1109 return this_request->state_handlers->parent.complete_handler(
1110 &this_request->parent);
1115 * @this_request: The SCIC_SDS_IO_REQUEST_T object for which the start
1116 * operation is to be executed.
1117 * @event_code: The event code returned by the hardware for the task reqeust.
1119 * This method invokes the core state handler for the SCIC_SDS_IO_REQUEST_T
1120 * object. enum sci_status
1122 enum sci_status scic_sds_io_request_event_handler(
1123 struct scic_sds_request *this_request,
1126 return this_request->state_handlers->event_handler(this_request, event_code);
1131 * @this_request: The SCIC_SDS_IO_REQUEST_T object for which the start
1132 * operation is to be executed.
1133 * @frame_index: The frame index returned by the hardware for the reqeust
1136 * This method invokes the core state frame handler for the
1137 * SCIC_SDS_IO_REQUEST_T object. enum sci_status
1139 enum sci_status scic_sds_io_request_frame_handler(
1140 struct scic_sds_request *this_request,
1143 return this_request->state_handlers->frame_handler(this_request, frame_index);
1148 * @this_request: The SCIC_SDS_IO_REQUEST_T object for which the task start
1149 * operation is to be executed.
1151 * This method invokes the core state task complete handler for the
1152 * SCIC_SDS_IO_REQUEST_T object. enum sci_status
1156 * ****************************************************************************
1157 * * SCIC SDS PROTECTED METHODS
1158 * **************************************************************************** */
1161 * This method copies response data for requests returning response data
1162 * instead of sense data.
1163 * @this_request: This parameter specifies the request object for which to copy
1164 * the response data.
1167 void scic_sds_io_request_copy_response(
1168 struct scic_sds_request *this_request)
1170 void *response_buffer;
1171 u32 user_response_length;
1172 u32 core_response_length;
1173 struct sci_ssp_response_iu *ssp_response;
1175 ssp_response = (struct sci_ssp_response_iu *)this_request->response_buffer;
1177 response_buffer = scic_cb_ssp_task_request_get_response_data_address(
1178 this_request->user_request
1181 user_response_length = scic_cb_ssp_task_request_get_response_data_length(
1182 this_request->user_request
1185 core_response_length = sci_ssp_get_response_data_length(
1186 ssp_response->response_data_length
1189 user_response_length = min(user_response_length, core_response_length);
1191 memcpy(response_buffer, ssp_response->data, user_response_length);
1195 * *****************************************************************************
1196 * * DEFAULT STATE HANDLERS
1197 * ***************************************************************************** */
1200 * scic_sds_request_default_start_handler() -
1201 * @request: This is the struct sci_base_request object that is cast to the
1202 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1204 * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
1205 * object receives a scic_sds_request_start() request. The default action is
1206 * to log a warning and return a failure status. enum sci_status
1207 * SCI_FAILURE_INVALID_STATE
1209 enum sci_status scic_sds_request_default_start_handler(
1210 struct sci_base_request *request)
1212 struct scic_sds_request *scic_request =
1213 (struct scic_sds_request *)request;
1215 dev_warn(scic_to_dev(scic_request->owning_controller),
1216 "%s: SCIC IO Request requested to start while in wrong "
1219 sci_base_state_machine_get_state(
1220 &((struct scic_sds_request *)request)->parent.state_machine));
1222 return SCI_FAILURE_INVALID_STATE;
1225 static enum sci_status scic_sds_request_default_abort_handler(
1226 struct sci_base_request *request)
1228 struct scic_sds_request *scic_request =
1229 (struct scic_sds_request *)request;
1231 dev_warn(scic_to_dev(scic_request->owning_controller),
1232 "%s: SCIC IO Request requested to abort while in wrong "
1235 sci_base_state_machine_get_state(
1236 &((struct scic_sds_request *)request)->parent.state_machine));
1238 return SCI_FAILURE_INVALID_STATE;
1242 * scic_sds_request_default_complete_handler() -
1243 * @request: This is the struct sci_base_request object that is cast to the
1244 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1246 * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
1247 * object receives a scic_sds_request_complete() request. The default action
1248 * is to log a warning and return a failure status. enum sci_status
1249 * SCI_FAILURE_INVALID_STATE
1251 enum sci_status scic_sds_request_default_complete_handler(
1252 struct sci_base_request *request)
1254 struct scic_sds_request *scic_request =
1255 (struct scic_sds_request *)request;
1257 dev_warn(scic_to_dev(scic_request->owning_controller),
1258 "%s: SCIC IO Request requested to complete while in wrong "
1261 sci_base_state_machine_get_state(
1262 &((struct scic_sds_request *)request)->parent.state_machine));
1264 return SCI_FAILURE_INVALID_STATE;
1268 * scic_sds_request_default_destruct_handler() -
1269 * @request: This is the struct sci_base_request object that is cast to the
1270 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1272 * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
1273 * object receives a scic_sds_request_complete() request. The default action
1274 * is to log a warning and return a failure status. enum sci_status
1275 * SCI_FAILURE_INVALID_STATE
1277 enum sci_status scic_sds_request_default_destruct_handler(
1278 struct sci_base_request *request)
1280 struct scic_sds_request *scic_request =
1281 (struct scic_sds_request *)request;
1283 dev_warn(scic_to_dev(scic_request->owning_controller),
1284 "%s: SCIC IO Request requested to destroy while in wrong "
1287 sci_base_state_machine_get_state(
1288 &((struct scic_sds_request *)request)->parent.state_machine));
1290 return SCI_FAILURE_INVALID_STATE;
1294 * scic_sds_request_default_tc_completion_handler() -
1295 * @request: This is the struct sci_base_request object that is cast to the
1296 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1298 * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
1299 * object receives a scic_sds_task_request_complete() request. The default
1300 * action is to log a warning and return a failure status. enum sci_status
1301 * SCI_FAILURE_INVALID_STATE
1303 enum sci_status scic_sds_request_default_tc_completion_handler(
1304 struct scic_sds_request *this_request,
1305 u32 completion_code)
1307 dev_warn(scic_to_dev(this_request->owning_controller),
1308 "%s: SCIC IO Request given task completion notification %x "
1309 "while in wrong state %d\n",
1312 sci_base_state_machine_get_state(
1313 &this_request->parent.state_machine));
1315 return SCI_FAILURE_INVALID_STATE;
1320 * scic_sds_request_default_event_handler() -
1321 * @request: This is the struct sci_base_request object that is cast to the
1322 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1324 * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
1325 * object receives a scic_sds_request_event_handler() request. The default
1326 * action is to log a warning and return a failure status. enum sci_status
1327 * SCI_FAILURE_INVALID_STATE
1329 enum sci_status scic_sds_request_default_event_handler(
1330 struct scic_sds_request *this_request,
1333 dev_warn(scic_to_dev(this_request->owning_controller),
1334 "%s: SCIC IO Request given event code notification %x while "
1335 "in wrong state %d\n",
1338 sci_base_state_machine_get_state(
1339 &this_request->parent.state_machine));
1341 return SCI_FAILURE_INVALID_STATE;
1345 * scic_sds_request_default_frame_handler() -
1346 * @request: This is the struct sci_base_request object that is cast to the
1347 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1349 * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
1350 * object receives a scic_sds_request_event_handler() request. The default
1351 * action is to log a warning and return a failure status. enum sci_status
1352 * SCI_FAILURE_INVALID_STATE
1354 enum sci_status scic_sds_request_default_frame_handler(
1355 struct scic_sds_request *this_request,
1358 dev_warn(scic_to_dev(this_request->owning_controller),
1359 "%s: SCIC IO Request given unexpected frame %x while in "
1363 sci_base_state_machine_get_state(
1364 &this_request->parent.state_machine));
1366 scic_sds_controller_release_frame(
1367 this_request->owning_controller, frame_index);
1369 return SCI_FAILURE_INVALID_STATE;
1373 * *****************************************************************************
1374 * * CONSTRUCTED STATE HANDLERS
1375 * ***************************************************************************** */
1378 * scic_sds_request_constructed_state_start_handler() -
1379 * @request: This is the struct sci_base_request object that is cast to the
1380 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1382 * This method implements the action taken when a constructed
1383 * SCIC_SDS_IO_REQUEST_T object receives a scic_sds_request_start() request.
1384 * This method will, if necessary, allocate a TCi for the io request object and
1385 * then will, if necessary, copy the constructed TC data into the actual TC
1386 * buffer. If everything is successful the post context field is updated with
1387 * the TCi so the controller can post the request to the hardware. enum sci_status
1388 * SCI_SUCCESS SCI_FAILURE_INSUFFICIENT_RESOURCES
1390 static enum sci_status scic_sds_request_constructed_state_start_handler(
1391 struct sci_base_request *request)
1393 struct scu_task_context *task_context;
1394 struct scic_sds_request *this_request = (struct scic_sds_request *)request;
1396 if (this_request->io_tag == SCI_CONTROLLER_INVALID_IO_TAG) {
1397 this_request->io_tag =
1398 scic_controller_allocate_io_tag(this_request->owning_controller);
1401 /* Record the IO Tag in the request */
1402 if (this_request->io_tag != SCI_CONTROLLER_INVALID_IO_TAG) {
1403 task_context = this_request->task_context_buffer;
1405 task_context->task_index = scic_sds_io_tag_get_index(this_request->io_tag);
1407 switch (task_context->protocol_type) {
1408 case SCU_TASK_CONTEXT_PROTOCOL_SMP:
1409 case SCU_TASK_CONTEXT_PROTOCOL_SSP:
1411 task_context->type.ssp.tag = this_request->io_tag;
1412 task_context->type.ssp.target_port_transfer_tag = 0xFFFF;
1415 case SCU_TASK_CONTEXT_PROTOCOL_STP:
1418 * task_context->type.stp.ncq_tag = this_request->ncq_tag; */
1421 case SCU_TASK_CONTEXT_PROTOCOL_NONE:
1422 /* / @todo When do we set no protocol type? */
1426 /* This should never happen since we build the IO requests */
1431 * Check to see if we need to copy the task context buffer
1432 * or have been building into the task context buffer */
1433 if (this_request->was_tag_assigned_by_user == false) {
1434 scic_sds_controller_copy_task_context(
1435 this_request->owning_controller, this_request
1439 /* Add to the post_context the io tag value */
1440 this_request->post_context |= scic_sds_io_tag_get_index(this_request->io_tag);
1442 /* Everything is good go ahead and change state */
1443 sci_base_state_machine_change_state(
1444 &this_request->parent.state_machine,
1445 SCI_BASE_REQUEST_STATE_STARTED
1451 return SCI_FAILURE_INSUFFICIENT_RESOURCES;
1455 * scic_sds_request_constructed_state_abort_handler() -
1456 * @request: This is the struct sci_base_request object that is cast to the
1457 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1459 * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
1460 * object receives a scic_sds_request_terminate() request. Since the request
1461 * has not yet been posted to the hardware the request transitions to the
1462 * completed state. enum sci_status SCI_SUCCESS
1464 static enum sci_status scic_sds_request_constructed_state_abort_handler(
1465 struct sci_base_request *request)
1467 struct scic_sds_request *this_request = (struct scic_sds_request *)request;
1470 * This request has been terminated by the user make sure that the correct
1471 * status code is returned */
1472 scic_sds_request_set_status(
1474 SCU_TASK_DONE_TASK_ABORT,
1475 SCI_FAILURE_IO_TERMINATED
1478 sci_base_state_machine_change_state(
1479 &this_request->parent.state_machine,
1480 SCI_BASE_REQUEST_STATE_COMPLETED
1487 * *****************************************************************************
1488 * * STARTED STATE HANDLERS
1489 * ***************************************************************************** */
1492 * scic_sds_request_started_state_abort_handler() -
1493 * @request: This is the struct sci_base_request object that is cast to the
1494 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1496 * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
1497 * object receives a scic_sds_request_terminate() request. Since the request
1498 * has been posted to the hardware the io request state is changed to the
1499 * aborting state. enum sci_status SCI_SUCCESS
1501 enum sci_status scic_sds_request_started_state_abort_handler(
1502 struct sci_base_request *request)
1504 struct scic_sds_request *this_request = (struct scic_sds_request *)request;
1506 if (this_request->has_started_substate_machine) {
1507 sci_base_state_machine_stop(&this_request->started_substate_machine);
1510 sci_base_state_machine_change_state(
1511 &this_request->parent.state_machine,
1512 SCI_BASE_REQUEST_STATE_ABORTING
1519 * scic_sds_request_started_state_tc_completion_handler() - This method process
1520 * TC (task context) completions for normal IO request (i.e. Task/Abort
1521 * Completions of type 0). This method will update the
1522 * SCIC_SDS_IO_REQUEST_T::status field.
1523 * @this_request: This parameter specifies the request for which a completion
1525 * @completion_code: This parameter specifies the completion code received from
1529 enum sci_status scic_sds_request_started_state_tc_completion_handler(
1530 struct scic_sds_request *this_request,
1531 u32 completion_code)
1534 struct sci_ssp_response_iu *response_buffer;
1537 * @todo Any SDMA return code of other than 0 is bad
1538 * decode 0x003C0000 to determine SDMA status
1540 switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
1541 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
1542 scic_sds_request_set_status(
1543 this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS
1547 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_EARLY_RESP):
1550 * There are times when the SCU hardware will return an early response
1551 * because the io request specified more data than is returned by the
1552 * target device (mode pages, inquiry data, etc.). We must check the
1553 * response stats to see if this is truly a failed request or a good
1554 * request that just got completed early. */
1555 struct sci_ssp_response_iu *response = (struct sci_ssp_response_iu *)
1556 this_request->response_buffer;
1557 scic_word_copy_with_swap(
1558 this_request->response_buffer,
1559 this_request->response_buffer,
1560 sizeof(struct sci_ssp_response_iu) / sizeof(u32)
1563 if (response->status == 0) {
1564 scic_sds_request_set_status(
1565 this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS_IO_DONE_EARLY
1568 scic_sds_request_set_status(
1570 SCU_TASK_DONE_CHECK_RESPONSE,
1571 SCI_FAILURE_IO_RESPONSE_VALID
1577 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_CHECK_RESPONSE):
1578 scic_word_copy_with_swap(
1579 this_request->response_buffer,
1580 this_request->response_buffer,
1581 sizeof(struct sci_ssp_response_iu) / sizeof(u32)
1584 scic_sds_request_set_status(
1586 SCU_TASK_DONE_CHECK_RESPONSE,
1587 SCI_FAILURE_IO_RESPONSE_VALID
1591 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_RESP_LEN_ERR):
1593 * / @todo With TASK_DONE_RESP_LEN_ERR is the response frame guaranteed
1594 * / to be received before this completion status is posted? */
1596 (struct sci_ssp_response_iu *)this_request->response_buffer;
1598 response_buffer->data_present & SCI_SSP_RESPONSE_IU_DATA_PRESENT_MASK;
1600 if ((data_present == 0x01) || (data_present == 0x02)) {
1601 scic_sds_request_set_status(
1603 SCU_TASK_DONE_CHECK_RESPONSE,
1604 SCI_FAILURE_IO_RESPONSE_VALID
1607 scic_sds_request_set_status(
1608 this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS
1613 /* only stp device gets suspended. */
1614 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_ACK_NAK_TO):
1615 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_LL_PERR):
1616 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_NAK_ERR):
1617 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_DATA_LEN_ERR):
1618 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_LL_ABORT_ERR):
1619 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_XR_WD_LEN):
1620 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_MAX_PLD_ERR):
1621 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_UNEXP_RESP):
1622 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_UNEXP_SDBFIS):
1623 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_REG_ERR):
1624 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SDB_ERR):
1625 if (this_request->protocol == SCIC_STP_PROTOCOL) {
1626 scic_sds_request_set_status(
1628 SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT,
1629 SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED
1632 scic_sds_request_set_status(
1634 SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT,
1635 SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
1640 /* both stp/ssp device gets suspended */
1641 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_LF_ERR):
1642 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_WRONG_DESTINATION):
1643 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_1):
1644 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_2):
1645 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_3):
1646 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_BAD_DESTINATION):
1647 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_ZONE_VIOLATION):
1648 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_STP_RESOURCES_BUSY):
1649 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_PROTOCOL_NOT_SUPPORTED):
1650 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_CONNECTION_RATE_NOT_SUPPORTED):
1651 scic_sds_request_set_status(
1653 SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT,
1654 SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED
1658 /* neither ssp nor stp gets suspended. */
1659 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_NAK_CMD_ERR):
1660 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_UNEXP_XR):
1661 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_XR_IU_LEN_ERR):
1662 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SDMA_ERR):
1663 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_OFFSET_ERR):
1664 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_EXCESS_DATA):
1665 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_RESP_TO_ERR):
1666 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_UFI_ERR):
1667 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_FRM_TYPE_ERR):
1668 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_LL_RX_ERR):
1669 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_UNEXP_DATA):
1670 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_OPEN_FAIL):
1671 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_VIIT_ENTRY_NV):
1672 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_IIT_ENTRY_NV):
1673 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_RNCNV_OUTBOUND):
1675 scic_sds_request_set_status(
1677 SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT,
1678 SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
1684 * @todo This is probably wrong for ACK/NAK timeout conditions
1687 /* In all cases we will treat this as the completion of the IO request. */
1688 sci_base_state_machine_change_state(
1689 &this_request->parent.state_machine,
1690 SCI_BASE_REQUEST_STATE_COMPLETED
1697 * scic_sds_request_started_state_frame_handler() -
1698 * @request: This is the struct sci_base_request object that is cast to the
1699 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1700 * @frame_index: This is the index of the unsolicited frame to be processed.
1702 * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
1703 * object receives a scic_sds_request_frame_handler() request. This method
1704 * first determines the frame type received. If this is a response frame then
1705 * the response data is copied to the io request response buffer for processing
1706 * at completion time. If the frame type is not a response buffer an error is
1707 * logged. enum sci_status SCI_SUCCESS SCI_FAILURE_INVALID_PARAMETER_VALUE
1709 static enum sci_status scic_sds_request_started_state_frame_handler(
1710 struct scic_sds_request *this_request,
1713 enum sci_status status;
1714 struct sci_ssp_frame_header *frame_header;
1716 /* / @todo If this is a response frame we must record that we received it */
1717 status = scic_sds_unsolicited_frame_control_get_header(
1718 &(scic_sds_request_get_controller(this_request)->uf_control),
1720 (void **)&frame_header
1723 if (frame_header->frame_type == SCI_SAS_RESPONSE_FRAME) {
1724 struct sci_ssp_response_iu *response_buffer;
1726 status = scic_sds_unsolicited_frame_control_get_buffer(
1727 &(scic_sds_request_get_controller(this_request)->uf_control),
1729 (void **)&response_buffer
1732 scic_word_copy_with_swap(
1733 this_request->response_buffer,
1734 (u32 *)response_buffer,
1735 sizeof(struct sci_ssp_response_iu)
1738 response_buffer = (struct sci_ssp_response_iu *)this_request->response_buffer;
1740 if ((response_buffer->data_present == 0x01) ||
1741 (response_buffer->data_present == 0x02)) {
1742 scic_sds_request_set_status(
1744 SCU_TASK_DONE_CHECK_RESPONSE,
1745 SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
1748 scic_sds_request_set_status(
1749 this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS
1752 /* This was not a response frame why did it get forwarded? */
1753 dev_err(scic_to_dev(this_request->owning_controller),
1754 "%s: SCIC IO Request 0x%p received unexpected "
1755 "frame %d type 0x%02x\n",
1759 frame_header->frame_type);
1762 * In any case we are done with this frame buffer return it to the
1764 scic_sds_controller_release_frame(
1765 this_request->owning_controller, frame_index
1772 * *****************************************************************************
1773 * * COMPLETED STATE HANDLERS
1774 * ***************************************************************************** */
1778 * scic_sds_request_completed_state_complete_handler() -
1779 * @request: This is the struct sci_base_request object that is cast to the
1780 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1782 * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
1783 * object receives a scic_sds_request_complete() request. This method frees up
1784 * any io request resources that have been allocated and transitions the
1785 * request to its final state. Consider stopping the state machine instead of
1786 * transitioning to the final state? enum sci_status SCI_SUCCESS
1788 static enum sci_status scic_sds_request_completed_state_complete_handler(
1789 struct sci_base_request *request)
1791 struct scic_sds_request *this_request = (struct scic_sds_request *)request;
1793 if (this_request->was_tag_assigned_by_user != true) {
1794 scic_controller_free_io_tag(
1795 this_request->owning_controller, this_request->io_tag
1799 if (this_request->saved_rx_frame_index != SCU_INVALID_FRAME_INDEX) {
1800 scic_sds_controller_release_frame(
1801 this_request->owning_controller, this_request->saved_rx_frame_index);
1804 sci_base_state_machine_change_state(
1805 &this_request->parent.state_machine,
1806 SCI_BASE_REQUEST_STATE_FINAL
1813 * *****************************************************************************
1814 * * ABORTING STATE HANDLERS
1815 * ***************************************************************************** */
1818 * scic_sds_request_aborting_state_abort_handler() -
1819 * @request: This is the struct sci_base_request object that is cast to the
1820 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1822 * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
1823 * object receives a scic_sds_request_terminate() request. This method is the
1824 * io request aborting state abort handlers. On receipt of a multiple
1825 * terminate requests the io request will transition to the completed state.
1826 * This should not happen in normal operation. enum sci_status SCI_SUCCESS
1828 static enum sci_status scic_sds_request_aborting_state_abort_handler(
1829 struct sci_base_request *request)
1831 struct scic_sds_request *this_request = (struct scic_sds_request *)request;
1833 sci_base_state_machine_change_state(
1834 &this_request->parent.state_machine,
1835 SCI_BASE_REQUEST_STATE_COMPLETED
1842 * scic_sds_request_aborting_state_tc_completion_handler() -
1843 * @request: This is the struct sci_base_request object that is cast to the
1844 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1846 * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
1847 * object receives a scic_sds_request_task_completion() request. This method
1848 * decodes the completion type waiting for the abort task complete
1849 * notification. When the abort task complete is received the io request
1850 * transitions to the completed state. enum sci_status SCI_SUCCESS
1852 static enum sci_status scic_sds_request_aborting_state_tc_completion_handler(
1853 struct scic_sds_request *this_request,
1854 u32 completion_code)
1856 switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
1857 case (SCU_TASK_DONE_GOOD << SCU_COMPLETION_TL_STATUS_SHIFT):
1858 case (SCU_TASK_DONE_TASK_ABORT << SCU_COMPLETION_TL_STATUS_SHIFT):
1859 scic_sds_request_set_status(
1860 this_request, SCU_TASK_DONE_TASK_ABORT, SCI_FAILURE_IO_TERMINATED
1863 sci_base_state_machine_change_state(
1864 &this_request->parent.state_machine,
1865 SCI_BASE_REQUEST_STATE_COMPLETED
1871 * Unless we get some strange error wait for the task abort to complete
1872 * TODO: Should there be a state change for this completion? */
1880 * scic_sds_request_aborting_state_frame_handler() -
1881 * @request: This is the struct sci_base_request object that is cast to the
1882 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1884 * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
1885 * object receives a scic_sds_request_frame_handler() request. This method
1886 * discards the unsolicited frame since we are waiting for the abort task
1887 * completion. enum sci_status SCI_SUCCESS
1889 static enum sci_status scic_sds_request_aborting_state_frame_handler(
1890 struct scic_sds_request *this_request,
1893 /* TODO: Is it even possible to get an unsolicited frame in the aborting state? */
1895 scic_sds_controller_release_frame(
1896 this_request->owning_controller, frame_index);
1901 /* --------------------------------------------------------------------------- */
1903 const struct scic_sds_io_request_state_handler scic_sds_request_state_handler_table[] = {
1904 [SCI_BASE_REQUEST_STATE_INITIAL] = {
1905 .parent.start_handler = scic_sds_request_default_start_handler,
1906 .parent.abort_handler = scic_sds_request_default_abort_handler,
1907 .parent.complete_handler = scic_sds_request_default_complete_handler,
1908 .parent.destruct_handler = scic_sds_request_default_destruct_handler,
1909 .tc_completion_handler = scic_sds_request_default_tc_completion_handler,
1910 .event_handler = scic_sds_request_default_event_handler,
1911 .frame_handler = scic_sds_request_default_frame_handler,
1913 [SCI_BASE_REQUEST_STATE_CONSTRUCTED] = {
1914 .parent.start_handler = scic_sds_request_constructed_state_start_handler,
1915 .parent.abort_handler = scic_sds_request_constructed_state_abort_handler,
1916 .parent.complete_handler = scic_sds_request_default_complete_handler,
1917 .parent.destruct_handler = scic_sds_request_default_destruct_handler,
1918 .tc_completion_handler = scic_sds_request_default_tc_completion_handler,
1919 .event_handler = scic_sds_request_default_event_handler,
1920 .frame_handler = scic_sds_request_default_frame_handler,
1922 [SCI_BASE_REQUEST_STATE_STARTED] = {
1923 .parent.start_handler = scic_sds_request_default_start_handler,
1924 .parent.abort_handler = scic_sds_request_started_state_abort_handler,
1925 .parent.complete_handler = scic_sds_request_default_complete_handler,
1926 .parent.destruct_handler = scic_sds_request_default_destruct_handler,
1927 .tc_completion_handler = scic_sds_request_started_state_tc_completion_handler,
1928 .event_handler = scic_sds_request_default_event_handler,
1929 .frame_handler = scic_sds_request_started_state_frame_handler,
1931 [SCI_BASE_REQUEST_STATE_COMPLETED] = {
1932 .parent.start_handler = scic_sds_request_default_start_handler,
1933 .parent.abort_handler = scic_sds_request_default_abort_handler,
1934 .parent.complete_handler = scic_sds_request_completed_state_complete_handler,
1935 .parent.destruct_handler = scic_sds_request_default_destruct_handler,
1936 .tc_completion_handler = scic_sds_request_default_tc_completion_handler,
1937 .event_handler = scic_sds_request_default_event_handler,
1938 .frame_handler = scic_sds_request_default_frame_handler,
1940 [SCI_BASE_REQUEST_STATE_ABORTING] = {
1941 .parent.start_handler = scic_sds_request_default_start_handler,
1942 .parent.abort_handler = scic_sds_request_aborting_state_abort_handler,
1943 .parent.complete_handler = scic_sds_request_default_complete_handler,
1944 .parent.destruct_handler = scic_sds_request_default_destruct_handler,
1945 .tc_completion_handler = scic_sds_request_aborting_state_tc_completion_handler,
1946 .event_handler = scic_sds_request_default_event_handler,
1947 .frame_handler = scic_sds_request_aborting_state_frame_handler,
1949 [SCI_BASE_REQUEST_STATE_FINAL] = {
1950 .parent.start_handler = scic_sds_request_default_start_handler,
1951 .parent.abort_handler = scic_sds_request_default_abort_handler,
1952 .parent.complete_handler = scic_sds_request_default_complete_handler,
1953 .parent.destruct_handler = scic_sds_request_default_destruct_handler,
1954 .tc_completion_handler = scic_sds_request_default_tc_completion_handler,
1955 .event_handler = scic_sds_request_default_event_handler,
1956 .frame_handler = scic_sds_request_default_frame_handler,
1961 * scic_sds_request_initial_state_enter() -
1962 * @object: This parameter specifies the base object for which the state
1963 * transition is occurring.
1965 * This method implements the actions taken when entering the
1966 * SCI_BASE_REQUEST_STATE_INITIAL state. This state is entered when the initial
1967 * base request is constructed. Entry into the initial state sets all handlers
1968 * for the io request object to their default handlers. none
1970 static void scic_sds_request_initial_state_enter(
1971 struct sci_base_object *object)
1973 struct scic_sds_request *this_request = (struct scic_sds_request *)object;
1977 scic_sds_request_state_handler_table,
1978 SCI_BASE_REQUEST_STATE_INITIAL
1983 * scic_sds_request_constructed_state_enter() -
1984 * @object: The io request object that is to enter the constructed state.
1986 * This method implements the actions taken when entering the
1987 * SCI_BASE_REQUEST_STATE_CONSTRUCTED state. The method sets the state handlers
1988 * for the the constructed state. none
1990 static void scic_sds_request_constructed_state_enter(
1991 struct sci_base_object *object)
1993 struct scic_sds_request *this_request = (struct scic_sds_request *)object;
1997 scic_sds_request_state_handler_table,
1998 SCI_BASE_REQUEST_STATE_CONSTRUCTED
2003 * scic_sds_request_started_state_enter() -
2004 * @object: This parameter specifies the base object for which the state
2005 * transition is occuring. This is cast into a SCIC_SDS_IO_REQUEST object.
2007 * This method implements the actions taken when entering the
2008 * SCI_BASE_REQUEST_STATE_STARTED state. If the io request object type is a
2009 * SCSI Task request we must enter the started substate machine. none
2011 static void scic_sds_request_started_state_enter(
2012 struct sci_base_object *object)
2014 struct scic_sds_request *this_request = (struct scic_sds_request *)object;
2018 scic_sds_request_state_handler_table,
2019 SCI_BASE_REQUEST_STATE_STARTED
2023 * Most of the request state machines have a started substate machine so
2024 * start its execution on the entry to the started state. */
2025 if (this_request->has_started_substate_machine == true)
2026 sci_base_state_machine_start(&this_request->started_substate_machine);
2030 * scic_sds_request_started_state_exit() -
2031 * @object: This parameter specifies the base object for which the state
2032 * transition is occuring. This object is cast into a SCIC_SDS_IO_REQUEST
2035 * This method implements the actions taken when exiting the
2036 * SCI_BASE_REQUEST_STATE_STARTED state. For task requests the action will be
2037 * to stop the started substate machine. none
2039 static void scic_sds_request_started_state_exit(
2040 struct sci_base_object *object)
2042 struct scic_sds_request *this_request = (struct scic_sds_request *)object;
2044 if (this_request->has_started_substate_machine == true)
2045 sci_base_state_machine_stop(&this_request->started_substate_machine);
2049 * scic_sds_request_completed_state_enter() -
2050 * @object: This parameter specifies the base object for which the state
2051 * transition is occuring. This object is cast into a SCIC_SDS_IO_REQUEST
2054 * This method implements the actions taken when entering the
2055 * SCI_BASE_REQUEST_STATE_COMPLETED state. This state is entered when the
2056 * SCIC_SDS_IO_REQUEST has completed. The method will decode the request
2057 * completion status and convert it to an enum sci_status to return in the
2058 * completion callback function. none
2060 static void scic_sds_request_completed_state_enter(
2061 struct sci_base_object *object)
2063 struct scic_sds_request *this_request = (struct scic_sds_request *)object;
2067 scic_sds_request_state_handler_table,
2068 SCI_BASE_REQUEST_STATE_COMPLETED
2071 /* Tell the SCI_USER that the IO request is complete */
2072 if (this_request->is_task_management_request == false) {
2073 scic_cb_io_request_complete(
2074 scic_sds_request_get_controller(this_request),
2075 scic_sds_request_get_device(this_request),
2077 this_request->sci_status
2080 scic_cb_task_request_complete(
2081 scic_sds_request_get_controller(this_request),
2082 scic_sds_request_get_device(this_request),
2084 this_request->sci_status
2090 * scic_sds_request_aborting_state_enter() -
2091 * @object: This parameter specifies the base object for which the state
2092 * transition is occuring. This object is cast into a SCIC_SDS_IO_REQUEST
2095 * This method implements the actions taken when entering the
2096 * SCI_BASE_REQUEST_STATE_ABORTING state. none
2098 static void scic_sds_request_aborting_state_enter(
2099 struct sci_base_object *object)
2101 struct scic_sds_request *this_request = (struct scic_sds_request *)object;
2103 /* Setting the abort bit in the Task Context is required by the silicon. */
2104 this_request->task_context_buffer->abort = 1;
2108 scic_sds_request_state_handler_table,
2109 SCI_BASE_REQUEST_STATE_ABORTING
2114 * scic_sds_request_final_state_enter() -
2115 * @object: This parameter specifies the base object for which the state
2116 * transition is occuring. This is cast into a SCIC_SDS_IO_REQUEST object.
2118 * This method implements the actions taken when entering the
2119 * SCI_BASE_REQUEST_STATE_FINAL state. The only action required is to put the
2120 * state handlers in place. none
2122 static void scic_sds_request_final_state_enter(
2123 struct sci_base_object *object)
2125 struct scic_sds_request *this_request = (struct scic_sds_request *)object;
2129 scic_sds_request_state_handler_table,
2130 SCI_BASE_REQUEST_STATE_FINAL
2134 /* --------------------------------------------------------------------------- */
2136 const struct sci_base_state scic_sds_request_state_table[] = {
2137 [SCI_BASE_REQUEST_STATE_INITIAL] = {
2138 .enter_state = scic_sds_request_initial_state_enter,
2140 [SCI_BASE_REQUEST_STATE_CONSTRUCTED] = {
2141 .enter_state = scic_sds_request_constructed_state_enter,
2143 [SCI_BASE_REQUEST_STATE_STARTED] = {
2144 .enter_state = scic_sds_request_started_state_enter,
2145 .exit_state = scic_sds_request_started_state_exit
2147 [SCI_BASE_REQUEST_STATE_COMPLETED] = {
2148 .enter_state = scic_sds_request_completed_state_enter,
2150 [SCI_BASE_REQUEST_STATE_ABORTING] = {
2151 .enter_state = scic_sds_request_aborting_state_enter,
2153 [SCI_BASE_REQUEST_STATE_FINAL] = {
2154 .enter_state = scic_sds_request_final_state_enter,