tools: add configuration to enable PPC host memory access
Tested: Successfully updated on a Zaius (PPC platform) using ipmilpc
Change-Id: Ic744f6e0ca40df7aa3d5f914e2baef58114fa71b
Signed-off-by: Rui Zhang <ruizhan@google.com>
diff --git a/README.md b/README.md
index 10e69ae..ea03fc0 100644
--- a/README.md
+++ b/README.md
@@ -209,6 +209,12 @@
------------------------ | -------
`--enable-update-status` | Enable use of update status file.
+If you would like to use host memory access to update on a PPC platform, this configuration option needs to be enabled.
+
+Option | Meaning
+--------------- | -------
+`--enable-ppc` | Enable PPC host memory access.
+
### Internal Configuration Details
The following variables can be set to whatever you wish, however they have
diff --git a/configure.ac b/configure.ac
index da2b0a9..4863dc1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -145,6 +145,15 @@
# Configurability
+# Enable ppc host memory access
+AC_ARG_ENABLE([ppc],
+ AS_HELP_STRING([--enable-ppc],
+ [Enable ppc host memory access.]))
+AM_CONDITIONAL([ENABLE_PPC], [test "x$enable_ppc" = "xyes"])
+AS_IF([test "x$enable_ppc" = "xyes"], [
+ AX_APPEND_COMPILE_FLAGS([-DENABLE_PPC], [CXXFLAGS])
+])
+
# Enable the reboot update mechanism
AC_ARG_ENABLE([reboot-update],
AS_HELP_STRING([--enable-reboot-update],
diff --git a/tools/io.hpp b/tools/io.hpp
index 48e70bf..8760aec 100644
--- a/tools/io.hpp
+++ b/tools/io.hpp
@@ -71,7 +71,7 @@
class PpcMemDevice : public HostIoInterface
{
public:
- explicit PpcMemDevice(const std::string ppcMemPath,
+ explicit PpcMemDevice(const std::string& ppcMemPath,
const internal::Sys* sys = &internal::sys_impl) :
ppcMemPath(ppcMemPath),
sys(sys)
diff --git a/tools/main.cpp b/tools/main.cpp
index 9746a6d..207fcdd 100644
--- a/tools/main.cpp
+++ b/tools/main.cpp
@@ -210,7 +210,12 @@
auto ipmi = ipmiblob::IpmiHandler::CreateIpmiHandler();
ipmiblob::BlobHandler blob(std::move(ipmi));
+#ifdef ENABLE_PPC
+ const std::string ppcMemPath = "/sys/kernel/debug/powerpc/lpc/fw";
+ host_tool::PpcMemDevice devmem(ppcMemPath);
+#else
host_tool::DevMemDevice devmem;
+#endif
host_tool::PciUtilImpl pci;
host_tool::ProgressStdoutIndicator progress;