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