summaryrefslogtreecommitdiffstats
path: root/static
diff options
context:
space:
mode:
authorLei YU <mine260309@gmail.com>2019-03-14 14:41:53 +0800
committerLei YU <mine260309@gmail.com>2019-03-18 11:25:47 +0800
commite499446423d6ebe96f74e079de36a8929d47277b (patch)
tree228794ab38e5e46e06fee89ae462244779a84d10 /static
parent7d832d7d30acfe942c7bb924ca14b9edaddca049 (diff)
downloadopenpower-pnor-code-mgmt-e499446423d6ebe96f74e079de36a8929d47277b.tar.gz
openpower-pnor-code-mgmt-e499446423d6ebe96f74e079de36a8929d47277b.zip
Refactor: Use hiomapd instead of mboxd
mbox service is renamed to hiomapd and provides "Suspend" and "Resume" method calls, which is more appropriate for raw "cmd" calls. Use the new methods to suspend and resume hiomapd. Move "getService()" function into utils so it is shared by multiple files. Tested: Verify the reset works on Romulus Change-Id: I8f89de134b13126697bfc69a21a3148a01c34cca Signed-off-by: Lei YU <mine260309@gmail.com>
Diffstat (limited to 'static')
-rw-r--r--static/item_updater_static.cpp73
1 files changed, 5 insertions, 68 deletions
diff --git a/static/item_updater_static.cpp b/static/item_updater_static.cpp
index d5940b638..b79028bc7 100644
--- a/static/item_updater_static.cpp
+++ b/static/item_updater_static.cpp
@@ -3,6 +3,7 @@
#include "item_updater_static.hpp"
#include "activation_static.hpp"
+#include "utils.hpp"
#include "version.hpp"
#include <array>
@@ -199,9 +200,6 @@ namespace software
{
namespace updater
{
-// TODO: Change paths once openbmc/openbmc#1663 is completed.
-constexpr auto MBOXD_INTERFACE = "org.openbmc.mboxd";
-constexpr auto MBOXD_PATH = "/org/openbmc/mboxd";
std::unique_ptr<Activation> ItemUpdaterStatic::createActivationObject(
const std::string& path, const std::string& versionId,
@@ -308,44 +306,15 @@ void ItemUpdaterStatic::processPNORImage()
void ItemUpdaterStatic::reset()
{
auto partitions = utils::getPartsToClear();
- std::vector<uint8_t> mboxdArgs;
- // Suspend mboxd - no args required.
- auto dbusCall = bus.new_method_call(MBOXD_INTERFACE, MBOXD_PATH,
- MBOXD_INTERFACE, "cmd");
- dbusCall.append(static_cast<uint8_t>(3), mboxdArgs);
+ utils::hiomapdSuspend(bus);
- try
- {
- bus.call_noreply(dbusCall);
- }
- catch (const SdBusError& e)
- {
- log<level::ERR>("Error in mboxd suspend call",
- entry("ERROR=%s", e.what()));
- elog<InternalFailure>();
- }
for (auto p : partitions)
{
utils::pnorClear(p.first, p.second);
}
- // Resume mboxd with arg 1, indicating that the flash was modified.
- dbusCall = bus.new_method_call(MBOXD_INTERFACE, MBOXD_PATH, MBOXD_INTERFACE,
- "cmd");
- mboxdArgs.push_back(1);
- dbusCall.append(static_cast<uint8_t>(4), mboxdArgs);
-
- try
- {
- bus.call_noreply(dbusCall);
- }
- catch (const SdBusError& e)
- {
- log<level::ERR>("Error in mboxd resume call",
- entry("ERROR=%s", e.what()));
- elog<InternalFailure>();
- }
+ utils::hiomapdResume(bus);
}
bool ItemUpdaterStatic::isVersionFunctional(const std::string& versionId)
@@ -390,43 +359,11 @@ void ItemUpdaterStatic::updateFunctionalAssociation(
void GardResetStatic::reset()
{
// Clear gard partition
- std::vector<uint8_t> mboxdArgs;
-
- auto dbusCall = bus.new_method_call(MBOXD_INTERFACE, MBOXD_PATH,
- MBOXD_INTERFACE, "cmd");
- // Suspend mboxd - no args required.
- dbusCall.append(static_cast<uint8_t>(3), mboxdArgs);
+ utils::hiomapdSuspend(bus);
- try
- {
- bus.call_noreply(dbusCall);
- }
- catch (const SdBusError& e)
- {
- log<level::ERR>("Error in mboxd suspend call",
- entry("ERROR=%s", e.what()));
- elog<InternalFailure>();
- }
-
- // Clear guard partition
utils::pnorClear("GUARD");
- dbusCall = bus.new_method_call(MBOXD_INTERFACE, MBOXD_PATH, MBOXD_INTERFACE,
- "cmd");
- // Resume mboxd with arg 1, indicating that the flash is modified.
- mboxdArgs.push_back(1);
- dbusCall.append(static_cast<uint8_t>(4), mboxdArgs);
-
- try
- {
- bus.call_noreply(dbusCall);
- }
- catch (const SdBusError& e)
- {
- log<level::ERR>("Error in mboxd resume call",
- entry("ERROR=%s", e.what()));
- elog<InternalFailure>();
- }
+ utils::hiomapdResume(bus);
}
} // namespace updater
OpenPOWER on IntegriCloud