YJwu2023 cc36cf4a18
PCI设备中断重构,删去USB相关代码 (#285)
* 修复ecam无法获取MCFG table的问题

* 完善pcie

* 完善irq的错误检测机制
2023-07-08 17:22:42 +08:00

24 lines
821 B
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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,
}
}