Skip to content

Commit f86a7ca

Browse files
Msix::new(): disable legacy IRQ for the device
Signed-off-by: Andy-Python-Programmer <[email protected]>
1 parent 6b32655 commit f86a7ca

File tree

1 file changed

+10
-0
lines changed
  • src/aero_kernel/src/drivers

1 file changed

+10
-0
lines changed

src/aero_kernel/src/drivers/pci.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ impl<'a> Msix<'a> {
124124
message_control.set_bit(15, true); // enable MSI-X
125125
message_control.set_bit(14, false); // function mask
126126

127+
header.disable_legacy_irq();
127128
header.write::<u16>(offset + 2, message_control as u32);
128129
}
129130

@@ -649,6 +650,15 @@ impl PciHeader {
649650
unsafe { self.write::<u16>(0x04, command | (1 << 2)) }
650651
}
651652

653+
pub fn disable_legacy_irq(&self) {
654+
// Set the Interrupt Disable bit, which is bit 10 of the Command register
655+
// (at Configuration Space offset 0x4) to disable legacy interrupts.
656+
let mut command = unsafe { self.read::<u16>(0x04) };
657+
command.set_bit(10, true);
658+
659+
unsafe { self.write::<u16>(0x04, command) }
660+
}
661+
652662
/// Returns the value stored in the PCI vendor ID register which is used to identify
653663
/// the manufacturer of the PCI device.
654664
pub fn get_vendor(&self) -> Vendor {

0 commit comments

Comments
 (0)