pci: Replace BAR tuple with PciBarConfiguration

In order to make the code more consistent and easier to read, we remove
the former tuple that was used to describe a BAR, replacing it with the
existing structure PciBarConfiguration.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2022-04-14 18:13:57 +02:00
committed by Bo Chen
parent da95c0d784
commit 89218b6d1e
7 changed files with 62 additions and 55 deletions

View File

@@ -3285,16 +3285,16 @@ impl DeviceManager {
.map_err(DeviceManagerError::AddPciDevice)?;
let mut new_resources = Vec::new();
for pci_bar in bars.iter() {
match pci_bar.2 {
for bar in bars {
match bar.region_type() {
PciBarRegionType::IoRegion => new_resources.push(Resource::PioAddressRange {
base: pci_bar.0.raw_value() as u16,
size: pci_bar.1 as u16,
base: bar.addr() as u16,
size: bar.size() as u16,
}),
PciBarRegionType::Memory32BitRegion | PciBarRegionType::Memory64BitRegion => {
new_resources.push(Resource::MmioAddressRange {
base: pci_bar.0.raw_value(),
size: pci_bar.1 as u64,
base: bar.addr(),
size: bar.size() as u64,
})
}
}