Add --oem flag for Erista / Mariko SoC selection

This commit is contained in:
Baptiste MOINE committed 2026-05-02 15:55:18 +02:00
1 parent 2f5f60eb6c
commit 1bb615e00f
5 files changed
+39 -5

No files matched your search

+1
View File
@@ -184,6 +184,7 @@ is in [t210/mmio.cpp](t210/mmio.cpp). Each encoder mirrors a corresponding
| `--boot0` | `BOOT0` | eMMC BOOT0 partition file (SDMMC4). | | `--boot0` | `BOOT0` | eMMC BOOT0 partition file (SDMMC4). |
| `--rawnand` | `rawnand.bin` | eMMC GPP partition prefix (auto-detects `.00`, `.01`, …). | | `--rawnand` | `rawnand.bin` | eMMC GPP partition prefix (auto-detects `.00`, `.01`, …). |
| `--prod-keys` | `prod.keys` | Override BIS keys from a Lockpick-style key file. | | `--prod-keys` | `prod.keys` | Override BIS keys from a Lockpick-style key file. |
| `--oem` | `erista` \| `mariko` | Switch SoC generation. Drives `APB_MISC_GP_HIDREV` so Hekate's `h_cfg.t210b01` matches and pkg1 identification skips the right OEM header. Default `erista`. |
| `--auto-pin-recovery` | (none) | Drive the Lockpick PIN-recovery menu without user input. | | `--auto-pin-recovery` | (none) | Drive the Lockpick PIN-recovery menu without user input. |
| `--auto-te-script` | (none) | Drive `recover_pin.te` in TegraExplorer without input. | | `--auto-te-script` | (none) | Drive `recover_pin.te` in TegraExplorer without input. |
+12 -2
View File
@@ -50,6 +50,7 @@ void reset_to_defaults(EmuState *s) {
s->usb_pd_voltage_mv = 5000; s->usb_pd_voltage_mv = 5000;
s->usb_pd_amperage_ma = 1500; s->usb_pd_amperage_ma = 1500;
s->pmic_otp = 0x35; s->pmic_otp = 0x35;
s->is_mariko = false;
s->pmic_silicon_rev = 0; s->pmic_silicon_rev = 0;
s->cpu_pmic_version = 0; s->cpu_pmic_version = 0;
s->sd_inserted = true; s->sd_inserted = true;
@@ -193,10 +194,19 @@ void build_ui(EmuState *state) {
atomic_slider_temp<int16_t>("PCB temp", state->pcb_temp_c10, 0.0f, 80.0f); atomic_slider_temp<int16_t>("PCB temp", state->pcb_temp_c10, 0.0f, 80.0f);
} }
if (ImGui::CollapsingHeader("PMIC (MAX77620 / MAX77621)", ImGuiTreeNodeFlags_DefaultOpen)) { if (ImGui::CollapsingHeader("SoC / PMIC", ImGuiTreeNodeFlags_DefaultOpen)) {
// SoC generation drives APB_MISC_GP_HIDREV (1=Erista, 2=Mariko).
// Selecting it also flips the PMIC OTP byte to match — they go
// together on real hardware.
const char *gen_items[] = {"Erista (T210)", "Mariko (T210B01)"};
int gidx = state->is_mariko.load() ? 1 : 0;
if (ImGui::Combo("SoC", &gidx, gen_items, IM_ARRAYSIZE(gen_items))) {
state->is_mariko.store(gidx == 1);
state->pmic_otp.store(gidx == 1 ? 0x53 : 0x35);
}
const char *otp_items[] = {"Erista (0x35)", "Mariko (0x53)"}; const char *otp_items[] = {"Erista (0x35)", "Mariko (0x53)"};
int idx = (state->pmic_otp.load() == 0x53) ? 1 : 0; int idx = (state->pmic_otp.load() == 0x53) ? 1 : 0;
if (ImGui::Combo("OTP", &idx, otp_items, IM_ARRAYSIZE(otp_items))) { if (ImGui::Combo("PMIC OTP", &idx, otp_items, IM_ARRAYSIZE(otp_items))) {
state->pmic_otp.store(idx == 1 ? 0x53 : 0x35); state->pmic_otp.store(idx == 1 ? 0x53 : 0x35);
} }
atomic_slider_int<uint8_t>("MAX77620 silicon rev", state->pmic_silicon_rev, 0, 15); atomic_slider_int<uint8_t>("MAX77620 silicon rev", state->pmic_silicon_rev, 0, 15);
+5
View File
@@ -143,6 +143,11 @@ struct EmuState {
// Main PMIC OEM (MAX77620 CID4): 0x35 = Erista, 0x53 = Mariko, other = Unknown // Main PMIC OEM (MAX77620 CID4): 0x35 = Erista, 0x53 = Mariko, other = Unknown
std::atomic<uint8_t> pmic_otp{0x35}; std::atomic<uint8_t> pmic_otp{0x35};
// Tegra X1 generation (drives APB_MISC_GP_HIDREV major nibble: 1 = T210
// Erista, 2 = T210B01 Mariko). Hekate's h_cfg.t210b01 derives from this,
// which controls the pkg1 OEM-header skip among other things.
std::atomic<bool> is_mariko{false};
std::atomic<uint8_t> pmic_silicon_rev{0}; // MAX77620 CID3 low nibble: "max77620 v%d" std::atomic<uint8_t> pmic_silicon_rev{0}; // MAX77620 CID3 low nibble: "max77620 v%d"
std::atomic<uint8_t> cpu_pmic_version{0}; // MAX77621 CHIPID1: "max77621 v%d" std::atomic<uint8_t> cpu_pmic_version{0}; // MAX77621 CHIPID1: "max77621 v%d"
+14 -1
View File
@@ -268,7 +268,7 @@ static uc_engine *setup_emulation(EmuState *state, uint8_t *payload, size_t payl
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (argc < 2) { if (argc < 2) {
fprintf(stderr, "Usage: %s <payload.bin> [--sd <sd.img>] [--boot0 <boot0.bin>] [--rawnand <rawnand_prefix>] [--prod-keys <prod.keys>]\n", argv[0]); fprintf(stderr, "Usage: %s <payload.bin> [--sd <sd.img>] [--boot0 <boot0.bin>] [--rawnand <rawnand_prefix>] [--prod-keys <prod.keys>] [--oem erista|mariko]\n", argv[0]);
fprintf(stderr, "\nControls:\n"); fprintf(stderr, "\nControls:\n");
fprintf(stderr, " Arrow Up/Down = VOL+/VOL- buttons\n"); fprintf(stderr, " Arrow Up/Down = VOL+/VOL- buttons\n");
fprintf(stderr, " Enter = POWER button\n"); fprintf(stderr, " Enter = POWER button\n");
@@ -303,6 +303,19 @@ int main(int argc, char *argv[]) {
rawnand_prefix = argv[++i]; rawnand_prefix = argv[++i];
} else if (strcmp(argv[i], "--prod-keys") == 0 && i + 1 < argc) { } else if (strcmp(argv[i], "--prod-keys") == 0 && i + 1 < argc) {
prod_keys_path = argv[++i]; prod_keys_path = argv[++i];
} else if (strcmp(argv[i], "--oem") == 0 && i + 1 < argc) {
const char *oem = argv[++i];
if (strcmp(oem, "mariko") == 0 || strcmp(oem, "t210b01") == 0) {
state.is_mariko = true;
state.pmic_otp = 0x53;
printf("[emu] OEM: Mariko (T210B01)\n");
} else if (strcmp(oem, "erista") == 0 || strcmp(oem, "t210") == 0) {
state.is_mariko = false;
state.pmic_otp = 0x35;
printf("[emu] OEM: Erista (T210)\n");
} else {
fprintf(stderr, "[emu] Unknown --oem value '%s'; expected 'erista' or 'mariko'\n", oem);
}
} }
} }
+7 -2
View File
@@ -538,9 +538,14 @@ uint32_t misc_read(EmuState *state, uint64_t addr) {
if (addr >= PINMUX_BASE && addr < PINMUX_BASE + PINMUX_SIZE) { if (addr >= PINMUX_BASE && addr < PINMUX_BASE + PINMUX_SIZE) {
return pinmux_reg[(addr - PINMUX_BASE) / 4]; return pinmux_reg[(addr - PINMUX_BASE) / 4];
} }
// APB_MISC_GP_HIDREV - hardware revision (Erista) // APB_MISC_GP_HIDREV - hardware revision.
// Bits 11:8 = chip ID (0x21 for both T210 / T210B01),
// Bits 7:4 = major rev (1 = Erista T210, 2 = Mariko T210B01),
// Bits 3:0 = minor.
// Hekate's hw_get_chip_id() does `(HIDREV >> 4) & 0xF` and compares against
// GP_HIDREV_MAJOR_T210B01 (=2) to decide h_cfg.t210b01.
if (addr == APB_MISC_BASE + 0x804) if (addr == APB_MISC_BASE + 0x804)
return 0x01; // T210 return state->is_mariko.load() ? 0x20 : 0x10;
// UART // UART
if (addr >= 0x70006000 && addr < 0x70006500) { if (addr >= 0x70006000 && addr < 0x70006500) {