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.

Dependency Surface

Detected Declarations

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

Implementation Notes