diff --git a/linux/payload/FreshMpsocHandler.cpp b/linux/payload/FreshMpsocHandler.cpp index 64134fef..723f366a 100644 --- a/linux/payload/FreshMpsocHandler.cpp +++ b/linux/payload/FreshMpsocHandler.cpp @@ -350,26 +350,19 @@ void FreshMpsocHandler::dataReceived(ActionId_t actionId, const uint8_t* data, u } void FreshMpsocHandler::completionSuccessfulReceived(ActionId_t actionId) { - if (actionId == supv::ACK_REPORT) { - // I seriously don't know why this happens.. - // sif::warning - // << "FreshMpsocHandler::completionSuccessfulReceived: Only received ACK report. - // Consider - // " - // "increasing the MPSoC boot timer." - // << std::endl; - } else if (actionId != supv::EXE_REPORT) { - sif::warning << "FreshMpsocHandler::completionSuccessfulReceived: Did not expect the action " - << "ID " << actionId << std::endl; - return; - } switch (powerState) { case PowerState::PENDING_STARTUP: { + if (actionId != supv::START_MPSOC) { + return; + } mpsocBootTransitionCd.resetTimer(); powerState = PowerState::DONE; break; } case PowerState::PENDING_SHUTDOWN: { + if (actionId != supv::SHUTDOWN_MPSOC) { + return; + } powerState = PowerState::DONE; break; } @@ -380,21 +373,15 @@ void FreshMpsocHandler::completionSuccessfulReceived(ActionId_t actionId) { } void FreshMpsocHandler::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) { - handleActionCommandFailure(actionId); + handleActionCommandFailure(actionId, returnCode); } -void FreshMpsocHandler::handleActionCommandFailure(ActionId_t actionId) { - switch (actionId) { - case supv::ACK_REPORT: - case supv::EXE_REPORT: - break; - default: - sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Did not expect the action ID " - << actionId << std::endl; - return; - } +void FreshMpsocHandler::handleActionCommandFailure(ActionId_t actionId, ReturnValue_t returnCode) { switch (powerState) { case PowerState::PENDING_STARTUP: { + if (actionId != supv::START_MPSOC) { + return; + } sif::info << "PlocMPSoCHandler::handleActionCommandFailure: MPSoC boot command failed" << std::endl; // This is commonly the case when the MPSoC is already operational. Thus the power state is @@ -404,6 +391,9 @@ void FreshMpsocHandler::handleActionCommandFailure(ActionId_t actionId) { case PowerState::PENDING_SHUTDOWN: { // FDIR will intercept event and switch PLOC power off triggerEvent(mpsoc::MPSOC_SHUTDOWN_FAILED); + if (actionId != supv::SHUTDOWN_MPSOC) { + return; + } sif::warning << "PlocMPSoCHandler::handleActionCommandFailure: Failed to shutdown MPSoC" << std::endl; break; diff --git a/linux/payload/FreshMpsocHandler.h b/linux/payload/FreshMpsocHandler.h index d5a6db21..842a9d5d 100644 --- a/linux/payload/FreshMpsocHandler.h +++ b/linux/payload/FreshMpsocHandler.h @@ -162,7 +162,7 @@ class FreshMpsocHandler : public FreshDeviceHandlerBase, public CommandsActionsI ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper* parameterWrapper, const ParameterWrapper* newValues, uint16_t startAtIndex) override; - void handleActionCommandFailure(ActionId_t actionId); + void handleActionCommandFailure(ActionId_t actionId, ReturnValue_t returnCode); ReturnValue_t executeRegularCmd(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t* data, size_t dataLen); void handleTransitionToOn(); diff --git a/linux/payload/FreshSupvHandler.cpp b/linux/payload/FreshSupvHandler.cpp index 4bf89f01..1252f9d8 100644 --- a/linux/payload/FreshSupvHandler.cpp +++ b/linux/payload/FreshSupvHandler.cpp @@ -1299,7 +1299,7 @@ void FreshSupvHandler::handleExecutionFailureReport(ActiveCmdInfo& info, Executi triggerEvent(SUPV_EXE_FAILURE, info.commandId, static_cast(report.getStatusCode())); } if (info.commandedBy) { - actionHelper.finish(false, info.commandedBy, info.commandId, report.getStatusCode()); + actionHelper.finish(false, info.commandedBy, info.commandId, result::RECEIVED_EXE_FAILURE); } info.isPending = false; }