xref: /DragonOS/kernel/src/arch/x86_64/msi.rs (revision 1603395155fc166de0ac5f80369526e196526ed2)
1 use crate::driver::pci::pci_irq::TriggerMode;
2 /// @brief 获得MSI Message Address
3 /// @param processor 目标CPU ID号
4 /// @return MSI Message Address
5 pub fn ia64_pci_get_arch_msi_message_address(processor: u16) -> u32 {
6     0xfee00000 | ((processor as u32) << 12)
7 }
8 /// @brief 获得MSI Message Data
9 /// @param vector 分配的中断向量号
10 /// @param processor 目标CPU ID号
11 /// @param trigger  申请中断的触发模式,MSI默认为边沿触发
12 /// @return MSI Message Address
13 pub fn ia64_pci_get_arch_msi_message_data(
14     vector: u16,
15     _processor: u16,
16     trigger: TriggerMode,
17 ) -> u32 {
18     match trigger {
19         TriggerMode::EdgeTrigger => vector as u32,
20         TriggerMode::AssertHigh => vector as u32 | 1 << 15 | 1 << 14,
21         TriggerMode::AssertLow => vector as u32 | 1 << 15,
22     }
23 }
24