drivers/message/fusion/mptfc.c
Source file repositories/reference/linux-study-clean/drivers/message/fusion/mptfc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/message/fusion/mptfc.c- Extension
.c- Size
- 43490 bytes
- Lines
- 1586
- Domain
- Driver Families
- Bucket
- drivers/message
- 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/kdev_t.hlinux/blkdev.hlinux/delay.hlinux/interrupt.hlinux/reboot.hlinux/workqueue.hlinux/sort.hlinux/slab.hscsi/scsi.hscsi/scsi_cmnd.hscsi/scsi_device.hscsi/scsi_host.hscsi/scsi_tcq.hscsi/scsi_transport_fc.hmptbase.hmptscsih.h
Detected Declarations
function mptfc_block_error_handlerfunction mptfc_abortfunction mptfc_dev_resetfunction mptfc_bus_resetfunction list_for_each_entryfunction mptfc_set_rport_loss_tmofunction mptfc_FcDevPage0_cmp_funcfunction mptfc_GetFcDevPage0function mptfc_generate_rport_idsfunction mptfc_register_devfunction mptfc_target_destroyfunction mptfc_target_allocfunction mptfc_dump_lun_infofunction mptfc_sdev_initfunction mptfc_qcmdfunction mptfc_display_port_link_speedfunction mptfc_GetFcPortPage0function mptfc_WriteFcPortPage1function mptfc_GetFcPortPage1function mptfc_SetFcPortPage1_defaultsfunction mptfc_init_host_attrfunction mptfc_link_status_changefunction mptfc_setup_resetfunction mptfc_rescan_devicesfunction mptfc_probefunction mptfc_event_processfunction mptfc_ioc_resetfunction mptfc_initfunction mptfc_removefunction list_for_each_entry_safefunction mptfc_exitmodule init mptfc_init
Annotated Snippet
static struct pci_driver mptfc_driver = {
.name = "mptfc",
.id_table = mptfc_pci_table,
.probe = mptfc_probe,
.remove = mptfc_remove,
.shutdown = mptscsih_shutdown,
#ifdef CONFIG_PM
.suspend = mptscsih_suspend,
.resume = mptscsih_resume,
#endif
};
static int
mptfc_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
{
u8 event = le32_to_cpu(pEvReply->Event) & 0xFF;
unsigned long flags;
int rc=1;
if (ioc->bus_type != FC)
return 0;
devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n",
ioc->name, event));
if (ioc->sh == NULL || shost_priv(ioc->sh) == NULL)
return 1;
switch (event) {
case MPI_EVENT_RESCAN:
spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
if (ioc->fc_rescan_work_q) {
queue_work(ioc->fc_rescan_work_q,
&ioc->fc_rescan_work);
}
spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
break;
case MPI_EVENT_LINK_STATUS_CHANGE:
spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
if (ioc->fc_rescan_work_q) {
queue_work(ioc->fc_rescan_work_q,
&ioc->fc_lsc_work);
}
spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
break;
default:
rc = mptscsih_event_process(ioc,pEvReply);
break;
}
return rc;
}
static int
mptfc_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
{
int rc;
unsigned long flags;
rc = mptscsih_ioc_reset(ioc,reset_phase);
if ((ioc->bus_type != FC) || (!rc))
return rc;
dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
": IOC %s_reset routed to FC host driver!\n",ioc->name,
reset_phase==MPT_IOC_SETUP_RESET ? "setup" : (
reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post")));
if (reset_phase == MPT_IOC_SETUP_RESET) {
spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
if (ioc->fc_rescan_work_q) {
queue_work(ioc->fc_rescan_work_q,
&ioc->fc_setup_reset_work);
}
spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
}
else if (reset_phase == MPT_IOC_PRE_RESET) {
}
else { /* MPT_IOC_POST_RESET */
mptfc_SetFcPortPage1_defaults(ioc);
spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
if (ioc->fc_rescan_work_q) {
queue_work(ioc->fc_rescan_work_q,
&ioc->fc_rescan_work);
}
spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
}
return 1;
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/errno.h`, `linux/kdev_t.h`, `linux/blkdev.h`, `linux/delay.h`, `linux/interrupt.h`.
- Detected declarations: `function mptfc_block_error_handler`, `function mptfc_abort`, `function mptfc_dev_reset`, `function mptfc_bus_reset`, `function list_for_each_entry`, `function mptfc_set_rport_loss_tmo`, `function mptfc_FcDevPage0_cmp_func`, `function mptfc_GetFcDevPage0`, `function mptfc_generate_rport_ids`, `function mptfc_register_dev`.
- Atlas domain: Driver Families / drivers/message.
- 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.