xref: /DragonOS/kernel/src/arch/riscv64/init/dragonstub.rs (revision 2b7818e80e00fcfe4d03533f587cc125ea5e4bec)
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 
early_dragonstub_init() -> Result<(), SystemError>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 {
init_bootloader_name(&self) -> Result<Option<String>, SystemError>17     fn init_bootloader_name(&self) -> Result<Option<String>, SystemError> {
18         Ok(format!("DragonStub").into())
19     }
20 
init_acpi_args(&self) -> Result<BootloaderAcpiArg, SystemError>21     fn init_acpi_args(&self) -> Result<BootloaderAcpiArg, SystemError> {
22         Ok(BootloaderAcpiArg::NotProvided)
23     }
24 
init_kernel_cmdline(&self) -> Result<(), SystemError>25     fn init_kernel_cmdline(&self) -> Result<(), SystemError> {
26         // parsed in `early_init_scan_chosen()`
27         Ok(())
28     }
29 
early_init_framebuffer_info( &self, _scinfo: &mut BootTimeScreenInfo, ) -> Result<(), SystemError>30     fn early_init_framebuffer_info(
31         &self,
32         _scinfo: &mut BootTimeScreenInfo,
33     ) -> Result<(), SystemError> {
34         unimplemented!("dragonstub early_init_framebuffer_info")
35     }
36 
early_init_memory_blocks(&self) -> Result<(), SystemError>37     fn early_init_memory_blocks(&self) -> Result<(), SystemError> {
38         // parsed in `early_init_scan_memory()` and uefi driver
39         Ok(())
40     }
41 }
42