drivers/scsi/csiostor/csio_init.c
Source file repositories/reference/linux-study-clean/drivers/scsi/csiostor/csio_init.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/csiostor/csio_init.c- Extension
.c- Size
- 29314 bytes
- Lines
- 1254
- 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/module.hlinux/init.hlinux/pci.hlinux/mm.hlinux/notifier.hlinux/kdebug.hlinux/seq_file.hlinux/debugfs.hlinux/string.hlinux/export.hcsio_init.hcsio_defs.ht4_pci_id_tbl.h
Detected Declarations
function csio_mem_readfunction csio_add_debugfs_memfunction csio_setup_debugfsfunction csio_dfs_createfunction csio_dfs_destroyfunction csio_dfs_initfunction csio_dfs_exitfunction csio_pci_initfunction csio_pci_exitfunction csio_hw_init_workersfunction csio_hw_exit_workersfunction csio_create_queuesfunction csio_config_queuesfunction csio_resource_allocfunction csio_resource_freefunction csio_hw_freefunction csio_shost_initfunction csio_shost_exitfunction csio_lnode_allocfunction csio_lnodes_block_requestfunction csio_lnodes_unblock_requestfunction csio_lnodes_block_by_portfunction csio_lnodes_unblock_by_portfunction csio_lnodes_exitfunction csio_lnode_init_postfunction csio_probe_onefunction csio_remove_onefunction csio_pci_error_detectedfunction csio_pci_slot_resetfunction csio_pci_resumefunction csio_initfunction csio_exitmodule init csio_init
Annotated Snippet
static const struct file_operations csio_mem_debugfs_fops = {
.owner = THIS_MODULE,
.open = simple_open,
.read = csio_mem_read,
.llseek = default_llseek,
};
void csio_add_debugfs_mem(struct csio_hw *hw, const char *name,
unsigned int idx, unsigned int size_mb)
{
debugfs_create_file_size(name, S_IRUSR, hw->debugfs_root,
(void *)hw + idx, &csio_mem_debugfs_fops,
size_mb << 20);
}
static int csio_setup_debugfs(struct csio_hw *hw)
{
int i;
if (IS_ERR_OR_NULL(hw->debugfs_root))
return -1;
i = csio_rd_reg32(hw, MA_TARGET_MEM_ENABLE_A);
if (i & EDRAM0_ENABLE_F)
csio_add_debugfs_mem(hw, "edc0", MEM_EDC0, 5);
if (i & EDRAM1_ENABLE_F)
csio_add_debugfs_mem(hw, "edc1", MEM_EDC1, 5);
hw->chip_ops->chip_dfs_create_ext_mem(hw);
return 0;
}
/*
* csio_dfs_create - Creates and sets up per-hw debugfs.
*
*/
static int
csio_dfs_create(struct csio_hw *hw)
{
if (csio_debugfs_root) {
hw->debugfs_root = debugfs_create_dir(pci_name(hw->pdev),
csio_debugfs_root);
csio_setup_debugfs(hw);
}
return 0;
}
/*
* csio_dfs_destroy - Destroys per-hw debugfs.
*/
static void
csio_dfs_destroy(struct csio_hw *hw)
{
debugfs_remove_recursive(hw->debugfs_root);
}
/*
* csio_dfs_init - Debug filesystem initialization for the module.
*
*/
static void
csio_dfs_init(void)
{
csio_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
}
/*
* csio_dfs_exit - debugfs cleanup for the module.
*/
static void
csio_dfs_exit(void)
{
debugfs_remove(csio_debugfs_root);
}
/*
* csio_pci_init - PCI initialization.
* @pdev: PCI device.
* @bars: Bitmask of bars to be requested.
*
* Initializes the PCI function by enabling MMIO, setting bus
* mastership and setting DMA mask.
*/
static int
csio_pci_init(struct pci_dev *pdev, int *bars)
{
int rv = -ENODEV;
*bars = pci_select_bars(pdev, IORESOURCE_MEM);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/init.h`, `linux/pci.h`, `linux/mm.h`, `linux/notifier.h`, `linux/kdebug.h`, `linux/seq_file.h`.
- Detected declarations: `function csio_mem_read`, `function csio_add_debugfs_mem`, `function csio_setup_debugfs`, `function csio_dfs_create`, `function csio_dfs_destroy`, `function csio_dfs_init`, `function csio_dfs_exit`, `function csio_pci_init`, `function csio_pci_exit`, `function csio_hw_init_workers`.
- 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.