1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-24 11:16:11 +00:00

exo2: account for sleep/wake enabling jtag

This commit is contained in:
Michael Scire 2020-06-12 06:16:58 -07:00 committed by SciresM
parent 73c1615cda
commit 43f5a0ef45
4 changed files with 10 additions and 7 deletions

View file

@ -21,10 +21,12 @@ program.lz4: build_program
build_program:
$(MAKE) -C program
warmboot.bin:
$(MAKE) -C warmboot
warmboot.bin: build_warmboot
@cp warmboot/warmboot.bin warmboot.bin
build_warmboot:
$(MAKE) -C warmboot
boot_code.lz4: program.lz4
exosphere-clean:

View file

@ -949,7 +949,9 @@ namespace ams::secmon {
void SetupForLp0Exit() {
/* Exit HiZ mode in charger, if we need to. */
if (smc::IsChargerHiZModeEnabled()) {
const auto target_fw = GetTargetFirmware();
const bool force_exit_hiz_mode = (target_fw < TargetFirmware_4_0_0) || (target_fw < TargetFirmware_8_0_0 && fuse::GetHardwareType() == fuse::HardwareType_Icosa);
if (force_exit_hiz_mode || smc::IsChargerHiZModeEnabled()) {
ExitChargerHiZMode();
}

View file

@ -81,10 +81,9 @@ namespace ams::warmboot {
PowerOnCpu();
/* Halt ourselves. */
const bool disable_jtag = metadata->target_firmware >= TargetFirmware_4_0_0;
while (true) {
reg::Write(secmon::MemoryRegionPhysicalDeviceFlowController.GetAddress() + FLOW_CTLR_HALT_COP_EVENTS, FLOW_REG_BITS_ENUM (HALT_COP_EVENTS_MODE, FLOW_MODE_STOP),
FLOW_REG_BITS_ENUM_SEL(HALT_COP_EVENTS_JTAG, disable_jtag, DISABLED, ENABLED));
reg::Write(secmon::MemoryRegionPhysicalDeviceFlowController.GetAddress() + FLOW_CTLR_HALT_COP_EVENTS, FLOW_REG_BITS_ENUM(HALT_COP_EVENTS_MODE, FLOW_MODE_STOP),
FLOW_REG_BITS_ENUM(HALT_COP_EVENTS_JTAG, ENABLED));
}
}

View file

@ -39,8 +39,8 @@ namespace ams::warmboot {
const bool jtag_sts = reg::HasValue(PMC + APBDEV_PMC_STICKY_BITS, PMC_REG_BITS_ENUM(STICKY_BITS_JTAG_STS, ENABLE));
reg::ReadWrite(SYSTEM + SB_PFCFG, SB_REG_BITS_ENUM_SEL(PFCFG_DBGEN, jtag_sts, ENABLE, DISABLE),
SB_REG_BITS_ENUM_SEL(PFCFG_NIDEN, jtag_sts, ENABLE, DISABLE),
SB_REG_BITS_ENUM_SEL(PFCFG_SPNIDEN, jtag_sts, ENABLE, DISABLE),
SB_REG_BITS_ENUM (PFCFG_NIDEN, ENABLE),
SB_REG_BITS_ENUM (PFCFG_SPIDEN, DISABLE));
reg::ReadWrite(APB_MISC + APB_MISC_PP_CONFIG_CTL, APB_MISC_REG_BITS_ENUM_SEL(PP_CONFIG_CTL_JTAG, jtag_sts, ENABLE, DISABLE));