tools/pci: add Nuvoton bridge configuration
The Nuvoton PCI device requires the Memory Space bit to be set in its
command register in order to access the mailbox over MMIO.
Signed-off-by: Benjamin Fair <benjaminfair@google.com>
Change-Id: Ic262b907ae55c622999aa68891b618650ccad3f2
diff --git a/tools/pciaccess.hpp b/tools/pciaccess.hpp
index ea7d5b4..3b25594 100644
--- a/tools/pciaccess.hpp
+++ b/tools/pciaccess.hpp
@@ -21,6 +21,8 @@
#include <pciaccess.h>
} // extern "C"
+#include <cstdint>
+
namespace host_tool
{
@@ -38,6 +40,12 @@
virtual struct pci_device*
pci_device_next(struct pci_device_iterator* iter) const = 0;
virtual int pci_device_probe(struct pci_device* dev) const = 0;
+ virtual int pci_device_cfg_read_u8(struct pci_device* dev,
+ std::uint8_t* data,
+ pciaddr_t offset) const = 0;
+ virtual int pci_device_cfg_write_u8(struct pci_device* dev,
+ std::uint8_t data,
+ pciaddr_t offset) const = 0;
virtual int pci_device_map_range(struct pci_device* dev, pciaddr_t base,
pciaddr_t size, unsigned map_flags,
void** addr) const = 0;
@@ -61,6 +69,10 @@
struct pci_device*
pci_device_next(struct pci_device_iterator* iter) const override;
int pci_device_probe(struct pci_device* dev) const override;
+ int pci_device_cfg_read_u8(struct pci_device* dev, std::uint8_t* data,
+ pciaddr_t offset) const override;
+ int pci_device_cfg_write_u8(struct pci_device* dev, std::uint8_t data,
+ pciaddr_t offset) const override;
int pci_device_map_range(struct pci_device* dev, pciaddr_t base,
pciaddr_t size, unsigned map_flags,
void** addr) const override;