From a4d6be1b3dcffc04df36c7d9d0786da46610023d Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Mon, 13 Apr 2015 11:00:46 +0200 Subject: [PATCH] wifi: use io mem via device interface Issue #1487 --- repos/dde_linux/src/lib/wifi/pci_driver.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/repos/dde_linux/src/lib/wifi/pci_driver.cc b/repos/dde_linux/src/lib/wifi/pci_driver.cc index b3d3a8b17..08fb585c0 100644 --- a/repos/dde_linux/src/lib/wifi/pci_driver.cc +++ b/repos/dde_linux/src/lib/wifi/pci_driver.cc @@ -354,15 +354,19 @@ extern "C" void *pci_ioremap_bar(struct pci_dev *dev, int bar) { using namespace Genode; + if (bar >= DEVICE_COUNT_RESOURCE || bar < 0) + return 0; + size_t start = pci_resource_start(dev, bar); size_t size = pci_resource_len(dev, bar); if (!start) return 0; - Io_mem_connection *io_mem; + Io_mem_session_client *io_mem; try { - io_mem = new (env()->heap()) Io_mem_connection(start, size, 0); + Pci::Device_client device(pci_device_cap); + io_mem = new (env()->heap()) Io_mem_session_client(device.io_mem(device.phys_bar_to_virt(bar))); } catch (...) { PERR("Failed to request I/O memory: [%zx,%zx)", start, start + size); return 0;