drivers/scsi/ipr.c
Source file repositories/reference/linux-study-clean/drivers/scsi/ipr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/ipr.c- Extension
.c- Size
- 287753 bytes
- Lines
- 10097
- Domain
- Driver Families
- Bucket
- drivers/scsi
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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
linux/fs.hlinux/init.hlinux/types.hlinux/errno.hlinux/kernel.hlinux/slab.hlinux/vmalloc.hlinux/ioport.hlinux/delay.hlinux/pci.hlinux/wait.hlinux/spinlock.hlinux/sched.hlinux/interrupt.hlinux/blkdev.hlinux/firmware.hlinux/module.hlinux/moduleparam.hlinux/hdreg.hlinux/reboot.hlinux/stringify.hlinux/irq.hasm/io.hasm/processor.hscsi/scsi.hscsi/scsi_host.hscsi/scsi_tcq.hscsi/scsi_eh.hscsi/scsi_cmnd.hipr.h
Detected Declarations
function ipr_trc_hookfunction ipr_lock_and_donefunction ipr_reinit_ipr_cmndfunction ipr_init_ipr_cmndfunction ipr_mask_and_clear_interruptsfunction ipr_save_pcix_cmd_regfunction ipr_set_pcix_cmd_regfunction __ipr_scsi_eh_donefunction ipr_scsi_eh_donefunction ipr_fail_all_opsfunction list_for_each_entry_safefunction ipr_send_commandfunction ipr_do_reqfunction ipr_internal_cmd_donefunction ipr_init_ioadlfunction ipr_send_blocking_cmdfunction ipr_get_hrrq_indexfunction ipr_send_hcamfunction ipr_init_res_entryfunction ipr_is_same_devicefunction ipr_update_res_entryfunction ipr_clear_res_targetfunction ipr_handle_config_changefunction list_for_each_entryfunction ipr_process_ccnfunction strip_whitespacefunction ipr_log_vpd_compactfunction ipr_log_vpdfunction ipr_log_ext_vpd_compactfunction ipr_log_ext_vpdfunction ipr_log_enhanced_cache_errorfunction ipr_log_cache_errorfunction ipr_log_enhanced_config_errorfunction ipr_log_sis64_config_errorfunction ipr_log_config_errorfunction ipr_log_enhanced_array_errorfunction ipr_log_array_errorfunction ipr_log_hex_datafunction ipr_log_enhanced_dual_ioa_errorfunction ipr_log_dual_ioa_errorfunction ipr_log_fabric_pathfunction ipr_log64_fabric_pathfunction ipr_log_path_elemfunction ipr_log64_path_elemfunction ipr_log_fabric_errorfunction ipr_log_sis64_array_errorfunction ipr_log_sis64_fabric_errorfunction ipr_log_sis64_service_required_error
Annotated Snippet
static struct pci_driver ipr_driver = {
.name = IPR_NAME,
.id_table = ipr_pci_table,
.probe = ipr_probe,
.remove = ipr_remove,
.shutdown = ipr_shutdown,
.err_handler = &ipr_err_handler,
};
/**
* ipr_halt_done - Shutdown prepare completion
* @ipr_cmd: ipr command struct
*
* Return value:
* none
**/
static void ipr_halt_done(struct ipr_cmnd *ipr_cmd)
{
list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q);
}
/**
* ipr_halt - Issue shutdown prepare to all adapters
* @nb: Notifier block
* @event: Notifier event
* @buf: Notifier data (unused)
*
* Return value:
* NOTIFY_OK on success / NOTIFY_DONE on failure
**/
static int ipr_halt(struct notifier_block *nb, ulong event, void *buf)
{
struct ipr_cmnd *ipr_cmd;
struct ipr_ioa_cfg *ioa_cfg;
unsigned long flags = 0, driver_lock_flags;
if (event != SYS_RESTART && event != SYS_HALT && event != SYS_POWER_OFF)
return NOTIFY_DONE;
spin_lock_irqsave(&ipr_driver_lock, driver_lock_flags);
list_for_each_entry(ioa_cfg, &ipr_ioa_head, queue) {
spin_lock_irqsave(ioa_cfg->host->host_lock, flags);
if (!ioa_cfg->hrrq[IPR_INIT_HRRQ].allow_cmds ||
(ipr_fast_reboot && event == SYS_RESTART && ioa_cfg->sis64)) {
spin_unlock_irqrestore(ioa_cfg->host->host_lock, flags);
continue;
}
ipr_cmd = ipr_get_free_ipr_cmnd(ioa_cfg);
ipr_cmd->ioarcb.res_handle = cpu_to_be32(IPR_IOA_RES_HANDLE);
ipr_cmd->ioarcb.cmd_pkt.request_type = IPR_RQTYPE_IOACMD;
ipr_cmd->ioarcb.cmd_pkt.cdb[0] = IPR_IOA_SHUTDOWN;
ipr_cmd->ioarcb.cmd_pkt.cdb[1] = IPR_SHUTDOWN_PREPARE_FOR_NORMAL;
ipr_do_req(ipr_cmd, ipr_halt_done, ipr_timeout, IPR_DEVICE_RESET_TIMEOUT);
spin_unlock_irqrestore(ioa_cfg->host->host_lock, flags);
}
spin_unlock_irqrestore(&ipr_driver_lock, driver_lock_flags);
return NOTIFY_OK;
}
static struct notifier_block ipr_notifier = {
ipr_halt, NULL, 0
};
/**
* ipr_init - Module entry point
*
* Return value:
* 0 on success / negative value on failure
**/
static int __init ipr_init(void)
{
int rc;
ipr_info("IBM Power RAID SCSI Device Driver version: %s %s\n",
IPR_DRIVER_VERSION, IPR_DRIVER_DATE);
register_reboot_notifier(&ipr_notifier);
rc = pci_register_driver(&ipr_driver);
if (rc) {
unregister_reboot_notifier(&ipr_notifier);
return rc;
}
return 0;
}
Annotation
- Immediate include surface: `linux/fs.h`, `linux/init.h`, `linux/types.h`, `linux/errno.h`, `linux/kernel.h`, `linux/slab.h`, `linux/vmalloc.h`, `linux/ioport.h`.
- Detected declarations: `function ipr_trc_hook`, `function ipr_lock_and_done`, `function ipr_reinit_ipr_cmnd`, `function ipr_init_ipr_cmnd`, `function ipr_mask_and_clear_interrupts`, `function ipr_save_pcix_cmd_reg`, `function ipr_set_pcix_cmd_reg`, `function __ipr_scsi_eh_done`, `function ipr_scsi_eh_done`, `function ipr_fail_all_ops`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: pattern 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.