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"
75 #include "sci_types.h"
77 #include "scu_completion_codes.h"
78 #include "scu_constants.h"
79 #include "scu_task_context.h"
81 #if !defined(DISABLE_ATAPI)
82 #include "scic_sds_stp_packet_request.h"
86 * ****************************************************************************
87 * * SCIC SDS IO REQUEST CONSTANTS
88 * **************************************************************************** */
93 * We have no timer requirements for IO requests right now
95 #define SCIC_SDS_IO_REQUEST_MINIMUM_TIMER_COUNT (0)
96 #define SCIC_SDS_IO_REQUEST_MAXIMUM_TIMER_COUNT (0)
99 * ****************************************************************************
100 * * SCIC SDS IO REQUEST MACROS
101 * **************************************************************************** */
104 * scic_sds_request_get_user_request() -
106 * This is a helper macro to return the os handle for this request object.
108 #define scic_sds_request_get_user_request(request) \
109 ((request)->user_request)
113 * scic_ssp_io_request_get_object_size() -
115 * This macro returns the sizeof memory required to store the an SSP IO
116 * request. This does not include the size of the SGL or SCU Task Context
119 #define scic_ssp_io_request_get_object_size() \
121 sizeof(struct sci_ssp_command_iu) \
122 + sizeof(struct sci_ssp_response_iu) \
126 * scic_sds_ssp_request_get_command_buffer() -
128 * This macro returns the address of the ssp command buffer in the io request
131 #define scic_sds_ssp_request_get_command_buffer(memory) \
132 ((struct sci_ssp_command_iu *)(\
133 ((char *)(memory)) + sizeof(struct scic_sds_request) \
137 * scic_sds_ssp_request_get_response_buffer() -
139 * This macro returns the address of the ssp response buffer in the io request
142 #define scic_sds_ssp_request_get_response_buffer(memory) \
143 ((struct sci_ssp_response_iu *)(\
144 ((char *)(scic_sds_ssp_request_get_command_buffer(memory))) \
145 + sizeof(struct sci_ssp_command_iu) \
149 * scic_sds_ssp_request_get_task_context_buffer() -
151 * This macro returns the address of the task context buffer in the io request
154 #define scic_sds_ssp_request_get_task_context_buffer(memory) \
155 ((struct scu_task_context *)(\
156 ((char *)(scic_sds_ssp_request_get_response_buffer(memory))) \
157 + sizeof(struct sci_ssp_response_iu) \
161 * scic_sds_ssp_request_get_sgl_element_buffer() -
163 * This macro returns the address of the sgl elment pairs in the io request
166 #define scic_sds_ssp_request_get_sgl_element_buffer(memory) \
167 ((struct scu_sgl_element_pair *)(\
168 ((char *)(scic_sds_ssp_request_get_task_context_buffer(memory))) \
169 + sizeof(struct scu_task_context) \
174 * scic_ssp_task_request_get_object_size() -
176 * This macro returns the sizeof of memory required to store an SSP Task
177 * request. This does not include the size of the SCU Task Context memory.
179 #define scic_ssp_task_request_get_object_size() \
181 sizeof(struct sci_ssp_task_iu) \
182 + sizeof(struct sci_ssp_response_iu) \
186 * scic_sds_ssp_task_request_get_command_buffer() -
188 * This macro returns the address of the ssp command buffer in the task request
189 * memory. Yes its the same as the above macro except for the name.
191 #define scic_sds_ssp_task_request_get_command_buffer(memory) \
192 ((struct sci_ssp_task_iu *)(\
193 ((char *)(memory)) + sizeof(struct scic_sds_request) \
197 * scic_sds_ssp_task_request_get_response_buffer() -
199 * This macro returns the address of the ssp response buffer in the task
202 #define scic_sds_ssp_task_request_get_response_buffer(memory) \
203 ((struct sci_ssp_response_iu *)(\
204 ((char *)(scic_sds_ssp_task_request_get_command_buffer(memory))) \
205 + sizeof(struct sci_ssp_task_iu) \
209 * scic_sds_ssp_task_request_get_task_context_buffer() -
211 * This macro returs the task context buffer for the SSP task request.
213 #define scic_sds_ssp_task_request_get_task_context_buffer(memory) \
214 ((struct scu_task_context *)(\
215 ((char *)(scic_sds_ssp_task_request_get_response_buffer(memory))) \
216 + sizeof(struct sci_ssp_response_iu) \
222 * ****************************************************************************
223 * * SCIC SDS IO REQUEST PRIVATE METHODS
224 * **************************************************************************** */
229 * This method returns the size required to store an SSP IO request object. u32
231 static u32 scic_sds_ssp_request_get_object_size(void)
233 return sizeof(struct scic_sds_request)
234 + scic_ssp_io_request_get_object_size()
235 + sizeof(struct scu_task_context)
237 + sizeof(struct scu_sgl_element_pair) * SCU_MAX_SGL_ELEMENT_PAIRS;
241 * This method returns the sgl element pair for the specificed sgl_pair index.
242 * @this_request: This parameter specifies the IO request for which to retrieve
243 * the Scatter-Gather List element pair.
244 * @sgl_pair_index: This parameter specifies the index into the SGL element
245 * pair to be retrieved.
247 * This method returns a pointer to an struct scu_sgl_element_pair.
249 static struct scu_sgl_element_pair *scic_sds_request_get_sgl_element_pair(
250 struct scic_sds_request *this_request,
253 struct scu_task_context *task_context;
255 task_context = (struct scu_task_context *)this_request->task_context_buffer;
257 if (sgl_pair_index == 0) {
258 return &task_context->sgl_pair_ab;
259 } else if (sgl_pair_index == 1) {
260 return &task_context->sgl_pair_cd;
263 return &this_request->sgl_element_pair_buffer[sgl_pair_index - 2];
267 * This function will build the SGL list for an IO request.
268 * @this_request: This parameter specifies the IO request for which to build
269 * the Scatter-Gather List.
272 void scic_sds_request_build_sgl(
273 struct scic_sds_request *this_request)
277 dma_addr_t physical_address;
278 u32 sgl_pair_index = 0;
279 struct scu_sgl_element_pair *scu_sgl_list = NULL;
280 struct scu_sgl_element_pair *previous_pair = NULL;
282 os_handle = scic_sds_request_get_user_request(this_request);
283 scic_cb_io_request_get_next_sge(os_handle, NULL, &os_sge);
285 while (os_sge != NULL) {
287 scic_sds_request_get_sgl_element_pair(this_request, sgl_pair_index);
289 SCU_SGL_COPY(os_handle, scu_sgl_list->A, os_sge);
291 scic_cb_io_request_get_next_sge(os_handle, os_sge, &os_sge);
293 if (os_sge != NULL) {
294 SCU_SGL_COPY(os_handle, scu_sgl_list->B, os_sge);
296 scic_cb_io_request_get_next_sge(os_handle, os_sge, &os_sge);
298 SCU_SGL_ZERO(scu_sgl_list->B);
301 if (previous_pair != NULL) {
302 scic_cb_io_request_get_physical_address(
303 scic_sds_request_get_controller(this_request),
309 previous_pair->next_pair_upper =
310 upper_32_bits(physical_address);
311 previous_pair->next_pair_lower =
312 lower_32_bits(physical_address);
315 previous_pair = scu_sgl_list;
319 if (scu_sgl_list != NULL) {
320 scu_sgl_list->next_pair_upper = 0;
321 scu_sgl_list->next_pair_lower = 0;
326 * This method initializes common portions of the io request object. This
327 * includes construction of the struct sci_base_request parent.
328 * @the_controller: This parameter specifies the controller for which the
329 * request is being constructed.
330 * @the_target: This parameter specifies the remote device for which the
331 * request is being constructed.
332 * @io_tag: This parameter specifies the IO tag to be utilized for this
333 * request. This parameter can be set to SCI_CONTROLLER_INVALID_IO_TAG.
334 * @user_io_request_object: This parameter specifies the user request object
335 * for which the request is being constructed.
336 * @this_request: This parameter specifies the request being constructed.
339 static void scic_sds_general_request_construct(
340 struct scic_sds_controller *the_controller,
341 struct scic_sds_remote_device *the_target,
343 void *user_io_request_object,
344 struct scic_sds_request *this_request)
346 sci_base_request_construct(
347 &this_request->parent,
348 scic_sds_request_state_table
351 this_request->io_tag = io_tag;
352 this_request->user_request = user_io_request_object;
353 this_request->owning_controller = the_controller;
354 this_request->target_device = the_target;
355 this_request->has_started_substate_machine = false;
356 this_request->protocol = SCIC_NO_PROTOCOL;
357 this_request->saved_rx_frame_index = SCU_INVALID_FRAME_INDEX;
358 this_request->device_sequence = scic_sds_remote_device_get_sequence(the_target);
360 this_request->sci_status = SCI_SUCCESS;
361 this_request->scu_status = 0;
362 this_request->post_context = 0xFFFFFFFF;
364 this_request->is_task_management_request = false;
366 if (io_tag == SCI_CONTROLLER_INVALID_IO_TAG) {
367 this_request->was_tag_assigned_by_user = false;
368 this_request->task_context_buffer = NULL;
370 this_request->was_tag_assigned_by_user = true;
372 this_request->task_context_buffer =
373 scic_sds_controller_get_task_context_buffer(
374 this_request->owning_controller, io_tag);
379 * This method build the remainder of the IO request object.
380 * @this_request: This parameter specifies the request object being constructed.
382 * The scic_sds_general_request_construct() must be called before this call is
385 static void scic_sds_ssp_io_request_assign_buffers(
386 struct scic_sds_request *this_request)
388 this_request->command_buffer =
389 scic_sds_ssp_request_get_command_buffer(this_request);
390 this_request->response_buffer =
391 scic_sds_ssp_request_get_response_buffer(this_request);
392 this_request->sgl_element_pair_buffer =
393 scic_sds_ssp_request_get_sgl_element_buffer(this_request);
394 this_request->sgl_element_pair_buffer =
395 scic_sds_request_align_sgl_element_buffer(this_request->sgl_element_pair_buffer);
397 if (this_request->was_tag_assigned_by_user == false) {
398 this_request->task_context_buffer =
399 scic_sds_ssp_request_get_task_context_buffer(this_request);
400 this_request->task_context_buffer =
401 scic_sds_request_align_task_context_buffer(this_request->task_context_buffer);
406 * This method constructs the SSP Command IU data for this io request object.
407 * @this_request: This parameter specifies the request object for which the SSP
408 * command information unit is being built.
411 static void scic_sds_io_request_build_ssp_command_iu(
412 struct scic_sds_request *this_request)
414 struct sci_ssp_command_iu *command_frame;
420 (struct sci_ssp_command_iu *)this_request->command_buffer;
422 os_handle = scic_sds_request_get_user_request(this_request);
424 command_frame->lun_upper = 0;
425 command_frame->lun_lower = scic_cb_ssp_io_request_get_lun(os_handle);
427 ((u32 *)command_frame)[2] = 0;
429 cdb_length = scic_cb_ssp_io_request_get_cdb_length(os_handle);
430 cdb_buffer = (u32 *)scic_cb_ssp_io_request_get_cdb_address(os_handle);
432 if (cdb_length > 16) {
433 command_frame->additional_cdb_length = cdb_length - 16;
436 /* / @todo Is it ok to leave junk at the end of the cdb buffer? */
437 scic_word_copy_with_swap(
438 (u32 *)(&command_frame->cdb),
440 (cdb_length + 3) / sizeof(u32)
443 command_frame->enable_first_burst = 0;
444 command_frame->task_priority =
445 scic_cb_ssp_io_request_get_command_priority(os_handle);
446 command_frame->task_attribute =
447 scic_cb_ssp_io_request_get_task_attribute(os_handle);
452 * This method constructs the SSP Task IU data for this io request object.
456 static void scic_sds_task_request_build_ssp_task_iu(
457 struct scic_sds_request *this_request)
459 struct sci_ssp_task_iu *command_frame;
463 (struct sci_ssp_task_iu *)this_request->command_buffer;
465 os_handle = scic_sds_request_get_user_request(this_request);
467 command_frame->lun_upper = 0;
468 command_frame->lun_lower = scic_cb_ssp_task_request_get_lun(os_handle);
470 ((u32 *)command_frame)[2] = 0;
472 command_frame->task_function =
473 scic_cb_ssp_task_request_get_function(os_handle);
474 command_frame->task_tag =
475 scic_cb_ssp_task_request_get_io_tag_to_manage(os_handle);
480 * This method is will fill in the SCU Task Context for any type of SSP request.
485 static void scu_ssp_reqeust_construct_task_context(
486 struct scic_sds_request *this_request,
487 struct scu_task_context *task_context)
489 dma_addr_t physical_address;
490 struct scic_sds_controller *owning_controller;
491 struct scic_sds_remote_device *target_device;
492 struct scic_sds_port *target_port;
494 owning_controller = scic_sds_request_get_controller(this_request);
495 target_device = scic_sds_request_get_device(this_request);
496 target_port = scic_sds_request_get_port(this_request);
498 /* Fill in the TC with the its required data */
499 task_context->abort = 0;
500 task_context->priority = 0;
501 task_context->initiator_request = 1;
502 task_context->connection_rate =
503 scic_remote_device_get_connection_rate(target_device);
504 task_context->protocol_engine_index =
505 scic_sds_controller_get_protocol_engine_group(owning_controller);
506 task_context->logical_port_index =
507 scic_sds_port_get_index(target_port);
508 task_context->protocol_type = SCU_TASK_CONTEXT_PROTOCOL_SSP;
509 task_context->valid = SCU_TASK_CONTEXT_VALID;
510 task_context->context_type = SCU_TASK_CONTEXT_TYPE;
512 task_context->remote_node_index =
513 scic_sds_remote_device_get_index(this_request->target_device);
514 task_context->command_code = 0;
516 task_context->link_layer_control = 0;
517 task_context->do_not_dma_ssp_good_response = 1;
518 task_context->strict_ordering = 0;
519 task_context->control_frame = 0;
520 task_context->timeout_enable = 0;
521 task_context->block_guard_enable = 0;
523 task_context->address_modifier = 0;
525 /* task_context->type.ssp.tag = this_request->io_tag; */
526 task_context->task_phase = 0x01;
528 if (this_request->was_tag_assigned_by_user) {
529 /* Build the task context now since we have already read the data */
530 this_request->post_context = (
531 SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC
533 scic_sds_controller_get_protocol_engine_group(owning_controller)
534 << SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT
537 scic_sds_port_get_index(target_port)
538 << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT
540 | scic_sds_io_tag_get_index(this_request->io_tag)
543 /* Build the task context now since we have already read the data */
544 this_request->post_context = (
545 SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC
547 scic_sds_controller_get_protocol_engine_group(owning_controller)
548 << SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT
551 scic_sds_port_get_index(target_port)
552 << SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT
554 /* This is not assigned because we have to wait until we get a TCi */
558 /* Copy the physical address for the command buffer to the SCU Task Context */
559 scic_cb_io_request_get_physical_address(
560 scic_sds_request_get_controller(this_request),
562 this_request->command_buffer,
566 task_context->command_iu_upper =
567 upper_32_bits(physical_address);
568 task_context->command_iu_lower =
569 lower_32_bits(physical_address);
571 /* Copy the physical address for the response buffer to the SCU Task Context */
572 scic_cb_io_request_get_physical_address(
573 scic_sds_request_get_controller(this_request),
575 this_request->response_buffer,
579 task_context->response_iu_upper =
580 upper_32_bits(physical_address);
581 task_context->response_iu_lower =
582 lower_32_bits(physical_address);
586 * This method is will fill in the SCU Task Context for a SSP IO request.
590 static void scu_ssp_io_request_construct_task_context(
591 struct scic_sds_request *this_request,
592 SCI_IO_REQUEST_DATA_DIRECTION data_direction,
593 u32 transfer_length_bytes)
595 struct scu_task_context *task_context;
597 task_context = scic_sds_request_get_task_context(this_request);
599 scu_ssp_reqeust_construct_task_context(this_request, task_context);
601 task_context->ssp_command_iu_length = sizeof(struct sci_ssp_command_iu) / sizeof(u32);
602 task_context->type.ssp.frame_type = SCI_SAS_COMMAND_FRAME;
604 switch (data_direction) {
605 case SCI_IO_REQUEST_DATA_IN:
606 case SCI_IO_REQUEST_NO_DATA:
607 task_context->task_type = SCU_TASK_TYPE_IOREAD;
609 case SCI_IO_REQUEST_DATA_OUT:
610 task_context->task_type = SCU_TASK_TYPE_IOWRITE;
614 task_context->transfer_length_bytes = transfer_length_bytes;
616 if (task_context->transfer_length_bytes > 0) {
617 scic_sds_request_build_sgl(this_request);
623 * This method will fill in the remainder of the io request object for SSP Task
628 static void scic_sds_ssp_task_request_assign_buffers(
629 struct scic_sds_request *this_request)
631 /* Assign all of the buffer pointers */
632 this_request->command_buffer =
633 scic_sds_ssp_task_request_get_command_buffer(this_request);
634 this_request->response_buffer =
635 scic_sds_ssp_task_request_get_response_buffer(this_request);
636 this_request->sgl_element_pair_buffer = NULL;
638 if (this_request->was_tag_assigned_by_user == false) {
639 this_request->task_context_buffer =
640 scic_sds_ssp_task_request_get_task_context_buffer(this_request);
641 this_request->task_context_buffer =
642 scic_sds_request_align_task_context_buffer(this_request->task_context_buffer);
647 * This method will fill in the SCU Task Context for a SSP Task request. The
648 * following important settings are utilized: -# priority ==
649 * SCU_TASK_PRIORITY_HIGH. This ensures that the task request is issued
650 * ahead of other task destined for the same Remote Node. -# task_type ==
651 * SCU_TASK_TYPE_IOREAD. This simply indicates that a normal request type
652 * (i.e. non-raw frame) is being utilized to perform task management. -#
653 * control_frame == 1. This ensures that the proper endianess is set so
654 * that the bytes are transmitted in the right order for a task frame.
655 * @this_request: This parameter specifies the task request object being
659 static void scu_ssp_task_request_construct_task_context(
660 struct scic_sds_request *this_request)
662 struct scu_task_context *task_context;
664 task_context = scic_sds_request_get_task_context(this_request);
666 scu_ssp_reqeust_construct_task_context(this_request, task_context);
668 task_context->control_frame = 1;
669 task_context->priority = SCU_TASK_PRIORITY_HIGH;
670 task_context->task_type = SCU_TASK_TYPE_RAW_FRAME;
671 task_context->transfer_length_bytes = 0;
672 task_context->type.ssp.frame_type = SCI_SAS_TASK_FRAME;
673 task_context->ssp_command_iu_length = sizeof(struct sci_ssp_task_iu) / sizeof(u32);
678 * This method constructs the SSP Command IU data for this ssp passthrough
679 * comand request object.
680 * @this_request: This parameter specifies the request object for which the SSP
681 * command information unit is being built.
683 * enum sci_status, returns invalid parameter is cdb > 16
688 * This method constructs the SATA request object.
697 static enum sci_status scic_io_request_construct_sata(
698 struct scic_sds_request *this_request,
701 SCI_IO_REQUEST_DATA_DIRECTION data_direction,
704 enum sci_status status = SCI_SUCCESS;
706 switch (sat_protocol) {
707 case SAT_PROTOCOL_PIO_DATA_IN:
708 case SAT_PROTOCOL_PIO_DATA_OUT:
709 status = scic_sds_stp_pio_request_construct(this_request, sat_protocol, copy_rx_frame);
712 case SAT_PROTOCOL_UDMA_DATA_IN:
713 case SAT_PROTOCOL_UDMA_DATA_OUT:
714 status = scic_sds_stp_udma_request_construct(this_request, transfer_length, data_direction);
717 case SAT_PROTOCOL_ATA_HARD_RESET:
718 case SAT_PROTOCOL_SOFT_RESET:
719 status = scic_sds_stp_soft_reset_request_construct(this_request);
722 case SAT_PROTOCOL_NON_DATA:
723 status = scic_sds_stp_non_data_request_construct(this_request);
726 case SAT_PROTOCOL_FPDMA:
727 status = scic_sds_stp_ncq_request_construct(this_request, transfer_length, data_direction);
730 #if !defined(DISABLE_ATAPI)
731 case SAT_PROTOCOL_PACKET_NON_DATA:
732 case SAT_PROTOCOL_PACKET_DMA_DATA_IN:
733 case SAT_PROTOCOL_PACKET_DMA_DATA_OUT:
734 case SAT_PROTOCOL_PACKET_PIO_DATA_IN:
735 case SAT_PROTOCOL_PACKET_PIO_DATA_OUT:
736 status = scic_sds_stp_packet_request_construct(this_request);
740 case SAT_PROTOCOL_DMA_QUEUED:
741 case SAT_PROTOCOL_DMA:
742 case SAT_PROTOCOL_DEVICE_DIAGNOSTIC:
743 case SAT_PROTOCOL_DEVICE_RESET:
744 case SAT_PROTOCOL_RETURN_RESPONSE_INFO:
746 dev_err(scic_to_dev(this_request->owning_controller),
747 "%s: SCIC IO Request 0x%p received un-handled "
749 __func__, this_request, sat_protocol);
751 status = SCI_FAILURE;
759 * ****************************************************************************
760 * * SCIC Interface Implementation
761 * **************************************************************************** */
766 /* --------------------------------------------------------------------------- */
768 u32 scic_io_request_get_object_size(void)
770 u32 ssp_request_size;
771 u32 stp_request_size;
772 u32 smp_request_size;
774 ssp_request_size = scic_sds_ssp_request_get_object_size();
775 stp_request_size = scic_sds_stp_request_get_object_size();
776 smp_request_size = scic_sds_smp_request_get_object_size();
778 return max(ssp_request_size, max(stp_request_size, smp_request_size));
781 /* --------------------------------------------------------------------------- */
784 /* --------------------------------------------------------------------------- */
787 /* --------------------------------------------------------------------------- */
790 /* --------------------------------------------------------------------------- */
792 enum sci_status scic_io_request_construct(
793 struct scic_sds_controller *scic_controller,
794 struct scic_sds_remote_device *scic_remote_device,
796 void *user_io_request_object,
797 void *scic_io_request_memory,
798 struct scic_sds_request **new_scic_io_request_handle)
800 enum sci_status status = SCI_SUCCESS;
801 struct scic_sds_request *this_request;
802 struct smp_discover_response_protocols device_protocol;
804 this_request = (struct scic_sds_request *)scic_io_request_memory;
806 /* Build the common part of the request */
807 scic_sds_general_request_construct(
808 (struct scic_sds_controller *)scic_controller,
809 (struct scic_sds_remote_device *)scic_remote_device,
811 user_io_request_object,
816 scic_sds_remote_device_get_index((struct scic_sds_remote_device *)scic_remote_device)
817 == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX
819 return SCI_FAILURE_INVALID_REMOTE_DEVICE;
822 scic_remote_device_get_protocols(scic_remote_device, &device_protocol);
824 if (device_protocol.u.bits.attached_ssp_target) {
825 scic_sds_ssp_io_request_assign_buffers(this_request);
826 } else if (device_protocol.u.bits.attached_stp_target) {
827 scic_sds_stp_request_assign_buffers(this_request);
828 memset(this_request->command_buffer, 0, sizeof(struct sata_fis_reg_h2d));
829 } else if (device_protocol.u.bits.attached_smp_target) {
830 scic_sds_smp_request_assign_buffers(this_request);
831 memset(this_request->command_buffer, 0, sizeof(struct smp_request));
833 status = SCI_FAILURE_UNSUPPORTED_PROTOCOL;
836 if (status == SCI_SUCCESS) {
838 this_request->task_context_buffer,
840 SCI_FIELD_OFFSET(struct scu_task_context, sgl_pair_ab)
842 *new_scic_io_request_handle = scic_io_request_memory;
848 /* --------------------------------------------------------------------------- */
851 enum sci_status scic_task_request_construct(
852 struct scic_sds_controller *controller,
853 struct scic_sds_remote_device *remote_device,
855 void *user_io_request_object,
856 void *scic_task_request_memory,
857 struct scic_sds_request **new_scic_task_request_handle)
859 enum sci_status status = SCI_SUCCESS;
860 struct scic_sds_request *this_request = (struct scic_sds_request *)
861 scic_task_request_memory;
862 struct smp_discover_response_protocols device_protocol;
864 /* Build the common part of the request */
865 scic_sds_general_request_construct(
866 (struct scic_sds_controller *)controller,
867 (struct scic_sds_remote_device *)remote_device,
869 user_io_request_object,
873 scic_remote_device_get_protocols(remote_device, &device_protocol);
875 if (device_protocol.u.bits.attached_ssp_target) {
876 scic_sds_ssp_task_request_assign_buffers(this_request);
878 this_request->has_started_substate_machine = true;
880 /* Construct the started sub-state machine. */
881 sci_base_state_machine_construct(
882 &this_request->started_substate_machine,
883 &this_request->parent.parent,
884 scic_sds_io_request_started_task_mgmt_substate_table,
885 SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION
887 } else if (device_protocol.u.bits.attached_stp_target) {
888 scic_sds_stp_request_assign_buffers(this_request);
890 status = SCI_FAILURE_UNSUPPORTED_PROTOCOL;
893 if (status == SCI_SUCCESS) {
894 this_request->is_task_management_request = true;
895 memset(this_request->task_context_buffer, 0x00, sizeof(struct scu_task_context));
896 *new_scic_task_request_handle = scic_task_request_memory;
903 enum sci_status scic_io_request_construct_basic_ssp(
904 struct scic_sds_request *sci_req)
908 sci_req->protocol = SCIC_SSP_PROTOCOL;
910 os_handle = scic_sds_request_get_user_request(sci_req);
912 scu_ssp_io_request_construct_task_context(
914 scic_cb_io_request_get_data_direction(os_handle),
915 scic_cb_io_request_get_transfer_length(os_handle)
919 scic_sds_io_request_build_ssp_command_iu(sci_req);
921 sci_base_state_machine_change_state(
922 &sci_req->parent.state_machine,
923 SCI_BASE_REQUEST_STATE_CONSTRUCTED
930 enum sci_status scic_task_request_construct_ssp(
931 struct scic_sds_request *sci_req)
933 /* Construct the SSP Task SCU Task Context */
934 scu_ssp_task_request_construct_task_context(sci_req);
936 /* Fill in the SSP Task IU */
937 scic_sds_task_request_build_ssp_task_iu(sci_req);
939 sci_base_state_machine_change_state(
940 &sci_req->parent.state_machine,
941 SCI_BASE_REQUEST_STATE_CONSTRUCTED
948 enum sci_status scic_io_request_construct_basic_sata(
949 struct scic_sds_request *sci_req)
951 enum sci_status status;
952 struct scic_sds_stp_request *this_stp_request;
955 SCI_IO_REQUEST_DATA_DIRECTION data_direction;
956 bool copy_rx_frame = false;
958 this_stp_request = (struct scic_sds_stp_request *)sci_req;
960 sci_req->protocol = SCIC_STP_PROTOCOL;
963 scic_cb_io_request_get_transfer_length(sci_req->user_request);
965 scic_cb_io_request_get_data_direction(sci_req->user_request);
967 sat_protocol = scic_cb_request_get_sat_protocol(sci_req->user_request);
968 copy_rx_frame = scic_cb_io_request_do_copy_rx_frames(this_stp_request->parent.user_request);
970 status = scic_io_request_construct_sata(
978 if (status == SCI_SUCCESS)
979 sci_base_state_machine_change_state(
980 &sci_req->parent.state_machine,
981 SCI_BASE_REQUEST_STATE_CONSTRUCTED
988 enum sci_status scic_task_request_construct_sata(
989 struct scic_sds_request *sci_req)
991 enum sci_status status;
992 u8 sat_protocol = scic_cb_request_get_sat_protocol(sci_req->user_request);
994 switch (sat_protocol) {
995 case SAT_PROTOCOL_ATA_HARD_RESET:
996 case SAT_PROTOCOL_SOFT_RESET:
997 status = scic_sds_stp_soft_reset_request_construct(sci_req);
1001 dev_err(scic_to_dev(sci_req->owning_controller),
1002 "%s: SCIC IO Request 0x%p received un-handled SAT "
1008 status = SCI_FAILURE;
1012 if (status == SCI_SUCCESS)
1013 sci_base_state_machine_change_state(
1014 &sci_req->parent.state_machine,
1015 SCI_BASE_REQUEST_STATE_CONSTRUCTED
1022 u16 scic_io_request_get_io_tag(
1023 struct scic_sds_request *sci_req)
1025 return sci_req->io_tag;
1029 u32 scic_request_get_controller_status(
1030 struct scic_sds_request *sci_req)
1032 return sci_req->scu_status;
1036 void *scic_io_request_get_command_iu_address(
1037 struct scic_sds_request *sci_req)
1039 return sci_req->command_buffer;
1043 void *scic_io_request_get_response_iu_address(
1044 struct scic_sds_request *sci_req)
1046 return sci_req->response_buffer;
1050 #define SCU_TASK_CONTEXT_SRAM 0x200000
1051 u32 scic_io_request_get_number_of_bytes_transferred(
1052 struct scic_sds_request *scic_sds_request)
1056 if (SMU_AMR_READ(scic_sds_request->owning_controller) == 0) {
1058 * get the bytes of data from the Address == BAR1 + 20002Ch + (256*TCi) where
1059 * BAR1 is the scu_registers
1060 * 0x20002C = 0x200000 + 0x2c
1061 * = start of task context SRAM + offset of (type.ssp.data_offset)
1062 * TCi is the io_tag of struct scic_sds_request */
1063 ret_val = scic_sds_pci_read_scu_dword(
1064 scic_sds_request->owning_controller,
1066 (u8 *)scic_sds_request->owning_controller->scu_registers +
1067 (SCU_TASK_CONTEXT_SRAM + SCI_FIELD_OFFSET(struct scu_task_context, type.ssp.data_offset)) +
1068 ((sizeof(struct scu_task_context)) * scic_sds_io_tag_get_index(scic_sds_request->io_tag))
1078 * ****************************************************************************
1079 * * SCIC SDS Interface Implementation
1080 * **************************************************************************** */
1084 * @this_request: The SCIC_SDS_IO_REQUEST_T object for which the start
1085 * operation is to be executed.
1087 * This method invokes the base state start request handler for the
1088 * SCIC_SDS_IO_REQUEST_T object. enum sci_status
1090 enum sci_status scic_sds_request_start(
1091 struct scic_sds_request *this_request)
1094 this_request->device_sequence
1095 == scic_sds_remote_device_get_sequence(this_request->target_device)
1097 return this_request->state_handlers->parent.start_handler(
1098 &this_request->parent
1107 * @this_request: The SCIC_SDS_IO_REQUEST_T object for which the start
1108 * operation is to be executed.
1110 * This method invokes the base state terminate request handber for the
1111 * SCIC_SDS_IO_REQUEST_T object. enum sci_status
1113 enum sci_status scic_sds_io_request_terminate(
1114 struct scic_sds_request *this_request)
1116 return this_request->state_handlers->parent.abort_handler(
1117 &this_request->parent);
1122 * @this_request: The SCIC_SDS_IO_REQUEST_T object for which the start
1123 * operation is to be executed.
1125 * This method invokes the base state request completion handler for the
1126 * SCIC_SDS_IO_REQUEST_T object. enum sci_status
1128 enum sci_status scic_sds_io_request_complete(
1129 struct scic_sds_request *this_request)
1131 return this_request->state_handlers->parent.complete_handler(
1132 &this_request->parent);
1137 * @this_request: The SCIC_SDS_IO_REQUEST_T object for which the start
1138 * operation is to be executed.
1139 * @event_code: The event code returned by the hardware for the task reqeust.
1141 * This method invokes the core state handler for the SCIC_SDS_IO_REQUEST_T
1142 * object. enum sci_status
1144 enum sci_status scic_sds_io_request_event_handler(
1145 struct scic_sds_request *this_request,
1148 return this_request->state_handlers->event_handler(this_request, event_code);
1153 * @this_request: The SCIC_SDS_IO_REQUEST_T object for which the start
1154 * operation is to be executed.
1155 * @frame_index: The frame index returned by the hardware for the reqeust
1158 * This method invokes the core state frame handler for the
1159 * SCIC_SDS_IO_REQUEST_T object. enum sci_status
1161 enum sci_status scic_sds_io_request_frame_handler(
1162 struct scic_sds_request *this_request,
1165 return this_request->state_handlers->frame_handler(this_request, frame_index);
1170 * @this_request: The SCIC_SDS_IO_REQUEST_T object for which the task start
1171 * operation is to be executed.
1173 * This method invokes the core state task complete handler for the
1174 * SCIC_SDS_IO_REQUEST_T object. enum sci_status
1178 * ****************************************************************************
1179 * * SCIC SDS PROTECTED METHODS
1180 * **************************************************************************** */
1183 * This method copies response data for requests returning response data
1184 * instead of sense data.
1185 * @this_request: This parameter specifies the request object for which to copy
1186 * the response data.
1189 void scic_sds_io_request_copy_response(
1190 struct scic_sds_request *this_request)
1192 void *response_buffer;
1193 u32 user_response_length;
1194 u32 core_response_length;
1195 struct sci_ssp_response_iu *ssp_response;
1197 ssp_response = (struct sci_ssp_response_iu *)this_request->response_buffer;
1199 response_buffer = scic_cb_ssp_task_request_get_response_data_address(
1200 this_request->user_request
1203 user_response_length = scic_cb_ssp_task_request_get_response_data_length(
1204 this_request->user_request
1207 core_response_length = sci_ssp_get_response_data_length(
1208 ssp_response->response_data_length
1211 user_response_length = min(user_response_length, core_response_length);
1213 memcpy(response_buffer, ssp_response->data, user_response_length);
1217 * *****************************************************************************
1218 * * DEFAULT STATE HANDLERS
1219 * ***************************************************************************** */
1222 * scic_sds_request_default_start_handler() -
1223 * @request: This is the struct sci_base_request object that is cast to the
1224 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1226 * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
1227 * object receives a scic_sds_request_start() request. The default action is
1228 * to log a warning and return a failure status. enum sci_status
1229 * SCI_FAILURE_INVALID_STATE
1231 enum sci_status scic_sds_request_default_start_handler(
1232 struct sci_base_request *request)
1234 struct scic_sds_request *scic_request =
1235 (struct scic_sds_request *)request;
1237 dev_warn(scic_to_dev(scic_request->owning_controller),
1238 "%s: SCIC IO Request requested to start while in wrong "
1241 sci_base_state_machine_get_state(
1242 &((struct scic_sds_request *)request)->parent.state_machine));
1244 return SCI_FAILURE_INVALID_STATE;
1247 static enum sci_status scic_sds_request_default_abort_handler(
1248 struct sci_base_request *request)
1250 struct scic_sds_request *scic_request =
1251 (struct scic_sds_request *)request;
1253 dev_warn(scic_to_dev(scic_request->owning_controller),
1254 "%s: SCIC IO Request requested to abort while in wrong "
1257 sci_base_state_machine_get_state(
1258 &((struct scic_sds_request *)request)->parent.state_machine));
1260 return SCI_FAILURE_INVALID_STATE;
1264 * scic_sds_request_default_complete_handler() -
1265 * @request: This is the struct sci_base_request object that is cast to the
1266 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1268 * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
1269 * object receives a scic_sds_request_complete() request. The default action
1270 * is to log a warning and return a failure status. enum sci_status
1271 * SCI_FAILURE_INVALID_STATE
1273 enum sci_status scic_sds_request_default_complete_handler(
1274 struct sci_base_request *request)
1276 struct scic_sds_request *scic_request =
1277 (struct scic_sds_request *)request;
1279 dev_warn(scic_to_dev(scic_request->owning_controller),
1280 "%s: SCIC IO Request requested to complete while in wrong "
1283 sci_base_state_machine_get_state(
1284 &((struct scic_sds_request *)request)->parent.state_machine));
1286 return SCI_FAILURE_INVALID_STATE;
1290 * scic_sds_request_default_destruct_handler() -
1291 * @request: This is the struct sci_base_request object that is cast to the
1292 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1294 * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
1295 * object receives a scic_sds_request_complete() request. The default action
1296 * is to log a warning and return a failure status. enum sci_status
1297 * SCI_FAILURE_INVALID_STATE
1299 enum sci_status scic_sds_request_default_destruct_handler(
1300 struct sci_base_request *request)
1302 struct scic_sds_request *scic_request =
1303 (struct scic_sds_request *)request;
1305 dev_warn(scic_to_dev(scic_request->owning_controller),
1306 "%s: SCIC IO Request requested to destroy while in wrong "
1309 sci_base_state_machine_get_state(
1310 &((struct scic_sds_request *)request)->parent.state_machine));
1312 return SCI_FAILURE_INVALID_STATE;
1316 * scic_sds_request_default_tc_completion_handler() -
1317 * @request: This is the struct sci_base_request object that is cast to the
1318 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1320 * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
1321 * object receives a scic_sds_task_request_complete() request. The default
1322 * action is to log a warning and return a failure status. enum sci_status
1323 * SCI_FAILURE_INVALID_STATE
1325 enum sci_status scic_sds_request_default_tc_completion_handler(
1326 struct scic_sds_request *this_request,
1327 u32 completion_code)
1329 dev_warn(scic_to_dev(this_request->owning_controller),
1330 "%s: SCIC IO Request given task completion notification %x "
1331 "while in wrong state %d\n",
1334 sci_base_state_machine_get_state(
1335 &this_request->parent.state_machine));
1337 return SCI_FAILURE_INVALID_STATE;
1342 * scic_sds_request_default_event_handler() -
1343 * @request: This is the struct sci_base_request object that is cast to the
1344 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1346 * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
1347 * object receives a scic_sds_request_event_handler() request. The default
1348 * action is to log a warning and return a failure status. enum sci_status
1349 * SCI_FAILURE_INVALID_STATE
1351 enum sci_status scic_sds_request_default_event_handler(
1352 struct scic_sds_request *this_request,
1355 dev_warn(scic_to_dev(this_request->owning_controller),
1356 "%s: SCIC IO Request given event code notification %x while "
1357 "in wrong state %d\n",
1360 sci_base_state_machine_get_state(
1361 &this_request->parent.state_machine));
1363 return SCI_FAILURE_INVALID_STATE;
1367 * scic_sds_request_default_frame_handler() -
1368 * @request: This is the struct sci_base_request object that is cast to the
1369 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1371 * This method is the default action to take when an SCIC_SDS_IO_REQUEST_T
1372 * object receives a scic_sds_request_event_handler() request. The default
1373 * action is to log a warning and return a failure status. enum sci_status
1374 * SCI_FAILURE_INVALID_STATE
1376 enum sci_status scic_sds_request_default_frame_handler(
1377 struct scic_sds_request *this_request,
1380 dev_warn(scic_to_dev(this_request->owning_controller),
1381 "%s: SCIC IO Request given unexpected frame %x while in "
1385 sci_base_state_machine_get_state(
1386 &this_request->parent.state_machine));
1388 scic_sds_controller_release_frame(
1389 this_request->owning_controller, frame_index);
1391 return SCI_FAILURE_INVALID_STATE;
1395 * *****************************************************************************
1396 * * CONSTRUCTED STATE HANDLERS
1397 * ***************************************************************************** */
1400 * scic_sds_request_constructed_state_start_handler() -
1401 * @request: This is the struct sci_base_request object that is cast to the
1402 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1404 * This method implements the action taken when a constructed
1405 * SCIC_SDS_IO_REQUEST_T object receives a scic_sds_request_start() request.
1406 * This method will, if necessary, allocate a TCi for the io request object and
1407 * then will, if necessary, copy the constructed TC data into the actual TC
1408 * buffer. If everything is successful the post context field is updated with
1409 * the TCi so the controller can post the request to the hardware. enum sci_status
1410 * SCI_SUCCESS SCI_FAILURE_INSUFFICIENT_RESOURCES
1412 static enum sci_status scic_sds_request_constructed_state_start_handler(
1413 struct sci_base_request *request)
1415 struct scu_task_context *task_context;
1416 struct scic_sds_request *this_request = (struct scic_sds_request *)request;
1418 if (this_request->io_tag == SCI_CONTROLLER_INVALID_IO_TAG) {
1419 this_request->io_tag =
1420 scic_controller_allocate_io_tag(this_request->owning_controller);
1423 /* Record the IO Tag in the request */
1424 if (this_request->io_tag != SCI_CONTROLLER_INVALID_IO_TAG) {
1425 task_context = this_request->task_context_buffer;
1427 task_context->task_index = scic_sds_io_tag_get_index(this_request->io_tag);
1429 switch (task_context->protocol_type) {
1430 case SCU_TASK_CONTEXT_PROTOCOL_SMP:
1431 case SCU_TASK_CONTEXT_PROTOCOL_SSP:
1433 task_context->type.ssp.tag = this_request->io_tag;
1434 task_context->type.ssp.target_port_transfer_tag = 0xFFFF;
1437 case SCU_TASK_CONTEXT_PROTOCOL_STP:
1440 * task_context->type.stp.ncq_tag = this_request->ncq_tag; */
1443 case SCU_TASK_CONTEXT_PROTOCOL_NONE:
1444 /* / @todo When do we set no protocol type? */
1448 /* This should never happen since we build the IO requests */
1453 * Check to see if we need to copy the task context buffer
1454 * or have been building into the task context buffer */
1455 if (this_request->was_tag_assigned_by_user == false) {
1456 scic_sds_controller_copy_task_context(
1457 this_request->owning_controller, this_request
1461 /* Add to the post_context the io tag value */
1462 this_request->post_context |= scic_sds_io_tag_get_index(this_request->io_tag);
1464 /* Everything is good go ahead and change state */
1465 sci_base_state_machine_change_state(
1466 &this_request->parent.state_machine,
1467 SCI_BASE_REQUEST_STATE_STARTED
1473 return SCI_FAILURE_INSUFFICIENT_RESOURCES;
1477 * scic_sds_request_constructed_state_abort_handler() -
1478 * @request: This is the struct sci_base_request object that is cast to the
1479 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1481 * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
1482 * object receives a scic_sds_request_terminate() request. Since the request
1483 * has not yet been posted to the hardware the request transitions to the
1484 * completed state. enum sci_status SCI_SUCCESS
1486 static enum sci_status scic_sds_request_constructed_state_abort_handler(
1487 struct sci_base_request *request)
1489 struct scic_sds_request *this_request = (struct scic_sds_request *)request;
1492 * This request has been terminated by the user make sure that the correct
1493 * status code is returned */
1494 scic_sds_request_set_status(
1496 SCU_TASK_DONE_TASK_ABORT,
1497 SCI_FAILURE_IO_TERMINATED
1500 sci_base_state_machine_change_state(
1501 &this_request->parent.state_machine,
1502 SCI_BASE_REQUEST_STATE_COMPLETED
1509 * *****************************************************************************
1510 * * STARTED STATE HANDLERS
1511 * ***************************************************************************** */
1514 * scic_sds_request_started_state_abort_handler() -
1515 * @request: This is the struct sci_base_request object that is cast to the
1516 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1518 * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
1519 * object receives a scic_sds_request_terminate() request. Since the request
1520 * has been posted to the hardware the io request state is changed to the
1521 * aborting state. enum sci_status SCI_SUCCESS
1523 enum sci_status scic_sds_request_started_state_abort_handler(
1524 struct sci_base_request *request)
1526 struct scic_sds_request *this_request = (struct scic_sds_request *)request;
1528 if (this_request->has_started_substate_machine) {
1529 sci_base_state_machine_stop(&this_request->started_substate_machine);
1532 sci_base_state_machine_change_state(
1533 &this_request->parent.state_machine,
1534 SCI_BASE_REQUEST_STATE_ABORTING
1541 * scic_sds_request_started_state_tc_completion_handler() - This method process
1542 * TC (task context) completions for normal IO request (i.e. Task/Abort
1543 * Completions of type 0). This method will update the
1544 * SCIC_SDS_IO_REQUEST_T::status field.
1545 * @this_request: This parameter specifies the request for which a completion
1547 * @completion_code: This parameter specifies the completion code received from
1551 enum sci_status scic_sds_request_started_state_tc_completion_handler(
1552 struct scic_sds_request *this_request,
1553 u32 completion_code)
1556 struct sci_ssp_response_iu *response_buffer;
1559 * @todo Any SDMA return code of other than 0 is bad
1560 * decode 0x003C0000 to determine SDMA status
1562 switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
1563 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
1564 scic_sds_request_set_status(
1565 this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS
1569 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_EARLY_RESP):
1572 * There are times when the SCU hardware will return an early response
1573 * because the io request specified more data than is returned by the
1574 * target device (mode pages, inquiry data, etc.). We must check the
1575 * response stats to see if this is truly a failed request or a good
1576 * request that just got completed early. */
1577 struct sci_ssp_response_iu *response = (struct sci_ssp_response_iu *)
1578 this_request->response_buffer;
1579 scic_word_copy_with_swap(
1580 this_request->response_buffer,
1581 this_request->response_buffer,
1582 sizeof(struct sci_ssp_response_iu) / sizeof(u32)
1585 if (response->status == 0) {
1586 scic_sds_request_set_status(
1587 this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS_IO_DONE_EARLY
1590 scic_sds_request_set_status(
1592 SCU_TASK_DONE_CHECK_RESPONSE,
1593 SCI_FAILURE_IO_RESPONSE_VALID
1599 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_CHECK_RESPONSE):
1600 scic_word_copy_with_swap(
1601 this_request->response_buffer,
1602 this_request->response_buffer,
1603 sizeof(struct sci_ssp_response_iu) / sizeof(u32)
1606 scic_sds_request_set_status(
1608 SCU_TASK_DONE_CHECK_RESPONSE,
1609 SCI_FAILURE_IO_RESPONSE_VALID
1613 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_RESP_LEN_ERR):
1615 * / @todo With TASK_DONE_RESP_LEN_ERR is the response frame guaranteed
1616 * / to be received before this completion status is posted? */
1618 (struct sci_ssp_response_iu *)this_request->response_buffer;
1620 response_buffer->data_present & SCI_SSP_RESPONSE_IU_DATA_PRESENT_MASK;
1622 if ((data_present == 0x01) || (data_present == 0x02)) {
1623 scic_sds_request_set_status(
1625 SCU_TASK_DONE_CHECK_RESPONSE,
1626 SCI_FAILURE_IO_RESPONSE_VALID
1629 scic_sds_request_set_status(
1630 this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS
1635 /* only stp device gets suspended. */
1636 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_ACK_NAK_TO):
1637 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_LL_PERR):
1638 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_NAK_ERR):
1639 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_DATA_LEN_ERR):
1640 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_LL_ABORT_ERR):
1641 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_XR_WD_LEN):
1642 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_MAX_PLD_ERR):
1643 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_UNEXP_RESP):
1644 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_UNEXP_SDBFIS):
1645 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_REG_ERR):
1646 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SDB_ERR):
1647 if (this_request->protocol == SCIC_STP_PROTOCOL) {
1648 scic_sds_request_set_status(
1650 SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT,
1651 SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED
1654 scic_sds_request_set_status(
1656 SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT,
1657 SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
1662 /* both stp/ssp device gets suspended */
1663 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_LF_ERR):
1664 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_WRONG_DESTINATION):
1665 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_1):
1666 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_2):
1667 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_RESERVED_ABANDON_3):
1668 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_BAD_DESTINATION):
1669 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_ZONE_VIOLATION):
1670 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_STP_RESOURCES_BUSY):
1671 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_PROTOCOL_NOT_SUPPORTED):
1672 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_CONNECTION_RATE_NOT_SUPPORTED):
1673 scic_sds_request_set_status(
1675 SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT,
1676 SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED
1680 /* neither ssp nor stp gets suspended. */
1681 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_NAK_CMD_ERR):
1682 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_UNEXP_XR):
1683 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_XR_IU_LEN_ERR):
1684 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SDMA_ERR):
1685 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_OFFSET_ERR):
1686 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_EXCESS_DATA):
1687 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_RESP_TO_ERR):
1688 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_UFI_ERR):
1689 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_FRM_TYPE_ERR):
1690 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_LL_RX_ERR):
1691 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_UNEXP_DATA):
1692 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_OPEN_FAIL):
1693 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_VIIT_ENTRY_NV):
1694 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_IIT_ENTRY_NV):
1695 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_RNCNV_OUTBOUND):
1697 scic_sds_request_set_status(
1699 SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT,
1700 SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
1706 * @todo This is probably wrong for ACK/NAK timeout conditions
1709 /* In all cases we will treat this as the completion of the IO request. */
1710 sci_base_state_machine_change_state(
1711 &this_request->parent.state_machine,
1712 SCI_BASE_REQUEST_STATE_COMPLETED
1719 * scic_sds_request_started_state_frame_handler() -
1720 * @request: This is the struct sci_base_request object that is cast to the
1721 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1722 * @frame_index: This is the index of the unsolicited frame to be processed.
1724 * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
1725 * object receives a scic_sds_request_frame_handler() request. This method
1726 * first determines the frame type received. If this is a response frame then
1727 * the response data is copied to the io request response buffer for processing
1728 * at completion time. If the frame type is not a response buffer an error is
1729 * logged. enum sci_status SCI_SUCCESS SCI_FAILURE_INVALID_PARAMETER_VALUE
1731 static enum sci_status scic_sds_request_started_state_frame_handler(
1732 struct scic_sds_request *this_request,
1735 enum sci_status status;
1736 struct sci_ssp_frame_header *frame_header;
1738 /* / @todo If this is a response frame we must record that we received it */
1739 status = scic_sds_unsolicited_frame_control_get_header(
1740 &(scic_sds_request_get_controller(this_request)->uf_control),
1742 (void **)&frame_header
1745 if (frame_header->frame_type == SCI_SAS_RESPONSE_FRAME) {
1746 struct sci_ssp_response_iu *response_buffer;
1748 status = scic_sds_unsolicited_frame_control_get_buffer(
1749 &(scic_sds_request_get_controller(this_request)->uf_control),
1751 (void **)&response_buffer
1754 scic_word_copy_with_swap(
1755 this_request->response_buffer,
1756 (u32 *)response_buffer,
1757 sizeof(struct sci_ssp_response_iu)
1760 response_buffer = (struct sci_ssp_response_iu *)this_request->response_buffer;
1762 if ((response_buffer->data_present == 0x01) ||
1763 (response_buffer->data_present == 0x02)) {
1764 scic_sds_request_set_status(
1766 SCU_TASK_DONE_CHECK_RESPONSE,
1767 SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
1770 scic_sds_request_set_status(
1771 this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS
1774 /* This was not a response frame why did it get forwarded? */
1775 dev_err(scic_to_dev(this_request->owning_controller),
1776 "%s: SCIC IO Request 0x%p received unexpected "
1777 "frame %d type 0x%02x\n",
1781 frame_header->frame_type);
1784 * In any case we are done with this frame buffer return it to the
1786 scic_sds_controller_release_frame(
1787 this_request->owning_controller, frame_index
1794 * *****************************************************************************
1795 * * COMPLETED STATE HANDLERS
1796 * ***************************************************************************** */
1800 * scic_sds_request_completed_state_complete_handler() -
1801 * @request: This is the struct sci_base_request object that is cast to the
1802 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1804 * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
1805 * object receives a scic_sds_request_complete() request. This method frees up
1806 * any io request resources that have been allocated and transitions the
1807 * request to its final state. Consider stopping the state machine instead of
1808 * transitioning to the final state? enum sci_status SCI_SUCCESS
1810 static enum sci_status scic_sds_request_completed_state_complete_handler(
1811 struct sci_base_request *request)
1813 struct scic_sds_request *this_request = (struct scic_sds_request *)request;
1815 if (this_request->was_tag_assigned_by_user != true) {
1816 scic_controller_free_io_tag(
1817 this_request->owning_controller, this_request->io_tag
1821 if (this_request->saved_rx_frame_index != SCU_INVALID_FRAME_INDEX) {
1822 scic_sds_controller_release_frame(
1823 this_request->owning_controller, this_request->saved_rx_frame_index);
1826 sci_base_state_machine_change_state(
1827 &this_request->parent.state_machine,
1828 SCI_BASE_REQUEST_STATE_FINAL
1835 * *****************************************************************************
1836 * * ABORTING STATE HANDLERS
1837 * ***************************************************************************** */
1840 * scic_sds_request_aborting_state_abort_handler() -
1841 * @request: This is the struct sci_base_request object that is cast to the
1842 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1844 * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
1845 * object receives a scic_sds_request_terminate() request. This method is the
1846 * io request aborting state abort handlers. On receipt of a multiple
1847 * terminate requests the io request will transition to the completed state.
1848 * This should not happen in normal operation. enum sci_status SCI_SUCCESS
1850 static enum sci_status scic_sds_request_aborting_state_abort_handler(
1851 struct sci_base_request *request)
1853 struct scic_sds_request *this_request = (struct scic_sds_request *)request;
1855 sci_base_state_machine_change_state(
1856 &this_request->parent.state_machine,
1857 SCI_BASE_REQUEST_STATE_COMPLETED
1864 * scic_sds_request_aborting_state_tc_completion_handler() -
1865 * @request: This is the struct sci_base_request object that is cast to the
1866 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1868 * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
1869 * object receives a scic_sds_request_task_completion() request. This method
1870 * decodes the completion type waiting for the abort task complete
1871 * notification. When the abort task complete is received the io request
1872 * transitions to the completed state. enum sci_status SCI_SUCCESS
1874 static enum sci_status scic_sds_request_aborting_state_tc_completion_handler(
1875 struct scic_sds_request *this_request,
1876 u32 completion_code)
1878 switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
1879 case (SCU_TASK_DONE_GOOD << SCU_COMPLETION_TL_STATUS_SHIFT):
1880 case (SCU_TASK_DONE_TASK_ABORT << SCU_COMPLETION_TL_STATUS_SHIFT):
1881 scic_sds_request_set_status(
1882 this_request, SCU_TASK_DONE_TASK_ABORT, SCI_FAILURE_IO_TERMINATED
1885 sci_base_state_machine_change_state(
1886 &this_request->parent.state_machine,
1887 SCI_BASE_REQUEST_STATE_COMPLETED
1893 * Unless we get some strange error wait for the task abort to complete
1894 * TODO: Should there be a state change for this completion? */
1902 * scic_sds_request_aborting_state_frame_handler() -
1903 * @request: This is the struct sci_base_request object that is cast to the
1904 * SCIC_SDS_IO_REQUEST_T object for which the start operation is requested.
1906 * This method implements the action to be taken when an SCIC_SDS_IO_REQUEST_T
1907 * object receives a scic_sds_request_frame_handler() request. This method
1908 * discards the unsolicited frame since we are waiting for the abort task
1909 * completion. enum sci_status SCI_SUCCESS
1911 static enum sci_status scic_sds_request_aborting_state_frame_handler(
1912 struct scic_sds_request *this_request,
1915 /* TODO: Is it even possible to get an unsolicited frame in the aborting state? */
1917 scic_sds_controller_release_frame(
1918 this_request->owning_controller, frame_index);
1923 /* --------------------------------------------------------------------------- */
1925 const struct scic_sds_io_request_state_handler scic_sds_request_state_handler_table[] = {
1926 [SCI_BASE_REQUEST_STATE_INITIAL] = {
1927 .parent.start_handler = scic_sds_request_default_start_handler,
1928 .parent.abort_handler = scic_sds_request_default_abort_handler,
1929 .parent.complete_handler = scic_sds_request_default_complete_handler,
1930 .parent.destruct_handler = scic_sds_request_default_destruct_handler,
1931 .tc_completion_handler = scic_sds_request_default_tc_completion_handler,
1932 .event_handler = scic_sds_request_default_event_handler,
1933 .frame_handler = scic_sds_request_default_frame_handler,
1935 [SCI_BASE_REQUEST_STATE_CONSTRUCTED] = {
1936 .parent.start_handler = scic_sds_request_constructed_state_start_handler,
1937 .parent.abort_handler = scic_sds_request_constructed_state_abort_handler,
1938 .parent.complete_handler = scic_sds_request_default_complete_handler,
1939 .parent.destruct_handler = scic_sds_request_default_destruct_handler,
1940 .tc_completion_handler = scic_sds_request_default_tc_completion_handler,
1941 .event_handler = scic_sds_request_default_event_handler,
1942 .frame_handler = scic_sds_request_default_frame_handler,
1944 [SCI_BASE_REQUEST_STATE_STARTED] = {
1945 .parent.start_handler = scic_sds_request_default_start_handler,
1946 .parent.abort_handler = scic_sds_request_started_state_abort_handler,
1947 .parent.complete_handler = scic_sds_request_default_complete_handler,
1948 .parent.destruct_handler = scic_sds_request_default_destruct_handler,
1949 .tc_completion_handler = scic_sds_request_started_state_tc_completion_handler,
1950 .event_handler = scic_sds_request_default_event_handler,
1951 .frame_handler = scic_sds_request_started_state_frame_handler,
1953 [SCI_BASE_REQUEST_STATE_COMPLETED] = {
1954 .parent.start_handler = scic_sds_request_default_start_handler,
1955 .parent.abort_handler = scic_sds_request_default_abort_handler,
1956 .parent.complete_handler = scic_sds_request_completed_state_complete_handler,
1957 .parent.destruct_handler = scic_sds_request_default_destruct_handler,
1958 .tc_completion_handler = scic_sds_request_default_tc_completion_handler,
1959 .event_handler = scic_sds_request_default_event_handler,
1960 .frame_handler = scic_sds_request_default_frame_handler,
1962 [SCI_BASE_REQUEST_STATE_ABORTING] = {
1963 .parent.start_handler = scic_sds_request_default_start_handler,
1964 .parent.abort_handler = scic_sds_request_aborting_state_abort_handler,
1965 .parent.complete_handler = scic_sds_request_default_complete_handler,
1966 .parent.destruct_handler = scic_sds_request_default_destruct_handler,
1967 .tc_completion_handler = scic_sds_request_aborting_state_tc_completion_handler,
1968 .event_handler = scic_sds_request_default_event_handler,
1969 .frame_handler = scic_sds_request_aborting_state_frame_handler,
1971 [SCI_BASE_REQUEST_STATE_FINAL] = {
1972 .parent.start_handler = scic_sds_request_default_start_handler,
1973 .parent.abort_handler = scic_sds_request_default_abort_handler,
1974 .parent.complete_handler = scic_sds_request_default_complete_handler,
1975 .parent.destruct_handler = scic_sds_request_default_destruct_handler,
1976 .tc_completion_handler = scic_sds_request_default_tc_completion_handler,
1977 .event_handler = scic_sds_request_default_event_handler,
1978 .frame_handler = scic_sds_request_default_frame_handler,
1983 * scic_sds_request_initial_state_enter() -
1984 * @object: This parameter specifies the base object for which the state
1985 * transition is occurring.
1987 * This method implements the actions taken when entering the
1988 * SCI_BASE_REQUEST_STATE_INITIAL state. This state is entered when the initial
1989 * base request is constructed. Entry into the initial state sets all handlers
1990 * for the io request object to their default handlers. none
1992 static void scic_sds_request_initial_state_enter(
1993 struct sci_base_object *object)
1995 struct scic_sds_request *this_request = (struct scic_sds_request *)object;
1999 scic_sds_request_state_handler_table,
2000 SCI_BASE_REQUEST_STATE_INITIAL
2005 * scic_sds_request_constructed_state_enter() -
2006 * @object: The io request object that is to enter the constructed state.
2008 * This method implements the actions taken when entering the
2009 * SCI_BASE_REQUEST_STATE_CONSTRUCTED state. The method sets the state handlers
2010 * for the the constructed state. none
2012 static void scic_sds_request_constructed_state_enter(
2013 struct sci_base_object *object)
2015 struct scic_sds_request *this_request = (struct scic_sds_request *)object;
2019 scic_sds_request_state_handler_table,
2020 SCI_BASE_REQUEST_STATE_CONSTRUCTED
2025 * scic_sds_request_started_state_enter() -
2026 * @object: This parameter specifies the base object for which the state
2027 * transition is occuring. This is cast into a SCIC_SDS_IO_REQUEST object.
2029 * This method implements the actions taken when entering the
2030 * SCI_BASE_REQUEST_STATE_STARTED state. If the io request object type is a
2031 * SCSI Task request we must enter the started substate machine. none
2033 static void scic_sds_request_started_state_enter(
2034 struct sci_base_object *object)
2036 struct scic_sds_request *this_request = (struct scic_sds_request *)object;
2040 scic_sds_request_state_handler_table,
2041 SCI_BASE_REQUEST_STATE_STARTED
2045 * Most of the request state machines have a started substate machine so
2046 * start its execution on the entry to the started state. */
2047 if (this_request->has_started_substate_machine == true)
2048 sci_base_state_machine_start(&this_request->started_substate_machine);
2052 * scic_sds_request_started_state_exit() -
2053 * @object: This parameter specifies the base object for which the state
2054 * transition is occuring. This object is cast into a SCIC_SDS_IO_REQUEST
2057 * This method implements the actions taken when exiting the
2058 * SCI_BASE_REQUEST_STATE_STARTED state. For task requests the action will be
2059 * to stop the started substate machine. none
2061 static void scic_sds_request_started_state_exit(
2062 struct sci_base_object *object)
2064 struct scic_sds_request *this_request = (struct scic_sds_request *)object;
2066 if (this_request->has_started_substate_machine == true)
2067 sci_base_state_machine_stop(&this_request->started_substate_machine);
2071 * scic_sds_request_completed_state_enter() -
2072 * @object: This parameter specifies the base object for which the state
2073 * transition is occuring. This object is cast into a SCIC_SDS_IO_REQUEST
2076 * This method implements the actions taken when entering the
2077 * SCI_BASE_REQUEST_STATE_COMPLETED state. This state is entered when the
2078 * SCIC_SDS_IO_REQUEST has completed. The method will decode the request
2079 * completion status and convert it to an enum sci_status to return in the
2080 * completion callback function. none
2082 static void scic_sds_request_completed_state_enter(
2083 struct sci_base_object *object)
2085 struct scic_sds_request *this_request = (struct scic_sds_request *)object;
2089 scic_sds_request_state_handler_table,
2090 SCI_BASE_REQUEST_STATE_COMPLETED
2093 /* Tell the SCI_USER that the IO request is complete */
2094 if (this_request->is_task_management_request == false) {
2095 scic_cb_io_request_complete(
2096 scic_sds_request_get_controller(this_request),
2097 scic_sds_request_get_device(this_request),
2099 this_request->sci_status
2102 scic_cb_task_request_complete(
2103 scic_sds_request_get_controller(this_request),
2104 scic_sds_request_get_device(this_request),
2106 this_request->sci_status
2112 * scic_sds_request_aborting_state_enter() -
2113 * @object: This parameter specifies the base object for which the state
2114 * transition is occuring. This object is cast into a SCIC_SDS_IO_REQUEST
2117 * This method implements the actions taken when entering the
2118 * SCI_BASE_REQUEST_STATE_ABORTING state. none
2120 static void scic_sds_request_aborting_state_enter(
2121 struct sci_base_object *object)
2123 struct scic_sds_request *this_request = (struct scic_sds_request *)object;
2125 /* Setting the abort bit in the Task Context is required by the silicon. */
2126 this_request->task_context_buffer->abort = 1;
2130 scic_sds_request_state_handler_table,
2131 SCI_BASE_REQUEST_STATE_ABORTING
2136 * scic_sds_request_final_state_enter() -
2137 * @object: This parameter specifies the base object for which the state
2138 * transition is occuring. This is cast into a SCIC_SDS_IO_REQUEST object.
2140 * This method implements the actions taken when entering the
2141 * SCI_BASE_REQUEST_STATE_FINAL state. The only action required is to put the
2142 * state handlers in place. none
2144 static void scic_sds_request_final_state_enter(
2145 struct sci_base_object *object)
2147 struct scic_sds_request *this_request = (struct scic_sds_request *)object;
2151 scic_sds_request_state_handler_table,
2152 SCI_BASE_REQUEST_STATE_FINAL
2156 /* --------------------------------------------------------------------------- */
2158 const struct sci_base_state scic_sds_request_state_table[] = {
2159 [SCI_BASE_REQUEST_STATE_INITIAL] = {
2160 .enter_state = scic_sds_request_initial_state_enter,
2162 [SCI_BASE_REQUEST_STATE_CONSTRUCTED] = {
2163 .enter_state = scic_sds_request_constructed_state_enter,
2165 [SCI_BASE_REQUEST_STATE_STARTED] = {
2166 .enter_state = scic_sds_request_started_state_enter,
2167 .exit_state = scic_sds_request_started_state_exit
2169 [SCI_BASE_REQUEST_STATE_COMPLETED] = {
2170 .enter_state = scic_sds_request_completed_state_enter,
2172 [SCI_BASE_REQUEST_STATE_ABORTING] = {
2173 .enter_state = scic_sds_request_aborting_state_enter,
2175 [SCI_BASE_REQUEST_STATE_FINAL] = {
2176 .enter_state = scic_sds_request_final_state_enter,