drivers/scsi/qla2xxx/qla_mr.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qla2xxx/qla_mr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qla2xxx/qla_mr.c- Extension
.c- Size
- 90767 bytes
- Lines
- 3406
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
qla_def.hlinux/delay.hlinux/ktime.hlinux/pci.hlinux/ratelimit.hlinux/vmalloc.hscsi/scsi_tcq.hlinux/utsname.h
Detected Declarations
function Copyrightfunction qlafx00_driver_shutdownfunction qlafx00_get_firmware_statefunction qlafx00_init_firmwarefunction qlafx00_mbx_reg_testfunction qlafx00_pci_configfunction qlafx00_soc_cpu_resetfunction qlafx00_soft_resetfunction qlafx00_chip_diagfunction qlafx00_config_ringsfunction qlafx00_pci_info_strfunction qlafx00_fw_version_strfunction qlafx00_enable_intrsfunction qlafx00_disable_intrsfunction qlafx00_abort_targetfunction qlafx00_lun_resetfunction qlafx00_iospace_configfunction qlafx00_save_queue_ptrsfunction qlafx00_config_queuesfunction qlafx00_init_fw_readyfunction qlafx00_fw_readyfunction qlafx00_find_all_targetsfunction for_each_set_bitfunction list_for_each_entryfunction qlafx00_configure_all_targetsfunction qlafx00_configure_devicesfunction qlafx00_abort_isp_cleanupfunction qlafx00_init_response_q_entriesfunction qlafx00_rescan_ispfunction qlafx00_timer_routinefunction qlafx00_reset_initializefunction qlafx00_abort_ispfunction qlafx00_get_fcportfunction qlafx00_tgt_detachfunction qlafx00_process_aenfunction qlafx00_update_host_attrfunction qla2x00_fxdisc_iocb_timeoutfunction qla2x00_fxdisc_sp_donefunction qlafx00_fx_discfunction qlafx00_initialize_adapterfunction qlafx00_fw_state_showfunction qlafx00_get_host_speedfunction qlafx00_handle_sensefunction qlafx00_tm_iocb_entryfunction qlafx00_abort_iocb_entryfunction qlafx00_ioctl_iosb_entryfunction qlafx00_status_entryfunction cpu_to_le16
Annotated Snippet
while (!ha->flags.mbox_int) {
if (time_after(jiffies, wait_time))
break;
/* Check for pending interrupts. */
qla2x00_poll(ha->rsp_q_map[0]);
if (!ha->flags.mbox_int &&
!(IS_QLA2200(ha) &&
command == MBC_LOAD_RISC_RAM_EXTENDED))
usleep_range(10000, 11000);
} /* while */
ql_dbg(ql_dbg_mbx, vha, 0x112d,
"Waited %d sec.\n",
(uint)((jiffies - (wait_time - (mcp->tov * HZ)))/HZ));
}
/* Check whether we timed out */
if (ha->flags.mbox_int) {
uint32_t *iptr2;
ql_dbg(ql_dbg_mbx, vha, 0x112e,
"Cmd=%x completed.\n", command);
/* Got interrupt. Clear the flag. */
ha->flags.mbox_int = 0;
clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
if (ha->mailbox_out32[0] != MBS_COMMAND_COMPLETE)
rval = QLA_FUNCTION_FAILED;
/* Load return mailbox registers. */
iptr2 = mcp->mb;
iptr = (uint32_t *)&ha->mailbox_out32[0];
mboxes = mcp->in_mb;
for (cnt = 0; cnt < ha->mbx_count; cnt++) {
if (mboxes & BIT_0)
*iptr2 = *iptr;
mboxes >>= 1;
iptr2++;
iptr++;
}
} else {
rval = QLA_FUNCTION_TIMEOUT;
}
ha->flags.mbox_busy = 0;
/* Clean up */
ha->mcp32 = NULL;
if ((abort_active || !io_lock_on) && !IS_NOPOLLING_TYPE(ha)) {
ql_dbg(ql_dbg_mbx, vha, 0x113a,
"checking for additional resp interrupt.\n");
/* polling mode for non isp_abort commands. */
qla2x00_poll(ha->rsp_q_map[0]);
}
if (rval == QLA_FUNCTION_TIMEOUT &&
mcp->mb[0] != MBC_GEN_SYSTEM_ERROR) {
if (!io_lock_on || (mcp->flags & IOCTL_CMD) ||
ha->flags.eeh_busy) {
/* not in dpc. schedule it for dpc to take over. */
ql_dbg(ql_dbg_mbx, vha, 0x115d,
"Timeout, schedule isp_abort_needed.\n");
if (!test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) &&
!test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) &&
!test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
ql_log(ql_log_info, base_vha, 0x115e,
"Mailbox cmd timeout occurred, cmd=0x%x, "
"mb[0]=0x%x, eeh_busy=0x%x. Scheduling ISP "
"abort.\n", command, mcp->mb[0],
ha->flags.eeh_busy);
set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
qla2xxx_wake_dpc(vha);
}
} else if (!abort_active) {
/* call abort directly since we are in the DPC thread */
ql_dbg(ql_dbg_mbx, vha, 0x1160,
"Timeout, calling abort_isp.\n");
if (!test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) &&
!test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) &&
!test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
Annotation
- Immediate include surface: `qla_def.h`, `linux/delay.h`, `linux/ktime.h`, `linux/pci.h`, `linux/ratelimit.h`, `linux/vmalloc.h`, `scsi/scsi_tcq.h`, `linux/utsname.h`.
- Detected declarations: `function Copyright`, `function qlafx00_driver_shutdown`, `function qlafx00_get_firmware_state`, `function qlafx00_init_firmware`, `function qlafx00_mbx_reg_test`, `function qlafx00_pci_config`, `function qlafx00_soc_cpu_reset`, `function qlafx00_soft_reset`, `function qlafx00_chip_diag`, `function qlafx00_config_rings`.
- 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.