Rust XHCI Implementation.

This commit is contained in:
Drew 2025-12-05 22:01:13 -08:00
parent 8b022a6b24
commit 7bbbf79bd6
26 changed files with 1901 additions and 209 deletions

View file

@ -1,3 +1,5 @@
use core::ffi::c_void;
use alloc::sync::Arc;
use mammoth::{
cap::Capability,
@ -26,8 +28,11 @@ impl AhciController {
pub fn new(pci_memory: Capability) -> Self {
let pci_device = PciDevice::from_cap(pci_memory).unwrap();
let hba_vaddr =
mem::map_direct_physical_and_leak(pci_device.header().bars[5] as u64, 0x1100);
let hba_vaddr = mem::map_direct_physical_and_leak::<c_void>(
pci_device.header().bars[5] as usize,
0x1100,
)
.as_ptr() as u64;
let hba = unsafe { (hba_vaddr as *mut AhciHba).as_mut().unwrap() };
let mut controller = Self {
pci_device: Mutex::new(pci_device),