1 use crate::driver::tty::tty_device::tty_init; 2 use system_error::SystemError; 3 use unified_init::{define_public_unified_initializer_slice, unified_init}; 4 5 use super::{ 6 class::classes_init, 7 cpu::cpu_device_manager, 8 device::{bus::buses_init, init::devices_init}, 9 firmware::firmware_init, 10 hypervisor::hypervisor_init, 11 platform::platform_bus_init, 12 }; 13 14 define_public_unified_initializer_slice!(SUBSYSTEM_INITIALIZER_SLICE); 15 16 pub(super) fn driver_init() -> Result<(), SystemError> { 17 devices_init()?; 18 buses_init()?; 19 classes_init()?; 20 firmware_init()?; 21 hypervisor_init()?; 22 platform_bus_init()?; 23 cpu_device_manager().init()?; 24 subsystem_init()?; 25 // 至此,已完成设备驱动模型的初始化 26 // 接下来,初始化设备 27 actual_device_init()?; 28 return Ok(()); 29 } 30 31 fn actual_device_init() -> Result<(), SystemError> { 32 tty_init()?; 33 34 return Ok(()); 35 } 36 37 fn subsystem_init() -> Result<(), SystemError> { 38 unified_init!(SUBSYSTEM_INITIALIZER_SLICE); 39 return Ok(()); 40 } 41