hos: Add error message for mariko warmboot fw not found

Ability to continue without sleep working also.
This commit is contained in:
CTCaer 2021-02-06 03:05:41 +02:00
parent 2428736bfa
commit a80cc0ae2c
3 changed files with 23 additions and 6 deletions

View file

@ -875,7 +875,17 @@ int hos_launch(ini_sec_t *cfg)
}
// Configure and manage Warmboot binary.
pkg1_warmboot_config(&ctxt, warmboot_base);
if (!pkg1_warmboot_config(&ctxt, warmboot_base))
{
// Can only happen on T210B01.
_hos_crit_error("Failed to match warmboot with fuses!\nIf you continue, sleep wont work!");
gfx_puts("\nPress POWER to continue.\nPress VOL to go to the menu.\n");
display_backlight_brightness(h_cfg.backlight, 1000);
if (!(btn_wait() & BTN_POWER))
goto error;
}
// Replace 'warmboot.bin' if requested.
if (ctxt.warmboot)

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 2018 naehrwert
* Copyright (c) 2018 st4rk
* Copyright (c) 2018-2020 CTCaer
* Copyright (c) 2018-2021 CTCaer
* Copyright (c) 2018 balika011
*
* This program is free software; you can redistribute it and/or modify it
@ -331,10 +331,11 @@ static void _warmboot_filename(char *out, u32 fuses)
strcat(out, ".bin");
}
void pkg1_warmboot_config(void *hos_ctxt, u32 warmboot_base)
int pkg1_warmboot_config(void *hos_ctxt, u32 warmboot_base)
{
launch_ctxt_t *ctxt = (launch_ctxt_t *)hos_ctxt;
u32 kb = ctxt->pkg1_id->kb;
int res = 1;
// Set warmboot address in PMC if required.
if (kb <= KB_FIRMWARE_VERSION_301)
@ -347,7 +348,7 @@ void pkg1_warmboot_config(void *hos_ctxt, u32 warmboot_base)
u32 fuses_fw = ctxt->pkg1_id->fuses;
u8 burnt_fuses = fuse_count_burnt(fuse_read_odm(7));
// Save current warmboot in storage cache and check if another one is needed.
// Save current warmboot in storage cache (MWS) and check if another one is needed.
if (!ctxt->warmboot)
{
char path[128];
@ -357,7 +358,7 @@ void pkg1_warmboot_config(void *hos_ctxt, u32 warmboot_base)
if (f_stat(path, NULL))
sd_save_to_file((void *)warmboot_base, ctxt->warmboot_size, path);
// Load warmboot fw from storage if not matched.
// Load warmboot fw from storage (MWS) if not matched.
if (burnt_fuses > fuses_fw)
{
u32 tmp_fuses = burnt_fuses;
@ -374,6 +375,10 @@ void pkg1_warmboot_config(void *hos_ctxt, u32 warmboot_base)
break;
tmp_fuses++;
}
// Check if proper warmboot firmware was found.
if (!ctxt->warmboot)
res = 0;
}
else // Replace burnt fuses with higher count.
burnt_fuses = fuses_fw;
@ -406,4 +411,6 @@ void pkg1_warmboot_config(void *hos_ctxt, u32 warmboot_base)
else if (kb == KB_FIRMWARE_VERSION_301)
PMC(APBDEV_PMC_SECURE_SCRATCH32) = 0x104; // Warmboot 3.0.1/.2 PA address id.
}
return res;
}

View file

@ -81,6 +81,6 @@ int pkg1_decrypt(const pkg1_id_t *id, u8 *pkg1);
const u8 *pkg1_unpack(void *wm_dst, u32 *wb_sz, void *sm_dst, void *ldr_dst, const pkg1_id_t *id, u8 *pkg1);
void pkg1_secmon_patch(void *hos_ctxt, u32 secmon_base, bool t210b01);
void pkg1_warmboot_patch(void *hos_ctxt);
void pkg1_warmboot_config(void *hos_ctxt, u32 warmboot_base);
int pkg1_warmboot_config(void *hos_ctxt, u32 warmboot_base);
#endif