mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-22 07:03:22 +00:00
初步编写cpu信息获取的代码 (#406)
1. 启动时从acpi获取所有的cpu信息并存到SMP_BOOT_DATA 2. 注册cpu subsystem/bus到sysfs(暂时未添加内容) todo: 1. build_cpu_map(在X86_64SmpManager中) 2. 实现cpu mask 3. 把cpu设备注册到sysfs
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
use core::{fmt::Debug, ptr::NonNull};
|
||||
|
||||
use acpi::AcpiHandler;
|
||||
use acpi::{AcpiHandler, PlatformInfo};
|
||||
use alloc::{string::ToString, sync::Arc};
|
||||
|
||||
use crate::{
|
||||
@ -87,6 +87,27 @@ impl AcpiManager {
|
||||
pub fn tables(&self) -> Option<&'static acpi::AcpiTables<AcpiHandlerImpl>> {
|
||||
unsafe { __ACPI_TABLE.as_ref() }
|
||||
}
|
||||
|
||||
/// 从acpi获取平台的信息
|
||||
///
|
||||
/// 包括:
|
||||
///
|
||||
/// - PowerProfile
|
||||
/// - InterruptModel
|
||||
/// - ProcessorInfo
|
||||
/// - PmTimer
|
||||
pub fn platform_info(&self) -> Option<PlatformInfo<'_, alloc::alloc::Global>> {
|
||||
let r = self.tables()?.platform_info();
|
||||
if let Err(ref e) = r {
|
||||
kerror!(
|
||||
"AcpiManager::platform_info(): failed to get platform info, error: {:?}",
|
||||
e
|
||||
);
|
||||
return None;
|
||||
}
|
||||
|
||||
return Some(r.unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
|
Reference in New Issue
Block a user