bmc: lpc: add support for lpc mapping and copying
The lpc handler object now handles copying the data after the window is
mapped, but the hardware specific pieces still play in dealing with the
driver directly.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I2f448411fd4ef9b61b5d1158915c70902b16666b
diff --git a/lpc_handler.hpp b/lpc_handler.hpp
index cbdf8ef..4158b9b 100644
--- a/lpc_handler.hpp
+++ b/lpc_handler.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "data_handler.hpp"
+#include "mapper_errors.hpp"
#include "window_hw_interface.hpp"
#include <cstdint>
@@ -45,12 +46,37 @@
private:
bool setInitializedAndReturn(bool value)
{
+ if (value)
+ {
+ try
+ {
+ /* Try really opening the map. */
+ memory = mapper->open();
+ }
+ catch (const MapperException& e)
+ {
+ std::fprintf(stderr, "received mapper exception: %s\n",
+ e.what());
+ return false;
+ }
+ }
+
initialized = value;
return value;
}
std::unique_ptr<HardwareMapperInterface> mapper;
bool initialized;
+ /* The LPC Handler does not take ownership of this, in case there's cleanup
+ * required for close()
+ */
+ MemorySet memory = {};
+
+ /* Offset in reserved memory at which host data arrives. */
+ /* Size of the chunk of the memory region in use by the host (e.g.
+ * mapped over external block mechanism).
+ */
+ WindowMapResult mappingResult = {};
};
} // namespace ipmi_flash