From b6ae2ccda46a3d308bf7b05230c38c50d11fd2dc Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Fri, 26 Jul 2019 17:15:40 -0700 Subject: [PATCH] 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 --- pci/src/bus.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pci/src/bus.rs b/pci/src/bus.rs index 2ec374e6b..bc0c446fc 100644 --- a/pci/src/bus.rs +++ b/pci/src/bus.rs @@ -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) })