drivers/firmware/efi/libstub/riscv.c
Source file repositories/reference/linux-study-clean/drivers/firmware/efi/libstub/riscv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/efi/libstub/riscv.c- Extension
.c- Size
- 2291 bytes
- Lines
- 99
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/efi.hlinux/libfdt.hasm/efi.hlinux/unaligned.hefistub.h
Detected Declarations
function get_boot_hartid_from_fdtfunction get_boot_hartid_from_efifunction check_platform_featuresfunction stext_offsetfunction efi_enter_kernel
Annotated Snippet
if (ret) {
efi_err("Failed to get boot hartid!\n");
return EFI_UNSUPPORTED;
}
}
return EFI_SUCCESS;
}
unsigned long __weak stext_offset(void)
{
/*
* This fallback definition is used by the EFI zboot stub, which loads
* the entire image so it can branch via the image header at offset #0.
*/
return 0;
}
void __noreturn efi_enter_kernel(unsigned long entrypoint, unsigned long fdt,
unsigned long fdt_size)
{
unsigned long kernel_entry = entrypoint + stext_offset();
jump_kernel_func jump_kernel = (jump_kernel_func)kernel_entry;
/*
* Jump to real kernel here with following constraints.
* 1. MMU should be disabled.
* 2. a0 should contain hartid
* 3. a1 should DT address
*/
csr_write(CSR_SATP, 0);
jump_kernel(hartid, fdt);
}
Annotation
- Immediate include surface: `linux/efi.h`, `linux/libfdt.h`, `asm/efi.h`, `linux/unaligned.h`, `efistub.h`.
- Detected declarations: `function get_boot_hartid_from_fdt`, `function get_boot_hartid_from_efi`, `function check_platform_features`, `function stext_offset`, `function efi_enter_kernel`.
- Atlas domain: Driver Families / drivers/firmware.
- 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.