drivers/firmware/efi/fdtparams.c
Source file repositories/reference/linux-study-clean/drivers/firmware/efi/fdtparams.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/efi/fdtparams.c- Extension
.c- Size
- 3061 bytes
- Lines
- 134
- Domain
- Driver Families
- Bucket
- drivers/firmware
- 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.
- 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/module.hlinux/init.hlinux/efi.hlinux/libfdt.hlinux/of_fdt.hlinux/unaligned.h
Detected Declarations
function efi_get_fdt_propfunction efi_get_fdt_params
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
#define pr_fmt(fmt) "efi: " fmt
#include <linux/module.h>
#include <linux/init.h>
#include <linux/efi.h>
#include <linux/libfdt.h>
#include <linux/of_fdt.h>
#include <linux/unaligned.h>
enum {
SYSTAB,
MMBASE,
MMSIZE,
DCSIZE,
DCVERS,
PARAMCOUNT
};
static __initconst const char name[][22] = {
[SYSTAB] = "System Table ",
[MMBASE] = "MemMap Address ",
[MMSIZE] = "MemMap Size ",
[DCSIZE] = "MemMap Desc. Size ",
[DCVERS] = "MemMap Desc. Version ",
};
static __initconst const struct {
const char path[17];
u8 paravirt;
const char params[PARAMCOUNT][26];
} dt_params[] = {
{
#ifdef CONFIG_XEN // <-------17------>
.path = "/hypervisor/uefi",
.paravirt = 1,
.params = {
[SYSTAB] = "xen,uefi-system-table",
[MMBASE] = "xen,uefi-mmap-start",
[MMSIZE] = "xen,uefi-mmap-size",
[DCSIZE] = "xen,uefi-mmap-desc-size",
[DCVERS] = "xen,uefi-mmap-desc-ver",
}
}, {
#endif
.path = "/chosen",
.params = { // <-----------26----------->
[SYSTAB] = "linux,uefi-system-table",
[MMBASE] = "linux,uefi-mmap-start",
[MMSIZE] = "linux,uefi-mmap-size",
[DCSIZE] = "linux,uefi-mmap-desc-size",
[DCVERS] = "linux,uefi-mmap-desc-ver",
}
}
};
static int __init efi_get_fdt_prop(const void *fdt, int node, const char *pname,
const char *rname, void *var, int size)
{
const void *prop;
int len;
u64 val;
prop = fdt_getprop(fdt, node, pname, &len);
if (!prop)
return 1;
val = (len == 4) ? (u64)be32_to_cpup(prop) : get_unaligned_be64(prop);
if (size == 8)
*(u64 *)var = val;
else
*(u32 *)var = (val < U32_MAX) ? val : U32_MAX; // saturate
if (efi_enabled(EFI_DBG))
pr_info(" %s: 0x%0*llx\n", rname, size * 2, val);
return 0;
}
u64 __init efi_get_fdt_params(struct efi_memory_map_data *mm)
{
const void *fdt = initial_boot_params;
unsigned long systab;
int i, j, node;
struct {
void *var;
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/efi.h`, `linux/libfdt.h`, `linux/of_fdt.h`, `linux/unaligned.h`.
- Detected declarations: `function efi_get_fdt_prop`, `function efi_get_fdt_params`.
- Atlas domain: Driver Families / drivers/firmware.
- Implementation status: source implementation candidate.
- 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.