mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-23 03:06:52 -04:00
bpc.mitm/exo: support pmic reboot/shutdown on mariko (thanks @CTCaer)
This commit is contained in:
parent
71d0274884
commit
2ec3e141c7
7 changed files with 54 additions and 15 deletions
|
@ -70,6 +70,15 @@ namespace ams::secmon {
|
|||
|
||||
}
|
||||
|
||||
void PerformUserRebootByPmic() {
|
||||
/* Ensure that i2c-5 is usable for communicating with the pmic. */
|
||||
clkrst::EnableI2c5Clock();
|
||||
i2c::Initialize(i2c::Port_5);
|
||||
|
||||
/* Reboot. */
|
||||
pmic::ShutdownSystem(true);
|
||||
}
|
||||
|
||||
void PerformUserRebootToRcm() {
|
||||
/* Configure the bootrom to boot to rcm. */
|
||||
reg::Write(PMC + APBDEV_PMC_SCRATCH0, 0x2);
|
||||
|
@ -100,11 +109,20 @@ namespace ams::secmon {
|
|||
}
|
||||
|
||||
void PerformUserShutDown() {
|
||||
/* Load our reboot stub to iram. */
|
||||
LoadRebootStub(RebootStubAction_ShutDown);
|
||||
if (fuse::GetSocType() == fuse::SocType_Mariko) {
|
||||
/* Ensure that i2c-5 is usable for communicating with the pmic. */
|
||||
clkrst::EnableI2c5Clock();
|
||||
i2c::Initialize(i2c::Port_5);
|
||||
|
||||
/* Reboot. */
|
||||
PerformPmcReboot();
|
||||
/* On Mariko shutdown via pmic. */
|
||||
pmic::ShutdownSystem(false);
|
||||
} else /* if (fuse::GetSocType() == fuse::SocType_Erista) */ {
|
||||
/* Load our reboot stub to iram. */
|
||||
LoadRebootStub(RebootStubAction_ShutDown);
|
||||
|
||||
/* Reboot. */
|
||||
PerformPmcReboot();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,11 +23,13 @@ namespace ams::secmon {
|
|||
UserRebootType_ToRcm = 1,
|
||||
UserRebootType_ToPayload = 2,
|
||||
UserRebootType_ToFatalError = 3,
|
||||
UserRebootType_ByPmic = 4,
|
||||
};
|
||||
|
||||
void PerformUserRebootToRcm();
|
||||
void PerformUserRebootToPayload();
|
||||
void PerformUserRebootToFatalError();
|
||||
void PerformUserRebootByPmic();
|
||||
void PerformUserShutDown();
|
||||
|
||||
}
|
||||
|
|
|
@ -357,6 +357,9 @@ namespace ams::secmon::smc {
|
|||
case UserRebootType_ToFatalError:
|
||||
PerformUserRebootToFatalError();
|
||||
break;
|
||||
case UserRebootType_ByPmic:
|
||||
PerformUserRebootByPmic();
|
||||
break;
|
||||
default:
|
||||
return SmcResult::InvalidArgument;
|
||||
}
|
||||
|
@ -365,18 +368,17 @@ namespace ams::secmon::smc {
|
|||
case UserRebootType_ToFatalError:
|
||||
PerformUserRebootToFatalError();
|
||||
break;
|
||||
case UserRebootType_ByPmic:
|
||||
PerformUserRebootByPmic();
|
||||
break;
|
||||
default:
|
||||
return SmcResult::InvalidArgument;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ConfigItem::ExosphereNeedsShutdown:
|
||||
if (soc_type == fuse::SocType_Erista) {
|
||||
if (args.r[3] != 0) {
|
||||
PerformUserShutDown();
|
||||
}
|
||||
} else /* if (soc_type == fuse::SocType_Mariko) */ {
|
||||
return SmcResult::NotSupported;
|
||||
if (args.r[3] != 0) {
|
||||
PerformUserShutDown();
|
||||
}
|
||||
break;
|
||||
case ConfigItem::ExospherePayloadAddress:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue