From 4bca3e55d306dfaf501aec0d47b651306a1ba832 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 31 Aug 2022 08:49:39 -0600 Subject: [PATCH] Fix xhcid compilation --- pcid/src/main.rs | 1 + xhcid/src/main.rs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pcid/src/main.rs b/pcid/src/main.rs index daff50513a..31f997afae 100644 --- a/pcid/src/main.rs +++ b/pcid/src/main.rs @@ -325,6 +325,7 @@ fn handle_parsed_header(state: Arc, config: &Config, bus_num: u8, }; // Find BAR sizes + //TODO: support 64-bit BAR sizes? let mut bars = [PciBar::None; 6]; let mut bar_sizes = [0; 6]; unsafe { diff --git a/xhcid/src/main.rs b/xhcid/src/main.rs index b097aa2942..6a8fc31ce9 100644 --- a/xhcid/src/main.rs +++ b/xhcid/src/main.rs @@ -87,7 +87,7 @@ fn get_int_method(pcid_handle: &mut PcidServerHandle, address: usize) -> (Option let pci_config = pcid_handle.fetch_config().expect("xhcid: failed to fetch config"); let bar = pci_config.func.bars[0]; - let bar_size = pci_config.func.bar_sizes[0]; + let bar_size = pci_config.func.bar_sizes[0] as u64; let irq = pci_config.func.legacy_interrupt_line; let bar_ptr = match bar { @@ -159,11 +159,11 @@ fn get_int_method(pcid_handle: &mut PcidServerHandle, address: usize) -> (Option let pba_base = capability.pba_base_pointer(pci_config.func.bars); - if !(bar_ptr..bar_ptr + bar_size).contains(&(table_base as u32 + table_min_length as u32)) { + if !(bar_ptr..bar_ptr + bar_size).contains(&(table_base as u64 + table_min_length as u64)) { panic!("Table {:#x}{:#x} outside of BAR {:#x}:{:#x}", table_base, table_base + table_min_length as usize, bar_ptr, bar_ptr + bar_size); } - if !(bar_ptr..bar_ptr + bar_size).contains(&(pba_base as u32 + pba_min_length as u32)) { + if !(bar_ptr..bar_ptr + bar_size).contains(&(pba_base as u64 + pba_min_length as u64)) { panic!("PBA {:#x}{:#x} outside of BAR {:#x}:{:#X}", pba_base, pba_base + pba_min_length as usize, bar_ptr, bar_ptr + bar_size); }