Add support for file/partition based emummc on emmc,
Add support for emuSD
This commit is contained in:
@@ -28,7 +28,7 @@ namespace ams::secmon {
|
||||
};
|
||||
union {
|
||||
EmummcConfiguration emummc_cfg;
|
||||
u8 _raw_emummc_config[0x120];
|
||||
u8 _raw_emummc_config[0x128];
|
||||
};
|
||||
u8 sealed_device_keys[pkg1::KeyGeneration_Max][se::AesBlockSize];
|
||||
u8 sealed_master_keys[pkg1::KeyGeneration_Max][se::AesBlockSize];
|
||||
@@ -88,8 +88,12 @@ namespace ams::secmon {
|
||||
return GetConfigurationContext().secmon_cfg;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const EmummcConfiguration &GetEmummcConfiguration() {
|
||||
return GetConfigurationContext().emummc_cfg;
|
||||
ALWAYS_INLINE const EmummcEmmcConfiguration &GetEmummcEmmcConfiguration() {
|
||||
return GetConfigurationContext().emummc_cfg.emmc_cfg;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const EmummcSdConfiguration &GetEmummcSdConfiguration() {
|
||||
return GetConfigurationContext().emummc_cfg.sd_cfg;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const pkg1::BootConfig &GetBootConfig() {
|
||||
|
||||
@@ -18,10 +18,21 @@
|
||||
|
||||
namespace ams::secmon {
|
||||
|
||||
enum EmummcType : u32 {
|
||||
EmummcType_None = 0,
|
||||
EmummcType_Partition = 1,
|
||||
EmummcType_File = 2,
|
||||
enum EmummcEmmcType : u32 {
|
||||
EmummcEmmcType_None = 0,
|
||||
EmummcEmmcType_Partition_Sd = 1,
|
||||
EmummcEmmcType_File_Sd = 2,
|
||||
EmummcEmmcType_Partition_Emmc = 3,
|
||||
EmummcEmmcType_File_Emmc = 4,
|
||||
};
|
||||
|
||||
enum EmummcSdType : u32 {
|
||||
EmummcSdType_None = 0,
|
||||
EmummcSdType_Partition_Emmc = 3,
|
||||
// Not (currently) supported
|
||||
// EmummcSdType_Partition_Sd = 1,
|
||||
// EmummcSdType_File_Sd = 2,
|
||||
// EmummcSdType_File_Emmc = 4,
|
||||
};
|
||||
|
||||
enum EmummcMmc {
|
||||
@@ -38,24 +49,6 @@ namespace ams::secmon {
|
||||
static_assert(util::is_pod<EmummcFilePath>::value);
|
||||
static_assert(sizeof(EmummcFilePath) == EmummcFilePathLengthMax);
|
||||
|
||||
struct EmummcBaseConfiguration {
|
||||
static constexpr u32 Magic = util::FourCC<'E','F','S','0'>::Code;
|
||||
|
||||
u32 magic;
|
||||
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);
|
||||
|
||||
struct EmummcPartitionConfiguration {
|
||||
u64 start_sector;
|
||||
@@ -67,8 +60,27 @@ namespace ams::secmon {
|
||||
};
|
||||
static_assert(util::is_pod<EmummcFileConfiguration>::value);
|
||||
|
||||
struct EmummcConfiguration {
|
||||
EmummcBaseConfiguration base_cfg;
|
||||
struct EmummcEmmcBaseConfiguration {
|
||||
static constexpr u32 Magic = util::FourCC<'E','F','S','0'>::Code;
|
||||
u32 magic;
|
||||
EmummcEmmcType type;
|
||||
u32 id;
|
||||
u32 fs_version;
|
||||
|
||||
constexpr bool IsValid() const {
|
||||
return this->magic == Magic;
|
||||
}
|
||||
|
||||
constexpr bool IsActive() const {
|
||||
return this->IsValid() && this->type != EmummcEmmcType::EmummcEmmcType_None;
|
||||
}
|
||||
};
|
||||
static_assert(util::is_pod<EmummcEmmcBaseConfiguration>::value);
|
||||
static_assert(sizeof(EmummcEmmcBaseConfiguration) == 0x10);
|
||||
|
||||
|
||||
struct EmummcEmmcConfiguration {
|
||||
EmummcEmmcBaseConfiguration base_cfg;
|
||||
union {
|
||||
EmummcPartitionConfiguration partition_cfg;
|
||||
EmummcFileConfiguration file_cfg;
|
||||
@@ -79,10 +91,55 @@ namespace ams::secmon {
|
||||
return this->base_cfg.IsValid();
|
||||
}
|
||||
|
||||
constexpr bool IsEmummcActive() const {
|
||||
return this->base_cfg.IsEmummcActive();
|
||||
constexpr bool IsActive() const {
|
||||
return this->base_cfg.IsActive();
|
||||
}
|
||||
};
|
||||
static_assert(util::is_pod<EmummcEmmcConfiguration>::value);
|
||||
static_assert(sizeof(EmummcEmmcConfiguration) == 0x110);
|
||||
|
||||
struct EmummcSdBaseConfiguration {
|
||||
static constexpr u32 Magic = util::FourCC<'E','F','S','0'>::Code;
|
||||
u32 magic;
|
||||
EmummcSdType type;
|
||||
/* id currently unused */
|
||||
u32 id;
|
||||
u32 fs_version;
|
||||
|
||||
constexpr bool IsValid() const {
|
||||
return this->magic == Magic;
|
||||
}
|
||||
|
||||
constexpr bool IsActive() const {
|
||||
return this->IsValid() && this->type != EmummcSdType::EmummcSdType_None;
|
||||
}
|
||||
};
|
||||
static_assert(util::is_pod<EmummcSdBaseConfiguration>::value);
|
||||
static_assert(sizeof(EmummcSdBaseConfiguration) == 0x10);
|
||||
|
||||
struct EmummcSdConfiguration {
|
||||
EmummcSdBaseConfiguration base_cfg;
|
||||
union {
|
||||
EmummcPartitionConfiguration partition_cfg;
|
||||
/* File based currently not supported */
|
||||
/* EmummcFileConfiguration file_cfg */
|
||||
};
|
||||
|
||||
constexpr bool IsValid() const {
|
||||
return this->base_cfg.IsValid();
|
||||
}
|
||||
|
||||
constexpr bool IsActive() const {
|
||||
return this->base_cfg.IsActive();
|
||||
}
|
||||
};
|
||||
static_assert(util::is_pod<EmummcSdConfiguration>::value);
|
||||
static_assert(sizeof(EmummcSdConfiguration) == 0x18);
|
||||
|
||||
struct EmummcConfiguration {
|
||||
EmummcEmmcConfiguration emmc_cfg;
|
||||
EmummcSdConfiguration sd_cfg;
|
||||
};
|
||||
static_assert(util::is_pod<EmummcConfiguration>::value);
|
||||
static_assert(sizeof(EmummcConfiguration) <= 0x200);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace ams::secmon {
|
||||
constexpr bool IsValid() const { return this->magic == Magic; }
|
||||
};
|
||||
static_assert(util::is_pod<SecureMonitorStorageConfiguration>::value);
|
||||
static_assert(sizeof(SecureMonitorStorageConfiguration) == 0x130);
|
||||
static_assert(sizeof(SecureMonitorStorageConfiguration) == 0x148);
|
||||
|
||||
struct SecureMonitorConfiguration {
|
||||
ams::TargetFirmware target_firmware;
|
||||
|
||||
Reference in New Issue
Block a user