tools/pci: refactor PCI bridge
Use polymorphism to handle the differences between Aspeed and Nuvoton
PCI devices.
Add unit tests (now at 100% line coverage for tools/pci.cpp).
Signed-off-by: Benjamin Fair <benjaminfair@google.com>
Change-Id: I43e63ec5eb9fce5fb0fc74e0e69667dd13b7433f
diff --git a/tools/main.cpp b/tools/main.cpp
index dd43c11..3876844 100644
--- a/tools/main.cpp
+++ b/tools/main.cpp
@@ -20,6 +20,7 @@
#include "net.hpp"
#include "p2a.hpp"
#include "pci.hpp"
+#include "pciaccess.hpp"
#include "progress.hpp"
#include "tool_errors.hpp"
#include "updater.hpp"
@@ -249,9 +250,9 @@
}
else if (interface == IPMIPCI)
{
- auto& pci = host_tool::PciUtilImpl::getInstance();
- handler = std::make_unique<host_tool::P2aDataHandler>(
- &blob, &devmem, &pci, &progress);
+ auto& pci = host_tool::PciAccessImpl::getInstance();
+ handler = std::make_unique<host_tool::P2aDataHandler>(&blob, &pci,
+ &progress);
}
if (!handler)