Exosphere: Add extension to perform a reboot to rcm.

This commit is contained in:
Michael Scire 2018-11-30 04:57:17 -08:00
parent 25956c4fa1
commit 8d3b8354c3
2 changed files with 20 additions and 4 deletions

View file

@ -31,11 +31,22 @@ static bool g_battery_profile = false;
static bool g_debugmode_override_user = false, g_debugmode_override_priv = false; static bool g_debugmode_override_user = false, g_debugmode_override_priv = false;
uint32_t configitem_set(bool privileged, ConfigItem item, uint64_t value) { uint32_t configitem_set(bool privileged, ConfigItem item, uint64_t value) {
if (item != CONFIGITEM_BATTERYPROFILE) { switch (item) {
return 2; case CONFIGITEM_BATTERYPROFILE:
g_battery_profile = (value != 0);
break;
case CONFIGITEM_NEEDS_REBOOT_TO_RCM:
/* Force a reboot to RCM. */
{
MAKE_REG32(0x7000E450) = 0x2;
MAKE_REG32(0x7000E400) = 0x10;
while (1) { }
}
break;
default:
return 2;
} }
g_battery_profile = (value != 0);
return 0; return 0;
} }
@ -167,6 +178,10 @@ uint32_t configitem_get(bool privileged, ConfigItem item, uint64_t *p_outvalue)
((uint64_t)(exosphere_get_target_firmware() & 0xFF) << 8ull) | ((uint64_t)(exosphere_get_target_firmware() & 0xFF) << 8ull) |
((uint64_t)(mkey_get_revision() & 0xFF) << 0ull); ((uint64_t)(mkey_get_revision() & 0xFF) << 0ull);
break; break;
case CONFIGITEM_NEEDS_REBOOT_TO_RCM:
/* UNOFFICIAL: The fact that we are executing means we aren't in the process of rebooting to rcm. */
*p_outvalue = 0;
break;
default: default:
result = 2; result = 2;
break; break;

View file

@ -40,7 +40,8 @@ typedef enum {
CONFIGITEM_PACKAGE2HASH_5X = 17, CONFIGITEM_PACKAGE2HASH_5X = 17,
/* These are unofficial, for usage by Exosphere. */ /* These are unofficial, for usage by Exosphere. */
CONFIGITEM_EXOSPHERE_VERSION = 65000 CONFIGITEM_EXOSPHERE_VERSION = 65000,
CONFIGITEM_NEEDS_REBOOT_TO_RCM = 65001,
} ConfigItem; } ConfigItem;
uint32_t configitem_set(bool privileged, ConfigItem item, uint64_t value); uint32_t configitem_set(bool privileged, ConfigItem item, uint64_t value);