drivers/scsi/mpt3sas/mpt3sas_scsih.c
Source file repositories/reference/linux-study-clean/drivers/scsi/mpt3sas/mpt3sas_scsih.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/mpt3sas/mpt3sas_scsih.c- Extension
.c- Size
- 416495 bytes
- Lines
- 14183
- 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/module.hlinux/kernel.hlinux/init.hlinux/errno.hlinux/blkdev.hlinux/sched.hlinux/workqueue.hlinux/delay.hlinux/pci.hlinux/interrupt.hlinux/raid_class.hlinux/unaligned.hmpt3sas_base.h
Detected Declarations
struct sense_infostruct fw_event_workstruct _scsi_io_transferenum device_responsive_stateenum hba_port_matched_codesfunction fw_event_work_freefunction fw_event_work_getfunction fw_event_work_putfunction _scsih_set_debug_levelfunction _scsih_srch_boot_sas_addressfunction _scsih_srch_boot_device_namefunction _scsih_srch_boot_encl_slotfunction mpt3sas_get_port_by_idfunction list_for_each_entry_safefunction idfunction mpt3sas_get_vphy_by_phyfunction list_for_each_entry_safefunction _scsih_is_boot_devicefunction _scsih_get_sas_addressfunction _scsih_probe_boot_devicesfunction __mpt3sas_get_sdev_from_targetfunction mpt3sas_get_sdev_from_targetfunction __mpt3sas_get_pdev_from_targetfunction mpt3sas_get_pdev_from_targetfunction __mpt3sas_get_sdev_by_rphyfunction list_for_each_entryfunction __mpt3sas_get_sdev_by_addrfunction list_for_each_entryfunction list_for_each_entryfunction mpt3sas_get_sdev_by_addrfunction __mpt3sas_get_sdev_by_handlefunction mpt3sas_get_sdev_by_handlefunction _scsih_display_enclosure_chassis_infofunction _scsih_sas_device_removefunction _scsih_device_remove_by_handlefunction mpt3sas_device_remove_by_sas_addressfunction _scsih_sas_device_addfunction scsi_sysfs_add_sdevfunction _scsih_sas_device_init_addfunction __mpt3sas_get_pdev_by_wwidfunction mpt3sas_get_pdev_by_wwidfunction __mpt3sas_get_pdev_by_idchannelfunction __mpt3sas_get_pdev_by_handlefunction mpt3sas_get_pdev_by_handlefunction _scsih_set_nvme_max_shutdown_latencyfunction _scsih_pcie_device_removefunction _scsih_pcie_device_remove_by_handlefunction _scsih_pcie_device_add
Annotated Snippet
static struct pci_driver mpt3sas_driver = {
.name = MPT3SAS_DRIVER_NAME,
.id_table = mpt3sas_pci_table,
.probe = _scsih_probe,
.remove = scsih_remove,
.shutdown = scsih_shutdown,
.err_handler = &_mpt3sas_err_handler,
.driver.pm = &scsih_pm_ops,
};
/**
* scsih_init - main entry point for this driver.
*
* Return: 0 success, anything else error.
*/
static int
scsih_init(void)
{
mpt2_ids = 0;
mpt3_ids = 0;
mpt3sas_base_initialize_callback_handler();
/* queuecommand callback hander */
scsi_io_cb_idx = mpt3sas_base_register_callback_handler(_scsih_io_done);
/* task management callback handler */
tm_cb_idx = mpt3sas_base_register_callback_handler(_scsih_tm_done);
/* base internal commands callback handler */
base_cb_idx = mpt3sas_base_register_callback_handler(mpt3sas_base_done);
port_enable_cb_idx = mpt3sas_base_register_callback_handler(
mpt3sas_port_enable_done);
/* transport internal commands callback handler */
transport_cb_idx = mpt3sas_base_register_callback_handler(
mpt3sas_transport_done);
/* scsih internal commands callback handler */
scsih_cb_idx = mpt3sas_base_register_callback_handler(_scsih_done);
/* configuration page API internal commands callback handler */
config_cb_idx = mpt3sas_base_register_callback_handler(
mpt3sas_config_done);
/* ctl module callback handler */
ctl_cb_idx = mpt3sas_base_register_callback_handler(mpt3sas_ctl_done);
tm_tr_cb_idx = mpt3sas_base_register_callback_handler(
_scsih_tm_tr_complete);
tm_tr_volume_cb_idx = mpt3sas_base_register_callback_handler(
_scsih_tm_volume_tr_complete);
tm_sas_control_cb_idx = mpt3sas_base_register_callback_handler(
_scsih_sas_control_complete);
mpt3sas_init_debugfs();
return 0;
}
/**
* scsih_exit - exit point for this driver (when it is a module).
*
* Return: 0 success, anything else error.
*/
static void
scsih_exit(void)
{
mpt3sas_base_release_callback_handler(scsi_io_cb_idx);
mpt3sas_base_release_callback_handler(tm_cb_idx);
mpt3sas_base_release_callback_handler(base_cb_idx);
mpt3sas_base_release_callback_handler(port_enable_cb_idx);
mpt3sas_base_release_callback_handler(transport_cb_idx);
mpt3sas_base_release_callback_handler(scsih_cb_idx);
mpt3sas_base_release_callback_handler(config_cb_idx);
mpt3sas_base_release_callback_handler(ctl_cb_idx);
mpt3sas_base_release_callback_handler(tm_tr_cb_idx);
mpt3sas_base_release_callback_handler(tm_tr_volume_cb_idx);
mpt3sas_base_release_callback_handler(tm_sas_control_cb_idx);
/* raid transport support */
if (hbas_to_enumerate != 1)
raid_class_release(mpt3sas_raid_template);
if (hbas_to_enumerate != 2)
raid_class_release(mpt2sas_raid_template);
sas_release_transport(mpt3sas_transport_template);
mpt3sas_exit_debugfs();
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/errno.h`, `linux/blkdev.h`, `linux/sched.h`, `linux/workqueue.h`, `linux/delay.h`.
- Detected declarations: `struct sense_info`, `struct fw_event_work`, `struct _scsi_io_transfer`, `enum device_responsive_state`, `enum hba_port_matched_codes`, `function fw_event_work_free`, `function fw_event_work_get`, `function fw_event_work_put`, `function _scsih_set_debug_level`, `function _scsih_srch_boot_sas_address`.
- 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.