drivers/edac/i5100_edac.c
Source file repositories/reference/linux-study-clean/drivers/edac/i5100_edac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/edac/i5100_edac.c- Extension
.c- Size
- 30954 bytes
- Lines
- 1241
- Domain
- Driver Families
- Bucket
- drivers/edac
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/init.hlinux/pci.hlinux/pci_ids.hlinux/edac.hlinux/delay.hlinux/mmzone.hlinux/debugfs.hedac_module.h
Detected Declarations
struct i5100_privfunction Hubfunction i5100_mc_errdetenfunction i5100_mc_scrbdonefunction i5100_spddata_rdofunction i5100_spddata_sbefunction i5100_spddata_busyfunction i5100_spddata_datafunction i5100_spdcmd_createfunction i5100_tolm_tolmfunction i5100_mir_limitfunction i5100_mir_way1function i5100_mir_way0function i5100_ferr_nf_mem_chan_indxfunction i5100_ferr_nf_mem_anyfunction i5100_nerr_nf_mem_anyfunction i5100_dmir_limitfunction i5100_dmir_rankfunction i5100_mtr_presentfunction i5100_mtr_ethrottlefunction i5100_mtr_widthfunction i5100_mtr_numbankfunction i5100_mtr_numrowfunction i5100_mtr_numcolfunction i5100_validlog_redmemvalidfunction i5100_validlog_recmemvalidfunction i5100_validlog_nrecmemvalidfunction i5100_nrecmema_merrfunction i5100_nrecmema_bankfunction i5100_nrecmema_rankfunction i5100_nrecmemb_casfunction i5100_nrecmemb_rasfunction i5100_recmema_merrfunction i5100_recmema_bankfunction i5100_recmema_rankfunction i5100_recmemb_casfunction i5100_recmemb_rasfunction i5100_rank_to_slotfunction i5100_csrow_to_rankfunction i5100_csrow_to_chanfunction i5100_handle_cefunction i5100_handle_uefunction i5100_read_logfunction i5100_check_errorfunction i5100_refresh_scrubbingfunction i5100_set_scrub_ratefunction i5100_get_scrub_ratefunction i5100_npages
Annotated Snippet
static const struct file_operations i5100_inject_enable_fops = {
.open = simple_open,
.write = inject_enable_write,
.llseek = generic_file_llseek,
};
static int i5100_setup_debugfs(struct mem_ctl_info *mci)
{
struct i5100_priv *priv = mci->pvt_info;
if (!i5100_debugfs)
return -ENODEV;
priv->debugfs = edac_debugfs_create_dir_at(mci->bus->name, i5100_debugfs);
if (!priv->debugfs)
return -ENOMEM;
edac_debugfs_create_x8("inject_channel", S_IRUGO | S_IWUSR, priv->debugfs,
&priv->inject_channel);
edac_debugfs_create_x8("inject_hlinesel", S_IRUGO | S_IWUSR, priv->debugfs,
&priv->inject_hlinesel);
edac_debugfs_create_x8("inject_deviceptr1", S_IRUGO | S_IWUSR, priv->debugfs,
&priv->inject_deviceptr1);
edac_debugfs_create_x8("inject_deviceptr2", S_IRUGO | S_IWUSR, priv->debugfs,
&priv->inject_deviceptr2);
edac_debugfs_create_x16("inject_eccmask1", S_IRUGO | S_IWUSR, priv->debugfs,
&priv->inject_eccmask1);
edac_debugfs_create_x16("inject_eccmask2", S_IRUGO | S_IWUSR, priv->debugfs,
&priv->inject_eccmask2);
edac_debugfs_create_file("inject_enable", S_IWUSR, priv->debugfs,
&mci->dev, &i5100_inject_enable_fops);
return 0;
}
static int i5100_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
{
int rc;
struct mem_ctl_info *mci;
struct edac_mc_layer layers[2];
struct i5100_priv *priv;
struct pci_dev *ch0mm, *ch1mm, *einj;
int ret = 0;
u32 dw;
int ranksperch;
if (PCI_FUNC(pdev->devfn) != 1)
return -ENODEV;
rc = pci_enable_device(pdev);
if (rc < 0) {
ret = rc;
goto bail;
}
/* ECC enabled? */
pci_read_config_dword(pdev, I5100_MC, &dw);
if (!i5100_mc_errdeten(dw)) {
printk(KERN_INFO "i5100_edac: ECC not enabled.\n");
ret = -ENODEV;
goto bail_pdev;
}
/* figure out how many ranks, from strapped state of 48GB_Mode input */
pci_read_config_dword(pdev, I5100_MS, &dw);
ranksperch = !!(dw & (1 << 8)) * 2 + 4;
/* device 21, func 0, Channel 0 Memory Map, Error Flag/Mask, etc... */
ch0mm = pci_get_device_func(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_5100_21, 0);
if (!ch0mm) {
ret = -ENODEV;
goto bail_pdev;
}
rc = pci_enable_device(ch0mm);
if (rc < 0) {
ret = rc;
goto bail_ch0;
}
/* device 22, func 0, Channel 1 Memory Map, Error Flag/Mask, etc... */
ch1mm = pci_get_device_func(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_5100_22, 0);
if (!ch1mm) {
ret = -ENODEV;
goto bail_disable_ch0;
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/pci.h`, `linux/pci_ids.h`, `linux/edac.h`, `linux/delay.h`, `linux/mmzone.h`, `linux/debugfs.h`.
- Detected declarations: `struct i5100_priv`, `function Hub`, `function i5100_mc_errdeten`, `function i5100_mc_scrbdone`, `function i5100_spddata_rdo`, `function i5100_spddata_sbe`, `function i5100_spddata_busy`, `function i5100_spddata_data`, `function i5100_spdcmd_create`, `function i5100_tolm_tolm`.
- Atlas domain: Driver Families / drivers/edac.
- Implementation status: pattern implementation candidate.
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.