drivers/firmware/efi/capsule-loader.c
Source file repositories/reference/linux-study-clean/drivers/firmware/efi/capsule-loader.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/efi/capsule-loader.c- Extension
.c- Size
- 8808 bytes
- Lines
- 343
- Domain
- Driver Families
- Bucket
- drivers/firmware
- 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.
- 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/miscdevice.hlinux/highmem.hlinux/io.hlinux/slab.hlinux/mutex.hlinux/efi.hlinux/vmalloc.h
Detected Declarations
function writefunction __efi_capsule_setup_infofunction efi_capsule_setup_infofunction efi_capsule_submit_updatefunction efi_capsule_updatefunction efi_capsule_releasefunction efi_capsule_openfunction efi_capsule_loader_initfunction efi_capsule_loader_exitmodule init efi_capsule_loader_init
Annotated Snippet
static const struct file_operations efi_capsule_fops = {
.owner = THIS_MODULE,
.open = efi_capsule_open,
.write = efi_capsule_write,
.release = efi_capsule_release,
};
static struct miscdevice efi_capsule_misc = {
.minor = MISC_DYNAMIC_MINOR,
.name = "efi_capsule_loader",
.fops = &efi_capsule_fops,
};
static int __init efi_capsule_loader_init(void)
{
int ret;
if (!efi_enabled(EFI_RUNTIME_SERVICES))
return -ENODEV;
ret = misc_register(&efi_capsule_misc);
if (ret)
pr_err("Unable to register capsule loader device\n");
return ret;
}
module_init(efi_capsule_loader_init);
static void __exit efi_capsule_loader_exit(void)
{
misc_deregister(&efi_capsule_misc);
}
module_exit(efi_capsule_loader_exit);
MODULE_DESCRIPTION("EFI capsule firmware binary loader");
MODULE_LICENSE("GPL v2");
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/miscdevice.h`, `linux/highmem.h`, `linux/io.h`, `linux/slab.h`, `linux/mutex.h`, `linux/efi.h`.
- Detected declarations: `function write`, `function __efi_capsule_setup_info`, `function efi_capsule_setup_info`, `function efi_capsule_submit_update`, `function efi_capsule_update`, `function efi_capsule_release`, `function efi_capsule_open`, `function efi_capsule_loader_init`, `function efi_capsule_loader_exit`, `module init efi_capsule_loader_init`.
- Atlas domain: Driver Families / drivers/firmware.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.