From 265ca5404c33864224197138cda13e4be36c2cc9 Mon Sep 17 00:00:00 2001 From: Baptiste MOINE Date: Tue, 4 Aug 2026 01:17:53 +0200 Subject: [PATCH] Serve measured MAX77620 CID3 and CID5 as whole bytes --- display/config_window.cpp | 13 +++++++++---- emu_state.h | 12 ++++++++++-- t210/mmio.cpp | 6 ++++-- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/display/config_window.cpp b/display/config_window.cpp index 741bb45..1feb437 100644 --- a/display/config_window.cpp +++ b/display/config_window.cpp @@ -52,8 +52,9 @@ void reset_to_defaults(EmuState *s) { s->usb_pd_amperage_ma = 1500; s->pmic_otp = 0x35; s->is_mariko = false; - s->pmic_silicon_rev = 0; - s->cpu_pmic_version = 0; + s->pmic_silicon_rev = 0x5B; // CID3, measured on a real console + s->pmic_es_rev = 0x81; // CID5 + s->cpu_pmic_version = 0x1C; s->sd_inserted = true; s->sd_cid_manfid = 0x03; s->sd_cid_oemid = 0x5344; // "SD" @@ -138,6 +139,7 @@ void reset_to_defaults(EmuState *s) { X(pmic_otp, "soc", "pmic_otp", 0) \ X(is_mariko, "soc", "is_mariko", 0) \ X(pmic_silicon_rev, "soc", "pmic_silicon_rev",0) \ + X(pmic_es_rev, "soc", "pmic_es_rev", 0) \ X(cpu_pmic_version, "soc", "cpu_pmic_version",0) \ /* Storage — SD (SDMMC1 CMD2) */ \ X(sd_inserted, "sd", "inserted", 0) \ @@ -410,8 +412,11 @@ void build_ui(EmuState *state) { if (ImGui::Combo("PMIC OTP", &idx, otp_items, IM_ARRAYSIZE(otp_items))) { state->pmic_otp.store(idx == 1 ? 0x53 : 0x35); } - atomic_slider_int("MAX77620 silicon rev", state->pmic_silicon_rev, 0, 15); - atomic_slider_int("MAX77621 chipid", state->cpu_pmic_version, 0, 15); + // Whole bytes (CID3 reads 0x5B on real silicon), so the range has to + // span 0..255 - a 0..15 slider silently clamped these to a nibble. + atomic_slider_int("MAX77620 CID3 (Si rev)", state->pmic_silicon_rev, 0, 255); + atomic_slider_int("MAX77620 CID5 (ES rev)", state->pmic_es_rev, 0, 255); + atomic_slider_int("MAX77621 chipid", state->cpu_pmic_version, 0, 255); } if (ImGui::CollapsingHeader("Charger (BQ24193)", ImGuiTreeNodeFlags_DefaultOpen)) { diff --git a/emu_state.h b/emu_state.h index 48ebf7e..7354854 100644 --- a/emu_state.h +++ b/emu_state.h @@ -158,8 +158,16 @@ struct EmuState { // Erista, 2 = T210B01 Mariko). Hekate's h_cfg.t210b01 derives from this, // which controls the pkg1 OEM-header skip among other things. std::atomic is_mariko{false}; - std::atomic pmic_silicon_rev{0}; // MAX77620 CID3 low nibble: "max77620 v%d" - std::atomic cpu_pmic_version{0}; // MAX77621 CHIPID1: "max77621 v%d" + // Silicon revisions, as read off a real console (Mariko, HAC-001(-01)): + // CID3 = 0x5B -> payloads print the low nibble, "max77620 v11" + // CID5 = 0x81 -> ES version (DIDM 8 / DIDO 1) + // These are whole bytes, not nibbles: masking CID3 to 4 bits (the old + // behaviour) made a genuine 0x5B read back as 0x0B. CID3/CID5 describe the + // silicon and are expected to be identical on Erista - only CID4 (the OTP + // version) differs by generation - but only Mariko is measured so far. + std::atomic pmic_silicon_rev{0x5B}; // MAX77620 CID3 + std::atomic pmic_es_rev{0x81}; // MAX77620 CID5 + std::atomic cpu_pmic_version{0x1C}; // MAX77621 CHIPID1 (unverified) // SD card insertion (GPIO Port Z bit 1 = 0 means inserted). std::atomic sd_inserted{true}; diff --git a/t210/mmio.cpp b/t210/mmio.cpp index 8bc11fa..743ea9d 100644 --- a/t210/mmio.cpp +++ b/t210/mmio.cpp @@ -398,9 +398,11 @@ uint32_t i2c_read(EmuState *state, uint64_t addr) { case 0x15: { // ONOFFSTAT — EN0 bit reflects power button return state->btn_power.load() ? (1 << 2) : 0; } - case 0x5B: return state->pmic_silicon_rev.load() & 0xF; // CID3: low nibble shown as "v%d" + // CID3 is a whole byte (0x5B on a real console); payloads print its low + // nibble as "max77620 v%d". Masking here would turn 0x5B into 0x0B. + case 0x5B: return state->pmic_silicon_rev.load(); case 0x5C: return state->pmic_otp.load(); // CID4: 0x35 Erista, 0x53 Mariko - case 0x5D: return 0x08; // CID5: ES version + case 0x5D: return state->pmic_es_rev.load(); // CID5: ES version (0x81) // Everything else comes out of the modelled register file, which holds // the values max77620_config_default() programs plus anything the // payload has written since. Returning 0 here (the old behaviour) made