bmc: firmware-handler: lpc: minor cleanup
Moves the setInitializedAndReturn method to the source file to remove
the exception dependency from the header.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I17ad9a116f47e729dd5b12b6279ea6986529e6ca
diff --git a/bmc/firmware-handler/lpc_handler.cpp b/bmc/firmware-handler/lpc_handler.cpp
index e3a5e08..c27bbe6 100644
--- a/bmc/firmware-handler/lpc_handler.cpp
+++ b/bmc/firmware-handler/lpc_handler.cpp
@@ -16,13 +16,36 @@
#include "lpc_handler.hpp"
+#include "mapper_errors.hpp"
+
#include <cstdint>
+#include <cstdio>
#include <cstring>
#include <vector>
namespace ipmi_flash
{
+bool LpcDataHandler::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;
+}
+
bool LpcDataHandler::open()
{
/* For the ASPEED LPC CTRL driver, the ioctl is required to set up the