hos: Improve errors more for HOS launch

This commit is contained in:
CTCaer 2019-12-04 17:46:12 +02:00
parent 2c1da3a97d
commit 9a082c1b18
4 changed files with 33 additions and 16 deletions

View file

@ -329,13 +329,18 @@ int keygen(u8 *keyblob, u32 kb, tsec_ctxt_t *tsec_ctxt, launch_ctxt_t *hos_ctxt)
static int _read_emmc_pkg1(launch_ctxt_t *ctxt)
{
int res = 0;
sdmmc_storage_t storage;
sdmmc_t sdmmc;
if (!emummc_storage_init_mmc(&storage, &sdmmc))
int res = emummc_storage_init_mmc(&storage, &sdmmc);
if (res)
{
_hos_crit_error("Failed to init emuMMC");
if (res == 2)
_hos_crit_error("Failed to init eMMC");
else
_hos_crit_error("Failed to init emuMMC");
return 0;
}
@ -368,9 +373,15 @@ static u8 *_read_emmc_pkg2(launch_ctxt_t *ctxt)
sdmmc_storage_t storage;
sdmmc_t sdmmc;
if (!emummc_storage_init_mmc(&storage, &sdmmc))
int res = emummc_storage_init_mmc(&storage, &sdmmc);
if (res)
{
_hos_crit_error("Failed to init emuMMC");
if (res == 2)
_hos_crit_error("Failed to init eMMC");
else
_hos_crit_error("Failed to init emuMMC");
return NULL;
}
@ -562,6 +573,8 @@ int hos_launch(ini_sec_t *cfg)
if (!pkg2_hdr)
{
_hos_crit_error("Pkg2 decryption failed!");
if (ctxt.pkg1_id->kb >= KB_FIRMWARE_VERSION_700)
EPRINTF("Is Sept updated?");
return 0;
}
@ -590,6 +603,7 @@ int hos_launch(ini_sec_t *cfg)
if (!ctxt.pkg2_kernel_id)
{
_hos_crit_error("Failed to identify kernel!");
return 0;
}

View file

@ -91,9 +91,14 @@ void check_sept()
sdmmc_storage_t storage;
sdmmc_t sdmmc;
if (!emummc_storage_init_mmc(&storage, &sdmmc))
int res = emummc_storage_init_mmc(&storage, &sdmmc);
if (res)
{
EPRINTF("Failed to init eMMC.");
if (res == 2)
EPRINTF("Failed to init eMMC");
else
EPRINTF("Failed to init emuMMC");
goto out_free;
}

View file

@ -1023,6 +1023,7 @@ skip_list:
hos_launch(cfg_sec);
EPRINTF("\nFailed to launch HOS!");
gfx_printf("\nPress any key and try again...\n");
msleep(500);
btn_wait();
}

View file

@ -92,18 +92,14 @@ static int emummc_raw_get_part_off(int part_idx)
return 2;
}
int emummc_storage_init_mmc(sdmmc_storage_t *storage, sdmmc_t *sdmmc)
{
FILINFO fno;
if (!sdmmc_storage_init_mmc(storage, sdmmc, SDMMC_4, SDMMC_BUS_WIDTH_8, 4))
{
EPRINTF("Failed to init eMMC.");
if (!sdmmc_storage_init_mmc(storage, sdmmc, SDMMC_4, SDMMC_BUS_WIDTH_8, SDHCI_TIMING_MMC_HS400))
return 2;
goto out;
}
if (h_cfg.emummc_force_disable)
return 1;
return 0;
emu_cfg.active_part = 0;
if (!sd_mount())
@ -129,10 +125,11 @@ int emummc_storage_init_mmc(sdmmc_storage_t *storage, sdmmc_t *sdmmc)
}
emu_cfg.file_based_part_size = fno.fsize >> 9;
}
return 1;
return 0;
out:
return 0;
return 1;
}
int emummc_storage_end(sdmmc_storage_t *storage)