xref: /DragonOS/kernel/src/arch/riscv64/init/dragonstub.rs (revision fae6e9ade46a52976ad5d099643d51cc20876448)
1 use alloc::string::String;
2 use system_error::SystemError;
3 
4 use crate::{
5     driver::video::fbdev::base::BootTimeScreenInfo,
6     init::boot::{register_boot_callbacks, BootCallbacks, BootloaderAcpiArg},
7 };
8 
9 pub(super) fn early_dragonstub_init() -> Result<(), SystemError> {
10     register_boot_callbacks(&DragonStubCallBack);
11     Ok(())
12 }
13 
14 struct DragonStubCallBack;
15 
16 impl BootCallbacks for DragonStubCallBack {
17     fn init_bootloader_name(&self) -> Result<Option<String>, SystemError> {
18         Ok(format!("DragonStub").into())
19     }
20 
21     fn init_acpi_args(&self) -> Result<BootloaderAcpiArg, SystemError> {
22         Ok(BootloaderAcpiArg::NotProvided)
23     }
24 
25     fn init_kernel_cmdline(&self) -> Result<(), SystemError> {
26         // parsed in `early_init_scan_chosen()`
27         Ok(())
28     }
29 
30     fn early_init_framebuffer_info(
31         &self,
32         _scinfo: &mut BootTimeScreenInfo,
33     ) -> Result<(), SystemError> {
34         unimplemented!("dragonstub early_init_framebuffer_info")
35     }
36 
37     fn early_init_memory_blocks(&self) -> Result<(), SystemError> {
38         // parsed in `early_init_scan_memory()` and uefi driver
39         Ok(())
40     }
41 }
42