Skip to content

Commit bad810f

Browse files
committed
refactor(pci): drop code for creating Bridge PCI configuration
We only ever create type-0 (device) PCI configurations. The code that was handling Bridge types was effectively dead code. Drop it. Signed-off-by: Babis Chalios <bchalios@amazon.es>
1 parent 0b970b9 commit bad810f

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/pci/src/configuration.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const CAPABILITY_MAX_OFFSET: usize = 192;
3232
pub const PCI_CONFIGURATION_ID: &str = "pci_configuration";
3333

3434
/// Represents the types of PCI headers allowed in the configuration registers.
35-
#[derive(Copy, Clone)]
35+
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
3636
pub enum PciHeaderType {
3737
Device,
3838
Bridge,
@@ -483,17 +483,11 @@ impl PciConfiguration {
483483
| (u32::from(pi) << 8)
484484
| u32::from(revision_id);
485485
writable_bits[3] = 0x0000_00ff; // Cacheline size (r/w)
486-
match header_type {
487-
PciHeaderType::Device => {
488-
registers[3] = 0x0000_0000; // Header type 0 (device)
489-
writable_bits[15] = 0x0000_00ff; // IRQ line (r/w)
490-
}
491-
PciHeaderType::Bridge => {
492-
registers[3] = 0x0001_0000; // Header type 1 (bridge)
493-
writable_bits[9] = 0xfff0_fff0; // Memory base and limit
494-
writable_bits[15] = 0xffff_00ff; // Bridge control (r/w), IRQ line (r/w)
495-
}
496-
};
486+
487+
// We only every create device types. No bridges used at the moment
488+
assert_eq!(header_type, PciHeaderType::Device);
489+
registers[3] = 0x0000_0000; // Header type 0 (device)
490+
writable_bits[15] = 0x0000_00ff; // IRQ line (r/w)
497491
registers[11] = (u32::from(subsystem_id) << 16) | u32::from(subsystem_vendor_id);
498492

499493
(

0 commit comments

Comments
 (0)