Erista EMC volt in uV; Add safety checks (voltage and cust)
This commit is contained in:
@@ -55,8 +55,10 @@ static const volatile CustomizeTable C = {
|
|||||||
* - Graphical glitches
|
* - Graphical glitches
|
||||||
* - System instabilities
|
* - System instabilities
|
||||||
* - NAND corruption
|
* - NAND corruption
|
||||||
* - RAM Voltage in mV
|
* - RAM Voltage in uV
|
||||||
* Default(HOS): 1125
|
* Range: 600'000 to 1250'000 uV
|
||||||
|
* Value should be divided evenly by 12'500
|
||||||
|
* Default(HOS): 1125'000
|
||||||
* Not enabled by default.
|
* Not enabled by default.
|
||||||
*/
|
*/
|
||||||
.eristaEmcMaxClock = 1862400,
|
.eristaEmcMaxClock = 1862400,
|
||||||
|
|||||||
@@ -1027,8 +1027,13 @@ namespace ams::ldr::oc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result MemVoltHandler(u32* ptr) {
|
Result MemVoltHandler(u32* ptr) {
|
||||||
if (C.eristaEmcVolt)
|
u32 emc_uv = C.eristaEmcVolt;
|
||||||
PatchOffset(ptr, C.eristaEmcVolt);
|
if (emc_uv) {
|
||||||
|
constexpr u32 uv_step = 12'500;
|
||||||
|
if (emc_uv % uv_step)
|
||||||
|
emc_uv = emc_uv / uv_step * uv_step;
|
||||||
|
PatchOffset(ptr, emc_uv);
|
||||||
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
@@ -1103,10 +1108,18 @@ namespace ams::ldr::oc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace pcv {
|
namespace pcv {
|
||||||
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
void SafetyCheck() {
|
||||||
if (C.custRev != CUST_REV) {
|
if ( C.custRev != CUST_REV
|
||||||
|
|| C.marikoCpuMaxVolt >= 1300
|
||||||
|
|| C.eristaCpuMaxVolt >= 1400
|
||||||
|
|| (C.eristaEmcVolt && (C.eristaEmcVolt < 600'000 || C.eristaEmcVolt > 1250'000)))
|
||||||
|
{
|
||||||
CRASH();
|
CRASH();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
||||||
|
SafetyCheck();
|
||||||
|
|
||||||
#ifdef OC_TEST
|
#ifdef OC_TEST
|
||||||
void* buf = malloc(nso_size);
|
void* buf = malloc(nso_size);
|
||||||
|
|||||||
@@ -12,8 +12,9 @@ typedef uint64_t u64;
|
|||||||
typedef int Result;
|
typedef int Result;
|
||||||
|
|
||||||
#define R_SUCCEEDED(arg) (arg == ResultSuccess())
|
#define R_SUCCEEDED(arg) (arg == ResultSuccess())
|
||||||
|
#define R_FAILED(arg) (!R_SUCCEEDED(arg))
|
||||||
#define LOGGING(fmt, ...) { printf(fmt "\n\tin %s\n", ##__VA_ARGS__, __PRETTY_FUNCTION__); }
|
#define LOGGING(fmt, ...) { printf(fmt "\n\tin %s\n", ##__VA_ARGS__, __PRETTY_FUNCTION__); }
|
||||||
#define AMS_ABORT() { fprintf(stderr, "Failed!\n"); exit(-1); }
|
#define AMS_ABORT() { fprintf(stderr, "Failed in %s!\n", __PRETTY_FUNCTION__); exit(-1); }
|
||||||
|
|
||||||
inline Result ResultSuccess() { return 0; }
|
inline Result ResultSuccess() { return 0; }
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ namespace ams::ldr::oc {
|
|||||||
.eristaCpuOCEnable = 1,
|
.eristaCpuOCEnable = 1,
|
||||||
.eristaCpuMaxVolt = 1300,
|
.eristaCpuMaxVolt = 1300,
|
||||||
.eristaEmcMaxClock = 1862400,
|
.eristaEmcMaxClock = 1862400,
|
||||||
.eristaEmcVolt = 1250,
|
.eristaEmcVolt = 1200'000,
|
||||||
.eristaMtc = reinterpret_cast<EristaMtcTable *>(const_cast<u8 *>(EmptyMtcTable)),
|
.eristaMtc = reinterpret_cast<EristaMtcTable *>(const_cast<u8 *>(EmptyMtcTable)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user