mirror of
https://github.com/CTCaer/hekate
synced 2024-12-22 11:21:23 +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,13 +312,25 @@ void config_exosphere(launch_ctxt_t *ctxt, u32 warmboot_base, bool exo_new)
|
||||||
u8 *rsa_mod = (u8 *)malloc(512);
|
u8 *rsa_mod = (u8 *)malloc(512);
|
||||||
|
|
||||||
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_BOOT0);
|
sdmmc_storage_set_mmc_partition(&emmc_storage, EMMC_BOOT0);
|
||||||
sdmmc_storage_read(&emmc_storage, 1, 1, rsa_mod);
|
|
||||||
|
|
||||||
// Patch AutoRCM out.
|
u32 sector;
|
||||||
if ((fuse_read_odm(4) & 3) != 3)
|
for (u32 i = 0; i < 4; i++)
|
||||||
rsa_mod[0x10] = 0xF7;
|
{
|
||||||
else
|
sector = 1 + (32 * i); // 0x4000 bct + 0x200 offset.
|
||||||
rsa_mod[0x10] = 0x37;
|
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)
|
||||||
|
rsa_mod[0x10] = 0xF7;
|
||||||
|
else
|
||||||
|
rsa_mod[0x10] = 0x37;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy((void *)(warmboot_base + 0x10), rsa_mod + 0x10, 0x100);
|
memcpy((void *)(warmboot_base + 0x10), rsa_mod + 0x10, 0x100);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1133,32 +1133,31 @@ static void _patched_rcm_protection()
|
||||||
u8 *buf = (u8 *)malloc(0x200);
|
u8 *buf = (u8 *)malloc(0x200);
|
||||||
sdmmc_storage_set_mmc_partition(&storage, EMMC_BOOT0);
|
sdmmc_storage_set_mmc_partition(&storage, EMMC_BOOT0);
|
||||||
|
|
||||||
|
u32 sector;
|
||||||
u8 corr_mod_byte0;
|
u8 corr_mod_byte0;
|
||||||
int i, sect = 0;
|
|
||||||
if ((fuse_read_odm(4) & 3) != 3)
|
if ((fuse_read_odm(4) & 3) != 3)
|
||||||
corr_mod_byte0 = 0xF7;
|
corr_mod_byte0 = 0xF7;
|
||||||
else
|
else
|
||||||
corr_mod_byte0 = 0x37;
|
corr_mod_byte0 = 0x37;
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (u32 i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
sect = (0x200 + (0x4000 * i)) / NX_EMMC_BLOCKSIZE;
|
sector = 1 + (32 * i); // 0x4000 bct + 0x200 offset.
|
||||||
sdmmc_storage_read(&storage, sect, 1, buf);
|
sdmmc_storage_read(&storage, sector, 1, buf);
|
||||||
|
|
||||||
// Check if 2nd byte of modulus is correct.
|
// Check if 2nd byte of modulus is correct.
|
||||||
if (buf[0x11] == 0x86)
|
if (buf[0x11] != 0x86)
|
||||||
goto out;
|
continue;
|
||||||
|
|
||||||
// If AutoRCM is enabled, disable it.
|
// If AutoRCM is enabled, disable it.
|
||||||
if (buf[0x10] != corr_mod_byte0)
|
if (buf[0x10] != corr_mod_byte0)
|
||||||
{
|
{
|
||||||
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);
|
free(buf);
|
||||||
sdmmc_storage_end(&storage);
|
sdmmc_storage_end(&storage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,13 @@
|
||||||
#include <mem/minerva.h>
|
#include <mem/minerva.h>
|
||||||
#include <mem/sdram.h>
|
#include <mem/sdram.h>
|
||||||
#include <power/max77620.h>
|
#include <power/max77620.h>
|
||||||
|
#include <soc/clock.h>
|
||||||
#include <soc/bpmp.h>
|
#include <soc/bpmp.h>
|
||||||
#include <soc/fuse.h>
|
#include <soc/fuse.h>
|
||||||
#include <soc/gpio.h>
|
#include <soc/gpio.h>
|
||||||
#include <soc/hw_init.h>
|
#include <soc/hw_init.h>
|
||||||
#include <soc/i2c.h>
|
#include <soc/i2c.h>
|
||||||
|
#include <soc/pinmux.h>
|
||||||
#include <soc/pmc.h>
|
#include <soc/pmc.h>
|
||||||
#include <soc/t210.h>
|
#include <soc/t210.h>
|
||||||
#include <soc/uart.h>
|
#include <soc/uart.h>
|
||||||
|
|
Loading…
Reference in a new issue