arch/powerpc/kexec/ranges.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kexec/ranges.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kexec/ranges.c- Extension
.c- Size
- 18890 bytes
- Lines
- 730
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- 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/sort.hlinux/kexec.hlinux/of.hlinux/slab.hlinux/memblock.hlinux/crash_core.hasm/sections.hasm/kexec_ranges.hasm/crashdump-ppc64.h
Detected Declarations
function Copyrightfunction get_mem_rngs_sizefunction __add_mem_rangefunction __merge_memory_rangesfunction rngcmpfunction sort_memory_rangesfunction add_mem_rangefunction add_tce_mem_rangesfunction for_each_node_by_typefunction add_initrd_mem_rangefunction add_htab_mem_rangefunction add_kernel_mem_rangefunction add_rtas_mem_rangefunction add_opal_mem_rangefunction add_reserved_mem_rangesfunction get_reserved_memory_rangesfunction get_exclude_memory_rangesfunction get_usable_memory_rangesfunction crash_exclude_mem_range_guardedfunction get_crash_memory_rangesfunction for_each_mem_rangefunction remove_mem_range
Annotated Snippet
if (base < mend && end > mstart) {
if (base < mstart)
mem_rngs->ranges[i].start = base;
if (end > mend)
mem_rngs->ranges[i].end = end;
return 0;
}
}
return __add_mem_range(mem_ranges, base, size);
}
#endif /* CONFIG_KEXEC_FILE || CONFIG_CRASH_DUMP */
#ifdef CONFIG_KEXEC_FILE
/**
* add_tce_mem_ranges - Adds tce-table range to the given memory ranges list.
* @mem_ranges: Range list to add the memory range(s) to.
*
* Returns 0 on success, negative errno on error.
*/
static int add_tce_mem_ranges(struct crash_mem **mem_ranges)
{
struct device_node *dn = NULL;
int ret = 0;
for_each_node_by_type(dn, "pci") {
u64 base;
u32 size;
ret = of_property_read_u64(dn, "linux,tce-base", &base);
ret |= of_property_read_u32(dn, "linux,tce-size", &size);
if (ret) {
/*
* It is ok to have pci nodes without tce. So, ignore
* property does not exist error.
*/
if (ret == -EINVAL) {
ret = 0;
continue;
}
break;
}
ret = add_mem_range(mem_ranges, base, size);
if (ret)
break;
}
of_node_put(dn);
return ret;
}
/**
* add_initrd_mem_range - Adds initrd range to the given memory ranges list,
* if the initrd was retained.
* @mem_ranges: Range list to add the memory range to.
*
* Returns 0 on success, negative errno on error.
*/
static int add_initrd_mem_range(struct crash_mem **mem_ranges)
{
u64 base, end;
int ret;
/* This range means something, only if initrd was retained */
if (!strstr(saved_command_line, "retain_initrd"))
return 0;
ret = of_property_read_u64(of_chosen, "linux,initrd-start", &base);
ret |= of_property_read_u64(of_chosen, "linux,initrd-end", &end);
if (!ret)
ret = add_mem_range(mem_ranges, base, end - base + 1);
return ret;
}
/**
* add_htab_mem_range - Adds htab range to the given memory ranges list,
* if it exists
* @mem_ranges: Range list to add the memory range to.
*
* Returns 0 on success, negative errno on error.
*/
static int add_htab_mem_range(struct crash_mem **mem_ranges)
{
#ifdef CONFIG_PPC_64S_HASH_MMU
if (!htab_address)
return 0;
Annotation
- Immediate include surface: `linux/sort.h`, `linux/kexec.h`, `linux/of.h`, `linux/slab.h`, `linux/memblock.h`, `linux/crash_core.h`, `asm/sections.h`, `asm/kexec_ranges.h`.
- Detected declarations: `function Copyright`, `function get_mem_rngs_size`, `function __add_mem_range`, `function __merge_memory_ranges`, `function rngcmp`, `function sort_memory_ranges`, `function add_mem_range`, `function add_tce_mem_ranges`, `function for_each_node_by_type`, `function add_initrd_mem_range`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.