exo2: implement SmcGetConfig

This commit is contained in:
Michael Scire 2020-05-15 02:32:17 -07:00 committed by SciresM
parent e3eadcd2e3
commit 6bf283ec2e
15 changed files with 640 additions and 45 deletions

View file

@ -31,21 +31,77 @@ namespace ams::fuse {
HardwareType_Undefined = 0xF,
};
enum SocType {
SocType_Erista = 0,
SocType_Mariko = 1,
SocType_Undefined = 0xF,
};
enum HardwareState {
HardwareState_Development = 0,
HardwareState_Production = 1,
HardwareState_Undefined = 2,
};
enum DramId {
DramId_IcosaSamsung4GB = 0,
DramId_IcosaHynix4GB = 1,
DramId_IcosaMicron4GB = 2,
DramId_CopperSamsung4GB = 3,
DramId_IcosaSamsung6GB = 4,
DramId_CopperHynix4GB = 5,
DramId_CopperMicron4GB = 6,
DramId_IowaX1X2Samsung4GB = 7,
DramId_IowaSansung4GB = 8,
DramId_IowaSamsung8GB = 9,
DramId_IowaHynix4GB = 10,
DramId_IowaMicron4GB = 11,
DramId_HoagSamsung4GB = 12,
DramId_HoagSamsung8GB = 13,
DramId_HoagHynix4GB = 14,
DramId_HoagMicron4GB = 15,
DramId_IowaSamsung4GBY = 16,
DramId_IowaSamsung1y4GBX = 17,
DramId_IowaSamsung1y8GBX = 18,
DramId_HoagSamsung1y4GBX = 19,
DramId_IowaSamsung1y4GBY = 20,
DramId_IowaSamsung1y8GBY = 21,
DramId_IowaSamsung1y4GBA = 22,
DramId_FiveSamsung1y8GBX = 23,
DramId_FiveSamsung1y4GBX = 24,
DramId_Count,
};
enum QuestState {
QuestState_Disabled = 0,
QuestState_Enabled = 1,
};
void SetRegisterAddress(uintptr_t address);
void SetWriteSecureOnly();
void Lockout();
void Activate();
void Deactivate();
void Reload();
u32 ReadWord(int address);
u32 GetOdmWord(int index);
DramId GetDramId();
void GetEcid(br::BootEcid *out);
HardwareType GetHardwareType();
HardwareState GetHardwareState();
u64 GetDeviceId();
QuestState GetQuestState();
pmic::Regulator GetRegulator();
void GetEcid(br::BootEcid *out);
int GetDeviceUniqueKeyGeneration();
SocType GetSocType();
int GetExpectedFuseVersion(TargetFirmware target_fw);
bool HasRcmVulnerabilityPatch();
}

View file

@ -45,7 +45,9 @@ namespace ams::pkg1 {
u32 secmon_start_time;
u32 secmon_end_time;
BctParameters bct_params;
u8 reserved[0xD8];
u32 deprecated_boot_reason_value;
u8 deprecated_boot_reason_state;
u8 reserved[0xD3];
u32 bootloader_state;
u32 secmon_state;
u8 reserved2[0x100];

View file

@ -45,6 +45,14 @@ namespace ams::secmon {
EmummcType type;
u32 id;
u32 fs_version;
constexpr bool IsValid() const {
return this->magic == Magic;
}
constexpr bool IsEmummcActive() const {
return this->IsValid() && this->type != EmummcType_None;
}
};
static_assert(util::is_pod<EmummcBaseConfiguration>::value);
static_assert(sizeof(EmummcBaseConfiguration) == 0x10);
@ -66,6 +74,14 @@ namespace ams::secmon {
EmummcFileConfiguration file_cfg;
};
EmummcFilePath emu_dir_path;
constexpr bool IsValid() const {
return this->base_cfg.IsValid();
}
constexpr bool IsEmummcActive() const {
return this->base_cfg.IsEmummcActive();
}
};
static_assert(util::is_pod<EmummcConfiguration>::value);
static_assert(sizeof(EmummcConfiguration) <= 0x200);

View file

@ -65,6 +65,8 @@ namespace ams::secmon {
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 IsDevelopmentFunctionEnabled(bool for_kern) const { return for_kern ? this->IsDevelopmentFunctionEnabledForKernel() : this->IsDevelopmentFunctionEnabledForUser(); }
};
static_assert(util::is_pod<SecureMonitorConfiguration>::value);
static_assert(sizeof(SecureMonitorConfiguration) == 0x80);