diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index 79be157..04a720e 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h @@ -60,12 +60,13 @@ int pci_init(void); * @param vendor_id The device's vendor ID * @param device_id the device's ID * @param info Pointer to the record pci_info_t where among other the IObase address will be stored + * @param base Search for the preferred IO address. Zero, if any address is useful * * @return * - 0 on success * - -EINVAL on failure */ -int pci_get_device_info(uint32_t vendor_id, uint32_t device_id, pci_info_t* info); +int pci_get_device_info(uint32_t vendor_id, uint32_t device_id, uint32_t base, pci_info_t* info); #ifdef WITH_PCI_NAMES /** @brief Print information of existing pci adapters diff --git a/arch/x86/kernel/pci.c b/arch/x86/kernel/pci.c index d0bb458..67c4be6 100644 --- a/arch/x86/kernel/pci.c +++ b/arch/x86/kernel/pci.c @@ -143,7 +143,7 @@ int pci_init(void) return 0; } -int pci_get_device_info(uint32_t vendor_id, uint32_t device_id, pci_info_t* info) +int pci_get_device_info(uint32_t vendor_id, uint32_t device_id, uint32_t base, pci_info_t* info) { uint32_t slot, bus, i; @@ -166,6 +166,9 @@ int pci_get_device_info(uint32_t vendor_id, uint32_t device_id, pci_info_t* info info->size[i] = (info->base[i]) ? pci_what_size(bus, slot, i) : 0; } info->irq = pci_what_irq(bus, slot); + if (base) + if (!(info->base[0] == base)) + continue; return 0; } }