添加FrameBuffer的接口抽象&完善设备驱动模型的class相关代码 (#472)

* 添加FrameBuffer的接口抽象(参考Linux 6.1.9)

* feature: 完善设备驱动模型的class的抽象,并创建graphics class

* feature: 完善设备驱动模型中Device对class的处理,使得能够在class下注册设备

目前注册了fbcon设备,但是由于虚拟终端还没写,因此fbcon的到终端以及帧缓冲区的映射还没加上去.
This commit is contained in:
LoGin
2023-12-20 17:24:05 +08:00
committed by GitHub
parent 8612b6ce7a
commit 08a2ee4084
21 changed files with 1442 additions and 50 deletions

View File

@ -73,7 +73,7 @@ impl CompatibleTable {
pub fn platform_bus_init() -> Result<(), SystemError> {
let platform_device: Arc<PlatformBusDevice> = PlatformBusDevice::new(
DevicePrivateData::new(
IdTable::new("platform".to_string(), DeviceNumber::new(0)),
IdTable::new("platform".to_string(), Some(DeviceNumber::new(0))),
BusState::NotInitialized.into(),
),
Some(Arc::downgrade(&(sys_devices_kset() as Arc<dyn KObject>))),

View File

@ -6,6 +6,7 @@ use ida::IdAllocator;
use crate::{
driver::base::{
class::Class,
device::{
bus::{Bus, BusState},
device_manager,
@ -287,7 +288,7 @@ impl Device for PlatformBusDevice {
#[inline]
#[allow(dead_code)]
fn id_table(&self) -> IdTable {
IdTable::new("platform".to_string(), DeviceNumber::new(0))
IdTable::new("platform".to_string(), Some(DeviceNumber::new(0)))
}
fn bus(&self) -> Option<Arc<dyn Bus>> {
@ -322,4 +323,8 @@ impl Device for PlatformBusDevice {
fn state_synced(&self) -> bool {
todo!()
}
fn set_class(&self, _class: Option<Arc<dyn Class>>) {
todo!()
}
}

View File

@ -30,10 +30,10 @@ pub struct PlatformBus {
impl PlatformBus {
pub fn new() -> Arc<Self> {
let w: Weak<Self> = Weak::new();
let private = SubSysPrivate::new("platform".to_string(), w, &[]);
let private = SubSysPrivate::new("platform".to_string(), Some(w), None, &[]);
let bus = Arc::new(Self { private });
bus.subsystem()
.set_bus(Arc::downgrade(&(bus.clone() as Arc<dyn Bus>)));
.set_bus(Some(Arc::downgrade(&(bus.clone() as Arc<dyn Bus>))));
return bus;
}