drivers/scsi/megaraid/megaraid_sas_base.c
Source file repositories/reference/linux-study-clean/drivers/scsi/megaraid/megaraid_sas_base.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/megaraid/megaraid_sas_base.c- Extension
.c- Size
- 253794 bytes
- Lines
- 9146
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/kernel.hlinux/types.hlinux/pci.hlinux/list.hlinux/moduleparam.hlinux/module.hlinux/spinlock.hlinux/interrupt.hlinux/delay.hlinux/uio.hlinux/slab.hlinux/uaccess.hlinux/unaligned.hlinux/fs.hlinux/compat.hlinux/blkdev.hlinux/mutex.hlinux/poll.hlinux/vmalloc.hlinux/irq_poll.hscsi/scsi.hscsi/scsi_cmnd.hscsi/scsi_device.hscsi/scsi_host.hscsi/scsi_tcq.hscsi/scsi_dbg.hmegaraid_sas_fusion.hmegaraid_sas.h
Detected Declarations
function megasas_readlfunction megasas_set_dma_settingsfunction megasas_issue_dcmdfunction megasas_return_cmdfunction format_timestampfunction format_classfunction megasas_decode_evtfunction megasas_enable_intr_xscalefunction megasas_disable_intr_xscalefunction megasas_read_fw_status_reg_xscalefunction megasas_clear_intr_xscalefunction megasas_fire_cmd_xscalefunction megasas_adp_reset_xscalefunction megasas_check_reset_xscalefunction xscalefunction megasas_disable_intr_ppcfunction megasas_read_fw_status_reg_ppcfunction megasas_clear_intr_ppcfunction megasas_fire_cmd_ppcfunction megasas_check_reset_ppcfunction megasas_enable_intr_skinnyfunction megasas_disable_intr_skinnyfunction megasas_read_fw_status_reg_skinnyfunction megasas_clear_intr_skinnyfunction megasas_fire_cmd_skinnyfunction megasas_check_reset_skinnyfunction gen2function megasas_disable_intr_gen2function megasas_read_fw_status_reg_gen2function megasas_clear_intr_gen2function megasas_fire_cmd_gen2function megasas_adp_reset_gen2function megasas_check_reset_gen2function megasas_issue_polledfunction megasas_issue_blocked_cmdfunction comamndfunction megasas_make_sgl32function megasas_make_sgl64function megasas_make_sgl_skinnyfunction megasas_get_frame_countfunction megasas_build_dcdbfunction Framesfunction megasas_cmd_typefunction megasas_dump_pending_framesfunction megasas_build_and_issue_cmdfunction megasas_queue_commandfunction alignmentfunction as
Annotated Snippet
static const struct file_operations megasas_mgmt_fops = {
.owner = THIS_MODULE,
.open = megasas_mgmt_open,
.fasync = megasas_mgmt_fasync,
.unlocked_ioctl = megasas_mgmt_ioctl,
.poll = megasas_mgmt_poll,
#ifdef CONFIG_COMPAT
.compat_ioctl = megasas_mgmt_compat_ioctl,
#endif
.llseek = noop_llseek,
};
static SIMPLE_DEV_PM_OPS(megasas_pm_ops, megasas_suspend, megasas_resume);
/*
* PCI hotplug support registration structure
*/
static struct pci_driver megasas_pci_driver = {
.name = "megaraid_sas",
.id_table = megasas_pci_table,
.probe = megasas_probe_one,
.remove = megasas_detach_one,
.driver.pm = &megasas_pm_ops,
.shutdown = megasas_shutdown,
};
/*
* Sysfs driver attributes
*/
static ssize_t version_show(struct device_driver *dd, char *buf)
{
return snprintf(buf, strlen(MEGASAS_VERSION) + 2, "%s\n",
MEGASAS_VERSION);
}
static DRIVER_ATTR_RO(version);
static ssize_t release_date_show(struct device_driver *dd, char *buf)
{
return snprintf(buf, strlen(MEGASAS_RELDATE) + 2, "%s\n",
MEGASAS_RELDATE);
}
static DRIVER_ATTR_RO(release_date);
static ssize_t support_poll_for_event_show(struct device_driver *dd, char *buf)
{
return sprintf(buf, "%u\n", support_poll_for_event);
}
static DRIVER_ATTR_RO(support_poll_for_event);
static ssize_t support_device_change_show(struct device_driver *dd, char *buf)
{
return sprintf(buf, "%u\n", support_device_change);
}
static DRIVER_ATTR_RO(support_device_change);
static ssize_t dbg_lvl_show(struct device_driver *dd, char *buf)
{
return sprintf(buf, "%u\n", megasas_dbg_lvl);
}
static ssize_t dbg_lvl_store(struct device_driver *dd, const char *buf,
size_t count)
{
int retval = count;
if (sscanf(buf, "%u", &megasas_dbg_lvl) < 1) {
printk(KERN_ERR "megasas: could not set dbg_lvl\n");
retval = -EINVAL;
}
return retval;
}
static DRIVER_ATTR_RW(dbg_lvl);
static ssize_t
support_nvme_encapsulation_show(struct device_driver *dd, char *buf)
{
return sprintf(buf, "%u\n", support_nvme_encapsulation);
}
static DRIVER_ATTR_RO(support_nvme_encapsulation);
static ssize_t
support_pci_lane_margining_show(struct device_driver *dd, char *buf)
{
return sprintf(buf, "%u\n", support_pci_lane_margining);
}
static DRIVER_ATTR_RO(support_pci_lane_margining);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/types.h`, `linux/pci.h`, `linux/list.h`, `linux/moduleparam.h`, `linux/module.h`, `linux/spinlock.h`, `linux/interrupt.h`.
- Detected declarations: `function megasas_readl`, `function megasas_set_dma_settings`, `function megasas_issue_dcmd`, `function megasas_return_cmd`, `function format_timestamp`, `function format_class`, `function megasas_decode_evt`, `function megasas_enable_intr_xscale`, `function megasas_disable_intr_xscale`, `function megasas_read_fw_status_reg_xscale`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.