Skip to content

Commit 1abcb48

Browse files
committed
Added IRQ checking to the PCI code
Signed-off-by: SlyMarbo <[email protected]>
1 parent a41d7db commit 1abcb48

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

kernel/src/pci.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ use x86_64::instructions::port::Port;
99
pub const CONFIG_ADDRESS: u16 = 0xcf8;
1010
pub const CONFIG_DATA: u16 = 0xcfc;
1111

12+
pub const NONE: u16 = 0xffff;
13+
1214
pub const VENDOR_ID: u8 = 0x00;
1315
pub const DEVICE_ID: u8 = 0x02;
1416
pub const COMMAND: u8 = 0x04;
1517
pub const SUBCLASS: u8 = 0x0a;
1618
pub const CLASS: u8 = 0x0b;
1719
pub const HEADER_TYPE: u8 = 0x0e;
18-
19-
pub const NONE: u16 = 0xffff;
20+
pub const INTERRUPT_LINE: u8 = 0x3c;
2021

2122
pub const BAR0: u8 = 0x10;
2223
pub const BAR1: u8 = 0x14;
@@ -158,6 +159,10 @@ impl Device {
158159
pub fn write_field_u32(&self, field: u8, value: u32) {
159160
write_u32(self.bus, self.slot, self.func, field, value);
160161
}
162+
163+
pub fn get_irq(&self) -> usize {
164+
self.read_field_u8(INTERRUPT_LINE) as usize
165+
}
161166
}
162167

163168
impl fmt::Display for Device {

0 commit comments

Comments
 (0)