arch/arm/kernel/atags_parse.c
Source file repositories/reference/linux-study-clean/arch/arm/kernel/atags_parse.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/kernel/atags_parse.c- Extension
.c- Size
- 5790 bytes
- Lines
- 231
- Domain
- Architecture Layer
- Bucket
- arch/arm
- 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/init.hlinux/initrd.hlinux/kernel.hlinux/fs.hlinux/root_dev.hlinux/screen_info.hlinux/memblock.huapi/linux/mount.hasm/setup.hasm/system_info.hasm/page.hasm/mach/arch.hatags.h
Detected Declarations
function parse_tag_corefunction parse_tag_mem32function parse_tag_videotextfunction parse_tag_ramdiskfunction parse_tag_serialnrfunction parse_tag_revisionfunction parse_tag_cmdlinefunction parse_tagfunction parse_tagsfunction squash_mem_tagsfunction setup_machine_tags
Annotated Snippet
if (tag->hdr.tag == t->tag) {
t->parse(tag);
break;
}
return t < &__tagtable_end;
}
/*
* Parse all tags in the list, checking both the global and architecture
* specific tag tables.
*/
static void __init parse_tags(const struct tag *t)
{
for (; t->hdr.size; t = tag_next(t))
if (!parse_tag(t))
pr_warn("Ignoring unrecognised tag 0x%08x\n",
t->hdr.tag);
}
static void __init squash_mem_tags(struct tag *tag)
{
for (; tag->hdr.size; tag = tag_next(tag))
if (tag->hdr.tag == ATAG_MEM)
tag->hdr.tag = ATAG_NONE;
}
const struct machine_desc * __init
setup_machine_tags(void *atags_vaddr, unsigned int machine_nr)
{
struct tag *tags = (struct tag *)&default_tags;
const struct machine_desc *mdesc = NULL, *p;
char *from = default_command_line;
default_tags.mem.start = PHYS_OFFSET;
/*
* locate machine in the list of supported machines.
*/
for_each_machine_desc(p)
if (machine_nr == p->nr) {
pr_info("Machine: %s\n", p->name);
mdesc = p;
break;
}
if (!mdesc)
return NULL;
if (atags_vaddr)
tags = atags_vaddr;
else if (mdesc->atag_offset)
tags = (void *)(PAGE_OFFSET + mdesc->atag_offset);
#if defined(CONFIG_DEPRECATED_PARAM_STRUCT)
/*
* If we have the old style parameters, convert them to
* a tag list.
*/
if (tags->hdr.tag != ATAG_CORE)
convert_to_tag_list(tags);
#endif
if (tags->hdr.tag != ATAG_CORE) {
early_print("Warning: Neither atags nor dtb found\n");
tags = (struct tag *)&default_tags;
}
if (mdesc->fixup)
mdesc->fixup(tags, &from);
if (tags->hdr.tag == ATAG_CORE) {
if (memblock_phys_mem_size())
squash_mem_tags(tags);
save_atags(tags);
parse_tags(tags);
}
/* parse_early_param needs a boot_command_line */
strscpy(boot_command_line, from, COMMAND_LINE_SIZE);
return mdesc;
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/initrd.h`, `linux/kernel.h`, `linux/fs.h`, `linux/root_dev.h`, `linux/screen_info.h`, `linux/memblock.h`, `uapi/linux/mount.h`.
- Detected declarations: `function parse_tag_core`, `function parse_tag_mem32`, `function parse_tag_videotext`, `function parse_tag_ramdisk`, `function parse_tag_serialnr`, `function parse_tag_revision`, `function parse_tag_cmdline`, `function parse_tag`, `function parse_tags`, `function squash_mem_tags`.
- Atlas domain: Architecture Layer / arch/arm.
- 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.