diff --git a/libexosphere/include/exosphere/tegra/tegra_clkrst.hpp b/libexosphere/include/exosphere/tegra/tegra_clkrst.hpp index f6a1ae6b..fc2253c2 100644 --- a/libexosphere/include/exosphere/tegra/tegra_clkrst.hpp +++ b/libexosphere/include/exosphere/tegra/tegra_clkrst.hpp @@ -63,6 +63,9 @@ DEFINE_CLK_RST_REG(MISC_CLK_ENB_CFG_ALL_VISIBLE, 28, 1); #define CLK_RST_CONTROLLER_CLK_SOURCE_UARTC (0x1A0) #define CLK_RST_CONTROLLER_CLK_SOURCE_ACTMON (0x3E8) +/* RST_DEV_*_SET */ +#define CLK_RST_CONTROLLER_RST_DEV_L_SET (0x300) + /* RST_DEV_*_CLR */ #define CLK_RST_CONTROLLER_RST_DEV_L_CLR (0x304) @@ -100,4 +103,6 @@ DEFINE_CLK_RST_REG_THREE_BIT_ENUM(CLK_SOURCE_UARTC_UARTC_CLK_SRC, 29, PLLP_OUT0, DEFINE_CLK_RST_REG_THREE_BIT_ENUM(CLK_SOURCE_ACTMON_ACTMON_CLK_SRC, 29, PLLP_OUT0, PLLC2_OUT0, PLLC_OUT0, PLLC4_OUT0, CLK_S, PLLC4_OUT1, CLK_M, PLLC4_OUT2); +DEFINE_CLK_RST_REG_BIT_ENUM(RST_DEV_L_SET_SET_COP_RST, 1, DISABLE, ENABLE); + DEFINE_CLK_RST_REG_BIT_ENUM(RST_DEV_L_CLR_CLR_COP_RST, 1, DISABLE, ENABLE); diff --git a/libexosphere/include/exosphere/tegra/tegra_pmc.hpp b/libexosphere/include/exosphere/tegra/tegra_pmc.hpp index 98d3743d..f64f500f 100644 --- a/libexosphere/include/exosphere/tegra/tegra_pmc.hpp +++ b/libexosphere/include/exosphere/tegra/tegra_pmc.hpp @@ -42,6 +42,8 @@ #define APBDEV_PMC_WAKE_DELAY (0x0E0) #define APBDEV_PMC_PWR_DET_VAL (0x0E4) #define APBDEV_PMC_CRYPTO_OP (0x0F4) +#define APBDEV_PMC_SCRATCH31 (0x118) +#define APBDEV_PMC_SCRATCH32 (0x11C) #define APBDEV_PMC_WAKE2_MASK (0x160) #define APBDEV_PMC_WAKE2_LVL (0x164) #define APBDEV_PMC_WAKE2_STATUS (0x168) diff --git a/libexosphere/source/log/log_api.cpp b/libexosphere/source/log/log_api.cpp index 2ea3c5c7..ad1d89ea 100644 --- a/libexosphere/source/log/log_api.cpp +++ b/libexosphere/source/log/log_api.cpp @@ -21,6 +21,7 @@ namespace ams::log { constexpr inline uart::Port UartLogPort = uart::Port_ReservedDebug; constinit bool g_initialized_uart = false; + constinit bool g_logging_enabled = false; constexpr inline u32 UartPortFlags = [] { if constexpr (UartLogPort == uart::Port_ReservedDebug) { @@ -75,14 +76,18 @@ namespace ams::log { g_initialized_uart = false; } + void SetDebugLogEnabled(bool en) { + g_logging_enabled = en; + } + void SendText(const void *text, size_t size) { - if (g_initialized_uart) { + if (g_initialized_uart && g_logging_enabled) { uart::SendText(UartLogPort, text, size); } } void Flush() { - if (g_initialized_uart) { + if (g_initialized_uart && g_logging_enabled) { uart::WaitFlush(UartLogPort); } } diff --git a/libexosphere/source/se/se_suspend.cpp b/libexosphere/source/se/se_suspend.cpp index 98d49c95..883ae3cb 100644 --- a/libexosphere/source/se/se_suspend.cpp +++ b/libexosphere/source/se/se_suspend.cpp @@ -44,7 +44,7 @@ namespace ams::se { } /* Execute the operation. */ - ExecuteOperation(SE, SE_OPERATION_OP_CTX_SAVE, dst, dst_size, src, src_size); + ExecuteOperation(SE, SE_OPERATION_OP_CTX_SAVE, temp, dst_size, src, src_size); /* Copy output from the operation, if any. */ if (dst_size > 0) {