1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-23 02:16:41 +00:00

fuse: Use fuse count function for burnt fuses

This commit is contained in:
CTCaer 2020-07-18 01:15:28 +03:00
parent 11df6030f9
commit adfa7c0780
3 changed files with 22 additions and 17 deletions

View file

@ -68,6 +68,18 @@ u32 fuse_read_odm_keygen_rev()
return 0; return 0;
} }
u8 fuse_count_burnt(u32 val)
{
u8 burnt_fuses = 0;
for (u32 i = 0; i < 32; i++)
{
if ((val >> i) & 1)
burnt_fuses++;
}
return burnt_fuses;
}
void fuse_wait_idle() void fuse_wait_idle()
{ {
u32 ctrl; u32 ctrl;

View file

@ -78,6 +78,7 @@
void fuse_disable_program(); void fuse_disable_program();
u32 fuse_read_odm(u32 idx); u32 fuse_read_odm(u32 idx);
u32 fuse_read_odm_keygen_rev(); u32 fuse_read_odm_keygen_rev();
u8 fuse_count_burnt(u32 val);
void fuse_wait_idle(); void fuse_wait_idle();
int fuse_read_ipatch(void (*ipatch)(u32 offset, u32 value)); int fuse_read_ipatch(void (*ipatch)(u32 offset, u32 value));
int fuse_read_evp_thunk(u32 *iram_evp_thunks, u32 *iram_evp_thunks_len); int fuse_read_evp_thunk(u32 *iram_evp_thunks, u32 *iram_evp_thunks_len);

View file

@ -514,8 +514,6 @@ static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn)
char *txt_buf = (char *)malloc(0x4000); char *txt_buf = (char *)malloc(0x4000);
// Decode fuses. // Decode fuses.
u8 burntFuses7 = 0;
u8 burntFuses6 = 0;
u32 odm4 = fuse_read_odm(4); u32 odm4 = fuse_read_odm(4);
u8 dram_id = (odm4 >> 3) & 0x1F; u8 dram_id = (odm4 >> 3) & 0x1F;
char dram_man[16] = {0}; char dram_man[16] = {0};
@ -536,17 +534,11 @@ static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn)
break; break;
} }
for (u32 i = 0; i < 32; i++) // Count burnt fuses.
{ u8 burnt_fuses_7 = fuse_count_burnt(fuse_read_odm(7));
if ((fuse_read_odm(7) >> i) & 1) u8 burnt_fuses_6 = fuse_count_burnt(fuse_read_odm(6));
burntFuses7++;
}
for (u32 i = 0; i < 32; i++)
{
if ((fuse_read_odm(6) >> i) & 1)
burntFuses6++;
}
// Calculate LOT.
u32 lot_code0 = (FUSE(FUSE_OPT_LOT_CODE_0) & 0xFFFFFFF) << 2; u32 lot_code0 = (FUSE(FUSE_OPT_LOT_CODE_0) & 0xFFFFFFF) << 2;
u32 lot_bin = 0; u32 lot_bin = 0;
for (int i = 0; i < 5; ++i) for (int i = 0; i < 5; ++i)
@ -565,7 +557,7 @@ static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn)
"%d\n%d\n%d (0x%X)\n%d\n%d\n%d\n%d\n" "%d\n%d\n%d (0x%X)\n%d\n%d\n%d\n%d\n"
"ID: %02X, Major: A0%d, Minor: %d", "ID: %02X, Major: A0%d, Minor: %d",
FUSE(FUSE_SKU_INFO), odm4 & 0x30000 ? "Mariko" : "Erista", (fuse_read_odm(4) & 3) ? "Dev" : "Retail", FUSE(FUSE_SKU_INFO), odm4 & 0x30000 ? "Mariko" : "Erista", (fuse_read_odm(4) & 3) ? "Dev" : "Retail",
dram_id, dram_man, burntFuses7, burntFuses6, dram_id, dram_man, burnt_fuses_7, burnt_fuses_6,
byte_swap_32(FUSE(FUSE_PRIVATE_KEY0)), byte_swap_32(FUSE(FUSE_PRIVATE_KEY1)), byte_swap_32(FUSE(FUSE_PRIVATE_KEY0)), byte_swap_32(FUSE(FUSE_PRIVATE_KEY1)),
byte_swap_32(FUSE(FUSE_PRIVATE_KEY2)), byte_swap_32(FUSE(FUSE_PRIVATE_KEY3)), byte_swap_32(FUSE(FUSE_PRIVATE_KEY2)), byte_swap_32(FUSE(FUSE_PRIVATE_KEY3)),
byte_swap_32(FUSE(FUSE_PRIVATE_KEY4)), byte_swap_32(FUSE(FUSE_PRIVATE_KEY4)),