mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 11:21:23 +00:00
nyx: Use full shutdown based reboot on T210B01
That's because of how the system is exploited.
This commit is contained in:
parent
0a9931ddb3
commit
0954eb2b09
3 changed files with 30 additions and 3 deletions
|
@ -152,6 +152,23 @@ void reboot_rcm()
|
||||||
bpmp_halt();
|
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()
|
void power_off()
|
||||||
{
|
{
|
||||||
sd_end();
|
sd_end();
|
||||||
|
|
|
@ -73,6 +73,7 @@ void msleep(u32 ms);
|
||||||
void panic(u32 val);
|
void panic(u32 val);
|
||||||
void reboot_normal();
|
void reboot_normal();
|
||||||
void reboot_rcm();
|
void reboot_rcm();
|
||||||
|
void reboot_full();
|
||||||
void power_off();
|
void power_off();
|
||||||
void exec_cfg(u32 *base, const cfg_op_t *ops, u32 num_ops);
|
void exec_cfg(u32 *base, const cfg_op_t *ops, u32 num_ops);
|
||||||
u32 crc32_calc(u32 crc, const u8 *buf, u32 len);
|
u32 crc32_calc(u32 crc, const u8 *buf, u32 len);
|
||||||
|
|
|
@ -900,7 +900,10 @@ static lv_res_t _removed_sd_action(lv_obj_t *btns, const char *txt)
|
||||||
switch (btnidx)
|
switch (btnidx)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
reboot_rcm();
|
if (h_cfg.t210b01)
|
||||||
|
reboot_full();
|
||||||
|
else
|
||||||
|
reboot_rcm();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
power_off();
|
power_off();
|
||||||
|
@ -951,9 +954,14 @@ static lv_res_t _reboot_action(lv_obj_t *btns, const char *txt)
|
||||||
switch (btnidx)
|
switch (btnidx)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
reboot_normal();
|
if (h_cfg.t210b01)
|
||||||
|
reboot_full();
|
||||||
|
else
|
||||||
|
reboot_normal();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
if (h_cfg.t210b01)
|
||||||
|
break;
|
||||||
reboot_rcm();
|
reboot_rcm();
|
||||||
break;
|
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);
|
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[] = { "\221OFW", "\221RCM", "\221Cancel", "" };
|
||||||
|
static const char * mbox_btn_map_t210b01[] = { "\221Reboot", "\221Cancel", "" };
|
||||||
lv_obj_t *mbox = lv_mbox_create(dark_bg, NULL);
|
lv_obj_t *mbox = lv_mbox_create(dark_bg, NULL);
|
||||||
lv_mbox_set_recolor_text(mbox, true);
|
lv_mbox_set_recolor_text(mbox, true);
|
||||||
lv_obj_set_width(mbox, LV_HOR_RES / 2);
|
lv_obj_set_width(mbox, LV_HOR_RES / 2);
|
||||||
|
|
||||||
lv_mbox_set_text(mbox, "#FF8000 Choose where to reboot:#");
|
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_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||||
lv_obj_set_top(mbox, true);
|
lv_obj_set_top(mbox, true);
|
||||||
|
|
Loading…
Reference in a new issue