From 7e876388b431b9979a20edb0fd99792f053c59ac Mon Sep 17 00:00:00 2001 From: Kostas Missos Date: Tue, 21 Aug 2018 04:26:14 +0300 Subject: [PATCH] Bugfixes - Fixed partial dumping filename/bar position - Add return for menu function handler - More files to bootloader folder --- bootloader/config/config.c | 8 ++------ bootloader/gfx/tui.c | 9 +++++++-- bootloader/gfx/tui.h | 1 + bootloader/libs/elfload/elfreloc_arm.c | 2 +- bootloader/main.c | 14 +++++++------- bootloader/soc/clock.h | 1 + bootloader/soc/t210.h | 2 ++ 7 files changed, 21 insertions(+), 16 deletions(-) diff --git a/bootloader/config/config.c b/bootloader/config/config.c index 7943e30..13cb9d1 100644 --- a/bootloader/config/config.c +++ b/bootloader/config/config.c @@ -132,8 +132,7 @@ void config_autoboot() LIST_INIT(ini_sections); - u8 max_entries = 29; - bool ini_freed = true; + u8 max_entries = 30; ment_t *ments = (ment_t *)malloc(sizeof(ment_t) * (max_entries + 3)); u32 *boot_values = (u32 *)malloc(sizeof(u32) * max_entries); @@ -146,8 +145,6 @@ void config_autoboot() { if (ini_parse(&ini_sections, "bootloader/hekate_ipl.ini")) { - ini_freed = false; - // Build configuration menu. ments[0].type = MENT_BACK; ments[0].caption = "Back"; @@ -229,8 +226,7 @@ out2:; free(ments); free(boot_values); free(boot_text); - if (!ini_freed) - ini_free(&ini_sections); + ini_free(&ini_sections); sd_unmount(); diff --git a/bootloader/gfx/tui.c b/bootloader/gfx/tui.c index 250a657..0d503ae 100644 --- a/bootloader/gfx/tui.c +++ b/bootloader/gfx/tui.c @@ -33,6 +33,8 @@ extern hekate_config h_cfg; void tui_sbar(gfx_con_t *con, bool force_update) { + u32 cx, cy; + u32 timePassed = get_tmr_s() - h_cfg.sbar_time_keeping; if (!force_update) if (timePassed < 5) @@ -45,7 +47,7 @@ void tui_sbar(gfx_con_t *con, bool force_update) u32 battPercent = 0; int battVoltCurr = 0; - gfx_con_getpos(con, &con->savedx, &con->savedy); + gfx_con_getpos(con, &cx, &cy); gfx_con_setpos(con, 0, 1260); max17050_get_property(MAX17050_RepSOC, (int *)&battPercent); @@ -64,7 +66,7 @@ void tui_sbar(gfx_con_t *con, bool force_update) gfx_printf(con, " %k-%d mA %k%K\n", 0xFF880000, (~battVoltCurr) / 1000, 0xFFCCCCCC, 0xFF1B1B1B); con->fntsz = prevFontSize; - gfx_con_setpos(con, con->savedx, con->savedy); + gfx_con_setpos(con, cx, cy); } void tui_pbar(gfx_con_t *con, int x, int y, u32 val, u32 fgcol, u32 bgcol) @@ -187,6 +189,9 @@ void *tui_do_menu(gfx_con_t *con, menu_t *menu) case MENT_BACK: return NULL; break; + case MENT_HDLR_RE: + ent->handler(ent->data); + return NULL; default: break; } diff --git a/bootloader/gfx/tui.h b/bootloader/gfx/tui.h index 306fedd..40eff42 100644 --- a/bootloader/gfx/tui.h +++ b/bootloader/gfx/tui.h @@ -28,6 +28,7 @@ #define MENT_BACK 4 #define MENT_CAPTION 5 #define MENT_CHGLINE 6 +#define MENT_HDLR_RE 7 typedef struct _ment_t { diff --git a/bootloader/libs/elfload/elfreloc_arm.c b/bootloader/libs/elfload/elfreloc_arm.c index 82544d9..8b905cb 100644 --- a/bootloader/libs/elfload/elfreloc_arm.c +++ b/bootloader/libs/elfload/elfreloc_arm.c @@ -14,9 +14,9 @@ // Taken from http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044f/IHI0044F_aaelf.pdf #define R_ARM_NONE 0 #define R_ARM_ABS32 2 -#define R_ARM_RELATIVE 23 #define R_ARM_JUMP_SLOT 22 #define R_ARM_GLOB_DAT 21 +#define R_ARM_RELATIVE 23 el_status el_applyrel(el_ctx *ctx, Elf_Rel *rel) { diff --git a/bootloader/main.c b/bootloader/main.c index f2d1388..5d88262 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -57,7 +57,6 @@ #include "power/bq24193.h" #include "config/config.h" #include "ianos/ianos.h" -#include "libs/elfload/elfload.h" //TODO: ugly. gfx_ctxt_t gfx_ctxt; @@ -1834,7 +1833,7 @@ void auto_launch_firmware() if (sd_mount()) { - if (ini_parse(&ini_sections, "hekate_ipl.ini")) + if (ini_parse(&ini_sections, "bootloader/hekate_ipl.ini")) { u32 configEntry = 0; u32 boot_entry_id = 0; @@ -1900,10 +1899,10 @@ void auto_launch_firmware() { bitmap = (u8 *)sd_file_read(bootlogoCustomEntry); if (bitmap == NULL) // Custom entry bootlogo not found, trying default custom one. - bitmap = (u8 *)sd_file_read("bootlogo.bmp"); + bitmap = (u8 *)sd_file_read("bootloader/bootlogo.bmp"); } else // User has not set a custom logo path. - bitmap = (u8 *)sd_file_read("bootlogo.bmp"); + bitmap = (u8 *)sd_file_read("bootloader/bootlogo.bmp"); if (bitmap != NULL) { @@ -1952,6 +1951,7 @@ void auto_launch_firmware() } else { + gfx_clear_grey(&gfx_ctxt, 0x1B); BOOTLOGO = (void *)malloc(0x4000); blz_uncompress_srcdest(BOOTLOGO_BLZ, SZ_BOOTLOGO_BLZ, BOOTLOGO, SZ_BOOTLOGO); gfx_set_rect_grey(&gfx_ctxt, BOOTLOGO, X_BOOTLOGO, Y_BOOTLOGO, 326, 544); @@ -2285,7 +2285,7 @@ void print_battery_info() if (sd_mount()) { char path[64]; - emmcsn_path_impl(path, "/Dumps", "fuel_gauge.bin", NULL); + emmcsn_path_impl(path, "/dumps", "fuel_gauge.bin", NULL); if (sd_save_to_file((u8 *)buf, 0x200, path)) EPRINTF("\nError creating fuel.bin file."); else @@ -2582,7 +2582,6 @@ menu_t menu_tools = { ment_t ment_top[] = { MDEF_HANDLER("Launch firmware", launch_firmware), - MDEF_HANDLER("Launch ELF", launch_elf), MDEF_MENU("Launch options", &menu_options), MDEF_CAPTION("---------------", 0xFF444444), MDEF_MENU("Tools", &menu_tools), @@ -2619,7 +2618,7 @@ void ipl_main() ianos_loader(true, "bootloader/sys/libsys_lp0.bso", DRAM_LIB, (void *)sdram_get_params()); display_init(); - //display_color_screen(0xAABBCCDD); + u32 *fb = display_init_framebuffer(); gfx_init_ctxt(&gfx_ctxt, fb, 720, 1280, 768); @@ -2632,6 +2631,7 @@ void ipl_main() // Enable backlight after initializing gfx //display_backlight(true); + set_default_configuration(); // Load saved configuration and auto boot if enabled. auto_launch_firmware(); diff --git a/bootloader/soc/clock.h b/bootloader/soc/clock.h index 34df2ae..20ba295 100644 --- a/bootloader/soc/clock.h +++ b/bootloader/soc/clock.h @@ -34,6 +34,7 @@ #define CLK_RST_CONTROLLER_CLK_SYSTEM_RATE 0x30 #define CLK_RST_CONTROLLER_MISC_CLK_ENB 0x48 #define CLK_RST_CONTROLLER_OSC_CTRL 0x50 +#define CLK_RST_CONTROLLER_PLLC_BASE 0x80 #define CLK_RST_CONTROLLER_PLLC_MISC 0x88 #define CLK_RST_CONTROLLER_PLLM_BASE 0x90 #define CLK_RST_CONTROLLER_PLLM_MISC1 0x98 diff --git a/bootloader/soc/t210.h b/bootloader/soc/t210.h index e990093..f41139c 100644 --- a/bootloader/soc/t210.h +++ b/bootloader/soc/t210.h @@ -20,6 +20,7 @@ #include "../utils/types.h" #define HOST1X_BASE 0x50000000 +#define BPMP_CACHE_BASE 0x50040000 #define DISPLAY_A_BASE 0x54200000 #define DSI_BASE 0x54300000 #define VIC_BASE 0x54340000 @@ -57,6 +58,7 @@ #define _REG(base, off) *(vu32 *)((base) + (off)) #define HOST1X(off) _REG(HOST1X_BASE, off) +#define BPMP_CACHE_CTRL(off) _REG(BPMP_CACHE_BASE, off) #define DISPLAY_A(off) _REG(DISPLAY_A_BASE, off) #define DSI(off) _REG(DSI_BASE, off) #define VIC(off) _REG(VIC_BASE, off)