From 545765d16713a25cef8bffef24b22248aafaf4b6 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 10 Oct 2022 21:12:26 -0700 Subject: [PATCH] ams/fuse: update version numbers, update DramId read logic --- .../libexosphere/source/fuse/fuse_api.cpp | 20 +++++++++++++++---- .../include/stratosphere/hos/hos_types.hpp | 2 ++ .../include/vapours/ams/ams_target_firmware.h | 6 +++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/libraries/libexosphere/source/fuse/fuse_api.cpp b/libraries/libexosphere/source/fuse/fuse_api.cpp index d31e042ef..26106d140 100644 --- a/libraries/libexosphere/source/fuse/fuse_api.cpp +++ b/libraries/libexosphere/source/fuse/fuse_api.cpp @@ -39,12 +39,13 @@ namespace ams::fuse { struct OdmWord4 { using HardwareState1 = util::BitPack32::Field<0, 2, int>; using HardwareType1 = util::BitPack32::Field; - using DramId = util::BitPack32::Field; - using HardwareType2 = util::BitPack32::Field; + using DramId1 = util::BitPack32::Field; + using HardwareType2 = util::BitPack32::Field; using HardwareState2 = util::BitPack32::Field; using RetailInteractiveDisplayState = util::BitPack32::Field; using FormatVersion = util::BitPack32::Field; - using Reserved = util::BitPack32::Field; + using DramId2 = util::BitPack32::Field; + using Reserved = util::BitPack32::Field; using HardwareType3 = util::BitPack32::Field; }; @@ -71,6 +72,15 @@ namespace ams::fuse { (odm_word4.Get() << HardwareType3Shift); } + constexpr ALWAYS_INLINE int GetDramIdValue(const util::BitPack32 odm_word4) { + constexpr auto DramId1Shift = 0; + constexpr auto DramId2Shift = OdmWord4::DramId1::Count + DramId1Shift; + + + return (odm_word4.Get() << DramId1Shift) | + (odm_word4.Get() << DramId2Shift); + } + constinit uintptr_t g_register_address = secmon::MemoryRegionPhysicalDeviceFuses.GetAddress(); constinit bool g_checked_for_rcm_bug_patch = false; @@ -167,6 +177,7 @@ namespace ams::fuse { } constexpr const TargetFirmware FuseVersionIncrementFirmwares[] = { + TargetFirmware_15_0_0, TargetFirmware_13_2_1, TargetFirmware_12_0_2, TargetFirmware_11_0_0, @@ -305,7 +316,8 @@ namespace ams::fuse { } DramId GetDramId() { - return static_cast(util::BitPack32{GetCommonOdmWord(4)}.Get()); + /* Get the value. */ + return static_cast(GetDramIdValue(util::BitPack32{GetCommonOdmWord(4)})); } HardwareType GetHardwareType() { diff --git a/libraries/libstratosphere/include/stratosphere/hos/hos_types.hpp b/libraries/libstratosphere/include/stratosphere/hos/hos_types.hpp index b55be4960..fd33701be 100644 --- a/libraries/libstratosphere/include/stratosphere/hos/hos_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/hos/hos_types.hpp @@ -72,6 +72,8 @@ namespace ams::hos { Version_14_0_0 = ::ams::TargetFirmware_14_0_0, Version_14_1_0 = ::ams::TargetFirmware_14_1_0, Version_14_1_1 = ::ams::TargetFirmware_14_1_1, + Version_14_1_2 = ::ams::TargetFirmware_14_1_2, + Version_15_0_0 = ::ams::TargetFirmware_15_0_0, Version_Current = ::ams::TargetFirmware_Current, diff --git a/libraries/libvapours/include/vapours/ams/ams_target_firmware.h b/libraries/libvapours/include/vapours/ams/ams_target_firmware.h index 8a755fd9f..4c84dbba1 100644 --- a/libraries/libvapours/include/vapours/ams/ams_target_firmware.h +++ b/libraries/libvapours/include/vapours/ams/ams_target_firmware.h @@ -70,8 +70,10 @@ #define ATMOSPHERE_TARGET_FIRMWARE_14_0_0 ATMOSPHERE_TARGET_FIRMWARE(14, 0, 0) #define ATMOSPHERE_TARGET_FIRMWARE_14_1_0 ATMOSPHERE_TARGET_FIRMWARE(14, 1, 0) #define ATMOSPHERE_TARGET_FIRMWARE_14_1_1 ATMOSPHERE_TARGET_FIRMWARE(14, 1, 1) +#define ATMOSPHERE_TARGET_FIRMWARE_14_1_2 ATMOSPHERE_TARGET_FIRMWARE(14, 1, 2) +#define ATMOSPHERE_TARGET_FIRMWARE_15_0_0 ATMOSPHERE_TARGET_FIRMWARE(15, 0, 0) -#define ATMOSPHERE_TARGET_FIRMWARE_CURRENT ATMOSPHERE_TARGET_FIRMWARE_14_1_1 +#define ATMOSPHERE_TARGET_FIRMWARE_CURRENT ATMOSPHERE_TARGET_FIRMWARE_15_0_0 #define ATMOSPHERE_TARGET_FIRMWARE_MIN ATMOSPHERE_TARGET_FIRMWARE(0, 0, 0) #define ATMOSPHERE_TARGET_FIRMWARE_MAX ATMOSPHERE_TARGET_FIRMWARE_CURRENT @@ -134,6 +136,8 @@ namespace ams { TargetFirmware_14_0_0 = ATMOSPHERE_TARGET_FIRMWARE_14_0_0, TargetFirmware_14_1_0 = ATMOSPHERE_TARGET_FIRMWARE_14_1_0, TargetFirmware_14_1_1 = ATMOSPHERE_TARGET_FIRMWARE_14_1_1, + TargetFirmware_14_1_2 = ATMOSPHERE_TARGET_FIRMWARE_14_1_2, + TargetFirmware_15_0_0 = ATMOSPHERE_TARGET_FIRMWARE_15_0_0, TargetFirmware_Current = ATMOSPHERE_TARGET_FIRMWARE_CURRENT,