nyx: Properly calculate Ranks and Channels in hw info

This commit is contained in:
CTCaer 2020-11-15 13:50:19 +02:00
parent b5df428e43
commit 55568b037f

View file

@ -609,6 +609,9 @@ static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn)
emc_mr_data_t ram_rev0 = sdram_read_mrx(MR6_REV_ID1); emc_mr_data_t ram_rev0 = sdram_read_mrx(MR6_REV_ID1);
emc_mr_data_t ram_rev1 = sdram_read_mrx(MR7_REV_ID2); emc_mr_data_t ram_rev1 = sdram_read_mrx(MR7_REV_ID2);
emc_mr_data_t ram_density = sdram_read_mrx(MR8_DENSITY); emc_mr_data_t ram_density = sdram_read_mrx(MR8_DENSITY);
u32 ranks = EMC(EMC_ADR_CFG) + 1;
u32 channels = (EMC(EMC_FBIO_CFG7) >> 1) & 3;
u32 die_channels = ranks * ((channels & 1) + ((channels & 2) >> 1));
s_printf(txt_buf, "#00DDFF LPDDR4 SDRAM ##FF8000 Slot 0 | Slot 1:#\n#FF8000 Vendor:# "); s_printf(txt_buf, "#00DDFF LPDDR4 SDRAM ##FF8000 Slot 0 | Slot 1:#\n#FF8000 Vendor:# ");
switch (ram_vendor.rank0_ch0) switch (ram_vendor.rank0_ch0)
{ {
@ -626,7 +629,7 @@ static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn)
break; break;
} }
s_printf(txt_buf + strlen(txt_buf), " (%d) #FF8000 |# ", ram_vendor.rank0_ch0); s_printf(txt_buf + strlen(txt_buf), " (%d) #FF8000 |# ", ram_vendor.rank0_ch0);
switch (ram_vendor.rank1_ch0) switch (ram_vendor.rank0_ch1)
{ {
case 1: case 1:
strcat(txt_buf, "Samsung"); strcat(txt_buf, "Samsung");
@ -641,8 +644,9 @@ static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn)
strcat(txt_buf, "Unknown"); strcat(txt_buf, "Unknown");
break; break;
} }
s_printf(txt_buf + strlen(txt_buf), " (%d)\n#FF8000 Rev ID:# %04X #FF8000 |# %04X\n#FF8000 Density:# ", s_printf(txt_buf + strlen(txt_buf), " (%d)\n#FF8000 Rev ID:# %X.%02X #FF8000 |# %X.%02X\n#FF8000 Density:# %d",
ram_vendor.rank1_ch0, (ram_rev0.rank0_ch0 << 8) | ram_rev1.rank0_ch0, (ram_rev0.rank1_ch0 << 8) | ram_rev1.rank1_ch0); ram_vendor.rank0_ch1, ram_rev0.rank0_ch0, ram_rev1.rank0_ch0, ram_rev0.rank0_ch1, ram_rev1.rank0_ch1,
die_channels);
switch ((ram_density.rank0_ch0 & 0x3C) >> 2) switch ((ram_density.rank0_ch0 & 0x3C) >> 2)
{ {
case 2: case 2:
@ -658,8 +662,8 @@ static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn)
strcat(txt_buf, " x Unk"); strcat(txt_buf, " x Unk");
break; break;
} }
s_printf(txt_buf + strlen(txt_buf), " (%d) #FF8000 |# ", (ram_density.rank0_ch0 & 0x3C) >> 2); s_printf(txt_buf + strlen(txt_buf), " (%d) #FF8000 |# %d", (ram_density.rank0_ch0 & 0x3C) >> 2, die_channels);
switch ((ram_density.rank1_ch0 & 0x3C) >> 2) switch ((ram_density.rank0_ch1 & 0x3C) >> 2)
{ {
case 2: case 2:
strcat(txt_buf, " x 512MB"); strcat(txt_buf, " x 512MB");
@ -674,7 +678,7 @@ static lv_res_t _create_window_fuses_info_status(lv_obj_t *btn)
strcat(txt_buf, " x Unk"); strcat(txt_buf, " x Unk");
break; break;
} }
s_printf(txt_buf + strlen(txt_buf), " (%d)\n\n", (ram_density.rank1_ch0 & 0x3C) >> 2); s_printf(txt_buf + strlen(txt_buf), " (%d)\n\n", (ram_density.rank0_ch1 & 0x3C) >> 2);
// Display info. // Display info.
u8 display_rev = (nyx_str->info.disp_id >> 8) & 0xFF; u8 display_rev = (nyx_str->info.disp_id >> 8) & 0xFF;