hos: allow overriding uCID

This commit is contained in:
CTCaer 2023-07-28 03:06:20 +03:00
parent 9187fa7a8c
commit d3567736c8
3 changed files with 31 additions and 20 deletions

View file

@ -1156,8 +1156,8 @@ int hos_launch(ini_sec_t *cfg)
// Disable display. This must be executed before secmon to provide support for all fw versions. // Disable display. This must be executed before secmon to provide support for all fw versions.
display_end(); display_end();
// Clear EMC_SCRATCH0. // Override uCID if set.
EMC(EMC_SCRATCH0) = 0; EMC(EMC_SCRATCH0) = ctxt.ucid;
// Hold USBD, USB2, AHBDMA and APBDMA in reset for SoC state validation on sleep. // Hold USBD, USB2, AHBDMA and APBDMA in reset for SoC state validation on sleep.
CLOCK(CLK_RST_CONTROLLER_RST_DEV_L_SET) = BIT(CLK_L_USBD); CLOCK(CLK_RST_CONTROLLER_RST_DEV_L_SET) = BIT(CLK_L_USBD);

View file

@ -94,8 +94,8 @@ typedef struct _launch_ctxt_t
u32 pkg2_size; u32 pkg2_size;
bool new_pkg2; bool new_pkg2;
void *kernel; void *kernel;
u32 kernel_size; u32 kernel_size;
link_t kip1_list; link_t kip1_list;
char* kip1_patches; char* kip1_patches;
@ -109,6 +109,8 @@ typedef struct _launch_ctxt_t
u32 fss0_hosver; u32 fss0_hosver;
bool atmosphere; bool atmosphere;
int ucid;
exo_ctxt_t exo_ctx; exo_ctxt_t exo_ctx;
ini_sec_t *cfg; ini_sec_t *cfg;

View file

@ -271,6 +271,14 @@ static int _config_exo_fatal_payload(launch_ctxt_t *ctxt, const char *value)
return 1; return 1;
} }
static int _config_ucid(launch_ctxt_t *ctxt, const char *value)
{
// Override uCID if set.
ctxt->ucid = atoi(value);
return 1;
}
typedef struct _cfg_handler_t typedef struct _cfg_handler_t
{ {
const char *key; const char *key;
@ -278,23 +286,24 @@ typedef struct _cfg_handler_t
} cfg_handler_t; } cfg_handler_t;
static const cfg_handler_t _config_handlers[] = { static const cfg_handler_t _config_handlers[] = {
{ "warmboot", _config_warmboot }, { "warmboot", _config_warmboot },
{ "secmon", _config_secmon }, { "secmon", _config_secmon },
{ "kernel", _config_kernel }, { "kernel", _config_kernel },
{ "kip1", _config_kip1 }, { "kip1", _config_kip1 },
{ "kip1patch", config_kip1patch }, { "kip1patch", config_kip1patch },
{ "fullsvcperm", _config_svcperm }, { "fullsvcperm", _config_svcperm },
{ "debugmode", _config_debugmode }, { "debugmode", _config_debugmode },
{ "stock", _config_stock }, { "stock", _config_stock },
{ "atmosphere", _config_atmosphere }, { "atmosphere", _config_atmosphere },
{ "fss0", _config_fss }, { "fss0", _config_fss },
{ "exofatal", _config_exo_fatal_payload}, { "exofatal", _config_exo_fatal_payload},
{ "emummcforce", _config_emummc_forced }, { "emummcforce", _config_emummc_forced },
{ "nouserexceptions", _config_dis_exo_user_exceptions }, { "nouserexceptions", _config_dis_exo_user_exceptions },
{ "userpmu", _config_exo_user_pmu_access }, { "userpmu", _config_exo_user_pmu_access },
{ "usb3force", _config_exo_usb3_force }, { "usb3force", _config_exo_usb3_force },
{ "cal0blank", _config_exo_cal0_blanking }, { "cal0blank", _config_exo_cal0_blanking },
{ "cal0writesys", _config_exo_cal0_writes_enable }, { "cal0writesys", _config_exo_cal0_writes_enable },
{ "ucid", _config_ucid },
{ NULL, NULL }, { NULL, NULL },
}; };