Start using the pci_types crate

This commit is contained in:
bjorn3
2024-01-22 11:25:43 +01:00
parent d56881de88
commit 0b611dca04
9 changed files with 74 additions and 93 deletions
+11 -4
View File
@@ -6,8 +6,7 @@ use std::sync::Mutex;
use syscall::io::{Io as _, Pio};
use log::info;
use crate::pci::{CfgAccess, PciAddress};
use pci_types::{ConfigRegionAccess, PciAddress};
pub(crate) struct Pci {
lock: Mutex<()>,
@@ -58,7 +57,11 @@ impl Pci {
}
}
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
impl CfgAccess for Pci {
impl ConfigRegionAccess for Pci {
fn function_exists(&self, _address: PciAddress) -> bool {
todo!();
}
unsafe fn read(&self, address: PciAddress, offset: u16) -> u32 {
let _guard = self.lock.lock().unwrap();
@@ -86,7 +89,11 @@ impl CfgAccess for Pci {
}
}
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
impl CfgAccess for Pci {
impl ConfigRegionAccess for Pci {
fn function_exists(&self, _address: PciAddress) -> bool {
todo!();
}
unsafe fn read(&self, addr: PciAddress, offset: u16) -> u32 {
let _guard = self.lock.lock().unwrap();
todo!("Pci::CfgAccess::read on this architecture")
+6 -2
View File
@@ -2,8 +2,8 @@ use std::sync::Mutex;
use std::{fmt, fs, io, mem, ptr, slice};
use log::info;
use pci_types::{ConfigRegionAccess, PciAddress};
use crate::pci::{CfgAccess, PciAddress};
use fallback::Pci;
mod fallback;
@@ -221,7 +221,11 @@ impl Pcie {
}
}
impl CfgAccess for Pcie {
impl ConfigRegionAccess for Pcie {
fn function_exists(&self, _address: PciAddress) -> bool {
todo!();
}
unsafe fn read(&self, address: PciAddress, offset: u16) -> u32 {
let _guard = self.lock.lock().unwrap();