1
0
mirror of https://github.com/CTCaer/hekate.git synced 2024-12-24 21:16:19 +00:00

minerva: Fix compatibility check for hekate main

Init now also returns status.
This commit is contained in:
CTCaer 2019-12-09 22:27:01 +02:00
parent bd8a5ece58
commit e4f7928513
4 changed files with 21 additions and 10 deletions

View File

@ -28,7 +28,7 @@
extern volatile nyx_storage_t *nyx_str; extern volatile nyx_storage_t *nyx_str;
void minerva_init() u32 minerva_init()
{ {
u32 curr_ram_idx = 0; u32 curr_ram_idx = 0;
@ -37,13 +37,17 @@ void minerva_init()
// Set table to nyx storage. // Set table to nyx storage.
mtc_cfg->mtc_table = (emc_table_t *)&nyx_str->mtc_table; mtc_cfg->mtc_table = (emc_table_t *)&nyx_str->mtc_table;
mtc_cfg->init_done = MTC_NEW_MAGIC;
mtc_cfg->sdram_id = (fuse_read_odm(4) >> 3) & 0x1F; mtc_cfg->sdram_id = (fuse_read_odm(4) >> 3) & 0x1F;
mtc_cfg->init_done = MTC_NEW_MAGIC; // Initialize mtc table.
u32 ep_addr = ianos_loader(false, "bootloader/sys/libsys_minerva.bso", DRAM_LIB, (void *)mtc_cfg); u32 ep_addr = ianos_loader(false, "bootloader/sys/libsys_minerva.bso", DRAM_LIB, (void *)mtc_cfg);
minerva_cfg = (void *)ep_addr;
// Ensure that Minerva is new.
if (mtc_cfg->init_done == MTC_INIT_MAGIC)
minerva_cfg = (void *)ep_addr;
if (!minerva_cfg) if (!minerva_cfg)
return; return 1;
// Get current frequency // Get current frequency
for (curr_ram_idx = 0; curr_ram_idx < 10; curr_ram_idx++) for (curr_ram_idx = 0; curr_ram_idx < 10; curr_ram_idx++)
@ -69,6 +73,8 @@ void minerva_init()
// Switch to max. // Switch to max.
mtc_cfg->rate_to = 1600000; mtc_cfg->rate_to = 1600000;
minerva_cfg(mtc_cfg, NULL); minerva_cfg(mtc_cfg, NULL);
return 0;
} }
void minerva_change_freq(minerva_freq_t freq) void minerva_change_freq(minerva_freq_t freq)

View File

@ -58,7 +58,7 @@ typedef enum
} minerva_freq_t; } minerva_freq_t;
void (*minerva_cfg)(mtc_config_t *mtc_cfg, void *); void (*minerva_cfg)(mtc_config_t *mtc_cfg, void *);
void minerva_init(); u32 minerva_init();
void minerva_change_freq(minerva_freq_t freq); void minerva_change_freq(minerva_freq_t freq);
void minerva_periodic_training(); void minerva_periodic_training();

View File

@ -28,7 +28,7 @@
extern volatile nyx_storage_t *nyx_str; extern volatile nyx_storage_t *nyx_str;
void minerva_init() u32 minerva_init()
{ {
u32 curr_ram_idx = 0; u32 curr_ram_idx = 0;
@ -37,23 +37,26 @@ void minerva_init()
// Set table to nyx storage. // Set table to nyx storage.
mtc_cfg->mtc_table = (emc_table_t *)&nyx_str->mtc_table; mtc_cfg->mtc_table = (emc_table_t *)&nyx_str->mtc_table;
// Set table to ram. // Check if Minerva is already initialized.
if (mtc_cfg->init_done == MTC_INIT_MAGIC) if (mtc_cfg->init_done == MTC_INIT_MAGIC)
{ {
mtc_cfg->train_mode = OP_PERIODIC_TRAIN; // Retrain if needed. mtc_cfg->train_mode = OP_PERIODIC_TRAIN; // Retrain if needed.
u32 ep_addr = ianos_loader(false, "bootloader/sys/libsys_minerva.bso", DRAM_LIB, (void *)mtc_cfg); u32 ep_addr = ianos_loader(false, "bootloader/sys/libsys_minerva.bso", DRAM_LIB, (void *)mtc_cfg);
minerva_cfg = (void *)ep_addr; minerva_cfg = (void *)ep_addr;
return; return 0;
} }
else else
{ {
mtc_config_t mtc_tmp; mtc_config_t mtc_tmp;
mtc_tmp.mtc_table = mtc_cfg->mtc_table; mtc_tmp.mtc_table = mtc_cfg->mtc_table;
mtc_tmp.sdram_id = (fuse_read_odm(4) >> 3) & 0x1F; mtc_tmp.sdram_id = (fuse_read_odm(4) >> 3) & 0x1F;
mtc_tmp.init_done = MTC_NEW_MAGIC; mtc_tmp.init_done = MTC_NEW_MAGIC;
u32 ep_addr = ianos_loader(false, "bootloader/sys/libsys_minerva.bso", DRAM_LIB, (void *)&mtc_tmp); u32 ep_addr = ianos_loader(false, "bootloader/sys/libsys_minerva.bso", DRAM_LIB, (void *)&mtc_tmp);
// Ensure that Minerva is new.
if (mtc_tmp.init_done == MTC_INIT_MAGIC) if (mtc_tmp.init_done == MTC_INIT_MAGIC)
minerva_cfg = (void *)ep_addr; minerva_cfg = (void *)ep_addr;
@ -63,7 +66,7 @@ void minerva_init()
} }
if (!minerva_cfg) if (!minerva_cfg)
return; return 1;
// Get current frequency // Get current frequency
for (curr_ram_idx = 0; curr_ram_idx < 10; curr_ram_idx++) for (curr_ram_idx = 0; curr_ram_idx < 10; curr_ram_idx++)
@ -89,6 +92,8 @@ void minerva_init()
// Switch to max. // Switch to max.
mtc_cfg->rate_to = 1600000; mtc_cfg->rate_to = 1600000;
minerva_cfg(mtc_cfg, NULL); minerva_cfg(mtc_cfg, NULL);
return 0;
} }
void minerva_change_freq(minerva_freq_t freq) void minerva_change_freq(minerva_freq_t freq)

View File

@ -58,7 +58,7 @@ typedef enum
} minerva_freq_t; } minerva_freq_t;
void (*minerva_cfg)(mtc_config_t *mtc_cfg, void *); void (*minerva_cfg)(mtc_config_t *mtc_cfg, void *);
void minerva_init(); u32 minerva_init();
void minerva_change_freq(minerva_freq_t freq); void minerva_change_freq(minerva_freq_t freq);
void minerva_periodic_training(); void minerva_periodic_training();