mirror of
https://github.com/CTCaer/hekate
synced 2024-11-16 00:49:27 +00:00
Various fixes and whitespace removal
This commit is contained in:
parent
e14a7d1d4d
commit
8c762c52e2
28 changed files with 221 additions and 97 deletions
7
Makefile
7
Makefile
|
@ -20,7 +20,7 @@ VPATH = $(dir ./$(SOURCEDIR)/) $(dir $(wildcard ./$(SOURCEDIR)/*/)) $(dir $(wild
|
|||
|
||||
# Main and graphics.
|
||||
OBJS = $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
||||
start.o \
|
||||
start.o exception_handlers.o \
|
||||
main.o heap.o \
|
||||
gfx.o tui.o \
|
||||
fe_emmc_tools.o fe_info.o fe_tools.o \
|
||||
|
@ -28,9 +28,10 @@ OBJS = $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
|||
|
||||
# Hardware.
|
||||
OBJS += $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
||||
bpmp.o clock.o cluster.o di.o gpio.o i2c.o mc.o sdram.o pinmux.o se.o smmu.o tsec.o uart.o \
|
||||
bpmp.o clock.o cluster.o di.o gpio.o i2c.o irq.o mc.o sdram.o \
|
||||
pinmux.o se.o smmu.o timer.o tsec.o uart.o \
|
||||
fuse.o kfuse.o minerva.o \
|
||||
sdmmc.o sdmmc_driver.o emummc.o nx_emmc.o \
|
||||
sdmmc.o sdmmc_driver.o emummc.o nx_emmc.o nx_sd.o \
|
||||
bq24193.o max17050.o max7762x.o max77620-rtc.o \
|
||||
hw_init.o \
|
||||
)
|
||||
|
|
|
@ -116,7 +116,7 @@ _reset:
|
|||
LDR R1, =0x30505645 /* EVP0 */
|
||||
STR R1, [R0] /* EVP0 in EXCP_EN_ADDR */
|
||||
LDR R0, =EXCP_LR_ADDR
|
||||
MOV R1, LR
|
||||
MOV R1, LR
|
||||
STR R1, [R0] /* Save LR in EXCP_LR_ADDR */
|
||||
LDR R0, =__bss_start
|
||||
EOR R1, R1, R1
|
||||
|
|
|
@ -153,21 +153,6 @@ void print_mmc_info()
|
|||
gfx_printf("%kCID:%k\n", 0xFF00DDFF, 0xFFCCCCCC);
|
||||
switch (storage.csd.mmca_vsn)
|
||||
{
|
||||
case 0: /* MMC v1.0 - v1.2 */
|
||||
case 1: /* MMC v1.4 */
|
||||
gfx_printf(
|
||||
" Vendor ID: %03X\n"
|
||||
" Model: %c%c%c%c%c%c%c\n"
|
||||
" HW rev: %X\n"
|
||||
" FW rev: %X\n"
|
||||
" S/N: %03X\n"
|
||||
" Month/Year: %02d/%04d\n\n",
|
||||
storage.cid.manfid,
|
||||
storage.cid.prod_name[0], storage.cid.prod_name[1], storage.cid.prod_name[2],
|
||||
storage.cid.prod_name[3], storage.cid.prod_name[4], storage.cid.prod_name[5],
|
||||
storage.cid.prod_name[6], storage.cid.hwrev, storage.cid.fwrev,
|
||||
storage.cid.serial, storage.cid.month, storage.cid.year);
|
||||
break;
|
||||
case 2: /* MMC v2.0 - v2.2 */
|
||||
case 3: /* MMC v3.1 - v3.3 */
|
||||
case 4: /* MMC v4 */
|
||||
|
@ -185,7 +170,6 @@ void print_mmc_info()
|
|||
storage.cid.prv, storage.cid.serial, storage.cid.month, storage.cid.year);
|
||||
break;
|
||||
default:
|
||||
EPRINTFARGS("eMMC has unknown MMCA version %d", storage.csd.mmca_vsn);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -351,7 +335,7 @@ void print_tsec_key()
|
|||
const pkg1_id_t *pkg1_id = pkg1_identify(pkg1);
|
||||
if (!pkg1_id)
|
||||
{
|
||||
EPRINTF("Unknown pkg1 version for reading\nTSEC firmware.");
|
||||
EPRINTF("Unknown pkg1 version.");
|
||||
goto out_wait;
|
||||
}
|
||||
|
||||
|
@ -443,7 +427,7 @@ void print_fuel_gauge_info()
|
|||
{
|
||||
int value = 0;
|
||||
|
||||
gfx_printf("%kFuel Gauge IC Info:\n%k", 0xFF00DDFF, 0xFFCCCCCC);
|
||||
gfx_printf("%kFuel Gauge Info:\n%k", 0xFF00DDFF, 0xFFCCCCCC);
|
||||
|
||||
max17050_get_property(MAX17050_RepSOC, &value);
|
||||
gfx_printf("Capacity now: %3d%\n", value >> 8);
|
||||
|
@ -495,7 +479,7 @@ void print_battery_charger_info()
|
|||
{
|
||||
int value = 0;
|
||||
|
||||
gfx_printf("%k\n\nBattery Charger IC Info:\n%k", 0xFF00DDFF, 0xFFCCCCCC);
|
||||
gfx_printf("%k\n\nBattery Charger Info:\n%k", 0xFF00DDFF, 0xFFCCCCCC);
|
||||
|
||||
bq24193_get_property(BQ24193_InputVoltageLimit, &value);
|
||||
gfx_printf("Input voltage limit: %4d mV\n", value);
|
||||
|
|
|
@ -522,7 +522,7 @@ int hos_launch(ini_sec_t *cfg)
|
|||
((fuse_read_odm(7) & 0x400) && (ctxt.pkg1_id->kb <= KB_FIRMWARE_VERSION_810))))
|
||||
config_kip1patch(&ctxt, "nogc");
|
||||
|
||||
gfx_printf("Loaded pkg1 & keyblob\n");
|
||||
gfx_printf("Loaded config, pkg1 and keyblob\n");
|
||||
|
||||
// Generate keys.
|
||||
if (!h_cfg.se_keygen_done)
|
||||
|
@ -590,7 +590,7 @@ int hos_launch(ini_sec_t *cfg)
|
|||
{
|
||||
// Else we patch it to allow for an unsigned package2 and patched kernel.
|
||||
patch_t *secmon_patchset = ctxt.pkg1_id->secmon_patchset;
|
||||
gfx_printf("%kPatching Security Monitor%k\n", 0xFFFFBA00, 0xFFCCCCCC);
|
||||
gfx_printf("%kPatching Secure Monitor%k\n", 0xFFFFBA00, 0xFFCCCCCC);
|
||||
for (u32 i = 0; secmon_patchset[i].off != 0xFFFFFFFF; i++)
|
||||
*(vu32 *)(ctxt.pkg1_id->secmon_base + secmon_patchset[i].off) = secmon_patchset[i].val;
|
||||
}
|
||||
|
@ -680,7 +680,7 @@ int hos_launch(ini_sec_t *cfg)
|
|||
// Check if FS is compatible with exFAT.
|
||||
if (!ctxt.stock && sd_fs.fs_type == FS_EXFAT && !_get_fs_exfat_compatible(&kip1_info))
|
||||
{
|
||||
_hos_crit_error("Your SD Card is exFAT and the installed\nFS only supports FAT32!");
|
||||
_hos_crit_error("SD Card is exFAT and the installed\nFS only supports FAT32!");
|
||||
|
||||
_free_launch_components(&ctxt);
|
||||
return 0;
|
||||
|
@ -782,9 +782,6 @@ int hos_launch(ini_sec_t *cfg)
|
|||
secmon_mb->in = bootStateDramPkg2;
|
||||
secmon_mb->out = 0;
|
||||
|
||||
// Free allocated memory.
|
||||
_free_launch_components(&ctxt);
|
||||
|
||||
// Disable display. This must be executed before secmon to provide support for all fw versions.
|
||||
display_end();
|
||||
|
||||
|
|
|
@ -642,6 +642,12 @@ static kip1_id_t _kip_ids[] =
|
|||
static kip1_id_t *_kip_id_sets = _kip_ids;
|
||||
static u32 _kip_id_sets_cnt = sizeof(_kip_ids) / sizeof(_kip_ids[0]);
|
||||
|
||||
void pkg2_get_ids(kip1_id_t **ids, u32 *entries)
|
||||
{
|
||||
*ids = _kip_id_sets;
|
||||
*entries = _kip_id_sets_cnt;
|
||||
}
|
||||
|
||||
static void parse_external_kip_patches()
|
||||
{
|
||||
static bool ext_patches_done = false;
|
||||
|
|
|
@ -149,6 +149,7 @@ int pkg2_has_kip(link_t *info, u64 tid);
|
|||
void pkg2_replace_kip(link_t *info, u64 tid, pkg2_kip1_t *kip1);
|
||||
void pkg2_add_kip(link_t *info, pkg2_kip1_t *kip1);
|
||||
void pkg2_merge_kip(link_t *info, pkg2_kip1_t *kip1);
|
||||
void pkg2_get_ids(kip1_id_t **ids, u32 *entries);
|
||||
const char* pkg2_patch_kips(link_t *info, char* patchNames);
|
||||
|
||||
const pkg2_kernel_id_t *pkg2_identify(u8 *hash);
|
||||
|
|
|
@ -180,9 +180,7 @@ void config_exosphere(launch_ctxt_t *ctxt)
|
|||
|
||||
// Set mailbox values.
|
||||
exo_cfg->magic = EXO_MAGIC_VAL;
|
||||
|
||||
exo_cfg->fwno = exoFwNo;
|
||||
|
||||
exo_cfg->flags = exoFlags;
|
||||
|
||||
// If warmboot is lp0fw, add in RSA modulus.
|
||||
|
|
|
@ -5694,7 +5694,7 @@ FRESULT f_mkfs (
|
|||
} else {
|
||||
/* Create a single-partition in this function */
|
||||
if (disk_ioctl(pdrv, GET_SECTOR_COUNT, &sz_vol) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
b_vol = (opt & FM_SFD) ? 0 : 63; /* Volume start sector */
|
||||
b_vol = (opt & FM_SFD) ? 0 : 32768; /* Volume start sector. Align to 16MB */
|
||||
if (sz_vol < b_vol) LEAVE_MKFS(FR_MKFS_ABORTED);
|
||||
sz_vol -= b_vol; /* Volume size */
|
||||
}
|
||||
|
@ -5981,13 +5981,13 @@ FRESULT f_mkfs (
|
|||
st_word(buf + BPB_BkBootSec32, 6); /* Offset of backup VBR (VBR + 6) */
|
||||
buf[BS_DrvNum32] = 0x80; /* Drive number (for int13) */
|
||||
buf[BS_BootSig32] = 0x29; /* Extended boot signature */
|
||||
mem_cpy(buf + BS_VolLab32, "NO NAME " "FAT32 ", 19); /* Volume label, FAT signature */
|
||||
mem_cpy(buf + BS_VolLab32, "SWITCH SD " "FAT32 ", 19); /* Volume label, FAT signature */
|
||||
} else {
|
||||
st_dword(buf + BS_VolID, GET_FATTIME()); /* VSN */
|
||||
st_word(buf + BPB_FATSz16, (WORD)sz_fat); /* FAT size [sector] */
|
||||
buf[BS_DrvNum] = 0x80; /* Drive number (for int13) */
|
||||
buf[BS_BootSig] = 0x29; /* Extended boot signature */
|
||||
mem_cpy(buf + BS_VolLab, "NO NAME " "FAT ", 19); /* Volume label, FAT signature */
|
||||
mem_cpy(buf + BS_VolLab, "SWITCH SD " "FAT ", 19); /* Volume label, FAT signature */
|
||||
}
|
||||
st_word(buf + BS_55AA, 0xAA55); /* Signature (offset is fixed here regardless of sector size) */
|
||||
if (disk_write(pdrv, buf, b_vol, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR); /* Write it to the VBR sector */
|
||||
|
|
|
@ -368,8 +368,11 @@ int ff_del_syncobj (FF_SYNC_t sobj); /* Delete a sync object */
|
|||
#define AM_RDO 0x01 /* Read only */
|
||||
#define AM_HID 0x02 /* Hidden */
|
||||
#define AM_SYS 0x04 /* System */
|
||||
#define AM_VOL 0x08 /* Volume */
|
||||
#define AM_DIR 0x10 /* Directory */
|
||||
#define AM_ARC 0x20 /* Archive */
|
||||
#define AM_DEV 0x40 /* Device */
|
||||
#define AM_RVD 0x80 /* Reserved */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1121,18 +1121,18 @@ static void _show_errors()
|
|||
display_backlight_brightness(150, 1000);
|
||||
|
||||
if (h_cfg.errors & ERR_LIBSYS_LP0)
|
||||
WPRINTF("Missing LP0 (sleep mode) library!\n");
|
||||
WPRINTF("Missing LP0 (sleep mode) lib!\n");
|
||||
if (h_cfg.errors & ERR_SYSOLD_MTC)
|
||||
WPRINTF("Missing or old Minerva library!\n");
|
||||
WPRINTF("Missing or old Minerva lib!\n");
|
||||
|
||||
if (h_cfg.errors & ~ERR_EXCEPT_ENB)
|
||||
{
|
||||
WPRINTF("\nUpdate your bootloader folder!\n\n");
|
||||
WPRINTF("\nUpdate bootloader folder!\n\n");
|
||||
}
|
||||
|
||||
if (h_cfg.errors & ERR_EXCEPT_ENB)
|
||||
{
|
||||
WPRINTFARGS("An exception happened (LR %08X):\n", *excp_lr);
|
||||
WPRINTFARGS("An exception occurred (LR %08X):\n", *excp_lr);
|
||||
switch (*excp_type)
|
||||
{
|
||||
case EXCP_TYPE_RESET:
|
||||
|
@ -1340,17 +1340,17 @@ ment_t ment_cinfo[] = {
|
|||
MDEF_BACK(),
|
||||
MDEF_CHGLINE(),
|
||||
MDEF_CAPTION("---- SoC Info ----", 0xFF0AB9E6),
|
||||
MDEF_HANDLER("Ipatches & bootrom info", bootrom_ipatches_info),
|
||||
MDEF_HANDLER("Print fuse info", print_fuseinfo),
|
||||
//MDEF_HANDLER("Print kfuse info", print_kfuseinfo),
|
||||
MDEF_HANDLER("Print TSEC keys", print_tsec_key),
|
||||
MDEF_HANDLER("Ipatches & bootrom", bootrom_ipatches_info),
|
||||
MDEF_HANDLER("Fuses", print_fuseinfo),
|
||||
//MDEF_HANDLER("KFuses", print_kfuseinfo),
|
||||
MDEF_HANDLER("TSEC keys", print_tsec_key),
|
||||
MDEF_CHGLINE(),
|
||||
MDEF_CAPTION("-- Storage Info --", 0xFF0AB9E6),
|
||||
MDEF_HANDLER("Print eMMC info", print_mmc_info),
|
||||
MDEF_HANDLER("Print SD Card info", print_sdcard_info),
|
||||
MDEF_HANDLER("eMMC", print_mmc_info),
|
||||
MDEF_HANDLER("SD Card", print_sdcard_info),
|
||||
MDEF_CHGLINE(),
|
||||
MDEF_CAPTION("------ Misc ------", 0xFF0AB9E6),
|
||||
MDEF_HANDLER("Print battery info", print_battery_info),
|
||||
MDEF_HANDLER("Battery", print_battery_info),
|
||||
MDEF_END()
|
||||
};
|
||||
|
||||
|
|
|
@ -463,4 +463,54 @@
|
|||
#define MC_ERR_APB_ASID_UPDATE_STATUS 0x9d0
|
||||
#define MC_DA_CONFIG0 0x9dc
|
||||
|
||||
// MC_SECURITY_CARVEOUTX_CFG0
|
||||
// Mode of LOCK_MODE.
|
||||
#define PROTECT_MODE_SHIFT 0
|
||||
#define SEC_CARVEOUT_CFG_SECURE (0 << PROTECT_MODE_SHIFT0)
|
||||
#define SEC_CARVEOUT_CFG_TZ_SECURE (1 << PROTECT_MODE_SHIFT0)
|
||||
// Enables PROTECT_MODE.
|
||||
#define LOCK_MODE_SHIFT 1
|
||||
#define SEC_CARVEOUT_CFG_UNLOCKED (0 << LOCK_MODE_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_LOCKED (1 << LOCK_MODE_SHIFT)
|
||||
|
||||
#define ADDRESS_TYPE_SHIFT 2
|
||||
#define SEC_CARVEOUT_CFG_ANY_ADDRESS (0 << ADDRESS_TYPE_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_UNTRANSLATED_ONLY (1 << ADDRESS_TYPE_SHIFT)
|
||||
|
||||
#define READ_ACCESS_LEVEL_SHIFT 3
|
||||
#define SEC_CARVEOUT_CFG_RD_ALL (1 << READ_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_RD_UNK (2 << READ_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_RD_FALCON_LS (4 << READ_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_RD_FALCON_HS (8 << READ_ACCESS_LEVEL_SHIFT)
|
||||
|
||||
#define WRITE_ACCESS_LEVEL_SHIFT 7
|
||||
#define SEC_CARVEOUT_CFG_WR_ALL (1 << WRITE_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_WR_UNK (2 << WRITE_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_WR_FALCON_LS (4 << WRITE_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_WR_FALCON_HS (8 << WRITE_ACCESS_LEVEL_SHIFT)
|
||||
|
||||
#define SEC_CARVEOUT_CFG_APERTURE_ID_MASK (3 << 11)
|
||||
|
||||
#define DISABLE_READ_CHECK_ACCESS_LEVEL_SHIFT 14
|
||||
#define SEC_CARVEOUT_CFG_DIS_RD_CHECK_L0 (1 << DISABLE_READ_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_DIS_RD_CHECK_L1 (2 << DISABLE_READ_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_DIS_RD_CHECK_L2 (4 << DISABLE_READ_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_DIS_RD_CHECK_L3 (8 << DISABLE_READ_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
|
||||
#define DISABLE_WRITE_CHECK_ACCESS_LEVEL_SHIFT 18
|
||||
#define SEC_CARVEOUT_CFG_DIS_WR_CHECK_L0 (1 << DISABLE_WRITE_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_DIS_WR_CHECK_L1 (2 << DISABLE_WRITE_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_DIS_WR_CHECK_L2 (4 << DISABLE_WRITE_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_DIS_WR_CHECK_L3 (8 << DISABLE_WRITE_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
|
||||
#define SEC_CARVEOUT_CFG_SEND_CFG_TO_GPU (1 << 22)
|
||||
|
||||
#define SEC_CARVEOUT_CFG_TZ_GLOBAL_WR_EN_BYPASS_CHECK (1 << 23)
|
||||
#define SEC_CARVEOUT_CFG_TZ_GLOBAL_RD_EN_BYPASS_CHECK (1 << 24)
|
||||
|
||||
#define SEC_CARVEOUT_CFG_ALLOW_APERTURE_ID_MISMATCH (1 << 25)
|
||||
#define SEC_CARVEOUT_CFG_FORCE_APERTURE_ID_MATCH (1 << 26)
|
||||
|
||||
#define SEC_CARVEOUT_CFG_IS_WPR (1 << 27)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -275,7 +275,6 @@ int se_aes_xts_crypt(u32 ks1, u32 ks2, u32 enc, u64 sec, void *dst, void *src, u
|
|||
return 1;
|
||||
}
|
||||
|
||||
// se_calc_sha256() was derived from Atmosphère's se_calculate_sha256.
|
||||
int se_calc_sha256(void *dst, const void *src, u32 src_size)
|
||||
{
|
||||
int res;
|
||||
|
|
|
@ -25,13 +25,23 @@
|
|||
#define APBDEV_PMC_PWRGATE_TOGGLE 0x30
|
||||
#define APBDEV_PMC_PWRGATE_STATUS 0x38
|
||||
#define APBDEV_PMC_NO_IOPOWER 0x44
|
||||
#define PMC_NO_IOPOWER_GPIO_IO_EN (1 << 21)
|
||||
#define PMC_NO_IOPOWER_AUDIO_HV (1 << 18)
|
||||
#define PMC_NO_IOPOWER_SDMMC1_IO_EN (1 << 12)
|
||||
#define APBDEV_PMC_SCRATCH0 0x50
|
||||
#define PMC_SCRATCH0_MODE_RECOVERY (1 << 31)
|
||||
#define PMC_SCRATCH0_MODE_FASTBOOT (1 << 30)
|
||||
#define PMC_SCRATCH0_MODE_PAYLOAD (1 << 29)
|
||||
#define PMC_SCRATCH0_MODE_RCM (1 << 1)
|
||||
#define PMC_SCRATCH0_MODE_WARMBOOT (1 << 0)
|
||||
#define APBDEV_PMC_SCRATCH1 0x54
|
||||
#define APBDEV_PMC_SCRATCH20 0xA0
|
||||
#define APBDEV_PMC_PWR_DET_VAL 0xE4
|
||||
#define PMC_PWR_DET_GPIO_IO_EN (1 << 21)
|
||||
#define PMC_PWR_DET_AUDIO_HV (1 << 18)
|
||||
#define PMC_PWR_DET_SDMMC1_IO_EN (1 << 12)
|
||||
#define APBDEV_PMC_DDR_PWR 0xE8
|
||||
#define APBDEV_PMC_USB_AO 0xF0
|
||||
#define APBDEV_PMC_CRYPTO_OP 0xF4
|
||||
#define PMC_CRYPTO_OP_SE_ENABLE 0
|
||||
#define PMC_CRYPTO_OP_SE_DISABLE 1
|
||||
|
@ -39,6 +49,8 @@
|
|||
#define APBDEV_PMC_SCRATCH40 0x13C
|
||||
#define APBDEV_PMC_OSC_EDPD_OVER 0x1A4
|
||||
#define PMC_OSC_EDPD_OVER_OSC_CTRL_OVER 0x400000
|
||||
#define APBDEV_PMC_CLK_OUT_CNTRL 0x1A8
|
||||
#define PMC_CLK_OUT_CNTRL_CLK1_FORCE_EN (1 << 2)
|
||||
#define APBDEV_PMC_RST_STATUS 0x1B4
|
||||
#define APBDEV_PMC_IO_DPD_REQ 0x1B8
|
||||
#define APBDEV_PMC_IO_DPD2_REQ 0x1C0
|
||||
|
|
|
@ -24,13 +24,12 @@
|
|||
#include "../soc/i2c.h"
|
||||
#include "../soc/pmc.h"
|
||||
#include "../soc/t210.h"
|
||||
#include "../storage/nx_sd.h"
|
||||
|
||||
#define USE_RTC_TIMER
|
||||
|
||||
extern volatile nyx_storage_t *nyx_str;
|
||||
|
||||
extern void sd_unmount();
|
||||
|
||||
u32 get_tmr_s()
|
||||
{
|
||||
return RTC(APBDEV_RTC_SECONDS);
|
||||
|
@ -117,7 +116,7 @@ void reboot_rcm()
|
|||
|
||||
nyx_str->mtc_cfg.init_done = 0;
|
||||
|
||||
PMC(APBDEV_PMC_SCRATCH0) = 2; // Reboot into rcm.
|
||||
PMC(APBDEV_PMC_SCRATCH0) = PMC_SCRATCH0_MODE_RCM;
|
||||
PMC(APBDEV_PMC_CNTRL) |= PMC_CNTRL_MAIN_RST;
|
||||
|
||||
while (true)
|
||||
|
@ -128,6 +127,8 @@ void power_off()
|
|||
{
|
||||
sd_unmount();
|
||||
display_end();
|
||||
|
||||
nyx_str->mtc_cfg.init_done = 0;
|
||||
|
||||
// Stop the alarm, in case we injected and powered off too fast.
|
||||
max77620_rtc_stop_alarm();
|
||||
|
|
|
@ -31,6 +31,7 @@ typedef enum
|
|||
ERR_LIBSYS_LP0 = (1 << 0),
|
||||
ERR_SYSOLD_NYX = (1 << 1),
|
||||
ERR_SYSOLD_MTC = (1 << 2),
|
||||
ERR_EXCEPT_ENB = (1 << 31),
|
||||
} hekate_errors_t;
|
||||
|
||||
#define byte_swap_32(num) (((num >> 24) & 0xff) | ((num << 8) & 0xff0000) | \
|
||||
|
|
|
@ -21,7 +21,7 @@ VPATH += $(dir $(wildcard ./$(SOURCEDIR)/*/*/*/)) $(dir $(wildcard ./$(SOURCEDIR
|
|||
|
||||
# Main and graphics.
|
||||
OBJS = $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
||||
start.o \
|
||||
start.o exception_handlers.o \
|
||||
nyx.o heap.o \
|
||||
gfx.o \
|
||||
gui.o gui_info.o gui_tools.o gui_options.o gui_emmc_tools.o gui_emummc_tools.o \
|
||||
|
@ -30,9 +30,10 @@ OBJS = $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
|||
|
||||
# Hardware.
|
||||
OBJS += $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
||||
bpmp.o clock.o cluster.o di.o gpio.o i2c.o mc.o sdram.o pinmux.o se.o smmu.o tsec.o uart.o \
|
||||
fuse.o kfuse.o minerva.o \
|
||||
sdmmc.o sdmmc_driver.o \
|
||||
bpmp.o clock.o cluster.o di.o gpio.o i2c.o irq.o pinmux.o se.o smmu.o tsec.o uart.o \
|
||||
fuse.o kfuse.o \
|
||||
mc.o sdram.o minerva.o \
|
||||
sdmmc.o sdmmc_driver.o nx_emmc.o nx_sd.o \
|
||||
bq24193.o max17050.o max7762x.o max77620-rtc.o regulator_5v.o \
|
||||
touch.o tmp451.o fan.o \
|
||||
hw_init.o \
|
||||
|
|
|
@ -116,7 +116,7 @@ _reset:
|
|||
LDR R1, =0x30505645 /* EVP0 */
|
||||
STR R1, [R0] /* EVP0 in EXCP_EN_ADDR */
|
||||
LDR R0, =EXCP_LR_ADDR
|
||||
MOV R1, LR
|
||||
MOV R1, LR
|
||||
STR R1, [R0] /* Save LR in EXCP_LR_ADDR */
|
||||
LDR R0, =__bss_start
|
||||
EOR R1, R1, R1
|
||||
|
|
|
@ -800,13 +800,13 @@ static void _create_tab_about(lv_theme_t * th, lv_obj_t * parent)
|
|||
|
||||
static void _update_status_bar(void *params)
|
||||
{
|
||||
char *label = (char *)malloc(64);
|
||||
char *label = (char *)malloc(128);
|
||||
|
||||
u16 soc_temp;
|
||||
u32 batt_percent;
|
||||
int charge_status;
|
||||
int batt_volt;
|
||||
int batt_curr;
|
||||
u16 soc_temp = 0;
|
||||
u32 batt_percent = 0;
|
||||
int charge_status = 0;
|
||||
int batt_volt = 0;
|
||||
int batt_curr = 0;
|
||||
rtc_time_t time;
|
||||
|
||||
// Get sensor data.
|
||||
|
@ -1119,7 +1119,7 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
|
|||
}
|
||||
|
||||
// Parse ini boot entries and set buttons/icons.
|
||||
char *tmp_path = calloc(0x80, 1);
|
||||
char *tmp_path = malloc(1024);
|
||||
LIST_INIT(ini_sections);
|
||||
if (sd_mount())
|
||||
{
|
||||
|
@ -1133,7 +1133,7 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
|
|||
if (ini_parse_success)
|
||||
{
|
||||
// Iterate to all boot entries and load icons.
|
||||
u32 i = 1, x = 0;
|
||||
u32 i = 1, curr_btn_idx = 0;
|
||||
LIST_FOREACH_ENTRY(ini_sec_t, ini_sec, &ini_sections, link)
|
||||
{
|
||||
if (!strcmp(ini_sec->name, "config") || (ini_sec->type != INI_CHOICE))
|
||||
|
@ -1171,7 +1171,7 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
|
|||
bmp = bmp_to_lvimg_obj(icon_path);
|
||||
|
||||
// Enable button.
|
||||
lv_obj_set_opa_scale(launch_ctxt[x], LV_OPA_COVER);
|
||||
lv_obj_set_opa_scale(launch_ctxt[curr_btn_idx], LV_OPA_COVER);
|
||||
|
||||
// Default to switch logo if no icon found at all.
|
||||
if (!bmp)
|
||||
|
@ -1180,12 +1180,12 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
|
|||
//Set icon.
|
||||
if (bmp)
|
||||
{
|
||||
img = lv_img_create(launch_ctxt[x], NULL);
|
||||
img = lv_img_create(launch_ctxt[curr_btn_idx], NULL);
|
||||
lv_img_set_src(img, bmp);
|
||||
}
|
||||
|
||||
// Add button mask/radius and align icon.
|
||||
lv_obj_t *btn = lv_btn_create(launch_ctxt[x], NULL);
|
||||
lv_obj_t *btn = lv_btn_create(launch_ctxt[curr_btn_idx], NULL);
|
||||
lv_obj_set_size(btn, 200, 200);
|
||||
lv_btn_set_style(btn, LV_BTN_STYLE_REL, &btn_home_transp_rel);
|
||||
lv_btn_set_style(btn, LV_BTN_STYLE_PR, &btn_home_transp_pr);
|
||||
|
@ -1195,7 +1195,7 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
|
|||
// Set autoboot index.
|
||||
ext = lv_obj_get_ext_attr(btn);
|
||||
ext->idx = i;
|
||||
ext = lv_obj_get_ext_attr(launch_ctxt[x]); // Redundancy.
|
||||
ext = lv_obj_get_ext_attr(launch_ctxt[curr_btn_idx]); // Redundancy.
|
||||
ext->idx = i;
|
||||
|
||||
// Set action.
|
||||
|
@ -1205,15 +1205,15 @@ static lv_res_t _create_window_home_launch(lv_obj_t *btn)
|
|||
lv_btn_set_action(btn, LV_BTN_ACTION_CLICK, _launch_more_cfg_action);
|
||||
|
||||
// Set button's label text.
|
||||
lv_label_set_text(launch_ctxt[x + 1], ini_sec->name);
|
||||
lv_obj_set_opa_scale(launch_ctxt[x + 1], LV_OPA_COVER);
|
||||
lv_label_set_text(launch_ctxt[curr_btn_idx + 1], ini_sec->name);
|
||||
lv_obj_set_opa_scale(launch_ctxt[curr_btn_idx + 1], LV_OPA_COVER);
|
||||
|
||||
// Set rolling text if name is big.
|
||||
if (strlen(ini_sec->name) > 22)
|
||||
lv_label_set_long_mode(boot_entry_label, LV_LABEL_LONG_ROLL);
|
||||
|
||||
i++;
|
||||
x += 2;
|
||||
curr_btn_idx += 2;
|
||||
|
||||
if (i > max_entries)
|
||||
break;
|
||||
|
@ -1477,9 +1477,9 @@ static void _nyx_set_default_styles(lv_theme_t * th)
|
|||
hint_small_style_white.text.font = &interui_20;
|
||||
|
||||
lv_style_copy(&monospace_text, &lv_style_plain);
|
||||
monospace_text.body.main_color = LV_COLOR_HEX(0x1b1b1b);
|
||||
monospace_text.body.grad_color = LV_COLOR_HEX(0x1b1b1b);
|
||||
monospace_text.body.border.color = LV_COLOR_HEX(0x1b1b1b);
|
||||
monospace_text.body.main_color = LV_COLOR_HEX(0x1B1B1B);
|
||||
monospace_text.body.grad_color = LV_COLOR_HEX(0x1B1B1B);
|
||||
monospace_text.body.border.color = LV_COLOR_HEX(0x1B1B1B);
|
||||
monospace_text.body.border.width = 0;
|
||||
monospace_text.body.opa = LV_OPA_TRANSP;
|
||||
monospace_text.text.color = LV_COLOR_HEX(0xD8D8D8);
|
||||
|
|
|
@ -52,7 +52,7 @@ static const pkg1_id_t _pkg1_ids[] = {
|
|||
{ "20190208150037", 7, 0x0F00, 0x6FE0, { 1, 2, 0 }, 0x40030000, 0x4003E000 }, //7.0.1
|
||||
{ "20190314172056", 7, 0x0E00, 0x6FE0, { 1, 2, 0 }, 0x40030000, 0x4003E000 }, //8.0.0 - 8.0.1
|
||||
{ "20190531152432", 8, 0x0E00, 0x6FE0, { 1, 2, 0 }, 0x40030000, 0x4003E000 }, //8.1.0
|
||||
{ "20190809135709", 9, 0x0E00, 0x6FE0, { 1, 2, 0 }, 0x40030000, 0x4003E000 }, //9.0.0
|
||||
{ "20190809135709", 9, 0x0E00, 0x6FE0, { 1, 2, 0 }, 0x40030000, 0x4003E000 }, //9.0.0 - 9.0.1
|
||||
{ "20191021113848", 10, 0x0E00, 0x6FE0, { 1, 2, 0 }, 0x40030000, 0x4003E000 }, //9.1.0
|
||||
{ "20200303104606", 10, 0x0E00, 0x6FE0, { 1, 2, 0 }, 0x40030000, 0x4003E000 }, //10.0.0
|
||||
{ NULL } //End.
|
||||
|
|
|
@ -116,7 +116,6 @@ static const u8 mkey_keyseed_8xx[][0x10] =
|
|||
|
||||
static bool _pkg2_key_unwrap_validate(pkg2_hdr_t *tmp_test, pkg2_hdr_t *hdr, u8 src_slot, u8 *mkey, const u8 *key_seed)
|
||||
{
|
||||
|
||||
// Decrypt older encrypted mkey.
|
||||
se_aes_crypt_ecb(src_slot, 0, mkey, 0x10, key_seed, 0x10);
|
||||
// Set and unwrap pkg2 key.
|
||||
|
@ -177,7 +176,7 @@ pkg2_hdr_t *pkg2_decrypt(void *data, u8 kb)
|
|||
mkey_seeds_idx--;
|
||||
se_aes_key_clear(9);
|
||||
se_aes_key_set(9, tmp_mkey, 0x10);
|
||||
|
||||
|
||||
decr_slot = 9; // Temp key.
|
||||
|
||||
// Check if we tried last key for that pkg2 version.
|
||||
|
|
|
@ -5906,7 +5906,7 @@ FRESULT f_mkfs (
|
|||
} else {
|
||||
/* Create a single-partition in this function */
|
||||
if (disk_ioctl(pdrv, GET_SECTOR_COUNT, &sz_vol) != RES_OK) LEAVE_MKFS(FR_DISK_ERR);
|
||||
b_vol = (opt & FM_SFD) ? 0 : 63; /* Volume start sector */
|
||||
b_vol = (opt & FM_SFD) ? 0 : 32768; /* Volume start sector. Align to 16MB */
|
||||
if (sz_vol < b_vol) LEAVE_MKFS(FR_MKFS_ABORTED);
|
||||
sz_vol -= b_vol; /* Volume size */
|
||||
}
|
||||
|
@ -6193,13 +6193,13 @@ FRESULT f_mkfs (
|
|||
st_word(buf + BPB_BkBootSec32, 6); /* Offset of backup VBR (VBR + 6) */
|
||||
buf[BS_DrvNum32] = 0x80; /* Drive number (for int13) */
|
||||
buf[BS_BootSig32] = 0x29; /* Extended boot signature */
|
||||
mem_cpy(buf + BS_VolLab32, "NO NAME " "FAT32 ", 19); /* Volume label, FAT signature */
|
||||
mem_cpy(buf + BS_VolLab32, "SWITCH SD " "FAT32 ", 19); /* Volume label, FAT signature */
|
||||
} else {
|
||||
st_dword(buf + BS_VolID, GET_FATTIME()); /* VSN */
|
||||
st_word(buf + BPB_FATSz16, (WORD)sz_fat); /* FAT size [sector] */
|
||||
buf[BS_DrvNum] = 0x80; /* Drive number (for int13) */
|
||||
buf[BS_BootSig] = 0x29; /* Extended boot signature */
|
||||
mem_cpy(buf + BS_VolLab, "NO NAME " "FAT ", 19); /* Volume label, FAT signature */
|
||||
mem_cpy(buf + BS_VolLab, "SWITCH SD " "FAT ", 19); /* Volume label, FAT signature */
|
||||
}
|
||||
st_word(buf + BS_55AA, 0xAA55); /* Signature (offset is fixed here regardless of sector size) */
|
||||
if (disk_write(pdrv, buf, b_vol, 1) != RES_OK) LEAVE_MKFS(FR_DISK_ERR); /* Write it to the VBR sector */
|
||||
|
|
|
@ -380,8 +380,11 @@ int ff_del_syncobj (FF_SYNC_t sobj); /* Delete a sync object */
|
|||
#define AM_RDO 0x01 /* Read only */
|
||||
#define AM_HID 0x02 /* Hidden */
|
||||
#define AM_SYS 0x04 /* System */
|
||||
#define AM_VOL 0x08 /* Volume */
|
||||
#define AM_DIR 0x10 /* Directory */
|
||||
#define AM_ARC 0x20 /* Archive */
|
||||
#define AM_DEV 0x40 /* Device */
|
||||
#define AM_RVD 0x80 /* Reserved */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -163,7 +163,7 @@
|
|||
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't caused problem
|
||||
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
|
||||
*/
|
||||
# define LV_LOG_LEVEL LV_LOG_LEVEL_ERROR
|
||||
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
|
||||
/* 1: Print the log with 'printf'; 0: user need to register a callback*/
|
||||
# define LV_LOG_PRINTF 1
|
||||
#endif /*USE_LV_LOG*/
|
||||
|
|
|
@ -186,7 +186,7 @@ static void label_init(void)
|
|||
sec.text.color = LV_COLOR_HEX(0xFF5500);
|
||||
|
||||
lv_style_copy(&hint, &prim);
|
||||
hint.text.color = LV_COLOR_HEX3(0xCCC);
|
||||
hint.text.color = LV_COLOR_HEX(0xCCCCCC);
|
||||
|
||||
theme.label.prim = &prim;
|
||||
theme.label.sec = &sec;
|
||||
|
@ -199,7 +199,7 @@ static void img_init(void)
|
|||
#if USE_LV_IMG != 0
|
||||
static lv_style_t img_light, img_dark;
|
||||
lv_style_copy(&img_light, &def);
|
||||
img_light.image.color = LV_COLOR_HEX(0xffffff);
|
||||
img_light.image.color = LV_COLOR_WHITE;
|
||||
img_light.image.intense = LV_OPA_80;
|
||||
|
||||
lv_style_copy(&img_dark, &def);
|
||||
|
@ -302,7 +302,7 @@ static void sw_init(void)
|
|||
sw_knob_off.body.main_color = LV_COLOR_HEX(0xDADADA);
|
||||
sw_knob_off.body.grad_color = sw_knob_off.body.main_color;
|
||||
sw_knob_off.body.border.width = 1;
|
||||
sw_knob_off.body.border.color = LV_COLOR_HEX3(0x999);
|
||||
sw_knob_off.body.border.color = LV_COLOR_HEX(0x999999);
|
||||
sw_knob_off.body.border.opa = LV_OPA_COVER;
|
||||
|
||||
theme.sw.bg = &sw_bg;
|
||||
|
@ -321,7 +321,7 @@ static void lmeter_init(void)
|
|||
lmeter.body.main_color = lv_color_hsv_to_rgb(_hue, 75, 90);
|
||||
lmeter.body.grad_color = lmeter.body.main_color;
|
||||
lmeter.body.padding.hor = LV_DPI / 10; // Scale line length.
|
||||
lmeter.line.color = LV_COLOR_HEX3(0x999);
|
||||
lmeter.line.color = LV_COLOR_HEX(0x999999);
|
||||
lmeter.line.width = 2;
|
||||
|
||||
theme.lmeter = &lmeter;
|
||||
|
@ -338,8 +338,8 @@ static void gauge_init(void)
|
|||
gauge.body.grad_color = gauge.body.main_color;
|
||||
gauge.body.padding.hor = LV_DPI / 16; // Scale line length.
|
||||
gauge.body.padding.inner = LV_DPI / 8;
|
||||
gauge.body.border.color = LV_COLOR_HEX3(0x999);
|
||||
gauge.text.color = LV_COLOR_HEX3(0xddd);
|
||||
gauge.body.border.color = LV_COLOR_HEX(0x999999);
|
||||
gauge.text.color = LV_COLOR_HEX(0xDDDDDD);
|
||||
gauge.line.width = 3;
|
||||
gauge.line.color = lv_color_hsv_to_rgb(_hue, 95, 70);
|
||||
|
||||
|
@ -428,7 +428,7 @@ static void cb_init(void)
|
|||
rel.body.shadow.width = 3;
|
||||
|
||||
lv_style_copy(&pr, &rel);
|
||||
pr.body.main_color = LV_COLOR_HEX3(0xCCC);
|
||||
pr.body.main_color = LV_COLOR_HEX(0xCCCCCC);
|
||||
pr.body.grad_color = pr.body.main_color;
|
||||
pr.body.shadow.width = 3;
|
||||
|
||||
|
@ -462,18 +462,18 @@ static void btnm_init(void)
|
|||
bg.body.padding.hor = 0;
|
||||
bg.body.padding.ver = 0;
|
||||
bg.body.padding.inner = 0;
|
||||
bg.text.color = LV_COLOR_HEX3(0x555);
|
||||
bg.text.color = LV_COLOR_HEX(0x555555);
|
||||
|
||||
lv_style_copy(&rel, theme.panel);
|
||||
rel.body.border.part = LV_BORDER_FULL | LV_BORDER_INTERNAL;
|
||||
rel.body.border.width = 1;
|
||||
rel.body.border.color = LV_COLOR_HEX3(0xBBB);
|
||||
rel.body.border.color = LV_COLOR_HEX(0xBBBBBB);
|
||||
rel.body.empty = 1;
|
||||
rel.body.shadow.width = 0;
|
||||
|
||||
lv_style_copy(&pr, &rel);
|
||||
pr.glass = 0;
|
||||
pr.body.main_color = LV_COLOR_HEX3(0xDDD);
|
||||
pr.body.main_color = LV_COLOR_HEX(0xDDDDDD);
|
||||
pr.body.grad_color = pr.body.main_color;
|
||||
pr.body.border.width = 0;
|
||||
pr.body.empty = 0;
|
||||
|
@ -508,7 +508,7 @@ static void kb_init(void)
|
|||
static lv_style_t bg, rel;
|
||||
|
||||
lv_style_copy(&bg, theme.btnm.bg);
|
||||
bg.text.color = LV_COLOR_HEX3(0xCCC);
|
||||
bg.text.color = LV_COLOR_HEX(0xCCCCCC);
|
||||
|
||||
lv_style_copy(&rel, &lv_style_transp);
|
||||
rel.text.font = _font;
|
||||
|
@ -565,9 +565,9 @@ static void ta_init(void)
|
|||
oneline.body.radius = 0;
|
||||
oneline.body.border.part = LV_BORDER_BOTTOM;
|
||||
oneline.body.border.width = 3;
|
||||
oneline.body.border.color = LV_COLOR_HEX3(0x555);
|
||||
oneline.body.border.color = LV_COLOR_HEX(0x555555);
|
||||
oneline.body.border.opa = LV_OPA_COVER;
|
||||
oneline.text.color = LV_COLOR_HEX3(0x888);
|
||||
oneline.text.color = LV_COLOR_HEX(0x888888);
|
||||
|
||||
theme.ta.area = theme.panel;
|
||||
theme.ta.oneline = &oneline;
|
||||
|
@ -676,7 +676,7 @@ static void roller_init(void)
|
|||
roller_bg.text.line_space = LV_DPI / 8;
|
||||
roller_bg.text.font = _font;
|
||||
roller_bg.glass = 0;
|
||||
roller_bg.text.color = LV_COLOR_HEX3(0x444);
|
||||
roller_bg.text.color = LV_COLOR_HEX(0x444444);
|
||||
|
||||
lv_style_copy(&roller_sel, &roller_bg);
|
||||
roller_sel.text.color = COLOR_HOS_TURQUOISE;
|
||||
|
@ -705,7 +705,7 @@ static void tabview_init(void)
|
|||
btn_bg.body.radius = 0;
|
||||
btn_bg.body.empty = 1;
|
||||
btn_bg.body.border.width = 0;
|
||||
btn_bg.body.border.color = LV_COLOR_HEX3(0xDDD);
|
||||
btn_bg.body.border.color = LV_COLOR_HEX(0xDDDDDD);
|
||||
btn_bg.body.border.part = LV_BORDER_BOTTOM;
|
||||
btn_bg.body.border.opa = LV_OPA_COVER;
|
||||
btn_bg.body.shadow.width = 0;
|
||||
|
@ -726,7 +726,7 @@ static void tabview_init(void)
|
|||
pr.body.border.width = 0;
|
||||
pr.body.empty = 0;
|
||||
pr.body.radius = 0;
|
||||
pr.body.border.color = LV_COLOR_HEX3(0x888);
|
||||
pr.body.border.color = LV_COLOR_HEX(0x888888);
|
||||
pr.body.border.part = LV_BORDER_BOTTOM;
|
||||
pr.body.border.opa = LV_OPA_COVER;
|
||||
pr.text.color = COLOR_HOS_TURQUOISE;
|
||||
|
@ -788,7 +788,7 @@ static void win_init(void)
|
|||
header.body.grad_color = header.body.main_color;
|
||||
header.body.radius = 0;
|
||||
header.body.border.width = 0;
|
||||
header.body.border.color = LV_COLOR_HEX3(0xDDD);
|
||||
header.body.border.color = LV_COLOR_HEX(0xDDDDDD);
|
||||
header.body.border.part = LV_BORDER_BOTTOM;
|
||||
header.body.border.opa = LV_OPA_COVER;
|
||||
header.body.shadow.width = 0;
|
||||
|
|
|
@ -463,4 +463,54 @@
|
|||
#define MC_ERR_APB_ASID_UPDATE_STATUS 0x9d0
|
||||
#define MC_DA_CONFIG0 0x9dc
|
||||
|
||||
// MC_SECURITY_CARVEOUTX_CFG0
|
||||
// Mode of LOCK_MODE.
|
||||
#define PROTECT_MODE_SHIFT 0
|
||||
#define SEC_CARVEOUT_CFG_SECURE (0 << PROTECT_MODE_SHIFT0)
|
||||
#define SEC_CARVEOUT_CFG_TZ_SECURE (1 << PROTECT_MODE_SHIFT0)
|
||||
// Enables PROTECT_MODE.
|
||||
#define LOCK_MODE_SHIFT 1
|
||||
#define SEC_CARVEOUT_CFG_UNLOCKED (0 << LOCK_MODE_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_LOCKED (1 << LOCK_MODE_SHIFT)
|
||||
|
||||
#define ADDRESS_TYPE_SHIFT 2
|
||||
#define SEC_CARVEOUT_CFG_ANY_ADDRESS (0 << ADDRESS_TYPE_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_UNTRANSLATED_ONLY (1 << ADDRESS_TYPE_SHIFT)
|
||||
|
||||
#define READ_ACCESS_LEVEL_SHIFT 3
|
||||
#define SEC_CARVEOUT_CFG_RD_ALL (1 << READ_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_RD_UNK (2 << READ_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_RD_FALCON_LS (4 << READ_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_RD_FALCON_HS (8 << READ_ACCESS_LEVEL_SHIFT)
|
||||
|
||||
#define WRITE_ACCESS_LEVEL_SHIFT 7
|
||||
#define SEC_CARVEOUT_CFG_WR_ALL (1 << WRITE_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_WR_UNK (2 << WRITE_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_WR_FALCON_LS (4 << WRITE_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_WR_FALCON_HS (8 << WRITE_ACCESS_LEVEL_SHIFT)
|
||||
|
||||
#define SEC_CARVEOUT_CFG_APERTURE_ID_MASK (3 << 11)
|
||||
|
||||
#define DISABLE_READ_CHECK_ACCESS_LEVEL_SHIFT 14
|
||||
#define SEC_CARVEOUT_CFG_DIS_RD_CHECK_L0 (1 << DISABLE_READ_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_DIS_RD_CHECK_L1 (2 << DISABLE_READ_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_DIS_RD_CHECK_L2 (4 << DISABLE_READ_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_DIS_RD_CHECK_L3 (8 << DISABLE_READ_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
|
||||
#define DISABLE_WRITE_CHECK_ACCESS_LEVEL_SHIFT 18
|
||||
#define SEC_CARVEOUT_CFG_DIS_WR_CHECK_L0 (1 << DISABLE_WRITE_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_DIS_WR_CHECK_L1 (2 << DISABLE_WRITE_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_DIS_WR_CHECK_L2 (4 << DISABLE_WRITE_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
#define SEC_CARVEOUT_CFG_DIS_WR_CHECK_L3 (8 << DISABLE_WRITE_CHECK_ACCESS_LEVEL_SHIFT)
|
||||
|
||||
#define SEC_CARVEOUT_CFG_SEND_CFG_TO_GPU (1 << 22)
|
||||
|
||||
#define SEC_CARVEOUT_CFG_TZ_GLOBAL_WR_EN_BYPASS_CHECK (1 << 23)
|
||||
#define SEC_CARVEOUT_CFG_TZ_GLOBAL_RD_EN_BYPASS_CHECK (1 << 24)
|
||||
|
||||
#define SEC_CARVEOUT_CFG_ALLOW_APERTURE_ID_MISMATCH (1 << 25)
|
||||
#define SEC_CARVEOUT_CFG_FORCE_APERTURE_ID_MATCH (1 << 26)
|
||||
|
||||
#define SEC_CARVEOUT_CFG_IS_WPR (1 << 27)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
u8 *Kc_MENU_LOGO;
|
||||
#endif //MENU_LOGO_ENABLE
|
||||
|
||||
nyx_config n_cfg;
|
||||
hekate_config h_cfg;
|
||||
|
||||
const volatile ipl_ver_meta_t __attribute__((section ("._ipl_version"))) ipl_ver = {
|
||||
|
@ -292,7 +293,7 @@ static void _show_errors()
|
|||
gfx_con_setpos(0, 0);
|
||||
display_backlight_brightness(100, 1000);
|
||||
|
||||
WPRINTFARGS("An exception happened (LR %08X):\n", *excp_lr);
|
||||
WPRINTFARGS("An exception occurred (LR %08X):\n", *excp_lr);
|
||||
switch (*excp_type)
|
||||
{
|
||||
case EXCP_TYPE_RESET:
|
||||
|
@ -331,10 +332,14 @@ void nyx_init_load_res()
|
|||
|
||||
// Set bootloader's default configuration.
|
||||
set_default_configuration();
|
||||
set_nyx_default_configuration();
|
||||
|
||||
gfx_init_ctxt((u32 *)NYX_FB_ADDRESS, 720, 1280, 720);
|
||||
gfx_con_init();
|
||||
|
||||
// Show exception errors if any.
|
||||
_show_errors();
|
||||
|
||||
sd_mount();
|
||||
|
||||
// Train DRAM and switch to max frequency.
|
||||
|
|
|
@ -25,13 +25,23 @@
|
|||
#define APBDEV_PMC_PWRGATE_TOGGLE 0x30
|
||||
#define APBDEV_PMC_PWRGATE_STATUS 0x38
|
||||
#define APBDEV_PMC_NO_IOPOWER 0x44
|
||||
#define PMC_NO_IOPOWER_GPIO_IO_EN (1 << 21)
|
||||
#define PMC_NO_IOPOWER_AUDIO_HV (1 << 18)
|
||||
#define PMC_NO_IOPOWER_SDMMC1_IO_EN (1 << 12)
|
||||
#define APBDEV_PMC_SCRATCH0 0x50
|
||||
#define PMC_SCRATCH0_MODE_RECOVERY (1 << 31)
|
||||
#define PMC_SCRATCH0_MODE_FASTBOOT (1 << 30)
|
||||
#define PMC_SCRATCH0_MODE_PAYLOAD (1 << 29)
|
||||
#define PMC_SCRATCH0_MODE_RCM (1 << 1)
|
||||
#define PMC_SCRATCH0_MODE_WARMBOOT (1 << 0)
|
||||
#define APBDEV_PMC_SCRATCH1 0x54
|
||||
#define APBDEV_PMC_SCRATCH20 0xA0
|
||||
#define APBDEV_PMC_PWR_DET_VAL 0xE4
|
||||
#define PMC_PWR_DET_GPIO_IO_EN (1 << 21)
|
||||
#define PMC_PWR_DET_AUDIO_HV (1 << 18)
|
||||
#define PMC_PWR_DET_SDMMC1_IO_EN (1 << 12)
|
||||
#define APBDEV_PMC_DDR_PWR 0xE8
|
||||
#define APBDEV_PMC_USB_AO 0xF0
|
||||
#define APBDEV_PMC_CRYPTO_OP 0xF4
|
||||
#define PMC_CRYPTO_OP_SE_ENABLE 0
|
||||
#define PMC_CRYPTO_OP_SE_DISABLE 1
|
||||
|
@ -39,6 +49,8 @@
|
|||
#define APBDEV_PMC_SCRATCH40 0x13C
|
||||
#define APBDEV_PMC_OSC_EDPD_OVER 0x1A4
|
||||
#define PMC_OSC_EDPD_OVER_OSC_CTRL_OVER 0x400000
|
||||
#define APBDEV_PMC_CLK_OUT_CNTRL 0x1A8
|
||||
#define PMC_CLK_OUT_CNTRL_CLK1_FORCE_EN (1 << 2)
|
||||
#define APBDEV_PMC_RST_STATUS 0x1B4
|
||||
#define APBDEV_PMC_IO_DPD_REQ 0x1B8
|
||||
#define APBDEV_PMC_IO_DPD2_REQ 0x1C0
|
||||
|
|
|
@ -31,6 +31,7 @@ typedef enum
|
|||
ERR_LIBSYS_LP0 = (1 << 0),
|
||||
ERR_SYSOLD_NYX = (1 << 1),
|
||||
ERR_SYSOLD_MTC = (1 << 2),
|
||||
ERR_EXCEPT_ENB = (1 << 31),
|
||||
} hekate_errors_t;
|
||||
|
||||
#define byte_swap_32(num) (((num >> 24) & 0xff) | ((num << 8) & 0xff0000) | \
|
||||
|
|
Loading…
Reference in a new issue