drivers/scsi/isci/request.c
Source file repositories/reference/linux-study-clean/drivers/scsi/isci/request.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/isci/request.c- Extension
.c- Size
- 104831 bytes
- Lines
- 3517
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
scsi/scsi_cmnd.hisci.htask.hrequest.hscu_completion_codes.hscu_event_codes.hsas.h
Detected Declarations
function to_sgl_element_pair_dmafunction init_sgl_elementfunction sci_request_build_sglfunction sci_io_request_build_ssp_command_iufunction sci_task_request_build_ssp_task_iufunction scu_ssp_request_construct_task_contextfunction scu_bg_blk_sizefunction scu_dif_bytesfunction scu_ssp_ireq_dif_insertfunction scu_ssp_ireq_dif_stripfunction scu_ssp_io_request_construct_task_contextfunction scu_ssp_task_request_construct_task_contextfunction scu_sata_request_construct_task_contextfunction scu_stp_raw_request_construct_task_contextfunction sci_stp_pio_request_constructfunction sci_stp_optimized_request_constructfunction sci_atapi_constructfunction sci_io_request_construct_satafunction sci_io_request_construct_basic_sspfunction sci_task_request_construct_sspfunction sci_io_request_construct_basic_satafunction sci_req_tx_bytesfunction sci_request_startfunction sci_io_request_terminatefunction sci_request_completefunction sci_io_request_event_handlerfunction sci_io_request_copy_responsefunction request_started_state_tc_eventfunction SCU_MAKE_COMPLETION_STATUSfunction request_aborting_state_tc_eventfunction ssp_task_request_await_tc_eventfunction smp_request_await_response_tc_eventfunction smp_request_await_tc_eventfunction stp_request_non_data_await_h2d_tc_eventfunction sci_stp_request_pio_data_out_trasmit_data_framefunction sci_stp_request_pio_data_out_transmit_datafunction sci_stp_request_pio_data_in_copy_data_bufferfunction sci_stp_request_pio_data_in_copy_datafunction stp_request_pio_await_h2d_completion_tc_eventfunction pio_data_out_tx_done_tc_eventfunction sci_stp_request_udma_general_frame_handlerfunction process_unsolicited_fisfunction atapi_d2h_reg_frame_handlerfunction scu_atapi_reconstruct_raw_frame_task_contextfunction scu_atapi_construct_task_contextfunction sci_io_request_frame_handlerfunction stp_request_udma_await_tc_eventfunction SCU_MAKE_COMPLETION_STATUS
Annotated Snippet
while (sg) {
scu_sg = to_sgl_element_pair(ireq, sg_idx);
init_sgl_element(&scu_sg->A, sg);
sg = sg_next(sg);
if (sg) {
init_sgl_element(&scu_sg->B, sg);
sg = sg_next(sg);
} else
memset(&scu_sg->B, 0, sizeof(scu_sg->B));
if (prev_sg) {
dma_addr = to_sgl_element_pair_dma(ihost,
ireq,
sg_idx);
prev_sg->next_pair_upper =
upper_32_bits(dma_addr);
prev_sg->next_pair_lower =
lower_32_bits(dma_addr);
}
prev_sg = scu_sg;
sg_idx++;
}
} else { /* handle when no sg */
scu_sg = to_sgl_element_pair(ireq, sg_idx);
dma_addr = dma_map_single(&ihost->pdev->dev,
task->scatter,
task->total_xfer_len,
task->data_dir);
ireq->zero_scatter_daddr = dma_addr;
scu_sg->A.length = task->total_xfer_len;
scu_sg->A.address_upper = upper_32_bits(dma_addr);
scu_sg->A.address_lower = lower_32_bits(dma_addr);
}
if (scu_sg) {
scu_sg->next_pair_upper = 0;
scu_sg->next_pair_lower = 0;
}
}
static void sci_io_request_build_ssp_command_iu(struct isci_request *ireq)
{
struct ssp_cmd_iu *cmd_iu;
struct sas_task *task = isci_request_access_task(ireq);
cmd_iu = &ireq->ssp.cmd;
memcpy(cmd_iu->LUN, task->ssp_task.LUN, 8);
cmd_iu->add_cdb_len = 0;
cmd_iu->_r_a = 0;
cmd_iu->_r_b = 0;
cmd_iu->en_fburst = 0; /* unsupported */
cmd_iu->task_prio = 0;
cmd_iu->task_attr = task->ssp_task.task_attr;
cmd_iu->_r_c = 0;
sci_swab32_cpy(&cmd_iu->cdb, task->ssp_task.cmd->cmnd,
(task->ssp_task.cmd->cmd_len+3) / sizeof(u32));
}
static void sci_task_request_build_ssp_task_iu(struct isci_request *ireq)
{
struct ssp_task_iu *task_iu;
struct sas_task *task = isci_request_access_task(ireq);
struct isci_tmf *isci_tmf = isci_request_access_tmf(ireq);
task_iu = &ireq->ssp.tmf;
memset(task_iu, 0, sizeof(struct ssp_task_iu));
memcpy(task_iu->LUN, task->ssp_task.LUN, 8);
task_iu->task_func = isci_tmf->tmf_code;
task_iu->task_tag =
(test_bit(IREQ_TMF, &ireq->flags)) ?
isci_tmf->io_tag :
SCI_CONTROLLER_INVALID_IO_TAG;
}
/*
* This method is will fill in the SCU Task Context for any type of SSP request.
*/
static void scu_ssp_request_construct_task_context(
struct isci_request *ireq,
struct scu_task_context *task_context)
Annotation
- Immediate include surface: `scsi/scsi_cmnd.h`, `isci.h`, `task.h`, `request.h`, `scu_completion_codes.h`, `scu_event_codes.h`, `sas.h`.
- Detected declarations: `function to_sgl_element_pair_dma`, `function init_sgl_element`, `function sci_request_build_sgl`, `function sci_io_request_build_ssp_command_iu`, `function sci_task_request_build_ssp_task_iu`, `function scu_ssp_request_construct_task_context`, `function scu_bg_blk_size`, `function scu_dif_bytes`, `function scu_ssp_ireq_dif_insert`, `function scu_ssp_ireq_dif_strip`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.