drivers/edac/dmc520_edac.c
Source file repositories/reference/linux-study-clean/drivers/edac/dmc520_edac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/edac/dmc520_edac.c- Extension
.c- Size
- 16672 bytes
- Lines
- 653
- Domain
- Driver Families
- Bucket
- drivers/edac
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/edac.hlinux/interrupt.hlinux/io.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/slab.hlinux/spinlock.hedac_mc.h
Detected Declarations
struct ecc_error_infostruct dmc520_irq_configstruct dmc520_edacenum dmc520_mem_widthenum dmc520_mem_typeenum dmc520_dev_widthfunction dmc520_read_regfunction dmc520_write_regfunction dmc520_calc_dram_ecc_errorfunction dmc520_get_dram_ecc_error_countfunction dmc520_get_dram_ecc_error_infofunction dmc520_is_ecc_enabledfunction dmc520_get_scrub_typefunction dmc520_get_memory_widthfunction dmc520_get_mtypefunction dmc520_get_dtypefunction dmc520_get_rank_countfunction dmc520_get_rank_sizefunction dmc520_handle_dram_ecc_errorsfunction dmc520_edac_dram_ecc_isrfunction dmc520_edac_dram_all_isrfunction dmc520_isrfunction dmc520_init_csrowfunction dmc520_edac_probefunction dmc520_edac_remove
Annotated Snippet
struct ecc_error_info {
u32 col;
u32 row;
u32 bank;
u32 rank;
};
/* The interrupt config */
struct dmc520_irq_config {
char *name;
int mask;
};
/* The interrupt mappings */
static struct dmc520_irq_config dmc520_irq_configs[] = {
{
.name = "ram_ecc_errc",
.mask = RAM_ECC_INT_CE_BIT
},
{
.name = "ram_ecc_errd",
.mask = RAM_ECC_INT_UE_BIT
},
{
.name = "dram_ecc_errc",
.mask = DRAM_ECC_INT_CE_BIT
},
{
.name = "dram_ecc_errd",
.mask = DRAM_ECC_INT_UE_BIT
},
{
.name = "failed_access",
.mask = FAILED_ACCESS_INT_BIT
},
{
.name = "failed_prog",
.mask = FAILED_PROG_INT_BIT
},
{
.name = "link_err",
.mask = LINK_ERR_INT_BIT
},
{
.name = "temperature_event",
.mask = TEMPERATURE_EVENT_INT_BIT
},
{
.name = "arch_fsm",
.mask = ARCH_FSM_INT_BIT
},
{
.name = "phy_request",
.mask = PHY_REQUEST_INT_BIT
}
};
#define NUMBER_OF_IRQS ARRAY_SIZE(dmc520_irq_configs)
/*
* The EDAC driver private data.
* error_lock is to protect concurrent writes to the mci->error_desc through
* edac_mc_handle_error().
*/
struct dmc520_edac {
void __iomem *reg_base;
spinlock_t error_lock;
u32 mem_width_in_bytes;
int irqs[NUMBER_OF_IRQS];
int masks[NUMBER_OF_IRQS];
};
static int dmc520_mc_idx;
static u32 dmc520_read_reg(struct dmc520_edac *pvt, u32 offset)
{
return readl(pvt->reg_base + offset);
}
static void dmc520_write_reg(struct dmc520_edac *pvt, u32 val, u32 offset)
{
writel(val, pvt->reg_base + offset);
}
static u32 dmc520_calc_dram_ecc_error(u32 value)
{
u32 total = 0;
/* Each rank's error counter takes one byte. */
while (value > 0) {
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/edac.h`, `linux/interrupt.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/slab.h`.
- Detected declarations: `struct ecc_error_info`, `struct dmc520_irq_config`, `struct dmc520_edac`, `enum dmc520_mem_width`, `enum dmc520_mem_type`, `enum dmc520_dev_width`, `function dmc520_read_reg`, `function dmc520_write_reg`, `function dmc520_calc_dram_ecc_error`, `function dmc520_get_dram_ecc_error_count`.
- Atlas domain: Driver Families / drivers/edac.
- Implementation status: source 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.