diff --git a/bootloader/config/config.c b/bootloader/config/config.c index 5234338..23dd8d6 100644 --- a/bootloader/config/config.c +++ b/bootloader/config/config.c @@ -46,6 +46,7 @@ void set_default_configuration() h_cfg.se_keygen_done = 0; h_cfg.sbar_time_keeping = 0; h_cfg.backlight = 100; + h_cfg.errors = 0; } int create_config_entry() diff --git a/bootloader/config/config.h b/bootloader/config/config.h index 0482f24..74fd646 100644 --- a/bootloader/config/config.h +++ b/bootloader/config/config.h @@ -30,8 +30,14 @@ typedef struct _hekate_config int se_keygen_done; u32 sbar_time_keeping; u32 backlight; + u32 errors; } hekate_config; +typedef enum +{ + ERR_LIBSYS_LP0 = (1 << 0), +} hsysmodule_t; + void set_default_configuration(); int create_config_entry(); void config_autoboot(); diff --git a/bootloader/gfx/tui.c b/bootloader/gfx/tui.c index e12ac9d..1e7a238 100644 --- a/bootloader/gfx/tui.c +++ b/bootloader/gfx/tui.c @@ -159,7 +159,13 @@ void *tui_do_menu(gfx_con_t *con, menu_t *menu) gfx_putc(con, '\n'); // Print help and battery status. - gfx_con_getpos(con, &con->savedx, &con->savedy); + gfx_con_setpos(con, 0, 1127); + if (h_cfg.errors) + { + gfx_printf(con, "%k Warning: %k", 0xFF800000, 0xFF555555); + if (h_cfg.errors & ERR_LIBSYS_LP0) + gfx_printf(con, "Sleep mode library is missing!\n"); + } gfx_con_setpos(con, 0, 1191); gfx_printf(con, "%k VOL: Move up/down\n PWR: Select option%k", 0xFF555555, 0xFFCCCCCC); diff --git a/bootloader/main.c b/bootloader/main.c index 60441a2..fd56c19 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -223,6 +223,39 @@ void panic(u32 val) ; } +void reboot_normal() +{ + sd_unmount(); +#ifdef MENU_LOGO_ENABLE + free(Kc_MENU_LOGO); +#endif //MENU_LOGO_ENABLE + display_end(); + panic(0x21); // Bypass fuse programming in package1. +} + +void reboot_rcm() +{ + sd_unmount(); +#ifdef MENU_LOGO_ENABLE + free(Kc_MENU_LOGO); +#endif //MENU_LOGO_ENABLE + display_end(); + PMC(APBDEV_PMC_SCRATCH0) = 2; // Reboot into rcm. + PMC(0) |= 0x10; + while (true) + usleep(1); +} + +void power_off() +{ + sd_unmount(); +#ifdef MENU_LOGO_ENABLE + free(Kc_MENU_LOGO); +#endif //MENU_LOGO_ENABLE + //TODO: we should probably make sure all regulators are powered off properly. + i2c_send_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_ONOFFCNFG1, MAX77620_ONOFFCNFG1_PWR_OFF); +} + void config_oscillators() { CLOCK(CLK_RST_CONTROLLER_SPARE_REG0) = (CLOCK(CLK_RST_CONTROLLER_SPARE_REG0) & 0xFFFFFFF3) | 4; @@ -771,37 +804,6 @@ out: free(pkg1); } -void reboot_normal() -{ - sd_unmount(); -#ifdef MENU_LOGO_ENABLE - free(Kc_MENU_LOGO); -#endif //MENU_LOGO_ENABLE - panic(0x21); // Bypass fuse programming in package1. -} - -void reboot_rcm() -{ - sd_unmount(); -#ifdef MENU_LOGO_ENABLE - free(Kc_MENU_LOGO); -#endif //MENU_LOGO_ENABLE - PMC(APBDEV_PMC_SCRATCH0) = 2; // Reboot into rcm. - PMC(0) |= 0x10; - while (true) - usleep(1); -} - -void power_off() -{ - sd_unmount(); -#ifdef MENU_LOGO_ENABLE - free(Kc_MENU_LOGO); -#endif //MENU_LOGO_ENABLE - //TODO: we should probably make sure all regulators are powered off properly. - i2c_send_byte(I2C_5, 0x3C, MAX77620_REG_ONOFFCNFG1, MAX77620_ONOFFCNFG1_PWR_OFF); -} - int dump_emmc_verify(sdmmc_storage_t *storage, u32 lba_curr, char *outFilename, emmc_part_t *part) { FIL fp; @@ -3182,7 +3184,8 @@ void ipl_main() set_default_configuration(); // Save sdram lp0 config. - ianos_loader(true, "bootloader/sys/libsys_lp0.bso", DRAM_LIB, (void *)sdram_get_params()); + if (ianos_loader(true, "bootloader/sys/libsys_lp0.bso", DRAM_LIB, (void *)sdram_get_params())) + h_cfg.errors |= ERR_LIBSYS_LP0; display_init();