exo: implement start of mariko fatal handler

This commit is contained in:
Michael Scire 2020-11-15 12:58:13 -08:00 committed by SciresM
parent 123ed80dc7
commit 7bcd5c6e3b
28 changed files with 1138 additions and 24 deletions

View file

@ -216,6 +216,8 @@ int main(int argc, char **argv)
boot::CheckBatteryCharge();
}
AMS_ABORT_UNLESS(spl::GetSocType() != spl::SocType_Mariko);
/* Configure pinmux + drive pads. */
boot::SetInitialPinmuxConfiguration();

View file

@ -43,7 +43,20 @@ namespace ams::boot {
}
}
void DoRebootToPayload(ams::FatalErrorContext *ctx) {
void DoRebootToPayload() {
/* Ensure clean IRAM state. */
ClearIram();
/* Copy in payload. */
for (size_t ofs = 0; ofs < fusee_primary_bin_size; ofs += sizeof(g_work_page)) {
std::memcpy(g_work_page, &fusee_primary_bin[ofs], std::min(static_cast<size_t>(fusee_primary_bin_size - ofs), sizeof(g_work_page)));
exosphere::CopyToIram(IramPayloadBase + ofs, g_work_page, sizeof(g_work_page));
}
exosphere::ForceRebootToIramPayload();
}
void DoRebootToFatalError(ams::FatalErrorContext *ctx) {
/* Ensure clean IRAM state. */
ClearIram();
@ -61,14 +74,14 @@ namespace ams::boot {
exosphere::CopyToIram(IramPayloadBase + IramFatalErrorContextOffset, g_work_page, sizeof(g_work_page));
}
exosphere::ForceRebootToIramPayload();
exosphere::ForceRebootToFatalError();
}
}
void RebootSystem() {
if (spl::GetSocType() == spl::SocType_Erista) {
DoRebootToPayload(nullptr);
DoRebootToPayload();
} else {
/* On Mariko, we can't reboot to payload, so we should just do a reboot. */
PmicDriver().RebootSystem();
@ -84,7 +97,7 @@ namespace ams::boot {
}
void RebootForFatalError(ams::FatalErrorContext *ctx) {
DoRebootToPayload(ctx);
DoRebootToFatalError(ctx);
}
}