1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-09 12:01:45 +00:00

nyx: Use full shutdown based reboot on T210B01

That's because of how the system is exploited.
This commit is contained in:
CTCaer 2020-12-02 01:45:12 +02:00
parent 0a9931ddb3
commit 0954eb2b09
3 changed files with 30 additions and 3 deletions

View file

@ -152,6 +152,23 @@ void reboot_rcm()
bpmp_halt();
}
void reboot_full()
{
sd_end();
hw_reinit_workaround(false, 0);
// Enable soft reset wake event.
u8 reg = i2c_recv_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_ONOFFCNFG2);
reg |= MAX77620_ONOFFCNFG2_SFT_RST_WK;
i2c_send_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_ONOFFCNFG2, reg);
// Do a soft reset.
i2c_send_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_ONOFFCNFG1, MAX77620_ONOFFCNFG1_SFT_RST);
while (true)
bpmp_halt();
}
void power_off()
{
sd_end();

View file

@ -73,6 +73,7 @@ void msleep(u32 ms);
void panic(u32 val);
void reboot_normal();
void reboot_rcm();
void reboot_full();
void power_off();
void exec_cfg(u32 *base, const cfg_op_t *ops, u32 num_ops);
u32 crc32_calc(u32 crc, const u8 *buf, u32 len);

View file

@ -900,7 +900,10 @@ static lv_res_t _removed_sd_action(lv_obj_t *btns, const char *txt)
switch (btnidx)
{
case 0:
reboot_rcm();
if (h_cfg.t210b01)
reboot_full();
else
reboot_rcm();
break;
case 1:
power_off();
@ -951,9 +954,14 @@ static lv_res_t _reboot_action(lv_obj_t *btns, const char *txt)
switch (btnidx)
{
case 0:
reboot_normal();
if (h_cfg.t210b01)
reboot_full();
else
reboot_normal();
break;
case 1:
if (h_cfg.t210b01)
break;
reboot_rcm();
break;
}
@ -997,13 +1005,14 @@ static lv_res_t _create_mbox_reboot(lv_obj_t *btn)
lv_obj_set_size(dark_bg, LV_HOR_RES, LV_VER_RES);
static const char * mbox_btn_map[] = { "\221OFW", "\221RCM", "\221Cancel", "" };
static const char * mbox_btn_map_t210b01[] = { "\221Reboot", "\221Cancel", "" };
lv_obj_t *mbox = lv_mbox_create(dark_bg, NULL);
lv_mbox_set_recolor_text(mbox, true);
lv_obj_set_width(mbox, LV_HOR_RES / 2);
lv_mbox_set_text(mbox, "#FF8000 Choose where to reboot:#");
lv_mbox_add_btns(mbox, mbox_btn_map, _reboot_action);
lv_mbox_add_btns(mbox, h_cfg.t210b01 ? mbox_btn_map_t210b01 : mbox_btn_map, _reboot_action);
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_top(mbox, true);