drivers/scsi/bfa/bfad.c
Source file repositories/reference/linux-study-clean/drivers/scsi/bfa/bfad.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/bfa/bfad.c- Extension
.c- Size
- 45717 bytes
- Lines
- 1777
- 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/kthread.hlinux/errno.hlinux/sched.hlinux/init.hlinux/fs.hlinux/pci.hlinux/firmware.hlinux/uaccess.hasm/fcntl.hbfad_drv.hbfad_im.hbfa_fcs.hbfa_defs.hbfa.h
Detected Declarations
function bfad_sm_uninitfunction bfad_sm_createdfunction bfad_sm_initializingfunction bfad_sm_failedfunction bfad_sm_operationalfunction bfad_sm_fcs_exitfunction bfad_sm_stoppingfunction bfad_hcb_compfunction bfa_cb_initfunction bfa_fcb_lport_newfunction bfa_fcb_rport_allocfunction bfa_fcb_pbc_vport_createfunction bfad_hal_mem_releasefunction bfad_update_hal_cfgfunction bfad_hal_mem_allocfunction bfad_vport_createfunction bfad_bfa_tmofunction bfad_init_timerfunction bfad_pci_initfunction bfad_pci_uninitfunction bfad_drv_initfunction bfad_drv_startfunction bfad_fcs_stopfunction bfad_stopfunction bfad_cfg_pportfunction bfad_uncfg_pportfunction bfad_start_opsfunction bfad_workerfunction bfad_intxfunction bfad_msixfunction bfad_init_msix_entryfunction bfad_install_msix_handlerfunction bfad_setup_intrfunction bfad_remove_intrfunction bfad_pci_probefunction bfad_pci_removefunction bfad_pci_error_detectedfunction restart_bfafunction bfad_pci_slot_resetfunction bfad_pci_mmio_enabledfunction bfad_pci_resumefunction bfad_initfunction bfad_exitfunction bfad_read_firmwarefunction bfad_load_fwimgfunction bfad_free_fwimgmodule init bfad_init
Annotated Snippet
static struct pci_driver bfad_pci_driver = {
.name = BFAD_DRIVER_NAME,
.id_table = bfad_id_table,
.probe = bfad_pci_probe,
.remove = bfad_pci_remove,
.err_handler = &bfad_err_handler,
};
/*
* Driver module init.
*/
static int __init
bfad_init(void)
{
int error = 0;
pr_info("QLogic BR-series BFA FC/FCOE SCSI driver - version: %s\n",
BFAD_DRIVER_VERSION);
if (num_sgpgs > 0)
num_sgpgs_parm = num_sgpgs;
error = bfad_im_module_init();
if (error) {
printk(KERN_WARNING "bfad_im_module_init failure\n");
return -ENOMEM;
}
if (strcmp(FCPI_NAME, " fcpim") == 0)
supported_fc4s |= BFA_LPORT_ROLE_FCP_IM;
bfa_auto_recover = ioc_auto_recover;
bfa_fcs_rport_set_del_timeout(rport_del_timeout);
bfa_fcs_rport_set_max_logins(max_rport_logins);
error = pci_register_driver(&bfad_pci_driver);
if (error) {
printk(KERN_WARNING "pci_register_driver failure\n");
goto ext;
}
return 0;
ext:
bfad_im_module_exit();
return error;
}
/*
* Driver module exit.
*/
static void __exit
bfad_exit(void)
{
pci_unregister_driver(&bfad_pci_driver);
bfad_im_module_exit();
bfad_free_fwimg();
}
/* Firmware handling */
static void
bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
u32 *bfi_image_size, char *fw_name)
{
const struct firmware *fw;
if (request_firmware(&fw, fw_name, &pdev->dev)) {
printk(KERN_ALERT "Can't locate firmware %s\n", fw_name);
*bfi_image = NULL;
goto out;
}
*bfi_image = vmalloc(fw->size);
if (NULL == *bfi_image) {
printk(KERN_ALERT "Fail to allocate buffer for fw image "
"size=%x!\n", (u32) fw->size);
goto out;
}
memcpy(*bfi_image, fw->data, fw->size);
*bfi_image_size = fw->size/sizeof(u32);
out:
release_firmware(fw);
}
static u32 *
bfad_load_fwimg(struct pci_dev *pdev)
{
if (bfa_asic_id_ct2(pdev->device)) {
if (bfi_image_ct2_size == 0)
Annotation
- Immediate include surface: `linux/module.h`, `linux/kthread.h`, `linux/errno.h`, `linux/sched.h`, `linux/init.h`, `linux/fs.h`, `linux/pci.h`, `linux/firmware.h`.
- Detected declarations: `function bfad_sm_uninit`, `function bfad_sm_created`, `function bfad_sm_initializing`, `function bfad_sm_failed`, `function bfad_sm_operational`, `function bfad_sm_fcs_exit`, `function bfad_sm_stopping`, `function bfad_hcb_comp`, `function bfa_cb_init`, `function bfa_fcb_lport_new`.
- 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.