pci: Disable multiple functions

Every PCI device is exposed as a separate device, on a specific PCI
slot, and we explicitely don't support to expose a device as a multi
function device. For this reason, this patch makes sure the enumeration
of the PCI bus will not find some multi function device.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2019-07-26 17:15:40 -07:00 committed by Samuel Ortiz
parent f86b9dd95e
commit b6ae2ccda4

View File

@ -125,7 +125,7 @@ impl PciConfigIo {
return 0xffff_ffff;
}
let (bus, device, _function, register) =
let (bus, device, function, register) =
parse_config_address(self.config_address & !0x8000_0000);
// Only support one bus.
@ -133,6 +133,11 @@ impl PciConfigIo {
return 0xffff_ffff;
}
// Don't support multi-function devices.
if function > 0 {
return 0xffff_ffff;
}
self.devices.get(device).map_or(0xffff_ffff, |d| {
d.lock().unwrap().read_config_register(register)
})