From b160d6f3b3cdcd6a293c33cd89dcc46ab54c3264 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Sun, 3 Nov 2019 21:35:57 +0100 Subject: pci-arbiter: Use libpciaccess instead of embedding it This patch removes all embedded pciaccess code from the arbiter and instead uses the external pciaccess library. * pci-arbiter/Makefile: * Remove pci_access.c and x86_pci.c from the sources. * pci-arbiter/func_files.c: * io_config_file: Use a harcoded PCI config size. * read_rom_file: Grab the full rom first, then return the requested amount. * pci-arbiter/main.c: * main: Call create_fs_tree() w/o pci_sys. Since it's not part of the translator anymore. * pci-arbiter/netfs_impl.c: * netfs_attempt_read: Send pci_device_cfg_read() as the read op. * netfs_attempt_write: Send pci_device_cfg_write() as the write op. * pci-arbiter/pci-ops.c: * S_pci_conf_read: Call libpciaccess' pci_device_cfg_read(). * S_pci_conf_write: Call libpciaccess' pci_device_cfg_write(). * S_pci_get_dev_rom: Set rom.base_addr to zero for the moment, until libpciaccess esposes it properly. * pci-arbiter/pci_access.c: Deleted * pci-arbiter/pci_access.h: Deleted * pci-arbiter/pcifs.c: * create_fs_tree: Remove the pci_sys parameter. Use libpciaccess' iterator. Use a hardcoded config space size. * pci-arbiter/pcifs.h: Definitions for changes in pcifs.c. * pci-arbiter/x86_pci.c: Deleted. * pci-arbiter/x86_pci.h: Deleted. --- pci-arbiter/pci-ops.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pci-arbiter/pci-ops.c') diff --git a/pci-arbiter/pci-ops.c b/pci-arbiter/pci-ops.c index 328db5b2..8279540a 100644 --- a/pci-arbiter/pci-ops.c +++ b/pci-arbiter/pci-ops.c @@ -25,7 +25,7 @@ #include #include -#include "pci_access.h" +#include #include "pcifs.h" #include "func_files.h" @@ -112,7 +112,7 @@ S_pci_conf_read (struct protid * master, int reg, char **data, * libnetfs which is multi-threaded. A lock is needed for arbitration. */ pthread_mutex_lock (lock); - err = pci_sys->read (e->bus, e->dev, e->func, reg, *data, amount); + err = pci_device_cfg_read (e->device, *data, reg, amount, NULL); pthread_mutex_unlock (lock); if (!err) @@ -149,7 +149,7 @@ S_pci_conf_write (struct protid * master, int reg, char *data, size_t datalen, return err; pthread_mutex_lock (lock); - err = pci_sys->write (e->bus, e->dev, e->func, reg, data, datalen); + err = pci_device_cfg_write (e->device, data, reg, datalen, NULL); pthread_mutex_unlock (lock); if (!err) @@ -260,7 +260,7 @@ S_pci_get_dev_rom (struct protid * master, char **data, size_t * datalen) } /* Copy the regions info */ - rom.base_addr = e->device->rom_base; + rom.base_addr = 0; // pci_device_private only rom.size = e->device->rom_size; memcpy (*data, &rom, size); -- cgit v1.2.3