From 88d7363db23f8dba06ed260e10b5c7f40538565c Mon Sep 17 00:00:00 2001 From: Joan Lledó Date: Sun, 13 Sep 2020 20:16:16 +0200 Subject: pci-arbiter: Probe devices and map regions This adapts the arbiter to a bug fixed in libpciaccess. We were relying on the library to probe devices and map regions but it's the arbiter who should do it. * pci-arbiter/pcifs.c: * create_fs_tree(): probe the device to find regions and rom * pci-arbiter/func_files.c: * io_region_file(): map region on the first access attempt --- pci-arbiter/pcifs.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'pci-arbiter/pcifs.c') diff --git a/pci-arbiter/pcifs.c b/pci-arbiter/pcifs.c index 615e8753..0535779e 100644 --- a/pci-arbiter/pcifs.c +++ b/pci-arbiter/pcifs.c @@ -180,12 +180,17 @@ create_fs_tree (struct pcifs * fs) nentries += 2; /* func dir + config */ - for (j = 0; j < 6; j++) - if (device->regions[j].size > 0) - nentries++; /* + memory region */ + /* Probe the device to find regions and rom */ + err = pci_device_probe (device); + if (!err) + { + for (j = 0; j < 6; j++) + if (device->regions[j].size > 0) + nentries++; /* + memory region */ - if (device->rom_size) - nentries++; /* + rom */ + if (device->rom_size) + nentries++; /* + rom */ + } } pci_iterator_destroy(iter); -- cgit v1.2.3