drivers/char/ipmi/ipmi_si_hardcode.c
Source file repositories/reference/linux-study-clean/drivers/char/ipmi/ipmi_si_hardcode.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/char/ipmi/ipmi_si_hardcode.c- Extension
.c- Size
- 5287 bytes
- Lines
- 154
- Domain
- Driver Families
- Bucket
- drivers/char
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/moduleparam.hlinux/platform_device.hipmi_si.hipmi_plat_data.h
Detected Declarations
function ipmi_hardcode_init_onefunction ipmi_hardcode_initfunction ipmi_si_hardcode_exitfunction ipmi_si_hardcode_match
Annotated Snippet
if (t < 0) {
pr_warn("Interface type specified for interface %d, was invalid: %s\n",
i, si_type_str);
return;
}
p.type = t;
}
p.regsize = regsizes[i];
p.regspacing = regspacings[i];
p.slave_addr = slave_addrs[i];
p.addr_source = SI_HARDCODED;
p.regshift = regshifts[i];
p.addr = addr;
p.space = addr_space;
ipmi_platform_add("hardcode-ipmi-si", i, &p);
}
void __init ipmi_hardcode_init(void)
{
unsigned int i;
char *str;
char *si_type[SI_MAX_PARMS];
memset(si_type, 0, sizeof(si_type));
/* Parse out the si_type string into its components. */
str = si_type_str;
if (*str != '\0') {
for (i = 0; (i < SI_MAX_PARMS) && (*str != '\0'); i++) {
si_type[i] = str;
str = strchr(str, ',');
if (str) {
*str = '\0';
str++;
} else {
break;
}
}
}
for (i = 0; i < SI_MAX_PARMS; i++) {
if (i < num_ports && ports[i])
ipmi_hardcode_init_one(si_type[i], i, ports[i],
IPMI_IO_ADDR_SPACE);
if (i < num_addrs && addrs[i])
ipmi_hardcode_init_one(si_type[i], i, addrs[i],
IPMI_MEM_ADDR_SPACE);
}
}
void ipmi_si_hardcode_exit(void)
{
ipmi_remove_platform_device_by_name("hardcode-ipmi-si");
}
/*
* Returns true of the given address exists as a hardcoded address,
* false if not.
*/
int ipmi_si_hardcode_match(int addr_space, unsigned long addr)
{
unsigned int i;
if (addr_space == IPMI_IO_ADDR_SPACE) {
for (i = 0; i < num_ports; i++) {
if (ports[i] == addr)
return 1;
}
} else {
for (i = 0; i < num_addrs; i++) {
if (addrs[i] == addr)
return 1;
}
}
return 0;
}
Annotation
- Immediate include surface: `linux/moduleparam.h`, `linux/platform_device.h`, `ipmi_si.h`, `ipmi_plat_data.h`.
- Detected declarations: `function ipmi_hardcode_init_one`, `function ipmi_hardcode_init`, `function ipmi_si_hardcode_exit`, `function ipmi_si_hardcode_match`.
- Atlas domain: Driver Families / drivers/char.
- Implementation status: source 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.