mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-22 23:43:24 +00:00
PCI设备中断重构,删去USB相关代码 (#285)
* 修复ecam无法获取MCFG table的问题 * 完善pcie * 完善irq的错误检测机制
This commit is contained in:
@ -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;
|
||||
|
23
kernel/src/arch/x86_64/msi.rs
Normal file
23
kernel/src/arch/x86_64/msi.rs
Normal 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,
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
Reference in New Issue
Block a user