drivers/scsi/mpi3mr/mpi3mr_os.c
Source file repositories/reference/linux-study-clean/drivers/scsi/mpi3mr/mpi3mr_os.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/mpi3mr/mpi3mr_os.c- Extension
.c- Size
- 178999 bytes
- Lines
- 6154
- 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
mpi3mr.hlinux/idr.h
Detected Declarations
function mpi3mr_host_tag_for_scmdfunction scsi_host_find_tagfunction mpi3mr_clear_scmd_privfunction mpi3mr_fwevt_freefunction mpi3mr_fwevt_getfunction mpi3mr_fwevt_putfunction mpi3mr_fwevt_add_to_listfunction mpi3mr_hdb_trigger_data_eventfunction mpi3mr_fwevt_del_from_listfunction mpi3mr_cancel_workfunction mpi3mr_cleanup_fwevt_listfunction workfunction mpi3mr_queue_qd_reduction_eventfunction mpi3mr_invalidate_devhandlesfunction list_for_each_entryfunction mpi3mr_print_scmdfunction mpi3mr_flush_scmdfunction devicefunction mpi3mr_count_tgt_pendingfunction blk_mq_tagset_busy_iterfunction mpi3mr_flush_cmds_for_unrecovered_controllerfunction mpi3mr_tgtdev_add_to_listfunction mpi3mr_tgtdev_del_from_listfunction mpi3mr_set_io_divert_for_all_vd_in_tgfunction mpi3mr_print_device_event_noticefunction scsi_remove_targetfunction scsi_scan_targetfunction mpi3mr_change_queue_depthfunction mpi3mr_configure_nvme_devfunction mpi3mr_configure_tgt_devfunction mpi3mr_update_sdevfunction mpi3mr_refresh_tgtdevsfunction list_for_each_entry_safefunction mpi3mr_debug_dump_devpg0function mpi3mr_update_tgtdevfunction mpi3mr_devstatuschg_evt_bhfunction mpi3mr_devinfochg_evt_bhfunction mpi3mr_free_enclosure_listfunction list_for_each_entry_safefunction list_for_each_entryfunction mpi3mr_process_trigger_data_event_bhfunction mpi3mr_encldev_add_chg_evt_debugfunction mpi3mr_encldev_add_chg_evt_bhfunction mpi3mr_sastopochg_evt_debugfunction mpi3mr_sastopochg_evt_bhfunction mpi3mr_pcietopochg_evt_debugfunction mpi3mr_pcietopochg_evt_bhfunction mpi3mr_logdata_evt_bh
Annotated Snippet
static struct pci_driver mpi3mr_pci_driver = {
.name = MPI3MR_DRIVER_NAME,
.id_table = mpi3mr_pci_id_table,
.probe = mpi3mr_probe,
.remove = mpi3mr_remove,
.shutdown = mpi3mr_shutdown,
.err_handler = &mpi3mr_err_handler,
.driver = {
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.pm = &mpi3mr_pm_ops,
},
};
static ssize_t event_counter_show(struct device_driver *dd, char *buf)
{
return sprintf(buf, "%llu\n", atomic64_read(&event_counter));
}
static DRIVER_ATTR_RO(event_counter);
static int __init mpi3mr_init(void)
{
int ret_val;
pr_info("Loading %s version %s\n", MPI3MR_DRIVER_NAME,
MPI3MR_DRIVER_VERSION);
mpi3mr_transport_template =
sas_attach_transport(&mpi3mr_transport_functions);
if (!mpi3mr_transport_template) {
pr_err("%s failed to load due to sas transport attach failure\n",
MPI3MR_DRIVER_NAME);
return -ENODEV;
}
ret_val = pci_register_driver(&mpi3mr_pci_driver);
if (ret_val) {
pr_err("%s failed to load due to pci register driver failure\n",
MPI3MR_DRIVER_NAME);
goto err_pci_reg_fail;
}
ret_val = driver_create_file(&mpi3mr_pci_driver.driver,
&driver_attr_event_counter);
if (ret_val)
goto err_event_counter;
return ret_val;
err_event_counter:
pci_unregister_driver(&mpi3mr_pci_driver);
err_pci_reg_fail:
sas_release_transport(mpi3mr_transport_template);
return ret_val;
}
static void __exit mpi3mr_exit(void)
{
if (warn_non_secure_ctlr)
pr_warn(
"Unloading %s version %s while managing a non secure controller\n",
MPI3MR_DRIVER_NAME, MPI3MR_DRIVER_VERSION);
else
pr_info("Unloading %s version %s\n", MPI3MR_DRIVER_NAME,
MPI3MR_DRIVER_VERSION);
driver_remove_file(&mpi3mr_pci_driver.driver,
&driver_attr_event_counter);
pci_unregister_driver(&mpi3mr_pci_driver);
sas_release_transport(mpi3mr_transport_template);
ida_destroy(&mrioc_ida);
}
module_init(mpi3mr_init);
module_exit(mpi3mr_exit);
Annotation
- Immediate include surface: `mpi3mr.h`, `linux/idr.h`.
- Detected declarations: `function mpi3mr_host_tag_for_scmd`, `function scsi_host_find_tag`, `function mpi3mr_clear_scmd_priv`, `function mpi3mr_fwevt_free`, `function mpi3mr_fwevt_get`, `function mpi3mr_fwevt_put`, `function mpi3mr_fwevt_add_to_list`, `function mpi3mr_hdb_trigger_data_event`, `function mpi3mr_fwevt_del_from_list`, `function mpi3mr_cancel_work`.
- 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.