diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/isci/host.c | 60 | ||||
-rw-r--r-- | drivers/scsi/isci/host.h | 27 | ||||
-rw-r--r-- | drivers/scsi/isci/port.c | 4 | ||||
-rw-r--r-- | drivers/scsi/isci/port.h | 6 | ||||
-rw-r--r-- | drivers/scsi/isci/remote_device.c | 396 | ||||
-rw-r--r-- | drivers/scsi/isci/remote_device.h | 148 | ||||
-rw-r--r-- | drivers/scsi/isci/remote_node_context.c | 48 | ||||
-rw-r--r-- | drivers/scsi/isci/remote_node_context.h | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/request.c | 60 | ||||
-rw-r--r-- | drivers/scsi/isci/request.h | 4 | ||||
-rw-r--r-- | drivers/scsi/isci/task.c | 47 |
11 files changed, 365 insertions, 437 deletions
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index 4e11f9e6d766..45d7f71c609a 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c | |||
@@ -272,7 +272,7 @@ static void scic_sds_controller_sdma_completion(struct scic_sds_controller *scic | |||
272 | { | 272 | { |
273 | u32 index; | 273 | u32 index; |
274 | struct isci_request *ireq; | 274 | struct isci_request *ireq; |
275 | struct scic_sds_remote_device *device; | 275 | struct isci_remote_device *idev; |
276 | 276 | ||
277 | index = SCU_GET_COMPLETION_INDEX(completion_entry); | 277 | index = SCU_GET_COMPLETION_INDEX(completion_entry); |
278 | 278 | ||
@@ -289,9 +289,9 @@ static void scic_sds_controller_sdma_completion(struct scic_sds_controller *scic | |||
289 | case SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_RNC: | 289 | case SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_RNC: |
290 | case SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC: | 290 | case SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC: |
291 | case SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC: | 291 | case SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC: |
292 | device = scic->device_table[index]; | 292 | idev = scic->device_table[index]; |
293 | dev_warn(scic_to_dev(scic), "%s: %x for device %p\n", | 293 | dev_warn(scic_to_dev(scic), "%s: %x for device %p\n", |
294 | __func__, completion_entry, device); | 294 | __func__, completion_entry, idev); |
295 | /* @todo For a port RNC operation we need to fail the | 295 | /* @todo For a port RNC operation we need to fail the |
296 | * device | 296 | * device |
297 | */ | 297 | */ |
@@ -312,7 +312,7 @@ static void scic_sds_controller_unsolicited_frame(struct scic_sds_controller *sc | |||
312 | struct isci_host *ihost = scic_to_ihost(scic); | 312 | struct isci_host *ihost = scic_to_ihost(scic); |
313 | struct scu_unsolicited_frame_header *frame_header; | 313 | struct scu_unsolicited_frame_header *frame_header; |
314 | struct isci_phy *iphy; | 314 | struct isci_phy *iphy; |
315 | struct scic_sds_remote_device *device; | 315 | struct isci_remote_device *idev; |
316 | 316 | ||
317 | enum sci_status result = SCI_FAILURE; | 317 | enum sci_status result = SCI_FAILURE; |
318 | 318 | ||
@@ -348,12 +348,12 @@ static void scic_sds_controller_unsolicited_frame(struct scic_sds_controller *sc | |||
348 | result = scic_sds_phy_frame_handler(iphy, frame_index); | 348 | result = scic_sds_phy_frame_handler(iphy, frame_index); |
349 | } else { | 349 | } else { |
350 | if (index < scic->remote_node_entries) | 350 | if (index < scic->remote_node_entries) |
351 | device = scic->device_table[index]; | 351 | idev = scic->device_table[index]; |
352 | else | 352 | else |
353 | device = NULL; | 353 | idev = NULL; |
354 | 354 | ||
355 | if (device != NULL) | 355 | if (idev != NULL) |
356 | result = scic_sds_remote_device_frame_handler(device, frame_index); | 356 | result = scic_sds_remote_device_frame_handler(idev, frame_index); |
357 | else | 357 | else |
358 | scic_sds_controller_release_frame(scic, frame_index); | 358 | scic_sds_controller_release_frame(scic, frame_index); |
359 | } | 359 | } |
@@ -370,7 +370,7 @@ static void scic_sds_controller_event_completion(struct scic_sds_controller *sci | |||
370 | u32 completion_entry) | 370 | u32 completion_entry) |
371 | { | 371 | { |
372 | struct isci_host *ihost = scic_to_ihost(scic); | 372 | struct isci_host *ihost = scic_to_ihost(scic); |
373 | struct scic_sds_remote_device *device; | 373 | struct isci_remote_device *idev; |
374 | struct isci_request *ireq; | 374 | struct isci_request *ireq; |
375 | struct isci_phy *iphy; | 375 | struct isci_phy *iphy; |
376 | u32 index; | 376 | u32 index; |
@@ -426,9 +426,9 @@ static void scic_sds_controller_event_completion(struct scic_sds_controller *sci | |||
426 | break; | 426 | break; |
427 | 427 | ||
428 | case SCU_EVENT_SPECIFIC_IT_NEXUS_TIMEOUT: | 428 | case SCU_EVENT_SPECIFIC_IT_NEXUS_TIMEOUT: |
429 | device = scic->device_table[index]; | 429 | idev = scic->device_table[index]; |
430 | if (device != NULL) | 430 | if (idev != NULL) |
431 | scic_sds_remote_device_event_handler(device, completion_entry); | 431 | scic_sds_remote_device_event_handler(idev, completion_entry); |
432 | else | 432 | else |
433 | dev_warn(scic_to_dev(scic), | 433 | dev_warn(scic_to_dev(scic), |
434 | "%s: SCIC Controller 0x%p received " | 434 | "%s: SCIC Controller 0x%p received " |
@@ -460,10 +460,10 @@ static void scic_sds_controller_event_completion(struct scic_sds_controller *sci | |||
460 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX: | 460 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX: |
461 | case SCU_EVENT_TYPE_RNC_OPS_MISC: | 461 | case SCU_EVENT_TYPE_RNC_OPS_MISC: |
462 | if (index < scic->remote_node_entries) { | 462 | if (index < scic->remote_node_entries) { |
463 | device = scic->device_table[index]; | 463 | idev = scic->device_table[index]; |
464 | 464 | ||
465 | if (device != NULL) | 465 | if (idev != NULL) |
466 | scic_sds_remote_device_event_handler(device, completion_entry); | 466 | scic_sds_remote_device_event_handler(idev, completion_entry); |
467 | } else | 467 | } else |
468 | dev_err(scic_to_dev(scic), | 468 | dev_err(scic_to_dev(scic), |
469 | "%s: SCIC Controller 0x%p received event 0x%x " | 469 | "%s: SCIC Controller 0x%p received event 0x%x " |
@@ -2549,13 +2549,13 @@ static bool scic_sds_controller_has_remote_devices_stopping( | |||
2549 | * object that the remote device has stopped. | 2549 | * object that the remote device has stopped. |
2550 | */ | 2550 | */ |
2551 | void scic_sds_controller_remote_device_stopped(struct scic_sds_controller *scic, | 2551 | void scic_sds_controller_remote_device_stopped(struct scic_sds_controller *scic, |
2552 | struct scic_sds_remote_device *sci_dev) | 2552 | struct isci_remote_device *idev) |
2553 | { | 2553 | { |
2554 | if (scic->sm.current_state_id != SCIC_STOPPING) { | 2554 | if (scic->sm.current_state_id != SCIC_STOPPING) { |
2555 | dev_dbg(scic_to_dev(scic), | 2555 | dev_dbg(scic_to_dev(scic), |
2556 | "SCIC Controller 0x%p remote device stopped event " | 2556 | "SCIC Controller 0x%p remote device stopped event " |
2557 | "from device 0x%p in unexpected state %d\n", | 2557 | "from device 0x%p in unexpected state %d\n", |
2558 | scic, sci_dev, | 2558 | scic, idev, |
2559 | scic->sm.current_state_id); | 2559 | scic->sm.current_state_id); |
2560 | return; | 2560 | return; |
2561 | } | 2561 | } |
@@ -2622,18 +2622,18 @@ struct isci_request *scic_request_by_tag(struct scic_sds_controller *scic, u16 i | |||
2622 | */ | 2622 | */ |
2623 | enum sci_status scic_sds_controller_allocate_remote_node_context( | 2623 | enum sci_status scic_sds_controller_allocate_remote_node_context( |
2624 | struct scic_sds_controller *scic, | 2624 | struct scic_sds_controller *scic, |
2625 | struct scic_sds_remote_device *sci_dev, | 2625 | struct isci_remote_device *idev, |
2626 | u16 *node_id) | 2626 | u16 *node_id) |
2627 | { | 2627 | { |
2628 | u16 node_index; | 2628 | u16 node_index; |
2629 | u32 remote_node_count = scic_sds_remote_device_node_count(sci_dev); | 2629 | u32 remote_node_count = scic_sds_remote_device_node_count(idev); |
2630 | 2630 | ||
2631 | node_index = scic_sds_remote_node_table_allocate_remote_node( | 2631 | node_index = scic_sds_remote_node_table_allocate_remote_node( |
2632 | &scic->available_remote_nodes, remote_node_count | 2632 | &scic->available_remote_nodes, remote_node_count |
2633 | ); | 2633 | ); |
2634 | 2634 | ||
2635 | if (node_index != SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) { | 2635 | if (node_index != SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) { |
2636 | scic->device_table[node_index] = sci_dev; | 2636 | scic->device_table[node_index] = idev; |
2637 | 2637 | ||
2638 | *node_id = node_index; | 2638 | *node_id = node_index; |
2639 | 2639 | ||
@@ -2654,12 +2654,12 @@ enum sci_status scic_sds_controller_allocate_remote_node_context( | |||
2654 | */ | 2654 | */ |
2655 | void scic_sds_controller_free_remote_node_context( | 2655 | void scic_sds_controller_free_remote_node_context( |
2656 | struct scic_sds_controller *scic, | 2656 | struct scic_sds_controller *scic, |
2657 | struct scic_sds_remote_device *sci_dev, | 2657 | struct isci_remote_device *idev, |
2658 | u16 node_id) | 2658 | u16 node_id) |
2659 | { | 2659 | { |
2660 | u32 remote_node_count = scic_sds_remote_device_node_count(sci_dev); | 2660 | u32 remote_node_count = scic_sds_remote_device_node_count(idev); |
2661 | 2661 | ||
2662 | if (scic->device_table[node_id] == sci_dev) { | 2662 | if (scic->device_table[node_id] == idev) { |
2663 | scic->device_table[node_id] = NULL; | 2663 | scic->device_table[node_id] = NULL; |
2664 | 2664 | ||
2665 | scic_sds_remote_node_table_release_remote_node_index( | 2665 | scic_sds_remote_node_table_release_remote_node_index( |
@@ -2798,7 +2798,7 @@ enum sci_status isci_free_tag(struct isci_host *ihost, u16 io_tag) | |||
2798 | * user desires to be utilized for this request. | 2798 | * user desires to be utilized for this request. |
2799 | */ | 2799 | */ |
2800 | enum sci_status scic_controller_start_io(struct scic_sds_controller *scic, | 2800 | enum sci_status scic_controller_start_io(struct scic_sds_controller *scic, |
2801 | struct scic_sds_remote_device *rdev, | 2801 | struct isci_remote_device *idev, |
2802 | struct isci_request *ireq) | 2802 | struct isci_request *ireq) |
2803 | { | 2803 | { |
2804 | enum sci_status status; | 2804 | enum sci_status status; |
@@ -2808,7 +2808,7 @@ enum sci_status scic_controller_start_io(struct scic_sds_controller *scic, | |||
2808 | return SCI_FAILURE_INVALID_STATE; | 2808 | return SCI_FAILURE_INVALID_STATE; |
2809 | } | 2809 | } |
2810 | 2810 | ||
2811 | status = scic_sds_remote_device_start_io(scic, rdev, ireq); | 2811 | status = scic_sds_remote_device_start_io(scic, idev, ireq); |
2812 | if (status != SCI_SUCCESS) | 2812 | if (status != SCI_SUCCESS) |
2813 | return status; | 2813 | return status; |
2814 | 2814 | ||
@@ -2835,7 +2835,7 @@ enum sci_status scic_controller_start_io(struct scic_sds_controller *scic, | |||
2835 | */ | 2835 | */ |
2836 | enum sci_status scic_controller_terminate_request( | 2836 | enum sci_status scic_controller_terminate_request( |
2837 | struct scic_sds_controller *scic, | 2837 | struct scic_sds_controller *scic, |
2838 | struct scic_sds_remote_device *rdev, | 2838 | struct isci_remote_device *idev, |
2839 | struct isci_request *ireq) | 2839 | struct isci_request *ireq) |
2840 | { | 2840 | { |
2841 | enum sci_status status; | 2841 | enum sci_status status; |
@@ -2873,7 +2873,7 @@ enum sci_status scic_controller_terminate_request( | |||
2873 | */ | 2873 | */ |
2874 | enum sci_status scic_controller_complete_io( | 2874 | enum sci_status scic_controller_complete_io( |
2875 | struct scic_sds_controller *scic, | 2875 | struct scic_sds_controller *scic, |
2876 | struct scic_sds_remote_device *rdev, | 2876 | struct isci_remote_device *idev, |
2877 | struct isci_request *ireq) | 2877 | struct isci_request *ireq) |
2878 | { | 2878 | { |
2879 | enum sci_status status; | 2879 | enum sci_status status; |
@@ -2884,7 +2884,7 @@ enum sci_status scic_controller_complete_io( | |||
2884 | /* XXX: Implement this function */ | 2884 | /* XXX: Implement this function */ |
2885 | return SCI_FAILURE; | 2885 | return SCI_FAILURE; |
2886 | case SCIC_READY: | 2886 | case SCIC_READY: |
2887 | status = scic_sds_remote_device_complete_io(scic, rdev, ireq); | 2887 | status = scic_sds_remote_device_complete_io(scic, idev, ireq); |
2888 | if (status != SCI_SUCCESS) | 2888 | if (status != SCI_SUCCESS) |
2889 | return status; | 2889 | return status; |
2890 | 2890 | ||
@@ -2923,7 +2923,7 @@ enum sci_status scic_controller_continue_io(struct isci_request *ireq) | |||
2923 | */ | 2923 | */ |
2924 | enum sci_task_status scic_controller_start_task( | 2924 | enum sci_task_status scic_controller_start_task( |
2925 | struct scic_sds_controller *scic, | 2925 | struct scic_sds_controller *scic, |
2926 | struct scic_sds_remote_device *rdev, | 2926 | struct isci_remote_device *idev, |
2927 | struct isci_request *ireq) | 2927 | struct isci_request *ireq) |
2928 | { | 2928 | { |
2929 | enum sci_status status; | 2929 | enum sci_status status; |
@@ -2936,7 +2936,7 @@ enum sci_task_status scic_controller_start_task( | |||
2936 | return SCI_TASK_FAILURE_INVALID_STATE; | 2936 | return SCI_TASK_FAILURE_INVALID_STATE; |
2937 | } | 2937 | } |
2938 | 2938 | ||
2939 | status = scic_sds_remote_device_start_task(scic, rdev, ireq); | 2939 | status = scic_sds_remote_device_start_task(scic, idev, ireq); |
2940 | switch (status) { | 2940 | switch (status) { |
2941 | case SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS: | 2941 | case SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS: |
2942 | set_bit(IREQ_ACTIVE, &ireq->flags); | 2942 | set_bit(IREQ_ACTIVE, &ireq->flags); |
diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h index fb8048e5fce7..ca2e3b0ee0dd 100644 --- a/drivers/scsi/isci/host.h +++ b/drivers/scsi/isci/host.h | |||
@@ -163,7 +163,7 @@ struct scic_sds_controller { | |||
163 | * objects that need to handle device completion notifications from the | 163 | * objects that need to handle device completion notifications from the |
164 | * hardware. The table is RNi based. | 164 | * hardware. The table is RNi based. |
165 | */ | 165 | */ |
166 | struct scic_sds_remote_device *device_table[SCI_MAX_REMOTE_DEVICES]; | 166 | struct isci_remote_device *device_table[SCI_MAX_REMOTE_DEVICES]; |
167 | 167 | ||
168 | /** | 168 | /** |
169 | * This field is the free RNi data structure | 169 | * This field is the free RNi data structure |
@@ -488,12 +488,12 @@ static inline struct isci_host *scic_to_ihost(struct scic_sds_controller *scic) | |||
488 | #define ISCI_TAG_TCI(tag) ((tag) & (SCI_MAX_IO_REQUESTS-1)) | 488 | #define ISCI_TAG_TCI(tag) ((tag) & (SCI_MAX_IO_REQUESTS-1)) |
489 | 489 | ||
490 | /* expander attached sata devices require 3 rnc slots */ | 490 | /* expander attached sata devices require 3 rnc slots */ |
491 | static inline int scic_sds_remote_device_node_count(struct scic_sds_remote_device *sci_dev) | 491 | static inline int scic_sds_remote_device_node_count(struct isci_remote_device *idev) |
492 | { | 492 | { |
493 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 493 | struct domain_device *dev = idev->domain_dev; |
494 | 494 | ||
495 | if ((dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) && | 495 | if ((dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) && |
496 | !sci_dev->is_direct_attached) | 496 | !idev->is_direct_attached) |
497 | return SCU_STP_REMOTE_NODE_COUNT; | 497 | return SCU_STP_REMOTE_NODE_COUNT; |
498 | return SCU_SSP_REMOTE_NODE_COUNT; | 498 | return SCU_SSP_REMOTE_NODE_COUNT; |
499 | } | 499 | } |
@@ -541,11 +541,8 @@ static inline struct device *sciport_to_dev(struct isci_port *iport) | |||
541 | return &iport->isci_host->pdev->dev; | 541 | return &iport->isci_host->pdev->dev; |
542 | } | 542 | } |
543 | 543 | ||
544 | static inline struct device *scirdev_to_dev(struct scic_sds_remote_device *sci_dev) | 544 | static inline struct device *scirdev_to_dev(struct isci_remote_device *idev) |
545 | { | 545 | { |
546 | struct isci_remote_device *idev = | ||
547 | container_of(sci_dev, typeof(*idev), sci); | ||
548 | |||
549 | if (!idev || !idev->isci_port || !idev->isci_port->isci_host) | 546 | if (!idev || !idev->isci_port || !idev->isci_port->isci_host) |
550 | return NULL; | 547 | return NULL; |
551 | 548 | ||
@@ -589,11 +586,11 @@ void scic_sds_controller_copy_sata_response(void *response_buffer, | |||
589 | void *frame_header, | 586 | void *frame_header, |
590 | void *frame_buffer); | 587 | void *frame_buffer); |
591 | enum sci_status scic_sds_controller_allocate_remote_node_context(struct scic_sds_controller *scic, | 588 | enum sci_status scic_sds_controller_allocate_remote_node_context(struct scic_sds_controller *scic, |
592 | struct scic_sds_remote_device *sci_dev, | 589 | struct isci_remote_device *idev, |
593 | u16 *node_id); | 590 | u16 *node_id); |
594 | void scic_sds_controller_free_remote_node_context( | 591 | void scic_sds_controller_free_remote_node_context( |
595 | struct scic_sds_controller *scic, | 592 | struct scic_sds_controller *scic, |
596 | struct scic_sds_remote_device *sci_dev, | 593 | struct isci_remote_device *idev, |
597 | u16 node_id); | 594 | u16 node_id); |
598 | union scu_remote_node_context *scic_sds_controller_get_remote_node_context_buffer( | 595 | union scu_remote_node_context *scic_sds_controller_get_remote_node_context_buffer( |
599 | struct scic_sds_controller *scic, | 596 | struct scic_sds_controller *scic, |
@@ -622,7 +619,7 @@ void scic_sds_controller_link_down( | |||
622 | 619 | ||
623 | void scic_sds_controller_remote_device_stopped( | 620 | void scic_sds_controller_remote_device_stopped( |
624 | struct scic_sds_controller *scic, | 621 | struct scic_sds_controller *scic, |
625 | struct scic_sds_remote_device *sci_dev); | 622 | struct isci_remote_device *idev); |
626 | 623 | ||
627 | void scic_sds_controller_copy_task_context( | 624 | void scic_sds_controller_copy_task_context( |
628 | struct scic_sds_controller *scic, | 625 | struct scic_sds_controller *scic, |
@@ -662,22 +659,22 @@ void scic_controller_disable_interrupts( | |||
662 | 659 | ||
663 | enum sci_status scic_controller_start_io( | 660 | enum sci_status scic_controller_start_io( |
664 | struct scic_sds_controller *scic, | 661 | struct scic_sds_controller *scic, |
665 | struct scic_sds_remote_device *remote_device, | 662 | struct isci_remote_device *idev, |
666 | struct isci_request *ireq); | 663 | struct isci_request *ireq); |
667 | 664 | ||
668 | enum sci_task_status scic_controller_start_task( | 665 | enum sci_task_status scic_controller_start_task( |
669 | struct scic_sds_controller *scic, | 666 | struct scic_sds_controller *scic, |
670 | struct scic_sds_remote_device *remote_device, | 667 | struct isci_remote_device *idev, |
671 | struct isci_request *ireq); | 668 | struct isci_request *ireq); |
672 | 669 | ||
673 | enum sci_status scic_controller_terminate_request( | 670 | enum sci_status scic_controller_terminate_request( |
674 | struct scic_sds_controller *scic, | 671 | struct scic_sds_controller *scic, |
675 | struct scic_sds_remote_device *remote_device, | 672 | struct isci_remote_device *idev, |
676 | struct isci_request *ireq); | 673 | struct isci_request *ireq); |
677 | 674 | ||
678 | enum sci_status scic_controller_complete_io( | 675 | enum sci_status scic_controller_complete_io( |
679 | struct scic_sds_controller *scic, | 676 | struct scic_sds_controller *scic, |
680 | struct scic_sds_remote_device *remote_device, | 677 | struct isci_remote_device *idev, |
681 | struct isci_request *ireq); | 678 | struct isci_request *ireq); |
682 | 679 | ||
683 | void scic_sds_port_configuration_agent_construct( | 680 | void scic_sds_port_configuration_agent_construct( |
diff --git a/drivers/scsi/isci/port.c b/drivers/scsi/isci/port.c index 04591882ee77..df37b1bf7d11 100644 --- a/drivers/scsi/isci/port.c +++ b/drivers/scsi/isci/port.c | |||
@@ -1541,7 +1541,7 @@ enum sci_status scic_sds_port_link_down(struct isci_port *iport, | |||
1541 | } | 1541 | } |
1542 | 1542 | ||
1543 | enum sci_status scic_sds_port_start_io(struct isci_port *iport, | 1543 | enum sci_status scic_sds_port_start_io(struct isci_port *iport, |
1544 | struct scic_sds_remote_device *sci_dev, | 1544 | struct isci_remote_device *idev, |
1545 | struct isci_request *ireq) | 1545 | struct isci_request *ireq) |
1546 | { | 1546 | { |
1547 | enum scic_sds_port_states state; | 1547 | enum scic_sds_port_states state; |
@@ -1561,7 +1561,7 @@ enum sci_status scic_sds_port_start_io(struct isci_port *iport, | |||
1561 | } | 1561 | } |
1562 | 1562 | ||
1563 | enum sci_status scic_sds_port_complete_io(struct isci_port *iport, | 1563 | enum sci_status scic_sds_port_complete_io(struct isci_port *iport, |
1564 | struct scic_sds_remote_device *sci_dev, | 1564 | struct isci_remote_device *idev, |
1565 | struct isci_request *ireq) | 1565 | struct isci_request *ireq) |
1566 | { | 1566 | { |
1567 | enum scic_sds_port_states state; | 1567 | enum scic_sds_port_states state; |
diff --git a/drivers/scsi/isci/port.h b/drivers/scsi/isci/port.h index cdea48ece005..b9bc89bf6519 100644 --- a/drivers/scsi/isci/port.h +++ b/drivers/scsi/isci/port.h | |||
@@ -283,15 +283,15 @@ enum sci_status scic_sds_port_link_down(struct isci_port *iport, | |||
283 | struct isci_phy *iphy); | 283 | struct isci_phy *iphy); |
284 | 284 | ||
285 | struct isci_request; | 285 | struct isci_request; |
286 | struct scic_sds_remote_device; | 286 | struct isci_remote_device; |
287 | enum sci_status scic_sds_port_start_io( | 287 | enum sci_status scic_sds_port_start_io( |
288 | struct isci_port *iport, | 288 | struct isci_port *iport, |
289 | struct scic_sds_remote_device *sci_dev, | 289 | struct isci_remote_device *idev, |
290 | struct isci_request *ireq); | 290 | struct isci_request *ireq); |
291 | 291 | ||
292 | enum sci_status scic_sds_port_complete_io( | 292 | enum sci_status scic_sds_port_complete_io( |
293 | struct isci_port *iport, | 293 | struct isci_port *iport, |
294 | struct scic_sds_remote_device *sci_dev, | 294 | struct isci_remote_device *idev, |
295 | struct isci_request *ireq); | 295 | struct isci_request *ireq); |
296 | 296 | ||
297 | enum sas_linkrate scic_sds_port_get_max_allowed_speed( | 297 | enum sas_linkrate scic_sds_port_get_max_allowed_speed( |
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c index 627cf731bad8..3b0234049a3d 100644 --- a/drivers/scsi/isci/remote_device.c +++ b/drivers/scsi/isci/remote_device.c | |||
@@ -93,7 +93,7 @@ static void isci_remote_device_not_ready(struct isci_host *ihost, | |||
93 | __func__, idev, ireq); | 93 | __func__, idev, ireq); |
94 | 94 | ||
95 | scic_controller_terminate_request(&ihost->sci, | 95 | scic_controller_terminate_request(&ihost->sci, |
96 | &idev->sci, | 96 | idev, |
97 | ireq); | 97 | ireq); |
98 | } | 98 | } |
99 | /* Fall through into the default case... */ | 99 | /* Fall through into the default case... */ |
@@ -127,15 +127,15 @@ static void isci_remote_device_ready(struct isci_host *ihost, struct isci_remote | |||
127 | */ | 127 | */ |
128 | static void rnc_destruct_done(void *_dev) | 128 | static void rnc_destruct_done(void *_dev) |
129 | { | 129 | { |
130 | struct scic_sds_remote_device *sci_dev = _dev; | 130 | struct isci_remote_device *idev = _dev; |
131 | 131 | ||
132 | BUG_ON(sci_dev->started_request_count != 0); | 132 | BUG_ON(idev->started_request_count != 0); |
133 | sci_change_state(&sci_dev->sm, SCI_DEV_STOPPED); | 133 | sci_change_state(&idev->sm, SCI_DEV_STOPPED); |
134 | } | 134 | } |
135 | 135 | ||
136 | static enum sci_status scic_sds_remote_device_terminate_requests(struct scic_sds_remote_device *sci_dev) | 136 | static enum sci_status scic_sds_remote_device_terminate_requests(struct isci_remote_device *idev) |
137 | { | 137 | { |
138 | struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller; | 138 | struct scic_sds_controller *scic = idev->owning_port->owning_controller; |
139 | struct isci_host *ihost = scic_to_ihost(scic); | 139 | struct isci_host *ihost = scic_to_ihost(scic); |
140 | enum sci_status status = SCI_SUCCESS; | 140 | enum sci_status status = SCI_SUCCESS; |
141 | u32 i; | 141 | u32 i; |
@@ -145,10 +145,10 @@ static enum sci_status scic_sds_remote_device_terminate_requests(struct scic_sds | |||
145 | enum sci_status s; | 145 | enum sci_status s; |
146 | 146 | ||
147 | if (!test_bit(IREQ_ACTIVE, &ireq->flags) || | 147 | if (!test_bit(IREQ_ACTIVE, &ireq->flags) || |
148 | ireq->target_device != sci_dev) | 148 | ireq->target_device != idev) |
149 | continue; | 149 | continue; |
150 | 150 | ||
151 | s = scic_controller_terminate_request(scic, sci_dev, ireq); | 151 | s = scic_controller_terminate_request(scic, idev, ireq); |
152 | if (s != SCI_SUCCESS) | 152 | if (s != SCI_SUCCESS) |
153 | status = s; | 153 | status = s; |
154 | } | 154 | } |
@@ -156,10 +156,10 @@ static enum sci_status scic_sds_remote_device_terminate_requests(struct scic_sds | |||
156 | return status; | 156 | return status; |
157 | } | 157 | } |
158 | 158 | ||
159 | enum sci_status scic_remote_device_stop(struct scic_sds_remote_device *sci_dev, | 159 | enum sci_status scic_remote_device_stop(struct isci_remote_device *idev, |
160 | u32 timeout) | 160 | u32 timeout) |
161 | { | 161 | { |
162 | struct sci_base_state_machine *sm = &sci_dev->sm; | 162 | struct sci_base_state_machine *sm = &idev->sm; |
163 | enum scic_sds_remote_device_states state = sm->current_state_id; | 163 | enum scic_sds_remote_device_states state = sm->current_state_id; |
164 | 164 | ||
165 | switch (state) { | 165 | switch (state) { |
@@ -167,16 +167,16 @@ enum sci_status scic_remote_device_stop(struct scic_sds_remote_device *sci_dev, | |||
167 | case SCI_DEV_FAILED: | 167 | case SCI_DEV_FAILED: |
168 | case SCI_DEV_FINAL: | 168 | case SCI_DEV_FINAL: |
169 | default: | 169 | default: |
170 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 170 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", |
171 | __func__, state); | 171 | __func__, state); |
172 | return SCI_FAILURE_INVALID_STATE; | 172 | return SCI_FAILURE_INVALID_STATE; |
173 | case SCI_DEV_STOPPED: | 173 | case SCI_DEV_STOPPED: |
174 | return SCI_SUCCESS; | 174 | return SCI_SUCCESS; |
175 | case SCI_DEV_STARTING: | 175 | case SCI_DEV_STARTING: |
176 | /* device not started so there had better be no requests */ | 176 | /* device not started so there had better be no requests */ |
177 | BUG_ON(sci_dev->started_request_count != 0); | 177 | BUG_ON(idev->started_request_count != 0); |
178 | scic_sds_remote_node_context_destruct(&sci_dev->rnc, | 178 | scic_sds_remote_node_context_destruct(&idev->rnc, |
179 | rnc_destruct_done, sci_dev); | 179 | rnc_destruct_done, idev); |
180 | /* Transition to the stopping state and wait for the | 180 | /* Transition to the stopping state and wait for the |
181 | * remote node to complete being posted and invalidated. | 181 | * remote node to complete being posted and invalidated. |
182 | */ | 182 | */ |
@@ -191,28 +191,28 @@ enum sci_status scic_remote_device_stop(struct scic_sds_remote_device *sci_dev, | |||
191 | case SCI_SMP_DEV_IDLE: | 191 | case SCI_SMP_DEV_IDLE: |
192 | case SCI_SMP_DEV_CMD: | 192 | case SCI_SMP_DEV_CMD: |
193 | sci_change_state(sm, SCI_DEV_STOPPING); | 193 | sci_change_state(sm, SCI_DEV_STOPPING); |
194 | if (sci_dev->started_request_count == 0) { | 194 | if (idev->started_request_count == 0) { |
195 | scic_sds_remote_node_context_destruct(&sci_dev->rnc, | 195 | scic_sds_remote_node_context_destruct(&idev->rnc, |
196 | rnc_destruct_done, sci_dev); | 196 | rnc_destruct_done, idev); |
197 | return SCI_SUCCESS; | 197 | return SCI_SUCCESS; |
198 | } else | 198 | } else |
199 | return scic_sds_remote_device_terminate_requests(sci_dev); | 199 | return scic_sds_remote_device_terminate_requests(idev); |
200 | break; | 200 | break; |
201 | case SCI_DEV_STOPPING: | 201 | case SCI_DEV_STOPPING: |
202 | /* All requests should have been terminated, but if there is an | 202 | /* All requests should have been terminated, but if there is an |
203 | * attempt to stop a device already in the stopping state, then | 203 | * attempt to stop a device already in the stopping state, then |
204 | * try again to terminate. | 204 | * try again to terminate. |
205 | */ | 205 | */ |
206 | return scic_sds_remote_device_terminate_requests(sci_dev); | 206 | return scic_sds_remote_device_terminate_requests(idev); |
207 | case SCI_DEV_RESETTING: | 207 | case SCI_DEV_RESETTING: |
208 | sci_change_state(sm, SCI_DEV_STOPPING); | 208 | sci_change_state(sm, SCI_DEV_STOPPING); |
209 | return SCI_SUCCESS; | 209 | return SCI_SUCCESS; |
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | enum sci_status scic_remote_device_reset(struct scic_sds_remote_device *sci_dev) | 213 | enum sci_status scic_remote_device_reset(struct isci_remote_device *idev) |
214 | { | 214 | { |
215 | struct sci_base_state_machine *sm = &sci_dev->sm; | 215 | struct sci_base_state_machine *sm = &idev->sm; |
216 | enum scic_sds_remote_device_states state = sm->current_state_id; | 216 | enum scic_sds_remote_device_states state = sm->current_state_id; |
217 | 217 | ||
218 | switch (state) { | 218 | switch (state) { |
@@ -226,7 +226,7 @@ enum sci_status scic_remote_device_reset(struct scic_sds_remote_device *sci_dev) | |||
226 | case SCI_DEV_RESETTING: | 226 | case SCI_DEV_RESETTING: |
227 | case SCI_DEV_FINAL: | 227 | case SCI_DEV_FINAL: |
228 | default: | 228 | default: |
229 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 229 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", |
230 | __func__, state); | 230 | __func__, state); |
231 | return SCI_FAILURE_INVALID_STATE; | 231 | return SCI_FAILURE_INVALID_STATE; |
232 | case SCI_DEV_READY: | 232 | case SCI_DEV_READY: |
@@ -240,13 +240,13 @@ enum sci_status scic_remote_device_reset(struct scic_sds_remote_device *sci_dev) | |||
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
243 | enum sci_status scic_remote_device_reset_complete(struct scic_sds_remote_device *sci_dev) | 243 | enum sci_status scic_remote_device_reset_complete(struct isci_remote_device *idev) |
244 | { | 244 | { |
245 | struct sci_base_state_machine *sm = &sci_dev->sm; | 245 | struct sci_base_state_machine *sm = &idev->sm; |
246 | enum scic_sds_remote_device_states state = sm->current_state_id; | 246 | enum scic_sds_remote_device_states state = sm->current_state_id; |
247 | 247 | ||
248 | if (state != SCI_DEV_RESETTING) { | 248 | if (state != SCI_DEV_RESETTING) { |
249 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 249 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", |
250 | __func__, state); | 250 | __func__, state); |
251 | return SCI_FAILURE_INVALID_STATE; | 251 | return SCI_FAILURE_INVALID_STATE; |
252 | } | 252 | } |
@@ -255,28 +255,28 @@ enum sci_status scic_remote_device_reset_complete(struct scic_sds_remote_device | |||
255 | return SCI_SUCCESS; | 255 | return SCI_SUCCESS; |
256 | } | 256 | } |
257 | 257 | ||
258 | enum sci_status scic_sds_remote_device_suspend(struct scic_sds_remote_device *sci_dev, | 258 | enum sci_status scic_sds_remote_device_suspend(struct isci_remote_device *idev, |
259 | u32 suspend_type) | 259 | u32 suspend_type) |
260 | { | 260 | { |
261 | struct sci_base_state_machine *sm = &sci_dev->sm; | 261 | struct sci_base_state_machine *sm = &idev->sm; |
262 | enum scic_sds_remote_device_states state = sm->current_state_id; | 262 | enum scic_sds_remote_device_states state = sm->current_state_id; |
263 | 263 | ||
264 | if (state != SCI_STP_DEV_CMD) { | 264 | if (state != SCI_STP_DEV_CMD) { |
265 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 265 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", |
266 | __func__, state); | 266 | __func__, state); |
267 | return SCI_FAILURE_INVALID_STATE; | 267 | return SCI_FAILURE_INVALID_STATE; |
268 | } | 268 | } |
269 | 269 | ||
270 | return scic_sds_remote_node_context_suspend(&sci_dev->rnc, | 270 | return scic_sds_remote_node_context_suspend(&idev->rnc, |
271 | suspend_type, NULL, NULL); | 271 | suspend_type, NULL, NULL); |
272 | } | 272 | } |
273 | 273 | ||
274 | enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_device *sci_dev, | 274 | enum sci_status scic_sds_remote_device_frame_handler(struct isci_remote_device *idev, |
275 | u32 frame_index) | 275 | u32 frame_index) |
276 | { | 276 | { |
277 | struct sci_base_state_machine *sm = &sci_dev->sm; | 277 | struct sci_base_state_machine *sm = &idev->sm; |
278 | enum scic_sds_remote_device_states state = sm->current_state_id; | 278 | enum scic_sds_remote_device_states state = sm->current_state_id; |
279 | struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller; | 279 | struct scic_sds_controller *scic = idev->owning_port->owning_controller; |
280 | enum sci_status status; | 280 | enum sci_status status; |
281 | 281 | ||
282 | switch (state) { | 282 | switch (state) { |
@@ -287,7 +287,7 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi | |||
287 | case SCI_SMP_DEV_IDLE: | 287 | case SCI_SMP_DEV_IDLE: |
288 | case SCI_DEV_FINAL: | 288 | case SCI_DEV_FINAL: |
289 | default: | 289 | default: |
290 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 290 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", |
291 | __func__, state); | 291 | __func__, state); |
292 | /* Return the frame back to the controller */ | 292 | /* Return the frame back to the controller */ |
293 | scic_sds_controller_release_frame(scic, frame_index); | 293 | scic_sds_controller_release_frame(scic, frame_index); |
@@ -313,7 +313,7 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi | |||
313 | sci_swab32_cpy(&hdr, frame_header, word_cnt); | 313 | sci_swab32_cpy(&hdr, frame_header, word_cnt); |
314 | 314 | ||
315 | ireq = scic_request_by_tag(scic, be16_to_cpu(hdr.tag)); | 315 | ireq = scic_request_by_tag(scic, be16_to_cpu(hdr.tag)); |
316 | if (ireq && ireq->target_device == sci_dev) { | 316 | if (ireq && ireq->target_device == idev) { |
317 | /* The IO request is now in charge of releasing the frame */ | 317 | /* The IO request is now in charge of releasing the frame */ |
318 | status = scic_sds_io_request_frame_handler(ireq, frame_index); | 318 | status = scic_sds_io_request_frame_handler(ireq, frame_index); |
319 | } else { | 319 | } else { |
@@ -335,7 +335,7 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi | |||
335 | 335 | ||
336 | if (hdr->fis_type == FIS_SETDEVBITS && | 336 | if (hdr->fis_type == FIS_SETDEVBITS && |
337 | (hdr->status & ATA_ERR)) { | 337 | (hdr->status & ATA_ERR)) { |
338 | sci_dev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; | 338 | idev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; |
339 | 339 | ||
340 | /* TODO Check sactive and complete associated IO if any. */ | 340 | /* TODO Check sactive and complete associated IO if any. */ |
341 | sci_change_state(sm, SCI_STP_DEV_NCQ_ERROR); | 341 | sci_change_state(sm, SCI_STP_DEV_NCQ_ERROR); |
@@ -345,8 +345,8 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi | |||
345 | * Some devices return D2H FIS when an NCQ error is detected. | 345 | * Some devices return D2H FIS when an NCQ error is detected. |
346 | * Treat this like an SDB error FIS ready reason. | 346 | * Treat this like an SDB error FIS ready reason. |
347 | */ | 347 | */ |
348 | sci_dev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; | 348 | idev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; |
349 | sci_change_state(&sci_dev->sm, SCI_STP_DEV_NCQ_ERROR); | 349 | sci_change_state(&idev->sm, SCI_STP_DEV_NCQ_ERROR); |
350 | } else | 350 | } else |
351 | status = SCI_FAILURE; | 351 | status = SCI_FAILURE; |
352 | 352 | ||
@@ -359,17 +359,17 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi | |||
359 | * in this state. All unsolicited frames are forwarded to the io request | 359 | * in this state. All unsolicited frames are forwarded to the io request |
360 | * object. | 360 | * object. |
361 | */ | 361 | */ |
362 | status = scic_sds_io_request_frame_handler(sci_dev->working_request, frame_index); | 362 | status = scic_sds_io_request_frame_handler(idev->working_request, frame_index); |
363 | break; | 363 | break; |
364 | } | 364 | } |
365 | 365 | ||
366 | return status; | 366 | return status; |
367 | } | 367 | } |
368 | 368 | ||
369 | static bool is_remote_device_ready(struct scic_sds_remote_device *sci_dev) | 369 | static bool is_remote_device_ready(struct isci_remote_device *idev) |
370 | { | 370 | { |
371 | 371 | ||
372 | struct sci_base_state_machine *sm = &sci_dev->sm; | 372 | struct sci_base_state_machine *sm = &idev->sm; |
373 | enum scic_sds_remote_device_states state = sm->current_state_id; | 373 | enum scic_sds_remote_device_states state = sm->current_state_id; |
374 | 374 | ||
375 | switch (state) { | 375 | switch (state) { |
@@ -387,10 +387,10 @@ static bool is_remote_device_ready(struct scic_sds_remote_device *sci_dev) | |||
387 | } | 387 | } |
388 | } | 388 | } |
389 | 389 | ||
390 | enum sci_status scic_sds_remote_device_event_handler(struct scic_sds_remote_device *sci_dev, | 390 | enum sci_status scic_sds_remote_device_event_handler(struct isci_remote_device *idev, |
391 | u32 event_code) | 391 | u32 event_code) |
392 | { | 392 | { |
393 | struct sci_base_state_machine *sm = &sci_dev->sm; | 393 | struct sci_base_state_machine *sm = &idev->sm; |
394 | enum scic_sds_remote_device_states state = sm->current_state_id; | 394 | enum scic_sds_remote_device_states state = sm->current_state_id; |
395 | enum sci_status status; | 395 | enum sci_status status; |
396 | 396 | ||
@@ -398,21 +398,21 @@ enum sci_status scic_sds_remote_device_event_handler(struct scic_sds_remote_devi | |||
398 | case SCU_EVENT_TYPE_RNC_OPS_MISC: | 398 | case SCU_EVENT_TYPE_RNC_OPS_MISC: |
399 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX: | 399 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX: |
400 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX: | 400 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX: |
401 | status = scic_sds_remote_node_context_event_handler(&sci_dev->rnc, event_code); | 401 | status = scic_sds_remote_node_context_event_handler(&idev->rnc, event_code); |
402 | break; | 402 | break; |
403 | case SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT: | 403 | case SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT: |
404 | if (scu_get_event_code(event_code) == SCU_EVENT_IT_NEXUS_TIMEOUT) { | 404 | if (scu_get_event_code(event_code) == SCU_EVENT_IT_NEXUS_TIMEOUT) { |
405 | status = SCI_SUCCESS; | 405 | status = SCI_SUCCESS; |
406 | 406 | ||
407 | /* Suspend the associated RNC */ | 407 | /* Suspend the associated RNC */ |
408 | scic_sds_remote_node_context_suspend(&sci_dev->rnc, | 408 | scic_sds_remote_node_context_suspend(&idev->rnc, |
409 | SCI_SOFTWARE_SUSPENSION, | 409 | SCI_SOFTWARE_SUSPENSION, |
410 | NULL, NULL); | 410 | NULL, NULL); |
411 | 411 | ||
412 | dev_dbg(scirdev_to_dev(sci_dev), | 412 | dev_dbg(scirdev_to_dev(idev), |
413 | "%s: device: %p event code: %x: %s\n", | 413 | "%s: device: %p event code: %x: %s\n", |
414 | __func__, sci_dev, event_code, | 414 | __func__, idev, event_code, |
415 | is_remote_device_ready(sci_dev) | 415 | is_remote_device_ready(idev) |
416 | ? "I_T_Nexus_Timeout event" | 416 | ? "I_T_Nexus_Timeout event" |
417 | : "I_T_Nexus_Timeout event in wrong state"); | 417 | : "I_T_Nexus_Timeout event in wrong state"); |
418 | 418 | ||
@@ -420,10 +420,10 @@ enum sci_status scic_sds_remote_device_event_handler(struct scic_sds_remote_devi | |||
420 | } | 420 | } |
421 | /* Else, fall through and treat as unhandled... */ | 421 | /* Else, fall through and treat as unhandled... */ |
422 | default: | 422 | default: |
423 | dev_dbg(scirdev_to_dev(sci_dev), | 423 | dev_dbg(scirdev_to_dev(idev), |
424 | "%s: device: %p event code: %x: %s\n", | 424 | "%s: device: %p event code: %x: %s\n", |
425 | __func__, sci_dev, event_code, | 425 | __func__, idev, event_code, |
426 | is_remote_device_ready(sci_dev) | 426 | is_remote_device_ready(idev) |
427 | ? "unexpected event" | 427 | ? "unexpected event" |
428 | : "unexpected event in wrong state"); | 428 | : "unexpected event in wrong state"); |
429 | status = SCI_FAILURE_INVALID_STATE; | 429 | status = SCI_FAILURE_INVALID_STATE; |
@@ -440,34 +440,34 @@ enum sci_status scic_sds_remote_device_event_handler(struct scic_sds_remote_devi | |||
440 | */ | 440 | */ |
441 | if (scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX || | 441 | if (scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX || |
442 | scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX) | 442 | scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX) |
443 | status = scic_sds_remote_node_context_resume(&sci_dev->rnc, NULL, NULL); | 443 | status = scic_sds_remote_node_context_resume(&idev->rnc, NULL, NULL); |
444 | } | 444 | } |
445 | 445 | ||
446 | return status; | 446 | return status; |
447 | } | 447 | } |
448 | 448 | ||
449 | static void scic_sds_remote_device_start_request(struct scic_sds_remote_device *sci_dev, | 449 | static void scic_sds_remote_device_start_request(struct isci_remote_device *idev, |
450 | struct isci_request *ireq, | 450 | struct isci_request *ireq, |
451 | enum sci_status status) | 451 | enum sci_status status) |
452 | { | 452 | { |
453 | struct isci_port *iport = sci_dev->owning_port; | 453 | struct isci_port *iport = idev->owning_port; |
454 | 454 | ||
455 | /* cleanup requests that failed after starting on the port */ | 455 | /* cleanup requests that failed after starting on the port */ |
456 | if (status != SCI_SUCCESS) | 456 | if (status != SCI_SUCCESS) |
457 | scic_sds_port_complete_io(iport, sci_dev, ireq); | 457 | scic_sds_port_complete_io(iport, idev, ireq); |
458 | else { | 458 | else { |
459 | kref_get(&sci_dev_to_idev(sci_dev)->kref); | 459 | kref_get(&idev->kref); |
460 | scic_sds_remote_device_increment_request_count(sci_dev); | 460 | scic_sds_remote_device_increment_request_count(idev); |
461 | } | 461 | } |
462 | } | 462 | } |
463 | 463 | ||
464 | enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic, | 464 | enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic, |
465 | struct scic_sds_remote_device *sci_dev, | 465 | struct isci_remote_device *idev, |
466 | struct isci_request *ireq) | 466 | struct isci_request *ireq) |
467 | { | 467 | { |
468 | struct sci_base_state_machine *sm = &sci_dev->sm; | 468 | struct sci_base_state_machine *sm = &idev->sm; |
469 | enum scic_sds_remote_device_states state = sm->current_state_id; | 469 | enum scic_sds_remote_device_states state = sm->current_state_id; |
470 | struct isci_port *iport = sci_dev->owning_port; | 470 | struct isci_port *iport = idev->owning_port; |
471 | enum sci_status status; | 471 | enum sci_status status; |
472 | 472 | ||
473 | switch (state) { | 473 | switch (state) { |
@@ -480,7 +480,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
480 | case SCI_DEV_RESETTING: | 480 | case SCI_DEV_RESETTING: |
481 | case SCI_DEV_FINAL: | 481 | case SCI_DEV_FINAL: |
482 | default: | 482 | default: |
483 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 483 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", |
484 | __func__, state); | 484 | __func__, state); |
485 | return SCI_FAILURE_INVALID_STATE; | 485 | return SCI_FAILURE_INVALID_STATE; |
486 | case SCI_DEV_READY: | 486 | case SCI_DEV_READY: |
@@ -489,11 +489,11 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
489 | * successful it will start the request for the port object then | 489 | * successful it will start the request for the port object then |
490 | * increment its own request count. | 490 | * increment its own request count. |
491 | */ | 491 | */ |
492 | status = scic_sds_port_start_io(iport, sci_dev, ireq); | 492 | status = scic_sds_port_start_io(iport, idev, ireq); |
493 | if (status != SCI_SUCCESS) | 493 | if (status != SCI_SUCCESS) |
494 | return status; | 494 | return status; |
495 | 495 | ||
496 | status = scic_sds_remote_node_context_start_io(&sci_dev->rnc, ireq); | 496 | status = scic_sds_remote_node_context_start_io(&idev->rnc, ireq); |
497 | if (status != SCI_SUCCESS) | 497 | if (status != SCI_SUCCESS) |
498 | break; | 498 | break; |
499 | 499 | ||
@@ -511,11 +511,11 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
511 | enum scic_sds_remote_device_states new_state; | 511 | enum scic_sds_remote_device_states new_state; |
512 | struct sas_task *task = isci_request_access_task(ireq); | 512 | struct sas_task *task = isci_request_access_task(ireq); |
513 | 513 | ||
514 | status = scic_sds_port_start_io(iport, sci_dev, ireq); | 514 | status = scic_sds_port_start_io(iport, idev, ireq); |
515 | if (status != SCI_SUCCESS) | 515 | if (status != SCI_SUCCESS) |
516 | return status; | 516 | return status; |
517 | 517 | ||
518 | status = scic_sds_remote_node_context_start_io(&sci_dev->rnc, ireq); | 518 | status = scic_sds_remote_node_context_start_io(&idev->rnc, ireq); |
519 | if (status != SCI_SUCCESS) | 519 | if (status != SCI_SUCCESS) |
520 | break; | 520 | break; |
521 | 521 | ||
@@ -526,7 +526,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
526 | if (task->ata_task.use_ncq) | 526 | if (task->ata_task.use_ncq) |
527 | new_state = SCI_STP_DEV_NCQ; | 527 | new_state = SCI_STP_DEV_NCQ; |
528 | else { | 528 | else { |
529 | sci_dev->working_request = ireq; | 529 | idev->working_request = ireq; |
530 | new_state = SCI_STP_DEV_CMD; | 530 | new_state = SCI_STP_DEV_CMD; |
531 | } | 531 | } |
532 | sci_change_state(sm, new_state); | 532 | sci_change_state(sm, new_state); |
@@ -536,11 +536,11 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
536 | struct sas_task *task = isci_request_access_task(ireq); | 536 | struct sas_task *task = isci_request_access_task(ireq); |
537 | 537 | ||
538 | if (task->ata_task.use_ncq) { | 538 | if (task->ata_task.use_ncq) { |
539 | status = scic_sds_port_start_io(iport, sci_dev, ireq); | 539 | status = scic_sds_port_start_io(iport, idev, ireq); |
540 | if (status != SCI_SUCCESS) | 540 | if (status != SCI_SUCCESS) |
541 | return status; | 541 | return status; |
542 | 542 | ||
543 | status = scic_sds_remote_node_context_start_io(&sci_dev->rnc, ireq); | 543 | status = scic_sds_remote_node_context_start_io(&idev->rnc, ireq); |
544 | if (status != SCI_SUCCESS) | 544 | if (status != SCI_SUCCESS) |
545 | break; | 545 | break; |
546 | 546 | ||
@@ -552,11 +552,11 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
552 | case SCI_STP_DEV_AWAIT_RESET: | 552 | case SCI_STP_DEV_AWAIT_RESET: |
553 | return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; | 553 | return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; |
554 | case SCI_SMP_DEV_IDLE: | 554 | case SCI_SMP_DEV_IDLE: |
555 | status = scic_sds_port_start_io(iport, sci_dev, ireq); | 555 | status = scic_sds_port_start_io(iport, idev, ireq); |
556 | if (status != SCI_SUCCESS) | 556 | if (status != SCI_SUCCESS) |
557 | return status; | 557 | return status; |
558 | 558 | ||
559 | status = scic_sds_remote_node_context_start_io(&sci_dev->rnc, ireq); | 559 | status = scic_sds_remote_node_context_start_io(&idev->rnc, ireq); |
560 | if (status != SCI_SUCCESS) | 560 | if (status != SCI_SUCCESS) |
561 | break; | 561 | break; |
562 | 562 | ||
@@ -564,8 +564,8 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
564 | if (status != SCI_SUCCESS) | 564 | if (status != SCI_SUCCESS) |
565 | break; | 565 | break; |
566 | 566 | ||
567 | sci_dev->working_request = ireq; | 567 | idev->working_request = ireq; |
568 | sci_change_state(&sci_dev->sm, SCI_SMP_DEV_CMD); | 568 | sci_change_state(&idev->sm, SCI_SMP_DEV_CMD); |
569 | break; | 569 | break; |
570 | case SCI_STP_DEV_CMD: | 570 | case SCI_STP_DEV_CMD: |
571 | case SCI_SMP_DEV_CMD: | 571 | case SCI_SMP_DEV_CMD: |
@@ -575,12 +575,12 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
575 | return SCI_FAILURE_INVALID_STATE; | 575 | return SCI_FAILURE_INVALID_STATE; |
576 | } | 576 | } |
577 | 577 | ||
578 | scic_sds_remote_device_start_request(sci_dev, ireq, status); | 578 | scic_sds_remote_device_start_request(idev, ireq, status); |
579 | return status; | 579 | return status; |
580 | } | 580 | } |
581 | 581 | ||
582 | static enum sci_status common_complete_io(struct isci_port *iport, | 582 | static enum sci_status common_complete_io(struct isci_port *iport, |
583 | struct scic_sds_remote_device *sci_dev, | 583 | struct isci_remote_device *idev, |
584 | struct isci_request *ireq) | 584 | struct isci_request *ireq) |
585 | { | 585 | { |
586 | enum sci_status status; | 586 | enum sci_status status; |
@@ -589,21 +589,21 @@ static enum sci_status common_complete_io(struct isci_port *iport, | |||
589 | if (status != SCI_SUCCESS) | 589 | if (status != SCI_SUCCESS) |
590 | return status; | 590 | return status; |
591 | 591 | ||
592 | status = scic_sds_port_complete_io(iport, sci_dev, ireq); | 592 | status = scic_sds_port_complete_io(iport, idev, ireq); |
593 | if (status != SCI_SUCCESS) | 593 | if (status != SCI_SUCCESS) |
594 | return status; | 594 | return status; |
595 | 595 | ||
596 | scic_sds_remote_device_decrement_request_count(sci_dev); | 596 | scic_sds_remote_device_decrement_request_count(idev); |
597 | return status; | 597 | return status; |
598 | } | 598 | } |
599 | 599 | ||
600 | enum sci_status scic_sds_remote_device_complete_io(struct scic_sds_controller *scic, | 600 | enum sci_status scic_sds_remote_device_complete_io(struct scic_sds_controller *scic, |
601 | struct scic_sds_remote_device *sci_dev, | 601 | struct isci_remote_device *idev, |
602 | struct isci_request *ireq) | 602 | struct isci_request *ireq) |
603 | { | 603 | { |
604 | struct sci_base_state_machine *sm = &sci_dev->sm; | 604 | struct sci_base_state_machine *sm = &idev->sm; |
605 | enum scic_sds_remote_device_states state = sm->current_state_id; | 605 | enum scic_sds_remote_device_states state = sm->current_state_id; |
606 | struct isci_port *iport = sci_dev->owning_port; | 606 | struct isci_port *iport = idev->owning_port; |
607 | enum sci_status status; | 607 | enum sci_status status; |
608 | 608 | ||
609 | switch (state) { | 609 | switch (state) { |
@@ -615,18 +615,18 @@ enum sci_status scic_sds_remote_device_complete_io(struct scic_sds_controller *s | |||
615 | case SCI_DEV_FAILED: | 615 | case SCI_DEV_FAILED: |
616 | case SCI_DEV_FINAL: | 616 | case SCI_DEV_FINAL: |
617 | default: | 617 | default: |
618 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 618 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", |
619 | __func__, state); | 619 | __func__, state); |
620 | return SCI_FAILURE_INVALID_STATE; | 620 | return SCI_FAILURE_INVALID_STATE; |
621 | case SCI_DEV_READY: | 621 | case SCI_DEV_READY: |
622 | case SCI_STP_DEV_AWAIT_RESET: | 622 | case SCI_STP_DEV_AWAIT_RESET: |
623 | case SCI_DEV_RESETTING: | 623 | case SCI_DEV_RESETTING: |
624 | status = common_complete_io(iport, sci_dev, ireq); | 624 | status = common_complete_io(iport, idev, ireq); |
625 | break; | 625 | break; |
626 | case SCI_STP_DEV_CMD: | 626 | case SCI_STP_DEV_CMD: |
627 | case SCI_STP_DEV_NCQ: | 627 | case SCI_STP_DEV_NCQ: |
628 | case SCI_STP_DEV_NCQ_ERROR: | 628 | case SCI_STP_DEV_NCQ_ERROR: |
629 | status = common_complete_io(iport, sci_dev, ireq); | 629 | status = common_complete_io(iport, idev, ireq); |
630 | if (status != SCI_SUCCESS) | 630 | if (status != SCI_SUCCESS) |
631 | break; | 631 | break; |
632 | 632 | ||
@@ -637,54 +637,54 @@ enum sci_status scic_sds_remote_device_complete_io(struct scic_sds_controller *s | |||
637 | * status of "DEVICE_RESET_REQUIRED", instead of "INVALID STATE". | 637 | * status of "DEVICE_RESET_REQUIRED", instead of "INVALID STATE". |
638 | */ | 638 | */ |
639 | sci_change_state(sm, SCI_STP_DEV_AWAIT_RESET); | 639 | sci_change_state(sm, SCI_STP_DEV_AWAIT_RESET); |
640 | } else if (scic_sds_remote_device_get_request_count(sci_dev) == 0) | 640 | } else if (scic_sds_remote_device_get_request_count(idev) == 0) |
641 | sci_change_state(sm, SCI_STP_DEV_IDLE); | 641 | sci_change_state(sm, SCI_STP_DEV_IDLE); |
642 | break; | 642 | break; |
643 | case SCI_SMP_DEV_CMD: | 643 | case SCI_SMP_DEV_CMD: |
644 | status = common_complete_io(iport, sci_dev, ireq); | 644 | status = common_complete_io(iport, idev, ireq); |
645 | if (status != SCI_SUCCESS) | 645 | if (status != SCI_SUCCESS) |
646 | break; | 646 | break; |
647 | sci_change_state(sm, SCI_SMP_DEV_IDLE); | 647 | sci_change_state(sm, SCI_SMP_DEV_IDLE); |
648 | break; | 648 | break; |
649 | case SCI_DEV_STOPPING: | 649 | case SCI_DEV_STOPPING: |
650 | status = common_complete_io(iport, sci_dev, ireq); | 650 | status = common_complete_io(iport, idev, ireq); |
651 | if (status != SCI_SUCCESS) | 651 | if (status != SCI_SUCCESS) |
652 | break; | 652 | break; |
653 | 653 | ||
654 | if (scic_sds_remote_device_get_request_count(sci_dev) == 0) | 654 | if (scic_sds_remote_device_get_request_count(idev) == 0) |
655 | scic_sds_remote_node_context_destruct(&sci_dev->rnc, | 655 | scic_sds_remote_node_context_destruct(&idev->rnc, |
656 | rnc_destruct_done, | 656 | rnc_destruct_done, |
657 | sci_dev); | 657 | idev); |
658 | break; | 658 | break; |
659 | } | 659 | } |
660 | 660 | ||
661 | if (status != SCI_SUCCESS) | 661 | if (status != SCI_SUCCESS) |
662 | dev_err(scirdev_to_dev(sci_dev), | 662 | dev_err(scirdev_to_dev(idev), |
663 | "%s: Port:0x%p Device:0x%p Request:0x%p Status:0x%x " | 663 | "%s: Port:0x%p Device:0x%p Request:0x%p Status:0x%x " |
664 | "could not complete\n", __func__, iport, | 664 | "could not complete\n", __func__, iport, |
665 | sci_dev, ireq, status); | 665 | idev, ireq, status); |
666 | else | 666 | else |
667 | isci_put_device(sci_dev_to_idev(sci_dev)); | 667 | isci_put_device(idev); |
668 | 668 | ||
669 | return status; | 669 | return status; |
670 | } | 670 | } |
671 | 671 | ||
672 | static void scic_sds_remote_device_continue_request(void *dev) | 672 | static void scic_sds_remote_device_continue_request(void *dev) |
673 | { | 673 | { |
674 | struct scic_sds_remote_device *sci_dev = dev; | 674 | struct isci_remote_device *idev = dev; |
675 | 675 | ||
676 | /* we need to check if this request is still valid to continue. */ | 676 | /* we need to check if this request is still valid to continue. */ |
677 | if (sci_dev->working_request) | 677 | if (idev->working_request) |
678 | scic_controller_continue_io(sci_dev->working_request); | 678 | scic_controller_continue_io(idev->working_request); |
679 | } | 679 | } |
680 | 680 | ||
681 | enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *scic, | 681 | enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *scic, |
682 | struct scic_sds_remote_device *sci_dev, | 682 | struct isci_remote_device *idev, |
683 | struct isci_request *ireq) | 683 | struct isci_request *ireq) |
684 | { | 684 | { |
685 | struct sci_base_state_machine *sm = &sci_dev->sm; | 685 | struct sci_base_state_machine *sm = &idev->sm; |
686 | enum scic_sds_remote_device_states state = sm->current_state_id; | 686 | enum scic_sds_remote_device_states state = sm->current_state_id; |
687 | struct isci_port *iport = sci_dev->owning_port; | 687 | struct isci_port *iport = idev->owning_port; |
688 | enum sci_status status; | 688 | enum sci_status status; |
689 | 689 | ||
690 | switch (state) { | 690 | switch (state) { |
@@ -698,7 +698,7 @@ enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *sc | |||
698 | case SCI_DEV_RESETTING: | 698 | case SCI_DEV_RESETTING: |
699 | case SCI_DEV_FINAL: | 699 | case SCI_DEV_FINAL: |
700 | default: | 700 | default: |
701 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 701 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", |
702 | __func__, state); | 702 | __func__, state); |
703 | return SCI_FAILURE_INVALID_STATE; | 703 | return SCI_FAILURE_INVALID_STATE; |
704 | case SCI_STP_DEV_IDLE: | 704 | case SCI_STP_DEV_IDLE: |
@@ -706,11 +706,11 @@ enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *sc | |||
706 | case SCI_STP_DEV_NCQ: | 706 | case SCI_STP_DEV_NCQ: |
707 | case SCI_STP_DEV_NCQ_ERROR: | 707 | case SCI_STP_DEV_NCQ_ERROR: |
708 | case SCI_STP_DEV_AWAIT_RESET: | 708 | case SCI_STP_DEV_AWAIT_RESET: |
709 | status = scic_sds_port_start_io(iport, sci_dev, ireq); | 709 | status = scic_sds_port_start_io(iport, idev, ireq); |
710 | if (status != SCI_SUCCESS) | 710 | if (status != SCI_SUCCESS) |
711 | return status; | 711 | return status; |
712 | 712 | ||
713 | status = scic_sds_remote_node_context_start_task(&sci_dev->rnc, ireq); | 713 | status = scic_sds_remote_node_context_start_task(&idev->rnc, ireq); |
714 | if (status != SCI_SUCCESS) | 714 | if (status != SCI_SUCCESS) |
715 | goto out; | 715 | goto out; |
716 | 716 | ||
@@ -722,7 +722,7 @@ enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *sc | |||
722 | * replace the request that probably resulted in the task | 722 | * replace the request that probably resulted in the task |
723 | * management request. | 723 | * management request. |
724 | */ | 724 | */ |
725 | sci_dev->working_request = ireq; | 725 | idev->working_request = ireq; |
726 | sci_change_state(sm, SCI_STP_DEV_CMD); | 726 | sci_change_state(sm, SCI_STP_DEV_CMD); |
727 | 727 | ||
728 | /* The remote node context must cleanup the TCi to NCQ mapping | 728 | /* The remote node context must cleanup the TCi to NCQ mapping |
@@ -732,32 +732,32 @@ enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *sc | |||
732 | * the correct action when the remote node context is suspended | 732 | * the correct action when the remote node context is suspended |
733 | * and later resumed. | 733 | * and later resumed. |
734 | */ | 734 | */ |
735 | scic_sds_remote_node_context_suspend(&sci_dev->rnc, | 735 | scic_sds_remote_node_context_suspend(&idev->rnc, |
736 | SCI_SOFTWARE_SUSPENSION, NULL, NULL); | 736 | SCI_SOFTWARE_SUSPENSION, NULL, NULL); |
737 | scic_sds_remote_node_context_resume(&sci_dev->rnc, | 737 | scic_sds_remote_node_context_resume(&idev->rnc, |
738 | scic_sds_remote_device_continue_request, | 738 | scic_sds_remote_device_continue_request, |
739 | sci_dev); | 739 | idev); |
740 | 740 | ||
741 | out: | 741 | out: |
742 | scic_sds_remote_device_start_request(sci_dev, ireq, status); | 742 | scic_sds_remote_device_start_request(idev, ireq, status); |
743 | /* We need to let the controller start request handler know that | 743 | /* We need to let the controller start request handler know that |
744 | * it can't post TC yet. We will provide a callback function to | 744 | * it can't post TC yet. We will provide a callback function to |
745 | * post TC when RNC gets resumed. | 745 | * post TC when RNC gets resumed. |
746 | */ | 746 | */ |
747 | return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS; | 747 | return SCI_FAILURE_RESET_DEVICE_PARTIAL_SUCCESS; |
748 | case SCI_DEV_READY: | 748 | case SCI_DEV_READY: |
749 | status = scic_sds_port_start_io(iport, sci_dev, ireq); | 749 | status = scic_sds_port_start_io(iport, idev, ireq); |
750 | if (status != SCI_SUCCESS) | 750 | if (status != SCI_SUCCESS) |
751 | return status; | 751 | return status; |
752 | 752 | ||
753 | status = scic_sds_remote_node_context_start_task(&sci_dev->rnc, ireq); | 753 | status = scic_sds_remote_node_context_start_task(&idev->rnc, ireq); |
754 | if (status != SCI_SUCCESS) | 754 | if (status != SCI_SUCCESS) |
755 | break; | 755 | break; |
756 | 756 | ||
757 | status = scic_sds_request_start(ireq); | 757 | status = scic_sds_request_start(ireq); |
758 | break; | 758 | break; |
759 | } | 759 | } |
760 | scic_sds_remote_device_start_request(sci_dev, ireq, status); | 760 | scic_sds_remote_device_start_request(idev, ireq, status); |
761 | 761 | ||
762 | return status; | 762 | return status; |
763 | } | 763 | } |
@@ -771,15 +771,15 @@ enum sci_status scic_sds_remote_device_start_task(struct scic_sds_controller *sc | |||
771 | * request and then requests the controller to post the request. none | 771 | * request and then requests the controller to post the request. none |
772 | */ | 772 | */ |
773 | void scic_sds_remote_device_post_request( | 773 | void scic_sds_remote_device_post_request( |
774 | struct scic_sds_remote_device *sci_dev, | 774 | struct isci_remote_device *idev, |
775 | u32 request) | 775 | u32 request) |
776 | { | 776 | { |
777 | u32 context; | 777 | u32 context; |
778 | 778 | ||
779 | context = scic_sds_remote_device_build_command_context(sci_dev, request); | 779 | context = scic_sds_remote_device_build_command_context(idev, request); |
780 | 780 | ||
781 | scic_sds_controller_post_request( | 781 | scic_sds_controller_post_request( |
782 | scic_sds_remote_device_get_controller(sci_dev), | 782 | scic_sds_remote_device_get_controller(idev), |
783 | context | 783 | context |
784 | ); | 784 | ); |
785 | } | 785 | } |
@@ -790,34 +790,33 @@ void scic_sds_remote_device_post_request( | |||
790 | */ | 790 | */ |
791 | static void remote_device_resume_done(void *_dev) | 791 | static void remote_device_resume_done(void *_dev) |
792 | { | 792 | { |
793 | struct scic_sds_remote_device *sci_dev = _dev; | 793 | struct isci_remote_device *idev = _dev; |
794 | 794 | ||
795 | if (is_remote_device_ready(sci_dev)) | 795 | if (is_remote_device_ready(idev)) |
796 | return; | 796 | return; |
797 | 797 | ||
798 | /* go 'ready' if we are not already in a ready state */ | 798 | /* go 'ready' if we are not already in a ready state */ |
799 | sci_change_state(&sci_dev->sm, SCI_DEV_READY); | 799 | sci_change_state(&idev->sm, SCI_DEV_READY); |
800 | } | 800 | } |
801 | 801 | ||
802 | static void scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(void *_dev) | 802 | static void scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(void *_dev) |
803 | { | 803 | { |
804 | struct scic_sds_remote_device *sci_dev = _dev; | 804 | struct isci_remote_device *idev = _dev; |
805 | struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); | 805 | struct scic_sds_controller *scic = idev->owning_port->owning_controller; |
806 | struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller; | ||
807 | 806 | ||
808 | /* For NCQ operation we do not issue a isci_remote_device_not_ready(). | 807 | /* For NCQ operation we do not issue a isci_remote_device_not_ready(). |
809 | * As a result, avoid sending the ready notification. | 808 | * As a result, avoid sending the ready notification. |
810 | */ | 809 | */ |
811 | if (sci_dev->sm.previous_state_id != SCI_STP_DEV_NCQ) | 810 | if (idev->sm.previous_state_id != SCI_STP_DEV_NCQ) |
812 | isci_remote_device_ready(scic_to_ihost(scic), idev); | 811 | isci_remote_device_ready(scic_to_ihost(scic), idev); |
813 | } | 812 | } |
814 | 813 | ||
815 | static void scic_sds_remote_device_initial_state_enter(struct sci_base_state_machine *sm) | 814 | static void scic_sds_remote_device_initial_state_enter(struct sci_base_state_machine *sm) |
816 | { | 815 | { |
817 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); | 816 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
818 | 817 | ||
819 | /* Initial state is a transitional state to the stopped state */ | 818 | /* Initial state is a transitional state to the stopped state */ |
820 | sci_change_state(&sci_dev->sm, SCI_DEV_STOPPED); | 819 | sci_change_state(&idev->sm, SCI_DEV_STOPPED); |
821 | } | 820 | } |
822 | 821 | ||
823 | /** | 822 | /** |
@@ -833,22 +832,22 @@ static void scic_sds_remote_device_initial_state_enter(struct sci_base_state_mac | |||
833 | * device isn't valid (e.g. it's already been destoryed, the handle isn't | 832 | * device isn't valid (e.g. it's already been destoryed, the handle isn't |
834 | * valid, etc.). | 833 | * valid, etc.). |
835 | */ | 834 | */ |
836 | static enum sci_status scic_remote_device_destruct(struct scic_sds_remote_device *sci_dev) | 835 | static enum sci_status scic_remote_device_destruct(struct isci_remote_device *idev) |
837 | { | 836 | { |
838 | struct sci_base_state_machine *sm = &sci_dev->sm; | 837 | struct sci_base_state_machine *sm = &idev->sm; |
839 | enum scic_sds_remote_device_states state = sm->current_state_id; | 838 | enum scic_sds_remote_device_states state = sm->current_state_id; |
840 | struct scic_sds_controller *scic; | 839 | struct scic_sds_controller *scic; |
841 | 840 | ||
842 | if (state != SCI_DEV_STOPPED) { | 841 | if (state != SCI_DEV_STOPPED) { |
843 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 842 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", |
844 | __func__, state); | 843 | __func__, state); |
845 | return SCI_FAILURE_INVALID_STATE; | 844 | return SCI_FAILURE_INVALID_STATE; |
846 | } | 845 | } |
847 | 846 | ||
848 | scic = sci_dev->owning_port->owning_controller; | 847 | scic = idev->owning_port->owning_controller; |
849 | scic_sds_controller_free_remote_node_context(scic, sci_dev, | 848 | scic_sds_controller_free_remote_node_context(scic, idev, |
850 | sci_dev->rnc.remote_node_index); | 849 | idev->rnc.remote_node_index); |
851 | sci_dev->rnc.remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX; | 850 | idev->rnc.remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX; |
852 | sci_change_state(sm, SCI_DEV_FINAL); | 851 | sci_change_state(sm, SCI_DEV_FINAL); |
853 | 852 | ||
854 | return SCI_SUCCESS; | 853 | return SCI_SUCCESS; |
@@ -871,34 +870,32 @@ static void isci_remote_device_deconstruct(struct isci_host *ihost, struct isci_ | |||
871 | * io requests in process */ | 870 | * io requests in process */ |
872 | BUG_ON(!list_empty(&idev->reqs_in_process)); | 871 | BUG_ON(!list_empty(&idev->reqs_in_process)); |
873 | 872 | ||
874 | scic_remote_device_destruct(&idev->sci); | 873 | scic_remote_device_destruct(idev); |
875 | list_del_init(&idev->node); | 874 | list_del_init(&idev->node); |
876 | isci_put_device(idev); | 875 | isci_put_device(idev); |
877 | } | 876 | } |
878 | 877 | ||
879 | static void scic_sds_remote_device_stopped_state_enter(struct sci_base_state_machine *sm) | 878 | static void scic_sds_remote_device_stopped_state_enter(struct sci_base_state_machine *sm) |
880 | { | 879 | { |
881 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); | 880 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
882 | struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller; | 881 | struct scic_sds_controller *scic = idev->owning_port->owning_controller; |
883 | struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); | ||
884 | u32 prev_state; | 882 | u32 prev_state; |
885 | 883 | ||
886 | /* If we are entering from the stopping state let the SCI User know that | 884 | /* If we are entering from the stopping state let the SCI User know that |
887 | * the stop operation has completed. | 885 | * the stop operation has completed. |
888 | */ | 886 | */ |
889 | prev_state = sci_dev->sm.previous_state_id; | 887 | prev_state = idev->sm.previous_state_id; |
890 | if (prev_state == SCI_DEV_STOPPING) | 888 | if (prev_state == SCI_DEV_STOPPING) |
891 | isci_remote_device_deconstruct(scic_to_ihost(scic), idev); | 889 | isci_remote_device_deconstruct(scic_to_ihost(scic), idev); |
892 | 890 | ||
893 | scic_sds_controller_remote_device_stopped(scic, sci_dev); | 891 | scic_sds_controller_remote_device_stopped(scic, idev); |
894 | } | 892 | } |
895 | 893 | ||
896 | static void scic_sds_remote_device_starting_state_enter(struct sci_base_state_machine *sm) | 894 | static void scic_sds_remote_device_starting_state_enter(struct sci_base_state_machine *sm) |
897 | { | 895 | { |
898 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); | 896 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
899 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); | 897 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(idev); |
900 | struct isci_host *ihost = scic_to_ihost(scic); | 898 | struct isci_host *ihost = scic_to_ihost(scic); |
901 | struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); | ||
902 | 899 | ||
903 | isci_remote_device_not_ready(ihost, idev, | 900 | isci_remote_device_not_ready(ihost, idev, |
904 | SCIC_REMOTE_DEVICE_NOT_READY_START_REQUESTED); | 901 | SCIC_REMOTE_DEVICE_NOT_READY_START_REQUESTED); |
@@ -906,27 +903,25 @@ static void scic_sds_remote_device_starting_state_enter(struct sci_base_state_ma | |||
906 | 903 | ||
907 | static void scic_sds_remote_device_ready_state_enter(struct sci_base_state_machine *sm) | 904 | static void scic_sds_remote_device_ready_state_enter(struct sci_base_state_machine *sm) |
908 | { | 905 | { |
909 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); | 906 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
910 | struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller; | 907 | struct scic_sds_controller *scic = idev->owning_port->owning_controller; |
911 | struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); | ||
912 | struct domain_device *dev = idev->domain_dev; | 908 | struct domain_device *dev = idev->domain_dev; |
913 | 909 | ||
914 | if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_SATA)) { | 910 | if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_SATA)) { |
915 | sci_change_state(&sci_dev->sm, SCI_STP_DEV_IDLE); | 911 | sci_change_state(&idev->sm, SCI_STP_DEV_IDLE); |
916 | } else if (dev_is_expander(dev)) { | 912 | } else if (dev_is_expander(dev)) { |
917 | sci_change_state(&sci_dev->sm, SCI_SMP_DEV_IDLE); | 913 | sci_change_state(&idev->sm, SCI_SMP_DEV_IDLE); |
918 | } else | 914 | } else |
919 | isci_remote_device_ready(scic_to_ihost(scic), idev); | 915 | isci_remote_device_ready(scic_to_ihost(scic), idev); |
920 | } | 916 | } |
921 | 917 | ||
922 | static void scic_sds_remote_device_ready_state_exit(struct sci_base_state_machine *sm) | 918 | static void scic_sds_remote_device_ready_state_exit(struct sci_base_state_machine *sm) |
923 | { | 919 | { |
924 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); | 920 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
925 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 921 | struct domain_device *dev = idev->domain_dev; |
926 | 922 | ||
927 | if (dev->dev_type == SAS_END_DEV) { | 923 | if (dev->dev_type == SAS_END_DEV) { |
928 | struct scic_sds_controller *scic = sci_dev->owning_port->owning_controller; | 924 | struct scic_sds_controller *scic = idev->owning_port->owning_controller; |
929 | struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); | ||
930 | 925 | ||
931 | isci_remote_device_not_ready(scic_to_ihost(scic), idev, | 926 | isci_remote_device_not_ready(scic_to_ihost(scic), idev, |
932 | SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED); | 927 | SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED); |
@@ -935,82 +930,81 @@ static void scic_sds_remote_device_ready_state_exit(struct sci_base_state_machin | |||
935 | 930 | ||
936 | static void scic_sds_remote_device_resetting_state_enter(struct sci_base_state_machine *sm) | 931 | static void scic_sds_remote_device_resetting_state_enter(struct sci_base_state_machine *sm) |
937 | { | 932 | { |
938 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); | 933 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
939 | 934 | ||
940 | scic_sds_remote_node_context_suspend( | 935 | scic_sds_remote_node_context_suspend( |
941 | &sci_dev->rnc, SCI_SOFTWARE_SUSPENSION, NULL, NULL); | 936 | &idev->rnc, SCI_SOFTWARE_SUSPENSION, NULL, NULL); |
942 | } | 937 | } |
943 | 938 | ||
944 | static void scic_sds_remote_device_resetting_state_exit(struct sci_base_state_machine *sm) | 939 | static void scic_sds_remote_device_resetting_state_exit(struct sci_base_state_machine *sm) |
945 | { | 940 | { |
946 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); | 941 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
947 | 942 | ||
948 | scic_sds_remote_node_context_resume(&sci_dev->rnc, NULL, NULL); | 943 | scic_sds_remote_node_context_resume(&idev->rnc, NULL, NULL); |
949 | } | 944 | } |
950 | 945 | ||
951 | static void scic_sds_stp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm) | 946 | static void scic_sds_stp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm) |
952 | { | 947 | { |
953 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); | 948 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
954 | 949 | ||
955 | sci_dev->working_request = NULL; | 950 | idev->working_request = NULL; |
956 | if (scic_sds_remote_node_context_is_ready(&sci_dev->rnc)) { | 951 | if (scic_sds_remote_node_context_is_ready(&idev->rnc)) { |
957 | /* | 952 | /* |
958 | * Since the RNC is ready, it's alright to finish completion | 953 | * Since the RNC is ready, it's alright to finish completion |
959 | * processing (e.g. signal the remote device is ready). */ | 954 | * processing (e.g. signal the remote device is ready). */ |
960 | scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(sci_dev); | 955 | scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(idev); |
961 | } else { | 956 | } else { |
962 | scic_sds_remote_node_context_resume(&sci_dev->rnc, | 957 | scic_sds_remote_node_context_resume(&idev->rnc, |
963 | scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler, | 958 | scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler, |
964 | sci_dev); | 959 | idev); |
965 | } | 960 | } |
966 | } | 961 | } |
967 | 962 | ||
968 | static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) | 963 | static void scic_sds_stp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) |
969 | { | 964 | { |
970 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); | 965 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
971 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); | 966 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(idev); |
972 | 967 | ||
973 | BUG_ON(sci_dev->working_request == NULL); | 968 | BUG_ON(idev->working_request == NULL); |
974 | 969 | ||
975 | isci_remote_device_not_ready(scic_to_ihost(scic), sci_dev_to_idev(sci_dev), | 970 | isci_remote_device_not_ready(scic_to_ihost(scic), idev, |
976 | SCIC_REMOTE_DEVICE_NOT_READY_SATA_REQUEST_STARTED); | 971 | SCIC_REMOTE_DEVICE_NOT_READY_SATA_REQUEST_STARTED); |
977 | } | 972 | } |
978 | 973 | ||
979 | static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base_state_machine *sm) | 974 | static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(struct sci_base_state_machine *sm) |
980 | { | 975 | { |
981 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); | 976 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
982 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); | 977 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(idev); |
983 | struct isci_remote_device *idev = sci_dev_to_idev(sci_dev); | ||
984 | 978 | ||
985 | if (sci_dev->not_ready_reason == SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED) | 979 | if (idev->not_ready_reason == SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED) |
986 | isci_remote_device_not_ready(scic_to_ihost(scic), idev, | 980 | isci_remote_device_not_ready(scic_to_ihost(scic), idev, |
987 | sci_dev->not_ready_reason); | 981 | idev->not_ready_reason); |
988 | } | 982 | } |
989 | 983 | ||
990 | static void scic_sds_smp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm) | 984 | static void scic_sds_smp_remote_device_ready_idle_substate_enter(struct sci_base_state_machine *sm) |
991 | { | 985 | { |
992 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); | 986 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
993 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); | 987 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(idev); |
994 | 988 | ||
995 | isci_remote_device_ready(scic_to_ihost(scic), sci_dev_to_idev(sci_dev)); | 989 | isci_remote_device_ready(scic_to_ihost(scic), idev); |
996 | } | 990 | } |
997 | 991 | ||
998 | static void scic_sds_smp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) | 992 | static void scic_sds_smp_remote_device_ready_cmd_substate_enter(struct sci_base_state_machine *sm) |
999 | { | 993 | { |
1000 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); | 994 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
1001 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(sci_dev); | 995 | struct scic_sds_controller *scic = scic_sds_remote_device_get_controller(idev); |
1002 | 996 | ||
1003 | BUG_ON(sci_dev->working_request == NULL); | 997 | BUG_ON(idev->working_request == NULL); |
1004 | 998 | ||
1005 | isci_remote_device_not_ready(scic_to_ihost(scic), sci_dev_to_idev(sci_dev), | 999 | isci_remote_device_not_ready(scic_to_ihost(scic), idev, |
1006 | SCIC_REMOTE_DEVICE_NOT_READY_SMP_REQUEST_STARTED); | 1000 | SCIC_REMOTE_DEVICE_NOT_READY_SMP_REQUEST_STARTED); |
1007 | } | 1001 | } |
1008 | 1002 | ||
1009 | static void scic_sds_smp_remote_device_ready_cmd_substate_exit(struct sci_base_state_machine *sm) | 1003 | static void scic_sds_smp_remote_device_ready_cmd_substate_exit(struct sci_base_state_machine *sm) |
1010 | { | 1004 | { |
1011 | struct scic_sds_remote_device *sci_dev = container_of(sm, typeof(*sci_dev), sm); | 1005 | struct isci_remote_device *idev = container_of(sm, typeof(*idev), sm); |
1012 | 1006 | ||
1013 | sci_dev->working_request = NULL; | 1007 | idev->working_request = NULL; |
1014 | } | 1008 | } |
1015 | 1009 | ||
1016 | static const struct sci_base_state scic_sds_remote_device_state_table[] = { | 1010 | static const struct sci_base_state scic_sds_remote_device_state_table[] = { |
@@ -1065,14 +1059,14 @@ static const struct sci_base_state scic_sds_remote_device_state_table[] = { | |||
1065 | * frees the remote_node_context(s) for the device. | 1059 | * frees the remote_node_context(s) for the device. |
1066 | */ | 1060 | */ |
1067 | static void scic_remote_device_construct(struct isci_port *iport, | 1061 | static void scic_remote_device_construct(struct isci_port *iport, |
1068 | struct scic_sds_remote_device *sci_dev) | 1062 | struct isci_remote_device *idev) |
1069 | { | 1063 | { |
1070 | sci_dev->owning_port = iport; | 1064 | idev->owning_port = iport; |
1071 | sci_dev->started_request_count = 0; | 1065 | idev->started_request_count = 0; |
1072 | 1066 | ||
1073 | sci_init_sm(&sci_dev->sm, scic_sds_remote_device_state_table, SCI_DEV_INITIAL); | 1067 | sci_init_sm(&idev->sm, scic_sds_remote_device_state_table, SCI_DEV_INITIAL); |
1074 | 1068 | ||
1075 | scic_sds_remote_node_context_construct(&sci_dev->rnc, | 1069 | scic_sds_remote_node_context_construct(&idev->rnc, |
1076 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX); | 1070 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX); |
1077 | } | 1071 | } |
1078 | 1072 | ||
@@ -1091,21 +1085,21 @@ static void scic_remote_device_construct(struct isci_port *iport, | |||
1091 | * SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted. | 1085 | * SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted. |
1092 | */ | 1086 | */ |
1093 | static enum sci_status scic_remote_device_da_construct(struct isci_port *iport, | 1087 | static enum sci_status scic_remote_device_da_construct(struct isci_port *iport, |
1094 | struct scic_sds_remote_device *sci_dev) | 1088 | struct isci_remote_device *idev) |
1095 | { | 1089 | { |
1096 | enum sci_status status; | 1090 | enum sci_status status; |
1097 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 1091 | struct domain_device *dev = idev->domain_dev; |
1098 | 1092 | ||
1099 | scic_remote_device_construct(iport, sci_dev); | 1093 | scic_remote_device_construct(iport, idev); |
1100 | 1094 | ||
1101 | /* | 1095 | /* |
1102 | * This information is request to determine how many remote node context | 1096 | * This information is request to determine how many remote node context |
1103 | * entries will be needed to store the remote node. | 1097 | * entries will be needed to store the remote node. |
1104 | */ | 1098 | */ |
1105 | sci_dev->is_direct_attached = true; | 1099 | idev->is_direct_attached = true; |
1106 | status = scic_sds_controller_allocate_remote_node_context(iport->owning_controller, | 1100 | status = scic_sds_controller_allocate_remote_node_context(iport->owning_controller, |
1107 | sci_dev, | 1101 | idev, |
1108 | &sci_dev->rnc.remote_node_index); | 1102 | &idev->rnc.remote_node_index); |
1109 | 1103 | ||
1110 | if (status != SCI_SUCCESS) | 1104 | if (status != SCI_SUCCESS) |
1111 | return status; | 1105 | return status; |
@@ -1116,10 +1110,10 @@ static enum sci_status scic_remote_device_da_construct(struct isci_port *iport, | |||
1116 | else | 1110 | else |
1117 | return SCI_FAILURE_UNSUPPORTED_PROTOCOL; | 1111 | return SCI_FAILURE_UNSUPPORTED_PROTOCOL; |
1118 | 1112 | ||
1119 | sci_dev->connection_rate = scic_sds_port_get_max_allowed_speed(iport); | 1113 | idev->connection_rate = scic_sds_port_get_max_allowed_speed(iport); |
1120 | 1114 | ||
1121 | /* / @todo Should I assign the port width by reading all of the phys on the port? */ | 1115 | /* / @todo Should I assign the port width by reading all of the phys on the port? */ |
1122 | sci_dev->device_port_width = 1; | 1116 | idev->device_port_width = 1; |
1123 | 1117 | ||
1124 | return SCI_SUCCESS; | 1118 | return SCI_SUCCESS; |
1125 | } | 1119 | } |
@@ -1137,16 +1131,16 @@ static enum sci_status scic_remote_device_da_construct(struct isci_port *iport, | |||
1137 | * SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted. | 1131 | * SCI_FAILURE_INSUFFICIENT_RESOURCES - remote node contexts exhausted. |
1138 | */ | 1132 | */ |
1139 | static enum sci_status scic_remote_device_ea_construct(struct isci_port *iport, | 1133 | static enum sci_status scic_remote_device_ea_construct(struct isci_port *iport, |
1140 | struct scic_sds_remote_device *sci_dev) | 1134 | struct isci_remote_device *idev) |
1141 | { | 1135 | { |
1142 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 1136 | struct domain_device *dev = idev->domain_dev; |
1143 | enum sci_status status; | 1137 | enum sci_status status; |
1144 | 1138 | ||
1145 | scic_remote_device_construct(iport, sci_dev); | 1139 | scic_remote_device_construct(iport, idev); |
1146 | 1140 | ||
1147 | status = scic_sds_controller_allocate_remote_node_context(iport->owning_controller, | 1141 | status = scic_sds_controller_allocate_remote_node_context(iport->owning_controller, |
1148 | sci_dev, | 1142 | idev, |
1149 | &sci_dev->rnc.remote_node_index); | 1143 | &idev->rnc.remote_node_index); |
1150 | if (status != SCI_SUCCESS) | 1144 | if (status != SCI_SUCCESS) |
1151 | return status; | 1145 | return status; |
1152 | 1146 | ||
@@ -1163,11 +1157,11 @@ static enum sci_status scic_remote_device_ea_construct(struct isci_port *iport, | |||
1163 | * connection the logical link rate is that same as the | 1157 | * connection the logical link rate is that same as the |
1164 | * physical. Furthermore, the SAS-2 and SAS-1.1 fields overlay | 1158 | * physical. Furthermore, the SAS-2 and SAS-1.1 fields overlay |
1165 | * one another, so this code works for both situations. */ | 1159 | * one another, so this code works for both situations. */ |
1166 | sci_dev->connection_rate = min_t(u16, scic_sds_port_get_max_allowed_speed(iport), | 1160 | idev->connection_rate = min_t(u16, scic_sds_port_get_max_allowed_speed(iport), |
1167 | dev->linkrate); | 1161 | dev->linkrate); |
1168 | 1162 | ||
1169 | /* / @todo Should I assign the port width by reading all of the phys on the port? */ | 1163 | /* / @todo Should I assign the port width by reading all of the phys on the port? */ |
1170 | sci_dev->device_port_width = 1; | 1164 | idev->device_port_width = 1; |
1171 | 1165 | ||
1172 | return SCI_SUCCESS; | 1166 | return SCI_SUCCESS; |
1173 | } | 1167 | } |
@@ -1185,22 +1179,22 @@ static enum sci_status scic_remote_device_ea_construct(struct isci_port *iport, | |||
1185 | * SCI_FAILURE_INVALID_PHY This value is returned if the user attempts to start | 1179 | * SCI_FAILURE_INVALID_PHY This value is returned if the user attempts to start |
1186 | * the device when there have been no phys added to it. | 1180 | * the device when there have been no phys added to it. |
1187 | */ | 1181 | */ |
1188 | static enum sci_status scic_remote_device_start(struct scic_sds_remote_device *sci_dev, | 1182 | static enum sci_status scic_remote_device_start(struct isci_remote_device *idev, |
1189 | u32 timeout) | 1183 | u32 timeout) |
1190 | { | 1184 | { |
1191 | struct sci_base_state_machine *sm = &sci_dev->sm; | 1185 | struct sci_base_state_machine *sm = &idev->sm; |
1192 | enum scic_sds_remote_device_states state = sm->current_state_id; | 1186 | enum scic_sds_remote_device_states state = sm->current_state_id; |
1193 | enum sci_status status; | 1187 | enum sci_status status; |
1194 | 1188 | ||
1195 | if (state != SCI_DEV_STOPPED) { | 1189 | if (state != SCI_DEV_STOPPED) { |
1196 | dev_warn(scirdev_to_dev(sci_dev), "%s: in wrong state: %d\n", | 1190 | dev_warn(scirdev_to_dev(idev), "%s: in wrong state: %d\n", |
1197 | __func__, state); | 1191 | __func__, state); |
1198 | return SCI_FAILURE_INVALID_STATE; | 1192 | return SCI_FAILURE_INVALID_STATE; |
1199 | } | 1193 | } |
1200 | 1194 | ||
1201 | status = scic_sds_remote_node_context_resume(&sci_dev->rnc, | 1195 | status = scic_sds_remote_node_context_resume(&idev->rnc, |
1202 | remote_device_resume_done, | 1196 | remote_device_resume_done, |
1203 | sci_dev); | 1197 | idev); |
1204 | if (status != SCI_SUCCESS) | 1198 | if (status != SCI_SUCCESS) |
1205 | return status; | 1199 | return status; |
1206 | 1200 | ||
@@ -1217,9 +1211,9 @@ static enum sci_status isci_remote_device_construct(struct isci_port *iport, | |||
1217 | enum sci_status status; | 1211 | enum sci_status status; |
1218 | 1212 | ||
1219 | if (dev->parent && dev_is_expander(dev->parent)) | 1213 | if (dev->parent && dev_is_expander(dev->parent)) |
1220 | status = scic_remote_device_ea_construct(iport, &idev->sci); | 1214 | status = scic_remote_device_ea_construct(iport, idev); |
1221 | else | 1215 | else |
1222 | status = scic_remote_device_da_construct(iport, &idev->sci); | 1216 | status = scic_remote_device_da_construct(iport, idev); |
1223 | 1217 | ||
1224 | if (status != SCI_SUCCESS) { | 1218 | if (status != SCI_SUCCESS) { |
1225 | dev_dbg(&ihost->pdev->dev, "%s: construct failed: %d\n", | 1219 | dev_dbg(&ihost->pdev->dev, "%s: construct failed: %d\n", |
@@ -1229,7 +1223,7 @@ static enum sci_status isci_remote_device_construct(struct isci_port *iport, | |||
1229 | } | 1223 | } |
1230 | 1224 | ||
1231 | /* start the device. */ | 1225 | /* start the device. */ |
1232 | status = scic_remote_device_start(&idev->sci, ISCI_REMOTE_DEVICE_START_TIMEOUT); | 1226 | status = scic_remote_device_start(idev, ISCI_REMOTE_DEVICE_START_TIMEOUT); |
1233 | 1227 | ||
1234 | if (status != SCI_SUCCESS) | 1228 | if (status != SCI_SUCCESS) |
1235 | dev_warn(&ihost->pdev->dev, "remote device start failed: %d\n", | 1229 | dev_warn(&ihost->pdev->dev, "remote device start failed: %d\n", |
@@ -1330,7 +1324,7 @@ enum sci_status isci_remote_device_stop(struct isci_host *ihost, struct isci_rem | |||
1330 | set_bit(IDEV_STOP_PENDING, &idev->flags); | 1324 | set_bit(IDEV_STOP_PENDING, &idev->flags); |
1331 | 1325 | ||
1332 | spin_lock_irqsave(&ihost->scic_lock, flags); | 1326 | spin_lock_irqsave(&ihost->scic_lock, flags); |
1333 | status = scic_remote_device_stop(&idev->sci, 50); | 1327 | status = scic_remote_device_stop(idev, 50); |
1334 | spin_unlock_irqrestore(&ihost->scic_lock, flags); | 1328 | spin_unlock_irqrestore(&ihost->scic_lock, flags); |
1335 | 1329 | ||
1336 | /* Wait for the stop complete callback. */ | 1330 | /* Wait for the stop complete callback. */ |
diff --git a/drivers/scsi/isci/remote_device.h b/drivers/scsi/isci/remote_device.h index 578d75b8cd16..45798582fc14 100644 --- a/drivers/scsi/isci/remote_device.h +++ b/drivers/scsi/isci/remote_device.h | |||
@@ -70,65 +70,14 @@ enum scic_remote_device_not_ready_reason_code { | |||
70 | SCIC_REMOTE_DEVICE_NOT_READY_REASON_CODE_MAX | 70 | SCIC_REMOTE_DEVICE_NOT_READY_REASON_CODE_MAX |
71 | }; | 71 | }; |
72 | 72 | ||
73 | struct scic_sds_remote_device { | 73 | /** |
74 | /** | 74 | * isci_remote_device - isci representation of a sas expander / end point |
75 | * This field contains the information for the base remote device state | 75 | * @device_port_width: hw setting for number of simultaneous connections |
76 | * machine. | 76 | * @connection_rate: per-taskcontext connection rate for this device |
77 | */ | 77 | * @working_request: SATA requests have no tag we for unaccelerated |
78 | struct sci_base_state_machine sm; | 78 | * protocols we need a method to associate unsolicited |
79 | 79 | * frames with a pending request | |
80 | /** | 80 | */ |
81 | * This field is the programmed device port width. This value is | ||
82 | * written to the RCN data structure to tell the SCU how many open | ||
83 | * connections this device can have. | ||
84 | */ | ||
85 | u32 device_port_width; | ||
86 | |||
87 | /** | ||
88 | * This field is the programmed connection rate for this remote device. It is | ||
89 | * used to program the TC with the maximum allowed connection rate. | ||
90 | */ | ||
91 | enum sas_linkrate connection_rate; | ||
92 | |||
93 | /** | ||
94 | * This filed is assinged the value of true if the device is directly | ||
95 | * attached to the port. | ||
96 | */ | ||
97 | bool is_direct_attached; | ||
98 | |||
99 | /** | ||
100 | * This filed contains a pointer back to the port to which this device | ||
101 | * is assigned. | ||
102 | */ | ||
103 | struct isci_port *owning_port; | ||
104 | |||
105 | /** | ||
106 | * This field contains the SCU silicon remote node context specific | ||
107 | * information. | ||
108 | */ | ||
109 | struct scic_sds_remote_node_context rnc; | ||
110 | |||
111 | /** | ||
112 | * This field contains the stated request count for the remote device. The | ||
113 | * device can not reach the SCI_DEV_STOPPED until all | ||
114 | * requests are complete and the rnc_posted value is false. | ||
115 | */ | ||
116 | u32 started_request_count; | ||
117 | |||
118 | /** | ||
119 | * This field contains a pointer to the working request object. It is only | ||
120 | * used only for SATA requests since the unsolicited frames we get from the | ||
121 | * hardware have no Tag value to look up the io request object. | ||
122 | */ | ||
123 | struct isci_request *working_request; | ||
124 | |||
125 | /** | ||
126 | * This field contains the reason for the remote device going not_ready. It is | ||
127 | * assigned in the state handlers and used in the state transition. | ||
128 | */ | ||
129 | u32 not_ready_reason; | ||
130 | }; | ||
131 | |||
132 | struct isci_remote_device { | 81 | struct isci_remote_device { |
133 | #define IDEV_START_PENDING 0 | 82 | #define IDEV_START_PENDING 0 |
134 | #define IDEV_STOP_PENDING 1 | 83 | #define IDEV_STOP_PENDING 1 |
@@ -143,7 +92,16 @@ struct isci_remote_device { | |||
143 | struct domain_device *domain_dev; | 92 | struct domain_device *domain_dev; |
144 | struct list_head node; | 93 | struct list_head node; |
145 | struct list_head reqs_in_process; | 94 | struct list_head reqs_in_process; |
146 | struct scic_sds_remote_device sci; | 95 | struct sci_base_state_machine sm; |
96 | u32 device_port_width; | ||
97 | enum sas_linkrate connection_rate; | ||
98 | bool is_direct_attached; | ||
99 | struct isci_port *owning_port; | ||
100 | struct scic_sds_remote_node_context rnc; | ||
101 | /* XXX unify with device reference counting and delete */ | ||
102 | u32 started_request_count; | ||
103 | struct isci_request *working_request; | ||
104 | u32 not_ready_reason; | ||
147 | }; | 105 | }; |
148 | 106 | ||
149 | #define ISCI_REMOTE_DEVICE_START_TIMEOUT 5000 | 107 | #define ISCI_REMOTE_DEVICE_START_TIMEOUT 5000 |
@@ -191,7 +149,7 @@ void isci_device_clear_reset_pending(struct isci_host *ihost, | |||
191 | * successfully stopped. | 149 | * successfully stopped. |
192 | */ | 150 | */ |
193 | enum sci_status scic_remote_device_stop( | 151 | enum sci_status scic_remote_device_stop( |
194 | struct scic_sds_remote_device *remote_device, | 152 | struct isci_remote_device *idev, |
195 | u32 timeout); | 153 | u32 timeout); |
196 | 154 | ||
197 | /** | 155 | /** |
@@ -207,7 +165,7 @@ enum sci_status scic_remote_device_stop( | |||
207 | * started. | 165 | * started. |
208 | */ | 166 | */ |
209 | enum sci_status scic_remote_device_reset( | 167 | enum sci_status scic_remote_device_reset( |
210 | struct scic_sds_remote_device *remote_device); | 168 | struct isci_remote_device *idev); |
211 | 169 | ||
212 | /** | 170 | /** |
213 | * scic_remote_device_reset_complete() - This method informs the device object | 171 | * scic_remote_device_reset_complete() - This method informs the device object |
@@ -220,7 +178,7 @@ enum sci_status scic_remote_device_reset( | |||
220 | * is resuming operation. | 178 | * is resuming operation. |
221 | */ | 179 | */ |
222 | enum sci_status scic_remote_device_reset_complete( | 180 | enum sci_status scic_remote_device_reset_complete( |
223 | struct scic_sds_remote_device *remote_device); | 181 | struct isci_remote_device *idev); |
224 | 182 | ||
225 | #define scic_remote_device_is_atapi(device_handle) false | 183 | #define scic_remote_device_is_atapi(device_handle) false |
226 | 184 | ||
@@ -335,27 +293,15 @@ enum scic_sds_remote_device_states { | |||
335 | SCI_DEV_FINAL, | 293 | SCI_DEV_FINAL, |
336 | }; | 294 | }; |
337 | 295 | ||
338 | static inline struct scic_sds_remote_device *rnc_to_dev(struct scic_sds_remote_node_context *rnc) | 296 | static inline struct isci_remote_device *rnc_to_dev(struct scic_sds_remote_node_context *rnc) |
339 | { | 297 | { |
340 | struct scic_sds_remote_device *sci_dev; | 298 | struct isci_remote_device *idev; |
341 | 299 | ||
342 | sci_dev = container_of(rnc, typeof(*sci_dev), rnc); | 300 | idev = container_of(rnc, typeof(*idev), rnc); |
343 | |||
344 | return sci_dev; | ||
345 | } | ||
346 | |||
347 | static inline struct isci_remote_device *sci_dev_to_idev(struct scic_sds_remote_device *sci_dev) | ||
348 | { | ||
349 | struct isci_remote_device *idev = container_of(sci_dev, typeof(*idev), sci); | ||
350 | 301 | ||
351 | return idev; | 302 | return idev; |
352 | } | 303 | } |
353 | 304 | ||
354 | static inline struct domain_device *sci_dev_to_domain(struct scic_sds_remote_device *sci_dev) | ||
355 | { | ||
356 | return sci_dev_to_idev(sci_dev)->domain_dev; | ||
357 | } | ||
358 | |||
359 | static inline bool dev_is_expander(struct domain_device *dev) | 305 | static inline bool dev_is_expander(struct domain_device *dev) |
360 | { | 306 | { |
361 | return dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV; | 307 | return dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV; |
@@ -366,8 +312,8 @@ static inline bool dev_is_expander(struct domain_device *dev) | |||
366 | * | 312 | * |
367 | * This macro incrments the request count for this device | 313 | * This macro incrments the request count for this device |
368 | */ | 314 | */ |
369 | #define scic_sds_remote_device_increment_request_count(sci_dev) \ | 315 | #define scic_sds_remote_device_increment_request_count(idev) \ |
370 | ((sci_dev)->started_request_count++) | 316 | ((idev)->started_request_count++) |
371 | 317 | ||
372 | /** | 318 | /** |
373 | * scic_sds_remote_device_decrement_request_count() - | 319 | * scic_sds_remote_device_decrement_request_count() - |
@@ -375,44 +321,44 @@ static inline bool dev_is_expander(struct domain_device *dev) | |||
375 | * This macro decrements the request count for this device. This count will | 321 | * This macro decrements the request count for this device. This count will |
376 | * never decrment past 0. | 322 | * never decrment past 0. |
377 | */ | 323 | */ |
378 | #define scic_sds_remote_device_decrement_request_count(sci_dev) \ | 324 | #define scic_sds_remote_device_decrement_request_count(idev) \ |
379 | ((sci_dev)->started_request_count > 0 ? \ | 325 | ((idev)->started_request_count > 0 ? \ |
380 | (sci_dev)->started_request_count-- : 0) | 326 | (idev)->started_request_count-- : 0) |
381 | 327 | ||
382 | /** | 328 | /** |
383 | * scic_sds_remote_device_get_request_count() - | 329 | * scic_sds_remote_device_get_request_count() - |
384 | * | 330 | * |
385 | * This is a helper macro to return the current device request count. | 331 | * This is a helper macro to return the current device request count. |
386 | */ | 332 | */ |
387 | #define scic_sds_remote_device_get_request_count(sci_dev) \ | 333 | #define scic_sds_remote_device_get_request_count(idev) \ |
388 | ((sci_dev)->started_request_count) | 334 | ((idev)->started_request_count) |
389 | 335 | ||
390 | /** | 336 | /** |
391 | * scic_sds_remote_device_get_controller() - | 337 | * scic_sds_remote_device_get_controller() - |
392 | * | 338 | * |
393 | * This macro returns the controller object that contains this device object | 339 | * This macro returns the controller object that contains this device object |
394 | */ | 340 | */ |
395 | #define scic_sds_remote_device_get_controller(sci_dev) \ | 341 | #define scic_sds_remote_device_get_controller(idev) \ |
396 | scic_sds_port_get_controller(scic_sds_remote_device_get_port(sci_dev)) | 342 | scic_sds_port_get_controller(scic_sds_remote_device_get_port(idev)) |
397 | 343 | ||
398 | /** | 344 | /** |
399 | * scic_sds_remote_device_get_port() - | 345 | * scic_sds_remote_device_get_port() - |
400 | * | 346 | * |
401 | * This macro returns the owning port of this device | 347 | * This macro returns the owning port of this device |
402 | */ | 348 | */ |
403 | #define scic_sds_remote_device_get_port(sci_dev) \ | 349 | #define scic_sds_remote_device_get_port(idev) \ |
404 | ((sci_dev)->owning_port) | 350 | ((idev)->owning_port) |
405 | 351 | ||
406 | /** | 352 | /** |
407 | * scic_sds_remote_device_get_controller_peg() - | 353 | * scic_sds_remote_device_get_controller_peg() - |
408 | * | 354 | * |
409 | * This macro returns the controllers protocol engine group | 355 | * This macro returns the controllers protocol engine group |
410 | */ | 356 | */ |
411 | #define scic_sds_remote_device_get_controller_peg(sci_dev) \ | 357 | #define scic_sds_remote_device_get_controller_peg(idev) \ |
412 | (\ | 358 | (\ |
413 | scic_sds_controller_get_protocol_engine_group(\ | 359 | scic_sds_controller_get_protocol_engine_group(\ |
414 | scic_sds_port_get_controller(\ | 360 | scic_sds_port_get_controller(\ |
415 | scic_sds_remote_device_get_port(sci_dev) \ | 361 | scic_sds_remote_device_get_port(idev) \ |
416 | ) \ | 362 | ) \ |
417 | ) \ | 363 | ) \ |
418 | ) | 364 | ) |
@@ -422,8 +368,8 @@ static inline bool dev_is_expander(struct domain_device *dev) | |||
422 | * | 368 | * |
423 | * This macro returns the remote node index for this device object | 369 | * This macro returns the remote node index for this device object |
424 | */ | 370 | */ |
425 | #define scic_sds_remote_device_get_index(sci_dev) \ | 371 | #define scic_sds_remote_device_get_index(idev) \ |
426 | ((sci_dev)->rnc.remote_node_index) | 372 | ((idev)->rnc.remote_node_index) |
427 | 373 | ||
428 | /** | 374 | /** |
429 | * scic_sds_remote_device_build_command_context() - | 375 | * scic_sds_remote_device_build_command_context() - |
@@ -448,36 +394,36 @@ static inline bool dev_is_expander(struct domain_device *dev) | |||
448 | ((device)->working_request = (request)) | 394 | ((device)->working_request = (request)) |
449 | 395 | ||
450 | enum sci_status scic_sds_remote_device_frame_handler( | 396 | enum sci_status scic_sds_remote_device_frame_handler( |
451 | struct scic_sds_remote_device *sci_dev, | 397 | struct isci_remote_device *idev, |
452 | u32 frame_index); | 398 | u32 frame_index); |
453 | 399 | ||
454 | enum sci_status scic_sds_remote_device_event_handler( | 400 | enum sci_status scic_sds_remote_device_event_handler( |
455 | struct scic_sds_remote_device *sci_dev, | 401 | struct isci_remote_device *idev, |
456 | u32 event_code); | 402 | u32 event_code); |
457 | 403 | ||
458 | enum sci_status scic_sds_remote_device_start_io( | 404 | enum sci_status scic_sds_remote_device_start_io( |
459 | struct scic_sds_controller *controller, | 405 | struct scic_sds_controller *controller, |
460 | struct scic_sds_remote_device *sci_dev, | 406 | struct isci_remote_device *idev, |
461 | struct isci_request *ireq); | 407 | struct isci_request *ireq); |
462 | 408 | ||
463 | enum sci_status scic_sds_remote_device_start_task( | 409 | enum sci_status scic_sds_remote_device_start_task( |
464 | struct scic_sds_controller *controller, | 410 | struct scic_sds_controller *controller, |
465 | struct scic_sds_remote_device *sci_dev, | 411 | struct isci_remote_device *idev, |
466 | struct isci_request *ireq); | 412 | struct isci_request *ireq); |
467 | 413 | ||
468 | enum sci_status scic_sds_remote_device_complete_io( | 414 | enum sci_status scic_sds_remote_device_complete_io( |
469 | struct scic_sds_controller *controller, | 415 | struct scic_sds_controller *controller, |
470 | struct scic_sds_remote_device *sci_dev, | 416 | struct isci_remote_device *idev, |
471 | struct isci_request *ireq); | 417 | struct isci_request *ireq); |
472 | 418 | ||
473 | enum sci_status scic_sds_remote_device_suspend( | 419 | enum sci_status scic_sds_remote_device_suspend( |
474 | struct scic_sds_remote_device *sci_dev, | 420 | struct isci_remote_device *idev, |
475 | u32 suspend_type); | 421 | u32 suspend_type); |
476 | 422 | ||
477 | void scic_sds_remote_device_post_request( | 423 | void scic_sds_remote_device_post_request( |
478 | struct scic_sds_remote_device *sci_dev, | 424 | struct isci_remote_device *idev, |
479 | u32 request); | 425 | u32 request); |
480 | 426 | ||
481 | #define scic_sds_remote_device_is_atapi(sci_dev) false | 427 | #define scic_sds_remote_device_is_atapi(idev) false |
482 | 428 | ||
483 | #endif /* !defined(_ISCI_REMOTE_DEVICE_H_) */ | 429 | #endif /* !defined(_ISCI_REMOTE_DEVICE_H_) */ |
diff --git a/drivers/scsi/isci/remote_node_context.c b/drivers/scsi/isci/remote_node_context.c index 1b51fe55314d..e485744e1263 100644 --- a/drivers/scsi/isci/remote_node_context.c +++ b/drivers/scsi/isci/remote_node_context.c | |||
@@ -103,22 +103,22 @@ bool scic_sds_remote_node_context_is_ready( | |||
103 | static void scic_sds_remote_node_context_construct_buffer( | 103 | static void scic_sds_remote_node_context_construct_buffer( |
104 | struct scic_sds_remote_node_context *sci_rnc) | 104 | struct scic_sds_remote_node_context *sci_rnc) |
105 | { | 105 | { |
106 | struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc); | 106 | struct isci_remote_device *idev = rnc_to_dev(sci_rnc); |
107 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 107 | struct domain_device *dev = idev->domain_dev; |
108 | int rni = sci_rnc->remote_node_index; | 108 | int rni = sci_rnc->remote_node_index; |
109 | union scu_remote_node_context *rnc; | 109 | union scu_remote_node_context *rnc; |
110 | struct scic_sds_controller *scic; | 110 | struct scic_sds_controller *scic; |
111 | __le64 sas_addr; | 111 | __le64 sas_addr; |
112 | 112 | ||
113 | scic = scic_sds_remote_device_get_controller(sci_dev); | 113 | scic = scic_sds_remote_device_get_controller(idev); |
114 | rnc = scic_sds_controller_get_remote_node_context_buffer(scic, rni); | 114 | rnc = scic_sds_controller_get_remote_node_context_buffer(scic, rni); |
115 | 115 | ||
116 | memset(rnc, 0, sizeof(union scu_remote_node_context) | 116 | memset(rnc, 0, sizeof(union scu_remote_node_context) |
117 | * scic_sds_remote_device_node_count(sci_dev)); | 117 | * scic_sds_remote_device_node_count(idev)); |
118 | 118 | ||
119 | rnc->ssp.remote_node_index = rni; | 119 | rnc->ssp.remote_node_index = rni; |
120 | rnc->ssp.remote_node_port_width = sci_dev->device_port_width; | 120 | rnc->ssp.remote_node_port_width = idev->device_port_width; |
121 | rnc->ssp.logical_port_index = sci_dev->owning_port->physical_port_index; | 121 | rnc->ssp.logical_port_index = idev->owning_port->physical_port_index; |
122 | 122 | ||
123 | /* sas address is __be64, context ram format is __le64 */ | 123 | /* sas address is __be64, context ram format is __le64 */ |
124 | sas_addr = cpu_to_le64(SAS_ADDR(dev->sas_addr)); | 124 | sas_addr = cpu_to_le64(SAS_ADDR(dev->sas_addr)); |
@@ -148,7 +148,7 @@ static void scic_sds_remote_node_context_construct_buffer( | |||
148 | rnc->ssp.initial_arbitration_wait_time = 0; | 148 | rnc->ssp.initial_arbitration_wait_time = 0; |
149 | 149 | ||
150 | /* Open Address Frame Parameters */ | 150 | /* Open Address Frame Parameters */ |
151 | rnc->ssp.oaf_connection_rate = sci_dev->connection_rate; | 151 | rnc->ssp.oaf_connection_rate = idev->connection_rate; |
152 | rnc->ssp.oaf_features = 0; | 152 | rnc->ssp.oaf_features = 0; |
153 | rnc->ssp.oaf_source_zone_group = 0; | 153 | rnc->ssp.oaf_source_zone_group = 0; |
154 | rnc->ssp.oaf_more_compatibility_features = 0; | 154 | rnc->ssp.oaf_more_compatibility_features = 0; |
@@ -220,26 +220,26 @@ static void scic_sds_remote_node_context_continue_state_transitions(struct scic_ | |||
220 | static void scic_sds_remote_node_context_validate_context_buffer( | 220 | static void scic_sds_remote_node_context_validate_context_buffer( |
221 | struct scic_sds_remote_node_context *sci_rnc) | 221 | struct scic_sds_remote_node_context *sci_rnc) |
222 | { | 222 | { |
223 | struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc); | 223 | struct isci_remote_device *idev = rnc_to_dev(sci_rnc); |
224 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 224 | struct domain_device *dev = idev->domain_dev; |
225 | union scu_remote_node_context *rnc_buffer; | 225 | union scu_remote_node_context *rnc_buffer; |
226 | 226 | ||
227 | rnc_buffer = scic_sds_controller_get_remote_node_context_buffer( | 227 | rnc_buffer = scic_sds_controller_get_remote_node_context_buffer( |
228 | scic_sds_remote_device_get_controller(sci_dev), | 228 | scic_sds_remote_device_get_controller(idev), |
229 | sci_rnc->remote_node_index | 229 | sci_rnc->remote_node_index |
230 | ); | 230 | ); |
231 | 231 | ||
232 | rnc_buffer->ssp.is_valid = true; | 232 | rnc_buffer->ssp.is_valid = true; |
233 | 233 | ||
234 | if (!sci_dev->is_direct_attached && | 234 | if (!idev->is_direct_attached && |
235 | (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP))) { | 235 | (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP))) { |
236 | scic_sds_remote_device_post_request(sci_dev, | 236 | scic_sds_remote_device_post_request(idev, |
237 | SCU_CONTEXT_COMMAND_POST_RNC_96); | 237 | SCU_CONTEXT_COMMAND_POST_RNC_96); |
238 | } else { | 238 | } else { |
239 | scic_sds_remote_device_post_request(sci_dev, SCU_CONTEXT_COMMAND_POST_RNC_32); | 239 | scic_sds_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_32); |
240 | 240 | ||
241 | if (sci_dev->is_direct_attached) { | 241 | if (idev->is_direct_attached) { |
242 | scic_sds_port_setup_transports(sci_dev->owning_port, | 242 | scic_sds_port_setup_transports(idev->owning_port, |
243 | sci_rnc->remote_node_index); | 243 | sci_rnc->remote_node_index); |
244 | } | 244 | } |
245 | } | 245 | } |
@@ -296,11 +296,11 @@ static void scic_sds_remote_node_context_invalidating_state_enter(struct sci_bas | |||
296 | static void scic_sds_remote_node_context_resuming_state_enter(struct sci_base_state_machine *sm) | 296 | static void scic_sds_remote_node_context_resuming_state_enter(struct sci_base_state_machine *sm) |
297 | { | 297 | { |
298 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), sm); | 298 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), sm); |
299 | struct scic_sds_remote_device *sci_dev; | 299 | struct isci_remote_device *idev; |
300 | struct domain_device *dev; | 300 | struct domain_device *dev; |
301 | 301 | ||
302 | sci_dev = rnc_to_dev(rnc); | 302 | idev = rnc_to_dev(rnc); |
303 | dev = sci_dev_to_domain(sci_dev); | 303 | dev = idev->domain_dev; |
304 | 304 | ||
305 | /* | 305 | /* |
306 | * For direct attached SATA devices we need to clear the TLCR | 306 | * For direct attached SATA devices we need to clear the TLCR |
@@ -309,11 +309,11 @@ static void scic_sds_remote_node_context_resuming_state_enter(struct sci_base_st | |||
309 | * the STPTLDARNI register with the RNi of the device | 309 | * the STPTLDARNI register with the RNi of the device |
310 | */ | 310 | */ |
311 | if ((dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) && | 311 | if ((dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) && |
312 | sci_dev->is_direct_attached) | 312 | idev->is_direct_attached) |
313 | scic_sds_port_setup_transports(sci_dev->owning_port, | 313 | scic_sds_port_setup_transports(idev->owning_port, |
314 | rnc->remote_node_index); | 314 | rnc->remote_node_index); |
315 | 315 | ||
316 | scic_sds_remote_device_post_request(sci_dev, SCU_CONTEXT_COMMAND_POST_RNC_RESUME); | 316 | scic_sds_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_RESUME); |
317 | } | 317 | } |
318 | 318 | ||
319 | static void scic_sds_remote_node_context_ready_state_enter(struct sci_base_state_machine *sm) | 319 | static void scic_sds_remote_node_context_ready_state_enter(struct sci_base_state_machine *sm) |
@@ -564,8 +564,8 @@ enum sci_status scic_sds_remote_node_context_resume(struct scic_sds_remote_node_ | |||
564 | sci_rnc->user_cookie = cb_p; | 564 | sci_rnc->user_cookie = cb_p; |
565 | return SCI_SUCCESS; | 565 | return SCI_SUCCESS; |
566 | case SCI_RNC_TX_SUSPENDED: { | 566 | case SCI_RNC_TX_SUSPENDED: { |
567 | struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc); | 567 | struct isci_remote_device *idev = rnc_to_dev(sci_rnc); |
568 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 568 | struct domain_device *dev = idev->domain_dev; |
569 | 569 | ||
570 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); | 570 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); |
571 | 571 | ||
@@ -573,7 +573,7 @@ enum sci_status scic_sds_remote_node_context_resume(struct scic_sds_remote_node_ | |||
573 | if (dev->dev_type == SAS_END_DEV || dev_is_expander(dev)) | 573 | if (dev->dev_type == SAS_END_DEV || dev_is_expander(dev)) |
574 | sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING); | 574 | sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING); |
575 | else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { | 575 | else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { |
576 | if (sci_dev->is_direct_attached) { | 576 | if (idev->is_direct_attached) { |
577 | /* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */ | 577 | /* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */ |
578 | sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING); | 578 | sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING); |
579 | } else { | 579 | } else { |
diff --git a/drivers/scsi/isci/remote_node_context.h b/drivers/scsi/isci/remote_node_context.h index 35e6ae616903..7a24c7a12de1 100644 --- a/drivers/scsi/isci/remote_node_context.h +++ b/drivers/scsi/isci/remote_node_context.h | |||
@@ -79,7 +79,7 @@ | |||
79 | #define SCI_SOFTWARE_SUSPENSION (1) | 79 | #define SCI_SOFTWARE_SUSPENSION (1) |
80 | 80 | ||
81 | struct isci_request; | 81 | struct isci_request; |
82 | struct scic_sds_remote_device; | 82 | struct isci_remote_device; |
83 | struct scic_sds_remote_node_context; | 83 | struct scic_sds_remote_node_context; |
84 | 84 | ||
85 | typedef void (*scics_sds_remote_node_context_callback)(void *); | 85 | typedef void (*scics_sds_remote_node_context_callback)(void *); |
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index 2d29abf3ce1f..90ead662828d 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c | |||
@@ -209,17 +209,17 @@ static void scu_ssp_reqeust_construct_task_context( | |||
209 | struct scu_task_context *task_context) | 209 | struct scu_task_context *task_context) |
210 | { | 210 | { |
211 | dma_addr_t dma_addr; | 211 | dma_addr_t dma_addr; |
212 | struct scic_sds_remote_device *target_device; | 212 | struct isci_remote_device *idev; |
213 | struct isci_port *iport; | 213 | struct isci_port *iport; |
214 | 214 | ||
215 | target_device = scic_sds_request_get_device(ireq); | 215 | idev = scic_sds_request_get_device(ireq); |
216 | iport = scic_sds_request_get_port(ireq); | 216 | iport = scic_sds_request_get_port(ireq); |
217 | 217 | ||
218 | /* Fill in the TC with the its required data */ | 218 | /* Fill in the TC with the its required data */ |
219 | task_context->abort = 0; | 219 | task_context->abort = 0; |
220 | task_context->priority = 0; | 220 | task_context->priority = 0; |
221 | task_context->initiator_request = 1; | 221 | task_context->initiator_request = 1; |
222 | task_context->connection_rate = target_device->connection_rate; | 222 | task_context->connection_rate = idev->connection_rate; |
223 | task_context->protocol_engine_index = | 223 | task_context->protocol_engine_index = |
224 | scic_sds_controller_get_protocol_engine_group(controller); | 224 | scic_sds_controller_get_protocol_engine_group(controller); |
225 | task_context->logical_port_index = scic_sds_port_get_index(iport); | 225 | task_context->logical_port_index = scic_sds_port_get_index(iport); |
@@ -227,8 +227,7 @@ static void scu_ssp_reqeust_construct_task_context( | |||
227 | task_context->valid = SCU_TASK_CONTEXT_VALID; | 227 | task_context->valid = SCU_TASK_CONTEXT_VALID; |
228 | task_context->context_type = SCU_TASK_CONTEXT_TYPE; | 228 | task_context->context_type = SCU_TASK_CONTEXT_TYPE; |
229 | 229 | ||
230 | task_context->remote_node_index = | 230 | task_context->remote_node_index = scic_sds_remote_device_get_index(idev); |
231 | scic_sds_remote_device_get_index(ireq->target_device); | ||
232 | task_context->command_code = 0; | 231 | task_context->command_code = 0; |
233 | 232 | ||
234 | task_context->link_layer_control = 0; | 233 | task_context->link_layer_control = 0; |
@@ -348,17 +347,17 @@ static void scu_sata_reqeust_construct_task_context( | |||
348 | struct scu_task_context *task_context) | 347 | struct scu_task_context *task_context) |
349 | { | 348 | { |
350 | dma_addr_t dma_addr; | 349 | dma_addr_t dma_addr; |
351 | struct scic_sds_remote_device *target_device; | 350 | struct isci_remote_device *idev; |
352 | struct isci_port *iport; | 351 | struct isci_port *iport; |
353 | 352 | ||
354 | target_device = scic_sds_request_get_device(ireq); | 353 | idev = scic_sds_request_get_device(ireq); |
355 | iport = scic_sds_request_get_port(ireq); | 354 | iport = scic_sds_request_get_port(ireq); |
356 | 355 | ||
357 | /* Fill in the TC with the its required data */ | 356 | /* Fill in the TC with the its required data */ |
358 | task_context->abort = 0; | 357 | task_context->abort = 0; |
359 | task_context->priority = SCU_TASK_PRIORITY_NORMAL; | 358 | task_context->priority = SCU_TASK_PRIORITY_NORMAL; |
360 | task_context->initiator_request = 1; | 359 | task_context->initiator_request = 1; |
361 | task_context->connection_rate = target_device->connection_rate; | 360 | task_context->connection_rate = idev->connection_rate; |
362 | task_context->protocol_engine_index = | 361 | task_context->protocol_engine_index = |
363 | scic_sds_controller_get_protocol_engine_group(controller); | 362 | scic_sds_controller_get_protocol_engine_group(controller); |
364 | task_context->logical_port_index = | 363 | task_context->logical_port_index = |
@@ -367,8 +366,7 @@ static void scu_sata_reqeust_construct_task_context( | |||
367 | task_context->valid = SCU_TASK_CONTEXT_VALID; | 366 | task_context->valid = SCU_TASK_CONTEXT_VALID; |
368 | task_context->context_type = SCU_TASK_CONTEXT_TYPE; | 367 | task_context->context_type = SCU_TASK_CONTEXT_TYPE; |
369 | 368 | ||
370 | task_context->remote_node_index = | 369 | task_context->remote_node_index = scic_sds_remote_device_get_index(idev); |
371 | scic_sds_remote_device_get_index(ireq->target_device); | ||
372 | task_context->command_code = 0; | 370 | task_context->command_code = 0; |
373 | 371 | ||
374 | task_context->link_layer_control = 0; | 372 | task_context->link_layer_control = 0; |
@@ -2850,7 +2848,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2850 | static void scic_sds_request_started_state_enter(struct sci_base_state_machine *sm) | 2848 | static void scic_sds_request_started_state_enter(struct sci_base_state_machine *sm) |
2851 | { | 2849 | { |
2852 | struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); | 2850 | struct isci_request *ireq = container_of(sm, typeof(*ireq), sm); |
2853 | struct domain_device *dev = sci_dev_to_domain(ireq->target_device); | 2851 | struct domain_device *dev = ireq->target_device->domain_dev; |
2854 | struct sas_task *task; | 2852 | struct sas_task *task; |
2855 | 2853 | ||
2856 | /* XXX as hch said always creating an internal sas_task for tmf | 2854 | /* XXX as hch said always creating an internal sas_task for tmf |
@@ -2988,12 +2986,12 @@ static const struct sci_base_state scic_sds_request_state_table[] = { | |||
2988 | 2986 | ||
2989 | static void | 2987 | static void |
2990 | scic_sds_general_request_construct(struct scic_sds_controller *scic, | 2988 | scic_sds_general_request_construct(struct scic_sds_controller *scic, |
2991 | struct scic_sds_remote_device *sci_dev, | 2989 | struct isci_remote_device *idev, |
2992 | struct isci_request *ireq) | 2990 | struct isci_request *ireq) |
2993 | { | 2991 | { |
2994 | sci_init_sm(&ireq->sm, scic_sds_request_state_table, SCI_REQ_INIT); | 2992 | sci_init_sm(&ireq->sm, scic_sds_request_state_table, SCI_REQ_INIT); |
2995 | 2993 | ||
2996 | ireq->target_device = sci_dev; | 2994 | ireq->target_device = idev; |
2997 | ireq->protocol = SCIC_NO_PROTOCOL; | 2995 | ireq->protocol = SCIC_NO_PROTOCOL; |
2998 | ireq->saved_rx_frame_index = SCU_INVALID_FRAME_INDEX; | 2996 | ireq->saved_rx_frame_index = SCU_INVALID_FRAME_INDEX; |
2999 | 2997 | ||
@@ -3004,16 +3002,16 @@ scic_sds_general_request_construct(struct scic_sds_controller *scic, | |||
3004 | 3002 | ||
3005 | static enum sci_status | 3003 | static enum sci_status |
3006 | scic_io_request_construct(struct scic_sds_controller *scic, | 3004 | scic_io_request_construct(struct scic_sds_controller *scic, |
3007 | struct scic_sds_remote_device *sci_dev, | 3005 | struct isci_remote_device *idev, |
3008 | struct isci_request *ireq) | 3006 | struct isci_request *ireq) |
3009 | { | 3007 | { |
3010 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 3008 | struct domain_device *dev = idev->domain_dev; |
3011 | enum sci_status status = SCI_SUCCESS; | 3009 | enum sci_status status = SCI_SUCCESS; |
3012 | 3010 | ||
3013 | /* Build the common part of the request */ | 3011 | /* Build the common part of the request */ |
3014 | scic_sds_general_request_construct(scic, sci_dev, ireq); | 3012 | scic_sds_general_request_construct(scic, idev, ireq); |
3015 | 3013 | ||
3016 | if (sci_dev->rnc.remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) | 3014 | if (idev->rnc.remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) |
3017 | return SCI_FAILURE_INVALID_REMOTE_DEVICE; | 3015 | return SCI_FAILURE_INVALID_REMOTE_DEVICE; |
3018 | 3016 | ||
3019 | if (dev->dev_type == SAS_END_DEV) | 3017 | if (dev->dev_type == SAS_END_DEV) |
@@ -3031,14 +3029,14 @@ scic_io_request_construct(struct scic_sds_controller *scic, | |||
3031 | } | 3029 | } |
3032 | 3030 | ||
3033 | enum sci_status scic_task_request_construct(struct scic_sds_controller *scic, | 3031 | enum sci_status scic_task_request_construct(struct scic_sds_controller *scic, |
3034 | struct scic_sds_remote_device *sci_dev, | 3032 | struct isci_remote_device *idev, |
3035 | u16 io_tag, struct isci_request *ireq) | 3033 | u16 io_tag, struct isci_request *ireq) |
3036 | { | 3034 | { |
3037 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 3035 | struct domain_device *dev = idev->domain_dev; |
3038 | enum sci_status status = SCI_SUCCESS; | 3036 | enum sci_status status = SCI_SUCCESS; |
3039 | 3037 | ||
3040 | /* Build the common part of the request */ | 3038 | /* Build the common part of the request */ |
3041 | scic_sds_general_request_construct(scic, sci_dev, ireq); | 3039 | scic_sds_general_request_construct(scic, idev, ireq); |
3042 | 3040 | ||
3043 | if (dev->dev_type == SAS_END_DEV || | 3041 | if (dev->dev_type == SAS_END_DEV || |
3044 | dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { | 3042 | dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { |
@@ -3102,7 +3100,7 @@ scic_io_request_construct_smp(struct device *dev, | |||
3102 | struct sas_task *task) | 3100 | struct sas_task *task) |
3103 | { | 3101 | { |
3104 | struct scatterlist *sg = &task->smp_task.smp_req; | 3102 | struct scatterlist *sg = &task->smp_task.smp_req; |
3105 | struct scic_sds_remote_device *sci_dev; | 3103 | struct isci_remote_device *idev; |
3106 | struct scu_task_context *task_context; | 3104 | struct scu_task_context *task_context; |
3107 | struct isci_port *iport; | 3105 | struct isci_port *iport; |
3108 | struct smp_req *smp_req; | 3106 | struct smp_req *smp_req; |
@@ -3147,7 +3145,7 @@ scic_io_request_construct_smp(struct device *dev, | |||
3147 | 3145 | ||
3148 | task_context = ireq->tc; | 3146 | task_context = ireq->tc; |
3149 | 3147 | ||
3150 | sci_dev = scic_sds_request_get_device(ireq); | 3148 | idev = scic_sds_request_get_device(ireq); |
3151 | iport = scic_sds_request_get_port(ireq); | 3149 | iport = scic_sds_request_get_port(ireq); |
3152 | 3150 | ||
3153 | /* | 3151 | /* |
@@ -3156,7 +3154,7 @@ scic_io_request_construct_smp(struct device *dev, | |||
3156 | */ | 3154 | */ |
3157 | task_context->priority = 0; | 3155 | task_context->priority = 0; |
3158 | task_context->initiator_request = 1; | 3156 | task_context->initiator_request = 1; |
3159 | task_context->connection_rate = sci_dev->connection_rate; | 3157 | task_context->connection_rate = idev->connection_rate; |
3160 | task_context->protocol_engine_index = | 3158 | task_context->protocol_engine_index = |
3161 | scic_sds_controller_get_protocol_engine_group(scic); | 3159 | scic_sds_controller_get_protocol_engine_group(scic); |
3162 | task_context->logical_port_index = scic_sds_port_get_index(iport); | 3160 | task_context->logical_port_index = scic_sds_port_get_index(iport); |
@@ -3166,7 +3164,7 @@ scic_io_request_construct_smp(struct device *dev, | |||
3166 | task_context->context_type = SCU_TASK_CONTEXT_TYPE; | 3164 | task_context->context_type = SCU_TASK_CONTEXT_TYPE; |
3167 | 3165 | ||
3168 | /* 04h */ | 3166 | /* 04h */ |
3169 | task_context->remote_node_index = sci_dev->rnc.remote_node_index; | 3167 | task_context->remote_node_index = idev->rnc.remote_node_index; |
3170 | task_context->command_code = 0; | 3168 | task_context->command_code = 0; |
3171 | task_context->task_type = SCU_TASK_TYPE_SMP_REQUEST; | 3169 | task_context->task_type = SCU_TASK_TYPE_SMP_REQUEST; |
3172 | 3170 | ||
@@ -3257,17 +3255,16 @@ static enum sci_status isci_smp_request_build(struct isci_request *ireq) | |||
3257 | */ | 3255 | */ |
3258 | static enum sci_status isci_io_request_build(struct isci_host *isci_host, | 3256 | static enum sci_status isci_io_request_build(struct isci_host *isci_host, |
3259 | struct isci_request *request, | 3257 | struct isci_request *request, |
3260 | struct isci_remote_device *isci_device) | 3258 | struct isci_remote_device *idev) |
3261 | { | 3259 | { |
3262 | enum sci_status status = SCI_SUCCESS; | 3260 | enum sci_status status = SCI_SUCCESS; |
3263 | struct sas_task *task = isci_request_access_task(request); | 3261 | struct sas_task *task = isci_request_access_task(request); |
3264 | struct scic_sds_remote_device *sci_device = &isci_device->sci; | ||
3265 | 3262 | ||
3266 | dev_dbg(&isci_host->pdev->dev, | 3263 | dev_dbg(&isci_host->pdev->dev, |
3267 | "%s: isci_device = 0x%p; request = %p, " | 3264 | "%s: idev = 0x%p; request = %p, " |
3268 | "num_scatter = %d\n", | 3265 | "num_scatter = %d\n", |
3269 | __func__, | 3266 | __func__, |
3270 | isci_device, | 3267 | idev, |
3271 | request, | 3268 | request, |
3272 | task->num_scatter); | 3269 | task->num_scatter); |
3273 | 3270 | ||
@@ -3290,8 +3287,7 @@ static enum sci_status isci_io_request_build(struct isci_host *isci_host, | |||
3290 | return SCI_FAILURE_INSUFFICIENT_RESOURCES; | 3287 | return SCI_FAILURE_INSUFFICIENT_RESOURCES; |
3291 | } | 3288 | } |
3292 | 3289 | ||
3293 | status = scic_io_request_construct(&isci_host->sci, sci_device, | 3290 | status = scic_io_request_construct(&isci_host->sci, idev, request); |
3294 | request); | ||
3295 | 3291 | ||
3296 | if (status != SCI_SUCCESS) { | 3292 | if (status != SCI_SUCCESS) { |
3297 | dev_warn(&isci_host->pdev->dev, | 3293 | dev_warn(&isci_host->pdev->dev, |
@@ -3397,14 +3393,14 @@ int isci_request_execute(struct isci_host *ihost, struct isci_remote_device *ide | |||
3397 | * ireq->is_task_management_request is false). | 3393 | * ireq->is_task_management_request is false). |
3398 | */ | 3394 | */ |
3399 | status = scic_controller_start_task(&ihost->sci, | 3395 | status = scic_controller_start_task(&ihost->sci, |
3400 | &idev->sci, | 3396 | idev, |
3401 | ireq); | 3397 | ireq); |
3402 | } else { | 3398 | } else { |
3403 | status = SCI_FAILURE; | 3399 | status = SCI_FAILURE; |
3404 | } | 3400 | } |
3405 | } else { | 3401 | } else { |
3406 | /* send the request, let the core assign the IO TAG. */ | 3402 | /* send the request, let the core assign the IO TAG. */ |
3407 | status = scic_controller_start_io(&ihost->sci, &idev->sci, | 3403 | status = scic_controller_start_io(&ihost->sci, idev, |
3408 | ireq); | 3404 | ireq); |
3409 | } | 3405 | } |
3410 | 3406 | ||
diff --git a/drivers/scsi/isci/request.h b/drivers/scsi/isci/request.h index 68d8a27357eb..ca64ea207ac8 100644 --- a/drivers/scsi/isci/request.h +++ b/drivers/scsi/isci/request.h | |||
@@ -146,7 +146,7 @@ struct isci_request { | |||
146 | struct completion *io_request_completion; | 146 | struct completion *io_request_completion; |
147 | struct sci_base_state_machine sm; | 147 | struct sci_base_state_machine sm; |
148 | struct scic_sds_controller *owning_controller; | 148 | struct scic_sds_controller *owning_controller; |
149 | struct scic_sds_remote_device *target_device; | 149 | struct isci_remote_device *target_device; |
150 | u16 io_tag; | 150 | u16 io_tag; |
151 | enum sci_request_protocol protocol; | 151 | enum sci_request_protocol protocol; |
152 | u32 scu_status; /* hardware result */ | 152 | u32 scu_status; /* hardware result */ |
@@ -501,7 +501,7 @@ void isci_terminate_pending_requests(struct isci_host *ihost, | |||
501 | struct isci_remote_device *idev); | 501 | struct isci_remote_device *idev); |
502 | enum sci_status | 502 | enum sci_status |
503 | scic_task_request_construct(struct scic_sds_controller *scic, | 503 | scic_task_request_construct(struct scic_sds_controller *scic, |
504 | struct scic_sds_remote_device *sci_dev, | 504 | struct isci_remote_device *idev, |
505 | u16 io_tag, | 505 | u16 io_tag, |
506 | struct isci_request *ireq); | 506 | struct isci_request *ireq); |
507 | enum sci_status | 507 | enum sci_status |
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c index 700708c82678..89b01eef44b1 100644 --- a/drivers/scsi/isci/task.c +++ b/drivers/scsi/isci/task.c | |||
@@ -257,7 +257,7 @@ static struct isci_request *isci_task_request_build(struct isci_host *ihost, | |||
257 | return NULL; | 257 | return NULL; |
258 | 258 | ||
259 | /* let the core do it's construct. */ | 259 | /* let the core do it's construct. */ |
260 | status = scic_task_request_construct(&ihost->sci, &idev->sci, tag, | 260 | status = scic_task_request_construct(&ihost->sci, idev, tag, |
261 | ireq); | 261 | ireq); |
262 | 262 | ||
263 | if (status != SCI_SUCCESS) { | 263 | if (status != SCI_SUCCESS) { |
@@ -288,12 +288,11 @@ static struct isci_request *isci_task_request_build(struct isci_host *ihost, | |||
288 | } | 288 | } |
289 | 289 | ||
290 | int isci_task_execute_tmf(struct isci_host *ihost, | 290 | int isci_task_execute_tmf(struct isci_host *ihost, |
291 | struct isci_remote_device *isci_device, | 291 | struct isci_remote_device *idev, |
292 | struct isci_tmf *tmf, unsigned long timeout_ms) | 292 | struct isci_tmf *tmf, unsigned long timeout_ms) |
293 | { | 293 | { |
294 | DECLARE_COMPLETION_ONSTACK(completion); | 294 | DECLARE_COMPLETION_ONSTACK(completion); |
295 | enum sci_task_status status = SCI_TASK_FAILURE; | 295 | enum sci_task_status status = SCI_TASK_FAILURE; |
296 | struct scic_sds_remote_device *sci_device; | ||
297 | struct isci_request *ireq; | 296 | struct isci_request *ireq; |
298 | int ret = TMF_RESP_FUNC_FAILED; | 297 | int ret = TMF_RESP_FUNC_FAILED; |
299 | unsigned long flags; | 298 | unsigned long flags; |
@@ -310,34 +309,30 @@ int isci_task_execute_tmf(struct isci_host *ihost, | |||
310 | /* sanity check, return TMF_RESP_FUNC_FAILED | 309 | /* sanity check, return TMF_RESP_FUNC_FAILED |
311 | * if the device is not there and ready. | 310 | * if the device is not there and ready. |
312 | */ | 311 | */ |
313 | if (!isci_device || | 312 | if (!idev || |
314 | (!test_bit(IDEV_IO_READY, &isci_device->flags) && | 313 | (!test_bit(IDEV_IO_READY, &idev->flags) && |
315 | !test_bit(IDEV_IO_NCQERROR, &isci_device->flags))) { | 314 | !test_bit(IDEV_IO_NCQERROR, &idev->flags))) { |
316 | dev_dbg(&ihost->pdev->dev, | 315 | dev_dbg(&ihost->pdev->dev, |
317 | "%s: isci_device = %p not ready (%#lx)\n", | 316 | "%s: idev = %p not ready (%#lx)\n", |
318 | __func__, | 317 | __func__, |
319 | isci_device, isci_device ? isci_device->flags : 0); | 318 | idev, idev ? idev->flags : 0); |
320 | goto err_tci; | 319 | goto err_tci; |
321 | } else | 320 | } else |
322 | dev_dbg(&ihost->pdev->dev, | 321 | dev_dbg(&ihost->pdev->dev, |
323 | "%s: isci_device = %p\n", | 322 | "%s: idev = %p\n", |
324 | __func__, isci_device); | 323 | __func__, idev); |
325 | |||
326 | sci_device = &isci_device->sci; | ||
327 | 324 | ||
328 | /* Assign the pointer to the TMF's completion kernel wait structure. */ | 325 | /* Assign the pointer to the TMF's completion kernel wait structure. */ |
329 | tmf->complete = &completion; | 326 | tmf->complete = &completion; |
330 | 327 | ||
331 | ireq = isci_task_request_build(ihost, isci_device, tag, tmf); | 328 | ireq = isci_task_request_build(ihost, idev, tag, tmf); |
332 | if (!ireq) | 329 | if (!ireq) |
333 | goto err_tci; | 330 | goto err_tci; |
334 | 331 | ||
335 | spin_lock_irqsave(&ihost->scic_lock, flags); | 332 | spin_lock_irqsave(&ihost->scic_lock, flags); |
336 | 333 | ||
337 | /* start the TMF io. */ | 334 | /* start the TMF io. */ |
338 | status = scic_controller_start_task(&ihost->sci, | 335 | status = scic_controller_start_task(&ihost->sci, idev, ireq); |
339 | sci_device, | ||
340 | ireq); | ||
341 | 336 | ||
342 | if (status != SCI_TASK_SUCCESS) { | 337 | if (status != SCI_TASK_SUCCESS) { |
343 | dev_warn(&ihost->pdev->dev, | 338 | dev_warn(&ihost->pdev->dev, |
@@ -355,7 +350,7 @@ int isci_task_execute_tmf(struct isci_host *ihost, | |||
355 | isci_request_change_state(ireq, started); | 350 | isci_request_change_state(ireq, started); |
356 | 351 | ||
357 | /* add the request to the remote device request list. */ | 352 | /* add the request to the remote device request list. */ |
358 | list_add(&ireq->dev_node, &isci_device->reqs_in_process); | 353 | list_add(&ireq->dev_node, &idev->reqs_in_process); |
359 | 354 | ||
360 | spin_unlock_irqrestore(&ihost->scic_lock, flags); | 355 | spin_unlock_irqrestore(&ihost->scic_lock, flags); |
361 | 356 | ||
@@ -370,7 +365,7 @@ int isci_task_execute_tmf(struct isci_host *ihost, | |||
370 | tmf->cb_state_func(isci_tmf_timed_out, tmf, tmf->cb_data); | 365 | tmf->cb_state_func(isci_tmf_timed_out, tmf, tmf->cb_data); |
371 | 366 | ||
372 | scic_controller_terminate_request(&ihost->sci, | 367 | scic_controller_terminate_request(&ihost->sci, |
373 | &isci_device->sci, | 368 | idev, |
374 | ireq); | 369 | ireq); |
375 | 370 | ||
376 | spin_unlock_irqrestore(&ihost->scic_lock, flags); | 371 | spin_unlock_irqrestore(&ihost->scic_lock, flags); |
@@ -520,13 +515,13 @@ static void isci_request_cleanup_completed_loiterer( | |||
520 | * from a thread that can wait. Note that the request is terminated and | 515 | * from a thread that can wait. Note that the request is terminated and |
521 | * completed (back to the host, if started there). | 516 | * completed (back to the host, if started there). |
522 | * @isci_host: This SCU. | 517 | * @isci_host: This SCU. |
523 | * @isci_device: The target. | 518 | * @idev: The target. |
524 | * @isci_request: The I/O request to be terminated. | 519 | * @isci_request: The I/O request to be terminated. |
525 | * | 520 | * |
526 | */ | 521 | */ |
527 | static void isci_terminate_request_core( | 522 | static void isci_terminate_request_core( |
528 | struct isci_host *isci_host, | 523 | struct isci_host *isci_host, |
529 | struct isci_remote_device *isci_device, | 524 | struct isci_remote_device *idev, |
530 | struct isci_request *isci_request) | 525 | struct isci_request *isci_request) |
531 | { | 526 | { |
532 | enum sci_status status = SCI_SUCCESS; | 527 | enum sci_status status = SCI_SUCCESS; |
@@ -540,7 +535,7 @@ static void isci_terminate_request_core( | |||
540 | 535 | ||
541 | dev_dbg(&isci_host->pdev->dev, | 536 | dev_dbg(&isci_host->pdev->dev, |
542 | "%s: device = %p; request = %p\n", | 537 | "%s: device = %p; request = %p\n", |
543 | __func__, isci_device, isci_request); | 538 | __func__, idev, isci_request); |
544 | 539 | ||
545 | spin_lock_irqsave(&isci_host->scic_lock, flags); | 540 | spin_lock_irqsave(&isci_host->scic_lock, flags); |
546 | 541 | ||
@@ -564,7 +559,7 @@ static void isci_terminate_request_core( | |||
564 | needs_cleanup_handling = true; | 559 | needs_cleanup_handling = true; |
565 | status = scic_controller_terminate_request( | 560 | status = scic_controller_terminate_request( |
566 | &isci_host->sci, | 561 | &isci_host->sci, |
567 | &isci_device->sci, | 562 | idev, |
568 | isci_request); | 563 | isci_request); |
569 | } | 564 | } |
570 | spin_unlock_irqrestore(&isci_host->scic_lock, flags); | 565 | spin_unlock_irqrestore(&isci_host->scic_lock, flags); |
@@ -683,7 +678,7 @@ static void isci_terminate_request_core( | |||
683 | } | 678 | } |
684 | if (needs_cleanup_handling) | 679 | if (needs_cleanup_handling) |
685 | isci_request_cleanup_completed_loiterer( | 680 | isci_request_cleanup_completed_loiterer( |
686 | isci_host, isci_device, isci_request, task); | 681 | isci_host, idev, isci_request, task); |
687 | } | 682 | } |
688 | } | 683 | } |
689 | 684 | ||
@@ -694,7 +689,7 @@ static void isci_terminate_request_core( | |||
694 | * called from a thread that can wait. Note that the requests are all | 689 | * called from a thread that can wait. Note that the requests are all |
695 | * terminated and completed (back to the host, if started there). | 690 | * terminated and completed (back to the host, if started there). |
696 | * @isci_host: This parameter specifies SCU. | 691 | * @isci_host: This parameter specifies SCU. |
697 | * @isci_device: This parameter specifies the target. | 692 | * @idev: This parameter specifies the target. |
698 | * | 693 | * |
699 | */ | 694 | */ |
700 | void isci_terminate_pending_requests(struct isci_host *ihost, | 695 | void isci_terminate_pending_requests(struct isci_host *ihost, |
@@ -1521,7 +1516,7 @@ static int isci_reset_device(struct isci_host *ihost, | |||
1521 | dev_dbg(&ihost->pdev->dev, "%s: idev %p\n", __func__, idev); | 1516 | dev_dbg(&ihost->pdev->dev, "%s: idev %p\n", __func__, idev); |
1522 | 1517 | ||
1523 | spin_lock_irqsave(&ihost->scic_lock, flags); | 1518 | spin_lock_irqsave(&ihost->scic_lock, flags); |
1524 | status = scic_remote_device_reset(&idev->sci); | 1519 | status = scic_remote_device_reset(idev); |
1525 | if (status != SCI_SUCCESS) { | 1520 | if (status != SCI_SUCCESS) { |
1526 | spin_unlock_irqrestore(&ihost->scic_lock, flags); | 1521 | spin_unlock_irqrestore(&ihost->scic_lock, flags); |
1527 | 1522 | ||
@@ -1547,7 +1542,7 @@ static int isci_reset_device(struct isci_host *ihost, | |||
1547 | 1542 | ||
1548 | /* Since all pending TCs have been cleaned, resume the RNC. */ | 1543 | /* Since all pending TCs have been cleaned, resume the RNC. */ |
1549 | spin_lock_irqsave(&ihost->scic_lock, flags); | 1544 | spin_lock_irqsave(&ihost->scic_lock, flags); |
1550 | status = scic_remote_device_reset_complete(&idev->sci); | 1545 | status = scic_remote_device_reset_complete(idev); |
1551 | spin_unlock_irqrestore(&ihost->scic_lock, flags); | 1546 | spin_unlock_irqrestore(&ihost->scic_lock, flags); |
1552 | 1547 | ||
1553 | /* If this is a device on an expander, bring the phy back up. */ | 1548 | /* If this is a device on an expander, bring the phy back up. */ |