loader/hekate/nyx: utilize the new rsvd cfg

This commit is contained in:
CTCaer
2025-11-27 12:28:19 +02:00
parent 7cbefa3061
commit dcf8e76441
3 changed files with 31 additions and 17 deletions

View File

@@ -38,10 +38,11 @@
hekate_config h_cfg;
boot_cfg_t __attribute__((section ("._boot_cfg"))) b_cfg;
const volatile ipl_ver_meta_t __attribute__((section ("._ipl_version"))) ipl_ver = {
.magic = BL_MAGIC,
.version = (BL_VER_MJ + '0') | ((BL_VER_MN + '0') << 8) | ((BL_VER_HF + '0') << 16) | ((BL_VER_RL) << 24),
.rsvd0 = 0,
.rsvd1 = 0
.magic = BL_MAGIC,
.version = (BL_VER_MJ + '0') | ((BL_VER_MN + '0') << 8) | ((BL_VER_HF + '0') << 16) | ((BL_VER_RL) << 24),
.rcfg.rsvd_flags = 0,
.rcfg.bclk_t210 = BPMP_CLK_LOWER_BOOST,
.rcfg.bclk_t210b01 = BPMP_CLK_DEFAULT_BOOST
};
volatile nyx_storage_t *nyx_str = (nyx_storage_t *)NYX_STORAGE_ADDR;
@@ -656,11 +657,15 @@ static void _nyx_load_run()
// Set hekate version used to boot Nyx.
nyx_str->version = ipl_ver.version - 0x303030; // Convert ASCII to numbers.
// Set SD card initialization info.
nyx_str->info.magic = NYX_NEW_INFO;
nyx_str->info.sd_init = sd_get_mode();
// Set [new] info validation magic.
nyx_str->info.magic = NYX_NEW_INFO;
nyx_str->info_ex.magic = NYX_NEW_INFO;
// Set SD card error info.
// Set [new] reserved flags.
nyx_str->info_ex.rsvd_flags = ipl_ver.rcfg.rsvd_flags;
// Set [new] SD card initialization and error info.
nyx_str->info.sd_init = sd_get_mode();
u16 *sd_errors = sd_get_error_count();
for (u32 i = 0; i < 3; i++)
nyx_str->info.sd_errors[i] = sd_errors[i];
@@ -1491,7 +1496,7 @@ void ipl_main()
display_init();
// Overclock BPMP.
bpmp_clk_rate_set(h_cfg.t210b01 ? BPMP_CLK_DEFAULT_BOOST : BPMP_CLK_LOWER_BOOST);
bpmp_clk_rate_set(h_cfg.t210b01 ? ipl_ver.rcfg.bclk_t210b01 : ipl_ver.rcfg.bclk_t210);
// Mount SD Card.
h_cfg.errors |= !sd_mount() ? ERR_SD_BOOT_EN : 0;

View File

@@ -22,19 +22,22 @@
#include <memory_map.h>
#include <libs/compr/lz.h>
#include <soc/bpmp.h>
#include <soc/clock.h>
#include <soc/t210.h>
// 0x4003D000: Safe for panic preserving, 0x40038000: Safe for debugging needs.
#define IPL_RELOC_TOP 0x40038000
#define IPL_RELOC_TOP 0x40038000
#define IPL_PATCHED_RELOC_SZ 0x94
#define IPL_VERSION_RCFG_OFF 0x120
boot_cfg_t __attribute__((section ("._boot_cfg"))) b_cfg;
const volatile ipl_ver_meta_t __attribute__((section ("._ipl_version"))) ipl_ver = {
.magic = BL_MAGIC,
.version = (BL_VER_MJ + '0') | ((BL_VER_MN + '0') << 8) | ((BL_VER_HF + '0') << 16) | ((BL_VER_RL) << 24),
.rsvd0 = 0,
.rsvd1 = 0
.magic = BL_MAGIC,
.version = (BL_VER_MJ + '0') | ((BL_VER_MN + '0') << 8) | ((BL_VER_HF + '0') << 16) | ((BL_VER_RL) << 24),
.rcfg.rsvd_flags = 0,
.rcfg.bclk_t210 = BPMP_CLK_LOWER_BOOST,
.rcfg.bclk_t210b01 = BPMP_CLK_DEFAULT_BOOST
};
const char __attribute__((section ("._octopus"))) octopus[] =
@@ -104,6 +107,9 @@ void loader_main()
// Copy over boot configuration storage.
memcpy((u8 *)(IPL_LOAD_ADDR + IPL_PATCHED_RELOC_SZ), &b_cfg, sizeof(boot_cfg_t));
// Copy new reserved configuration.
memcpy((u8 *)(IPL_LOAD_ADDR + IPL_VERSION_RCFG_OFF), (rsvd_cfg_t *)&ipl_ver.rcfg, sizeof(rsvd_cfg_t));
// Chainload into uncompressed payload.
void (*ipl_ptr)() = (void *)IPL_LOAD_ADDR;
(*ipl_ptr)();

View File

@@ -36,8 +36,6 @@ hekate_config h_cfg;
const volatile ipl_ver_meta_t __attribute__((section ("._ipl_version"))) ipl_ver = {
.magic = NYX_MAGIC,
.version = (NYX_VER_MJ + '0') | ((NYX_VER_MN + '0') << 8) | ((NYX_VER_HF + '0') << 16) | ((NYX_VER_RL) << 24),
.rsvd0 = 0,
.rsvd1 = 0
};
volatile nyx_storage_t *nyx_str = (nyx_storage_t *)NYX_STORAGE_ADDR;
@@ -441,8 +439,13 @@ void nyx_init_load_res()
nyx_str->info.sd_errors[i] = 0;
}
// Reset new extended info if magic not correct.
if (nyx_str->info_ex.magic != NYX_NEW_INFO)
nyx_str->info_ex.rsvd_flags = 0;
// Clear info magic.
nyx_str->info.magic = 0;
nyx_str->info.magic = 0;
nyx_str->info_ex.magic = 0;
// Set display id from previous initialization.
display_set_decoded_panel_id(nyx_str->info.panel_id);