tools/pci: Use pci_device_enable() to enable bridge
Enabling the bridge by writing to the PCI config space does not enable
all the host resources required.
Use pci_device_enable api.
Signed-off-by: Vivekanand Veeracholan <vveerach@google.com>
Change-Id: I159a132b76eadc569efb8fb47488a4abd4c27404
diff --git a/tools/test/pciaccess_mock.hpp b/tools/test/pciaccess_mock.hpp
index a030a18..738a1b1 100644
--- a/tools/test/pciaccess_mock.hpp
+++ b/tools/test/pciaccess_mock.hpp
@@ -13,6 +13,7 @@
MOCK_CONST_METHOD1(pci_id_match_iterator_create,
struct pci_device_iterator*(const struct pci_id_match*));
MOCK_CONST_METHOD1(pci_iterator_destroy, void(struct pci_device_iterator*));
+ MOCK_CONST_METHOD1(pci_device_enable, void(struct pci_device*));
MOCK_CONST_METHOD1(pci_device_next,
struct pci_device*(struct pci_device_iterator*));
MOCK_CONST_METHOD1(pci_device_probe, int(struct pci_device*));
diff --git a/tools/test/tools_pci_unittest.cpp b/tools/test/tools_pci_unittest.cpp
index 7f69db2..6906851 100644
--- a/tools/test/tools_pci_unittest.cpp
+++ b/tools/test/tools_pci_unittest.cpp
@@ -317,6 +317,8 @@
pci_device_unmap_range(Eq(&dev), Eq(region), mockRegionSize))
.WillOnce(Return(0));
+ EXPECT_CALL(pciMock, pci_device_enable(Eq(&dev))).Times(1);
+
if (deviceExpectations)
param->expectSetup(pciMock, dev);
}