drivers/scsi/isci/remote_node_context.c
Source file repositories/reference/linux-study-clean/drivers/scsi/isci/remote_node_context.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/isci/remote_node_context.c- Extension
.c- Size
- 25690 bytes
- Lines
- 806
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
scsi/sas_ata.hhost.hisci.hremote_device.hremote_node_context.hscu_event_codes.hscu_task_context.h
Detected Declarations
function sci_remote_node_context_is_readyfunction sci_remote_node_context_is_suspendedfunction sci_remote_node_context_construct_bufferfunction sci_remote_node_context_setup_to_resumefunction sci_remote_node_context_setup_to_destroyfunction sci_remote_node_context_notify_userfunction sci_remote_node_context_continue_state_transitionsfunction sci_remote_node_context_validate_context_bufferfunction sci_remote_node_context_invalidate_context_bufferfunction sci_remote_node_context_initial_state_enterfunction sci_remote_node_context_posting_state_enterfunction sci_remote_node_context_invalidating_state_enterfunction sci_remote_node_context_resuming_state_enterfunction sci_remote_node_context_ready_state_enterfunction sci_remote_node_context_tx_suspended_state_enterfunction sci_remote_node_context_tx_rx_suspended_state_enterfunction sci_remote_node_context_await_suspend_state_exitfunction sci_remote_node_context_constructfunction sci_remote_node_context_event_handlerfunction sci_remote_node_context_destructfunction sci_remote_node_context_suspendfunction sci_remote_node_context_resumefunction sci_remote_node_context_start_iofunction sci_remote_node_context_start_taskfunction sci_remote_node_context_is_safe_to_abort
Annotated Snippet
if (callback != NULL) {
sci_rnc->user_callback = callback;
sci_rnc->user_cookie = callback_parameter;
}
}
}
static void sci_remote_node_context_setup_to_destroy(
struct sci_remote_node_context *sci_rnc,
scics_sds_remote_node_context_callback callback,
void *callback_parameter)
{
struct isci_host *ihost = idev_to_ihost(rnc_to_dev(sci_rnc));
sci_rnc->destination_state = RNC_DEST_FINAL;
sci_rnc->user_callback = callback;
sci_rnc->user_cookie = callback_parameter;
wake_up(&ihost->eventq);
}
/*
* This method just calls the user callback function and then resets the
* callback.
*/
static void sci_remote_node_context_notify_user(
struct sci_remote_node_context *rnc)
{
if (rnc->user_callback != NULL) {
(*rnc->user_callback)(rnc->user_cookie);
rnc->user_callback = NULL;
rnc->user_cookie = NULL;
}
}
static void sci_remote_node_context_continue_state_transitions(struct sci_remote_node_context *rnc)
{
switch (rnc->destination_state) {
case RNC_DEST_READY:
case RNC_DEST_SUSPENDED_RESUME:
rnc->destination_state = RNC_DEST_READY;
fallthrough;
case RNC_DEST_FINAL:
sci_remote_node_context_resume(rnc, rnc->user_callback,
rnc->user_cookie);
break;
default:
rnc->destination_state = RNC_DEST_UNSPECIFIED;
break;
}
}
static void sci_remote_node_context_validate_context_buffer(struct sci_remote_node_context *sci_rnc)
{
union scu_remote_node_context *rnc_buffer;
struct isci_remote_device *idev = rnc_to_dev(sci_rnc);
struct domain_device *dev = idev->domain_dev;
struct isci_host *ihost = idev->owning_port->owning_controller;
rnc_buffer = sci_rnc_by_id(ihost, sci_rnc->remote_node_index);
rnc_buffer->ssp.is_valid = true;
if (dev_is_sata(dev) && dev->parent) {
sci_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_96);
} else {
sci_remote_device_post_request(idev, SCU_CONTEXT_COMMAND_POST_RNC_32);
if (!dev->parent)
sci_port_setup_transports(idev->owning_port,
sci_rnc->remote_node_index);
}
}
static void sci_remote_node_context_invalidate_context_buffer(struct sci_remote_node_context *sci_rnc)
{
union scu_remote_node_context *rnc_buffer;
struct isci_remote_device *idev = rnc_to_dev(sci_rnc);
struct isci_host *ihost = idev->owning_port->owning_controller;
rnc_buffer = sci_rnc_by_id(ihost, sci_rnc->remote_node_index);
rnc_buffer->ssp.is_valid = false;
sci_remote_device_post_request(rnc_to_dev(sci_rnc),
SCU_CONTEXT_COMMAND_POST_RNC_INVALIDATE);
}
static void sci_remote_node_context_initial_state_enter(struct sci_base_state_machine *sm)
Annotation
- Immediate include surface: `scsi/sas_ata.h`, `host.h`, `isci.h`, `remote_device.h`, `remote_node_context.h`, `scu_event_codes.h`, `scu_task_context.h`.
- Detected declarations: `function sci_remote_node_context_is_ready`, `function sci_remote_node_context_is_suspended`, `function sci_remote_node_context_construct_buffer`, `function sci_remote_node_context_setup_to_resume`, `function sci_remote_node_context_setup_to_destroy`, `function sci_remote_node_context_notify_user`, `function sci_remote_node_context_continue_state_transitions`, `function sci_remote_node_context_validate_context_buffer`, `function sci_remote_node_context_invalidate_context_buffer`, `function sci_remote_node_context_initial_state_enter`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source implementation candidate.
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.