drivers/scsi/lpfc/lpfc_init.c
Source file repositories/reference/linux-study-clean/drivers/scsi/lpfc/lpfc_init.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/lpfc/lpfc_init.c- Extension
.c- Size
- 470199 bytes
- Lines
- 15821
- 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/blkdev.hlinux/crc32.hlinux/delay.hlinux/dma-mapping.hlinux/idr.hlinux/interrupt.hlinux/module.hlinux/kthread.hlinux/pci.hlinux/spinlock.hlinux/sched/clock.hlinux/ctype.hlinux/slab.hlinux/firmware.hlinux/miscdevice.hlinux/percpu.hlinux/irq.hlinux/bitops.hlinux/crash_dump.hlinux/cpu.hlinux/cpuhotplug.hscsi/scsi.hscsi/scsi_device.hscsi/scsi_host.hscsi/scsi_transport_fc.hscsi/scsi_tcq.hscsi/fc/fc_fs.hlpfc_hw4.hlpfc_hw.hlpfc_sli.hlpfc_sli4.hlpfc_nl.h
Detected Declarations
function Datafunction lpfc_config_async_cmplfunction lpfc_dump_wakeup_param_cmplfunction lpfc_update_vport_wwnfunction memcmpfunction lpfc_config_port_postfunction lpfc_sli4_refresh_paramsfunction lpfc_hba_init_linkfunction lpfc_hba_init_link_fc_topologyfunction lpfc_hba_down_linkfunction lpfc_hba_down_prepfunction lpfc_sli4_free_sp_eventsfunction lpfc_hba_free_post_buffunction list_for_each_entry_safefunction lpfc_hba_clean_txcmplqfunction lpfc_hba_down_post_s3function lpfc_hba_down_post_s4function list_for_each_entry_safefunction list_for_each_entry_safefunction lpfc_hba_down_postfunction lpfc_hb_timeoutfunction lpfc_rrq_timeoutfunction LPFC_HB_MBOX_INTERVALfunction lpfc_idle_stat_delay_workfunction for_each_present_cpufunction lpfc_hb_eq_delay_workfunction for_each_present_cpufunction list_for_each_entry_safefunction lpfc_hb_mxp_handlerfunction lpfc_issue_hb_mboxfunction timerfunction windowfunction lpfc_offline_erattfunction lpfc_sli4_offline_erattfunction test_bitfunction lpfc_handle_deferred_erattfunction lpfc_board_errevt_to_mgmtfunction lpfc_handle_eratt_s3function registerfunction lpfc_handle_eratt_s4function lpfc_handle_erattfunction lpfc_handle_lattfunction lpfc_fill_vpdfunction Datafunction lpfc_get_atto_model_descfunction lpfc_get_hba_model_descfunction lpfc_sli3_post_bufferfunction lpfc_post_rcv_buf
Annotated Snippet
static struct pci_driver lpfc_driver = {
.name = LPFC_DRIVER_NAME,
.id_table = lpfc_id_table,
.probe = lpfc_pci_probe_one,
.remove = lpfc_pci_remove_one,
.shutdown = lpfc_pci_remove_one,
.driver.pm = &lpfc_pci_pm_ops_one,
.err_handler = &lpfc_err_handler,
};
static const struct file_operations lpfc_mgmt_fop = {
.owner = THIS_MODULE,
};
static struct miscdevice lpfc_mgmt_dev = {
.minor = MISC_DYNAMIC_MINOR,
.name = "lpfcmgmt",
.fops = &lpfc_mgmt_fop,
};
/**
* lpfc_init - lpfc module initialization routine
*
* This routine is to be invoked when the lpfc module is loaded into the
* kernel. The special kernel macro module_init() is used to indicate the
* role of this routine to the kernel as lpfc module entry point.
*
* Return codes
* 0 - successful
* -ENOMEM - FC attach transport failed
* all others - failed
*/
static int __init
lpfc_init(void)
{
int error = 0;
pr_info(LPFC_MODULE_DESC "\n");
pr_info(LPFC_COPYRIGHT "\n");
error = misc_register(&lpfc_mgmt_dev);
if (error)
printk(KERN_ERR "Could not register lpfcmgmt device, "
"misc_register returned with status %d", error);
error = -ENOMEM;
lpfc_transport_functions.vport_create = lpfc_vport_create;
lpfc_transport_functions.vport_delete = lpfc_vport_delete;
lpfc_transport_template =
fc_attach_transport(&lpfc_transport_functions);
if (lpfc_transport_template == NULL)
goto unregister;
lpfc_vport_transport_template =
fc_attach_transport(&lpfc_vport_transport_functions);
if (lpfc_vport_transport_template == NULL) {
fc_release_transport(lpfc_transport_template);
goto unregister;
}
lpfc_wqe_cmd_template();
lpfc_nvmet_cmd_template();
/* Initialize in case vector mapping is needed */
lpfc_present_cpu = num_present_cpus();
lpfc_pldv_detect = false;
error = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN,
"lpfc/sli4:online",
lpfc_cpu_online, lpfc_cpu_offline);
if (error < 0)
goto cpuhp_failure;
lpfc_cpuhp_state = error;
error = pci_register_driver(&lpfc_driver);
if (error)
goto unwind;
return error;
unwind:
cpuhp_remove_multi_state(lpfc_cpuhp_state);
cpuhp_failure:
fc_release_transport(lpfc_transport_template);
fc_release_transport(lpfc_vport_transport_template);
unregister:
misc_deregister(&lpfc_mgmt_dev);
return error;
}
Annotation
- Immediate include surface: `linux/blkdev.h`, `linux/crc32.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/idr.h`, `linux/interrupt.h`, `linux/module.h`, `linux/kthread.h`.
- Detected declarations: `function Data`, `function lpfc_config_async_cmpl`, `function lpfc_dump_wakeup_param_cmpl`, `function lpfc_update_vport_wwn`, `function memcmp`, `function lpfc_config_port_post`, `function lpfc_sli4_refresh_params`, `function lpfc_hba_init_link`, `function lpfc_hba_init_link_fc_topology`, `function lpfc_hba_down_link`.
- 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.