mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-22 18:06:40 +00:00
hos: Fix sleep on modchiped Erista
This commit is contained in:
parent
b6ec217484
commit
f1386c60af
3 changed files with 27 additions and 14 deletions
|
@ -312,7 +312,16 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base, bool exo_new)
|
|||
u8 *rsa_mod = (u8 *)malloc(512);
|
||||
|
||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_BOOT0);
|
||||
sdmmc_storage_read(&emmc_storage, 1, 1, rsa_mod);
|
||||
|
||||
u32 sector;
|
||||
for (u32 i = 0; i < 4; i++)
|
||||
{
|
||||
sector = 1 + (32 * i); // 0x4000 bct + 0x200 offset.
|
||||
sdmmc_storage_read(&emmc_storage, sector, 1, rsa_mod);
|
||||
|
||||
// Check if 2nd byte of modulus is correct.
|
||||
if (rsa_mod[0x11] != 0x86)
|
||||
continue;
|
||||
|
||||
// Patch AutoRCM out.
|
||||
if ((fuse_read_odm(4) & 3) != 3)
|
||||
|
@ -320,6 +329,9 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base, bool exo_new)
|
|||
else
|
||||
rsa_mod[0x10] = 0x37;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
memcpy((void *)(warmboot_base + 0x10), rsa_mod + 0x10, 0x100);
|
||||
}
|
||||
|
||||
|
|
|
@ -1133,32 +1133,31 @@ static void _patched_rcm_protection()
|
|||
u8 *buf = (u8 *)malloc(0x200);
|
||||
sdmmc_storage_set_mmc_partition(&storage, EMMC_BOOT0);
|
||||
|
||||
u32 sector;
|
||||
u8 corr_mod_byte0;
|
||||
int i, sect = 0;
|
||||
if ((fuse_read_odm(4) & 3) != 3)
|
||||
corr_mod_byte0 = 0xF7;
|
||||
else
|
||||
corr_mod_byte0 = 0x37;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (u32 i = 0; i < 4; i++)
|
||||
{
|
||||
sect = (0x200 + (0x4000 * i)) / NX_EMMC_BLOCKSIZE;
|
||||
sdmmc_storage_read(&storage, sect, 1, buf);
|
||||
sector = 1 + (32 * i); // 0x4000 bct + 0x200 offset.
|
||||
sdmmc_storage_read(&storage, sector, 1, buf);
|
||||
|
||||
// Check if 2nd byte of modulus is correct.
|
||||
if (buf[0x11] == 0x86)
|
||||
goto out;
|
||||
if (buf[0x11] != 0x86)
|
||||
continue;
|
||||
|
||||
// If AutoRCM is enabled, disable it.
|
||||
if (buf[0x10] != corr_mod_byte0)
|
||||
{
|
||||
buf[0x10] = corr_mod_byte0;
|
||||
|
||||
sdmmc_storage_write(&storage, sect, 1, buf);
|
||||
sdmmc_storage_write(&storage, sector, 1, buf);
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
free(buf);
|
||||
sdmmc_storage_end(&storage);
|
||||
}
|
||||
|
|
|
@ -32,11 +32,13 @@
|
|||
#include <mem/minerva.h>
|
||||
#include <mem/sdram.h>
|
||||
#include <power/max77620.h>
|
||||
#include <soc/clock.h>
|
||||
#include <soc/bpmp.h>
|
||||
#include <soc/fuse.h>
|
||||
#include <soc/gpio.h>
|
||||
#include <soc/hw_init.h>
|
||||
#include <soc/i2c.h>
|
||||
#include <soc/pinmux.h>
|
||||
#include <soc/pmc.h>
|
||||
#include <soc/t210.h>
|
||||
#include <soc/uart.h>
|
||||
|
|
Loading…
Reference in a new issue