From a9062994d2850287f7001758f3014b1b686d2017 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 18 Nov 2020 13:42:32 -0800 Subject: [PATCH] exo: receive saved lcd vendor from bl --- ...ecmon_configuration_context.arch.arm64.hpp | 4 +++ .../secmon/secmon_monitor_context.hpp | 36 ++++++++++++------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/libexosphere/include/exosphere/secmon/secmon_configuration_context.arch.arm64.hpp b/libexosphere/include/exosphere/secmon/secmon_configuration_context.arch.arm64.hpp index fff53236..bddcf1b7 100644 --- a/libexosphere/include/exosphere/secmon/secmon_configuration_context.arch.arm64.hpp +++ b/libexosphere/include/exosphere/secmon/secmon_configuration_context.arch.arm64.hpp @@ -112,6 +112,10 @@ namespace ams::secmon { return GetSecmonConfiguration().GetHardwareState(); } + ALWAYS_INLINE u16 GetLcdVendor() { + return GetSecmonConfiguration().GetLcdVendor(); + } + ALWAYS_INLINE bool IsProduction() { return GetSecmonConfiguration().IsProduction(); } diff --git a/libexosphere/include/exosphere/secmon/secmon_monitor_context.hpp b/libexosphere/include/exosphere/secmon/secmon_monitor_context.hpp index 568812c7..c2970801 100644 --- a/libexosphere/include/exosphere/secmon/secmon_monitor_context.hpp +++ b/libexosphere/include/exosphere/secmon/secmon_monitor_context.hpp @@ -37,8 +37,10 @@ namespace ams::secmon { u32 magic; ams::TargetFirmware target_firmware; - u32 flags; - u32 reserved[5]; + u32 flags[2]; + u16 lcd_vendor; + u16 reserved0; + u32 reserved1[3]; EmummcConfiguration emummc_cfg; constexpr bool IsValid() const { return this->magic == Magic; } @@ -53,12 +55,16 @@ namespace ams::secmon { u8 soc_type; u8 hardware_state; u8 pad_0B[1]; - u32 flags; - u32 reserved[(0x80 - 0x10) / sizeof(u32)]; + u32 flags[2]; + u16 lcd_vendor; + u16 reserved0; + u32 reserved1[(0x80 - 0x18) / sizeof(u32)]; constexpr void CopyFrom(const SecureMonitorStorageConfiguration &storage) { this->target_firmware = storage.target_firmware; - this->flags = storage.flags; + this->flags[0] = storage.flags[0]; + this->flags[1] = storage.flags[1]; + this->lcd_vendor = storage.lcd_vendor; } void SetFuseInfo() { @@ -73,14 +79,16 @@ namespace ams::secmon { constexpr fuse::SocType GetSocType() const { return static_cast(this->soc_type); } constexpr fuse::HardwareState GetHardwareState() const { return static_cast(this->hardware_state); } + constexpr u16 GetLcdVendor() const { return this->lcd_vendor; } + constexpr bool IsProduction() const { return this->GetHardwareState() != fuse::HardwareState_Development; } - constexpr bool IsDevelopmentFunctionEnabledForKernel() const { return (this->flags & SecureMonitorConfigurationFlag_IsDevelopmentFunctionEnabledForKernel) != 0; } - constexpr bool IsDevelopmentFunctionEnabledForUser() const { return (this->flags & SecureMonitorConfigurationFlag_IsDevelopmentFunctionEnabledForUser) != 0; } - constexpr bool DisableUserModeExceptionHandlers() const { return (this->flags & SecureMonitorConfigurationFlag_DisableUserModeExceptionHandlers) != 0; } - constexpr bool EnableUserModePerformanceCounterAccess() const { return (this->flags & SecureMonitorConfigurationFlag_EnableUserModePerformanceCounterAccess) != 0; } - constexpr bool ShouldUseBlankCalibrationBinary() const { return (this->flags & SecureMonitorConfigurationFlag_ShouldUseBlankCalibrationBinary) != 0; } - constexpr bool AllowWritingToCalibrationBinarySysmmc() const { return (this->flags & SecureMonitorConfigurationFlag_AllowWritingToCalibrationBinarySysmmc) != 0; } + constexpr bool IsDevelopmentFunctionEnabledForKernel() const { return (this->flags[0] & SecureMonitorConfigurationFlag_IsDevelopmentFunctionEnabledForKernel) != 0; } + constexpr bool IsDevelopmentFunctionEnabledForUser() const { return (this->flags[0] & SecureMonitorConfigurationFlag_IsDevelopmentFunctionEnabledForUser) != 0; } + constexpr bool DisableUserModeExceptionHandlers() const { return (this->flags[0] & SecureMonitorConfigurationFlag_DisableUserModeExceptionHandlers) != 0; } + constexpr bool EnableUserModePerformanceCounterAccess() const { return (this->flags[0] & SecureMonitorConfigurationFlag_EnableUserModePerformanceCounterAccess) != 0; } + constexpr bool ShouldUseBlankCalibrationBinary() const { return (this->flags[0] & SecureMonitorConfigurationFlag_ShouldUseBlankCalibrationBinary) != 0; } + constexpr bool AllowWritingToCalibrationBinarySysmmc() const { return (this->flags[0] & SecureMonitorConfigurationFlag_AllowWritingToCalibrationBinarySysmmc) != 0; } constexpr bool IsDevelopmentFunctionEnabled(bool for_kern) const { return for_kern ? this->IsDevelopmentFunctionEnabledForKernel() : this->IsDevelopmentFunctionEnabledForUser(); } }; @@ -94,8 +102,10 @@ namespace ams::secmon { .soc_type = {}, .hardware_state = {}, .pad_0B = {}, - .flags = SecureMonitorConfigurationFlag_Default, - .reserved = {}, + .flags = { SecureMonitorConfigurationFlag_Default, SecureMonitorConfigurationFlag_None }, + .lcd_vendor = {}, + .reserved0 = {}, + .reserved1 = {}, }; }