70 return strings[
state];
78 return &ireq->
tc->sgl_pair_ab;
80 return &ireq->
tc->sgl_pair_cd;
84 return &ireq->sg_table[idx - 2];
93 offset = (
void *) &ireq->
tc->sgl_pair_ab -
96 }
else if (idx == 1) {
97 offset = (
void *) &ireq->
tc->sgl_pair_cd -
102 return sci_io_request_get_dma_addr(ireq, &ireq->sg_table[idx - 2]);
113 static void sci_request_build_sgl(
struct isci_request *ireq)
127 scu_sg = to_sgl_element_pair(ireq, sg_idx);
128 init_sgl_element(&scu_sg->
A, sg);
131 init_sgl_element(&scu_sg->
B, sg);
134 memset(&scu_sg->
B, 0,
sizeof(scu_sg->
B));
137 dma_addr = to_sgl_element_pair_dma(ihost,
151 scu_sg = to_sgl_element_pair(ireq, sg_idx);
171 static void sci_io_request_build_ssp_command_iu(
struct isci_request *ireq)
176 cmd_iu = &ireq->
ssp.cmd;
191 static void sci_task_request_build_ssp_task_iu(
struct isci_request *ireq)
197 task_iu = &ireq->
ssp.tmf;
216 static void scu_ssp_reqeust_construct_task_context(
228 task_context->
abort = 0;
263 dma_addr = sci_io_request_get_dma_addr(ireq, &ireq->
ssp.cmd);
272 dma_addr = sci_io_request_get_dma_addr(ireq, &ireq->
ssp.rsp);
294 return (len >>
ilog2(sector_size)) * 8;
301 u8 blk_sz = scu_bg_blk_size(scmd->
device);
310 scmd->
device->sector_size);
352 static void scu_ssp_ireq_dif_strip(
struct isci_request *ireq,
u8 type,
u8 op)
356 u8 blk_sz = scu_bg_blk_size(scmd->
device);
365 scmd->
device->sector_size);
374 if ((type & SCSI_PROT_DIF_TYPE1) || (type & SCSI_PROT_DIF_TYPE2))
398 if ((type & SCSI_PROT_DIF_TYPE1) || (type & SCSI_PROT_DIF_TYPE2)) {
401 }
else if (type & SCSI_PROT_DIF_TYPE3)
402 tc->
bgctl_f.app_ref_f_detect = 1;
418 static void scu_ssp_io_request_construct_task_context(
struct isci_request *ireq,
428 scu_ssp_reqeust_construct_task_context(ireq, task_context);
448 sci_request_build_sgl(ireq);
452 scu_ssp_ireq_dif_strip(ireq, prot_type, prot_op);
454 scu_ssp_ireq_dif_insert(ireq, prot_type, prot_op);
471 static void scu_ssp_task_request_construct_task_context(
struct isci_request *ireq)
475 scu_ssp_reqeust_construct_task_context(ireq, task_context);
498 static void scu_sata_reqeust_construct_task_context(
510 task_context->
abort = 0;
549 dma_addr = sci_io_request_get_dma_addr(ireq,
550 ((
char *) &ireq->
stp.cmd) +
561 static void scu_stp_raw_request_construct_task_context(
struct isci_request *ireq)
565 scu_sata_reqeust_construct_task_context(ireq, task_context);
579 scu_stp_raw_request_construct_task_context(ireq);
582 stp_req->
sgl.offset = 0;
586 sci_request_build_sgl(ireq);
587 stp_req->
sgl.index = 0;
590 stp_req->
sgl.index = -1;
608 static void sci_stp_optimized_request_construct(
struct isci_request *ireq,
609 u8 optimized_task_type,
616 scu_sata_reqeust_construct_task_context(ireq, task_context);
619 sci_request_build_sgl(ireq);
637 task_context->
task_type = optimized_task_type;
641 static void sci_atapi_construct(
struct isci_request *ireq)
644 struct sas_task *
task;
653 scu_stp_raw_request_construct_task_context(ireq);
662 ireq->
stp.rsp.fis_type = 0;
666 sci_io_request_construct_sata(
struct isci_request *ireq,
680 "%s: Request 0x%p received un-handled SAT "
681 "management protocol 0x%x.\n",
689 "%s: Non-ATA protocol in SATA path: 0x%x\n",
699 sci_atapi_construct(ireq);
705 scu_stp_raw_request_construct_task_context(ireq);
711 sci_stp_optimized_request_construct(ireq,
719 sci_stp_optimized_request_construct(ireq,
724 return sci_stp_pio_request_construct(ireq, copy);
735 scu_ssp_io_request_construct_task_context(ireq,
739 sci_io_request_build_ssp_command_iu(ireq);
750 scu_ssp_task_request_construct_task_context(ireq);
753 sci_task_request_build_ssp_task_iu(ireq);
770 status = sci_io_request_construct_sata(ireq,
785 #define SCU_TASK_CONTEXT_SRAM 0x200000
800 ret_val =
readl(scu_reg_base +
810 enum sci_base_request_states
state;
814 state = ireq->
sm.current_state_id;
815 if (state != SCI_REQ_CONSTRUCTED) {
817 "%s: SCIC IO Request requested to start while in wrong "
818 "state %d\n", __func__, state);
829 tc->
type.
ssp.target_port_transfer_tag = 0xFFFF;
860 enum sci_base_request_states
state;
862 state = ireq->
sm.current_state_id;
865 case SCI_REQ_CONSTRUCTED:
872 case SCI_REQ_STARTED:
873 case SCI_REQ_TASK_WAIT_TC_COMP:
874 case SCI_REQ_SMP_WAIT_RESP:
875 case SCI_REQ_SMP_WAIT_TC_COMP:
876 case SCI_REQ_STP_UDMA_WAIT_TC_COMP:
877 case SCI_REQ_STP_UDMA_WAIT_D2H:
878 case SCI_REQ_STP_NON_DATA_WAIT_H2D:
879 case SCI_REQ_STP_NON_DATA_WAIT_D2H:
880 case SCI_REQ_STP_PIO_WAIT_H2D:
881 case SCI_REQ_STP_PIO_WAIT_FRAME:
882 case SCI_REQ_STP_PIO_DATA_IN:
883 case SCI_REQ_STP_PIO_DATA_OUT:
884 case SCI_REQ_ATAPI_WAIT_H2D:
885 case SCI_REQ_ATAPI_WAIT_PIO_SETUP:
886 case SCI_REQ_ATAPI_WAIT_D2H:
887 case SCI_REQ_ATAPI_WAIT_TC_COMP:
889 case SCI_REQ_TASK_WAIT_TC_RESP:
898 case SCI_REQ_ABORTING:
907 case SCI_REQ_COMPLETED:
910 "%s: SCIC IO Request requested to abort while in wrong "
911 "state %d\n", __func__, ireq->
sm.current_state_id);
920 enum sci_base_request_states
state;
923 state = ireq->
sm.current_state_id;
924 if (
WARN_ONCE(state != SCI_REQ_COMPLETED,
925 "isci: request completion from wrong state (%s)\n",
941 enum sci_base_request_states
state;
944 state = ireq->
sm.current_state_id;
946 if (state != SCI_REQ_STP_PIO_DATA_IN) {
947 dev_warn(&ihost->
pdev->dev,
"%s: (%x) in wrong state %s\n",
962 "%s: pio request unexpected event %#x\n",
963 __func__, event_code);
978 static void sci_io_request_copy_response(
struct isci_request *ireq)
982 struct ssp_response_iu *ssp_response;
985 ssp_response = &ireq->
ssp.rsp;
993 memcpy(resp_buf, ssp_response->resp_data, len);
997 request_started_state_tc_event(
struct isci_request *ireq,
1000 struct ssp_response_iu *resp_iu;
1019 struct ssp_response_iu *
resp = &ireq->
ssp.rsp;
1022 sci_swab32_cpy(&ireq->
ssp.rsp,
1026 if (resp->status == 0) {
1038 sci_swab32_cpy(&ireq->
ssp.rsp,
1052 resp_iu = &ireq->
ssp.
rsp;
1053 datapres = resp_iu->datapres;
1055 if (datapres == 1 || datapres == 2) {
1135 request_aborting_state_tc_event(
struct isci_request *ireq,
1136 u32 completion_code)
1157 u32 completion_code)
1172 "%s: TaskRequest:0x%p CompletionCode:%x - "
1173 "ACK/NAK timeout\n", __func__, ireq,
1194 smp_request_await_response_tc_event(
struct isci_request *ireq,
1195 u32 completion_code)
1237 u32 completion_code)
1264 struct isci_stp_pio_sgl *pio_sgl = &stp_req->
sgl;
1266 sgl_pair = to_sgl_element_pair(ireq, pio_sgl->index);
1270 if (sgl_pair->
B.address_lower == 0 &&
1271 sgl_pair->
B.address_upper == 0) {
1284 sgl_pair = to_sgl_element_pair(ireq, pio_sgl->index);
1293 stp_request_non_data_await_h2d_tc_event(
struct isci_request *ireq,
1294 u32 completion_code)
1317 #define SCU_MAX_FRAME_BUFFER_SIZE 0x400
1322 static enum sci_status sci_stp_request_pio_data_out_trasmit_data_frame(
1334 sgl_pair = to_sgl_element_pair(ireq, stp_req->
sgl.index);
1336 current_sgl = &sgl_pair->
A;
1338 current_sgl = &sgl_pair->
B;
1359 offset = stp_req->
sgl.offset;
1360 sgl_pair = to_sgl_element_pair(ireq, stp_req->
sgl.index);
1361 if (
WARN_ONCE(!sgl_pair,
"%s: null sgl element", __func__))
1366 len = sgl_pair->
A.length -
offset;
1369 len = sgl_pair->
B.length -
offset;
1375 if (stp_req->
pio_len >= len) {
1376 status = sci_stp_request_pio_data_out_trasmit_data_frame(ireq, len);
1382 sgl = pio_sgl_next(stp_req);
1384 }
else if (stp_req->
pio_len < len) {
1385 sci_stp_request_pio_data_out_trasmit_data_frame(ireq, stp_req->
pio_len);
1408 sci_stp_request_pio_data_in_copy_data_buffer(
struct isci_stp_request *stp_req,
1414 struct sas_task *
task;
1419 ireq = to_ireq(stp_req);
1421 src_addr = data_buf;
1426 while (total_len > 0) {
1433 total_len -= copy_len;
1434 src_addr += copy_len;
1452 static enum sci_status sci_stp_request_pio_data_in_copy_data(
1462 status = sci_stp_request_pio_data_in_copy_data_buffer(
1463 stp_req, data_buffer, stp_req->
pio_len);
1469 status = sci_stp_request_pio_data_in_copy_data_buffer(
1480 stp_request_pio_await_h2d_completion_tc_event(
struct isci_request *ireq,
1481 u32 completion_code)
1507 pio_data_out_tx_done_tc_event(
struct isci_request *ireq,
1508 u32 completion_code)
1511 bool all_frames_transferred =
false;
1518 status = sci_stp_request_pio_data_out_transmit_data(ireq);
1521 all_frames_transferred =
true;
1523 }
else if (stp_req->
pio_len == 0) {
1528 all_frames_transferred =
true;
1532 if (all_frames_transferred) {
1565 (
void **)&frame_header);
1571 (
void **)&frame_buffer);
1593 (
void **)&frame_header);
1600 "%s ERROR: invalid fis type 0x%X\n",
1607 (
void **)&frame_buffer);
1610 (
u32 *)frame_header,
1625 status = process_unsolicited_fis(ireq, frame_index);
1649 static void scu_atapi_reconstruct_raw_frame_task_context(
struct isci_request *ireq)
1666 static void scu_atapi_construct_task_context(
struct isci_request *ireq)
1702 sci_request_build_sgl(ireq);
1711 enum sci_base_request_states
state;
1715 state = ireq->
sm.current_state_id;
1717 case SCI_REQ_STARTED: {
1718 struct ssp_frame_hdr ssp_hdr;
1725 word_cnt =
sizeof(
struct ssp_frame_hdr) / sizeof(u32);
1726 sci_swab32_cpy(&ssp_hdr, frame_header, word_cnt);
1729 struct ssp_response_iu *resp_iu;
1736 sci_swab32_cpy(&ireq->
ssp.rsp, resp_iu, word_cnt);
1738 resp_iu = &ireq->
ssp.rsp;
1740 if (resp_iu->datapres == 0x01 ||
1741 resp_iu->datapres == 0x02) {
1751 "%s: SCIC IO Request 0x%p received unexpected "
1752 "frame %d type 0x%02x\n", __func__, ireq,
1753 frame_index, ssp_hdr.frame_type);
1765 case SCI_REQ_TASK_WAIT_TC_RESP:
1766 sci_io_request_copy_response(ireq);
1771 case SCI_REQ_SMP_WAIT_RESP: {
1774 void *frame_header, *kaddr;
1781 rsp = kaddr + sg->
offset;
1782 sci_swab32_cpy(rsp, frame_header, 1);
1791 word_cnt = (sg->
length/4)-1;
1793 word_cnt =
min_t(
unsigned int, word_cnt,
1795 sci_swab32_cpy(rsp + 4, smp_resp, word_cnt);
1806 "%s: SCIC SMP Request 0x%p received unexpected "
1807 "frame %d type 0x%02x\n",
1824 case SCI_REQ_STP_UDMA_WAIT_TC_COMP:
1825 return sci_stp_request_udma_general_frame_handler(ireq,
1828 case SCI_REQ_STP_UDMA_WAIT_D2H:
1830 status = sci_stp_request_udma_general_frame_handler(ireq, frame_index);
1840 case SCI_REQ_STP_NON_DATA_WAIT_D2H: {
1846 (
void **)&frame_header);
1850 "%s: SCIC IO Request 0x%p could not get frame "
1851 "header for frame index %d, status %x\n",
1864 (
void **)&frame_buffer);
1877 "%s: IO Request:0x%p Frame Id:%d protocol "
1878 "violation occurred\n", __func__, stp_req,
1894 case SCI_REQ_STP_PIO_WAIT_FRAME: {
1901 (
void **)&frame_header);
1905 "%s: SCIC IO Request 0x%p could not get frame "
1906 "header for frame index %d, status %x\n",
1907 __func__, stp_req, frame_index, status);
1916 (
void **)&frame_buffer);
1925 stp_req->
pio_len = frame_buffer[3] & 0xffff;
1928 stp_req->
status = (frame_buffer[2] >> 24) & 0xff;
1943 status = sci_stp_request_pio_data_out_transmit_data(ireq);
1962 "%s: SCIC PIO Request 0x%p received "
1963 "D2H Register FIS with BSY status "
1973 (
void **)&frame_buffer);
1995 case SCI_REQ_STP_PIO_DATA_IN: {
1997 struct sata_fis_data *frame_buffer;
2001 (
void **)&frame_header);
2005 "%s: SCIC IO Request 0x%p could not get frame "
2006 "header for frame index %d, status %x\n",
2016 "%s: SCIC PIO Request 0x%p received frame %d "
2017 "with fis type 0x%02x when expecting a data "
2033 if (stp_req->
sgl.index < 0) {
2039 (
void **)&frame_buffer);
2041 status = sci_stp_request_pio_data_in_copy_data(stp_req,
2042 (
u8 *)frame_buffer);
2064 case SCI_REQ_ATAPI_WAIT_PIO_SETUP: {
2071 scu_atapi_reconstruct_raw_frame_task_context(ireq);
2074 scu_atapi_construct_task_context(ireq);
2080 case SCI_REQ_ATAPI_WAIT_D2H:
2081 return atapi_d2h_reg_frame_handler(ireq, frame_index);
2082 case SCI_REQ_ABORTING:
2092 "%s: SCIC IO Request given unexpected frame %x while "
2104 u32 completion_code)
2155 enum sci_base_request_states
next)
2181 u32 completion_code)
2193 u16 len = sci_req_tx_bytes(ireq);
2200 d2h->
flags = (1 << 6);
2260 static int sci_request_smp_completion_status_is_tx_suspend(
2261 unsigned int completion_status)
2263 switch (completion_status) {
2275 static int sci_request_smp_completion_status_is_tx_rx_suspend(
2276 unsigned int completion_status)
2281 static int sci_request_ssp_completion_status_is_tx_suspend(
2282 unsigned int completion_status)
2284 switch (completion_status) {
2301 static int sci_request_ssp_completion_status_is_tx_rx_suspend(
2302 unsigned int completion_status)
2307 static int sci_request_stpsata_completion_status_is_tx_suspend(
2308 unsigned int completion_status)
2310 switch (completion_status) {
2331 static int sci_request_stpsata_completion_status_is_tx_rx_suspend(
2332 unsigned int completion_status)
2334 switch (completion_status) {
2348 static void sci_request_handle_suspending_completions(
2350 u32 completion_code)
2357 is_tx = sci_request_smp_completion_status_is_tx_suspend(
2359 is_tx_rx = sci_request_smp_completion_status_is_tx_rx_suspend(
2363 is_tx = sci_request_ssp_completion_status_is_tx_suspend(
2365 is_tx_rx = sci_request_ssp_completion_status_is_tx_rx_suspend(
2369 is_tx = sci_request_stpsata_completion_status_is_tx_suspend(
2372 sci_request_stpsata_completion_status_is_tx_rx_suspend(
2377 "%s: request %p has no valid protocol\n",
2381 if (is_tx || is_tx_rx) {
2382 BUG_ON(is_tx && is_tx_rx);
2394 u32 completion_code)
2396 enum sci_base_request_states
state;
2399 state = ireq->
sm.current_state_id;
2402 sci_request_handle_suspending_completions(
2406 case SCI_REQ_STARTED:
2407 return request_started_state_tc_event(ireq, completion_code);
2409 case SCI_REQ_TASK_WAIT_TC_COMP:
2410 return ssp_task_request_await_tc_event(ireq,
2413 case SCI_REQ_SMP_WAIT_RESP:
2414 return smp_request_await_response_tc_event(ireq,
2417 case SCI_REQ_SMP_WAIT_TC_COMP:
2418 return smp_request_await_tc_event(ireq, completion_code);
2420 case SCI_REQ_STP_UDMA_WAIT_TC_COMP:
2421 return stp_request_udma_await_tc_event(ireq,
2424 case SCI_REQ_STP_NON_DATA_WAIT_H2D:
2425 return stp_request_non_data_await_h2d_tc_event(ireq,
2428 case SCI_REQ_STP_PIO_WAIT_H2D:
2429 return stp_request_pio_await_h2d_completion_tc_event(ireq,
2432 case SCI_REQ_STP_PIO_DATA_OUT:
2433 return pio_data_out_tx_done_tc_event(ireq, completion_code);
2435 case SCI_REQ_ABORTING:
2436 return request_aborting_state_tc_event(ireq,
2439 case SCI_REQ_ATAPI_WAIT_H2D:
2440 return atapi_raw_completion(ireq, completion_code,
2441 SCI_REQ_ATAPI_WAIT_PIO_SETUP);
2443 case SCI_REQ_ATAPI_WAIT_TC_COMP:
2444 return atapi_raw_completion(ireq, completion_code,
2445 SCI_REQ_ATAPI_WAIT_D2H);
2447 case SCI_REQ_ATAPI_WAIT_D2H:
2448 return atapi_data_tc_completion_handler(ireq, completion_code);
2451 dev_warn(&ihost->
pdev->dev,
"%s: %x in wrong state %s\n",
2467 static void isci_request_process_response_iu(
2468 struct sas_task *task,
2469 struct ssp_response_iu *resp_iu,
2474 "resp_iu->status = 0x%x,\nresp_iu->datapres = %d "
2475 "resp_iu->response_data_len = %x, "
2476 "resp_iu->sense_data_len = %x\nrepsonse data: ",
2481 resp_iu->response_data_len,
2482 resp_iu->sense_data_len);
2501 static void isci_request_set_open_reject_status(
2503 struct sas_task *task,
2512 task->
task_status.open_rej_reason = open_rej_reason;
2524 static void isci_request_handle_controller_specific_errors(
2527 struct sas_task *task,
2531 unsigned int cstatus;
2536 "%s: %p SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR "
2537 "- controller status = 0x%x\n",
2538 __func__, request, cstatus);
2616 isci_request_set_open_reject_status(
2617 request, task, response_ptr, status_ptr,
2626 isci_request_set_open_reject_status(
2627 request, task, response_ptr, status_ptr,
2633 isci_request_set_open_reject_status(
2634 request, task, response_ptr, status_ptr,
2640 isci_request_set_open_reject_status(
2641 request, task, response_ptr, status_ptr,
2647 isci_request_set_open_reject_status(
2648 request, task, response_ptr, status_ptr,
2654 isci_request_set_open_reject_status(
2655 request, task, response_ptr, status_ptr,
2661 isci_request_set_open_reject_status(
2662 request, task, response_ptr, status_ptr,
2668 isci_request_set_open_reject_status(
2669 request, task, response_ptr, status_ptr,
2675 isci_request_set_open_reject_status(
2676 request, task, response_ptr, status_ptr,
2717 static void isci_process_stp_response(
struct sas_task *task,
struct dev_to_host_fis *
fis)
2739 static void isci_request_io_request_complete(
struct isci_host *ihost,
2744 struct ssp_response_iu *resp_iu;
2745 unsigned long task_flags;
2751 "%s: request = %p, task = %p, "
2752 "task->data_dir = %d completion_status = 0x%x\n",
2753 __func__, request, task, task->
data_dir, completion_status);
2758 switch (completion_status) {
2762 "%s: SCI_IO_FAILURE_RESPONSE_VALID (%p/%p)\n",
2763 __func__, request, task);
2766 isci_process_stp_response(task, &request->
stp.rsp);
2770 resp_iu = &request->
ssp.rsp;
2771 isci_request_process_response_iu(task, resp_iu,
2777 "%s: SCI_IO_FAILURE_RESPONSE_VALID: "
2778 "SAS_PROTOCOL_SMP protocol\n",
2783 "%s: unknown protocol\n", __func__);
2806 u32 transferred_length = sci_req_tx_bytes(request);
2818 "%s: SCI_IO_SUCCESS_IO_DONE_EARLY %d\n",
2822 dev_dbg(&ihost->
pdev->dev,
"%s: SCI_IO_SUCCESS\n",
2829 "%s: SCI_IO_FAILURE_TERMINATED (%p/%p)\n",
2830 __func__, request, task);
2848 isci_request_handle_controller_specific_errors(idev, request,
2888 "%s: invalid completion code: 0x%x - "
2889 "isci_request = %p\n",
2890 __func__, completion_status, request);
2932 smp_req = kaddr + sg->
offset;
2933 sci_swab32_cpy(smp_req, smp_req, sg->
length /
sizeof(
u32));
2970 enum sci_base_request_states
state;
2971 struct sas_task *
task;
2982 state = SCI_REQ_TASK_WAIT_TC_COMP;
2984 state = SCI_REQ_SMP_WAIT_RESP;
2985 }
else if (task && sas_protocol_ata(task->
task_proto) &&
2989 state = SCI_REQ_ATAPI_WAIT_H2D;
2991 state = SCI_REQ_STP_NON_DATA_WAIT_H2D;
2992 }
else if (task->
ata_task.dma_xfer) {
2993 state = SCI_REQ_STP_UDMA_WAIT_TC_COMP;
2995 state = SCI_REQ_STP_PIO_WAIT_H2D;
3011 isci_request_io_request_complete(ihost, ireq,
3022 ireq->
tc->abort = 1;
3025 static void sci_stp_request_started_non_data_await_h2d_completion_enter(
struct sci_base_state_machine *sm)
3040 [SCI_REQ_INIT] = { },
3041 [SCI_REQ_CONSTRUCTED] = { },
3042 [SCI_REQ_STARTED] = {
3043 .enter_state = sci_request_started_state_enter,
3045 [SCI_REQ_STP_NON_DATA_WAIT_H2D] = {
3046 .enter_state = sci_stp_request_started_non_data_await_h2d_completion_enter,
3048 [SCI_REQ_STP_NON_DATA_WAIT_D2H] = { },
3049 [SCI_REQ_STP_PIO_WAIT_H2D] = {
3050 .enter_state = sci_stp_request_started_pio_await_h2d_completion_enter,
3052 [SCI_REQ_STP_PIO_WAIT_FRAME] = { },
3053 [SCI_REQ_STP_PIO_DATA_IN] = { },
3054 [SCI_REQ_STP_PIO_DATA_OUT] = { },
3055 [SCI_REQ_STP_UDMA_WAIT_TC_COMP] = { },
3056 [SCI_REQ_STP_UDMA_WAIT_D2H] = { },
3057 [SCI_REQ_TASK_WAIT_TC_COMP] = { },
3058 [SCI_REQ_TASK_WAIT_TC_RESP] = { },
3059 [SCI_REQ_SMP_WAIT_RESP] = { },
3060 [SCI_REQ_SMP_WAIT_TC_COMP] = { },
3061 [SCI_REQ_ATAPI_WAIT_H2D] = { },
3062 [SCI_REQ_ATAPI_WAIT_PIO_SETUP] = { },
3063 [SCI_REQ_ATAPI_WAIT_D2H] = { },
3064 [SCI_REQ_ATAPI_WAIT_TC_COMP] = { },
3065 [SCI_REQ_COMPLETED] = {
3066 .enter_state = sci_request_completed_state_enter,
3068 [SCI_REQ_ABORTING] = {
3069 .enter_state = sci_request_aborting_state_enter,
3071 [SCI_REQ_FINAL] = { },
3075 sci_general_request_construct(
struct isci_host *ihost,
3079 sci_init_sm(&ireq->
sm, sci_request_state_table, SCI_REQ_INIT);
3091 sci_io_request_construct(
struct isci_host *ihost,
3099 sci_general_request_construct(ihost, idev, ireq);
3106 else if (dev_is_sata(dev))
3108 else if (dev_is_expander(dev))
3126 sci_general_request_construct(ihost, idev, ireq);
3133 if (dev_is_sata(dev))
3143 static enum sci_status isci_request_ssp_request_construct(
3149 "%s: request = %p\n",
3152 status = sci_io_request_construct_basic_ssp(request);
3169 if (!task->
ata_task.device_control_reg_update)
3173 status = sci_io_request_construct_basic_sata(ireq);
3178 ireq->
tc->type.stp.ncq_tag = qc->
tag;
3185 sci_io_request_construct_smp(
struct device *dev,
3187 struct sas_task *task)
3199 smp_req = kaddr + sg->
offset;
3206 switch (smp_req->
func) {
3222 sci_swab32_cpy(smp_req, smp_req, sg->
length /
sizeof(
u32));
3223 cmd = *(
u32 *) smp_req;
3233 task_context = ireq->
tc;
3248 task_context->
abort = 0;
3321 status = sci_io_request_construct_smp(dev, ireq, task);
3324 "%s: failed with status = %d\n",
3349 "%s: idev = 0x%p; request = %p, "
3350 "num_scatter = %d\n",
3375 status = sci_io_request_construct(ihost, idev, request);
3379 "%s: failed request construct\n",
3386 status = isci_smp_request_build(request);
3389 status = isci_request_ssp_request_construct(request);
3394 status = isci_request_stp_request_construct(request);
3398 "%s: unknown protocol\n", __func__);
3419 struct sas_task *task,
3424 ireq = isci_request_from_tag(ihost, tag);
3433 struct isci_tmf *isci_tmf,
3438 ireq = isci_request_from_tag(ihost, tag);
3446 struct sas_task *task,
u16 tag)
3450 unsigned long flags;
3454 ireq = isci_io_request_from_tag(ihost, task, tag);
3456 status = isci_io_request_build(ihost, ireq, idev);
3459 "%s: request_construct failed - status = 0x%x\n",
3469 if (isci_task_is_ncq_recovery(task)) {
3492 "%s: failed request start (0x%x)\n",
3494 spin_unlock_irqrestore(&ihost->
scic_lock, flags);
3507 spin_unlock_irqrestore(&ihost->
scic_lock, flags);