ableos/ableos/src/devices/pci/mod.rs

52 lines
1.5 KiB
Rust

/*
* Copyright (c) 2022, Umut İnan Erdoğan <umutinanerdogan@pm.me>
*
* SPDX-License-Identifier: MPL-2.0
*/
pub mod class;
pub mod device;
pub mod vendors;
// MassStorage_IDE (0x0101)
pub mod piix;
pub use class::*;
pub use device::*;
use x86_64::structures::paging::{Mapper, Size4KiB};
use crate::arch::memory::BootInfoFrameAllocator;
use self::piix::Piix;
/// Enumerate PCI devices and run initialisation routines on ones we support
pub fn init(mapper: &mut impl Mapper<Size4KiB>, frame_allocator: &mut BootInfoFrameAllocator) {
for bus in 0..=255 {
for device in 0..32 {
if let Some(device_info) = device::check_device(bus, device) {
match device_info.device_id {
// FIXME: Unknown class
S3INC_TRIO64V2 => {}
// MassStorage_IDE (0x0101)
INTEL_PIIX3_IDE | INTEL_PIIX4_IDE => {
let mut piix = Piix::new(bus, device).unwrap();
piix.allocate_dma_frame(mapper, frame_allocator).unwrap();
piix.read().unwrap();
}
// Display_VGA (0x0300)
VMWARE_SVGA2 => {}
_ => {
trace!(
"PCI device {} on bus {} unsupported",
device_info.device,
device_info.bus
)
}
}
}
}
}
}