tools: tie devmem io handler into lpc handler
The lpc handler requires mapping memory on the host.
Change-Id: Ic851dfa6c06d10566f66153ce7915cf5ad66992b
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/tools/lpc.hpp b/tools/lpc.hpp
index 21c776d..1ccecc2 100644
--- a/tools/lpc.hpp
+++ b/tools/lpc.hpp
@@ -3,6 +3,7 @@
#include "blob_interface.hpp"
#include "interface.hpp"
#include "internal/sys.hpp"
+#include "io.hpp"
#include <cstdint>
@@ -20,10 +21,10 @@
class LpcDataHandler : public DataInterface
{
public:
- LpcDataHandler(BlobInterface* blob,
+ LpcDataHandler(BlobInterface* blob, HostIoInterface* io,
const internal::Sys* sys = &internal::sys_impl) :
blob(blob),
- sys(sys){};
+ io(io), sys(sys){};
bool sendContents(const std::string& input, std::uint16_t session) override;
blobs::FirmwareBlobHandler::UpdateFlags supportedType() const override
@@ -33,6 +34,7 @@
private:
BlobInterface* blob;
+ HostIoInterface* io;
const internal::Sys* sys;
};
diff --git a/tools/main.cpp b/tools/main.cpp
index 547d50e..ada34bb 100644
--- a/tools/main.cpp
+++ b/tools/main.cpp
@@ -16,6 +16,7 @@
#include "blob_handler.hpp"
#include "bt.hpp"
+#include "io.hpp"
#include "ipmi_handler.hpp"
#include "lpc.hpp"
#include "tool_errors.hpp"
@@ -138,6 +139,7 @@
host_tool::IpmiHandler ipmi;
host_tool::BlobHandler blob(&ipmi);
+ host_tool::DevMemDevice devmem;
std::unique_ptr<host_tool::DataInterface> handler;
@@ -148,7 +150,8 @@
}
else if (interface == IPMILPC)
{
- handler = std::make_unique<host_tool::LpcDataHandler>(&blob);
+ handler =
+ std::make_unique<host_tool::LpcDataHandler>(&blob, &devmem);
}
if (!handler)