From a76deac0262afd868ee27030f0f65800f8363019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Thu, 7 Nov 2013 06:03:49 +0000 Subject: [PATCH] fixed multi-function devices --- BaS_gcc/sources/pci.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/BaS_gcc/sources/pci.c b/BaS_gcc/sources/pci.c index 693fab9..6e8ca13 100644 --- a/BaS_gcc/sources/pci.c +++ b/BaS_gcc/sources/pci.c @@ -246,13 +246,16 @@ int16_t pci_find_device(uint16_t device_id, uint16_t vendor_id, int index) if (vendor_id == 0xffff || (PCI_VENDOR_ID(value) == vendor_id && PCI_DEVICE_ID(value) == device_id)) { - return handle; - } - else - { - /* found a match, but at wrong position */ - pos++; - continue; + if (pos == index) + { + return handle; + } + else + { + /* found a match, but at wrong position */ + pos++; + continue; + } } } }