arch/x86/platform/olpc/olpc_dt.c
Source file repositories/reference/linux-study-clean/arch/x86/platform/olpc/olpc_dt.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/platform/olpc/olpc_dt.c- Extension
.c- Size
- 7156 bytes
- Lines
- 322
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/memblock.hlinux/of.hlinux/of_pdt.hasm/olpc.hasm/olpc_ofw.h
Detected Declarations
function Copyrightfunction olpc_dt_getchildfunction olpc_dt_getproplenfunction olpc_dt_getpropertyfunction olpc_dt_nextpropfunction olpc_dt_pkg2pathfunction prom_early_allocfunction olpc_dt_finddevicefunction olpc_dt_interpretfunction olpc_dt_get_board_revisionfunction olpc_dt_compatible_matchfunction olpc_dt_fixupfunction olpc_dt_build_devicetree
Annotated Snippet
if (olpc_ofw("getprop", args, res)) {
pr_err("PROM: %s: getprop failed!\n", __func__);
return -1;
}
}
return plen;
}
static int __init olpc_dt_nextprop(phandle node, char *prev, char *buf)
{
const void *args[] = { (void *)node, prev, buf };
int success;
void *res[] = { &success };
buf[0] = '\0';
if ((s32)node == -1)
return -1;
if (olpc_ofw("nextprop", args, res) || success != 1)
return -1;
return 0;
}
static int __init olpc_dt_pkg2path(phandle node, char *buf,
const int buflen, int *len)
{
const void *args[] = { (void *)node, buf, (void *)buflen };
void *res[] = { len };
if ((s32)node == -1)
return -1;
if (olpc_ofw("package-to-path", args, res) || *len < 1)
return -1;
return 0;
}
static unsigned int prom_early_allocated __initdata;
void * __init prom_early_alloc(unsigned long size)
{
static u8 *mem;
static size_t free_mem;
void *res;
if (free_mem < size) {
const size_t chunk_size = max(PAGE_SIZE, size);
/*
* To minimize the number of allocations, grab at least
* PAGE_SIZE of memory (that's an arbitrary choice that's
* fast enough on the platforms we care about while minimizing
* wasted bootmem) and hand off chunks of it to callers.
*/
res = memblock_alloc_or_panic(chunk_size, SMP_CACHE_BYTES);
prom_early_allocated += chunk_size;
memset(res, 0, chunk_size);
free_mem = chunk_size;
mem = res;
}
/* allocate from the local cache */
free_mem -= size;
res = mem;
mem += size;
return res;
}
static struct of_pdt_ops prom_olpc_ops __initdata = {
.nextprop = olpc_dt_nextprop,
.getproplen = olpc_dt_getproplen,
.getproperty = olpc_dt_getproperty,
.getchild = olpc_dt_getchild,
.getsibling = olpc_dt_getsibling,
.pkg2path = olpc_dt_pkg2path,
};
static phandle __init olpc_dt_finddevice(const char *path)
{
phandle node;
const void *args[] = { path };
void *res[] = { &node };
if (olpc_ofw("finddevice", args, res)) {
pr_err("olpc_dt: finddevice failed!\n");
return 0;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/memblock.h`, `linux/of.h`, `linux/of_pdt.h`, `asm/olpc.h`, `asm/olpc_ofw.h`.
- Detected declarations: `function Copyright`, `function olpc_dt_getchild`, `function olpc_dt_getproplen`, `function olpc_dt_getproperty`, `function olpc_dt_nextprop`, `function olpc_dt_pkg2path`, `function prom_early_alloc`, `function olpc_dt_finddevice`, `function olpc_dt_interpret`, `function olpc_dt_get_board_revision`.
- Atlas domain: Architecture Layer / arch/x86.
- 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.