drivers/scsi/isci/remote_device.c
Source file repositories/reference/linux-study-clean/drivers/scsi/isci/remote_device.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/isci/remote_device.c- Extension
.c- Size
- 51906 bytes
- Lines
- 1669
- Domain
- Driver Families
- Bucket
- drivers/scsi
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
scsi/sas.hlinux/bitops.hisci.hport.hremote_device.hrequest.hremote_node_context.hscu_event_codes.htask.h
Detected Declarations
function sci_remote_device_suspendfunction isci_remote_device_readyfunction sci_remote_device_terminate_reqfunction sci_remote_device_terminate_reqs_checkabortfunction isci_compare_suspendcountfunction isci_check_reqtermfunction isci_check_devemptyfunction isci_remote_device_terminate_requestsfunction isci_remote_device_not_readyfunction rnc_destruct_donefunction sci_remote_device_terminate_requestsfunction sci_remote_device_stopfunction sci_remote_device_frame_handlerfunction is_remote_device_readyfunction statefunction sci_remote_device_event_handlerfunction sci_remote_device_start_requestfunction sci_remote_device_start_iofunction common_complete_iofunction sci_remote_device_complete_iofunction sci_remote_device_continue_requestfunction sci_remote_device_start_taskfunction sci_remote_device_post_requestfunction remote_device_resume_donefunction sci_stp_remote_device_ready_idle_substate_resume_complete_handlerfunction sci_remote_device_initial_state_enterfunction sci_remote_device_destructfunction isci_remote_device_deconstructfunction sci_remote_device_stopped_state_enterfunction sci_remote_device_starting_state_enterfunction sci_remote_device_ready_state_enterfunction sci_remote_device_ready_state_exitfunction sci_remote_device_resetting_state_enterfunction sci_remote_device_resetting_state_exitfunction sci_stp_remote_device_ready_idle_substate_enterfunction sci_stp_remote_device_ready_cmd_substate_enterfunction sci_stp_remote_device_ready_ncq_error_substate_enterfunction sci_smp_remote_device_ready_idle_substate_enterfunction sci_smp_remote_device_ready_cmd_substate_enterfunction sci_smp_remote_device_ready_cmd_substate_exitfunction sci_remote_device_constructfunction sci_remote_device_da_constructfunction sci_remote_device_ea_constructfunction sci_remote_device_resumefunction isci_remote_device_resume_from_abort_completefunction isci_remote_device_test_resume_donefunction isci_remote_device_wait_for_resume_from_abortfunction isci_remote_device_test_resume_done
Annotated Snippet
if (ireq) {
/* Terminate a specific TC. */
set_bit(IREQ_NO_AUTO_FREE_TAG, &ireq->flags);
sci_remote_device_terminate_req(ihost, idev, 0, ireq);
spin_unlock_irqrestore(&ihost->scic_lock, flags);
if (!wait_event_timeout(ihost->eventq,
isci_check_reqterm(ihost, idev, ireq,
rnc_suspend_count),
msecs_to_jiffies(MAX_SUSPEND_MSECS))) {
dev_warn(&ihost->pdev->dev, "%s host%d timeout single\n",
__func__, ihost->id);
dev_dbg(&ihost->pdev->dev,
"%s: ******* Timeout waiting for "
"suspend; idev=%p, current state %s; "
"started_request_count=%d, flags=%lx\n\t"
"rnc_suspend_count=%d, rnc.suspend_count=%d "
"RNC: current state %s, current "
"suspend_type %x dest state %d;\n"
"ireq=%p, ireq->flags = %lx\n",
__func__, idev,
dev_state_name(idev->sm.current_state_id),
idev->started_request_count, idev->flags,
rnc_suspend_count, idev->rnc.suspend_count,
rnc_state_name(idev->rnc.sm.current_state_id),
idev->rnc.suspend_type,
idev->rnc.destination_state,
ireq, ireq->flags);
}
spin_lock_irqsave(&ihost->scic_lock, flags);
clear_bit(IREQ_NO_AUTO_FREE_TAG, &ireq->flags);
if (!test_bit(IREQ_ABORT_PATH_ACTIVE, &ireq->flags))
isci_free_tag(ihost, ireq->io_tag);
spin_unlock_irqrestore(&ihost->scic_lock, flags);
} else {
/* Terminate all TCs. */
sci_remote_device_terminate_requests(idev);
spin_unlock_irqrestore(&ihost->scic_lock, flags);
if (!wait_event_timeout(ihost->eventq,
isci_check_devempty(ihost, idev,
rnc_suspend_count),
msecs_to_jiffies(MAX_SUSPEND_MSECS))) {
dev_warn(&ihost->pdev->dev, "%s host%d timeout all\n",
__func__, ihost->id);
dev_dbg(&ihost->pdev->dev,
"%s: ******* Timeout waiting for "
"suspend; idev=%p, current state %s; "
"started_request_count=%d, flags=%lx\n\t"
"rnc_suspend_count=%d, "
"RNC: current state %s, "
"rnc.suspend_count=%d, current "
"suspend_type %x dest state %d\n",
__func__, idev,
dev_state_name(idev->sm.current_state_id),
idev->started_request_count, idev->flags,
rnc_suspend_count,
rnc_state_name(idev->rnc.sm.current_state_id),
idev->rnc.suspend_count,
idev->rnc.suspend_type,
idev->rnc.destination_state);
}
}
dev_dbg(&ihost->pdev->dev, "%s: idev=%p, wait done\n",
__func__, idev);
isci_put_device(idev);
}
return status;
}
/**
* isci_remote_device_not_ready() - This function is called by the ihost when
* the remote device is not ready. We mark the isci device as ready (not
* "ready_for_io") and signal the waiting proccess.
* @ihost: This parameter specifies the isci host object.
* @idev: This parameter specifies the remote device
* @reason: Reason to switch on
*
* sci_lock is held on entrance to this function.
*/
static void isci_remote_device_not_ready(struct isci_host *ihost,
struct isci_remote_device *idev,
u32 reason)
{
dev_dbg(&ihost->pdev->dev,
"%s: isci_device = %p; reason = %d\n", __func__, idev, reason);
switch (reason) {
case SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED:
set_bit(IDEV_IO_NCQERROR, &idev->flags);
Annotation
- Immediate include surface: `scsi/sas.h`, `linux/bitops.h`, `isci.h`, `port.h`, `remote_device.h`, `request.h`, `remote_node_context.h`, `scu_event_codes.h`.
- Detected declarations: `function sci_remote_device_suspend`, `function isci_remote_device_ready`, `function sci_remote_device_terminate_req`, `function sci_remote_device_terminate_reqs_checkabort`, `function isci_compare_suspendcount`, `function isci_check_reqterm`, `function isci_check_devempty`, `function isci_remote_device_terminate_requests`, `function isci_remote_device_not_ready`, `function rnc_destruct_done`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.