PCI设备中断重构,删去USB相关代码 (#285)

* 修复ecam无法获取MCFG table的问题

* 完善pcie

* 完善irq的错误检测机制
This commit is contained in:
YJwu2023
2023-07-08 17:22:42 +08:00
committed by GitHub
parent 2311e2f300
commit cc36cf4a18
23 changed files with 1246 additions and 3416 deletions

View File

@ -5,6 +5,7 @@ pub mod cpu;
pub mod fpu;
pub mod interrupt;
pub mod mm;
pub mod msi;
pub mod pci;
pub mod rand;
pub mod sched;

View File

@ -0,0 +1,23 @@
use crate::driver::pci::pci_irq::TriggerMode;
/// @brief 获得MSI Message Address
/// @param processor 目标CPU ID号
/// @return MSI Message Address
pub fn ia64_pci_get_arch_msi_message_address(processor: u16) -> u32 {
0xfee00000 as u32 | ((processor as u32) << 12)
}
/// @brief 获得MSI Message Data
/// @param vector 分配的中断向量号
/// @param processor 目标CPU ID号
/// @param trigger 申请中断的触发模式MSI默认为边沿触发
/// @return MSI Message Address
pub fn ia64_pci_get_arch_msi_message_data(
vector: u16,
processor: u16,
trigger: TriggerMode,
) -> u32 {
match trigger {
TriggerMode::EdgeTrigger => vector as u32,
TriggerMode::AssertHigh => vector as u32 | 1 << 15 | 1 << 14,
TriggerMode::AssertLow => vector as u32 | 1 << 15,
}
}

View File

@ -50,6 +50,10 @@ impl TraitPciArch for X86_64PciArch {
unsafe {
acpi_iter_SDT(Some(acpi_get_MCFG), data_point as *mut usize as *mut c_void);
};
// 防止无PCIE的机器找不到MCFG Table导致的错误
if data == 0 {
return Err(PciError::McfgTableNotFound);
}
//kdebug!("{}",data);
//loop{}
let head = NonNull::new(data as *mut acpi_system_description_table_header_t).unwrap();