New total reboot counter handling #708
@ -1209,45 +1209,7 @@ ReturnValue_t CoreController::actionXscReboot(const uint8_t *data, size_t size)
|
|||||||
auto tgtChip = static_cast<xsc::Chip>(data[1]);
|
auto tgtChip = static_cast<xsc::Chip>(data[1]);
|
||||||
auto tgtCopy = static_cast<xsc::Copy>(data[2]);
|
auto tgtCopy = static_cast<xsc::Copy>(data[2]);
|
||||||
|
|
||||||
// This function can not really fail
|
performGracefulShutdown(tgtChip, tgtCopy);
|
||||||
gracefulShutdownTasks(tgtChip, tgtCopy, protOpPerformed);
|
|
||||||
|
|
||||||
switch (tgtChip) {
|
|
||||||
case (xsc::Chip::CHIP_0): {
|
|
||||||
switch (tgtCopy) {
|
|
||||||
case (xsc::Copy::COPY_0): {
|
|
||||||
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_NOMINAL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (xsc::Copy::COPY_1): {
|
|
||||||
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_GOLD);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (xsc::Chip::CHIP_1): {
|
|
||||||
switch (tgtCopy) {
|
|
||||||
case (xsc::Copy::COPY_0): {
|
|
||||||
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_NOMINAL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (xsc::Copy::COPY_1): {
|
|
||||||
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_GOLD);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1267,7 +1229,8 @@ ReturnValue_t CoreController::gracefulShutdownTasks(xsc::Chip chip, xsc::Copy co
|
|||||||
// Attempt graceful shutdown by unmounting and switching off SD cards
|
// Attempt graceful shutdown by unmounting and switching off SD cards
|
||||||
sdcMan->switchOffSdCard(sd::SdCard::SLOT_0);
|
sdcMan->switchOffSdCard(sd::SdCard::SLOT_0);
|
||||||
sdcMan->switchOffSdCard(sd::SdCard::SLOT_1);
|
sdcMan->switchOffSdCard(sd::SdCard::SLOT_1);
|
||||||
// If any boot copies are unprotected
|
// If any boot copies are unprotected.
|
||||||
|
// Actually this function only ensures that reboots to the own image are protected..
|
||||||
ReturnValue_t result = setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
ReturnValue_t result = setBootCopyProtection(xsc::Chip::SELF_CHIP, xsc::Copy::SELF_COPY, true,
|
||||||
protOpPerformed, false);
|
protOpPerformed, false);
|
||||||
if (result == returnvalue::OK and protOpPerformed) {
|
if (result == returnvalue::OK and protOpPerformed) {
|
||||||
@ -1739,8 +1702,7 @@ void CoreController::performRebootWatchdogHandling(bool recreateFile) {
|
|||||||
rebootWatchdogFile.mechanismNextChip = tgtChip;
|
rebootWatchdogFile.mechanismNextChip = tgtChip;
|
||||||
rebootWatchdogFile.mechanismNextCopy = tgtCopy;
|
rebootWatchdogFile.mechanismNextCopy = tgtCopy;
|
||||||
rewriteRebootWatchdogFile(rebootWatchdogFile);
|
rewriteRebootWatchdogFile(rebootWatchdogFile);
|
||||||
xsc_boot_copy(static_cast<xsc_libnor_chip_t>(tgtChip),
|
performGracefulShutdown(tgtChip, tgtCopy);
|
||||||
static_cast<xsc_libnor_copy_t>(tgtCopy));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rebootWatchdogFile.mechanismNextChip = xsc::NO_CHIP;
|
rebootWatchdogFile.mechanismNextChip = xsc::NO_CHIP;
|
||||||
@ -2563,6 +2525,50 @@ void CoreController::announceCurrentImageInfo() {
|
|||||||
triggerEvent(CURRENT_IMAGE_INFO, CURRENT_CHIP, CURRENT_COPY);
|
triggerEvent(CURRENT_IMAGE_INFO, CURRENT_CHIP, CURRENT_COPY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t CoreController::performGracefulShutdown(xsc::Chip tgtChip, xsc::Copy tgtCopy) {
|
||||||
|
bool protOpPerformed = false;
|
||||||
|
// This function can not really fail
|
||||||
|
gracefulShutdownTasks(tgtChip, tgtCopy, protOpPerformed);
|
||||||
|
|
||||||
|
switch (tgtChip) {
|
||||||
|
case (xsc::Chip::CHIP_0): {
|
||||||
|
switch (tgtCopy) {
|
||||||
|
case (xsc::Copy::COPY_0): {
|
||||||
|
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_NOMINAL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (xsc::Copy::COPY_1): {
|
||||||
|
xsc_boot_copy(XSC_LIBNOR_CHIP_0, XSC_LIBNOR_COPY_GOLD);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (xsc::Chip::CHIP_1): {
|
||||||
|
switch (tgtCopy) {
|
||||||
|
case (xsc::Copy::COPY_0): {
|
||||||
|
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_NOMINAL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (xsc::Copy::COPY_1): {
|
||||||
|
xsc_boot_copy(XSC_LIBNOR_CHIP_1, XSC_LIBNOR_COPY_GOLD);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return returnvalue::OK;
|
||||||
|
}
|
||||||
|
|
||||||
bool CoreController::isNumber(const std::string &s) {
|
bool CoreController::isNumber(const std::string &s) {
|
||||||
return !s.empty() && std::find_if(s.begin(), s.end(),
|
return !s.empty() && std::find_if(s.begin(), s.end(),
|
||||||
[](unsigned char c) { return !std::isdigit(c); }) == s.end();
|
[](unsigned char c) { return !std::isdigit(c); }) == s.end();
|
||||||
|
@ -363,6 +363,7 @@ class CoreController : public ExtendedControllerBase, public ReceivesParameterMe
|
|||||||
const uint8_t* data, size_t size);
|
const uint8_t* data, size_t size);
|
||||||
ReturnValue_t actionListDirectoryDumpDirectly(ActionId_t actionId, MessageQueueId_t commandedBy,
|
ReturnValue_t actionListDirectoryDumpDirectly(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||||
const uint8_t* data, size_t size);
|
const uint8_t* data, size_t size);
|
||||||
|
ReturnValue_t performGracefulShutdown(xsc::Chip targetChip, xsc::Copy targetCopy);
|
||||||
|
|
||||||
ReturnValue_t actionListDirectoryCommonCommandCreator(const uint8_t* data, size_t size,
|
ReturnValue_t actionListDirectoryCommonCommandCreator(const uint8_t* data, size_t size,
|
||||||
std::ostringstream& oss);
|
std::ostringstream& oss);
|
||||||
|
Loading…
Reference in New Issue
Block a user