Skip to content

Commit 51cd7a0

Browse files
committed
Support 64-bit addressing in MSI capabilities
1 parent 2c1c472 commit 51cd7a0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/capability/msi.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,27 @@ impl MsiCapability {
113113
MultipleMessageSupport::try_from(reg.get_bits(4..7) as u8).unwrap_or(MultipleMessageSupport::Int1)
114114
}
115115

116-
/// Set where the interrupts will be sent to
116+
/// Set the memory address that will be written to when the interrupt fires.
117117
///
118118
/// # Arguments
119-
/// * `address` - Target Local APIC address (if not changed, can be calculated with `0xFEE00000 | (processor << 12)`)
119+
/// * `address` - Target Local APIC address (if not changed, can be calculated with `0xfee00000 | (processor << 12)`)
120120
/// * `vector` - Which interrupt vector should be triggered on LAPIC
121121
/// * `trigger_mode` - When interrupt should be triggered
122122
/// * `access` - PCI Configuration Space accessor
123123
pub fn set_message_info(
124124
&self,
125-
address: u32,
125+
address: u64,
126126
vector: u8,
127127
trigger_mode: TriggerMode,
128128
access: impl ConfigRegionAccess,
129129
) {
130-
unsafe { access.write(self.address.address, self.address.offset + 0x4, address) }
131-
let data_offset = if self.is_64bit { 0xC } else { 0x8 };
130+
unsafe {
131+
access.write(self.address.address, self.address.offset + 0x04, address.get_bits(0..32) as u32);
132+
if self.is_64bit {
133+
access.write(self.address.address, self.address.offset + 0x08, address.get_bits(32..64) as u32);
134+
}
135+
}
136+
let data_offset = if self.is_64bit { 0x0c } else { 0x08 };
132137
let mut data = unsafe { access.read(self.address.address, self.address.offset + data_offset) };
133138
data.set_bits(0..8, vector as u32);
134139
data.set_bits(14..16, trigger_mode as u32);

0 commit comments

Comments
 (0)