Compare commits
28
Commits
main
..
8a930448eb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a930448eb | ||
|
|
7960dd9be6 | ||
|
|
a71c88942d | ||
|
|
603f9d7ca2 | ||
|
|
b0d111ad17 | ||
|
|
cd7c211cdf | ||
|
|
3714aecf32 | ||
|
|
2a10aa7cc5 | ||
|
|
47bdc26a1a | ||
|
|
192fc41f1a | ||
|
|
73eae055c0 | ||
|
|
044d7b69e0 | ||
|
|
59ea651360 | ||
|
|
12597f8aa3 | ||
|
|
4143857358 | ||
|
|
28e8ca37e1 | ||
|
|
52424a86e3 | ||
|
|
56495e9b64 | ||
|
|
151d8584e4 | ||
|
|
b9bf6dd719 | ||
|
|
0befcd2d75 | ||
|
|
3d5dbf77ea | ||
|
|
ab1fde543d | ||
|
|
66cfbe0d0b | ||
|
|
d92aaff7c1 | ||
|
|
dac56d58b5 | ||
|
|
987e37f4ab | ||
|
|
73dbd98d5b |
No files matched your search
@@ -0,0 +1,3 @@
|
|||||||
|
# Donate to us!
|
||||||
|
|
||||||
|
https://ko-fi.com/souldbminer
|
||||||
@@ -8,4 +8,3 @@ build
|
|||||||
Source/hekate
|
Source/hekate
|
||||||
dist/*
|
dist/*
|
||||||
!dist/.gitignore
|
!dist/.gitignore
|
||||||
Status-Monitor-Overlay.ovl*
|
|
||||||
@@ -5,6 +5,3 @@ Horizon OC Compilation Instructions
|
|||||||
3. Clone the Horizon OC develop branch (``git clone https://github.com/Horizon-OC/Horizon-OC.git --recurse-submodules``)
|
3. Clone the Horizon OC develop branch (``git clone https://github.com/Horizon-OC/Horizon-OC.git --recurse-submodules``)
|
||||||
4. Run ``./build.sh`` in the root directory
|
4. Run ``./build.sh`` in the root directory
|
||||||
- If you want to compile with extensions, append ``--ext``
|
- If you want to compile with extensions, append ``--ext``
|
||||||
- To skip components, append ``-s``/``--skip`` followed by one or more of: ``ldr`` (loader), ``clk`` (hoc-clk), ``hek`` (hekate), ``btb`` (benchmark toolbox), ``exos`` (exosphere), ``sm`` (status-monitor download), ``zip`` (dist.zip packaging). Example: ``./build.sh --ext -s ldr hek``
|
|
||||||
- Building the custom Hekate (``--ext`` without skipping ``hek``) additionally requires devkitARM with ``DEVKITARM`` exported
|
|
||||||
- Installing ``ccache`` is optional; if it is on your PATH it is used automatically to speed up rebuilds
|
|
||||||
@@ -34,9 +34,9 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to
|
|||||||
|
|
||||||
## Default clocks
|
## Default clocks
|
||||||
|
|
||||||
* **CPU:** 1963MHz (Mariko) / 1785MHz (Erista)
|
* **CPU:** Up to 1963MHz (Mariko) / 1785MHz (Erista)
|
||||||
* **GPU:** 1152MHz (Mariko) / 921MHz (Erista)
|
* **GPU:** Up to 1075MHz (Mariko) / 921MHz (Erista)
|
||||||
* **RAM:** 2133MHz (Mariko) / 1600MHz (Erista)
|
* **RAM:** Up to 1866/2133MHz (Mariko) / 1600MHz (Erista)
|
||||||
* Over/undervolting support
|
* Over/undervolting support
|
||||||
* Built-in configurator
|
* Built-in configurator
|
||||||
* Compatible with most homebrew
|
* Compatible with most homebrew
|
||||||
@@ -51,7 +51,7 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to
|
|||||||
|
|
||||||
* [Atmosphere](https://github.com/Atmosphere-NX/Atmosphere)
|
* [Atmosphere](https://github.com/Atmosphere-NX/Atmosphere)
|
||||||
* [Ultrahand Overlay](https://github.com/ppkantorski/Ultrahand-Overlay)
|
* [Ultrahand Overlay](https://github.com/ppkantorski/Ultrahand-Overlay)
|
||||||
2. Download and extract **Horizon OC** to the root of your SD card.
|
2. Download and extract the **Horizon OC Package** to the root of your SD card.
|
||||||
3. If using **Hekate**, edit `hekate_ipl.ini` to include:
|
3. If using **Hekate**, edit `hekate_ipl.ini` to include:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -83,23 +83,13 @@ We don't accept donations. Put your spare cash into a charity instead :)
|
|||||||
Refer to COMPILATION.md
|
Refer to COMPILATION.md
|
||||||
|
|
||||||
---
|
---
|
||||||
|
## Clock table
|
||||||
Higher clocks are achievable via undervolting or further configuration, refer to this table for more details.
|
|
||||||
The averages are only for reference. Each ram is different and must be tuned independently. Refer to the guide for more details!
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary><h2 style="display:inline">Clock table</h2></summary>
|
|
||||||
|
|
||||||
### MEM clocks (mhz)
|
### MEM clocks (mhz)
|
||||||
* 3400 → max on mariko.
|
|
||||||
* 3366
|
* 3200 → max on mariko, JEDEC.
|
||||||
* 3333
|
|
||||||
* 3300
|
|
||||||
* 3266
|
|
||||||
* 3233
|
|
||||||
* 3200 → JEDEC, Hynix NEE/x267 Average
|
|
||||||
* 3166
|
* 3166
|
||||||
* 3133 → Micron WT:B Average
|
* 3133
|
||||||
* 3100
|
* 3100
|
||||||
* 3066
|
* 3066
|
||||||
* 3033
|
* 3033
|
||||||
@@ -108,20 +98,20 @@ The averages are only for reference. Each ram is different and must be tuned ind
|
|||||||
* 2933 → JEDEC.
|
* 2933 → JEDEC.
|
||||||
* 2900
|
* 2900
|
||||||
* 2866
|
* 2866
|
||||||
* 2833 → Samsung AA-MGCL Average
|
* 2833
|
||||||
* 2800
|
* 2800
|
||||||
* 2766
|
* 2766
|
||||||
* 2733 → Samsung AM-MGCJ/Micron WT:E Average
|
* 2733
|
||||||
* 2700
|
* 2700
|
||||||
* 2666 → JEDEC, Micron WT:F Average
|
* 2666 → JEDEC.
|
||||||
* 2633
|
* 2633
|
||||||
* 2600
|
* 2600
|
||||||
* 2566 → Samsung AB-MGCL Average
|
* 2566
|
||||||
* 2533
|
* 2533
|
||||||
* 2500
|
* 2500
|
||||||
* 2466
|
* 2466
|
||||||
* 2433
|
* 2433
|
||||||
* 2400 → max on erista, JEDEC, Hynix NME Average
|
* 2400 → max on erista, JEDEC.
|
||||||
* 2366
|
* 2366
|
||||||
* 2333
|
* 2333
|
||||||
* 2300
|
* 2300
|
||||||
@@ -134,7 +124,7 @@ The averages are only for reference. Each ram is different and must be tuned ind
|
|||||||
* 2066
|
* 2066
|
||||||
* 2033
|
* 2033
|
||||||
* 2000
|
* 2000
|
||||||
* 1996 → JEDEC, Erista Average
|
* 1996 → JEDEC standard
|
||||||
* 1966
|
* 1966
|
||||||
* 1933
|
* 1933
|
||||||
* 1900
|
* 1900
|
||||||
@@ -148,14 +138,9 @@ The averages are only for reference. Each ram is different and must be tuned ind
|
|||||||
* 1633
|
* 1633
|
||||||
* 1600 → official docked, boost mode, Erista JEDEC standard max (3200 Modules), JEDEC.
|
* 1600 → official docked, boost mode, Erista JEDEC standard max (3200 Modules), JEDEC.
|
||||||
* 1331 → official handheld, JEDEC.
|
* 1331 → official handheld, JEDEC.
|
||||||
* 1065 → Erista only
|
* 1065
|
||||||
* 800 → Erista only
|
* 800
|
||||||
* 665 → Erista only
|
* 665
|
||||||
* 408 → Erista only
|
|
||||||
* 204 → sleep mode
|
|
||||||
* 102 → Erista only
|
|
||||||
* 68 → Erista only
|
|
||||||
* 40 → Erista only
|
|
||||||
|
|
||||||
### CPU clocks (mhz)
|
### CPU clocks (mhz)
|
||||||
* 2805 → mariko absolute max, dangerous
|
* 2805 → mariko absolute max, dangerous
|
||||||
@@ -182,13 +167,9 @@ The averages are only for reference. Each ram is different and must be tuned ind
|
|||||||
* 612 → sleep mode
|
* 612 → sleep mode
|
||||||
|
|
||||||
### GPU clocks (mhz)
|
### GPU clocks (mhz)
|
||||||
* 1574 → absolute max clock on mariko. Dangerous
|
* 1536 → absolute max clock on mariko. Dangerous
|
||||||
* 1536
|
|
||||||
* 1497 → max mariko unsafe clock
|
* 1497 → max mariko unsafe clock
|
||||||
* 1459
|
|
||||||
* 1420
|
|
||||||
* 1382 → Max mariko "safe" clock
|
* 1382 → Max mariko "safe" clock
|
||||||
* 1344
|
|
||||||
* 1305
|
* 1305
|
||||||
* 1267 → NVIDIA T214(mariko) rating
|
* 1267 → NVIDIA T214(mariko) rating
|
||||||
* 1228 → mariko High UV safe clock
|
* 1228 → mariko High UV safe clock
|
||||||
@@ -215,15 +196,12 @@ The averages are only for reference. Each ram is different and must be tuned ind
|
|||||||
3. On Mariko, cap with hiOpt is 614MHz, with hiOpt-15mV it is 691MHz and with High UV it's 768MHz
|
3. On Mariko, cap with hiOpt is 614MHz, with hiOpt-15mV it is 691MHz and with High UV it's 768MHz
|
||||||
4. Clocks higher than 768MHz on erista need the official charger is plugged in.
|
4. Clocks higher than 768MHz on erista need the official charger is plugged in.
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
* **Lightos's Cats** - Cats
|
* **Lightos's Cat** - Cat
|
||||||
* **Souldbminer** - hoc-clk and loader development
|
* **Souldbminer** - hoc-clk and loader development
|
||||||
* **Lightos** - Loader patches development, hoc-clk development, guides
|
* **Lightos** - Loader patches development, hoc-clk development, guides
|
||||||
* **HAZEL** - Perfect DRAM timings help
|
|
||||||
* **TDRR** - HOC Logo Design
|
* **TDRR** - HOC Logo Design
|
||||||
* **tetetete-ctrl** - Website design
|
* **tetetete-ctrl** - Website design
|
||||||
* **SciresM** - Atmosphere CFW
|
* **SciresM** - Atmosphere CFW
|
||||||
@@ -240,9 +218,6 @@ The averages are only for reference. Each ram is different and must be tuned ind
|
|||||||
* **Dominatorul, Samybigio, Arcdelta, Miki, Happy, Winnerboi77, Blaise, Alvise, agjeococh, frost, letum00, and Xenshen** - Testing
|
* **Dominatorul, Samybigio, Arcdelta, Miki, Happy, Winnerboi77, Blaise, Alvise, agjeococh, frost, letum00, and Xenshen** - Testing
|
||||||
* **Samybigio2011, Miki** - Italian translations
|
* **Samybigio2011, Miki** - Italian translations
|
||||||
* **angelblaster** - Korean translations
|
* **angelblaster** - Korean translations
|
||||||
* **q1332348216-glitch, nangongjing1, xinluochenjiang** - Chinese translations
|
* **q1332348216-glitch** - Chinese translations
|
||||||
* **th3-ne0undr5c0r** - French translations
|
* **th3-ne0undr5c0r** - French translations
|
||||||
* **redraz** - Russian translations
|
|
||||||
* **Wivi** - Portuguese translations
|
|
||||||
* **Niklas080208** - JSON language support for sysmodule notifications.
|
|
||||||
* **Nvidia** - [Tegra X1 Technical Reference Manual](https://developer.nvidia.com/embedded/dlc/tegra-x1-technical-reference-manual), soctherm driver, L4T
|
* **Nvidia** - [Tegra X1 Technical Reference Manual](https://developer.nvidia.com/embedded/dlc/tegra-x1-technical-reference-manual), soctherm driver, L4T
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
160c160
|
||||||
|
< /* Validate that the bpmp is appropriately halted. */
|
||||||
|
---
|
||||||
|
> /* Horizon-OC: Halt BPMP here as hoc-clk may be running it, and if it's running there will be a panic. */
|
||||||
|
161a162,165
|
||||||
|
> reg::Write(FLOW_CTLR + FLOW_CTLR_HALT_COP_EVENTS, FLOW_REG_BITS_ENUM (HALT_COP_EVENTS_MODE, FLOW_MODE_STOP),
|
||||||
|
> FLOW_REG_BITS_ENUM_SEL(HALT_COP_EVENTS_JTAG, jtag, ENABLED, DISABLED));
|
||||||
|
>
|
||||||
|
> /* Validate that the bpmp is appropriately halted. */
|
||||||
@@ -900,6 +900,32 @@ namespace ams::secmon {
|
|||||||
reg::ReadWrite(PMC + APBDEV_PMC_SECURE_SCRATCH39, REG_BITS_VALUE(0, 27, WarmbootCarveoutConfig));
|
reg::ReadWrite(PMC + APBDEV_PMC_SECURE_SCRATCH39, REG_BITS_VALUE(0, 27, WarmbootCarveoutConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EnableBpmpSmmu() {
|
||||||
|
/* Define the ASID contents. */
|
||||||
|
constexpr int BpmpAsid = 1;
|
||||||
|
constexpr uintptr_t BpmpAsidPde = MemoryRegionPhysicalDeviceSecurityEngine.GetAddress();
|
||||||
|
|
||||||
|
/* Configure the ASID. */
|
||||||
|
reg::Write(MC + MC_SMMU_PTB_ASID, MC_REG_BITS_VALUE(SMMU_PTB_ASID_CURRENT_ASID, BpmpAsid));
|
||||||
|
|
||||||
|
reg::Write(MC + MC_SMMU_PTB_DATA, MC_REG_BITS_VALUE(SMMU_PTB_DATA_ASID_PDE_BASE, BpmpAsidPde / 4_KB),
|
||||||
|
MC_REG_BITS_ENUM (SMMU_PTB_DATA_ASID_NONSECURE, DISABLE),
|
||||||
|
MC_REG_BITS_ENUM (SMMU_PTB_DATA_ASID_WRITABLE, DISABLE),
|
||||||
|
MC_REG_BITS_ENUM (SMMU_PTB_DATA_ASID_READABLE, DISABLE));
|
||||||
|
|
||||||
|
/* Configure the BPMP and PPCS1 to use the asid. */
|
||||||
|
reg::Write(MC + MC_SMMU_AVPC_ASID, MC_REG_BITS_ENUM(SMMU_AVPC_ASID_AVPC_SMMU_ENABLE, ENABLE), MC_REG_BITS_VALUE(SMMU_AVPC_ASID_AVPC_ASID, BpmpAsid));
|
||||||
|
reg::Write(MC + MC_SMMU_PPCS1_ASID, MC_REG_BITS_ENUM(SMMU_PPCS1_ASID_PPCS1_SMMU_ENABLE, ENABLE), MC_REG_BITS_VALUE(SMMU_PPCS1_ASID_PPCS1_ASID, BpmpAsid));
|
||||||
|
|
||||||
|
/* Flush the entire page table cache, and read TLB_CONFIG to ensure the flush takes. */
|
||||||
|
reg::Write(MC + MC_SMMU_PTC_FLUSH_0, 0);
|
||||||
|
reg::Read (MC + MC_SMMU_TLB_CONFIG);
|
||||||
|
|
||||||
|
/* Flush the entire translation lookaside buffer, and read TLB_CONFIG to ensure the flush takes. */
|
||||||
|
reg::Write(MC + MC_SMMU_TLB_FLUSH, 0);
|
||||||
|
reg::Read (MC + MC_SMMU_TLB_CONFIG);
|
||||||
|
}
|
||||||
|
|
||||||
void ValidateResetExpected() {
|
void ValidateResetExpected() {
|
||||||
/* We're coming out of reset, so check that we expected to come out of reset. */
|
/* We're coming out of reset, so check that we expected to come out of reset. */
|
||||||
if (!IsResetExpected()) {
|
if (!IsResetExpected()) {
|
||||||
@@ -909,6 +935,11 @@ namespace ams::secmon {
|
|||||||
SetResetExpected(false);
|
SetResetExpected(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActmonInterruptHandler() {
|
||||||
|
SetError(pkg1::ErrorInfo_ActivityMonitorInterrupt);
|
||||||
|
AMS_ABORT("actmon observed bpmp wakeup");
|
||||||
|
}
|
||||||
|
|
||||||
void ExitChargerHiZMode() {
|
void ExitChargerHiZMode() {
|
||||||
/* Setup I2c-1. */
|
/* Setup I2c-1. */
|
||||||
pinmux::SetupI2c1();
|
pinmux::SetupI2c1();
|
||||||
@@ -1151,6 +1182,39 @@ namespace ams::secmon {
|
|||||||
FinalizeCarveoutSecureScratchRegisters();
|
FinalizeCarveoutSecureScratchRegisters();
|
||||||
pmc::LockSecureRegister(pmc::SecureRegister_Carveout);
|
pmc::LockSecureRegister(pmc::SecureRegister_Carveout);
|
||||||
|
|
||||||
|
/* Clear all the BPMP exception vectors to a fixed value. */
|
||||||
|
constexpr u32 BpmpExceptionVector = 0x7D000000;
|
||||||
|
reg::Write(EVP + EVP_COP_RESET_VECTOR, BpmpExceptionVector);
|
||||||
|
reg::Write(EVP + EVP_COP_UNDEF_VECTOR, BpmpExceptionVector);
|
||||||
|
reg::Write(EVP + EVP_COP_SWI_VECTOR, BpmpExceptionVector);
|
||||||
|
reg::Write(EVP + EVP_COP_PREFETCH_ABORT_VECTOR, BpmpExceptionVector);
|
||||||
|
reg::Write(EVP + EVP_COP_DATA_ABORT_VECTOR, BpmpExceptionVector);
|
||||||
|
reg::Write(EVP + EVP_COP_RSVD_VECTOR, BpmpExceptionVector);
|
||||||
|
reg::Write(EVP + EVP_COP_IRQ_VECTOR, BpmpExceptionVector);
|
||||||
|
reg::Write(EVP + EVP_COP_FIQ_VECTOR, BpmpExceptionVector);
|
||||||
|
|
||||||
|
/* Disable arbitration for the bpmp. */
|
||||||
|
reg::ReadWrite(SYSTEM + AHB_ARBITRATION_DISABLE, AHB_REG_BITS_ENUM(ARBITRATION_DISABLE_COP, DISABLE));
|
||||||
|
|
||||||
|
/* Turn on the SMMU for the BPMP. */
|
||||||
|
EnableBpmpSmmu();
|
||||||
|
|
||||||
|
/* Wait until the flow controller reports that the BPMP is halted. */
|
||||||
|
while (!reg::HasValue(FLOW_CTLR + FLOW_CTLR_HALT_COP_EVENTS, FLOW_REG_BITS_ENUM(HALT_COP_EVENTS_MODE, FLOW_MODE_STOP))) {
|
||||||
|
util::WaitMicroSeconds(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enable clock to the activity monitor. */
|
||||||
|
clkrst::EnableActmonClock();
|
||||||
|
|
||||||
|
/* If JTAG is disabled, disable JTAG. */
|
||||||
|
if (!secmon::IsJtagEnabled()) {
|
||||||
|
reg::Write(FLOW_CTLR + FLOW_CTLR_HALT_COP_EVENTS, FLOW_REG_BITS_ENUM(HALT_COP_EVENTS_MODE, FLOW_MODE_STOP),
|
||||||
|
FLOW_REG_BITS_ENUM(HALT_COP_EVENTS_JTAG, DISABLED));
|
||||||
|
|
||||||
|
/* Turn on the activity monitor to prevent booting up the bpmp. */
|
||||||
|
actmon::StartMonitoringBpmp(ActmonInterruptHandler);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupPmcAndMcSecure() {
|
void SetupPmcAndMcSecure() {
|
||||||
|
|||||||
@@ -157,8 +157,12 @@ namespace ams::secmon::smc {
|
|||||||
/* Validate that all other cores are off. */
|
/* Validate that all other cores are off. */
|
||||||
AMS_ABORT_UNLESS(reg::HasValue(PMC + APBDEV_PMC_PWRGATE_STATUS, PMC_REG_BITS_VALUE(PWRGATE_STATUS_CE123, 0)));
|
AMS_ABORT_UNLESS(reg::HasValue(PMC + APBDEV_PMC_PWRGATE_STATUS, PMC_REG_BITS_VALUE(PWRGATE_STATUS_CE123, 0)));
|
||||||
|
|
||||||
/* Validate that the bpmp is appropriately halted. */
|
/* Horizon-OC: Halt BPMP here as hoc-clk may be running it, and if it's running there will be a panic. */
|
||||||
const bool jtag = IsJtagEnabled();
|
const bool jtag = IsJtagEnabled();
|
||||||
|
reg::Write(FLOW_CTLR + FLOW_CTLR_HALT_COP_EVENTS, FLOW_REG_BITS_ENUM (HALT_COP_EVENTS_MODE, FLOW_MODE_STOP),
|
||||||
|
FLOW_REG_BITS_ENUM_SEL(HALT_COP_EVENTS_JTAG, jtag, ENABLED, DISABLED));
|
||||||
|
|
||||||
|
/* Validate that the bpmp is appropriately halted. */
|
||||||
AMS_ABORT_UNLESS(reg::Read(FLOW_CTLR + FLOW_CTLR_HALT_COP_EVENTS) == reg::Encode(FLOW_REG_BITS_ENUM (HALT_COP_EVENTS_MODE, FLOW_MODE_STOP),
|
AMS_ABORT_UNLESS(reg::Read(FLOW_CTLR + FLOW_CTLR_HALT_COP_EVENTS) == reg::Encode(FLOW_REG_BITS_ENUM (HALT_COP_EVENTS_MODE, FLOW_MODE_STOP),
|
||||||
FLOW_REG_BITS_ENUM_SEL(HALT_COP_EVENTS_JTAG, jtag, ENABLED, DISABLED)));
|
FLOW_REG_BITS_ENUM_SEL(HALT_COP_EVENTS_JTAG, jtag, ENABLED, DISABLED)));
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
#include "ldr_capabilities.hpp"
|
#include "ldr_capabilities.hpp"
|
||||||
#include "ldr_content_management.hpp"
|
#include "ldr_content_management.hpp"
|
||||||
|
|||||||
@@ -36,14 +36,14 @@ volatile CustomizeTable C = {
|
|||||||
.hpMode = DISABLED,
|
.hpMode = DISABLED,
|
||||||
|
|
||||||
.commonEmcMemVolt = 1175000, /* LPDDR4(X) JEDEC Specification */
|
.commonEmcMemVolt = 1175000, /* LPDDR4(X) JEDEC Specification */
|
||||||
.eristaEmcMaxClock = 1600000, /* Erista ram rating*/
|
.eristaEmcMaxClock = 1600000, /* Maximum HB-MGCH ram rating */
|
||||||
|
|
||||||
/* Available: 33MHz step rate, 66MHz step rate, 100MHz step rate, 133MHz step rate and jedec. */
|
/* Available: 66MHz step rate, 100MHz step rate, 133MHz step rate and jedec. */
|
||||||
/* Jedec freqs are 1333MHz, 1600MHz, 1866MHz, 2133MHz, 2400MHz, 2666MHz, 2933MHz, 3200MHz. */
|
/* Jedec freqs are 1333MHz, 1600MHz, 1866MHz, 2133MHz, 2400MHz, 2666MHz, 2933MHz, 3200MHz. */
|
||||||
.stepMode = StepMode_Jedec,
|
.stepMode = StepMode_Jedec,
|
||||||
|
|
||||||
.marikoEmcMaxClock = 2133000, /* Should work for every ram*/
|
.marikoEmcMaxClock = 2133000, /* 1866MHz @ 1866tWRL is guaranteed to work on all Mariko units */
|
||||||
.marikoEmcVddqVolt = 640000, /* Optimal for DRAM OC */
|
.marikoEmcVddqVolt = 600000,
|
||||||
|
|
||||||
.emcDvbShift = 0,
|
.emcDvbShift = 0,
|
||||||
.marikoSocVmax = 0, /* 0 = stock limits (1450 - 1597 is 1050mV, 1598-1708 is 1025mV, 1709+ is 1000mV). */
|
.marikoSocVmax = 0, /* 0 = stock limits (1450 - 1597 is 1050mV, 1598-1708 is 1025mV, 1709+ is 1000mV). */
|
||||||
@@ -133,7 +133,7 @@ volatile CustomizeTable C = {
|
|||||||
AUTO /* 153 */,
|
AUTO /* 153 */,
|
||||||
AUTO /* 192 */,
|
AUTO /* 192 */,
|
||||||
AUTO /* 230 */,
|
AUTO /* 230 */,
|
||||||
AUTO /* 268 */,
|
AUTO /* 269 */,
|
||||||
AUTO /* 307 */,
|
AUTO /* 307 */,
|
||||||
AUTO /* 346 */,
|
AUTO /* 346 */,
|
||||||
AUTO /* 384 */,
|
AUTO /* 384 */,
|
||||||
@@ -182,7 +182,6 @@ volatile CustomizeTable C = {
|
|||||||
DEACTIVATED_GPU_FREQ /* 1459 (Disabled by default) */,
|
DEACTIVATED_GPU_FREQ /* 1459 (Disabled by default) */,
|
||||||
DEACTIVATED_GPU_FREQ /* 1497 (Disabled by default) */,
|
DEACTIVATED_GPU_FREQ /* 1497 (Disabled by default) */,
|
||||||
DEACTIVATED_GPU_FREQ /* 1536 (Disabled by default) */,
|
DEACTIVATED_GPU_FREQ /* 1536 (Disabled by default) */,
|
||||||
DEACTIVATED_GPU_FREQ /* 1574 (Disabled by default) */,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Override soc voltage brackets. */
|
/* Override soc voltage brackets. */
|
||||||
@@ -221,16 +220,6 @@ volatile CustomizeTable C = {
|
|||||||
.fineTune_t6_tRTW = 0,
|
.fineTune_t6_tRTW = 0,
|
||||||
.fineTune_t7_tWTR = 0,
|
.fineTune_t7_tWTR = 0,
|
||||||
|
|
||||||
/* Debugging options */
|
|
||||||
|
|
||||||
/* PCV Log Verbosity */
|
|
||||||
/* 0xFF: Nothing */
|
|
||||||
/* 0: Basic logging */
|
|
||||||
/* 1: More advanced logging */
|
|
||||||
/* 2: All logging excluding MMIO */
|
|
||||||
/* 3: All logging including MMIO */
|
|
||||||
.pcvLogVerbosity = 2,
|
|
||||||
|
|
||||||
/* You shouldn't have to anything past here. */
|
/* You shouldn't have to anything past here. */
|
||||||
.eristaCpuDvfsTable = {
|
.eristaCpuDvfsTable = {
|
||||||
{ 204000, { 721094, }, { } },
|
{ 204000, { 721094, }, { } },
|
||||||
@@ -587,14 +576,13 @@ volatile CustomizeTable C = {
|
|||||||
{ 1152000, { }, { 1180029, -14534, -830, 0, 1469, 110 } },
|
{ 1152000, { }, { 1180029, -14534, -830, 0, 1469, 110 } },
|
||||||
{ 1228800, { }, { 1238293, -16383, -859, 0, 3722, 313 } },
|
{ 1228800, { }, { 1238293, -16383, -859, 0, 3722, 313 } },
|
||||||
{ 1267200, { }, { 1276399, -17475, -867, 0, 3681, 559 } },
|
{ 1267200, { }, { 1276399, -17475, -867, 0, 3681, 559 } },
|
||||||
{ 1305600, { }, { 0, 0, 0, 0, 0, 0 } },
|
{ 1305600, { }, { } },
|
||||||
{ 1344000, { }, { 0, 0, 0, 0, 0, 0 } },
|
{ 1344000, { }, { } },
|
||||||
{ 1382400, { }, { 0, 0, 0, 0, 0, 0 } },
|
{ 1382400, { }, { } },
|
||||||
{ 1420800, { }, { 0, 0, 0, 0, 0, 0 } },
|
{ 1420800, { }, { } },
|
||||||
{ 1459200, { }, { 0, 0, 0, 0, 0, 0 } },
|
{ 1459200, { }, { } },
|
||||||
{ 1497600, { }, { 0, 0, 0, 0, 0, 0 } },
|
{ 1497600, { }, { } },
|
||||||
{ 1536000, { }, { 0, 0, 0, 0, 0, 0 } },
|
{ 1536000, { }, { } },
|
||||||
{ 1574400, { }, { 0, 0, 0, 0, 0, 0 } },
|
|
||||||
},
|
},
|
||||||
|
|
||||||
.marikoGpuDvfsTableHighUV = {
|
.marikoGpuDvfsTableHighUV = {
|
||||||
@@ -622,7 +610,6 @@ volatile CustomizeTable C = {
|
|||||||
{ 1459200, { }, { 0, 0, 0, 0, 0, 0 } },
|
{ 1459200, { }, { 0, 0, 0, 0, 0, 0 } },
|
||||||
{ 1497600, { }, { 0, 0, 0, 0, 0, 0 } },
|
{ 1497600, { }, { 0, 0, 0, 0, 0, 0 } },
|
||||||
{ 1536000, { }, { 0, 0, 0, 0, 0, 0 } },
|
{ 1536000, { }, { 0, 0, 0, 0, 0, 0 } },
|
||||||
{ 1574400, { }, { 0, 0, 0, 0, 0, 0 } },
|
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define CUST_REV 7
|
#define CUST_REV 7
|
||||||
#define KIP_VERSION 300
|
#define KIP_VERSION 260
|
||||||
|
|
||||||
#include "oc_common.hpp"
|
#include "oc_common.hpp"
|
||||||
#include "pcv/pcv_common.hpp"
|
#include "pcv/pcv_common.hpp"
|
||||||
@@ -40,21 +40,20 @@ enum StepMode: u32 {
|
|||||||
StepMode_100MHz = 1,
|
StepMode_100MHz = 1,
|
||||||
StepMode_Jedec = 2,
|
StepMode_Jedec = 2,
|
||||||
StepMode_133MHz = 3,
|
StepMode_133MHz = 3,
|
||||||
StepMode_33MHz = 4,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ReadLatency: u32 {
|
enum ReadLatency: u32 {
|
||||||
RL_2133 = 40,
|
RL_2133 = 40,
|
||||||
RL_1866 = 36,
|
RL_1866 = 36,
|
||||||
RL_1600 = 32,
|
RL_1600 = 32,
|
||||||
RL_1333 = 28,
|
RL_1331 = 28,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum WriteLatency: u32 {
|
enum WriteLatency: u32 {
|
||||||
WL_2133 = 18,
|
WL_2133 = 18,
|
||||||
WL_1866 = 16,
|
WL_1866 = 16,
|
||||||
WL_1600 = 14,
|
WL_1600 = 14,
|
||||||
WL_1333 = 12,
|
WL_1331 = 12,
|
||||||
};
|
};
|
||||||
|
|
||||||
using CustomizeCpuDvfsTable = pcv::cvb_entry_t[pcv::DvfsTableEntryLimit];
|
using CustomizeCpuDvfsTable = pcv::cvb_entry_t[pcv::DvfsTableEntryLimit];
|
||||||
@@ -126,15 +125,13 @@ struct CustomizeTable {
|
|||||||
s32 commonGpuVoltOffset;
|
s32 commonGpuVoltOffset;
|
||||||
|
|
||||||
u32 eristaGpuVoltArray[27];
|
u32 eristaGpuVoltArray[27];
|
||||||
u32 marikoGpuVoltArray[25];
|
u32 marikoGpuVoltArray[24];
|
||||||
s32 marikoSocVoltArray[28];
|
s32 marikoSocVoltArray[28];
|
||||||
|
|
||||||
u32 fineTune_t6_tRTW;
|
u32 fineTune_t6_tRTW;
|
||||||
u32 fineTune_t7_tWTR;
|
u32 fineTune_t7_tWTR;
|
||||||
|
|
||||||
u32 pcvLogVerbosity;
|
u32 reserved[60];
|
||||||
|
|
||||||
u32 reserved[57];
|
|
||||||
|
|
||||||
CustomizeCpuDvfsTable eristaCpuDvfsTable;
|
CustomizeCpuDvfsTable eristaCpuDvfsTable;
|
||||||
CustomizeCpuDvfsTable eristaCpuDvfsTableSLT;
|
CustomizeCpuDvfsTable eristaCpuDvfsTableSLT;
|
||||||
|
|||||||
@@ -0,0 +1,144 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Lightos_
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../mtc_timing_value.hpp"
|
||||||
|
|
||||||
|
namespace ams::ldr::hoc::pcv::erista {
|
||||||
|
|
||||||
|
void SwitchLatency(volatile u32 &latency, u32 index, u32 latencyStep) {
|
||||||
|
latency += index * latencyStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
static s32 GetMaxLatencyIndex(volatile u32 *latencyArray, u32 latencySize) {
|
||||||
|
s32 maxIndex = -1;
|
||||||
|
for (u32 i = 0; i < latencySize; ++i) {
|
||||||
|
if (latencyArray[i]) {
|
||||||
|
maxIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return maxIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoLatency(volatile u32 &latency, u32 freq, u32 latencyStep) {
|
||||||
|
if (freq > 1600'000 && freq <= 1866'000) { /* 1866tRWL */
|
||||||
|
latency += latencyStep * 2;
|
||||||
|
} else { /* 2133tRWL */
|
||||||
|
latency += latencyStep * 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleLatency(u32 freq, volatile u32 &latency, volatile u32 *latencyArray, u32 indexMax, u32 latencyStep) {
|
||||||
|
for (u32 i = 0; i <= indexMax; ++i) {
|
||||||
|
if (latencyArray[i] != 0 && freq <= latencyArray[i]) {
|
||||||
|
SwitchLatency(latency, i, latencyStep);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SwitchLatency(latency, indexMax, latencyStep);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleLatency(u32 freq) {
|
||||||
|
static s32 rlIndexMax = GetMaxLatencyIndex(C.readLatency, std::size(C.readLatency));
|
||||||
|
static s32 wlIndexMax = GetMaxLatencyIndex(C.writeLatency, std::size(C.writeLatency));
|
||||||
|
constexpr u32 ReadLatencyStep = 4;
|
||||||
|
constexpr u32 WriteLatencyStep = 2;
|
||||||
|
bool autoLatencyRead = false, autoLatencyWrite = false;
|
||||||
|
|
||||||
|
if (rlIndexMax == -1) {
|
||||||
|
AutoLatency(RL, freq, ReadLatencyStep);
|
||||||
|
autoLatencyRead = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wlIndexMax == -1) {
|
||||||
|
AutoLatency(WL, freq, WriteLatencyStep);
|
||||||
|
autoLatencyWrite = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (autoLatencyRead && autoLatencyWrite) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!autoLatencyRead) {
|
||||||
|
HandleLatency(freq, RL, C.readLatency, rlIndexMax, ReadLatencyStep);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!autoLatencyWrite) {
|
||||||
|
HandleLatency(freq, WL, C.writeLatency, wlIndexMax, WriteLatencyStep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalculateMrw2() {
|
||||||
|
static const u8 rlMapDBI[8] = {
|
||||||
|
6, 12, 16, 22, 28, 32, 36, 40
|
||||||
|
};
|
||||||
|
|
||||||
|
static const u8 wlMapSetA[8] = {
|
||||||
|
4, 6, 8, 10, 12, 14, 16, 18
|
||||||
|
};
|
||||||
|
|
||||||
|
u32 rlIndex = 0;
|
||||||
|
u32 wlIndex = 0;
|
||||||
|
|
||||||
|
for (u32 i = 0; i < std::size(rlMapDBI); ++i) {
|
||||||
|
if (rlMapDBI[i] == 32) {
|
||||||
|
rlIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (u32 i = 0; i < std::size(wlMapSetA); ++i) {
|
||||||
|
if (wlMapSetA[i] == WL) {
|
||||||
|
wlIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DBI is always enabled. */
|
||||||
|
mrw2 = static_cast<u8>(((rlIndex & 0x7) | ((wlIndex & 0x7) << 3) | ((0 & 0x1) << 6)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalculateTimings(double tCK_avg, u32 freq) {
|
||||||
|
RL = RL_1331;
|
||||||
|
WL = WL_1331;
|
||||||
|
|
||||||
|
HandleLatency(freq);
|
||||||
|
CalculateMrw2();
|
||||||
|
|
||||||
|
tR2P = CEIL((RL * 0.426) - 2.0);
|
||||||
|
tR2W = FLOOR(FLOOR((5.0 / tCK_avg) + ((FLOOR(48.0 / WL) - 0.478) * 3.0)) / 1.501) + RL - (C.t6_tRTW * 3) + finetRTW;
|
||||||
|
|
||||||
|
tW2P = (CEIL(WL * 1.7303) * 2) - 5;
|
||||||
|
tWTPDEN = CEIL(((1.803 / tCK_avg) + MAX(RL + (2.694 / tCK_avg), static_cast<double>(tW2P))) + (BL / 2));
|
||||||
|
tW2R = FLOOR(MAX((5.020 / tCK_avg) + 1.130, WL - MAX(-CEIL(0.258 * (WL - RL)), 1.964)) * 1.964) + WL - CEIL(tWTR / tCK_avg) + finetWTR;
|
||||||
|
|
||||||
|
wdv = WL;
|
||||||
|
wsv = WL - 2;
|
||||||
|
wev = 0xA + (WL - 14);
|
||||||
|
|
||||||
|
u32 obdlyHigh = 3 / FLOOR(MIN(static_cast<double>(2), tCK_avg * (WL - 7)));
|
||||||
|
u32 obdlyLow = MAX(WL - FLOOR((126.0 / CEIL(tCK_avg + 8.601))), 0.0);
|
||||||
|
obdly = PACK_U32_NIBBLE_HIGH_BYTE_LOW(obdlyHigh, obdlyLow);
|
||||||
|
|
||||||
|
pdex2rw = CEIL((CEIL(12.335 - tCK_avg) + (7.430 / tCK_avg) - CEIL(tCK_avg * 11.361)));
|
||||||
|
tCLKSTOP = FLOOR(MIN(8.488 / tCK_avg, 23.0)) + 8.0;
|
||||||
|
|
||||||
|
const double tMMRI = tRCD + (tCK_avg * 3);
|
||||||
|
pdex2mrr = tMMRI + 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
-1
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::erista {
|
namespace ams::ldr::hoc::pcv::erista {
|
||||||
|
|
||||||
u8 GetNWrIndex();
|
|
||||||
void CalculateTimings(double tCK_avg, u32 freq);
|
void CalculateTimings(double tCK_avg, u32 freq);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,204 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Lightos_
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stratosphere.hpp>
|
||||||
|
#include "../mtc_timing_value.hpp"
|
||||||
|
#include "timing_tables.hpp"
|
||||||
|
|
||||||
|
namespace ams::ldr::hoc::pcv::mariko {
|
||||||
|
|
||||||
|
void GetRext() {
|
||||||
|
if (auto r = FindRext()) {
|
||||||
|
rext = r->rext;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* > 3200 */
|
||||||
|
rext = 0x1E;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SwitchLatency(volatile u32 &latency, u32 index, u32 latencyStep) {
|
||||||
|
latency += index * latencyStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
static s32 GetMaxLatencyIndex(volatile u32 *latencyArray, u32 latencySize) {
|
||||||
|
s32 maxIndex = -1;
|
||||||
|
for (u32 i = 0; i < latencySize; ++i) {
|
||||||
|
if (latencyArray[i]) {
|
||||||
|
maxIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return maxIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutoLatency(volatile u32 &latency, u32 freq, u32 latencyStep) {
|
||||||
|
if (freq > 1600'000 && freq <= 1862'400) { /* 1866tRWL */
|
||||||
|
latency += latencyStep * 2;
|
||||||
|
} else { /* 2133tRWL */
|
||||||
|
latency += latencyStep * 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleLatency(u32 freq, volatile u32 &latency, volatile u32 *latencyArray, u32 indexMax, u32 latencyStep) {
|
||||||
|
for (u32 i = 0; i <= indexMax; ++i) {
|
||||||
|
if (latencyArray[i] != 0 && freq <= latencyArray[i]) {
|
||||||
|
SwitchLatency(latency, i, latencyStep);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SwitchLatency(latency, indexMax, latencyStep);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleLatency(u32 freq) {
|
||||||
|
static s32 rlIndexMax = GetMaxLatencyIndex(C.readLatency, std::size(C.readLatency));
|
||||||
|
static s32 wlIndexMax = GetMaxLatencyIndex(C.writeLatency, std::size(C.writeLatency));
|
||||||
|
constexpr u32 ReadLatencyStep = 4;
|
||||||
|
constexpr u32 WriteLatencyStep = 2;
|
||||||
|
bool autoLatencyRead = false, autoLatencyWrite = false;
|
||||||
|
|
||||||
|
if (rlIndexMax == -1) {
|
||||||
|
AutoLatency(RL, freq, ReadLatencyStep);
|
||||||
|
autoLatencyRead = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wlIndexMax == -1) {
|
||||||
|
AutoLatency(WL, freq, WriteLatencyStep);
|
||||||
|
autoLatencyWrite = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (autoLatencyRead && autoLatencyWrite) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!autoLatencyRead) {
|
||||||
|
HandleLatency(freq, RL, C.readLatency, rlIndexMax, ReadLatencyStep);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!autoLatencyWrite) {
|
||||||
|
HandleLatency(freq, WL, C.writeLatency, wlIndexMax, WriteLatencyStep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalculateMrw2() {
|
||||||
|
static const u8 rlMapDBI[8] = {
|
||||||
|
6, 12, 16, 22, 28, 32, 36, 40
|
||||||
|
};
|
||||||
|
|
||||||
|
static const u8 wlMapSetA[8] = {
|
||||||
|
4, 6, 8, 10, 12, 14, 16, 18
|
||||||
|
};
|
||||||
|
|
||||||
|
u32 rlIndex = 0;
|
||||||
|
u32 wlIndex = 0;
|
||||||
|
|
||||||
|
for (u32 i = 0; i < std::size(rlMapDBI); ++i) {
|
||||||
|
if (rlMapDBI[i] == RL) {
|
||||||
|
rlIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (u32 i = 0; i < std::size(wlMapSetA); ++i) {
|
||||||
|
if (wlMapSetA[i] == WL) {
|
||||||
|
wlIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DBI is always enabled. */
|
||||||
|
mrw2 = static_cast<u8>(((rlIndex & 0x7) | ((wlIndex & 0x7) << 3) | ((0 & 0x1) << 6)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalculateTimings(double tCK_avg, u32 freq) {
|
||||||
|
RL = RL_1331;
|
||||||
|
WL = WL_1331;
|
||||||
|
|
||||||
|
HandleLatency(freq);
|
||||||
|
|
||||||
|
GetRext();
|
||||||
|
|
||||||
|
/* At 1333WL, for some reason (incorrect ram timing config in mtc table?), tRP causes crashes at high reductions - 2 seems to be the most common limit. */
|
||||||
|
/* This is a lazy workaround until I find the issue... */
|
||||||
|
const bool lowFreq = freq < C.timingEmcTbreak;
|
||||||
|
|
||||||
|
tRCD = tRCD_values[lowFreq ? C.low_t1_tRCD : C.t1_tRCD];
|
||||||
|
tRPpb = tRP_values[lowFreq ? C.low_t2_tRP : C.t2_tRP];
|
||||||
|
tRAS = tRAS_values[lowFreq ? C.low_t3_tRAS : C.t3_tRAS];
|
||||||
|
tRRD = tRRD_values[lowFreq ? C.low_t4_tRRD : C.t4_tRRD];
|
||||||
|
tRFCpb = tRFC_values[lowFreq ? C.low_t5_tRFC : C.t5_tRFC];
|
||||||
|
|
||||||
|
u32 tRTW = lowFreq ? C.low_t6_tRTW : C.t6_tRTW;
|
||||||
|
u32 tWTR = 10 - tWTR_values[lowFreq ? C.low_t7_tWTR : C.t7_tWTR];
|
||||||
|
|
||||||
|
s32 finetRTW = C.fineTune_t6_tRTW;
|
||||||
|
s32 finetWTR = C.fineTune_t7_tWTR;
|
||||||
|
|
||||||
|
u32 tREFI = lowFreq ? C.low_t8_tREFI : C.t8_tREFI;
|
||||||
|
refresh_raw = 0xFFFF;
|
||||||
|
if (tREFI != 6) {
|
||||||
|
refresh_raw = CEIL(tREFpb_values[tREFI] / tCK_avg) - 0x40;
|
||||||
|
refresh_raw = MIN(refresh_raw, static_cast<u32>(0xFFFF));
|
||||||
|
}
|
||||||
|
|
||||||
|
tRC = tRAS + tRPpb;
|
||||||
|
tRFCab = tRFCpb * 2;
|
||||||
|
tXSR = static_cast<double>(tRFCab + 7.5);
|
||||||
|
tFAW = static_cast<u32>(tRRD * 4.0);
|
||||||
|
tRPab = tRPpb + 3;
|
||||||
|
|
||||||
|
tR2P = CEIL((RL * 0.426) - 2.0);
|
||||||
|
tR2W = FLOOR(FLOOR((5.0 / tCK_avg) + ((FLOOR(48.0 / WL) - 0.478) * 3.0)) / 1.501) + RL - (tRTW * 3) + finetRTW;
|
||||||
|
tRTM = FLOOR((10.0 + RL) + (3.502 / tCK_avg)) + FLOOR(7.489 / tCK_avg);
|
||||||
|
tRATM = CEIL((tRTM - 10.0) + (RL * 0.426));
|
||||||
|
|
||||||
|
rdv = RL + FLOOR((5.105 / tCK_avg) + 17.017);
|
||||||
|
qpop = rdv - 14;
|
||||||
|
quse_width = CEIL(((4.897 / tCK_avg) - FLOOR(2.538 / tCK_avg)) + 3.782);
|
||||||
|
quse = FLOOR(RL + ((5.082 / tCK_avg) + FLOOR(2.560 / tCK_avg))) - CEIL(4.820 / tCK_avg);
|
||||||
|
einput_duration = FLOOR(9.936 / tCK_avg) + 5.0 + quse_width;
|
||||||
|
einput = quse - CEIL(9.928 / tCK_avg);
|
||||||
|
u32 qrst_duration = FLOOR(8.399 - tCK_avg);
|
||||||
|
u32 qrstLow = MAX(static_cast<s32>(einput - qrst_duration - 2), static_cast<s32>(0));
|
||||||
|
qrst = PACK_U32(qrst_duration, qrstLow);
|
||||||
|
ibdly = PACK_U32_NIBBLE_HIGH_BYTE_LOW(1, quse - qrst_duration - 2.0);
|
||||||
|
qsafe = (einput_duration + 3) + MAX(MIN(qrstLow * rdv, qrst_duration + qrst_duration), einput);
|
||||||
|
tW2P = (CEIL(WL * 1.7303) * 2) - 5;
|
||||||
|
tWTPDEN = CEIL(((1.803 / tCK_avg) + MAX(RL + (2.694 / tCK_avg), static_cast<double>(tW2P))) + (BL / 2));
|
||||||
|
tW2R = FLOOR(MAX((5.020 / tCK_avg) + 1.130, WL - MAX(-CEIL(0.258 * (WL - RL)), 1.964)) * 1.964) + WL - CEIL(tWTR / tCK_avg) + finetWTR;
|
||||||
|
tWTM = CEIL(WL + ((7.570 / tCK_avg) + 8.753));
|
||||||
|
tWATM = (tWTM + (FLOOR(WL / 0.816) * 2.0)) - 4.0;
|
||||||
|
|
||||||
|
wdv = WL;
|
||||||
|
wsv = WL - 2;
|
||||||
|
wev = 0xA + (WL - 14);
|
||||||
|
|
||||||
|
u32 obdlyHigh = 3 / FLOOR(MIN(static_cast<double>(2), tCK_avg * (WL - 7)));
|
||||||
|
u32 obdlyLow = MAX(WL - FLOOR((126.0 / CEIL(tCK_avg + 8.601))), 0.0);
|
||||||
|
obdly = PACK_U32_NIBBLE_HIGH_BYTE_LOW(obdlyHigh, obdlyLow);
|
||||||
|
|
||||||
|
pdex2rw = CEIL((CEIL(12.335 - tCK_avg) + (7.430 / tCK_avg) - CEIL(tCK_avg * 11.361)));
|
||||||
|
|
||||||
|
tCLKSTOP = FLOOR(MIN(8.488 / tCK_avg, 23.0)) + 8.0;
|
||||||
|
|
||||||
|
u32 tMMRI = tRCD + (tCK_avg * 3);
|
||||||
|
pdex2mrr = tMMRI + 10;
|
||||||
|
|
||||||
|
CalculateMrw2();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+1
@@ -21,3 +21,4 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
void CalculateTimings(double tCK_avg, u32 freq);
|
void CalculateTimings(double tCK_avg, u32 freq);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Lightos_
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../oc_common.hpp"
|
||||||
|
#include "timing_tables.hpp"
|
||||||
|
|
||||||
|
namespace ams::ldr::hoc::pcv::mariko {
|
||||||
|
|
||||||
|
const ReplacePatch g_rext_table[] = {
|
||||||
|
{2'133'000, 0x1A}, {2'166'000, 0x19}, {2'200'000, 0x19},
|
||||||
|
{2'233'000, 0x19}, {2'266'000, 0x1A}, {2'300'000, 0x1B},
|
||||||
|
{2'333'000, 0x1B}, {2'366'000, 0x1B}, {2'400'000, 0x1B},
|
||||||
|
{2'433'000, 0x1B}, {2'466'000, 0x1B}, {2'500'000, 0x1A},
|
||||||
|
{2'533'000, 0x1C}, {2'566'000, 0x1B}, {2'600'000, 0x1B},
|
||||||
|
{2'633'000, 0x1B}, {2'666'000, 0x1B}, {2'700'000, 0x1C},
|
||||||
|
{2'733'000, 0x1C}, {2'766'000, 0x1D}, {2'800'000, 0x1D},
|
||||||
|
{2'833'000, 0x1D}, {2'866'000, 0x1D}, {2'900'000, 0x1D},
|
||||||
|
{2'933'000, 0x1C}, {2'966'000, 0x1D}, {3'000'000, 0x1D},
|
||||||
|
{3'033'000, 0x1D}, {3'066'000, 0x1D}, {3'100'000, 0x1D},
|
||||||
|
{3'133'000, 0x1D}, {3'166'000, 0x1C}, {3'200'000, 0x1C},
|
||||||
|
};
|
||||||
|
|
||||||
|
const u32 g_rext_table_size = sizeof(g_rext_table) / sizeof(g_rext_table[0]);
|
||||||
|
|
||||||
|
const ReplacePatch *FindRext() {
|
||||||
|
for (u32 i = 0; i < g_rext_table_size; i++) {
|
||||||
|
if (g_rext_table[i].freq >= C.marikoEmcMaxClock) {
|
||||||
|
return &g_rext_table[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+6
-9
@@ -15,20 +15,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv {
|
namespace ams::ldr::hoc::pcv::mariko {
|
||||||
|
|
||||||
struct RextPatch {
|
struct ReplacePatch {
|
||||||
u32 freq;
|
u32 freq;
|
||||||
u32 rext;
|
u32 rext;
|
||||||
};
|
};
|
||||||
|
|
||||||
void HandleLatency(u32 freq);
|
extern const ReplacePatch g_rext_table[];
|
||||||
u32 GetRlFrequency();
|
extern const u32 g_rext_table_size;
|
||||||
u32 GetWlFrequency();
|
const ReplacePatch *FindRext();
|
||||||
u32 GetOdtLon();
|
|
||||||
u32 CalculateNWr();
|
|
||||||
u32 CalculateNTRTP();
|
|
||||||
u8 CalculateMrw2();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2023 hanai3Bi
|
* Copyright (c) 2023 hanai3Bi
|
||||||
*
|
*
|
||||||
* Copyright (c) Lightos_
|
* Copyright (c) 2025 Lightos_
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "oc_common.hpp"
|
#include "oc_common.hpp"
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv {
|
namespace ams::ldr::hoc {
|
||||||
#define MAX(A, B) std::max(A, B)
|
#define MAX(A, B) std::max(A, B)
|
||||||
#define MIN(A, B) std::min(A, B)
|
#define MIN(A, B) std::min(A, B)
|
||||||
#define CEIL(A) std::ceil(A)
|
#define CEIL(A) std::ceil(A)
|
||||||
@@ -30,9 +30,6 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
#define PACK_U32(high, low) ((static_cast<u32>(high) << 16) | (static_cast<u32>(low) & 0xFFFF))
|
#define PACK_U32(high, low) ((static_cast<u32>(high) << 16) | (static_cast<u32>(low) & 0xFFFF))
|
||||||
#define PACK_U32_NIBBLE_HIGH_BYTE_LOW(high, low) ((static_cast<u32>(high & 0xF) << 28) | (static_cast<u32>(low) & 0xFF))
|
#define PACK_U32_NIBBLE_HIGH_BYTE_LOW(high, low) ((static_cast<u32>(high & 0xF) << 28) | (static_cast<u32>(low) & 0xFF))
|
||||||
|
|
||||||
#define GET_CYCLE_CEIL(PARAM) u32(CEIL(double(PARAM) / tCK_avg))
|
|
||||||
#define GET_CYCLE_FLOOR(PARAM) u32(FLOOR(double(PARAM) / tCK_avg))
|
|
||||||
|
|
||||||
/* Burst latency, not to be confused with base latency (tWRL). */
|
/* Burst latency, not to be confused with base latency (tWRL). */
|
||||||
const u32 BL = 16;
|
const u32 BL = 16;
|
||||||
|
|
||||||
@@ -41,10 +38,6 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
|
|
||||||
/* DQS output access time from CK_t/CK_c. */
|
/* DQS output access time from CK_t/CK_c. */
|
||||||
const double tDQSCK_max = 3.5;
|
const double tDQSCK_max = 3.5;
|
||||||
|
|
||||||
/* Turn-around time RDQS to WDQS for WDQS control case. */
|
|
||||||
const double tDQSTA = 0.25;
|
|
||||||
|
|
||||||
/* Write preamble. (tCK) */
|
/* Write preamble. (tCK) */
|
||||||
const u32 tWPRE = 2;
|
const u32 tWPRE = 2;
|
||||||
|
|
||||||
@@ -63,24 +56,10 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
/* DQ-to-DQS offset(max) (ns) */
|
/* DQ-to-DQS offset(max) (ns) */
|
||||||
const double tDQS2DQ_max = 0.8;
|
const double tDQS2DQ_max = 0.8;
|
||||||
|
|
||||||
/* Internal READ to PRECHARGE command delay */
|
|
||||||
const double tRTP = 7.5;
|
|
||||||
|
|
||||||
/* Write recovery time. */
|
/* Write recovery time. */
|
||||||
const u32 tWR = 18;
|
const u32 tWR = 18;
|
||||||
|
|
||||||
/* Write-to-Read delay. */
|
namespace pcv::erista {
|
||||||
const u32 tWTRStock = 10;
|
|
||||||
|
|
||||||
/* Round trace routing delay(?) Guessed based on tK1 (ns) */
|
|
||||||
const double roundTripDelay = 0.5;
|
|
||||||
|
|
||||||
const double tODTon = 1.5;
|
|
||||||
|
|
||||||
inline u32 RL;
|
|
||||||
inline u32 WL;
|
|
||||||
|
|
||||||
namespace erista {
|
|
||||||
const std::array<u32, 8> tRCD_values = { 18, 17, 16, 15, 14, 13, 12, 11 };
|
const std::array<u32, 8> tRCD_values = { 18, 17, 16, 15, 14, 13, 12, 11 };
|
||||||
const std::array<u32, 8> tRP_values = { 18, 17, 16, 15, 14, 13, 12, 11 };
|
const std::array<u32, 8> tRP_values = { 18, 17, 16, 15, 14, 13, 12, 11 };
|
||||||
const std::array<u32, 10> tRAS_values = { 42, 36, 34, 32, 30, 28, 26, 24, 22, 20 };
|
const std::array<u32, 10> tRAS_values = { 42, 36, 34, 32, 30, 28, 26, 24, 22, 20 };
|
||||||
@@ -104,20 +83,13 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
const u32 tFAW = static_cast<u32>(tRRD * 4.0);
|
const u32 tFAW = static_cast<u32>(tRRD * 4.0);
|
||||||
const double tRPab = tRPpb + 3;
|
const double tRPab = tRPpb + 3;
|
||||||
|
|
||||||
|
inline u32 RL;
|
||||||
|
inline u32 WL;
|
||||||
|
|
||||||
inline u32 tR2P;
|
inline u32 tR2P;
|
||||||
inline u32 tR2W;
|
inline u32 tR2W;
|
||||||
inline u32 rext;
|
inline u32 rext;
|
||||||
|
|
||||||
inline u32 rdv;
|
|
||||||
inline u32 qpop;
|
|
||||||
inline u32 quse_width;
|
|
||||||
inline u32 quse;
|
|
||||||
inline u32 einput_duration;
|
|
||||||
inline u32 einput;
|
|
||||||
inline u32 qrst;
|
|
||||||
inline u32 ibdly;
|
|
||||||
inline u32 qsafe;
|
|
||||||
|
|
||||||
inline u32 tW2P;
|
inline u32 tW2P;
|
||||||
inline u32 tWTPDEN;
|
inline u32 tWTPDEN;
|
||||||
inline u32 tW2R;
|
inline u32 tW2R;
|
||||||
@@ -135,17 +107,9 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
inline double pdex2mrr;
|
inline double pdex2mrr;
|
||||||
|
|
||||||
inline u8 mrw2;
|
inline u8 mrw2;
|
||||||
|
|
||||||
namespace {
|
|
||||||
/* Delay of entering soc? Guessed based on tK1. (ns) */
|
|
||||||
double chipDelay = 1.655;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Soc->dram->soc delay(?) */
|
namespace pcv::mariko {
|
||||||
const double flyByTime = chipDelay + roundTripDelay;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace mariko {
|
|
||||||
const std::array<u32, 8> tRCD_values = { 18, 17, 16, 15, 14, 13, 12, 11 };
|
const std::array<u32, 8> tRCD_values = { 18, 17, 16, 15, 14, 13, 12, 11 };
|
||||||
const std::array<u32, 8> tRP_values = { 18, 17, 16, 15, 14, 13, 12, 11 };
|
const std::array<u32, 8> tRP_values = { 18, 17, 16, 15, 14, 13, 12, 11 };
|
||||||
const std::array<u32, 10> tRAS_values = { 42, 36, 34, 32, 30, 28, 26, 24, 22, 20 };
|
const std::array<u32, 10> tRAS_values = { 42, 36, 34, 32, 30, 28, 26, 24, 22, 20 };
|
||||||
@@ -168,6 +132,9 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
|
|
||||||
inline u32 refresh_raw;
|
inline u32 refresh_raw;
|
||||||
|
|
||||||
|
inline u32 RL;
|
||||||
|
inline u32 WL;
|
||||||
|
|
||||||
inline u32 tR2P;
|
inline u32 tR2P;
|
||||||
inline u32 tR2W;
|
inline u32 tR2W;
|
||||||
inline u32 tRTM;
|
inline u32 tRTM;
|
||||||
@@ -200,17 +167,9 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
|
|
||||||
inline u32 tCLKSTOP;
|
inline u32 tCLKSTOP;
|
||||||
|
|
||||||
inline double pdex2mrr;
|
inline u32 pdex2mrr;
|
||||||
|
|
||||||
inline u8 mrw2;
|
inline u8 mrw2;
|
||||||
|
|
||||||
namespace {
|
|
||||||
/* Delay of entering soc? Guessed based on tK1. (ns) */
|
|
||||||
const double chipDelay = 1.109;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Soc->dram->soc delay(?) */
|
|
||||||
const double flyByTime = chipDelay + roundTripDelay;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,102 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Souldbminer, Lightos and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nvsrv.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::nvsrv {
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
/* NvServices device names */
|
|
||||||
constexpr char DbgGpuPath[] = "/dev/nvhost-dbg-gpu";
|
|
||||||
constexpr char ProfGpuPath[] = "/dev/nvhost-prof-gpu";
|
|
||||||
|
|
||||||
/* Permission offset to patch */
|
|
||||||
constexpr size_t DevTablePermOffset = 0x68;
|
|
||||||
|
|
||||||
uintptr_t FindBytes(uintptr_t start, uintptr_t end, const void *needle, size_t len) {
|
|
||||||
const u8 *pat = reinterpret_cast<const u8 *>(needle);
|
|
||||||
for (uintptr_t addr = start; addr + len <= end; ++addr) {
|
|
||||||
if (std::memcmp(reinterpret_cast<const void *>(addr), pat, len) == 0) {
|
|
||||||
return addr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Unlock the devices */
|
|
||||||
Result UnlockDevicePermission(uintptr_t mapped_nso, size_t nso_size, uintptr_t nso_address, const char *path, [[maybe_unused]] const char *description) {
|
|
||||||
const size_t path_len = std::strlen(path) + 1;
|
|
||||||
|
|
||||||
const uintptr_t str_addr = FindBytes(mapped_nso, mapped_nso + nso_size, path, path_len);
|
|
||||||
if (str_addr == 0) {
|
|
||||||
LOGGING("nvsrv: %s path string not found (nso_size=%lx)", description, static_cast<unsigned long>(nso_size));
|
|
||||||
R_THROW(ldr::ResultInvalidNvsrvDevTable());
|
|
||||||
}
|
|
||||||
|
|
||||||
const uintptr_t str_offset = str_addr - mapped_nso;
|
|
||||||
const uintptr_t candidates[] = { str_offset, nso_address + str_offset };
|
|
||||||
|
|
||||||
uintptr_t entry_addr = 0;
|
|
||||||
for (uintptr_t ptr = mapped_nso; entry_addr == 0 && ptr + sizeof(uintptr_t) <= mapped_nso + nso_size; ptr += sizeof(uintptr_t)) {
|
|
||||||
const uintptr_t val = *reinterpret_cast<const uintptr_t *>(ptr);
|
|
||||||
for (uintptr_t cand : candidates) {
|
|
||||||
if (val == cand) {
|
|
||||||
entry_addr = ptr;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (entry_addr == 0) {
|
|
||||||
LOGGING("nvsrv: %s str@+%lx has no referencing table entry", description,
|
|
||||||
static_cast<unsigned long>(str_offset));
|
|
||||||
R_THROW(ldr::ResultInvalidNvsrvDevTable());
|
|
||||||
}
|
|
||||||
|
|
||||||
const uintptr_t perm_addr = entry_addr + DevTablePermOffset;
|
|
||||||
if (perm_addr + sizeof(uintptr_t) > mapped_nso + nso_size) {
|
|
||||||
LOGGING("nvsrv: %s entry@+%lx perm field out of bounds", description, static_cast<unsigned long>(entry_addr - mapped_nso));
|
|
||||||
R_THROW(ldr::ResultInvalidNvsrvDevTable());
|
|
||||||
}
|
|
||||||
|
|
||||||
uintptr_t *perm = reinterpret_cast<uintptr_t *>(perm_addr);
|
|
||||||
LOGGING("nvsrv: %s entry@+%lx perm@+%lx was %lx", description,
|
|
||||||
static_cast<unsigned long>(entry_addr - mapped_nso),
|
|
||||||
static_cast<unsigned long>(perm_addr - mapped_nso),
|
|
||||||
static_cast<unsigned long>(*perm));
|
|
||||||
|
|
||||||
PATCH_OFFSET(perm, static_cast<uintptr_t>(0));
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Patch(uintptr_t mapped_nso, size_t nso_size, uintptr_t nso_address) {
|
|
||||||
struct {
|
|
||||||
const char *path;
|
|
||||||
const char *description;
|
|
||||||
} targets[] = {
|
|
||||||
{ DbgGpuPath, "dbg-gpu" },
|
|
||||||
{ ProfGpuPath, "prof-gpu" },
|
|
||||||
};
|
|
||||||
|
|
||||||
for (auto &t : targets) {
|
|
||||||
[[maybe_unused]] const Result res = UnlockDevicePermission(mapped_nso, nso_size, nso_address, t.path, t.description);
|
|
||||||
LOGGING("nvsrv: %s unlock%s", t.description, R_SUCCEEDED(res) ? "ed" : " skipped");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "../oc_common.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::nvsrv {
|
|
||||||
void Patch(uintptr_t mapped_nso, size_t nso_size, uintptr_t nso_address);
|
|
||||||
}
|
|
||||||
@@ -20,41 +20,12 @@
|
|||||||
|
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
#include <vapours/results/results_common.hpp>
|
#include <vapours/results/results_common.hpp>
|
||||||
|
#define LOGGING(fmt, ...) ((void)0)
|
||||||
|
#define CRASH(msg, ...) { ams::diag::AbortImpl(msg, __PRETTY_FUNCTION__, "", 0); __builtin_unreachable(); }
|
||||||
#ifndef HOC_UART_LOG
|
|
||||||
#define HOC_UART_LOG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HOC_UART_LOG && !(defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING))
|
|
||||||
#undef HOC_UART_LOG
|
|
||||||
#define HOC_UART_LOG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "customize.hpp"
|
#include "customize.hpp"
|
||||||
#include "oc_log.hpp"
|
#include "oc_log.hpp"
|
||||||
|
|
||||||
#define HOC_IRAM_LOG 0
|
|
||||||
|
|
||||||
#if (!HOC_UART_LOG) && (defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING))
|
|
||||||
#undef HOC_IRAM_LOG
|
|
||||||
#define HOC_IRAM_LOG 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
|
|
||||||
|
|
||||||
#if HOC_IRAM_LOG
|
|
||||||
#define LOGGING(...) Log(__VA_ARGS__)
|
|
||||||
#elif HOC_UART_LOG
|
|
||||||
#define LOGGING(fmt, ...) AMS_LOG(fmt "\n", ##__VA_ARGS__)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
#define LOGGING(...) ((void)0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CRASH(msg, ...) { ams::diag::AbortImpl(msg, __PRETTY_FUNCTION__, "", 0); __builtin_unreachable(); }
|
|
||||||
|
|
||||||
#define PATCH_OFFSET(offset, value) \
|
#define PATCH_OFFSET(offset, value) \
|
||||||
static_assert(sizeof(__typeof__(offset)) <= sizeof(u64)); \
|
static_assert(sizeof(__typeof__(offset)) <= sizeof(u64)); \
|
||||||
*(offset) = value;
|
*(offset) = value;
|
||||||
@@ -79,26 +50,13 @@ namespace ams::ldr {
|
|||||||
R_DEFINE_ERROR_RESULT(InvalidMtcTablePattern, 1016);
|
R_DEFINE_ERROR_RESULT(InvalidMtcTablePattern, 1016);
|
||||||
R_DEFINE_ERROR_RESULT(InvalidSocVoltPattern, 1017);
|
R_DEFINE_ERROR_RESULT(InvalidSocVoltPattern, 1017);
|
||||||
R_DEFINE_ERROR_RESULT(InvalidSocVoltLimit, 1018);
|
R_DEFINE_ERROR_RESULT(InvalidSocVoltLimit, 1018);
|
||||||
R_DEFINE_ERROR_RESULT(InvalidEmcDvfsCount, 1019);
|
R_DEFINE_ERROR_RESULT(HookArenaOutOfMemory, 1019);
|
||||||
R_DEFINE_ERROR_RESULT(InvalidEmcSocLut, 1020);
|
R_DEFINE_ERROR_RESULT(HookPayloadTooLarge, 1020);
|
||||||
R_DEFINE_ERROR_RESULT(InvalidEmcRateList, 1021);
|
R_DEFINE_ERROR_RESULT(HookRelocationUnsupported, 1021);
|
||||||
R_DEFINE_ERROR_RESULT(InvalidNvLogRedirect, 1022);
|
R_DEFINE_ERROR_RESULT(HookSiteInvalid, 1022);
|
||||||
R_DEFINE_ERROR_RESULT(InvalidBusFreqReloc, 1023);
|
R_DEFINE_ERROR_RESULT(HookPayloadEscapes, 1023);
|
||||||
R_DEFINE_ERROR_RESULT(HookArenaOutOfMemory, 1024);
|
R_DEFINE_ERROR_RESULT(HookDataOutOfMemory, 1024);
|
||||||
R_DEFINE_ERROR_RESULT(HookPayloadTooLarge, 1025);
|
R_DEFINE_ERROR_RESULT(HookUnavailable, 1025);
|
||||||
R_DEFINE_ERROR_RESULT(HookRelocationUnsupported, 1026);
|
|
||||||
R_DEFINE_ERROR_RESULT(HookSiteInvalid, 1027);
|
|
||||||
R_DEFINE_ERROR_RESULT(HookPayloadEscapes, 1028);
|
|
||||||
R_DEFINE_ERROR_RESULT(HookDataOutOfMemory, 1029);
|
|
||||||
R_DEFINE_ERROR_RESULT(HookUnavailable, 1030);
|
|
||||||
R_DEFINE_ERROR_RESULT(InvalidNvsrvDevTable, 1031);
|
|
||||||
R_DEFINE_ERROR_RESULT(InvalidForceVerbosityPattern, 1032);
|
|
||||||
R_DEFINE_ERROR_RESULT(InvalidCpuLutMaxAsmPattern, 1033);
|
|
||||||
R_DEFINE_ERROR_RESULT(InvalidCpuLutHook, 1034);
|
|
||||||
R_DEFINE_ERROR_RESULT(InvalidDvcoRateConfig, 1035);
|
|
||||||
R_DEFINE_ERROR_RESULT(InvalidVoltCode, 1036);
|
|
||||||
R_DEFINE_ERROR_RESULT(InvalidVoltLutIndex, 1037);
|
|
||||||
R_DEFINE_ERROR_RESULT(InvalidHookCave, 1038);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ams::ldr::hoc {
|
namespace ams::ldr::hoc {
|
||||||
@@ -113,7 +71,6 @@ namespace ams::ldr::hoc {
|
|||||||
patternFn pattern_search_fn = nullptr;
|
patternFn pattern_search_fn = nullptr;
|
||||||
Pointer value_search;
|
Pointer value_search;
|
||||||
size_t patched_count = 0;
|
size_t patched_count = 0;
|
||||||
bool optional = false;
|
|
||||||
|
|
||||||
Result Apply(Pointer *ptr) {
|
Result Apply(Pointer *ptr) {
|
||||||
Result res = patcher_fn(ptr);
|
Result res = patcher_fn(ptr);
|
||||||
@@ -144,7 +101,7 @@ namespace ams::ldr::hoc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result CheckResult() {
|
Result CheckResult() {
|
||||||
R_UNLESS(optional || patched_count > 0, ldr::ResultUnsuccessfulPatcher());
|
R_UNLESS(patched_count > 0, ldr::ResultUnsuccessfulPatcher());
|
||||||
|
|
||||||
if (maximum_patched_count) {
|
if (maximum_patched_count) {
|
||||||
R_UNLESS(patched_count <= maximum_patched_count, ldr::ResultUnsuccessfulPatcher());
|
R_UNLESS(patched_count <= maximum_patched_count, ldr::ResultUnsuccessfulPatcher());
|
||||||
|
|||||||
@@ -21,4 +21,3 @@
|
|||||||
#include "oc_common.hpp"
|
#include "oc_common.hpp"
|
||||||
#include "pcv/pcv.hpp"
|
#include "pcv/pcv.hpp"
|
||||||
#include "ptm/ptm.hpp"
|
#include "ptm/ptm.hpp"
|
||||||
#include "nvsrv/nvsrv.hpp"
|
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "oc_common.hpp"
|
#include "oc_common.hpp"
|
||||||
|
|
||||||
#if HOC_IRAM_LOG
|
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
|
||||||
#include "fatal_handler_bin.h"
|
#include "fatal_handler_bin.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -70,32 +70,6 @@ namespace ams::ldr::hoc {
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HOC_UART_LOG
|
|
||||||
/* Remove this? */
|
|
||||||
void UartLog(const char *fmt, ...) {
|
|
||||||
char line[256];
|
|
||||||
constexpr size_t PrefixLen = 13; /* "[HOC] " */
|
|
||||||
std::memcpy(line, "[Horizon OC] ", PrefixLen);
|
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start(args, fmt);
|
|
||||||
int n = vsnprintf(line + PrefixLen, sizeof(line) - PrefixLen - 1, fmt, args);
|
|
||||||
va_end(args);
|
|
||||||
if (n < 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t body = static_cast<size_t>(n);
|
|
||||||
if (body > sizeof(line) - PrefixLen - 2) { /* vsnprintf returns the untruncated length */
|
|
||||||
body = sizeof(line) - PrefixLen - 2;
|
|
||||||
}
|
|
||||||
size_t len = PrefixLen + body;
|
|
||||||
line[len++] = '\n';
|
|
||||||
|
|
||||||
svc::OutputDebugString(line, len);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct log_ctx_t {
|
struct log_ctx_t {
|
||||||
u32 magic;
|
u32 magic;
|
||||||
u32 sz;
|
u32 sz;
|
||||||
@@ -107,7 +81,7 @@ namespace ams::ldr::hoc {
|
|||||||
#define IRAM_LOG_CTX_ADDR 0x4003C000
|
#define IRAM_LOG_CTX_ADDR 0x4003C000
|
||||||
#define IRAM_LOG_MAX_SZ 4096
|
#define IRAM_LOG_MAX_SZ 4096
|
||||||
|
|
||||||
#if HOC_IRAM_LOG
|
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
|
||||||
void Log(const char *data, ...) {
|
void Log(const char *data, ...) {
|
||||||
static const u32 max_log_sz = sizeof(working_buf) - sizeof(log_ctx_t);
|
static const u32 max_log_sz = sizeof(working_buf) - sizeof(log_ctx_t);
|
||||||
static bool initDone = false;
|
static bool initDone = false;
|
||||||
@@ -138,8 +112,8 @@ namespace ams::ldr::hoc {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
|
||||||
void ViewLog() {
|
void ViewLog() {
|
||||||
#if HOC_IRAM_LOG
|
|
||||||
if (spl::GetSocType() == spl::SocType_Mariko) {
|
if (spl::GetSocType() == spl::SocType_Mariko) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -153,65 +127,6 @@ namespace ams::ldr::hoc {
|
|||||||
SmcRebootToIramPayload();
|
SmcRebootToIramPayload();
|
||||||
|
|
||||||
while(true) { }
|
while(true) { }
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
constexpr size_t SdLogBufferSize = 0x1000;
|
|
||||||
char sdLogBuffer[SdLogBufferSize];
|
|
||||||
size_t workingLength = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SdLog(const char *data, ...) {
|
|
||||||
if (workingLength >= SdLogBufferSize - 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start(args, data);
|
|
||||||
s32 res = vsnprintf(sdLogBuffer + workingLength, SdLogBufferSize - workingLength, data, args);
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
if (res < 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
workingLength = std::min(workingLength + static_cast<size_t>(res), SdLogBufferSize - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SaveLog() {
|
|
||||||
static bool saved = false;
|
|
||||||
if (workingLength == 0 || saved) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cfg::IsSdCardInitialized()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (R_FAILED(fs::MountSdCard("sdmc"))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ON_SCOPE_EXIT { fs::Unmount("sdmc"); };
|
|
||||||
|
|
||||||
constexpr const char *Path = "sdmc:/config/horizon-oc/ldr_log.txt";
|
|
||||||
|
|
||||||
R_DISCARD(fs::DeleteFile(Path));
|
|
||||||
if (R_FAILED(fs::CreateFile(Path, workingLength))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs::FileHandle file;
|
|
||||||
if (R_FAILED(fs::OpenFile(std::addressof(file), Path, fs::OpenMode_Write))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ON_SCOPE_EXIT { fs::CloseFile(file); };
|
|
||||||
|
|
||||||
if (R_FAILED(fs::WriteFile(file, 0, sdLogBuffer, workingLength, fs::WriteOption::Flush))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
saved = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -23,12 +23,6 @@ namespace ams::ldr::hoc {
|
|||||||
|
|
||||||
Result SmcCopyToIram(uintptr_t dest, const void *src, u32 size);
|
Result SmcCopyToIram(uintptr_t dest, const void *src, u32 size);
|
||||||
void Log(const char *data, ...);
|
void Log(const char *data, ...);
|
||||||
void SdLog(const char *data, ...);
|
|
||||||
void SaveLog();
|
|
||||||
void ViewLog();
|
void ViewLog();
|
||||||
|
|
||||||
/* Emit a formatted line over the kernel debug UART via svcOutputDebugString.
|
|
||||||
No-op unless the running kernel enables debug logging (audit/debug mesosphere). */
|
|
||||||
void UartLog(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
-185
@@ -1,185 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Lightos_
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../../oc_common.hpp"
|
|
||||||
#include "../../mtc_timing_value.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv {
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
void SwitchLatency(volatile u32 &latency, u32 index, u32 latencyStep) {
|
|
||||||
latency += index * latencyStep;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AutoLatency(volatile u32 &latency, u32 freq, u32 latencyStep) {
|
|
||||||
if (freq > 1600'000 && freq <= 1866'000) { /* 1866tRWL */
|
|
||||||
latency += latencyStep * 2;
|
|
||||||
} else { /* 2133tRWL */
|
|
||||||
latency += latencyStep * 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static s32 GetMaxLatencyIndex(volatile u32 *latencyArray, u32 latencySize) {
|
|
||||||
s32 maxIndex = -1;
|
|
||||||
for (u32 i = 0; i < latencySize; ++i) {
|
|
||||||
if (latencyArray[i]) {
|
|
||||||
maxIndex = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return maxIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleLatency(u32 freq, volatile u32 &latency, volatile u32 *latencyArray, u32 indexMax, u32 latencyStep) {
|
|
||||||
for (u32 i = 0; i <= indexMax; ++i) {
|
|
||||||
if (latencyArray[i] != 0 && freq <= latencyArray[i]) {
|
|
||||||
SwitchLatency(latency, i, latencyStep);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SwitchLatency(latency, indexMax, latencyStep);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 RoundUpToEven(u32 value) {
|
|
||||||
return value + (value % 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
double GetTckAvg(u32 khz) {
|
|
||||||
return 1000'000.0 / static_cast<double>(khz);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HandleLatency(u32 freq) {
|
|
||||||
static s32 rlIndexMax = GetMaxLatencyIndex(C.readLatency, std::size(C.readLatency));
|
|
||||||
static s32 wlIndexMax = GetMaxLatencyIndex(C.writeLatency, std::size(C.writeLatency));
|
|
||||||
constexpr u32 ReadLatencyStep = 4;
|
|
||||||
constexpr u32 WriteLatencyStep = 2;
|
|
||||||
bool autoLatencyRead = false, autoLatencyWrite = false;
|
|
||||||
|
|
||||||
if (rlIndexMax == -1) {
|
|
||||||
AutoLatency(RL, freq, ReadLatencyStep);
|
|
||||||
autoLatencyRead = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wlIndexMax == -1) {
|
|
||||||
AutoLatency(WL, freq, WriteLatencyStep);
|
|
||||||
autoLatencyWrite = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (autoLatencyRead && autoLatencyWrite) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!autoLatencyRead) {
|
|
||||||
HandleLatency(freq, RL, C.readLatency, rlIndexMax, ReadLatencyStep);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!autoLatencyWrite) {
|
|
||||||
HandleLatency(freq, WL, C.writeLatency, wlIndexMax, WriteLatencyStep);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 GetRlFrequency() {
|
|
||||||
switch (RL) {
|
|
||||||
case RL_1333:
|
|
||||||
return 1333'000;
|
|
||||||
case RL_1600:
|
|
||||||
return 1600'000;
|
|
||||||
case RL_1866:
|
|
||||||
return 1866'000;
|
|
||||||
case RL_2133:
|
|
||||||
return 2133'000;
|
|
||||||
default:
|
|
||||||
return 2133'000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 GetWlFrequency() {
|
|
||||||
switch (WL) {
|
|
||||||
case WL_1333:
|
|
||||||
return 1333'000;
|
|
||||||
case WL_1600:
|
|
||||||
return 1600'000;
|
|
||||||
case WL_1866:
|
|
||||||
return 1866'000;
|
|
||||||
case WL_2133:
|
|
||||||
return 2133'000;
|
|
||||||
default:
|
|
||||||
return 2133'000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 GetOdtLon() {
|
|
||||||
/* Set A. */
|
|
||||||
switch (WL) {
|
|
||||||
case WL_1333:
|
|
||||||
return 4;
|
|
||||||
case WL_1600:
|
|
||||||
case WL_1866:
|
|
||||||
return 6;
|
|
||||||
case WL_2133:
|
|
||||||
return 8;
|
|
||||||
default:
|
|
||||||
return 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 CalculateNWr() {
|
|
||||||
const u32 latencyFrequency = GetWlFrequency();
|
|
||||||
const double tCK = GetTckAvg(latencyFrequency);
|
|
||||||
const u32 nWr = CEIL(tWR / tCK);
|
|
||||||
|
|
||||||
return RoundUpToEven(nWr);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 CalculateNTRTP() {
|
|
||||||
const u32 latencyFrequency = GetRlFrequency();
|
|
||||||
const double tCK = GetTckAvg(latencyFrequency);
|
|
||||||
|
|
||||||
return CEIL(tRTP / tCK);
|
|
||||||
}
|
|
||||||
|
|
||||||
u8 CalculateMrw2() {
|
|
||||||
static const u8 rlMapDBI[8] = {
|
|
||||||
6, 12, 16, 22, 28, 32, 36, 40
|
|
||||||
};
|
|
||||||
|
|
||||||
static const u8 wlMapSetA[8] = {
|
|
||||||
4, 6, 8, 10, 12, 14, 16, 18
|
|
||||||
};
|
|
||||||
|
|
||||||
u32 rlIndex = 0;
|
|
||||||
u32 wlIndex = 0;
|
|
||||||
|
|
||||||
for (u32 i = 0; i < std::size(rlMapDBI); ++i) {
|
|
||||||
if (rlMapDBI[i] == RL) {
|
|
||||||
rlIndex = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (u32 i = 0; i < std::size(wlMapSetA); ++i) {
|
|
||||||
if (wlMapSetA[i] == WL) {
|
|
||||||
wlIndex = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DBI is always enabled. */
|
|
||||||
return static_cast<u8>(((rlIndex & 0x7) | ((wlIndex & 0x7) << 3) | ((0 & 0x1) << 6)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-186
@@ -1,186 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Lightos_
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../../mtc_timing_value.hpp"
|
|
||||||
#include "../common/calculate_timings_common.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::erista {
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
/* Dumped from bpmp fw mtc table (l4t). */
|
|
||||||
const RextPatch gRextTable[] = {
|
|
||||||
{1'633'000, 0x17}, {1'728'000, 0x17}, {1'795'200, 0x19},
|
|
||||||
{1'862'400, 0x1A}, {1'894'400, 0x1A}, {1'932'800, 0x1A},
|
|
||||||
{1'958'400, 0x1A}, {1'996'800, 0x1A}, {2'035'200, 0x1A},
|
|
||||||
{2'064'000, 0x19}, {2'099'200, 0x19}, {2'131'200, 0x1A},
|
|
||||||
{2'163'200, 0x1A}, {2'188'800, 0x1A}, {2'227'200, 0x1A},
|
|
||||||
{2'265'600, 0x1B}, {2'291'200, 0x1B}, {2'329'600, 0x1A},
|
|
||||||
{2'361'600, 0x1A},
|
|
||||||
};
|
|
||||||
|
|
||||||
const RextPatch *LookupRext(u32 freq) {
|
|
||||||
for (u32 i = 0; i < std::size(gRextTable); i++) {
|
|
||||||
if (gRextTable[i].freq >= freq) {
|
|
||||||
return &gRextTable[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GetRext(u32 freq) {
|
|
||||||
if (auto r = LookupRext(freq)) {
|
|
||||||
rext = r->rext;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fallback */
|
|
||||||
rext = 0x1A;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CalculateReadTimings(u32 freq, double tCK_avg) {
|
|
||||||
tR2P = CalculateNTRTP();
|
|
||||||
|
|
||||||
double fullRoundDelay = flyByTime + tDQSCK_max;
|
|
||||||
|
|
||||||
/* Read to write turnaround. */
|
|
||||||
/* Switch seemingly uses odt. */
|
|
||||||
tR2W = RL + (BL / 2) + CEIL((fullRoundDelay / tCK_avg) + tDQSTA) - GET_CYCLE_FLOOR(tODTon) - GetOdtLon() + tWPRE - (C.t6_tRTW * 3) + finetRTW;
|
|
||||||
|
|
||||||
/* Read data valid: Read command -> data ready to be latched into the registers. */
|
|
||||||
rdv = RL + GET_CYCLE_CEIL(fullRoundDelay) + 18;
|
|
||||||
|
|
||||||
/* Read command -> data poppable at the pad macros, 16 cycles ahead of rdv. */
|
|
||||||
qpop = rdv - 16;
|
|
||||||
|
|
||||||
constexpr double TrimmerStepPs = 3.0;
|
|
||||||
constexpr double MaxTrimmerSteps = 95.0;
|
|
||||||
|
|
||||||
double tCkAvgPs = tCK_avg * 1000.0;
|
|
||||||
double tckDerated = tCkAvgPs * 0.85;
|
|
||||||
u32 derateStepCount = MIN(FLOOR(tckDerated / TrimmerStepPs), MaxTrimmerSteps);
|
|
||||||
double deratedNsDelay = (derateStepCount * TrimmerStepPs) / 1000.0;
|
|
||||||
|
|
||||||
/* readEyeEndDerated, nv call this quseExtra. */
|
|
||||||
u32 quseExtra = GET_CYCLE_CEIL(fullRoundDelay - deratedNsDelay);
|
|
||||||
|
|
||||||
/* The amount of deration from the perspective of a full round trip. */
|
|
||||||
u32 readEyeEndDerateMargin = GET_CYCLE_CEIL(fullRoundDelay) - quseExtra;
|
|
||||||
|
|
||||||
u32 tQuse = FLOOR((flyByTime + 0.94) / tCK_avg);
|
|
||||||
u32 readEyeStart = tQuse + RL + 1;
|
|
||||||
|
|
||||||
u32 einputMinimal = readEyeStart + readEyeEndDerateMargin - 2;
|
|
||||||
|
|
||||||
/* Data valid window, quse aligns with the start of the read eye (probably). */
|
|
||||||
/* DQS needs to be logically and'ed with quse in order to be valid. */
|
|
||||||
/* einputMinimal satisfies this. */
|
|
||||||
quse = einputMinimal;
|
|
||||||
|
|
||||||
/* Difference between the two eye edges. */
|
|
||||||
quse_width = quseExtra - tQuse + 4;
|
|
||||||
|
|
||||||
/* input receiver takes time to enable. */
|
|
||||||
u32 einputLatency = GET_CYCLE_CEIL(10.0);
|
|
||||||
|
|
||||||
/* Enable input receiver. */
|
|
||||||
einput = einputMinimal - einputLatency;
|
|
||||||
|
|
||||||
/* Duration of input receiver being enabled? */
|
|
||||||
einput_duration = einputLatency + quse_width + 4;
|
|
||||||
|
|
||||||
/* qrst_duration is CEIL(a / tCK_avg + b) */
|
|
||||||
/* a and b were derived through a brute forcer. */
|
|
||||||
u32 qrst_duration = CEIL(1.4 / tCK_avg + 3.5);
|
|
||||||
u32 qrstLow = MAX(static_cast<s32>(einput - qrst_duration - 2), static_cast<s32>(0));
|
|
||||||
|
|
||||||
/* quse reset? */
|
|
||||||
qrst = PACK_U32(qrst_duration, qrstLow);
|
|
||||||
|
|
||||||
/* Qsafe, safe to reset quse? */
|
|
||||||
qsafe = (einput_duration + 3) + MAX(MIN(qrstLow * rdv, qrst_duration + qrst_duration), einput);
|
|
||||||
|
|
||||||
/* Input buffer delay? */
|
|
||||||
ibdly = PACK_U32_NIBBLE_HIGH_BYTE_LOW(1, quse - qrst_duration - 2.0);
|
|
||||||
|
|
||||||
GetRext(freq);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CalculateWriteTimings(double tCK_avg) {
|
|
||||||
/* Write to read turnaround. */
|
|
||||||
/* According to jedec specifications: nWR >= tWTR + nRTP */
|
|
||||||
/* Therefore tWTR >= nWR - tRTP. */
|
|
||||||
const u32 nTWTR = GET_CYCLE_CEIL(tWTRStock);
|
|
||||||
const u32 nWr = CalculateNWr();
|
|
||||||
u32 autoPrecharcetWTRMin = nWr - tR2P;
|
|
||||||
|
|
||||||
/* tWTR reduction is applied in a weird way to not break existing setups. */
|
|
||||||
tW2R = WL + 1 + MAX(autoPrecharcetWTRMin, nTWTR) - GET_CYCLE_CEIL(tWTR) + finetWTR;
|
|
||||||
tW2P = (CEIL(WL * 1.7303) * 2) - 5;
|
|
||||||
tWTPDEN = CEIL(((1.8 / tCK_avg) + MAX(RL + (2.7 / tCK_avg), static_cast<double>(tW2P))) + (BL / 2));
|
|
||||||
|
|
||||||
wdv = WL;
|
|
||||||
wsv = WL - 2;
|
|
||||||
wev = WL - 4;
|
|
||||||
|
|
||||||
/* Output buffer delay? */
|
|
||||||
u32 obdlyHigh = 3 / FLOOR(MIN(static_cast<double>(2), tCK_avg * (WL - 7)));
|
|
||||||
u32 obdlyLow = MAX(WL - FLOOR((126.0 / CEIL(tCK_avg + 8.601))), 0.0);
|
|
||||||
obdly = PACK_U32_NIBBLE_HIGH_BYTE_LOW(obdlyHigh, obdlyLow);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CalculatePowerDownTimings(double tCK_avg) {
|
|
||||||
pdex2rw = CEIL((CEIL(12.335 - tCK_avg) + (7.430 / tCK_avg) - CEIL(tCK_avg * 11.361)));
|
|
||||||
tCLKSTOP = FLOOR(MIN(8.488 / tCK_avg, 23.0)) + 8.0;
|
|
||||||
|
|
||||||
const double tMMRI = tRCD + (tCK_avg * 3);
|
|
||||||
pdex2mrr = tMMRI + 10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
u8 GetNWrIndex() {
|
|
||||||
static const u8 nWrMap[8] = {
|
|
||||||
6, 10, 16, 20, 24, 30, 34, 40
|
|
||||||
};
|
|
||||||
|
|
||||||
const u32 nWr = CalculateNWr();
|
|
||||||
|
|
||||||
for (u8 i = 0; i < std::size(nWrMap); ++i) {
|
|
||||||
if (nWrMap[i] >= nWr) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return static_cast<u8>(std::size(nWrMap) - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CalculateTimings(double tCK_avg, u32 freq) {
|
|
||||||
RL = RL_1333;
|
|
||||||
WL = WL_1333;
|
|
||||||
|
|
||||||
/* I don't understand why, I don't want to know why, but for some fucking reason erista doesn't handle RL 40. */
|
|
||||||
/* This should not be required but for these fuck damn reasons any type of dram oc will crash instantly with RL 40. */
|
|
||||||
/* But it works fine in l4t? Even when copying the tables it still doesn't work??? WTF */
|
|
||||||
C.readLatency[std::size(C.readLatency) - 1] = 0;
|
|
||||||
HandleLatency(freq);
|
|
||||||
RL = std::min(static_cast<u32>(RL_1866), RL);
|
|
||||||
|
|
||||||
CalculateReadTimings(freq, tCK_avg);
|
|
||||||
CalculateWriteTimings(tCK_avg);
|
|
||||||
CalculatePowerDownTimings(tCK_avg);
|
|
||||||
mrw2 = CalculateMrw2();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Switch-OC-Suite
|
|
||||||
*
|
|
||||||
* Copyright (c) 2023 hanai3Bi
|
|
||||||
*
|
|
||||||
* Copyright (c) B3711
|
|
||||||
*
|
|
||||||
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../pcv.hpp"
|
|
||||||
#include "../../mtc_timing_value.hpp"
|
|
||||||
#include "pcv_erista_cpu.hpp"
|
|
||||||
#include "pcv_erista_gpu.hpp"
|
|
||||||
#include "pcv_erista_mtc.hpp"
|
|
||||||
#include "calculate_timings_erista.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::erista {
|
|
||||||
|
|
||||||
DEFINE_HOOK_PAYLOAD_PTR(HookPayloadData, e_HookPayloadData);
|
|
||||||
|
|
||||||
u32 *nsoStart;
|
|
||||||
|
|
||||||
Result InstallHooks() {
|
|
||||||
R_TRY(Hooks().CheckEnabled());
|
|
||||||
|
|
||||||
R_TRY(Hooks().CopyPayload());
|
|
||||||
|
|
||||||
auto *data = Hooks().BindData(e_HookPayloadData);
|
|
||||||
R_UNLESS(data != nullptr, ldr::ResultHookDataOutOfMemory());
|
|
||||||
|
|
||||||
R_TRY(MtcInstallHooks(data));
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
|
||||||
nsoStart = reinterpret_cast<u32 *>(mapped_nso);
|
|
||||||
MtcGenerateFreqTables();
|
|
||||||
|
|
||||||
u32 CpuCvbDefaultMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(CpuCvbTableDefault)->freq);
|
|
||||||
u32 GpuCvbDefaultMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(GpuCvbTableDefault)->freq);
|
|
||||||
|
|
||||||
PatcherEntry<u32> patches[] = {
|
|
||||||
{"CPU Freq Table", CpuFreqCvbTable<false>, 1, nullptr, CpuCvbDefaultMaxFreq },
|
|
||||||
{"CPU Volt DVFS", &CpuVoltDvfs, 1, nullptr, CpuVminOfficial },
|
|
||||||
{"CPU Volt Thermals", &CpuVoltThermals, 1, nullptr, CpuVminOfficial },
|
|
||||||
{"CPU Volt Dfll", &CpuVoltDfll, 1, nullptr, CpuTune0Low },
|
|
||||||
{"GPU Volt DVFS", &GpuVoltDVFS, 1, nullptr, GpuVminOfficial },
|
|
||||||
{"GPU Volt Thermals", &GpuVoltThermals, 1, nullptr, GpuVminOfficial },
|
|
||||||
{"GPU Freq Table", GpuFreqCvbTable<false>, 1, nullptr, GpuCvbDefaultMaxFreq },
|
|
||||||
{"GPU Freq Asm", &GpuFreqMaxAsm, 2, &GpuMaxClockPatternFn },
|
|
||||||
{"GPU PLL Max", &GpuFreqPllMax, 1, nullptr, GpuClkPllMax },
|
|
||||||
// {"GPU PLL Limit", &GpuFreqPllLimit, 4, nullptr, GpuClkPllLimit },
|
|
||||||
{"MEM Table Asm", &MemMtcTableAsm, 4, &MemMtcGetGetTablePatternFn },
|
|
||||||
{"MEM Freq Mtc", &MemFreqMtcTable, 1, nullptr, EmcClkOSLimit },
|
|
||||||
{"MEM Freq Max", &MemFreqMax, 0, nullptr, EmcClkOSLimit },
|
|
||||||
{"MEM Freq PLLM", &MemFreqPllmLimit, 2, nullptr, EmcClkPllmLimit },
|
|
||||||
{"MEM Volt", &MemVoltHandler, 2, nullptr, MemVoltHOS },
|
|
||||||
};
|
|
||||||
|
|
||||||
for (uintptr_t ptr = mapped_nso; ptr <= mapped_nso + nso_size - sizeof(EristaMtcTable); ptr += sizeof(u32)) {
|
|
||||||
u32 *ptr32 = reinterpret_cast<u32 *>(ptr);
|
|
||||||
for (auto &entry : patches) {
|
|
||||||
if (R_SUCCEEDED(entry.SearchAndApply(ptr32))) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto &entry : patches) {
|
|
||||||
LOGGING("%s Count: %zu", entry.description, entry.patched_count);
|
|
||||||
if (R_FAILED(entry.CheckResult())) {
|
|
||||||
panic::SmcError(panic::Patch);
|
|
||||||
|
|
||||||
CRASH(entry.description);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (R_FAILED(InstallHooks())) {
|
|
||||||
panic::SmcError(panic::Patch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Switch-OC-Suite
|
|
||||||
*
|
|
||||||
* Copyright (c) 2023 hanai3Bi
|
|
||||||
*
|
|
||||||
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "../../oc_common.hpp"
|
|
||||||
#include "../pcv_common.hpp"
|
|
||||||
#include "../pcv_asm.hpp"
|
|
||||||
#include "../pcv_hook.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::erista {
|
|
||||||
|
|
||||||
struct HookPayloadData {
|
|
||||||
struct {
|
|
||||||
EristaMtcTable *mtcTable;
|
|
||||||
u32 mtcCount;
|
|
||||||
} mtcTableAsm;
|
|
||||||
};
|
|
||||||
DECLARE_HOOK_PAYLOAD_PTR(HookPayloadData, e_HookPayloadData);
|
|
||||||
|
|
||||||
extern u32 *nsoStart;
|
|
||||||
|
|
||||||
void Patch(uintptr_t mapped_nso, size_t nso_size);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Switch-OC-Suite
|
|
||||||
*
|
|
||||||
* Copyright (c) 2023 hanai3Bi
|
|
||||||
*
|
|
||||||
* Copyright (c) B3711
|
|
||||||
*
|
|
||||||
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../pcv.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::erista {
|
|
||||||
|
|
||||||
Result CpuVoltDvfs(u32 *ptr) {
|
|
||||||
if (std::memcmp(ptr + 5, cpuVoltDvfsPattern, sizeof(cpuVoltDvfsPattern))) {
|
|
||||||
R_THROW(ldr::ResultInvalidCpuMinVolt());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (C.eristaCpuVmin) {
|
|
||||||
PATCH_OFFSET(ptr, C.eristaCpuVmin);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (C.eristaCpuUV) {
|
|
||||||
PATCH_OFFSET(ptr - 2, C.eristaCpuVmin);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (C.eristaCpuMaxVolt) {
|
|
||||||
PATCH_OFFSET(ptr + 5, C.eristaCpuMaxVolt);
|
|
||||||
}
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result CpuVoltThermals(u32 *ptr) {
|
|
||||||
if (std::memcmp(ptr - 6, cpuVoltageThermalPattern, sizeof(cpuVoltageThermalPattern))) {
|
|
||||||
R_THROW(ldr::ResultInvalidCpuMinVolt());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (C.eristaCpuVmin) {
|
|
||||||
PATCH_OFFSET( ptr, C.eristaCpuVmin);
|
|
||||||
PATCH_OFFSET(ptr + 3, C.eristaCpuVmin);
|
|
||||||
PATCH_OFFSET(ptr + 6, C.eristaCpuVmin);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (C.eristaCpuMaxVolt) {
|
|
||||||
PATCH_OFFSET(ptr - 2, C.eristaCpuMaxVolt);
|
|
||||||
PATCH_OFFSET(ptr + 1, C.eristaCpuMaxVolt);
|
|
||||||
PATCH_OFFSET(ptr + 4, C.eristaCpuMaxVolt);
|
|
||||||
PATCH_OFFSET(ptr + 7, C.eristaCpuMaxVolt);
|
|
||||||
}
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result CpuVoltDfll(u32* ptr) {
|
|
||||||
CvbCpuDfllData *entry = reinterpret_cast<CvbCpuDfllData *>(ptr);
|
|
||||||
|
|
||||||
R_UNLESS(entry->tune0_low == 0xFFEAD0FF, ldr::ResultInvalidCpuVoltDfllEntry());
|
|
||||||
R_UNLESS(entry->tune0_high == 0x0, ldr::ResultInvalidCpuVoltDfllEntry());
|
|
||||||
R_UNLESS(entry->tune1_low == 0x0, ldr::ResultInvalidCpuVoltDfllEntry());
|
|
||||||
R_UNLESS(entry->tune1_high == 0x0, ldr::ResultInvalidCpuVoltDfllEntry());
|
|
||||||
|
|
||||||
if (!C.eristaCpuUV) {
|
|
||||||
R_SKIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (C.eristaCpuUV) {
|
|
||||||
case 1:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xffff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27007ff);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xefff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27407ff);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27807ff);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xdfdf);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27a07ff);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xcfdf);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x37007ff);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Switch-OC-Suite
|
|
||||||
*
|
|
||||||
* Copyright (c) 2023 hanai3Bi
|
|
||||||
*
|
|
||||||
* Copyright (c) B3711
|
|
||||||
*
|
|
||||||
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "pcv_erista.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::erista {
|
|
||||||
|
|
||||||
constexpr cvb_entry_t CpuCvbTableDefault[] = {
|
|
||||||
// CPU_PLL_CVB_TABLE_ODN
|
|
||||||
{ 204000, {721094}, { } },
|
|
||||||
{ 306000, {754040}, { } },
|
|
||||||
{ 408000, {786986}, { } },
|
|
||||||
{ 510000, {819932}, { } },
|
|
||||||
{ 612000, {852878}, { } },
|
|
||||||
{ 714000, {885824}, { } },
|
|
||||||
{ 816000, {918770}, { } },
|
|
||||||
{ 918000, {951716}, { } },
|
|
||||||
{ 1020000, {984662}, { -2875621, 358099, -8585} },
|
|
||||||
{ 1122000, {1017608}, { -52225, 104159, -2816} },
|
|
||||||
{ 1224000, {1050554}, { 1076868, 8356, -727} },
|
|
||||||
{ 1326000, {1083500}, { 2208191, -84659, 1240} },
|
|
||||||
{ 1428000, {1116446}, { 2519460, -105063, 1611} },
|
|
||||||
{ 1581000, {1130000}, { 2889664, -122173, 1834} },
|
|
||||||
{ 1683000, {1168000}, { 5100873, -279186, 4747} },
|
|
||||||
{ 1785000, {1227500}, { 5100873, -279186, 4747} },
|
|
||||||
{ },
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr u32 CpuVoltOfficial = 1227;
|
|
||||||
constexpr u32 CpuVminOfficial = 825;
|
|
||||||
constexpr u32 CpuTune0Low = 0xFFEAD0FF;
|
|
||||||
|
|
||||||
constexpr u32 CpuVoltL4T = 1257'000;
|
|
||||||
|
|
||||||
static const u32 cpuVoltDvfsPattern[] = { 1227, 1000, 100, 1000, 0 };
|
|
||||||
static_assert(sizeof(cpuVoltDvfsPattern) == 0x14, "Invalid cpuVoltDvfsPattern size");
|
|
||||||
|
|
||||||
static const u32 cpuVoltageThermalPattern[] = { 950, 1132, 0, 950, 1227, 0, 825, 1227, 15000, 825, 1170, 60000, 825, 1132, 80000 };
|
|
||||||
static_assert(sizeof(cpuVoltageThermalPattern) == 0x3c, "Invalid cpuVoltageThermalPattern size");
|
|
||||||
|
|
||||||
|
|
||||||
Result CpuVoltDvfs(u32 *ptr);
|
|
||||||
Result CpuVoltThermals(u32 *ptr);
|
|
||||||
Result CpuVoltDfll(u32* ptr);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Switch-OC-Suite
|
|
||||||
*
|
|
||||||
* Copyright (c) 2023 hanai3Bi
|
|
||||||
*
|
|
||||||
* Copyright (c) B3711
|
|
||||||
*
|
|
||||||
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../pcv.hpp"
|
|
||||||
#include "../pcv_asm.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::erista {
|
|
||||||
|
|
||||||
Result GpuVoltDVFS(u32 *ptr) {
|
|
||||||
if (std::memcmp(ptr, gpuVoltDvfsPattern, sizeof(gpuVoltDvfsPattern))) {
|
|
||||||
R_THROW(ldr::ResultInvalidGpuDvfs());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (C.eristaGpuVmin) {
|
|
||||||
PATCH_OFFSET(ptr, C.eristaGpuVmin);
|
|
||||||
}
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result GpuVoltThermals(u32 *ptr) {
|
|
||||||
if (std::memcmp(ptr - 3, gpuVoltThermalPattern, sizeof(gpuVoltThermalPattern))) {
|
|
||||||
R_THROW(ldr::ResultInvalidGpuDvfs());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (C.eristaGpuVmin) {
|
|
||||||
PATCH_OFFSET(ptr, C.eristaGpuVmin);
|
|
||||||
PATCH_OFFSET(ptr + 3, C.eristaGpuVmin);
|
|
||||||
PATCH_OFFSET(ptr + 6, C.eristaGpuVmin);
|
|
||||||
PATCH_OFFSET(ptr + 9, C.eristaGpuVmin);
|
|
||||||
PATCH_OFFSET(ptr + 12, C.eristaGpuVmin);
|
|
||||||
}
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result GpuFreqMaxAsm(u32 *ptr32) {
|
|
||||||
// Check if both two instructions match the pattern
|
|
||||||
u32 ins1 = *ptr32, ins2 = *(ptr32 + 1);
|
|
||||||
if (!(_asm::Ignoring(ins1, GpuAsmPattern[0], _asm::field::Rd) && _asm::Ignoring(ins2, GpuAsmPattern[1], _asm::field::Rd))) {
|
|
||||||
R_THROW(ldr::ResultInvalidGpuFreqMaxPattern());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Both instructions should operate on the same register
|
|
||||||
u8 rd = _asm::Get(ins1, _asm::field::Rd);
|
|
||||||
if (rd != _asm::Get(ins2, _asm::field::Rd)) {
|
|
||||||
R_THROW(ldr::ResultInvalidGpuFreqMaxPattern());
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 max_clock;
|
|
||||||
switch (C.eristaGpuUV) {
|
|
||||||
case 0:
|
|
||||||
max_clock = GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
max_clock = GetDvfsTableLastEntry(C.eristaGpuDvfsTableSLT)->freq;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
max_clock = GetDvfsTableLastEntry(C.eristaGpuDvfsTableHiOPT)->freq;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
max_clock = GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 asm_patch[2] = {
|
|
||||||
_asm::Encode(_asm::op::MovzW, {_asm::field::Rd, rd}, {_asm::field::Imm16, max_clock}),
|
|
||||||
_asm::Encode(_asm::op::MovkW, {_asm::field::Rd, rd}, {_asm::field::Imm16, max_clock >> 16}, {_asm::field::Hw, 1})
|
|
||||||
};
|
|
||||||
|
|
||||||
PATCH_OFFSET(ptr32, asm_patch[0]);
|
|
||||||
PATCH_OFFSET(ptr32 + 1, asm_patch[1]);
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result GpuFreqPllMax(u32 *ptr) {
|
|
||||||
clk_pll_param *entry = reinterpret_cast<clk_pll_param *>(ptr);
|
|
||||||
|
|
||||||
// All zero except for freq
|
|
||||||
for (size_t i = 1; i < sizeof(clk_pll_param) / sizeof(u32); i++) {
|
|
||||||
R_UNLESS(*(ptr + i) == 0, ldr::ResultInvalidGpuPllEntry());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Double the max clk simply
|
|
||||||
u32 max_clk = entry->freq * 2;
|
|
||||||
entry->freq = max_clk;
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
// patch out 1305MHz limit on erista, don't use this!
|
|
||||||
// Result GpuFreqPllLimit(u32 *ptr) {
|
|
||||||
// u32 prev_freq = *(ptr - 1);
|
|
||||||
|
|
||||||
// if (prev_freq != 128000 && prev_freq != 1300000 && prev_freq != 76800) {
|
|
||||||
// R_THROW(ldr::ResultInvalidGpuPllEntry());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// PATCH_OFFSET(ptr, 3600000);
|
|
||||||
|
|
||||||
// R_SUCCEED();
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Switch-OC-Suite
|
|
||||||
*
|
|
||||||
* Copyright (c) 2023 hanai3Bi
|
|
||||||
*
|
|
||||||
* Copyright (c) B3711
|
|
||||||
*
|
|
||||||
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "pcv_erista.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::erista {
|
|
||||||
|
|
||||||
constexpr u32 GpuClkPllLimit = 2'600'000;
|
|
||||||
constexpr u32 GpuClkPllMax = 921'600'000;
|
|
||||||
constexpr u32 GpuVminOfficial = 810;
|
|
||||||
|
|
||||||
static const u32 gpuVoltDvfsPattern[] = { 810, 1150, 1000, 100, 1000, 10, };
|
|
||||||
static_assert(sizeof(gpuVoltDvfsPattern) == (sizeof(u32) * 6), "Invalid gpuVoltDvfsPattern");
|
|
||||||
|
|
||||||
static const u32 gpuVoltThermalPattern[] = { 950, 1132, 0, 810, 1132, 15000, 810, 1132, 30000, 810, 1132, 50000, 810, 1132, 70000, 810, 1132, 105000 };
|
|
||||||
static_assert(sizeof(gpuVoltThermalPattern) == 0x48, "Invalid gpuVoltageThermalPattern size");
|
|
||||||
|
|
||||||
/* GPU Max Clock asm Pattern:
|
|
||||||
*
|
|
||||||
* MOV W11, #0x1000 MOV (wide immediate) 0x1000 0xB (11)
|
|
||||||
* sf | opc | | hw | imm16 | Rd
|
|
||||||
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
|
||||||
* 0 | 1 0 | 1 0 0 1 0 1| 0 0| 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 |0 1 0 1 1
|
|
||||||
*
|
|
||||||
* MOVK W11, #0xE, LSL#16 <shift>16 0xE 0xB (11)
|
|
||||||
* sf | opc | | hw | imm16 | Rd
|
|
||||||
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
|
||||||
* 0 | 1 1 | 1 0 0 1 0 1| 0 1| 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 |0 1 0 1 1
|
|
||||||
*/
|
|
||||||
inline constexpr u32 GpuAsmPattern[] = { 0x52820000, 0x72A001C0 };
|
|
||||||
|
|
||||||
inline bool GpuMaxClockPatternFn(u32 *ptr32) {
|
|
||||||
return _asm::Ignoring(*ptr32, GpuAsmPattern[0], _asm::field::Rd);
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr cvb_entry_t GpuCvbTableDefault[] = {
|
|
||||||
// NA_FREQ_CVB_TABLE
|
|
||||||
{ 76800, {}, { 814294, 8144, -940, 808, -21583, 226, } },
|
|
||||||
{ 153600, {}, { 856185, 8144, -940, 808, -21583, 226, } },
|
|
||||||
{ 230400, {}, { 898077, 8144, -940, 808, -21583, 226, } },
|
|
||||||
{ 307200, {}, { 939968, 8144, -940, 808, -21583, 226, } },
|
|
||||||
{ 384000, {}, { 981860, 8144, -940, 808, -21583, 226, } },
|
|
||||||
{ 460800, {}, { 1023751, 8144, -940, 808, -21583, 226, } },
|
|
||||||
{ 537600, {}, { 1065642, 8144, -940, 808, -21583, 226, } },
|
|
||||||
{ 614400, {}, { 1107534, 8144, -940, 808, -21583, 226, } },
|
|
||||||
{ 691200, {}, { 1149425, 8144, -940, 808, -21583, 226, } },
|
|
||||||
{ 768000, {}, { 1191317, 8144, -940, 808, -21583, 226, } },
|
|
||||||
{ 844800, {}, { 1233208, 8144, -940, 808, -21583, 226, } },
|
|
||||||
{ 921600, {}, { 1275100, 8144, -940, 808, -21583, 226, } },
|
|
||||||
{ },
|
|
||||||
};
|
|
||||||
|
|
||||||
Result GpuVoltDVFS(u32 *ptr);
|
|
||||||
Result GpuVoltThermals(u32 *ptr);
|
|
||||||
Result GpuFreqMaxAsm(u32 *ptr32);
|
|
||||||
Result GpuFreqPllMax(u32 *ptr);
|
|
||||||
|
|
||||||
// patch out 1305MHz limit on erista, don't use this!
|
|
||||||
// Result GpuFreqPllLimit(u32 *ptr);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Switch-OC-Suite
|
|
||||||
*
|
|
||||||
* Copyright (c) 2023 hanai3Bi
|
|
||||||
*
|
|
||||||
* Copyright (c) B3711
|
|
||||||
*
|
|
||||||
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "pcv_erista.hpp"
|
|
||||||
#include "../../mtc_timing_table.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::erista {
|
|
||||||
|
|
||||||
constexpr u32 EmcListDefault[] = { 40800, 68000, 102000, 204000, 408000, 665600, 800000, 1065600, 1331200, 1600000, };
|
|
||||||
constexpr u32 EmcListSizeDefault = std::size(EmcListDefault);
|
|
||||||
constexpr u32 EmcListEndDefault = EmcListSizeDefault - 1;
|
|
||||||
|
|
||||||
constexpr u32 MemVoltHOS = 1125'000;
|
|
||||||
constexpr u32 EmcClkPllmLimit = 1866'000'000;
|
|
||||||
|
|
||||||
constexpr u32 MTC_TABLE_REV = 7;
|
|
||||||
constexpr u32 MtcTableCountDefault = 10;
|
|
||||||
|
|
||||||
constexpr size_t MtcFullTableSize = sizeof(EristaMtcTable) * MtcTableCountDefault;
|
|
||||||
constexpr u32 MtcFullTableCount = 3;
|
|
||||||
|
|
||||||
/* These dramids were copied from Hekate -- see /bdk/mem/sdram.h */
|
|
||||||
enum DramId {
|
|
||||||
ICOSA_4GB_SAMSUNG_K4F6E304HB_MGCH = 0,
|
|
||||||
ICOSA_4GB_HYNIX_H9HCNNNBPUMLHR_NLE = 1,
|
|
||||||
ICOSA_4GB_MICRON_MT53B512M32D2NP_062_WTC = 2,
|
|
||||||
ICOSA_6GB_SAMSUNG_K4FHE3D4HM_MGCH = 4,
|
|
||||||
ICOSA_8GB_SAMSUNG_K4FBE3D4HM_MGXX = 7,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum MtcTableIndex {
|
|
||||||
T210SdevEmcDvfsTableS4gb01 = 0, /* HB-MGCH, WT:C */
|
|
||||||
T210SdevEmcDvfsTableS6gb01 = 1, /* HM-MGCH */
|
|
||||||
T210SdevEmcDvfsTableH4gb01 = 2, /* HR-NLE */
|
|
||||||
MtcTableIndex_Invalid = 3,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MtcDramIndex {
|
|
||||||
DramId dramId;
|
|
||||||
MtcTableIndex index;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* TODO: Test 6gb and 8gb. */
|
|
||||||
const inline MtcDramIndex mtcIndexTable[] = {
|
|
||||||
{ ICOSA_4GB_SAMSUNG_K4F6E304HB_MGCH, T210SdevEmcDvfsTableS4gb01, },
|
|
||||||
{ ICOSA_4GB_MICRON_MT53B512M32D2NP_062_WTC, T210SdevEmcDvfsTableS4gb01, },
|
|
||||||
{ ICOSA_6GB_SAMSUNG_K4FHE3D4HM_MGCH, T210SdevEmcDvfsTableS6gb01, },
|
|
||||||
{ ICOSA_8GB_SAMSUNG_K4FBE3D4HM_MGXX, T210SdevEmcDvfsTableS6gb01, },
|
|
||||||
{ ICOSA_4GB_HYNIX_H9HCNNNBPUMLHR_NLE, T210SdevEmcDvfsTableH4gb01, },
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr u32 MtcBrAsm = 0xD61F0140;
|
|
||||||
constexpr u32 MtcMovAsm = 0x52800148;
|
|
||||||
constexpr u32 MtcAdrpAsm = 0xD0000081;
|
|
||||||
constexpr u32 MtcAddAsm = 0x91131821;
|
|
||||||
|
|
||||||
ALWAYS_INLINE bool MemMtcGetGetTablePatternFn(u32 *ptr) {
|
|
||||||
/* This builds an address that gets returned, so the register must be x0 by convention. */
|
|
||||||
return _asm::Ignoring(*ptr, MtcAddAsm, _asm::field::Imm12);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result MemFreqMtcTable(u32 *ptr);
|
|
||||||
void MtcGenerateFreqTables();
|
|
||||||
Result MemFreqMax(u32 *ptr);
|
|
||||||
HOOK_PAYLOAD_FN EristaMtcTable *GetEristaMtcTableImpl(u32 *count);
|
|
||||||
Result MemMtcTableAsm(u32 *ptr);
|
|
||||||
|
|
||||||
Result MtcInstallHooks(HookPayloadData *data);
|
|
||||||
|
|
||||||
}
|
|
||||||
-220
@@ -1,220 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Lightos_
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../../mtc_timing_value.hpp"
|
|
||||||
#include "../common/calculate_timings_common.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::mariko {
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
const RextPatch gRextTable[] = {
|
|
||||||
{1'633'000, 0x17}, {1'666'000, 0x18}, {1'700'000, 0x18},
|
|
||||||
{1'733'000, 0x18}, {1'766'000, 0x18}, {1'800'000, 0x1A},
|
|
||||||
{1'833'000, 0x1A}, {1'866'000, 0x1A}, {1'900'000, 0x19},
|
|
||||||
{1'933'000, 0x19}, {1'966'000, 0x19}, {2'100'000, 0x1A},
|
|
||||||
{2'133'000, 0x1A}, {2'166'000, 0x19}, {2'200'000, 0x19},
|
|
||||||
{2'233'000, 0x19}, {2'266'000, 0x1A}, {2'300'000, 0x1B},
|
|
||||||
{2'333'000, 0x1B}, {2'366'000, 0x1B}, {2'400'000, 0x1B},
|
|
||||||
{2'433'000, 0x1B}, {2'466'000, 0x1B}, {2'500'000, 0x1A},
|
|
||||||
{2'533'000, 0x1C}, {2'566'000, 0x1B}, {2'600'000, 0x1B},
|
|
||||||
{2'633'000, 0x1B}, {2'666'000, 0x1B}, {2'700'000, 0x1C},
|
|
||||||
{2'733'000, 0x1C}, {2'766'000, 0x1D}, {2'800'000, 0x1D},
|
|
||||||
{2'833'000, 0x1D}, {2'866'000, 0x1D}, {2'900'000, 0x1D},
|
|
||||||
{2'933'000, 0x1C}, {2'966'000, 0x1D}, {3'000'000, 0x1D},
|
|
||||||
{3'033'000, 0x1D}, {3'066'000, 0x1D}, {3'100'000, 0x1D},
|
|
||||||
{3'133'000, 0x1D}, {3'166'000, 0x1C}, {3'200'000, 0x1C},
|
|
||||||
{3'233'000, 0x1E}, {3'266'000, 0x1F}, {3'300'000, 0x1E},
|
|
||||||
{3'333'000, 0x1F}, {3'366'000, 0x1F}, {3'400'000, 0x1F},
|
|
||||||
{3'433'000, 0x1F}, {3'466'000, 0x1F}, {3'500'000, 0x1E},
|
|
||||||
{3'533'000, 0x1E}, {3'566'000, 0x1E}, {3'600'000, 0x1E},
|
|
||||||
{3'633'000, 0x1E}, {3'666'000, 0x1E}, {3'700'000, 0x1F},
|
|
||||||
};
|
|
||||||
|
|
||||||
const RextPatch *LookupRext(u32 freq) {
|
|
||||||
for (u32 i = 0; i < std::size(gRextTable); i++) {
|
|
||||||
if (gRextTable[i].freq >= freq) {
|
|
||||||
return &gRextTable[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GetRext(u32 freq) {
|
|
||||||
if (auto r = LookupRext(freq)) {
|
|
||||||
rext = r->rext;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fallback */
|
|
||||||
rext = 0x1E;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CalculateActivatePrechargeTimings(bool lowFreq) {
|
|
||||||
tRCD = tRCD_values[lowFreq ? C.low_t1_tRCD : C.t1_tRCD];
|
|
||||||
tRPpb = tRP_values[lowFreq ? C.low_t2_tRP : C.t2_tRP];
|
|
||||||
tRAS = tRAS_values[lowFreq ? C.low_t3_tRAS : C.t3_tRAS];
|
|
||||||
|
|
||||||
tRC = tRAS + tRPpb;
|
|
||||||
tRPab = tRPpb + 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CalculateActivateWindowTimings(bool lowFreq) {
|
|
||||||
tRRD = tRRD_values[lowFreq ? C.low_t4_tRRD : C.t4_tRRD];
|
|
||||||
tFAW = static_cast<u32>(tRRD * 4.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CalculateReadTimings(u32 freq, double tCK_avg, bool lowFreq) {
|
|
||||||
u32 tRTW = lowFreq ? C.low_t6_tRTW : C.t6_tRTW;
|
|
||||||
s32 finetRTW = C.fineTune_t6_tRTW;
|
|
||||||
|
|
||||||
double fullRoundDelay = flyByTime + tDQSCK_max;
|
|
||||||
|
|
||||||
/* Read to precharge delay. */
|
|
||||||
tR2P = CalculateNTRTP();
|
|
||||||
|
|
||||||
/* Read to write turnaround. */
|
|
||||||
/* Switch seemingly uses odt. */
|
|
||||||
tR2W = RL + (BL / 2) + CEIL((fullRoundDelay / tCK_avg) + tDQSTA) - GET_CYCLE_FLOOR(tODTon) - GetOdtLon() - (tRTW * 3) + finetRTW;
|
|
||||||
tRTM = FLOOR((10.0 + RL) + (3.502 / tCK_avg)) + GET_CYCLE_FLOOR(7.489);
|
|
||||||
tRATM = CEIL((tRTM - 10.0) + (RL * 0.426));
|
|
||||||
|
|
||||||
/* Read data valid: Read command -> data ready to be latched into the registers. */
|
|
||||||
rdv = RL + GET_CYCLE_CEIL(fullRoundDelay) + 16;
|
|
||||||
|
|
||||||
/* Read command -> data poppable at the pad macros, 14 cycles ahead of rdv. */
|
|
||||||
qpop = rdv - 14;
|
|
||||||
|
|
||||||
constexpr double TrimmerStepPs = 3.0;
|
|
||||||
constexpr double MaxTrimmerSteps = 96.0;
|
|
||||||
|
|
||||||
double tCkAvgPs = tCK_avg * 1000.0;
|
|
||||||
double tckDerated = tCkAvgPs * 0.85;
|
|
||||||
u32 derateStepCount = MIN(FLOOR(tckDerated / TrimmerStepPs), MaxTrimmerSteps);
|
|
||||||
double deratedNsDelay = (derateStepCount * TrimmerStepPs) / 1000.0;
|
|
||||||
/* readEyeEndDerated, nv call this quseExtra. */
|
|
||||||
u32 quseExtra = GET_CYCLE_CEIL(fullRoundDelay - deratedNsDelay);
|
|
||||||
|
|
||||||
/* The amount of deration from the perspective of a full round trip. */
|
|
||||||
u32 readEyeEndDerateMargin = GET_CYCLE_CEIL(fullRoundDelay) - quseExtra;
|
|
||||||
|
|
||||||
u32 tQuse = FLOOR((flyByTime + 0.94) / tCK_avg);
|
|
||||||
u32 readEyeStart = tQuse + RL + 1;
|
|
||||||
|
|
||||||
u32 einputMinimal = readEyeStart + readEyeEndDerateMargin - 2;
|
|
||||||
|
|
||||||
/* Data valid window, quse aligns with the start of the read eye (probably). */
|
|
||||||
/* DQS needs to be logically and'ed with quse in order to be valid. */
|
|
||||||
/* einputMinimal satisfies this. */
|
|
||||||
quse = einputMinimal;
|
|
||||||
|
|
||||||
/* input receiver takes time to enable. */
|
|
||||||
u32 einputLatency = GET_CYCLE_CEIL(10.0);
|
|
||||||
|
|
||||||
/* Enable input receiver. */
|
|
||||||
einput = einputMinimal - einputLatency;
|
|
||||||
|
|
||||||
/* Difference between the two eye edges. */
|
|
||||||
quse_width = quseExtra - tQuse + 4;
|
|
||||||
|
|
||||||
/* Duration of input receiver being enabled? */
|
|
||||||
einput_duration = einputLatency + quse_width + 4;
|
|
||||||
|
|
||||||
/* qrst_duration is CEIL(a / tCK_avg + b) */
|
|
||||||
/* a and b were derived through a brute forcer. */
|
|
||||||
u32 qrst_duration = CEIL(1.4 / tCK_avg + 3.5);
|
|
||||||
u32 qrstLow = MAX(static_cast<s32>(einput - qrst_duration - 2), static_cast<s32>(0));
|
|
||||||
|
|
||||||
/* quse reset? */
|
|
||||||
qrst = PACK_U32(qrst_duration, qrstLow);
|
|
||||||
|
|
||||||
/* Input buffer delay? */
|
|
||||||
ibdly = PACK_U32_NIBBLE_HIGH_BYTE_LOW(1, quse - qrst_duration - 2.0);
|
|
||||||
|
|
||||||
/* Qsafe, safe to reset quse? */
|
|
||||||
qsafe = (einput_duration + 3) + MAX(MIN(qrstLow * rdv, qrst_duration + qrst_duration), einput);
|
|
||||||
|
|
||||||
GetRext(freq);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CalculateWriteTimings(double tCK_avg, bool lowFreq) {
|
|
||||||
u32 tWTR = 10 - tWTR_values[lowFreq ? C.low_t7_tWTR : C.t7_tWTR];
|
|
||||||
s32 finetWTR = C.fineTune_t7_tWTR;
|
|
||||||
|
|
||||||
/* Write to read turnaround. */
|
|
||||||
/* According to jedec specifications: nWR >= tWTR + nRTP */
|
|
||||||
/* Therefore tWTR >= nWR - tRTP. */
|
|
||||||
const u32 nTWTR = GET_CYCLE_CEIL(tWTRStock);
|
|
||||||
const u32 nWr = CalculateNWr();
|
|
||||||
u32 autoPrecharcetWTRMin = nWr - tR2P;
|
|
||||||
|
|
||||||
/* tWTR reduction is applied in a weird way to not break existing setups. */
|
|
||||||
tW2R = WL + 1 + MAX(autoPrecharcetWTRMin, nTWTR) - GET_CYCLE_CEIL(tWTR) + finetWTR;
|
|
||||||
tW2P = (CEIL(WL * 1.7303) * 2) - 5;
|
|
||||||
tWTM = CEIL(WL + ((7.570 / tCK_avg) + 8.753));
|
|
||||||
tWATM = (tWTM + (FLOOR(WL / 0.816) * 2.0)) - 4.0;
|
|
||||||
|
|
||||||
wdv = WL;
|
|
||||||
wsv = WL - 2;
|
|
||||||
wev = WL - 4;
|
|
||||||
|
|
||||||
/* Output buffer delay? */
|
|
||||||
u32 obdlyHigh = 3 / FLOOR(MIN(static_cast<double>(2), tCK_avg * (WL - 7)));
|
|
||||||
u32 obdlyLow = MAX(WL - FLOOR((126.0 / CEIL(tCK_avg + 8.601))), 0.0);
|
|
||||||
obdly = PACK_U32_NIBBLE_HIGH_BYTE_LOW(obdlyHigh, obdlyLow);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CalculateRefreshTimings(double tCK_avg, bool lowFreq) {
|
|
||||||
tRFCpb = tRFC_values[lowFreq ? C.low_t5_tRFC : C.t5_tRFC];
|
|
||||||
tRFCab = tRFCpb * 2;
|
|
||||||
tXSR = static_cast<double>(tRFCab + 7.5);
|
|
||||||
|
|
||||||
u32 tREFI = lowFreq ? C.low_t8_tREFI : C.t8_tREFI;
|
|
||||||
refresh_raw = 0xFFFF;
|
|
||||||
if (tREFI != 6) {
|
|
||||||
refresh_raw = GET_CYCLE_CEIL(tREFpb_values[tREFI]) - 0x40;
|
|
||||||
refresh_raw = MIN(refresh_raw, static_cast<u32>(0xFFFF));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CalculatePowerDownTimings(double tCK_avg) {
|
|
||||||
tWTPDEN = CEIL(((1.8 / tCK_avg) + MAX(RL + (2.7 / tCK_avg), static_cast<double>(tW2P))) + (BL / 2));
|
|
||||||
pdex2rw = CEIL((CEIL(12.335 - tCK_avg) + (7.430 / tCK_avg) - CEIL(tCK_avg * 11.361)));
|
|
||||||
|
|
||||||
tCLKSTOP = FLOOR(MIN(8.488 / tCK_avg, 23.0)) + 8.0;
|
|
||||||
|
|
||||||
double tMMRI = tRCD + (tCK_avg * 3);
|
|
||||||
pdex2mrr = tMMRI + 10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CalculateTimings(double tCK_avg, u32 freq) {
|
|
||||||
RL = RL_1333;
|
|
||||||
WL = WL_1333;
|
|
||||||
|
|
||||||
HandleLatency(freq);
|
|
||||||
|
|
||||||
const bool lowFreq = freq < C.timingEmcTbreak;
|
|
||||||
|
|
||||||
CalculateActivatePrechargeTimings(lowFreq);
|
|
||||||
CalculateActivateWindowTimings(lowFreq);
|
|
||||||
CalculateReadTimings(freq, tCK_avg, lowFreq);
|
|
||||||
CalculateWriteTimings(tCK_avg, lowFreq);
|
|
||||||
CalculateRefreshTimings(tCK_avg, lowFreq);
|
|
||||||
CalculatePowerDownTimings(tCK_avg);
|
|
||||||
mrw2 = CalculateMrw2();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Switch-OC-Suite
|
|
||||||
*
|
|
||||||
* Copyright (c) 2023 hanai3Bi
|
|
||||||
*
|
|
||||||
* Copyright (c) B3711
|
|
||||||
*
|
|
||||||
* Copyright (c) Souldbminer, Lightos and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include "../pcv.hpp"
|
|
||||||
#include "../../mtc_timing_value.hpp"
|
|
||||||
#include "pcv_mariko.hpp"
|
|
||||||
#include "pcv_mariko_cpu.hpp"
|
|
||||||
#include "pcv_mariko_gpu.hpp"
|
|
||||||
#include "pcv_mariko_mtc.hpp"
|
|
||||||
#include "pcv_mariko_soc.hpp"
|
|
||||||
#include "pcv_mariko_log.hpp"
|
|
||||||
#include "pcv_mariko_cave.hpp"
|
|
||||||
#include "calculate_timings_mariko.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::mariko {
|
|
||||||
|
|
||||||
u32 *nsoStart;
|
|
||||||
size_t g_nso_size = 0;
|
|
||||||
|
|
||||||
DEFINE_HOOK_PAYLOAD_PTR(HookPayloadData, m_HookPayloadData);
|
|
||||||
|
|
||||||
Result InstallHooks() {
|
|
||||||
R_TRY(CaveInstall());
|
|
||||||
|
|
||||||
R_TRY(Hooks().CheckEnabled());
|
|
||||||
|
|
||||||
R_TRY(Hooks().CopyPayload());
|
|
||||||
|
|
||||||
auto *data = Hooks().BindData(m_HookPayloadData);
|
|
||||||
R_UNLESS(data != nullptr, ldr::ResultHookDataOutOfMemory());
|
|
||||||
|
|
||||||
R_TRY(SharedClkBusInstallHooks(data));
|
|
||||||
|
|
||||||
R_TRY(LutWriterInstallHooks(data));
|
|
||||||
|
|
||||||
#if HOC_UART_LOG
|
|
||||||
R_TRY(ForceVebosityInstallHooks(data));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
|
||||||
nsoStart = reinterpret_cast<u32 *>(mapped_nso);
|
|
||||||
g_nso_size = nso_size;
|
|
||||||
|
|
||||||
MtcGenerateFreqTables();
|
|
||||||
|
|
||||||
u32 CpuCvbDefaultMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(CpuCvbTableDefault)->freq);
|
|
||||||
u32 GpuCvbDefaultMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(GpuCvbTableDefault)->freq);
|
|
||||||
|
|
||||||
PatcherEntry<u32> patches[] = {
|
|
||||||
{ "CPU Freq Vdd", &CpuFreqVdd, 1, nullptr, CpuClkOSLimit },
|
|
||||||
{ "CPU Freq Table", CpuFreqCvbTable<true>, 1, nullptr, CpuCvbDefaultMaxFreq },
|
|
||||||
{ "CPU Volt DVFS", &CpuVoltDVFS, 1, nullptr, CpuVminOfficial },
|
|
||||||
{ "CPU Volt Thermals", &CpuVoltThermals, 1, nullptr, CpuVminOfficial },
|
|
||||||
{ "CPU Volt Dfll", &CpuVoltDfll, 1, nullptr, CpuTune0Low },
|
|
||||||
{ "GPU Volt DVFS", &GpuVoltDVFS, 1, nullptr, GpuVminOfficial },
|
|
||||||
{ "GPU Volt Thermals", &GpuVoltThermals, 1, nullptr, GpuVminOfficial },
|
|
||||||
{ "GPU Freq Table", GpuFreqCvbTable<true>, 1, nullptr, GpuCvbDefaultMaxFreq },
|
|
||||||
{ "GPU Freq Asm", &GpuFreqMaxAsm, 2, &GpuMaxClockPatternFn },
|
|
||||||
{ "GPU PLL Max", &GpuFreqPllMax, 1, nullptr, GpuClkPllMax },
|
|
||||||
{ "GPU PLL Limit", &GpuFreqPllLimit, 4, nullptr, GpuClkPllLimit },
|
|
||||||
{ "MEM Freq Mtc", &MemFreqMtcTable, 1, nullptr, EmcClkOSLimit },
|
|
||||||
{ "MEM Freq Dvb", &MemFreqDvbTable, 1, nullptr, EmcClkOSLimit },
|
|
||||||
{ "MEM Freq Max", &MemFreqMax, 0, nullptr, EmcClkOSLimit },
|
|
||||||
{ "MEM Freq PLLM", &MemFreqPllmLimit, 2, nullptr, EmcClkPllmLimit },
|
|
||||||
{ "MEM Vddq", &EmcVddqVolt, 2, nullptr, EmcVddqDefault },
|
|
||||||
{ "MEM Vdd2", &MemVoltHandler, 2, nullptr, MemVdd2Default },
|
|
||||||
{ "MEM Table Asm", &MemMtcTableAsm, 1, &MemMtcGetGetTablePatternFn },
|
|
||||||
{ "EMC DVFS Count", &EmcDvfsCountLimit, 1, &EmcDvfsCountPatternFn },
|
|
||||||
{ "EMC SoC LUT", &EmcSocLutReloc, 1, &EmcSocLutPatternFn },
|
|
||||||
{ "EMC Rate List", &EmcRateListLimit, 0, &EmcRateListPatternFn },
|
|
||||||
{ "EMC Rate Sess", &EmcRateSessLimit, 1, &EmcRateSessPatternFn },
|
|
||||||
{ "Bus Freq Reloc", &BusFreqReloc, 1, &BusFreqRelocPatternFn },
|
|
||||||
{ "SOC Volt Asm", &SocVoltAsm, 1, &SocVoltPatternFn },
|
|
||||||
{ "SOC Volt Limit", &SocVoltLimit, 1, nullptr, SocVoltLimitOfficial },
|
|
||||||
{ "CPU Lut Max Asm", &CpuLutMaxAsm, 1, &CpuLutAsmPatternFn },
|
|
||||||
{ "CPU Lut Max Asm2", &CpuLutMaxAsm2, 1, &CpuLutAsmPatternFn2 },
|
|
||||||
{ "CPU Lut Writer", &LutWriterFind, 1, &LutWriterPatternFn },
|
|
||||||
{ "CPU Dvco Rate Cfg", &CpuLutDvcoRateCfg, 1, &CpuLutDvcoRateCfgPatternFn },
|
|
||||||
{ "Hook Cave", &DeadDestructorCaveFind, 0, &CaveFlagRunPatternFn, 0, 0, true },
|
|
||||||
|
|
||||||
/* Debugging patches */
|
|
||||||
#if HOC_UART_LOG
|
|
||||||
{ "NvLog Redirect", &NvLogUartRedirect, 1, &NvLogVsnprintfPatternFn, 0, 0, true },
|
|
||||||
{ "Force Verbosity", &ForceVerbosity, 3, &ForceVerbosityPatternFn, 0, 0, true },
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
for (uintptr_t ptr = mapped_nso; ptr <= mapped_nso + nso_size - sizeof(MarikoMtcTable); ptr += sizeof(u32)) {
|
|
||||||
u32 *ptr32 = reinterpret_cast<u32 *>(ptr);
|
|
||||||
for (auto &entry : patches) {
|
|
||||||
if (R_SUCCEEDED(entry.SearchAndApply(ptr32))) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto &entry : patches) {
|
|
||||||
LOGGING("%s Count: %zu", entry.description, entry.patched_count);
|
|
||||||
if (R_FAILED(entry.CheckResult())) {
|
|
||||||
panic::SmcError(panic::Patch);
|
|
||||||
|
|
||||||
CRASH(entry.description);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (R_FAILED(InstallHooks())) {
|
|
||||||
panic::SmcError(panic::Patch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Switch-OC-Suite
|
|
||||||
*
|
|
||||||
* Copyright (c) 2023 hanai3Bi
|
|
||||||
*
|
|
||||||
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "../../oc_common.hpp"
|
|
||||||
#include "../pcv_common.hpp"
|
|
||||||
#include "../pcv_asm.hpp"
|
|
||||||
#include "../pcv_hook.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::mariko {
|
|
||||||
|
|
||||||
constexpr u32 BusFreqTableCount = 2;
|
|
||||||
|
|
||||||
struct HookPayloadData {
|
|
||||||
struct {
|
|
||||||
u32 *next; /* Save the bytes. */
|
|
||||||
uintptr_t originalFnCallback;
|
|
||||||
u32 table[BusFreqTableCount][EmcDvfsTableEntryCount]; /* Original bus table size: 32. */
|
|
||||||
} busData;
|
|
||||||
struct {
|
|
||||||
uintptr_t orig; /* ClDvfsLut64ExpandImpl to CLDVFS LUT writer trampoline. */
|
|
||||||
u32 table[ClDvfsLutSize];
|
|
||||||
} lut64;
|
|
||||||
#if HOC_UART_LOG
|
|
||||||
u32 verbosityLevel;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
DECLARE_HOOK_PAYLOAD_PTR(HookPayloadData, m_HookPayloadData);
|
|
||||||
|
|
||||||
void Patch(uintptr_t mapped_nso, size_t nso_size);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "pcv_mariko_cave.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::mariko {
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
struct {
|
|
||||||
u32 *site = nullptr;
|
|
||||||
u32 *end = nullptr;
|
|
||||||
} caveCache;
|
|
||||||
|
|
||||||
bool HasDirectCaller(const u32 *target, const u32 *begin, const u32 *end) {
|
|
||||||
for (const u32 *ptr = begin; ptr < end; ++ptr) {
|
|
||||||
const u32 top6 = *ptr & 0xFC000000u;
|
|
||||||
if (top6 != _asm::op::B && top6 != _asm::op::Bl) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_asm::Target26(*ptr, reinterpret_cast<uintptr_t>(ptr)) == reinterpret_cast<uintptr_t>(target)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Result DeadDestructorCaveFind(u32 *ptr) {
|
|
||||||
u32 *textEnd = reinterpret_cast<u32 *>(g_pcv_cave);
|
|
||||||
|
|
||||||
u32 *site = _asm::FindFnPrologue(ptr, CavePrologueMargin, nsoStart);
|
|
||||||
R_UNLESS(site != nullptr, ldr::ResultInvalidHookCave());
|
|
||||||
|
|
||||||
u32 *end = _asm::FindFnEnd(site, textEnd);
|
|
||||||
R_UNLESS(end != nullptr, ldr::ResultInvalidHookCave());
|
|
||||||
|
|
||||||
/* Ensure this function is never called. */
|
|
||||||
R_UNLESS(!HasDirectCaller(site, nsoStart, textEnd), ldr::ResultInvalidHookCave());
|
|
||||||
|
|
||||||
caveCache.site = site;
|
|
||||||
caveCache.end = end;
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result CaveInstall() {
|
|
||||||
if (Hooks().CaveFree() >= HookContext::RequiredCaveSize()) {
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
R_UNLESS(caveCache.site != nullptr, ldr::ResultInvalidHookCave());
|
|
||||||
|
|
||||||
const uintptr_t start = util::AlignUp(reinterpret_cast<uintptr_t>(caveCache.site + 1), sizeof(u64));
|
|
||||||
const uintptr_t end = reinterpret_cast<uintptr_t>(caveCache.end);
|
|
||||||
R_UNLESS(start < end && end - start >= HookContext::RequiredCaveSize(), ldr::ResultHookPayloadTooLarge());
|
|
||||||
|
|
||||||
/* Insert a break in case this function gets called for whatever reason. */
|
|
||||||
*caveCache.site = _asm::BrkIns;
|
|
||||||
|
|
||||||
Hooks().SetCave(start, end - start);
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "../pcv.hpp"
|
|
||||||
#include "../pcv_asm.hpp"
|
|
||||||
#include "../pcv_hook.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::mariko {
|
|
||||||
|
|
||||||
extern u32 *nsoStart;
|
|
||||||
|
|
||||||
constexpr u32 CaveFlagChunkCount = 4;
|
|
||||||
constexpr u32 CaveFlagChunkInsCount = 4;
|
|
||||||
constexpr u32 CaveFlagLdrbDelta = 0x30;
|
|
||||||
constexpr u32 CavePrologueMargin = 8;
|
|
||||||
|
|
||||||
/* This function consists of multiple chunks. */
|
|
||||||
/* Each chunk does a load, a comparison and a conditional branch. The next chunk's address setup (adrp) follows right after it. */
|
|
||||||
inline bool IsFlagCheckChunk(const u32 *ptr) {
|
|
||||||
return _asm::IsOp(ptr[0], _asm::op::LdrbImm, _asm::field::Rt, _asm::field::Rn, _asm::field::Off1)
|
|
||||||
&& _asm::Ignoring(ptr[1], _asm::CmpImm32(0, 1), _asm::field::Rn)
|
|
||||||
&& _asm::Ignoring(ptr[2], _asm::Encode(_asm::op::BCond, {_asm::field::BCond, _asm::cond::Eq}), _asm::field::Imm19);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool IsChunkDeltaValid(const u32 *prev, const u32 *next) {
|
|
||||||
return IsFlagCheckChunk(next) && _asm::Get(*next, _asm::field::Off1) == _asm::Get(*prev, _asm::field::Off1) + CaveFlagLdrbDelta;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool ValidateChunkConsistency(const u32 *first) {
|
|
||||||
for (u32 i = 1; i < CaveFlagChunkCount; ++i) {
|
|
||||||
if (!IsChunkDeltaValid(first + (i - 1) * CaveFlagChunkInsCount, first + i * CaveFlagChunkInsCount)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool CaveFlagRunPatternFn(u32 *ptr) {
|
|
||||||
if (Hooks().CaveFree() >= HookContext::RequiredCaveSize()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
/* In case we don't have enough cave memory, we need to commit this warcrime. */
|
|
||||||
|
|
||||||
/* Ensure we don't dereference invalid memory. */
|
|
||||||
u32 *textEnd = reinterpret_cast<u32 *>(g_pcv_cave);
|
|
||||||
if (ptr - CaveFlagChunkInsCount < nsoStart || ptr + CaveFlagChunkCount * CaveFlagChunkInsCount > textEnd) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Validate the current chunk and the previous chunk and ensure the delta of the ldrb instructions is consistent. */
|
|
||||||
if (!IsFlagCheckChunk(ptr) || IsChunkDeltaValid(ptr - CaveFlagChunkInsCount, ptr)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ValidateChunkConsistency(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result DeadDestructorCaveFind(u32 *ptr);
|
|
||||||
Result CaveInstall();
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,617 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Switch-OC-Suite
|
|
||||||
*
|
|
||||||
* Copyright (c) 2023 hanai3Bi
|
|
||||||
*
|
|
||||||
* Copyright (c) B3711
|
|
||||||
*
|
|
||||||
* Copyright (c) Souldbminer, Lightos and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../pcv.hpp"
|
|
||||||
#include "pcv_mariko_cpu.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::mariko {
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
u32 CapCpuClock() {
|
|
||||||
u32 cpuCap = allowedCpuMaxFrequencies[0];
|
|
||||||
|
|
||||||
for (u32 freq : allowedCpuMaxFrequencies) {
|
|
||||||
if (C.marikoCpuMaxClock >= freq) {
|
|
||||||
cpuCap = freq;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cpuCap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO: Reduce code duplication. */
|
|
||||||
cvb_entry_t *GetDvfsTable() {
|
|
||||||
switch (C.tableConf) {
|
|
||||||
case TBREAK_1683: return const_cast<cvb_entry_t *>(C.marikoCpuDvfsTable1683Tbreak);
|
|
||||||
case TBREAK_1581: return const_cast<cvb_entry_t *>(C.marikoCpuDvfsTable1581Tbreak);
|
|
||||||
case EXTREME_TABLE: return const_cast<cvb_entry_t *>(C.marikoCpuDvfsTableExtreme);
|
|
||||||
case DEFAULT_TABLE:
|
|
||||||
default:
|
|
||||||
return const_cast<cvb_entry_t *>(mariko::CpuCvbTableDefault);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Todo: Reduce code duplication of this. */
|
|
||||||
Result GetCpuSpeedo(u32 &cpuSpeedo) {
|
|
||||||
constexpr u64 FusePhysicalAddress = 0x7000F000;
|
|
||||||
u64 virtualAddress = 0;
|
|
||||||
constexpr u64 Size = 0x1000;
|
|
||||||
|
|
||||||
u64 outSize;
|
|
||||||
/* TODO: use svc::QueryMemoryMapping instead. */
|
|
||||||
R_TRY(svcQueryMemoryMapping(&virtualAddress, &outSize, FusePhysicalAddress, Size));
|
|
||||||
|
|
||||||
constexpr u32 FuseOffset = 2048;
|
|
||||||
constexpr u32 CpuSpeedoOffset = 0x114;
|
|
||||||
cpuSpeedo = *reinterpret_cast<u32 *>(virtualAddress + FuseOffset + CpuSpeedoOffset);
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 CalculateCvbVoltage(cvb_entry_t *entry, u32 speedo, u32 speedoScale) {
|
|
||||||
float speedDiv = static_cast<float>(speedo) / speedoScale;
|
|
||||||
return ((entry->cvb_dfll_param.c2 * speedDiv + entry->cvb_dfll_param.c1) * speedDiv + entry->cvb_dfll_param.c0);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 DivRoundUp(u32 n, u32 d) {
|
|
||||||
return (n + d - 1) / d;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 RoundCvbVoltage(u32 mv, u32 vScale, u32 stepUv) {
|
|
||||||
u32 step = (stepUv ? stepUv : 1000) * vScale;
|
|
||||||
|
|
||||||
u32 uv = mv * 1000;
|
|
||||||
uv = DivRoundUp(uv, step) * stepUv;
|
|
||||||
return uv / 1000;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 EffVmin() { return C.marikoCpuLowVmin ? C.marikoCpuLowVmin : CpuVminOfficial; }
|
|
||||||
u32 EffVmax() { return C.marikoCpuMaxVolt ? C.marikoCpuMaxVolt : CpuVoltOfficial; }
|
|
||||||
|
|
||||||
u32 ClampVoltage(u32 mv) {
|
|
||||||
return std::clamp(mv, EffVmin(), EffVmax());
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 PmicBaseMv = 250;
|
|
||||||
constexpr u32 PmicStepMv = 5;
|
|
||||||
constexpr u32 PmicVoltCount = 256;
|
|
||||||
|
|
||||||
u32 GetExactVoltCode(u32 mv) {
|
|
||||||
u32 alignMult = mv / PmicStepMv;
|
|
||||||
|
|
||||||
for (u32 i = 0; i < PmicVoltCount; ++i) {
|
|
||||||
u32 regMult = (PmicBaseMv + i * PmicStepMv) / PmicStepMv;
|
|
||||||
if (alignMult == regMult) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return UINT32_MAX;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 GetVoltCode(u32 mv) {
|
|
||||||
u32 alignMult = DivRoundUp(mv, PmicStepMv);
|
|
||||||
|
|
||||||
for (u32 i = 0; i < PmicVoltCount; i++) {
|
|
||||||
u32 regMult = (PmicBaseMv + i * PmicStepMv) / PmicStepMv;
|
|
||||||
if (alignMult <= regMult) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return UINT32_MAX;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result BuildLut(u32 *lut, const u32 *voltArray) {
|
|
||||||
const u32 vMin = EffVmin();
|
|
||||||
const u32 vMax = *std::max_element(voltArray, voltArray + ClDvfsLutSize);
|
|
||||||
R_UNLESS(vMin <= vMax, ldr::ResultInvalidCpuMinVolt());
|
|
||||||
|
|
||||||
u32 voltage = vMin;
|
|
||||||
u32 code = GetExactVoltCode(voltage);
|
|
||||||
R_UNLESS(code != UINT32_MAX, ldr::ResultInvalidVoltCode());
|
|
||||||
lut[0] = code;
|
|
||||||
|
|
||||||
u32 j = 1;
|
|
||||||
for (u32 i = 0; i < ClDvfsLutSize; ++i) {
|
|
||||||
for (;;) {
|
|
||||||
R_UNLESS(j < ClDvfsLutSize, ldr::ResultInvalidVoltLutIndex());
|
|
||||||
|
|
||||||
voltage += std::max<u32>(1u, (vMax - voltage) / (ClDvfsLutSize - j));
|
|
||||||
if (voltage >= voltArray[i]) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
code = GetVoltCode(voltage);
|
|
||||||
R_UNLESS(code != UINT32_MAX, ldr::ResultInvalidVoltCode());
|
|
||||||
if (code != lut[j - 1]) {
|
|
||||||
lut[j++] = code;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
voltage = (j == ClDvfsLutSize - 1) ? vMax : voltArray[i];
|
|
||||||
code = GetExactVoltCode(voltage);
|
|
||||||
R_UNLESS(code != UINT32_MAX, ldr::ResultInvalidVoltCode());
|
|
||||||
|
|
||||||
if (code != lut[j - 1]) {
|
|
||||||
R_UNLESS(j < ClDvfsLutSize, ldr::ResultInvalidVoltLutIndex());
|
|
||||||
lut[j++] = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (voltage >= vMax) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (u32 k = j; k < ClDvfsLutSize; ++k) {
|
|
||||||
lut[k] = lut[j - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Since doing the proper lut creation in pcv is wasteful, we'll do it ourselves */
|
|
||||||
Result FillLutTable(HookPayloadData *data) {
|
|
||||||
/* Step 1: Get the speedo. */
|
|
||||||
u32 cpuSpeedo = 0;
|
|
||||||
R_TRY(GetCpuSpeedo(cpuSpeedo));
|
|
||||||
|
|
||||||
/* Step 2: Select the appropriate table. */
|
|
||||||
cvb_entry_t *table = GetDvfsTable();
|
|
||||||
constexpr u32 SpeedoScale = 100;
|
|
||||||
constexpr u32 VoltageScale = 1000;
|
|
||||||
constexpr u32 StepUv = 5000;
|
|
||||||
|
|
||||||
/* Step 3: Fill the voltage array. */
|
|
||||||
u32 voltArray[ClDvfsLutSize] = {};
|
|
||||||
for (u32 i = 0; i < DvfsTableEntryLimit; ++i) {
|
|
||||||
u32 voltage = CalculateCvbVoltage(&table[i], cpuSpeedo, SpeedoScale);
|
|
||||||
voltage = RoundCvbVoltage(voltage, VoltageScale, StepUv);
|
|
||||||
voltage = ClampVoltage(voltage);
|
|
||||||
|
|
||||||
voltArray[i] = voltage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Step 4: Build the lut table. */
|
|
||||||
u32 lut[ClDvfsLutSize] = {};
|
|
||||||
R_TRY(BuildLut(lut, voltArray));
|
|
||||||
|
|
||||||
/* Step 5: Copy it. */
|
|
||||||
std::memcpy(data->lut64.table, lut, sizeof(lut));
|
|
||||||
|
|
||||||
/* Step 6: Finally done. */
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Result CpuFreqVdd(u32 *ptr) {
|
|
||||||
dvfs_rail *entry = reinterpret_cast<dvfs_rail *>(reinterpret_cast<u8 *>(ptr) - offsetof(dvfs_rail, freq));
|
|
||||||
|
|
||||||
R_UNLESS(entry->id == 1, ldr::ResultInvalidCpuFreqVddEntry());
|
|
||||||
R_UNLESS(entry->min_mv == 250'000, ldr::ResultInvalidCpuFreqVddEntry());
|
|
||||||
R_UNLESS(entry->step_mv == 5000, ldr::ResultInvalidCpuFreqVddEntry());
|
|
||||||
R_UNLESS(entry->max_mv == 1525'000, ldr::ResultInvalidCpuFreqVddEntry());
|
|
||||||
|
|
||||||
if (C.marikoCpuUVHigh) {
|
|
||||||
PATCH_OFFSET(ptr, CapCpuClock());
|
|
||||||
} else {
|
|
||||||
PATCH_OFFSET(ptr, GetDvfsTableLastEntry(C.marikoCpuDvfsTable)->freq);
|
|
||||||
}
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result CpuVoltDVFS(u32 *ptr) {
|
|
||||||
CvbMeta *cpuCvbMeta = reinterpret_cast<CvbMeta *>(reinterpret_cast<u8 *>(ptr) - offsetof(CvbMeta, vmin));
|
|
||||||
|
|
||||||
R_UNLESS(cpuCvbMeta->highVmin == CpuHighVminOfficial, ldr::ResultInvalidCpuMinVolt());
|
|
||||||
R_UNLESS(cpuCvbMeta->unkStepMaybe == 38, ldr::ResultInvalidCpuMinVolt());
|
|
||||||
R_UNLESS(cpuCvbMeta->vmax == CpuVoltOfficial, ldr::ResultInvalidCpuMinVolt());
|
|
||||||
R_UNLESS(cpuCvbMeta->unkScale2 == 1000, ldr::ResultInvalidCpuMinVolt());
|
|
||||||
R_UNLESS(cpuCvbMeta->speedoScale == 100, ldr::ResultInvalidCpuMinVolt());
|
|
||||||
R_UNLESS(cpuCvbMeta->voltageScale == 1000, ldr::ResultInvalidCpuMinVolt());
|
|
||||||
R_UNLESS(cpuCvbMeta->unkZero5 == 0, ldr::ResultInvalidCpuMinVolt());
|
|
||||||
|
|
||||||
if (C.marikoCpuLowVmin) {
|
|
||||||
PATCH_OFFSET(&(cpuCvbMeta->vmin), C.marikoCpuLowVmin);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (C.marikoCpuHighVmin) {
|
|
||||||
PATCH_OFFSET(&(cpuCvbMeta->highVmin), C.marikoCpuHighVmin);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (C.marikoCpuMaxVolt) {
|
|
||||||
PATCH_OFFSET(&(cpuCvbMeta->vmax), C.marikoCpuMaxVolt);
|
|
||||||
}
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result CpuVoltThermals(u32 *ptr) {
|
|
||||||
if (std::memcmp(ptr, cpuVoltThermalData, sizeof(cpuVoltThermalData))) {
|
|
||||||
R_THROW(ldr::ResultInvalidCpuMinVolt());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (C.marikoCpuLowVmin) {
|
|
||||||
PATCH_OFFSET(ptr, C.marikoCpuLowVmin);
|
|
||||||
PATCH_OFFSET(ptr + 3, C.marikoCpuLowVmin);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (C.marikoCpuMaxVolt) {
|
|
||||||
PATCH_OFFSET(ptr - 2, C.marikoCpuMaxVolt);
|
|
||||||
PATCH_OFFSET(ptr - 5, C.marikoCpuMaxVolt);
|
|
||||||
PATCH_OFFSET(ptr + 1, C.marikoCpuMaxVolt);
|
|
||||||
PATCH_OFFSET(ptr + 4, C.marikoCpuMaxVolt);
|
|
||||||
}
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result CpuVoltDfll(u32 *ptr) {
|
|
||||||
CvbCpuDfllData *entry = reinterpret_cast<CvbCpuDfllData *>(ptr);
|
|
||||||
|
|
||||||
R_UNLESS(entry->tune0_low == 0xFFCF, ldr::ResultInvalidCpuVoltDfllEntry());
|
|
||||||
R_UNLESS(entry->tune0_high == 0x0, ldr::ResultInvalidCpuVoltDfllEntry());
|
|
||||||
R_UNLESS(entry->tune1_low == 0x12207FF, ldr::ResultInvalidCpuVoltDfllEntry());
|
|
||||||
R_UNLESS(entry->tune1_high == 0x3FFF7FF, ldr::ResultInvalidCpuVoltDfllEntry());
|
|
||||||
|
|
||||||
switch (C.marikoCpuUVLow) {
|
|
||||||
case 1:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_low), 0xffa0);
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xffff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_low), 0x21107ff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x0);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_low), 0x21107ff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27207ff);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_low), 0xffdf);
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_low), 0x21107ff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27307ff);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_low), 0xffff);
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_low), 0x21107ff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27407ff);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_low), 0x21607ff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27707ff);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_low), 0x21607ff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27807ff);
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_low), 0x21607ff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27b07ff);
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_low), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_low), 0x21707ff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27b07ff);
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_low), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_low), 0x21707ff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27c07ff);
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_low), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_low), 0x21707ff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27d07ff);
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_low), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_low), 0x21707ff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27e07ff);
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_low), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_low), 0x21707ff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27f07ff);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (C.marikoCpuUVHigh) {
|
|
||||||
case 1:
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x0);
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xffff);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27207ff);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27307ff);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27407ff);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27707ff);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27807ff);
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
case 8:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27b07ff);
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27c07ff);
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27d07ff);
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27e07ff);
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27f07ff);
|
|
||||||
break;
|
|
||||||
case 13:
|
|
||||||
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
|
||||||
PATCH_OFFSET(&(entry->tune1_high), 0x27FF7FF);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Little helper for ORR:LSL pairs which are found in here */
|
|
||||||
inline bool IsOrrLsl(u32 w) {
|
|
||||||
if (!_asm::IsOp(w, _asm::op::OrrShifted32, _asm::field::Rd, _asm::field::Rn, _asm::field::Rm, _asm::field::Shift, _asm::field::Imm6))
|
|
||||||
return false;
|
|
||||||
return _asm::Get(w, _asm::field::Shift) == 0; /* 0=LSL, 1=LSR, 2=ASR, 3=ROR */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Probably overcomplicated but I wanted to have a rock-solid way to do this regardless of FW version */
|
|
||||||
Result CpuLutMaxAsm(u32* ptr) {
|
|
||||||
/* Check for the dual ORR-LSL pairs*/
|
|
||||||
R_UNLESS(IsOrrLsl(ptr[2]), ldr::ResultInvalidCpuLutMaxAsmPattern());
|
|
||||||
R_UNLESS(IsOrrLsl(ptr[3]), ldr::ResultInvalidCpuLutMaxAsmPattern());
|
|
||||||
/* We can safely assume that we are in the right place now */
|
|
||||||
|
|
||||||
/* Safety check */
|
|
||||||
R_UNLESS(ptr - 10 >= nsoStart, ldr::ResultInvalidCpuLutMaxAsmPattern());
|
|
||||||
|
|
||||||
/* Search for the STRB */
|
|
||||||
u32* strb = _asm::ScanAssembly(ptr - 10, 10, _asm::Encode(_asm::op::StrbImm,
|
|
||||||
{_asm::field::Rt, 0}, {_asm::field::Rn, 0}, {_asm::field::Off1, 0x25D}), _asm::field::Rt,
|
|
||||||
_asm::field::Rn);
|
|
||||||
R_UNLESS(strb != nullptr, ldr::ResultInvalidCpuLutMaxAsmPattern());
|
|
||||||
|
|
||||||
/* Probably a cleaner way to do this?*/
|
|
||||||
u32 *prod = strb + 2;
|
|
||||||
const u32 rd = _asm::Get(*prod, _asm::field::Rd);
|
|
||||||
if (_asm::IsOp(*prod, _asm::op::Ubfm32, _asm::field::Rd, _asm::field::Rn, _asm::field::Immr, _asm::field::Imm6)) {
|
|
||||||
/* replacement must carry LSL#16 to make up for ubfiz's remoal */
|
|
||||||
const u32 nw = _asm::Encode(_asm::op::MovzW, {_asm::field::Rd, rd}, {_asm::field::Imm16, 0x3F}, {_asm::field::Hw, 1});
|
|
||||||
PATCH_OFFSET(prod, nw); /* movz wD,#0x3F,LSL#16 */
|
|
||||||
} else {
|
|
||||||
/* Imm12 is 7 for 0xff*/
|
|
||||||
R_UNLESS(_asm::IsOp(*prod, _asm::op::AndImm32, _asm::field::Rd, _asm::field::Rn, _asm::field::Imm12) && _asm::Get(*prod, _asm::field::Imm12) == 7, ldr::ResultInvalidCpuLutMaxAsmPattern());
|
|
||||||
/* No need to do the lsl */
|
|
||||||
const u32 nw = _asm::Encode(_asm::op::MovzW, {_asm::field::Rd, rd}, {_asm::field::Imm16, 0x3F});
|
|
||||||
PATCH_OFFSET(prod, nw); /* movz wD,#0x3F */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set SAFE to entry 32 */
|
|
||||||
PATCH_OFFSET(ptr + 1, _asm::Encode(_asm::op::MovzW, {_asm::field::Rd, _asm::Get(ptr[1], _asm::field::Rd)}, {_asm::field::Imm16, 32}));
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
struct {
|
|
||||||
u32 *site = nullptr; /* LUT writer prologue. */
|
|
||||||
} lutWriterCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
HOOK_PAYLOAD_FN void CpuLutWriterExpandImpl(u64 param) {
|
|
||||||
HookPayloadData *data = HOOK_PAYLOAD_PTR(HookPayloadData, m_HookPayloadData);
|
|
||||||
reinterpret_cast<void (*)(u64)>(data->lut64.orig)(param);
|
|
||||||
|
|
||||||
/* *(param+8) = CLDVFS mapping */
|
|
||||||
const u64 base = *reinterpret_cast<u64 *>(param + 8);
|
|
||||||
u32 *lut = reinterpret_cast<u32 *>(base + 0x200);
|
|
||||||
|
|
||||||
for (u32 i = 0; i < ClDvfsLutSize; ++i) {
|
|
||||||
lut[i] = data->lut64.table[i];
|
|
||||||
}
|
|
||||||
__asm__ volatile("dsb st" ::: "memory");
|
|
||||||
}
|
|
||||||
|
|
||||||
Result LutWriterFind(u32 *ptr) {
|
|
||||||
R_UNLESS(LutWriterPatternFn(ptr), ldr::ResultInvalidCpuLutHook());
|
|
||||||
|
|
||||||
u32 *prog = _asm::FindFnPrologue(ptr, 140, nsoStart);
|
|
||||||
R_UNLESS(prog != nullptr, ldr::ResultInvalidCpuLutHook());
|
|
||||||
|
|
||||||
/* Prolouge must hold MMIO base, so obtain it. */
|
|
||||||
bool ok = false;
|
|
||||||
for (u32 i = 0; i < 8; ++i) {
|
|
||||||
if (_asm::IsOp(prog[i], _asm::op::LdrImm64, _asm::field::Rt, _asm::field::Rn, _asm::field::Off8)
|
|
||||||
&& _asm::Get(prog[i], _asm::field::Rn) == 0
|
|
||||||
&& _asm::Get(prog[i], _asm::field::Off8) == 0x8) {
|
|
||||||
ok = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
R_UNLESS(ok, ldr::ResultInvalidCpuLutHook());
|
|
||||||
lutWriterCache.site = prog;
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result LutWriterInstallHooks(HookPayloadData *data) {
|
|
||||||
R_UNLESS(lutWriterCache.site != nullptr, ldr::ResultInvalidCpuLutHook());
|
|
||||||
|
|
||||||
R_TRY(FillLutTable(data));
|
|
||||||
|
|
||||||
uintptr_t orig = 0;
|
|
||||||
R_TRY(INSTALL_IMPL_HOOK_ORIG(lutWriterCache.site, CpuLutWriterExpandImpl, &orig));
|
|
||||||
data->lut64.orig = orig;
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result CpuLutMaxAsm2(u32* ptr) {
|
|
||||||
/* movk w?,#0xFFC0,LSL#16 */
|
|
||||||
R_UNLESS(_asm::IsOp(ptr[1], _asm::op::MovkW, _asm::field::Rd, _asm::field::Imm16, _asm::field::Hw)
|
|
||||||
&& _asm::Get(ptr[1], _asm::field::Imm16) == 0xFFC0
|
|
||||||
&& _asm::Get(ptr[1], _asm::field::Hw) == 1, ldr::ResultInvalidCpuLutMaxAsmPattern());
|
|
||||||
|
|
||||||
/* and x, x, #0xff */
|
|
||||||
R_UNLESS(_asm::IsOp(ptr[2], _asm::op::AndImm32, _asm::field::Rd, _asm::field::Rn, _asm::field::Imm12) ||
|
|
||||||
_asm::Get(ptr[2], _asm::field::Imm12) != 7, ldr::ResultInvalidCpuLutMaxAsmPattern());
|
|
||||||
|
|
||||||
const u32 rd = _asm::Get(ptr[2], _asm::field::Rd);
|
|
||||||
PATCH_OFFSET(ptr + 2, _asm::Encode(_asm::op::MovzW, {_asm::field::Rd, rd}, {_asm::field::Imm16, 0x3F})); /* movz wD,#0x3F */
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* FW 20.4.0
|
|
||||||
71000571dc 01 01 00 d0 adrp param_2=>aCldvfssetdvcor,aSSRequestedDKh+0x1f = "ClDvfsSetDvcoRateMin"
|
|
||||||
= " %s divider %#x diff %d\n"
|
|
||||||
71000571e0 21 40 27 91 add param_2=>aCldvfssetdvcor,param_2,#0x9d0 = "ClDvfsSetDvcoRateMin"
|
|
||||||
71000571e4 c3 9f ff 97 bl nn::pcv::NvLog undefined NvLog(char * fmt, ...)
|
|
||||||
loc_71000571E8 XREF[1]: 71000571b4(j)
|
|
||||||
71000571e8 69 aa 42 a9 ldp x9,x10,[x19, #0x28]
|
|
||||||
71000571ec 4a fd 41 d3 lsr x10,x10,#0x1
|
|
||||||
71000571f0 68 26 41 f9 ldr x8,[x19, #0x248] Anchor
|
|
||||||
71000571f4 0b 0d 0a cb sub x11,x8,x10, LSL #0x3 Target
|
|
||||||
71000571f8 6b 4e 01 f9 str x11,[x19, #0x298] Verify1
|
|
||||||
71000571fc 2c 0d 40 f9 ldr x12,[x9, #0x18] Verify2
|
|
||||||
7100057200 7f 01 0c eb cmp x11,x12
|
|
||||||
7100057204 6b 81 8c 9a csel x11,x11,x12,hi
|
|
||||||
7100057208 6b 4e 01 f9 str x11,[x19, #0x298]
|
|
||||||
710005720c 2b c9 40 f9 ldr x11,[x9, #0x190]
|
|
||||||
7100057210 6b 52 01 f9 str x11,[x19, #0x2a0]
|
|
||||||
7100057214 8b 00 00 b4 cbz x11,loc_7100057224
|
|
||||||
7100057218 f4 4f 41 a9 ldp x20,x19,[sp, #local_10]
|
|
||||||
710005721c fd 7b c2 a8 ldp x29=>local_20,x30,[sp], #0x20
|
|
||||||
7100057220 c0 03 5f d6 ret
|
|
||||||
loc_7100057224 XREF[1]: 7100057214(j)
|
|
||||||
7100057224 08 15 0a 8b add x8,x8,x10, LSL #0x5 Target
|
|
||||||
7100057228 2a 55 81 b9 ldrsw x10,[x9, #0x154] Anchor
|
|
||||||
710005722c 68 52 01 f9 str x8,[x19, #0x2a0] Verify1
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
Result CpuLutDvcoRateCfg(u32* ptr) {
|
|
||||||
/* Anchor via scanning to prevent ordering issues */
|
|
||||||
u32 *sub = _asm::ScanAssembly(ptr + 1, 4,
|
|
||||||
_asm::Encode(_asm::op::SubShifted64, {_asm::field::Rd, 0}, {_asm::field::Rn, 0}, {_asm::field::Rm, 0},
|
|
||||||
{_asm::field::Shift, 0}, {_asm::field::Imm6, 3}),
|
|
||||||
_asm::field::Rd, _asm::field::Rn, _asm::field::Rm);
|
|
||||||
R_UNLESS(sub != nullptr, ldr::ResultInvalidDvcoRateConfig());
|
|
||||||
|
|
||||||
/* Verify */
|
|
||||||
R_UNLESS(_asm::IsOp(sub[1], _asm::op::StrImm64, _asm::field::Rt, _asm::field::Rn, _asm::field::Off8)
|
|
||||||
&& _asm::Get(sub[1], _asm::field::Off8) == 0x298, ldr::ResultInvalidDvcoRateConfig());
|
|
||||||
|
|
||||||
/* 22.x uses pre-index ldr x?,[x?,#0x18]! here (0xF8418D6D class). */
|
|
||||||
const bool isLdr18 = _asm::IsOp(sub[2], _asm::op::LdrImm64, _asm::field::Rt, _asm::field::Rn, _asm::field::Off8)
|
|
||||||
&& _asm::Get(sub[2], _asm::field::Off8) == 0x18;
|
|
||||||
const bool isLdrPre18 = _asm::IsOp(sub[2], _asm::op::LdrPreImm64, _asm::field::Rt, _asm::field::Rn, _asm::field::Imm9)
|
|
||||||
&& _asm::Get(sub[2], _asm::field::Imm9) == 0x18;
|
|
||||||
R_UNLESS(isLdr18 || isLdrPre18, ldr::ResultInvalidDvcoRateConfig());
|
|
||||||
|
|
||||||
/* Patch the target */
|
|
||||||
PATCH_OFFSET(sub, _asm::Encode(_asm::op::SubShifted64,
|
|
||||||
{_asm::field::Rd, _asm::Get(*sub, _asm::field::Rd)},
|
|
||||||
{_asm::field::Rn, _asm::Get(*sub, _asm::field::Rn)},
|
|
||||||
{_asm::field::Rm, _asm::Get(*sub, _asm::field::Rm)},
|
|
||||||
{_asm::field::Shift, 0}, {_asm::field::Imm6, 4}));
|
|
||||||
|
|
||||||
/* Search for the second anchor */
|
|
||||||
u32* ldrsw = _asm::ScanAssembly(sub, 20,
|
|
||||||
_asm::Encode(_asm::op::LdrsWImm64, {_asm::field::Rt, 0}, {_asm::field::Rn, 0}, {_asm::field::Off4, 0x154}),
|
|
||||||
_asm::field::Rt, _asm::field::Rn);
|
|
||||||
|
|
||||||
R_UNLESS(ldrsw != nullptr, ldr::ResultInvalidDvcoRateConfig());
|
|
||||||
|
|
||||||
/* Validate the str #0x2a0 */
|
|
||||||
auto isCorrectStr = [](u32 w) {
|
|
||||||
return _asm::IsOp(w, _asm::op::StrImm64, _asm::field::Rt, _asm::field::Rn, _asm::field::Off8)
|
|
||||||
&& _asm::Get(w, _asm::field::Off8) == 0x2a0;
|
|
||||||
};
|
|
||||||
R_UNLESS(isCorrectStr(ldrsw[1]) || isCorrectStr(ldrsw[2]), ldr::ResultInvalidDvcoRateConfig());
|
|
||||||
|
|
||||||
/* Validate the target in both directuins */
|
|
||||||
/* Due to codegen difference */
|
|
||||||
u32 *add = nullptr;
|
|
||||||
if (_asm::IsOp(ldrsw[-1], _asm::op::AddShifted64, _asm::field::Rd, _asm::field::Rn, _asm::field::Rm, _asm::field::Shift, _asm::field::Imm6)
|
|
||||||
&& _asm::Get(ldrsw[-1], _asm::field::Shift) == 0
|
|
||||||
&& _asm::Get(ldrsw[-1], _asm::field::Imm6) == 5) {
|
|
||||||
add = ldrsw - 1;
|
|
||||||
}
|
|
||||||
else if (_asm::IsOp(ldrsw[1], _asm::op::AddShifted64, _asm::field::Rd, _asm::field::Rn, _asm::field::Rm, _asm::field::Shift, _asm::field::Imm6)
|
|
||||||
&& _asm::Get(ldrsw[1], _asm::field::Shift) == 0
|
|
||||||
&& _asm::Get(ldrsw[1], _asm::field::Imm6) == 5) {
|
|
||||||
add = ldrsw + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
R_UNLESS(add != nullptr, ldr::ResultInvalidDvcoRateConfig());
|
|
||||||
|
|
||||||
/* Patch the second target */
|
|
||||||
PATCH_OFFSET(add, _asm::Encode(_asm::op::AddShifted64,
|
|
||||||
{_asm::field::Rd, _asm::Get(*add, _asm::field::Rd)},
|
|
||||||
{_asm::field::Rn, _asm::Get(*add, _asm::field::Rn)},
|
|
||||||
{_asm::field::Rm, _asm::Get(*add, _asm::field::Rm)},
|
|
||||||
{_asm::field::Shift, 0}, {_asm::field::Imm6, 6}));
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Switch-OC-Suite
|
|
||||||
*
|
|
||||||
* Copyright (c) 2023 hanai3Bi
|
|
||||||
*
|
|
||||||
* Copyright (c) B3711
|
|
||||||
*
|
|
||||||
* Copyright (c) Souldbminer, Lightos and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "../pcv.hpp"
|
|
||||||
#include "../pcv_asm.hpp"
|
|
||||||
#include "../pcv_hook.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::mariko {
|
|
||||||
|
|
||||||
extern u32 *nsoStart;
|
|
||||||
|
|
||||||
/* Maybe a cleaner way to do this? */
|
|
||||||
inline bool LutWriterPatternFn(u32 *ptr) {
|
|
||||||
if (_asm::IsOp(*ptr, _asm::op::AndImm64, _asm::field::Rd, _asm::field::Rn, _asm::field::Immr, _asm::field::Imm6)
|
|
||||||
&& _asm::Get(*ptr, _asm::field::Immr) == 61 && _asm::Get(*ptr, _asm::field::Imm6) == 7)
|
|
||||||
return true;
|
|
||||||
if (_asm::IsOp(*ptr, _asm::op::AndImm32, _asm::field::Rd, _asm::field::Rn, _asm::field::Imm12)
|
|
||||||
&& _asm::Get(*ptr, _asm::field::Imm12) == 0x747)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
HOOK_PAYLOAD_FN void CpuLutWriterExpandImpl(u64 param);
|
|
||||||
Result LutWriterFind(u32 *ptr);
|
|
||||||
Result LutWriterInstallHooks(HookPayloadData *data);
|
|
||||||
|
|
||||||
constexpr cvb_entry_t CpuCvbTableDefault[] = {
|
|
||||||
{ 204000, { 721589, -12695, 27 }, { } },
|
|
||||||
{ 306000, { 747134, -14195, 27 }, { } },
|
|
||||||
{ 408000, { 776324, -15705, 27 }, { } },
|
|
||||||
{ 510000, { 809160, -17205, 27 }, { } },
|
|
||||||
{ 612000, { 845641, -18715, 27 }, { } },
|
|
||||||
{ 714000, { 885768, -20215, 27 }, { } },
|
|
||||||
{ 816000, { 929540, -21725, 27 }, { } },
|
|
||||||
{ 918000, { 976958, -23225, 27 }, { } },
|
|
||||||
{ 1020000, { 1028021, -24725, 27 }, { 1120000 } },
|
|
||||||
{ 1122000, { 1082730, -26235, 27 }, { 1120000 } },
|
|
||||||
{ 1224000, { 1141084, -27735, 27 }, { 1120000 } },
|
|
||||||
{ 1326000, { 1203084, -29245, 27 }, { 1120000 } },
|
|
||||||
{ 1428000, { 1268729, -30745, 27 }, { 1120000 } },
|
|
||||||
{ 1581000, { 1374032, -33005, 27 }, { 1120000 } },
|
|
||||||
{ 1683000, { 1448791, -34505, 27 }, { 1120000 } },
|
|
||||||
{ 1785000, { 1527196, -36015, 27 }, { 1120000 } },
|
|
||||||
{ 1887000, { 1609246, -37515, 27 }, { 1120000 } },
|
|
||||||
{ 1963500, { 1675751, -38635, 27 }, { 1120000 } },
|
|
||||||
{ },
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr u32 CpuClkOfficial = 1963'500;
|
|
||||||
constexpr u32 CpuVoltOfficial = 1120;
|
|
||||||
constexpr u32 CpuHighVminOfficial = 850;
|
|
||||||
constexpr u32 CpuVminOfficial = 620;
|
|
||||||
constexpr u32 CpuTune0Low = 0xFFCF;
|
|
||||||
|
|
||||||
static const u32 cpuVoltagePatchValues[] = { 850, 38, 1120, 1000, 100, 1000, 0 };
|
|
||||||
static const s32 cpuVoltagePatchOffsets[] = { -2, -1, 5, 6, 7, 8, 9 };
|
|
||||||
static_assert(sizeof(cpuVoltagePatchValues) == sizeof(cpuVoltagePatchOffsets), "Invalid cpuVoltagePatch size");
|
|
||||||
|
|
||||||
static const u32 cpuVoltThermalData[] = { 620, 1120, 20000, 620, 1120, 70000, 950, 1132, 0, 950, 1227, 0 };
|
|
||||||
|
|
||||||
/* Refer to customize.cpp for more information */
|
|
||||||
static const u32 allowedCpuMaxFrequencies[] = { 1'963'500, 2'091'000, 2'193'000, 2'295'000, 2'397'000, 2'499'000, 2'601'000, 2'703'000, 2'805'000 };
|
|
||||||
|
|
||||||
Result CpuFreqVdd(u32 *ptr);
|
|
||||||
Result CpuVoltDVFS(u32 *ptr);
|
|
||||||
Result CpuVoltThermals(u32 *ptr);
|
|
||||||
Result CpuVoltDfll(u32 *ptr);
|
|
||||||
Result CpuLutMaxAsm(u32* ptr);
|
|
||||||
Result CpuLutMaxAsm2(u32* ptr);
|
|
||||||
Result CpuLutDvcoRateCfg(u32* ptr);
|
|
||||||
|
|
||||||
ALWAYS_INLINE bool CpuLutAsmPatternFn(u32* ptr) {
|
|
||||||
/* Check if it is a DSB ST, a common indication of CL-DVFS related functions */
|
|
||||||
return *ptr == _asm::Dsb(_asm::barrier::St);
|
|
||||||
}
|
|
||||||
|
|
||||||
ALWAYS_INLINE bool CpuLutAsmPatternFn2(u32* ptr) {
|
|
||||||
/* Note: We are doing multiple checks here as it is the cleanest method */
|
|
||||||
return _asm::IsOp(*ptr, _asm::op::MovzW, _asm::field::Rd, _asm::field::Imm16, _asm::field::Hw)
|
|
||||||
&& _asm::Get(*ptr, _asm::field::Imm16) == 0xC0FF
|
|
||||||
&& _asm::Get(*ptr, _asm::field::Hw) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ALWAYS_INLINE bool CpuLutDvcoRateCfgPatternFn(u32* ptr) {
|
|
||||||
/* Again, cleaner to ensure we are on the correct instruction here */
|
|
||||||
return _asm::IsOp(*ptr, _asm::op::LdrImm64, _asm::field::Rt, _asm::field::Rn, _asm::field::Off8)
|
|
||||||
&& _asm::Get(*ptr, _asm::field::Off8) == 0x248;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,150 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Switch-OC-Suite
|
|
||||||
*
|
|
||||||
* Copyright (c) 2023 hanai3Bi
|
|
||||||
*
|
|
||||||
* Copyright (c) B3711
|
|
||||||
*
|
|
||||||
* Copyright (c) Souldbminer, Lightos and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../pcv.hpp"
|
|
||||||
#include "../pcv_asm.hpp"
|
|
||||||
#include "pcv_mariko_gpu.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::mariko {
|
|
||||||
|
|
||||||
Result GpuVoltDVFS(u32 *ptr) {
|
|
||||||
/* Check for valid pattern. */
|
|
||||||
for (size_t i = 0; i < std::size(gpuDVFSPattern); ++i) {
|
|
||||||
if (*(ptr + i + 1) != gpuDVFSPattern[i]) {
|
|
||||||
R_THROW(ldr::ResultInvalidGpuDvfs());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Default value is 1050mV. */
|
|
||||||
if (C.marikoGpuVmax) {
|
|
||||||
PATCH_OFFSET(ptr + 1, C.marikoGpuVmax);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (C.marikoGpuVmin) {
|
|
||||||
PATCH_OFFSET(ptr, C.marikoGpuVmin);
|
|
||||||
}
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result GpuVoltThermals(u32 *ptr) {
|
|
||||||
if (std::memcmp(ptr - 3, gpuVoltThermalPattern, sizeof(gpuVoltThermalPattern))) {
|
|
||||||
R_THROW(ldr::ResultInvalidGpuDvfs());
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (C.marikoGpuBootVolt) {
|
|
||||||
// PATCH_OFFSET(ptr - 3, C.marikoGpuBootVolt);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (C.marikoGpuVmin) {
|
|
||||||
PATCH_OFFSET(ptr, C.marikoGpuVmin);
|
|
||||||
PATCH_OFFSET(ptr + 3, C.marikoGpuVmin);
|
|
||||||
PATCH_OFFSET(ptr + 6, C.marikoGpuVmin);
|
|
||||||
PATCH_OFFSET(ptr + 9, C.marikoGpuVmin);
|
|
||||||
PATCH_OFFSET(ptr + 12, C.marikoGpuVmin);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (C.marikoGpuVmax) {
|
|
||||||
// PATCH_OFFSET(ptr - 2, C.marikoGpuVmax);
|
|
||||||
// PATCH_OFFSET(ptr + 1, C.marikoGpuVmax);
|
|
||||||
// PATCH_OFFSET(ptr + 4, C.marikoGpuVmax);
|
|
||||||
// PATCH_OFFSET(ptr + 7, C.marikoGpuVmax);
|
|
||||||
// PATCH_OFFSET(ptr + 10, C.marikoGpuVmax);
|
|
||||||
// PATCH_OFFSET(ptr + 13, C.marikoGpuVmax);
|
|
||||||
// }
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result GpuFreqMaxAsm(u32 *ptr32) {
|
|
||||||
// Check if both two instructions match the pattern
|
|
||||||
u32 ins1 = *ptr32, ins2 = *(ptr32 + 1);
|
|
||||||
if (!(_asm::Ignoring(ins1, GpuAsmPattern[0], _asm::field::Rd) && _asm::Ignoring(ins2, GpuAsmPattern[1], _asm::field::Rd))) {
|
|
||||||
R_THROW(ldr::ResultInvalidGpuFreqMaxPattern());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Both instructions should operate on the same register
|
|
||||||
u8 rd = _asm::Get(ins1, _asm::field::Rd);
|
|
||||||
if (rd != _asm::Get(ins2, _asm::field::Rd)) {
|
|
||||||
R_THROW(ldr::ResultInvalidGpuFreqMaxPattern());
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 max_clock;
|
|
||||||
switch (C.marikoGpuUV) {
|
|
||||||
case 0:
|
|
||||||
max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableSLT)->freq;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT15)->freq;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableHighUV)->freq;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 asm_patch[2] = {
|
|
||||||
_asm::Encode(_asm::op::MovzW, {_asm::field::Rd, rd}, {_asm::field::Imm16, max_clock}),
|
|
||||||
_asm::Encode(_asm::op::MovkW, {_asm::field::Rd, rd}, {_asm::field::Imm16, max_clock >> 16}, {_asm::field::Hw, 1})
|
|
||||||
};
|
|
||||||
|
|
||||||
PATCH_OFFSET(ptr32, asm_patch[0]);
|
|
||||||
PATCH_OFFSET(ptr32 + 1, asm_patch[1]);
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result GpuFreqPllMax(u32 *ptr) {
|
|
||||||
clk_pll_param *entry = reinterpret_cast<clk_pll_param *>(ptr);
|
|
||||||
|
|
||||||
// All zero except for freq
|
|
||||||
for (size_t i = 1; i < sizeof(clk_pll_param) / sizeof(u32); i++) {
|
|
||||||
R_UNLESS(*(ptr + i) == 0, ldr::ResultInvalidGpuPllEntry());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Double the max clk simply
|
|
||||||
u32 max_clk = entry->freq * 2;
|
|
||||||
entry->freq = max_clk;
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result GpuFreqPllLimit(u32 *ptr) {
|
|
||||||
u32 prev_freq = *(ptr - 1);
|
|
||||||
|
|
||||||
if (prev_freq != 128000 && prev_freq != 1300000 && prev_freq != 76800) {
|
|
||||||
R_THROW(ldr::ResultInvalidGpuPllEntry());
|
|
||||||
}
|
|
||||||
|
|
||||||
PATCH_OFFSET(ptr, 3600000);
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Switch-OC-Suite
|
|
||||||
*
|
|
||||||
* Copyright (c) 2023 hanai3Bi
|
|
||||||
*
|
|
||||||
* Copyright (c) B3711
|
|
||||||
*
|
|
||||||
* Copyright (c) Souldbminer, Lightos and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "../pcv.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::mariko {
|
|
||||||
|
|
||||||
constexpr cvb_entry_t GpuCvbTableDefault[] = {
|
|
||||||
// GPUB01_NA_CVB_TABLE
|
|
||||||
{ 76800, {}, { 610000, } },
|
|
||||||
{ 153600, {}, { 610000, } },
|
|
||||||
{ 230400, {}, { 610000, } },
|
|
||||||
{ 307200, {}, { 610000, } },
|
|
||||||
{ 384000, {}, { 610000, } },
|
|
||||||
{ 460800, {}, { 610000, } },
|
|
||||||
{ 537600, {}, { 801688, -10900, -163, 298, -10599, 162, } },
|
|
||||||
{ 614400, {}, { 824214, -5743, -452, 238, -6325, 81, } },
|
|
||||||
{ 691200, {}, { 848830, -3903, -552, 119, -4030, -2, } },
|
|
||||||
{ 768000, {}, { 891575, -4409, -584, 0, -2849, 39, } },
|
|
||||||
{ 844800, {}, { 940071, -5367, -602, -60, -63, -93, } },
|
|
||||||
{ 921600, {}, { 986765, -6637, -614, -179, 1905, -13, } },
|
|
||||||
{ 998400, {}, { 1098475, -13529, -497, -179, 3626, 9, } },
|
|
||||||
{ 1075200, {}, { 1163644, -12688, -648, 0, 1077, 40, } },
|
|
||||||
{ 1152000, {}, { 1204812, -9908, -830, 0, 1469, 110, } },
|
|
||||||
{ 1228800, {}, { 1277303, -11675, -859, 0, 3722, 313, } },
|
|
||||||
{ 1267200, {}, { 1335531, -12567, -867, 0, 3681, 559, } },
|
|
||||||
{ },
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr u32 GpuClkPllMax = 1300'000'000;
|
|
||||||
constexpr u32 GpuClkPllLimit = 2'600'000;
|
|
||||||
constexpr u32 GpuVminOfficial = 610;
|
|
||||||
|
|
||||||
static const u32 gpuDVFSPattern[] = { 1050, 1000, 100, 1000, 10, };
|
|
||||||
static const u32 gpuVoltThermalPattern[] = { 800, 1120, 0, 610, 1120, 20000, 610, 1120, 30000, 610, 1120, 50000, 610, 1120, 70000, 610, 1120, 90000, };
|
|
||||||
static_assert(sizeof(gpuVoltThermalPattern) == 72, "Invalid gpuVoltThermalPattern");
|
|
||||||
|
|
||||||
/* GPU Max Clock asm Pattern:
|
|
||||||
*
|
|
||||||
* MOV W11, #0x1000 MOV (wide immediate) 0x1000 0xB (11)
|
|
||||||
* sf | opc | | hw | imm16 | Rd
|
|
||||||
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
|
||||||
* 0 | 1 0 | 1 0 0 1 0 1| 0 0| 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 |0 1 0 1 1
|
|
||||||
*
|
|
||||||
* MOVK W11, #0xE, LSL#16 <shift>16 0xE 0xB (11)
|
|
||||||
* sf | opc | | hw | imm16 | Rd
|
|
||||||
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
|
||||||
* 0 | 1 1 | 1 0 0 1 0 1| 0 1| 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 |0 1 0 1 1
|
|
||||||
*/
|
|
||||||
inline constexpr u32 GpuAsmPattern[] = { 0x52820000, 0x72A001C0 };
|
|
||||||
|
|
||||||
inline bool GpuMaxClockPatternFn(u32 *ptr32) {
|
|
||||||
return _asm::Ignoring(*ptr32, GpuAsmPattern[0], _asm::field::Rd);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result GpuVoltDVFS(u32 *ptr);
|
|
||||||
Result GpuVoltThermals(u32 *ptr);
|
|
||||||
Result GpuFreqMaxAsm(u32 *ptr32);
|
|
||||||
Result GpuFreqPllMax(u32 *ptr);
|
|
||||||
Result GpuFreqPllLimit(u32 *ptr);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,239 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Souldbminer, Lightos and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../pcv.hpp"
|
|
||||||
#include "pcv_mariko_log.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::mariko {
|
|
||||||
|
|
||||||
/* Todo: Remove this bs. */
|
|
||||||
[[maybe_unused]] static uintptr_t CaveReserve(size_t count) {
|
|
||||||
return reinterpret_cast<uintptr_t>(Hooks().Reserve(count));
|
|
||||||
}
|
|
||||||
|
|
||||||
#if HOC_UART_LOG
|
|
||||||
namespace {
|
|
||||||
struct {
|
|
||||||
uintptr_t vsnprintf_addr = 0;
|
|
||||||
uintptr_t nvlog_addr = 0;
|
|
||||||
} nvLogCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result NvLogUartRedirect(u32 *ptr) {
|
|
||||||
const uintptr_t mapped_nso = reinterpret_cast<uintptr_t>(nsoStart);
|
|
||||||
const size_t nso_size = g_nso_size;
|
|
||||||
const uintptr_t textEnd = g_pcv_cave; /* .text ends where the cave begins */
|
|
||||||
const uintptr_t vsnprintf_addr = reinterpret_cast<uintptr_t>(ptr);
|
|
||||||
|
|
||||||
{
|
|
||||||
using namespace _asm::field;
|
|
||||||
R_UNLESS(_asm::Ignoring(ptr[1], NvLogStpFpLrAsm, PairOff8), ldr::ResultInvalidNvLogRedirect()); /* stp x29,x30,[sp,#imm] */
|
|
||||||
R_UNLESS(_asm::Ignoring(ptr[2], NvLogStrSpillAsm, Rt, Off8), ldr::ResultInvalidNvLogRedirect()); /* str x?,[sp,#imm] */
|
|
||||||
R_UNLESS(_asm::Ignoring(ptr[3], NvLogMovFpAsm, Imm12), ldr::ResultInvalidNvLogRedirect()); /* add x29,sp,#imm */
|
|
||||||
R_UNLESS(ptr[4] == NvLogCmpSizeAsm, ldr::ResultInvalidNvLogRedirect()); /* cmp x1,#0 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* NvLog via the VDD_SOC log */
|
|
||||||
static const char Fmt[] = "%s(%s): DVFS request VDD_SOC %d mV\n";
|
|
||||||
constexpr size_t FmtLen = sizeof(Fmt) - 1;
|
|
||||||
uintptr_t strAddr = 0;
|
|
||||||
{
|
|
||||||
const char *hay = reinterpret_cast<const char *>(mapped_nso);
|
|
||||||
for (size_t i = 0; i + FmtLen <= nso_size; ++i) {
|
|
||||||
if (std::memcmp(hay + i, Fmt, FmtLen) == 0) { strAddr = mapped_nso + i; break; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (strAddr == 0) {
|
|
||||||
LOGGING("NvLogRedirect: fmt string not found (vsnprintf@+%lx)", vsnprintf_addr - mapped_nso);
|
|
||||||
R_THROW(ldr::ResultInvalidNvLogRedirect());
|
|
||||||
}
|
|
||||||
|
|
||||||
uintptr_t nvlog_addr = 0;
|
|
||||||
for (u32 *p = nsoStart; reinterpret_cast<uintptr_t>(p + 2) <= textEnd; ++p) {
|
|
||||||
const uintptr_t pc = reinterpret_cast<uintptr_t>(p);
|
|
||||||
if (!_asm::IsOp(p[0], _asm::op::Adrp, _asm::field::Rd, _asm::field::ImmAdrpHi, _asm::field::ImmAdrpLo)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (_asm::TargetAdrp(p[0], pc) != (strAddr & ~static_cast<uintptr_t>(0xFFFu))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const u32 adrpReg = _asm::Get(p[0], _asm::field::Rd);
|
|
||||||
if (!(_asm::IsOp(p[1], _asm::op::AddImm64, _asm::field::Rd, _asm::field::Rn, _asm::field::Imm12)
|
|
||||||
&& _asm::Get(p[1], _asm::field::Rd) == adrpReg && _asm::Get(p[1], _asm::field::Rn) == adrpReg
|
|
||||||
&& _asm::Get(p[1], _asm::field::Imm12) == (strAddr & 0xFFFu))) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (u32 k = 2; k <= 12 && (pc + (k + 1) * 4) <= textEnd; ++k) {
|
|
||||||
if (_asm::IsOp(p[k], _asm::op::Bl, _asm::field::Imm26)) { nvlog_addr = _asm::Target26(p[k], pc + k * 4); break; }
|
|
||||||
}
|
|
||||||
if (nvlog_addr != 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nvlog_addr == 0 || nvlog_addr < mapped_nso || nvlog_addr >= textEnd) {
|
|
||||||
LOGGING("NvLogRedirect: NvLog entry not found (fmt@+%lx)", strAddr - mapped_nso);
|
|
||||||
R_THROW(ldr::ResultInvalidNvLogRedirect());
|
|
||||||
}
|
|
||||||
|
|
||||||
nvLogCache.vsnprintf_addr = vsnprintf_addr;
|
|
||||||
nvLogCache.nvlog_addr = nvlog_addr;
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
Result InstallNvLogRedirect() {
|
|
||||||
const uintptr_t mapped_nso = reinterpret_cast<uintptr_t>(nsoStart);
|
|
||||||
const uintptr_t textEnd = g_pcv_cave;
|
|
||||||
const uintptr_t vsnprintf_addr = nvLogCache.vsnprintf_addr;
|
|
||||||
const uintptr_t nvlog_addr = nvLogCache.nvlog_addr;
|
|
||||||
|
|
||||||
const uintptr_t helper = CaveReserve(40);
|
|
||||||
if (helper == 0) {
|
|
||||||
LOGGING("NvLogRedirect: cave unavailable (cave=%lx size=%lx)",
|
|
||||||
static_cast<unsigned long>(g_pcv_cave), static_cast<unsigned long>(g_pcv_cave_size));
|
|
||||||
R_THROW(ldr::ResultInvalidNvLogRedirect());
|
|
||||||
}
|
|
||||||
u32 *t = reinterpret_cast<u32 *>(helper);
|
|
||||||
size_t n = 0;
|
|
||||||
auto emit = [&](u32 ins) { t[n] = ins; ++n; };
|
|
||||||
|
|
||||||
using namespace _asm::field;
|
|
||||||
constexpr u32 SP = _asm::reg::Sp;
|
|
||||||
|
|
||||||
emit(_asm::Encode(_asm::op::SubImm64, {Rd, SP}, {Rn, SP}, {Imm12, 0x200}));
|
|
||||||
emit(_asm::Encode(_asm::op::StpImm64, {Rt, 0}, {Rt2, 1}, {Rn, SP}, {PairOff8, 0x100}));
|
|
||||||
emit(_asm::Encode(_asm::op::StpImm64, {Rt, 2}, {Rt2, 3}, {Rn, SP}, {PairOff8, 0x110}));
|
|
||||||
emit(_asm::Encode(_asm::op::StpImm64, {Rt, 4}, {Rt2, 5}, {Rn, SP}, {PairOff8, 0x120}));
|
|
||||||
emit(_asm::Encode(_asm::op::StpImm64, {Rt, 6}, {Rt2, 7}, {Rn, SP}, {PairOff8, 0x130}));
|
|
||||||
emit(_asm::Encode(_asm::op::StpImmQ, {Rt, 0}, {Rt2, 1}, {Rn, SP}, {PairOff16, 0x140}));
|
|
||||||
emit(_asm::Encode(_asm::op::StpImmQ, {Rt, 2}, {Rt2, 3}, {Rn, SP}, {PairOff16, 0x160}));
|
|
||||||
emit(_asm::Encode(_asm::op::StpImmQ, {Rt, 4}, {Rt2, 5}, {Rn, SP}, {PairOff16, 0x180}));
|
|
||||||
emit(_asm::Encode(_asm::op::StpImmQ, {Rt, 6}, {Rt2, 7}, {Rn, SP}, {PairOff16, 0x1A0}));
|
|
||||||
emit(_asm::Encode(_asm::op::StrImm64, {Rt, _asm::reg::Lr}, {Rn, SP}, {Off8, 0x1E0}));
|
|
||||||
emit(_asm::Encode(_asm::op::AddImm64, {Rd, 9}, {Rn, SP}, {Imm12, 0x200})); emit(_asm::Encode(_asm::op::StrImm64, {Rt, 9}, {Rn, SP}, {Off8, 0x1C0})); /* __stack */
|
|
||||||
emit(_asm::Encode(_asm::op::AddImm64, {Rd, 9}, {Rn, SP}, {Imm12, 0x140})); emit(_asm::Encode(_asm::op::StrImm64, {Rt, 9}, {Rn, SP}, {Off8, 0x1C8})); /* __gr_top */
|
|
||||||
emit(_asm::Encode(_asm::op::AddImm64, {Rd, 9}, {Rn, SP}, {Imm12, 0x1C0})); emit(_asm::Encode(_asm::op::StrImm64, {Rt, 9}, {Rn, SP}, {Off8, 0x1D0})); /* __vr_top */
|
|
||||||
emit(_asm::Encode(_asm::op::MovnW, {Rd, 9}, {Imm16, 0x37})); emit(_asm::Encode(_asm::op::StrImm32, {Rt, 9}, {Rn, SP}, {Off4, 0x1D8})); /* __gr_offs = -56 */
|
|
||||||
emit(_asm::Encode(_asm::op::MovnW, {Rd, 9}, {Imm16, 0x7F})); emit(_asm::Encode(_asm::op::StrImm32, {Rt, 9}, {Rn, SP}, {Off4, 0x1DC})); /* __vr_offs = -128 */
|
|
||||||
emit(_asm::Encode(_asm::op::AddImm64, {Rd, 0}, {Rn, SP}, {Imm12, 0x00})); /* mov x0,sp (buf) */
|
|
||||||
emit(_asm::Encode(_asm::op::MovzW, {Rd, 1}, {Imm16, 0x100})); /* size = 0x100 */
|
|
||||||
emit(_asm::Encode(_asm::op::LdrImm64, {Rt, 2}, {Rn, SP}, {Off8, 0x100})); /* fmt (saved x0) */
|
|
||||||
emit(_asm::Encode(_asm::op::AddImm64, {Rd, 3}, {Rn, SP}, {Imm12, 0x1C0})); /* ap */
|
|
||||||
emit(_asm::Retarget26(_asm::op::Bl, helper + n * 4, vsnprintf_addr));
|
|
||||||
emit(_asm::MovReg64(1, 0)); /* len = retval */
|
|
||||||
emit(_asm::CmpImm32(1, 0x100));
|
|
||||||
{ /* b.lo +2 */
|
|
||||||
const size_t at = n;
|
|
||||||
emit(_asm::Retarget19(_asm::Encode(_asm::op::BCond, {BCond, _asm::cond::Lo}), helper + at * 4, helper + (at + 2) * 4));
|
|
||||||
}
|
|
||||||
emit(_asm::Encode(_asm::op::MovzW, {Rd, 1}, {Imm16, 0xFF})); /* clamp len */
|
|
||||||
emit(_asm::Encode(_asm::op::AddImm64, {Rd, 0}, {Rn, SP}, {Imm12, 0x00})); /* mov x0,sp (str) */
|
|
||||||
emit(_asm::Encode(_asm::op::Svc, {Imm16, 0x27})); /* svcOutputDebugString */
|
|
||||||
emit(_asm::Encode(_asm::op::LdrImm64, {Rt, _asm::reg::Lr}, {Rn, SP}, {Off8, 0x1E0}));
|
|
||||||
emit(_asm::Encode(_asm::op::AddImm64, {Rd, SP}, {Rn, SP}, {Imm12, 0x200}));
|
|
||||||
emit(_asm::RetIns);
|
|
||||||
|
|
||||||
/* Redirect the call sites as patching the actual function causes crash */
|
|
||||||
const uintptr_t roStart = g_pcv_cave + g_pcv_cave_size; /* module .rodata start */
|
|
||||||
size_t patchedSites = 0;
|
|
||||||
for (u32 *p = nsoStart; reinterpret_cast<uintptr_t>(p + 1) <= textEnd; ++p) {
|
|
||||||
if (!_asm::IsOp(*p, _asm::op::Bl, _asm::field::Imm26)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const uintptr_t pc = reinterpret_cast<uintptr_t>(p);
|
|
||||||
if (_asm::Target26(*p, pc) != nvlog_addr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
bool isFmtCall = false;
|
|
||||||
for (u32 j = 1; j <= 8 && reinterpret_cast<uintptr_t>(p - j) >= reinterpret_cast<uintptr_t>(nsoStart); ++j) {
|
|
||||||
const u32 w = *(p - j);
|
|
||||||
if (_asm::IsOp(w, _asm::op::Adrp, _asm::field::Rd, _asm::field::ImmAdrpHi, _asm::field::ImmAdrpLo) && _asm::Get(w, _asm::field::Rd) == 0) { /* adrp x0,<page> */
|
|
||||||
const uintptr_t tgtPage = _asm::TargetAdrp(w, pc - j * 4);
|
|
||||||
if (tgtPage >= (roStart & ~static_cast<uintptr_t>(0xFFFu))) { isFmtCall = true; break; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isFmtCall) {
|
|
||||||
PATCH_OFFSET(p, _asm::Retarget26(_asm::op::Bl, pc, helper));
|
|
||||||
++patchedSites;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOGGING("NvLogRedirect: stub@+%lx vsnprintf@+%lx helper@+%lx instr=%zu sites=%zu", nvlog_addr - mapped_nso, vsnprintf_addr - mapped_nso, helper - mapped_nso, n, patchedSites);
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
struct {
|
|
||||||
u32 *sites[3] = {};
|
|
||||||
u32 count = 0;
|
|
||||||
} forceVerbosityCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
HOOK_PAYLOAD_FN u32 ForceVerbosityImpl() {
|
|
||||||
HookPayloadData *data = HOOK_PAYLOAD_PTR(HookPayloadData, m_HookPayloadData);
|
|
||||||
return data->verbosityLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Force GetEffectiveVerbosityLevel to return a non-zero level so all NvLog runs. */
|
|
||||||
Result ForceVerbosity(u32 *ptr) {
|
|
||||||
using namespace _asm::field;
|
|
||||||
|
|
||||||
R_UNLESS(_asm::IsOp(ptr[1], _asm::op::StrImm64, Rt, Rn, Off8) && _asm::Get(ptr[1], Rn) == _asm::reg::Sp,
|
|
||||||
ldr::ResultInvalidForceVerbosityPattern()); /* str x?,[sp,#imm] */
|
|
||||||
R_UNLESS(_asm::IsOp(ptr[2], _asm::op::AddImm64, Rd, Rn, Imm12)
|
|
||||||
&& _asm::Get(ptr[2], Rd) == _asm::reg::Fp && _asm::Get(ptr[2], Rn) == _asm::reg::Sp,
|
|
||||||
ldr::ResultInvalidForceVerbosityPattern()); /* add x29,sp,#imm */
|
|
||||||
R_UNLESS(_asm::IsOp(ptr[3], _asm::op::AddImm64, Rn, Imm12)
|
|
||||||
&& _asm::Get(ptr[3], Rd) == 0 && _asm::Get(ptr[3], Rn) == _asm::reg::Fp,
|
|
||||||
ldr::ResultInvalidForceVerbosityPattern()); /* add x0,x29,#imm */
|
|
||||||
R_UNLESS(_asm::IsOp(ptr[4], _asm::op::AddImm64, Rd, Rn, Imm12) && _asm::Get(ptr[4], Rn) == _asm::reg::Fp,
|
|
||||||
ldr::ResultInvalidForceVerbosityPattern()); /* add x?,x29,#imm */
|
|
||||||
R_UNLESS(_asm::Get(ptr[3], Imm12) == _asm::Get(ptr[4], Imm12)
|
|
||||||
&& _asm::IsOp(ptr[5], _asm::op::Bl, Imm26),
|
|
||||||
ldr::ResultInvalidForceVerbosityPattern());
|
|
||||||
|
|
||||||
bool foundCmp = false;
|
|
||||||
for (u32 j = 6; j <= 10; ++j) {
|
|
||||||
if (ptr[j] == 0x7100001Fu) { /* cmp w0,#0 */
|
|
||||||
foundCmp = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
R_UNLESS(foundCmp, ldr::ResultInvalidForceVerbosityPattern());
|
|
||||||
|
|
||||||
R_UNLESS(forceVerbosityCache.count < std::size(forceVerbosityCache.sites), ldr::ResultInvalidForceVerbosityPattern());
|
|
||||||
forceVerbosityCache.sites[forceVerbosityCache.count++] = ptr;
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result ForceVebosityInstallHooks(HookPayloadData *data) {
|
|
||||||
if (nvLogCache.nvlog_addr != 0) {
|
|
||||||
R_TRY(InstallNvLogRedirect());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (forceVerbosityCache.count != 0 && C.pcvLogVerbosity != 0xff) {
|
|
||||||
data->verbosityLevel = C.pcvLogVerbosity;
|
|
||||||
for (u32 i = 0; i < forceVerbosityCache.count; ++i) {
|
|
||||||
R_DISCARD(INSTALL_IMPL_HOOK(forceVerbosityCache.sites[i], ForceVerbosityImpl));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Souldbminer, Lightos and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "../pcv.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::mariko {
|
|
||||||
|
|
||||||
extern u32 *nsoStart;
|
|
||||||
extern size_t g_nso_size;
|
|
||||||
|
|
||||||
inline bool ForceVerbosityPatternFn(u32 *ptr) {
|
|
||||||
if (g_pcv_cave == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (reinterpret_cast<uintptr_t>(ptr + 11) > g_pcv_cave) { /* .text only */
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return _asm::IsFramePushPre(*ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
sub sp, sp, #imm
|
|
||||||
stp x29,x30,[sp,#imm]
|
|
||||||
str x?, [sp,#imm]
|
|
||||||
add x29,sp, #imm
|
|
||||||
subs xzr, x1, #0
|
|
||||||
*/
|
|
||||||
constexpr u32 NvLogSubSpAsm = 0xD10003FFu; /* sub sp,sp,#0 */
|
|
||||||
constexpr u32 NvLogStpFpLrAsm = 0xA9007BFDu; /* stp x29,x30,[sp,#0] */
|
|
||||||
constexpr u32 NvLogStrSpillAsm = 0xF90003E0u; /* str x?,[sp,#0] */
|
|
||||||
constexpr u32 NvLogMovFpAsm = 0x910003FDu; /* add x29,sp,#0 */
|
|
||||||
constexpr u32 NvLogCmpSizeAsm = 0xF100003Fu; /* subs xzr,x1,#0 */
|
|
||||||
|
|
||||||
inline bool NvLogVsnprintfPatternFn(u32 *ptr) {
|
|
||||||
if (HOC_UART_LOG == 0 || g_pcv_cave == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (reinterpret_cast<uintptr_t>(ptr + 5) > g_pcv_cave) { /* must sit in .text */
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return _asm::Ignoring(*ptr, NvLogSubSpAsm, _asm::field::Imm12);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result NvLogUartRedirect(u32 *ptr);
|
|
||||||
HOOK_PAYLOAD_FN u32 ForceVerbosityImpl();
|
|
||||||
Result ForceVerbosity(u32 *ptr);
|
|
||||||
Result ForceVebosityInstallHooks(HookPayloadData *data);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,325 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Souldbminer, Lightos and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../pcv.hpp"
|
|
||||||
#include "pcv_mariko_soc.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::mariko {
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
struct {
|
|
||||||
u32 *site = nullptr;
|
|
||||||
} busInitCache;
|
|
||||||
|
|
||||||
Result GetSocSpeedo(u32 &socSpeedo) {
|
|
||||||
constexpr u64 FusePhysicalAddress = 0x7000F000;
|
|
||||||
u64 virtualAddress = 0;
|
|
||||||
constexpr u64 Size = 0x1000;
|
|
||||||
|
|
||||||
u64 outSize;
|
|
||||||
/* TODO: use svc::QueryMemoryMapping instead. */
|
|
||||||
R_TRY(svcQueryMemoryMapping(&virtualAddress, &outSize, FusePhysicalAddress, Size));
|
|
||||||
|
|
||||||
constexpr u32 FuseOffset = 2048;
|
|
||||||
constexpr u32 SocSpeedoOffset = 0x134;
|
|
||||||
socSpeedo = *reinterpret_cast<u32 *>(virtualAddress + FuseOffset + SocSpeedoOffset);
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 GetSocProcessId(u32 socSpeedo) {
|
|
||||||
if (socSpeedo <= 1597) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (socSpeedo <= 1708) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* >= 1709. */
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Result SocVoltAsm(u32 *compareSpeedos) {
|
|
||||||
using namespace _asm::field;
|
|
||||||
|
|
||||||
constexpr u32 VoltageScanLimit = 10;
|
|
||||||
/* Might actually be speedo id. */
|
|
||||||
u32 *writeProcessId = _asm::ScanAssembly(compareSpeedos, VoltageScanLimit, SocVoltWriteProcessIdAsm, Rd);
|
|
||||||
R_UNLESS(writeProcessId != nullptr, ldr::ResultInvalidSocVoltPattern());
|
|
||||||
u8 writeProcessIdRd = _asm::Get(*writeProcessId, Rd);
|
|
||||||
|
|
||||||
/* This writes 1050mV. */
|
|
||||||
u32 *writeVoltage = _asm::ScanAssembly(writeProcessId, VoltageScanLimit, SocVoltWriteVoltageAsm, Rd);
|
|
||||||
R_UNLESS(writeVoltage != nullptr, ldr::ResultInvalidSocVoltPattern());
|
|
||||||
u8 writeVoltageRd = _asm::Get(*writeVoltage, Rd);
|
|
||||||
|
|
||||||
/* A csel instruction is used to select the soc voltage limit register. */
|
|
||||||
/* We care about its destination register since that is used for verification. */
|
|
||||||
constexpr u32 VoltageSelectScanLimit = 24;
|
|
||||||
u32 *selectVoltage = _asm::ScanAssembly(writeVoltage, VoltageSelectScanLimit, SocVoltSelectRegisterAsm, Rd, Rn, Rm);
|
|
||||||
R_UNLESS(selectVoltage != nullptr, ldr::ResultInvalidSocVoltPattern());
|
|
||||||
/* Todo: check rm and rn? */
|
|
||||||
u8 selectVoltageRd = _asm::Get(*selectVoltage, Rd);
|
|
||||||
|
|
||||||
/* rdCsel is then multiplied by 1000 to convert to uV. */
|
|
||||||
/* This is pretty far down the function. */
|
|
||||||
constexpr u32 MultiplierScanLimit = 200;
|
|
||||||
u32 *multiplier = _asm::ScanAssembly(selectVoltage, MultiplierScanLimit, SocVoltMultiplyVoltsAsm, Rd, Rn, Rm);
|
|
||||||
R_UNLESS(multiplier != nullptr, ldr::ResultInvalidSocVoltPattern());
|
|
||||||
u8 multiplierRn = _asm::Get(*multiplier, Rn);
|
|
||||||
u8 multiplierRm = _asm::Get(*multiplier, Rm);
|
|
||||||
/* One of the two registers has to be rdCsel. */
|
|
||||||
R_UNLESS((multiplierRn == selectVoltageRd) || (multiplierRm == selectVoltageRd), ldr::ResultInvalidSocVoltPattern());
|
|
||||||
u8 multiplierRd = _asm::Get(*multiplier, Rd);
|
|
||||||
|
|
||||||
/* Subs instruction is then used to verify against absolute limit. */
|
|
||||||
/* NB: Rn is written into the pattern and then ignored by the comparison; only Rm is matched. */
|
|
||||||
u32 limitValidationPattern = _asm::Set(SocVoltValidateLimitAsm, Rn, multiplierRd);
|
|
||||||
u32 *limitValidation = _asm::ScanAssembly(multiplier, VoltageScanLimit, limitValidationPattern, Rd, Rn);
|
|
||||||
R_UNLESS(limitValidation != nullptr, ldr::ResultInvalidSocVoltPattern());
|
|
||||||
|
|
||||||
/* There is a b.gt instruction right after (checks for socVoltageCap < socVoltageMax). */
|
|
||||||
u32 *branchToAbort = limitValidation + 1;
|
|
||||||
R_UNLESS(_asm::Ignoring(*branchToAbort, SocVoltBranchToAbortAsm, Imm19), ldr::ResultInvalidSocVoltPattern());
|
|
||||||
|
|
||||||
if (!C.marikoSocVmax || C.marikoSocVmax <= 1000) {
|
|
||||||
R_SKIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Adjust 1598 speedo minimum to ensure it always goes down process id 0 branch. */
|
|
||||||
/* 2200 should be high enough :D */
|
|
||||||
u32 compareSpeedosPatch = _asm::Set(*compareSpeedos, Imm12, 2200);
|
|
||||||
PATCH_OFFSET(compareSpeedos, compareSpeedosPatch);
|
|
||||||
|
|
||||||
u32 socSpeedo = 0;
|
|
||||||
R_TRY(GetSocSpeedo(socSpeedo));
|
|
||||||
|
|
||||||
/* Adjust processId from 0 to [process id of switch booting this]. */
|
|
||||||
/* We're overwriting the orr instruction entirly. */
|
|
||||||
u32 processId = GetSocProcessId(socSpeedo);
|
|
||||||
u32 writeProcessIdPatch = _asm::Encode(_asm::op::MovzW, {Rd, writeProcessIdRd}, {Imm16, processId});
|
|
||||||
PATCH_OFFSET(writeProcessId, writeProcessIdPatch);
|
|
||||||
|
|
||||||
/* Adjust voltage limit. */
|
|
||||||
u32 voltageLimitPatch = _asm::Encode(_asm::op::MovzW, {Rd, writeVoltageRd}, {Imm16, C.marikoSocVmax});
|
|
||||||
PATCH_OFFSET(writeVoltage, voltageLimitPatch);
|
|
||||||
|
|
||||||
/* Branches to an abort if limits are invalid -- we patch the branch instruction with NOP. */
|
|
||||||
PATCH_OFFSET(branchToAbort, _asm::NopIns);
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result SocVoltLimit(u32 *ptr) {
|
|
||||||
R_UNLESS(!std::memcmp(ptr - SocVoltLimitMaxDefaultIndex, socVoltLimitArray, sizeof(socVoltLimitArray)), ldr::ResultInvalidSocVoltLimit());
|
|
||||||
if (!C.marikoSocVmax || C.marikoSocVmax <= SocVoltLimitOfficial) {
|
|
||||||
R_SKIP();
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 Step = 25;
|
|
||||||
u32 maxVolt = C.marikoSocVmax;
|
|
||||||
if (maxVolt % Step) {
|
|
||||||
maxVolt = maxVolt / Step * Step; /* Round. */
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 volt = SocVoltLimitOfficial;
|
|
||||||
for (u32 i = 1; i < DvfsTableEntryCount - SocVoltLimitMaxDefaultIndex && volt < maxVolt; ++i) {
|
|
||||||
volt += Step;
|
|
||||||
PATCH_OFFSET(ptr + i, volt);
|
|
||||||
}
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
HOOK_PAYLOAD_FN u64 BusFreqExtendImpl(SharedClkBus *bus) {
|
|
||||||
HookPayloadData *data = HOOK_PAYLOAD_PTR(HookPayloadData, m_HookPayloadData);
|
|
||||||
|
|
||||||
u32 *table = data->busData.next;
|
|
||||||
bus->allowedFreqTable = table;
|
|
||||||
data->busData.next = table + EmcDvfsTableEntryCount;
|
|
||||||
|
|
||||||
/* Call the original function. */
|
|
||||||
return reinterpret_cast<u64 (*)(SharedClkBus *)>(data->busData.originalFnCallback)(bus);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Relocate and extend C2/C3Bus to avoid issues (likely buffer overflow) */
|
|
||||||
Result BusFreqReloc(u32 *ptr) {
|
|
||||||
using namespace _asm::field;
|
|
||||||
|
|
||||||
const u32 bus = _asm::Get(ptr[0], Rn);
|
|
||||||
R_UNLESS(_asm::IsOp(ptr[1], _asm::op::AddImm64, Rd, Rn, Imm12) && _asm::Get(ptr[1], Imm12) == 0x18 && _asm::Get(ptr[1], Rn) == bus,
|
|
||||||
ldr::ResultInvalidBusFreqReloc()); /* add Xcnt,Xbus,#0x18 */
|
|
||||||
R_UNLESS(_asm::IsOp(ptr[2], _asm::op::StrImm64, Rt, Rn, Off8) && _asm::Get(ptr[2], Off8) == 0x50 && _asm::Get(ptr[2], Rn) == bus,
|
|
||||||
ldr::ResultInvalidBusFreqReloc()); /* str Xrail,[Xbus,#0x50] */
|
|
||||||
R_UNLESS(_asm::IsOp(ptr[3], _asm::op::Bl, Imm26), ldr::ResultInvalidBusFreqReloc()); /* bl GetDvfsRailUniqueFreqList */
|
|
||||||
|
|
||||||
constexpr u32 PrologueMargin = 140;
|
|
||||||
u32 *functionPrologue = _asm::FindFnPrologue(ptr, PrologueMargin, nsoStart);
|
|
||||||
R_UNLESS(functionPrologue != nullptr, ldr::ResultInvalidBusFreqReloc());
|
|
||||||
|
|
||||||
busInitCache.site = functionPrologue;
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Widen InitDram for a >32-entry EMC DVFS list. Freq array can be dropped to free 264 bytes, relocate the Soc LUT to that space */
|
|
||||||
Result EmcSocLutReloc(u32 *ptr) {
|
|
||||||
constexpr u32 Window = 48;
|
|
||||||
|
|
||||||
using namespace _asm::field;
|
|
||||||
|
|
||||||
R_UNLESS(_asm::Ignoring(ptr[1], EmcSocLutCountStoreAsm, Rt), ldr::ResultInvalidEmcSocLut()); /* str w?,[x0,#0x154] */
|
|
||||||
|
|
||||||
u32 *freqStore = _asm::ScanAssembly(ptr - Window, Window, EmcSocFreqStoreAsm, Rt); /* str x?,[x8,#0x18] */
|
|
||||||
u32 *voltStore = _asm::ScanAssembly(ptr - Window, Window, EmcSocVoltStoreAsm, Rt); /* str w?,[x8,#0x48] */
|
|
||||||
u32 *readLoad = _asm::ScanAssembly(ptr - Window, Window, EmcSocReadLoadAsm, Rt); /* ldr w?,[x9,#0x48] */
|
|
||||||
R_UNLESS(freqStore && voltStore && readLoad, ldr::ResultInvalidEmcSocLut());
|
|
||||||
|
|
||||||
u32 *voltBase = voltStore - 2; /* `add Xb,Xsrc,Xi,LSL#2` (a cmn sits between it and store) */
|
|
||||||
R_UNLESS(_asm::IsOp(*voltBase, _asm::op::AddShifted64, Rd, Rn, Rm, Imm6) && _asm::Get(*voltBase, Rd) == _asm::Get(*voltStore, Rn), ldr::ResultInvalidEmcSocLut());
|
|
||||||
|
|
||||||
/* adrp Xl ; add Xl,Xl,#off ; ... ; str Xl,[rail,#0x120] */
|
|
||||||
const u32 lutReg = _asm::Get(ptr[0], Rt);
|
|
||||||
const u32 railReg = _asm::Get(ptr[0], Rn);
|
|
||||||
R_UNLESS(_asm::IsOp(ptr[-3], _asm::op::Adrp, Rd, ImmAdrpHi, ImmAdrpLo) && _asm::Get(ptr[-3], Rd) == lutReg, ldr::ResultInvalidEmcSocLut());
|
|
||||||
R_UNLESS(_asm::IsOp(ptr[-2], _asm::op::AddImm64, Rd, Rn, Imm12) && _asm::Get(ptr[-2], Rd) == lutReg && _asm::Get(ptr[-2], Rn) == lutReg, ldr::ResultInvalidEmcSocLut());
|
|
||||||
|
|
||||||
const u32 srcBase = _asm::Get(*voltBase, Rn); /* rail ptr at +0x20 */
|
|
||||||
const u32 wBase = _asm::Get(*voltBase, Rd); /* base reg */
|
|
||||||
const u32 wIdx = _asm::Get(*voltBase, Rm); /* loop index */
|
|
||||||
|
|
||||||
PATCH_OFFSET(freqStore, _asm::NopIns); /* Unneeded */
|
|
||||||
PATCH_OFFSET(voltBase, _asm::Encode(_asm::op::LdrImm64, {Rt, wBase}, {Rn, srcBase}, {Off8, 0x20})); /* ldr Xb,[Xsrc,#0x20] (rail) */
|
|
||||||
PATCH_OFFSET(voltStore - 1, _asm::Encode(_asm::op::AddImm64, {Rd, wBase}, {Rn, wBase}, {Imm12, 0x18})); /* add Xb,Xb,#0x18 (was cmn) */
|
|
||||||
PATCH_OFFSET(voltStore, _asm::ToRegOffset(*voltStore, wIdx)); /* str Wv,[Xb,Xi,LSL#2] -> rail+0x18+i*4 */
|
|
||||||
PATCH_OFFSET(voltStore + 1, _asm::NopIns); /* Unneeded */
|
|
||||||
|
|
||||||
/* rail+0x18 as the socMinLut pointer. */
|
|
||||||
PATCH_OFFSET(ptr - 3, _asm::NopIns);
|
|
||||||
PATCH_OFFSET(ptr - 2, _asm::Encode(_asm::op::AddImm64, {Rd, lutReg}, {Rn, railReg}, {Imm12, 0x18})); /* add Xl,rail,#0x18 */
|
|
||||||
|
|
||||||
/* Drop the abort branch in case of a bad read */
|
|
||||||
for (u32 i = 1; i <= 4; ++i) {
|
|
||||||
if (_asm::IsOp(readLoad[i], _asm::op::BCond, Imm19, BCond)) {
|
|
||||||
PATCH_OFFSET(&readLoad[i], _asm::NopIns);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result EmcDvfsCountLimit(u32 *ptr) {
|
|
||||||
R_UNLESS(_asm::IsOp(*(ptr - 1), _asm::op::Cbz, _asm::field::Imm19, _asm::field::Rt), ldr::ResultInvalidEmcDvfsCount()); /* cbz w?,<skip> */
|
|
||||||
R_UNLESS(_asm::Ignoring(*(ptr + 1), _asm::Encode(_asm::op::BCond, {_asm::field::BCond, _asm::cond::Cs}), _asm::field::Imm19),
|
|
||||||
ldr::ResultInvalidEmcDvfsCount()); /* b.cs <abort> */
|
|
||||||
|
|
||||||
/* cmp w?,#0x21 -> cmp w?,#EmcDvfsTableEntryCount */
|
|
||||||
PATCH_OFFSET(ptr, _asm::Set(*ptr, _asm::field::Imm12, EmcDvfsTableEntryCount));
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result EmcRateListLimit(u32 *ptr) {
|
|
||||||
R_UNLESS(_asm::Ignoring(ptr[1], EmcRateCapCselAsm, _asm::field::Rd, _asm::field::Rn, _asm::field::Rm)
|
|
||||||
&& _asm::Get(ptr[0], _asm::field::Rn) == _asm::Get(ptr[1], _asm::field::Rn),
|
|
||||||
ldr::ResultInvalidEmcRateList()); /* csel w?,w?,w?,lt, min(reg, 0x20) */
|
|
||||||
R_UNLESS(_asm::IsOp(ptr[2], _asm::op::Bl, _asm::field::Imm26), ldr::ResultInvalidEmcRateList());
|
|
||||||
|
|
||||||
/* The csel's Rm holds the 32 cap. */
|
|
||||||
const u32 capReg = _asm::Get(ptr[1], _asm::field::Rm);
|
|
||||||
const u32 capMov = _asm::Encode(_asm::op::MovzW, {_asm::field::Rd, capReg}, {_asm::field::Imm16, 0x20}); /* movz w<Rm>,#0x20 */
|
|
||||||
|
|
||||||
u32 *movPtr = nullptr;
|
|
||||||
for (u32 i = 1; i <= 16; ++i) {
|
|
||||||
if (*(ptr - i) == capMov) {
|
|
||||||
movPtr = ptr - i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
R_UNLESS(movPtr, ldr::ResultInvalidEmcRateList());
|
|
||||||
|
|
||||||
/* min(maxCount, 32) -> min(maxCount, EmcDvfsTableEntryCount). */
|
|
||||||
PATCH_OFFSET(ptr, _asm::Set(*ptr, _asm::field::Imm12, EmcDvfsTableEntryCount)); /* cmp w?,#64 */
|
|
||||||
PATCH_OFFSET(movPtr, _asm::Set(*movPtr, _asm::field::Imm16, EmcDvfsTableEntryCount)); /* movz w?,#64 */
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result EmcRateSessLimit(u32 *ptr) {
|
|
||||||
u32 movzI = 0;
|
|
||||||
R_UNLESS(EmcRateSessFindClamp(ptr, nullptr, nullptr, &movzI), ldr::ResultInvalidEmcRateList());
|
|
||||||
|
|
||||||
/* Reject cmd11 GetDvfsTable. */
|
|
||||||
for (u32 i = 1; i <= 24; ++i) {
|
|
||||||
const u32 w = ptr[i];
|
|
||||||
if (_asm::IsOp(w, _asm::op::SubImm64, _asm::field::Rd, _asm::field::Rn, _asm::field::Imm12)
|
|
||||||
&& _asm::Get(w, _asm::field::Rn) == _asm::reg::Fp && _asm::Get(w, _asm::field::Imm12) >= 0x20u) { /* sub x?,x29,#>=0x20 */
|
|
||||||
R_THROW(ldr::ResultInvalidEmcRateList());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* mov x<desc>,x2 */
|
|
||||||
u32 descReg = 0xFFu;
|
|
||||||
for (u32 i = 1; i <= 24; ++i) {
|
|
||||||
if (_asm::Ignoring(ptr[i], _asm::MovReg64(0, 2), _asm::field::Rd)) { descReg = _asm::Get(ptr[i], _asm::field::Rd); break; }
|
|
||||||
}
|
|
||||||
R_UNLESS(descReg != 0xFFu, ldr::ResultInvalidEmcRateList());
|
|
||||||
|
|
||||||
/* Repoint the duplicated-imm pair */
|
|
||||||
u32 *adds[8]; u32 addImm[8]; u32 nAdds = 0;
|
|
||||||
for (u32 i = 1; i <= 24 && nAdds < 8; ++i) {
|
|
||||||
const u32 w = ptr[i];
|
|
||||||
if (_asm::IsOp(w, _asm::op::AddImm64, _asm::field::Rd, _asm::field::Rn, _asm::field::Imm12) && _asm::Get(w, _asm::field::Rn) == _asm::reg::Sp) { /* add x?,sp,#imm12 (shift 0) */
|
|
||||||
adds[nAdds] = ptr + i;
|
|
||||||
addImm[nAdds] = _asm::Get(w, _asm::field::Imm12);
|
|
||||||
++nAdds;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
u32 patched = 0;
|
|
||||||
for (u32 a = 0; a < nAdds; ++a) {
|
|
||||||
bool dup = false;
|
|
||||||
for (u32 b = 0; b < nAdds; ++b) {
|
|
||||||
if (a != b && addImm[a] == addImm[b]) { dup = true; break; }
|
|
||||||
}
|
|
||||||
if (dup) {
|
|
||||||
PATCH_OFFSET(adds[a], _asm::Encode(_asm::op::LdrImm64, {_asm::field::Rt, _asm::Get(*adds[a], _asm::field::Rd)},
|
|
||||||
{_asm::field::Rn, descReg},
|
|
||||||
{_asm::field::Off8, 0})); /* ldr x?,[x<desc>] */
|
|
||||||
++patched;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
R_UNLESS(patched == 2, ldr::ResultInvalidEmcRateList());
|
|
||||||
|
|
||||||
/* min(maxCount, 32) -> min(maxCount, EmcDvfsTableEntryCount) */
|
|
||||||
PATCH_OFFSET(ptr, _asm::Set(*ptr, _asm::field::Imm12, EmcDvfsTableEntryCount)); /* cmp w?,#64 */
|
|
||||||
PATCH_OFFSET(ptr + movzI, _asm::Set(*(ptr + movzI), _asm::field::Imm16, EmcDvfsTableEntryCount)); /* movz w?,#64 */
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result SharedClkBusInstallHooks(HookPayloadData *data) {
|
|
||||||
R_UNLESS(busInitCache.site != nullptr, ldr::ResultInvalidBusFreqReloc());
|
|
||||||
|
|
||||||
uintptr_t originalFn = 0;
|
|
||||||
R_TRY(INSTALL_IMPL_HOOK_ORIG(busInitCache.site, BusFreqExtendImpl, &originalFn));
|
|
||||||
data->busData.originalFnCallback = originalFn;
|
|
||||||
data->busData.next = reinterpret_cast<u32 *>(Hooks().ToVa(data->busData.table[0]));
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Souldbminer, Lightos and Horizon OC Contributors
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms and conditions of the GNU General Public License,
|
|
||||||
* version 2, as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "pcv_mariko.hpp"
|
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::mariko {
|
|
||||||
|
|
||||||
extern u32 *nsoStart;
|
|
||||||
|
|
||||||
/* Movz */
|
|
||||||
/*
|
|
||||||
SF | OPC | HW | Imm16 | RD
|
|
||||||
31 | 30 29 28 27 26 25 24 23 | 22 21 | 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 | 4 3 2 1 0
|
|
||||||
*/
|
|
||||||
constexpr u32 SocVoltCompareSpeedoAsm = 0x7118FAFF; /* subs imm, compares to >=1598 max speedo and then goes down process id 1 route. */
|
|
||||||
constexpr u32 SocVoltWriteProcessIdAsm = 0x2A1F03F4; /* orr, writes id 0. */
|
|
||||||
constexpr u32 SocVoltWriteVoltageAsm = 0x52808358; /* Movz imm, writes 1050mV. */
|
|
||||||
constexpr u32 SocVoltSelectRegisterAsm = 0x1A9A3118; /* Csel, selects the voltage -- we need the register of this. */
|
|
||||||
constexpr u32 SocVoltMultiplyVoltsAsm = 0x1B1A7F0B; /* Mul, converts from mV -> uV */
|
|
||||||
constexpr u32 SocVoltValidateLimitAsm = 0x6B0A017F; /* Subs, checks limits */
|
|
||||||
constexpr u32 SocVoltBranchToAbortAsm = 0x540020AC; /* B.ge Branches to abort if limits are invalid. */
|
|
||||||
|
|
||||||
ALWAYS_INLINE bool SocVoltPatternFn(u32 *ptr) {
|
|
||||||
return _asm::Ignoring(*ptr, SocVoltCompareSpeedoAsm, _asm::field::Rd);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 SocVoltLimitOfficial = 1050;
|
|
||||||
constexpr u32 SocVoltLimitMaxDefaultIndex = 17;
|
|
||||||
static const u32 socVoltLimitArray[DvfsTableEntryCount] = { 637, 650, 675, 700, 725, 750, 775, 800, 825, 850, 875, 900, 925, 950, 975, 1000, 1025, 1050, };
|
|
||||||
|
|
||||||
constexpr u32 EmcCountCmpAsm = 0x7100851F; /* cmp w?,#0x21 (subs wzr,w?,#0x21) */
|
|
||||||
|
|
||||||
/*
|
|
||||||
str <lut>,[<rail>,#0x120] ; volt-array pointer
|
|
||||||
str w?, [<rail>,#0x154] ; num_freqs
|
|
||||||
*/
|
|
||||||
constexpr u32 EmcSocLutPtrStoreAsm = 0xF9009009; /* str x?,[x0,#0x120] (anchor) */
|
|
||||||
constexpr u32 EmcSocLutCountStoreAsm = 0xB9015408; /* str w?,[x0,#0x154] (anchor) */
|
|
||||||
constexpr u32 EmcSocFreqStoreAsm = 0xF9000D00; /* str x?,[x8,#0x18] */
|
|
||||||
constexpr u32 EmcSocVoltStoreAsm = 0xB9004900; /* str w?,[x8,#0x48] (socMinLut[i]) */
|
|
||||||
constexpr u32 EmcSocReadLoadAsm = 0xB9404929; /* ldr w?,[x9,#0x48] (socMinLut) */
|
|
||||||
|
|
||||||
inline bool EmcDvfsCountPatternFn(u32 *ptr) {
|
|
||||||
return _asm::Ignoring(*ptr, EmcCountCmpAsm, _asm::field::Rd);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool EmcSocLutPatternFn(u32 *ptr) {
|
|
||||||
return _asm::Ignoring(*ptr, EmcSocLutPtrStoreAsm, _asm::field::Rt); /* str x?,[x0,#0x120] */
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
mov w?,#0x20 ; the 32 cap
|
|
||||||
cmp w?,#0x20
|
|
||||||
csel w?,w?,w?,lt ; w? = min(maxCount, 32)
|
|
||||||
bl TegraGetEmcDvfsFreqTable
|
|
||||||
|
|
||||||
cmp w?,#0x20 ; (maxCount)
|
|
||||||
csel w?,<same>,<cap>,lt ; min(maxCount, 32)
|
|
||||||
bl <_asm::Get*DvfsFreqTable>
|
|
||||||
*/
|
|
||||||
constexpr u32 EmcRateCapCmpAsm = 0x710082FF; /* cmp w?,#0x20 */
|
|
||||||
constexpr u32 EmcRateCapCselAsm = 0x1A80B000; /* csel w?,w?,w?,lt */
|
|
||||||
|
|
||||||
inline bool EmcRateListPatternFn(u32 *ptr) {
|
|
||||||
return _asm::Ignoring(*ptr, EmcRateCapCmpAsm, _asm::field::Rd, _asm::field::Rn);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 EmcRateSessCmpAsm = 0x710082FF; /* cmp w?,#0x20 */
|
|
||||||
constexpr u32 EmcRateSessMovAsm = 0x52800400; /* movz w?,#0x20 */
|
|
||||||
constexpr u32 EmcRateSessCselAsm = 0x1A80B000; /* csel w?,w?,w?,lt (opcode + cond) */
|
|
||||||
|
|
||||||
inline bool EmcRateSessFindClamp(u32 *ptr, u32 *out_c, u32 *out_cap, u32 *out_movz_i) {
|
|
||||||
const u32 c = _asm::Get(ptr[0], _asm::field::Rn);
|
|
||||||
for (u32 i = 1; i <= 14; ++i) {
|
|
||||||
const u32 w = ptr[i];
|
|
||||||
if (_asm::Ignoring(w, EmcRateSessCselAsm, _asm::field::Rd, _asm::field::Rn, _asm::field::Rm) && _asm::Get(w, _asm::field::Rn) == c && _asm::Get(w, _asm::field::Rd) == c) {
|
|
||||||
const u32 cap = _asm::Get(w, _asm::field::Rm);
|
|
||||||
for (u32 j = 1; j < i; ++j) {
|
|
||||||
if (_asm::Ignoring(ptr[j], EmcRateSessMovAsm, _asm::field::Rd) && _asm::Get(ptr[j], _asm::field::Rd) == cap) {
|
|
||||||
if (out_c) *out_c = c;
|
|
||||||
if (out_cap) *out_cap = cap;
|
|
||||||
if (out_movz_i) *out_movz_i = j;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool EmcRateSessPatternFn(u32 *ptr) {
|
|
||||||
return _asm::Ignoring(*ptr, EmcRateSessCmpAsm, _asm::field::Rd, _asm::field::Rn);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool BusFreqRelocPatternFn(u32 *ptr) {
|
|
||||||
if (g_pcv_cave == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (reinterpret_cast<uintptr_t>(ptr + 4) > g_pcv_cave) { /* the call site lives in .text */
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return _asm::IsOp(*ptr, _asm::op::LdrImm64, _asm::field::Rt, _asm::field::Rn, _asm::field::Off8)
|
|
||||||
&& _asm::Get(*ptr, _asm::field::Off8) == 0x10; /* ldr Xbuf,[Xbus,#0x10] */
|
|
||||||
}
|
|
||||||
|
|
||||||
Result SocVoltAsm(u32 *compareSpeedos);
|
|
||||||
Result SocVoltLimit(u32 *ptr);
|
|
||||||
HOOK_PAYLOAD_FN u64 BusFreqExtendImpl(SharedClkBus *bus);
|
|
||||||
Result BusFreqReloc(u32 *ptr);
|
|
||||||
Result EmcSocLutReloc(u32 *ptr);
|
|
||||||
Result EmcDvfsCountLimit(u32 *ptr);
|
|
||||||
Result EmcRateListLimit(u32 *ptr);
|
|
||||||
Result EmcRateSessLimit(u32 *ptr);
|
|
||||||
Result SharedClkBusInstallHooks(HookPayloadData *data);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pcv.hpp"
|
#include "pcv.hpp"
|
||||||
|
#include "pcv_hook.hpp"
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv {
|
namespace ams::ldr::hoc::pcv {
|
||||||
|
|
||||||
@@ -82,7 +83,6 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
u32 max;
|
u32 max;
|
||||||
u32 panic;
|
u32 panic;
|
||||||
bool value_required = false;
|
bool value_required = false;
|
||||||
const char *name = "unnamed";
|
|
||||||
|
|
||||||
Result Check() {
|
Result Check() {
|
||||||
if (!value_required && !value) {
|
if (!value_required && !value) {
|
||||||
@@ -108,7 +108,6 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
} else {
|
} else {
|
||||||
marikoCpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoCpuDvfsTable)->freq);
|
marikoCpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoCpuDvfsTable)->freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 eristaGpuDvfsMaxFreq;
|
u32 eristaGpuDvfsMaxFreq;
|
||||||
switch (C.eristaGpuUV) {
|
switch (C.eristaGpuUV) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -148,28 +147,26 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Validator validators[] = {
|
Validator validators[] = {
|
||||||
{ C.eristaCpuBoostClock, 1020'000, 2397'000, panic::Cpu, true, "eristaCpuBoostClock" },
|
{ C.eristaCpuBoostClock, 1020'000, 2397'000, panic::Cpu, true },
|
||||||
{ C.marikoCpuBoostClock, 1020'000, 2805'000, panic::Cpu, true, "marikoCpuBoostClock" },
|
{ C.marikoCpuBoostClock, 1020'000, 2805'000, panic::Cpu, true },
|
||||||
{ C.eristaCpuMaxVolt, 1000, 1260, panic::Cpu, false, "eristaCpuMaxVolt" },
|
{ C.eristaCpuMaxVolt, 1000, 1260, panic::Cpu, },
|
||||||
{ C.marikoCpuMaxVolt, 1000, 1235, panic::Cpu, false, "marikoCpuMaxVolt" },
|
{ C.marikoCpuMaxVolt, 1000, 1235, panic::Cpu, },
|
||||||
{ eristaCpuDvfsMaxFreq, 1785'000, 2397'000, panic::Cpu, false, "eristaCpuDvfsMaxFreq"},
|
{ eristaCpuDvfsMaxFreq, 1785'000, 2397'000, panic::Cpu, },
|
||||||
{ marikoCpuDvfsMaxFreq, 1785'000, 2805'000, panic::Cpu, false, "marikoCpuDvfsMaxFreq"},
|
{ marikoCpuDvfsMaxFreq, 1785'000, 2805'000, panic::Cpu, },
|
||||||
{ C.commonEmcMemVolt, 912'500, 1350'000, panic::Emc, false, "commonEmcMemVolt" }, /* Official vmax for the RAMs is 1400-1500mV */
|
{ C.commonEmcMemVolt, 912'500, 1350'000, panic::Emc, }, /* Official vmax for the RAMs is 1400-1500mV */
|
||||||
{ C.eristaEmcMaxClock, 1600'000, 2600'000, panic::Emc, false, "eristaEmcMaxClock" },
|
{ C.eristaEmcMaxClock, 1600'000, 2600'000, panic::Emc, },
|
||||||
{ C.marikoEmcMaxClock, 1600'000, 3500'000, panic::Emc, false, "marikoEmcMaxClock" },
|
{ C.marikoEmcMaxClock, 1600'000, 3500'000, panic::Emc, },
|
||||||
{ C.marikoEmcVddqVolt, 400'000, 750'000, panic::Emc, false, "marikoEmcVddqVolt" },
|
{ C.marikoEmcVddqVolt, 400'000, 750'000, panic::Emc, },
|
||||||
{ C.marikoSocVmax, 1000, 1200, panic::Emc, false, "marikoSocVmax" },
|
{ C.marikoSocVmax, 1000, 1200, panic::Emc, },
|
||||||
{ eristaGpuDvfsMaxFreq, 768'000, 1152'000, panic::Gpu, false, "eristaGpuDvfsMaxFreq"},
|
{ eristaGpuDvfsMaxFreq, 768'000, 1152'000, panic::Gpu, },
|
||||||
{ marikoGpuDvfsMaxFreq, 768'000, 1574'400, panic::Gpu, false, "marikoGpuDvfsMaxFreq"},
|
{ marikoGpuDvfsMaxFreq, 768'000, 1536'000, panic::Gpu, },
|
||||||
{ C.marikoGpuVmax, 800, 995, panic::Gpu, false, "marikoGpuVmax" }, /* Official GPU vMax is 1050mV */
|
{ C.marikoGpuVmax, 800, 960, panic::Gpu, },
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto &v : validators) {
|
for (auto &v : validators) {
|
||||||
if (R_FAILED(v.Check())) {
|
if (R_FAILED(v.Check())) {
|
||||||
LOGGING("Validation FAIL: %s value=%u min=%u max=%u", v.name, static_cast<u32>(v.value), v.min, v.max);
|
|
||||||
panic::SmcError(v.panic);
|
panic::SmcError(v.panic);
|
||||||
CRASH("Validation FAIL");
|
CRASH("Validation FAIL");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,9 +182,6 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
|
|
||||||
Hooks().Initialize(mapped_nso, nso_address, cave, cave_size, data_arena);
|
Hooks().Initialize(mapped_nso, nso_address, cave, cave_size, data_arena);
|
||||||
|
|
||||||
g_pcv_cave = cave;
|
|
||||||
g_pcv_cave_size = cave_size;
|
|
||||||
|
|
||||||
bool isMariko = (spl::GetSocType() == spl::SocType_Mariko);
|
bool isMariko = (spl::GetSocType() == spl::SocType_Mariko);
|
||||||
if (isMariko) {
|
if (isMariko) {
|
||||||
mariko::Patch(mapped_nso, nso_size);
|
mariko::Patch(mapped_nso, nso_size);
|
||||||
|
|||||||
@@ -22,17 +22,8 @@
|
|||||||
|
|
||||||
#include "../oc_common.hpp"
|
#include "../oc_common.hpp"
|
||||||
#include "pcv_common.hpp"
|
#include "pcv_common.hpp"
|
||||||
|
#include "pcv_erista.hpp"
|
||||||
#include "erista/pcv_erista_cpu.hpp"
|
#include "pcv_mariko.hpp"
|
||||||
#include "erista/pcv_erista_gpu.hpp"
|
|
||||||
#include "erista/pcv_erista_mtc.hpp"
|
|
||||||
#include "erista/pcv_erista.hpp"
|
|
||||||
|
|
||||||
#include "mariko/pcv_mariko.hpp"
|
|
||||||
#include "mariko/pcv_mariko_cpu.hpp"
|
|
||||||
#include "mariko/pcv_mariko_gpu.hpp"
|
|
||||||
#include "mariko/pcv_mariko_mtc.hpp"
|
|
||||||
|
|
||||||
#include "pcv_hook.hpp"
|
#include "pcv_hook.hpp"
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv {
|
namespace ams::ldr::hoc::pcv {
|
||||||
@@ -197,7 +188,6 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
}
|
}
|
||||||
++entry;
|
++entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (C.commonGpuVoltOffset && !(isMariko ? C.marikoGpuUV : C.eristaGpuUV)) {
|
if (C.commonGpuVoltOffset && !(isMariko ? C.marikoGpuUV : C.eristaGpuUV)) {
|
||||||
cvb_entry_t *entry = static_cast<cvb_entry_t *>(gpu_cvb_table_head);
|
cvb_entry_t *entry = static_cast<cvb_entry_t *>(gpu_cvb_table_head);
|
||||||
for (size_t i = 0; i < customize_entry_count; ++i) {
|
for (size_t i = 0; i < customize_entry_count; ++i) {
|
||||||
|
|||||||
@@ -22,246 +22,11 @@
|
|||||||
|
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::_asm {
|
namespace ams::ldr::hoc::pcv {
|
||||||
|
|
||||||
constexpr u32 NopIns = 0xD503201F;
|
constexpr u32 NopIns = 0xD503201F;
|
||||||
constexpr u32 RetIns = 0xD65F03C0;
|
|
||||||
constexpr u32 BrkIns = 0xD4200000;
|
|
||||||
|
|
||||||
constexpr u32 GetField(u32 ins, u8 lsb, u8 width) {
|
template <typename Compare>
|
||||||
return (ins >> lsb) & ((1u << width) - 1u);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 SetField(u32 ins, u8 lsb, u8 width, u32 val) {
|
|
||||||
const u32 mask = ((1u << width) - 1u) << lsb;
|
|
||||||
return (ins & ~mask) | ((val << lsb) & mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 FieldMask(u8 lsb, u8 width) {
|
|
||||||
return ((1u << width) - 1u) << lsb;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr s64 SignExtend(u64 v, u32 bits) {
|
|
||||||
const u32 pad = 64u - bits;
|
|
||||||
return static_cast<s64>(v << pad) >> pad;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace field {
|
|
||||||
struct Descriptor {
|
|
||||||
u8 lsb;
|
|
||||||
u8 width;
|
|
||||||
u8 shift = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr Descriptor Rd { 0, 5}; /* destination register */
|
|
||||||
constexpr Descriptor Rn { 5, 5}; /* first source register */
|
|
||||||
constexpr Descriptor Rm {16, 5}; /* second source register */
|
|
||||||
constexpr Descriptor Ra {10, 5}; /* accumulator register */
|
|
||||||
constexpr Descriptor Rt { 0, 5}; /* load/store transfer register */
|
|
||||||
constexpr Descriptor Rt2 {10, 5}; /* second transfer register of a pair */
|
|
||||||
|
|
||||||
constexpr Descriptor Cond {12, 4}; /* condition code (CSEL) */
|
|
||||||
constexpr Descriptor BCond { 0, 4}; /* condition code (B.cond) */
|
|
||||||
constexpr Descriptor Hw {21, 2}; /* MOVZ/MOVK/MOVN shift */
|
|
||||||
|
|
||||||
constexpr Descriptor Sh {22, 1};
|
|
||||||
constexpr Descriptor Shift {22, 2}; /* ADD/SUB (shifted register) shift type */
|
|
||||||
constexpr Descriptor Imm6 {10, 6}; /* ADD/SUB (shifted register) shift amount */
|
|
||||||
constexpr Descriptor Immr {16, 6}; /* UBFM immr */
|
|
||||||
|
|
||||||
constexpr Descriptor Imm16 { 5, 16}; /* MOVZ/MOVK/MOVN immediate */
|
|
||||||
constexpr Descriptor Imm12 {10, 12}; /* ADD/SUB (immediate) */
|
|
||||||
constexpr Descriptor Imm19 { 5, 19}; /* B.cond / CBZ / CBNZ immediate */
|
|
||||||
constexpr Descriptor Imm26 { 0, 26}; /* B / BL immediate */
|
|
||||||
|
|
||||||
constexpr Descriptor ImmAdrpHi { 5, 19};
|
|
||||||
constexpr Descriptor ImmAdrpLo {29, 2};
|
|
||||||
|
|
||||||
constexpr Descriptor Off1 {10, 12, 0}; /* LDRB/STRB */
|
|
||||||
constexpr Descriptor Off4 {10, 12, 2}; /* 32-bit LDR/STR */
|
|
||||||
constexpr Descriptor Imm9 {12, 9}; /* pre/post-index offset */
|
|
||||||
|
|
||||||
constexpr Descriptor Barrier { 8, 4}; /* DSB/DMB option (CRm) */
|
|
||||||
constexpr Descriptor Off8 {10, 12, 3}; /* 64-bit LDR/STR */
|
|
||||||
|
|
||||||
constexpr Descriptor PairOff8 {15, 7, 3}; /* X pairs */
|
|
||||||
constexpr Descriptor PairOff16 {15, 7, 4}; /* Q pairs */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Regs that read as a name in the encoding. */
|
|
||||||
namespace reg {
|
|
||||||
constexpr u32 Fp = 29;
|
|
||||||
constexpr u32 Lr = 30;
|
|
||||||
constexpr u32 Sp = 31;
|
|
||||||
constexpr u32 Wzr = 31;
|
|
||||||
constexpr u32 Xzr = 31;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace cond {
|
|
||||||
constexpr u32 Eq = 0x0, Ne = 0x1, Cs = 0x2, Cc = 0x3,
|
|
||||||
Mi = 0x4, Pl = 0x5, Vs = 0x6, Vc = 0x7,
|
|
||||||
Hi = 0x8, Ls = 0x9, Ge = 0xA, Lt = 0xB,
|
|
||||||
Gt = 0xC, Le = 0xD, Al = 0xE;
|
|
||||||
constexpr u32 Hs = Cs, Lo = Cc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Base opcodes. */
|
|
||||||
/* Either pair with Encode or Ignoring. */
|
|
||||||
namespace op {
|
|
||||||
constexpr u32 AddImm32 = 0x11000000;
|
|
||||||
constexpr u32 AddImm64 = 0x91000000;
|
|
||||||
constexpr u32 SubImm64 = 0xD1000000;
|
|
||||||
constexpr u32 SubsImm32 = 0x71000000;
|
|
||||||
constexpr u32 SubsImm64 = 0xF1000000;
|
|
||||||
|
|
||||||
constexpr u32 MovzW = 0x52800000;
|
|
||||||
constexpr u32 MovkW = 0x72800000;
|
|
||||||
constexpr u32 MovnW = 0x12800000;
|
|
||||||
|
|
||||||
constexpr u32 AddShifted64 = 0x8B000000;
|
|
||||||
constexpr u32 SubShifted64 = 0xCB000000;
|
|
||||||
constexpr u32 AndImm32 = 0x12000000;
|
|
||||||
constexpr u32 AndImm64 = 0x92400000;
|
|
||||||
constexpr u32 Ubfm32 = 0x53000000; /* UBFIZ/UBFX/LSL aliases */
|
|
||||||
constexpr u32 OrrShifted32 = 0x2A000000;
|
|
||||||
constexpr u32 OrrShifted64 = 0xAA000000;
|
|
||||||
constexpr u32 SubsShifted32 = 0x6B000000;
|
|
||||||
|
|
||||||
constexpr u32 Csel32 = 0x1A800000;
|
|
||||||
constexpr u32 Madd32 = 0x1B000000;
|
|
||||||
|
|
||||||
constexpr u32 LdrbImm = 0x39400000;
|
|
||||||
constexpr u32 StrbImm = 0x39000000;
|
|
||||||
constexpr u32 LdrImm32 = 0xB9400000;
|
|
||||||
constexpr u32 LdrsWImm64 = 0xB9800000; /* LDRSW x, 32-bit mem, Off4-scaled */
|
|
||||||
constexpr u32 StrImm32 = 0xB9000000;
|
|
||||||
constexpr u32 LdrImm64 = 0xF9400000;
|
|
||||||
constexpr u32 LdrPreImm64 = 0xF8400C00; /* LDR (pre-index): bits 11:10 fixed */
|
|
||||||
constexpr u32 StrImm64 = 0xF9000000;
|
|
||||||
|
|
||||||
constexpr u32 StpImm64 = 0xA9000000;
|
|
||||||
constexpr u32 StpPreImm64 = 0xA9800000;
|
|
||||||
constexpr u32 StpImmQ = 0xAD000000;
|
|
||||||
|
|
||||||
constexpr u32 B = 0x14000000;
|
|
||||||
constexpr u32 Bl = 0x94000000;
|
|
||||||
constexpr u32 BCond = 0x54000000;
|
|
||||||
constexpr u32 Cbz = 0x34000000;
|
|
||||||
constexpr u32 Br = 0xD61F0000;
|
|
||||||
|
|
||||||
constexpr u32 Adrp = 0x90000000;
|
|
||||||
constexpr u32 Svc = 0xD4000001;
|
|
||||||
|
|
||||||
constexpr u32 Dsb = 0xD503309F; /* DSB, option cleared */
|
|
||||||
constexpr u32 Dmb = 0xD50330BF; /* DMB, option cleared */
|
|
||||||
constexpr u32 Isb = 0xD5033FDF; /* ISB SY (only valid option) */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Barrier options (CRm). */
|
|
||||||
namespace barrier {
|
|
||||||
constexpr u32 Sy = 0xFu, St = 0xEu, Ld = 0xDu;
|
|
||||||
constexpr u32 Ish = 0xBu, Ishst = 0xAu, Ishld = 0x9u;
|
|
||||||
constexpr u32 Nsh = 0x7u, Nshst = 0x6u, Nshld = 0x5u;
|
|
||||||
constexpr u32 Osh = 0x3u, Oshst = 0x2u, Oshld = 0x1u;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 Get(u32 ins, field::Descriptor f) {
|
|
||||||
return GetField(ins, f.lsb, f.width) << f.shift;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 Set(u32 ins, field::Descriptor f, u64 val) {
|
|
||||||
return SetField(ins, f.lsb, f.width, static_cast<u32>(val >> f.shift));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... Fs>
|
|
||||||
constexpr bool Ignoring(u32 a, u32 b, Fs... fields) {
|
|
||||||
const u32 mask = (0u | ... | FieldMask(fields.lsb, fields.width));
|
|
||||||
return (a & ~mask) == (b & ~mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline constexpr auto IgnoringRd = [](u32 a, u32 b) {
|
|
||||||
return Ignoring(a, b, field::Rd);
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename... Fs>
|
|
||||||
constexpr bool IsOp(u32 ins, u32 baseOpcode, Fs... variableFields) {
|
|
||||||
return Ignoring(ins, baseOpcode, variableFields...);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct FieldValue {
|
|
||||||
field::Descriptor f;
|
|
||||||
u64 val;
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr u32 Encode(u32 base, FieldValue a) {
|
|
||||||
return Set(base, a.f, a.val);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 Encode(u32 base, FieldValue a, FieldValue b) {
|
|
||||||
return Encode(Encode(base, a), b);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 Encode(u32 base, FieldValue a, FieldValue b, FieldValue c) {
|
|
||||||
return Encode(Encode(base, a, b), c);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 Encode(u32 base, FieldValue a, FieldValue b, FieldValue c, FieldValue d) {
|
|
||||||
return Encode(Encode(base, a, b, c), d);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 Encode(u32 base, FieldValue a, FieldValue b, FieldValue c, FieldValue d, FieldValue e) {
|
|
||||||
return Encode(Encode(base, a, b, c, d), e);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr uintptr_t Target26(u32 ins, uintptr_t pc) {
|
|
||||||
return static_cast<uintptr_t>(static_cast<s64>(pc) + SignExtend(static_cast<u64>(Get(ins, field::Imm26)) << 2, 28));
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 Retarget26(u32 ins, uintptr_t pc, uintptr_t target) {
|
|
||||||
return Set(ins, field::Imm26, static_cast<u32>((static_cast<s64>(target) - static_cast<s64>(pc)) >> 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr uintptr_t Target19(u32 ins, uintptr_t pc) {
|
|
||||||
return static_cast<uintptr_t>(static_cast<s64>(pc) + SignExtend(static_cast<u64>(Get(ins, field::Imm19)) << 2, 21));
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 Retarget19(u32 ins, uintptr_t pc, uintptr_t target) {
|
|
||||||
return Set(ins, field::Imm19, static_cast<u32>((static_cast<s64>(target) - static_cast<s64>(pc)) >> 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr uintptr_t TargetAdrp(u32 ins, uintptr_t pc) {
|
|
||||||
const u64 imm21 = (static_cast<u64>(Get(ins, field::ImmAdrpHi)) << 2) | Get(ins, field::ImmAdrpLo);
|
|
||||||
return static_cast<uintptr_t>(static_cast<s64>(pc & ~static_cast<uintptr_t>(0xFFF)) + SignExtend(imm21 << 12, 33));
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 RetargetAdrp(u32 ins, uintptr_t pc, uintptr_t target) {
|
|
||||||
const s64 delta = static_cast<s64>(target & ~static_cast<uintptr_t>(0xFFF)) - static_cast<s64>(pc & ~static_cast<uintptr_t>(0xFFF));
|
|
||||||
const u32 imm21 = static_cast<u32>((delta >> 12) & 0x1FFFFF);
|
|
||||||
return Set(Set(ins, field::ImmAdrpHi, imm21 >> 2), field::ImmAdrpLo, imm21 & 0x3u);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 Dsb(u32 opt) {
|
|
||||||
return Encode(op::Dsb, {field::Barrier, opt});
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 Dmb(u32 opt) {
|
|
||||||
return Encode(op::Dmb, {field::Barrier, opt});
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 MovReg64(u32 rd, u32 rm) {
|
|
||||||
return Encode(op::OrrShifted64, {field::Rd, rd}, {field::Rn, reg::Xzr}, {field::Rm, rm});
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 CmpImm32(u32 rn, u32 imm12) {
|
|
||||||
return Encode(op::SubsImm32, {field::Rd, reg::Wzr}, {field::Rn, rn}, {field::Imm12, imm12});
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 ToRegOffset(u32 ldstImm, u32 rm) {
|
|
||||||
constexpr u32 Keep = 0xC0C00000u | FieldMask(field::Rt.lsb, field::Rt.width) | FieldMask(field::Rn.lsb, field::Rn.width);
|
|
||||||
return ((ldstImm & Keep) | 0x38207800u) | ((rm & 0x1Fu) << field::Rm.lsb);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Compare> requires (!std::is_same_v<std::remove_cvref_t<Compare>, field::Descriptor>)
|
|
||||||
u32 *ScanAssembly(u32 *ptr, u32 scanLimit, u32 pattern, Compare comp) {
|
u32 *ScanAssembly(u32 *ptr, u32 scanLimit, u32 pattern, Compare comp) {
|
||||||
for (u32 i = 0; i < scanLimit; ++i) {
|
for (u32 i = 0; i < scanLimit; ++i) {
|
||||||
if (comp(pattern, ptr[i])) {
|
if (comp(pattern, ptr[i])) {
|
||||||
@@ -271,63 +36,161 @@ namespace ams::ldr::hoc::pcv::_asm {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Fs>
|
inline auto asm_compare_no_rd = [](u32 ins1, u32 ins2) {
|
||||||
u32 *ScanAssembly(u32 *ptr, u32 scanLimit, u32 pattern, Fs... ignoreFields) {
|
return ((ins1 ^ ins2) >> 5) == 0;
|
||||||
return ScanAssembly(ptr, scanLimit, pattern, [=](u32 a, u32 b) ALWAYS_INLINE_LAMBDA { return Ignoring(a, b, ignoreFields...); });
|
};
|
||||||
|
|
||||||
|
inline auto asm_get_rd = [](u32 ins) {
|
||||||
|
return ins & ((1 << 5) - 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline auto asm_set_rd = [](u32 ins, u8 rd) {
|
||||||
|
return (ins & 0xFFFFFFE0) | (rd & 0x1F);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline auto asm_set_imm16 = [](u32 ins, u16 imm) {
|
||||||
|
return (ins & 0xFFE0001F) | ((imm & 0xFFFF) << 5);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline auto AsmGetImm16 = [](u32 ins) {
|
||||||
|
return static_cast<u16>((ins >> 5) & 0xFFFF);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline auto AsmCompareBrNoRd = [](u32 ins1, u32 ins2) {
|
||||||
|
constexpr u32 RegMask = ~(((1 << 5) - 1) << 5);
|
||||||
|
return ((ins1 & RegMask) ^ (ins2 & RegMask)) == 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline auto AsmCompareAddNoImm12 = [](u32 ins1, u32 ins2) {
|
||||||
|
constexpr u32 Imm12Mask = ~(((1 << 12) - 1) << 10);
|
||||||
|
return ((ins1 & Imm12Mask) ^ (ins2 & Imm12Mask)) == 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline auto AsmCompareAdrpNoImm = [](u32 ins1, u32 ins2) {
|
||||||
|
constexpr u32 ImmMask = ~((((1 << 2) - 1) << 29) | (((1 << 19) - 1) << 5));
|
||||||
|
return ((ins1 & ImmMask) ^ (ins2 & ImmMask)) == 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Csel (Conditional Select) */
|
||||||
|
/*
|
||||||
|
SF | Op | S | | RM | Cond | 0 | 0 | Rn | Rd
|
||||||
|
31 | 30 | 29 | 28 27 26 25 24 23 | 20 19 18 17 16 | 15 14 13 12 | 11 | 10 | 9 8 7 6 5 | 4 3 2 1 0
|
||||||
|
*/
|
||||||
|
inline auto AsmCbzCompareOpcodeOnly = [](u32 ins1, u32 ins2) {
|
||||||
|
return ((ins1 ^ ins2) >> 24) == 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline auto AsmBlCompareOpcodeOnly = [](u32 ins1, u32 ins2) {
|
||||||
|
return ((ins1 ^ ins2) >> 26) == 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline auto AsmIsAdrX0 = [](u32 ins) {
|
||||||
|
return (ins & 0x9F00001Fu) == 0x10000000u;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline auto AsmAdrTarget = [](u32 ins, uintptr_t pc) -> uintptr_t {
|
||||||
|
s64 imm = static_cast<s64>((((ins >> 5) & 0x7FFFFu) << 2) | ((ins >> 29) & 0x3u));
|
||||||
|
imm = (imm << 43) >> 43;
|
||||||
|
return static_cast<uintptr_t>(static_cast<s64>(pc) + imm);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline auto AsmSetAdrTarget = [](u32 ins, uintptr_t pc, uintptr_t target) -> u32 {
|
||||||
|
const s64 delta = static_cast<s64>(target) - static_cast<s64>(pc);
|
||||||
|
const u32 immlo = static_cast<u32>(delta & 0x3);
|
||||||
|
const u32 immhi = static_cast<u32>((delta >> 2) & 0x7FFFF);
|
||||||
|
return (ins & ~((0x3u << 29) | (0x7FFFFu << 5))) | (immlo << 29) | (immhi << 5);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline auto AsmIsLdpX = [](u32 ins) {
|
||||||
|
return (ins & 0xFE400000u) == 0xA8400000u;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool AsmComparePrologue(u32 ins1, u32 ins2, u32 ins3, u32 cmp1, u32 cmp2, u32 cmp3) {
|
||||||
|
constexpr u32 StpImmMask = ~((((1u << 7) - 1u) << 15));
|
||||||
|
|
||||||
|
bool firstMatch = (ins1 & StpImmMask) == (cmp1 & StpImmMask);
|
||||||
|
|
||||||
|
constexpr u32 StpRegsImmMask = ~(((1u << 5) - 1u) |(((1u << 5) - 1u) << 10) | (((1u << 7) - 1u) << 15));
|
||||||
|
|
||||||
|
bool secondMatch = (ins2 & StpRegsImmMask) == (cmp2 & StpRegsImmMask);
|
||||||
|
|
||||||
|
constexpr u32 MovMask = ~((1u << 5) - 1u);
|
||||||
|
|
||||||
|
bool thirdMatch = (ins3 & MovMask) == (cmp3 & MovMask);
|
||||||
|
|
||||||
|
return firstMatch && secondMatch && thirdMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool IsFramePushPre(u32 ins) {
|
inline auto AsmCompareCselNoReg = [](u32 ins1, u32 ins2) {
|
||||||
constexpr u32 Pattern = Encode(op::StpPreImm64, {field::Rt, reg::Fp}, {field::Rt2, reg::Lr}, {field::Rn, reg::Sp});
|
constexpr u32 ClearReg = ~(((1 << 10) - 1) | (((1 << 5) - 1) << 16));
|
||||||
return Ignoring(ins, Pattern, field::PairOff8);
|
return ((ins1 & ClearReg) ^ (ins2 & ClearReg)) == 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
constexpr bool IsFramePushOffset(u32 ins) {
|
/* Mul */
|
||||||
constexpr u32 Pattern = Encode(op::StpImm64, {field::Rt, reg::Fp}, {field::Rt2, reg::Lr}, {field::Rn, reg::Sp});
|
/*
|
||||||
return Ignoring(ins, Pattern, field::PairOff8);
|
SF | Op54 | Op31 | RM | o0 | RA | RN | RD
|
||||||
}
|
31 | 30 29 28 27 26 25 24 | 23 22 21 | 20 19 18 17 16 | 15 | 14 13 12 11 10 | 9 8 7 6 5 | 4 3 2 1 0
|
||||||
|
*/
|
||||||
|
inline auto AsmCompareMullNoReg = [](u32 ins1, u32 ins2) {
|
||||||
|
constexpr u32 ClearReg = ~(((1 << 10) - 1) | (((1 << 5) - 1) << 16));
|
||||||
|
return ((ins1 & ClearReg) ^ (ins2 & ClearReg)) == 0;
|
||||||
|
};
|
||||||
|
|
||||||
constexpr bool IsSpSubImm(u32 ins) {
|
/* Mul */
|
||||||
constexpr u32 Pattern = Encode(op::SubImm64, {field::Rd, reg::Sp}, {field::Rn, reg::Sp});
|
/* MUL W11, W24, W26 */
|
||||||
return Ignoring(ins, Pattern, field::Imm12);
|
/* multiplies by 1000, mV -> uV */
|
||||||
}
|
/*
|
||||||
|
SF | Op54 | Op31 | RM | o0 | RA | RN | RD
|
||||||
|
31 | 30 29 28 27 26 25 24 | 23 22 21 | 20 19 18 17 16 | 15 | 14 13 12 11 10 | 9 8 7 6 5 | 4 3 2 1 0
|
||||||
|
*/
|
||||||
|
inline auto AsmGetMullRn = [](u32 ins) {
|
||||||
|
constexpr u32 Mask = ((1 << 5) - 1) << 5;
|
||||||
|
return (ins & Mask) >> 5;
|
||||||
|
};
|
||||||
|
|
||||||
constexpr bool IsFramePush(u32 ins) {
|
inline auto AsmGetMullRm = [](u32 ins) {
|
||||||
return IsFramePushPre(ins) || IsFramePushOffset(ins);
|
constexpr u32 Mask = ((1 << 5) - 1) << 16;
|
||||||
}
|
return (ins & Mask) >> 16;
|
||||||
|
};
|
||||||
|
|
||||||
constexpr bool IsCondBranch(u32 ins) {
|
/* Subs (Shifted register) */
|
||||||
return (ins & 0xFF000010u) == op::BCond;
|
/*
|
||||||
}
|
SF | Op | S | | Shift | 0 | RM | Imm6 | Rn | Rd
|
||||||
|
31 | 30 | 29 | 28 27 26 25 24 | 23 22 | 21 | 20 19 18 17 16 | 15 14 13 12 11 10 | 9 8 7 6 5 | 4 3 2 1 0
|
||||||
|
*/
|
||||||
|
inline auto AsmSubsSetRn = [](u32 ins, u8 rn) {
|
||||||
|
constexpr u32 RnMaskClear = ~(((1u << 5) - 1u) << 5);
|
||||||
|
constexpr u32 RnMaskSet = (1u << 5) - 1u;
|
||||||
|
|
||||||
constexpr bool IsCompareBranch(u32 ins) {
|
return (ins & RnMaskClear) | ((static_cast<u32>(rn) & RnMaskSet) << 5);
|
||||||
return (ins & 0x7E000000u) == op::Cbz;
|
};
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool IsTestBranch(u32 ins) {
|
/* Subs (Immediate) */
|
||||||
return (ins & 0x7E000000u) == 0x36000000u;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline u32 *FindFnEnd(u32 *prologue, u32 *limit) {
|
/*
|
||||||
u32 *furthest = prologue;
|
SF | Op | S | | Sh | Imm12 | Rn | Rd
|
||||||
for (u32 *ptr = prologue; ptr < limit; ++ptr) {
|
31 | 30 | 29 | 28 27 26 25 24 23 | 22 | 21 20 19 18 17 16 15 14 13 12 11 10 | 9 8 7 6 5 | 4 3 2 1 0
|
||||||
const u32 ins = *ptr;
|
*/
|
||||||
if (ins == RetIns && ptr >= furthest) {
|
inline auto AsmSubsSetImm12 = [](u32 ins, u16 imm12) {
|
||||||
return ptr + 1;
|
constexpr u32 ClearMask = ~(((1u << 12) - 1) << 10);
|
||||||
}
|
constexpr u32 SetImm12Mask = ( 1u << 12) - 1;
|
||||||
|
|
||||||
s64 delta = 0;
|
return (ins & ClearMask) | ((imm12 & SetImm12Mask) << 10);
|
||||||
if (IsCondBranch(ins) || IsCompareBranch(ins)) {
|
};
|
||||||
delta = SignExtend(static_cast<u64>(Get(ins, field::Imm19)) << 2, 21);
|
|
||||||
} else if (IsTestBranch(ins)) {
|
|
||||||
delta = SignExtend(static_cast<u64>(GetField(ins, 5, 14)) << 2, 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ptr + (delta >> 2) > furthest) {
|
inline auto AsmSubsCompareNoReg = [](u32 ins1, u32 ins2) {
|
||||||
furthest = ptr + (delta >> 2);
|
return ((ins1 ^ ins2) >> 10) == 0;
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
inline auto AsmCompareBrConNoImm19 = [](u32 ins1, u32 ins2) {
|
||||||
|
constexpr u32 ClearImm19 = ~(((1 << 19) - 1) << 5);
|
||||||
|
return (ins1 & ClearImm19) == (ins2 & ClearImm19);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool AsmIsFramePush(u32 ins) {
|
||||||
|
constexpr u32 FramePushMask = 0xFFC07FFF;
|
||||||
|
constexpr u32 FramePushValue = 0xA9807BFD;
|
||||||
|
return (ins & FramePushMask) == FramePushValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline u32 *FindFnPrologue(u32 *ptr, u32 margin, u32 *nsoStart) {
|
inline u32 *FindFnPrologue(u32 *ptr, u32 margin, u32 *nsoStart) {
|
||||||
@@ -337,13 +200,9 @@ namespace ams::ldr::hoc::pcv::_asm {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsFramePushPre(*candidate)) {
|
if (AsmIsFramePush(*candidate)) {
|
||||||
return candidate;
|
return candidate;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsFramePushOffset(*candidate) && candidate - 1 >= nsoStart && IsSpSubImm(candidate[-1])) {
|
|
||||||
return candidate - 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@@ -163,30 +163,6 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
};
|
};
|
||||||
static_assert(sizeof(CvbMeta) == 0x78);
|
static_assert(sizeof(CvbMeta) == 0x78);
|
||||||
|
|
||||||
struct SubClockStub {
|
|
||||||
u8 _unknown[0x48];
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SharedClkBus {
|
|
||||||
u64 moduleId;
|
|
||||||
u32 currentRateHz;
|
|
||||||
u32 padding0;
|
|
||||||
u32 *allowedFreqTable;
|
|
||||||
u32 allowedFreqCount;
|
|
||||||
u32 padding1;
|
|
||||||
SubClockStub *subClocksTable;
|
|
||||||
u32 subClockCount;
|
|
||||||
u32 padding2;
|
|
||||||
void *unk30;
|
|
||||||
void *clockSource;
|
|
||||||
u32 targetRateHz;
|
|
||||||
u32 saveDivFlag;
|
|
||||||
u32 idleRateHz; /* Unsure. */
|
|
||||||
u32 alwaysOnFlag;
|
|
||||||
u64 clockSession;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(SharedClkBus) == 0x58);
|
|
||||||
|
|
||||||
constexpr u32 CpuClkOSLimit = 1785'000;
|
constexpr u32 CpuClkOSLimit = 1785'000;
|
||||||
constexpr u32 GpuClkOsLimit = 921'600;
|
constexpr u32 GpuClkOsLimit = 921'600;
|
||||||
constexpr u32 EmcClkOSLimit = 1600'000;
|
constexpr u32 EmcClkOSLimit = 1600'000;
|
||||||
@@ -194,20 +170,9 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
#define R_SKIP() R_SUCCEED()
|
#define R_SKIP() R_SUCCEED()
|
||||||
|
|
||||||
// Count 32 / Index 31 is reserved to be empty
|
// Count 32 / Index 31 is reserved to be empty
|
||||||
/* The actual lut table has a size of 33. */
|
|
||||||
constexpr size_t DvfsTableEntryCount = 32;
|
constexpr size_t DvfsTableEntryCount = 32;
|
||||||
constexpr size_t DvfsTableEntryLimit = DvfsTableEntryCount - 1;
|
constexpr size_t DvfsTableEntryLimit = DvfsTableEntryCount - 1;
|
||||||
|
|
||||||
// EMC-only limit.
|
|
||||||
constexpr size_t EmcDvfsTableEntryCount = 64;
|
|
||||||
constexpr size_t EmcDvfsTableEntryLimit = EmcDvfsTableEntryCount - 1;
|
|
||||||
|
|
||||||
/* Note: According to TRM the lut size is 33, but up to 64 LUT is possible. */
|
|
||||||
constexpr size_t ClDvfsLutSize = 64;
|
|
||||||
|
|
||||||
inline uintptr_t g_pcv_cave = 0;
|
|
||||||
inline size_t g_pcv_cave_size = 0;
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
size_t GetDvfsTableEntryCount(T *table_head) {
|
size_t GetDvfsTableEntryCount(T *table_head) {
|
||||||
using NT = std::remove_const_t<std::remove_volatile_t<T>>;
|
using NT = std::remove_const_t<std::remove_volatile_t<T>>;
|
||||||
|
|||||||
+294
-44
@@ -21,14 +21,24 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "../pcv.hpp"
|
#include "pcv.hpp"
|
||||||
#include "../../mtc_timing_value.hpp"
|
#include "../mtc_timing_value.hpp"
|
||||||
#include "calculate_timings_erista.hpp"
|
#include "../erista/calculate_timings_erista.hpp"
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::erista {
|
namespace ams::ldr::hoc::pcv::erista {
|
||||||
|
|
||||||
|
struct HookPayloadData {
|
||||||
|
struct {
|
||||||
|
EristaMtcTable *mtcTable;
|
||||||
|
u32 mtcCount;
|
||||||
|
} mtcTableAsm;
|
||||||
|
};
|
||||||
|
DEFINE_HOOK_PAYLOAD_PTR(HookPayloadData, e_HookPayloadData);
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
std::vector<u32> newEmcList;
|
std::vector<u32> newEmcList;
|
||||||
|
u32 *nsoStart;
|
||||||
|
u32 *nsoEnd;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
u32 *getEristaMtcTableFnSite = nullptr;
|
u32 *getEristaMtcTableFnSite = nullptr;
|
||||||
@@ -37,6 +47,155 @@ namespace ams::ldr::hoc::pcv::erista {
|
|||||||
} getMtcTableCache;
|
} getMtcTableCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result CpuVoltDvfs(u32 *ptr) {
|
||||||
|
if (std::memcmp(ptr + 5, cpuVoltDvfsPattern, sizeof(cpuVoltDvfsPattern))) {
|
||||||
|
R_THROW(ldr::ResultInvalidCpuMinVolt());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (C.eristaCpuVmin) {
|
||||||
|
PATCH_OFFSET(ptr, C.eristaCpuVmin);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (C.eristaCpuUV) {
|
||||||
|
PATCH_OFFSET(ptr - 2, C.eristaCpuVmin);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (C.eristaCpuMaxVolt) {
|
||||||
|
PATCH_OFFSET(ptr + 5, C.eristaCpuMaxVolt);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result CpuVoltThermals(u32 *ptr) {
|
||||||
|
if (std::memcmp(ptr - 6, cpuVoltageThermalPattern, sizeof(cpuVoltageThermalPattern))) {
|
||||||
|
R_THROW(ldr::ResultInvalidCpuMinVolt());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (C.eristaCpuVmin) {
|
||||||
|
PATCH_OFFSET( ptr, C.eristaCpuVmin);
|
||||||
|
PATCH_OFFSET(ptr + 3, C.eristaCpuVmin);
|
||||||
|
PATCH_OFFSET(ptr + 6, C.eristaCpuVmin);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (C.eristaCpuMaxVolt) {
|
||||||
|
PATCH_OFFSET(ptr - 2, C.eristaCpuMaxVolt);
|
||||||
|
PATCH_OFFSET(ptr + 1, C.eristaCpuMaxVolt);
|
||||||
|
PATCH_OFFSET(ptr + 4, C.eristaCpuMaxVolt);
|
||||||
|
PATCH_OFFSET(ptr + 7, C.eristaCpuMaxVolt);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result CpuVoltDfll(u32* ptr) {
|
||||||
|
CvbCpuDfllData *entry = reinterpret_cast<CvbCpuDfllData *>(ptr);
|
||||||
|
|
||||||
|
R_UNLESS(entry->tune0_low == 0xFFEAD0FF, ldr::ResultInvalidCpuVoltDfllEntry());
|
||||||
|
R_UNLESS(entry->tune0_high == 0x0, ldr::ResultInvalidCpuVoltDfllEntry());
|
||||||
|
R_UNLESS(entry->tune1_low == 0x0, ldr::ResultInvalidCpuVoltDfllEntry());
|
||||||
|
R_UNLESS(entry->tune1_high == 0x0, ldr::ResultInvalidCpuVoltDfllEntry());
|
||||||
|
|
||||||
|
if (!C.eristaCpuUV) {
|
||||||
|
R_SKIP();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(C.eristaCpuUV) {
|
||||||
|
case 1:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xffff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27007ff);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xefff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27407ff);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27807ff);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xdfdf);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27a07ff);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xcfdf);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x37007ff);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result GpuVoltDVFS(u32 *ptr) {
|
||||||
|
if (std::memcmp(ptr, gpuVoltDvfsPattern, sizeof(gpuVoltDvfsPattern))) {
|
||||||
|
R_THROW(ldr::ResultInvalidGpuDvfs());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (C.eristaGpuVmin) {
|
||||||
|
PATCH_OFFSET(ptr, C.eristaGpuVmin);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result GpuVoltThermals(u32 *ptr) {
|
||||||
|
if (std::memcmp(ptr - 3, gpuVoltThermalPattern, sizeof(gpuVoltThermalPattern))) {
|
||||||
|
R_THROW(ldr::ResultInvalidGpuDvfs());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (C.eristaGpuVmin) {
|
||||||
|
PATCH_OFFSET(ptr, C.eristaGpuVmin);
|
||||||
|
PATCH_OFFSET(ptr + 3, C.eristaGpuVmin);
|
||||||
|
PATCH_OFFSET(ptr + 6, C.eristaGpuVmin);
|
||||||
|
PATCH_OFFSET(ptr + 9, C.eristaGpuVmin);
|
||||||
|
PATCH_OFFSET(ptr + 12, C.eristaGpuVmin);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result GpuFreqMaxAsm(u32 *ptr32) {
|
||||||
|
// Check if both two instructions match the pattern
|
||||||
|
u32 ins1 = *ptr32, ins2 = *(ptr32 + 1);
|
||||||
|
if (!(asm_compare_no_rd(ins1, GpuAsmPattern[0]) && asm_compare_no_rd(ins2, GpuAsmPattern[1]))) {
|
||||||
|
R_THROW(ldr::ResultInvalidGpuFreqMaxPattern());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Both instructions should operate on the same register
|
||||||
|
u8 rd = asm_get_rd(ins1);
|
||||||
|
if (rd != asm_get_rd(ins2)) {
|
||||||
|
R_THROW(ldr::ResultInvalidGpuFreqMaxPattern());
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 max_clock;
|
||||||
|
switch (C.eristaGpuUV) {
|
||||||
|
case 0:
|
||||||
|
max_clock = GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
max_clock = GetDvfsTableLastEntry(C.eristaGpuDvfsTableSLT)->freq;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
max_clock = GetDvfsTableLastEntry(C.eristaGpuDvfsTableHiOPT)->freq;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
max_clock = GetDvfsTableLastEntry(C.eristaGpuDvfsTable)->freq;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 asm_patch[2] = {
|
||||||
|
asm_set_rd(asm_set_imm16(GpuAsmPattern[0], max_clock), rd),
|
||||||
|
asm_set_rd(asm_set_imm16(GpuAsmPattern[1], max_clock >> 16), rd)
|
||||||
|
};
|
||||||
|
|
||||||
|
PATCH_OFFSET(ptr32, asm_patch[0]);
|
||||||
|
PATCH_OFFSET(ptr32 + 1, asm_patch[1]);
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
/* Note: This does not have proper timings, so base latency adjustment will not work. */
|
/* Note: This does not have proper timings, so base latency adjustment will not work. */
|
||||||
/* However, it may still achieve a slightly higher frequency, but not as much as it could be. */
|
/* However, it may still achieve a slightly higher frequency, but not as much as it could be. */
|
||||||
/* I'm certainly not insane enough to attempt this pain again, so this will have to do *for now*. */
|
/* I'm certainly not insane enough to attempt this pain again, so this will have to do *for now*. */
|
||||||
@@ -46,9 +205,10 @@ namespace ams::ldr::hoc::pcv::erista {
|
|||||||
#define WRITE_PARAM_ALL_REG(TABLE, PARAM, VALUE) \
|
#define WRITE_PARAM_ALL_REG(TABLE, PARAM, VALUE) \
|
||||||
TABLE->burst_regs.PARAM = VALUE; \
|
TABLE->burst_regs.PARAM = VALUE; \
|
||||||
TABLE->shadow_regs_ca_train.PARAM = VALUE; \
|
TABLE->shadow_regs_ca_train.PARAM = VALUE; \
|
||||||
TABLE->shadow_regs_quse_train.PARAM = VALUE; \
|
|
||||||
TABLE->shadow_regs_rdwr_train.PARAM = VALUE;
|
TABLE->shadow_regs_rdwr_train.PARAM = VALUE;
|
||||||
|
|
||||||
|
#define GET_CYCLE_CEIL(PARAM) u32(CEIL(double(PARAM) / tCK_avg))
|
||||||
|
|
||||||
/* Ram power down */
|
/* Ram power down */
|
||||||
/* B31: DRAM_CLKSTOP_PD */
|
/* B31: DRAM_CLKSTOP_PD */
|
||||||
/* B30: DRAM_CLKSTOP_SR */
|
/* B30: DRAM_CLKSTOP_SR */
|
||||||
@@ -65,6 +225,14 @@ namespace ams::ldr::hoc::pcv::erista {
|
|||||||
refresh_raw = MIN(refresh_raw, static_cast<u32>(0xFFFF));
|
refresh_raw = MIN(refresh_raw, static_cast<u32>(0xFFFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (table->rate_khz > 3200000) {
|
||||||
|
rext = 30;
|
||||||
|
} else if (table->rate_khz >= 2133001) {
|
||||||
|
rext = 28;
|
||||||
|
} else {
|
||||||
|
rext = 26;
|
||||||
|
}
|
||||||
|
|
||||||
u32 trefbw = refresh_raw + 0x40;
|
u32 trefbw = refresh_raw + 0x40;
|
||||||
trefbw = MIN(trefbw, static_cast<u32>(0x3FFF));
|
trefbw = MIN(trefbw, static_cast<u32>(0x3FFF));
|
||||||
|
|
||||||
@@ -103,37 +271,37 @@ namespace ams::ldr::hoc::pcv::erista {
|
|||||||
WRITE_PARAM_ALL_REG(table, emc_pchg2pden, GET_CYCLE_CEIL(1.763));
|
WRITE_PARAM_ALL_REG(table, emc_pchg2pden, GET_CYCLE_CEIL(1.763));
|
||||||
WRITE_PARAM_ALL_REG(table, emc_ar2pden, GET_CYCLE_CEIL(1.75));
|
WRITE_PARAM_ALL_REG(table, emc_ar2pden, GET_CYCLE_CEIL(1.75));
|
||||||
WRITE_PARAM_ALL_REG(table, emc_pdex2cke, GET_CYCLE_CEIL(1.05));
|
WRITE_PARAM_ALL_REG(table, emc_pdex2cke, GET_CYCLE_CEIL(1.05));
|
||||||
WRITE_PARAM_ALL_REG(table, emc_act2pden, GET_CYCLE_CEIL(1.75));
|
WRITE_PARAM_ALL_REG(table, emc_act2pden, GET_CYCLE_CEIL(14.0));
|
||||||
WRITE_PARAM_ALL_REG(table, emc_cke2pden, GET_CYCLE_CEIL(8.499));
|
WRITE_PARAM_ALL_REG(table, emc_cke2pden, GET_CYCLE_CEIL(8.499));
|
||||||
WRITE_PARAM_ALL_REG(table, emc_pdex2mrr, GET_CYCLE_CEIL(pdex2mrr));
|
WRITE_PARAM_ALL_REG(table, emc_pdex2mrr, GET_CYCLE_CEIL(pdex2mrr));
|
||||||
WRITE_PARAM_ALL_REG(table, emc_rw2pden, tWTPDEN);
|
WRITE_PARAM_ALL_REG(table, emc_rw2pden, tWTPDEN);
|
||||||
|
|
||||||
/* Accept imperfection or prepare for suffering. */
|
/* Accept imperfection or prepare for suffering. */
|
||||||
// #if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
|
// #if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
|
||||||
WRITE_PARAM_ALL_REG(table, emc_einput, einput);
|
// WRITE_PARAM_ALL_REG(table, emc_einput, einput);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_einput_duration, einput_duration);
|
// WRITE_PARAM_ALL_REG(table, emc_einput_duration, einput_duration);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_obdly, obdly);
|
WRITE_PARAM_ALL_REG(table, emc_obdly, obdly);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_ibdly, ibdly);
|
// WRITE_PARAM_ALL_REG(table, emc_ibdly, ibdly);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_wdv_mask, wdv);
|
// WRITE_PARAM_ALL_REG(table, emc_wdv_mask, wdv);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_quse_width, quse_width);
|
// WRITE_PARAM_ALL_REG(table, emc_quse_width, quse_width);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_quse, quse);
|
// WRITE_PARAM_ALL_REG(table, emc_quse, quse);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_wdv, wdv);
|
WRITE_PARAM_ALL_REG(table, emc_wdv, wdv);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_wsv, wsv);
|
WRITE_PARAM_ALL_REG(table, emc_wsv, wsv);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_wev, wev);
|
WRITE_PARAM_ALL_REG(table, emc_wev, wev);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_qrst, qrst);
|
// WRITE_PARAM_ALL_REG(table, emc_qrst, qrst);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_tr_qrst, qrst);
|
// WRITE_PARAM_ALL_REG(table, emc_tr_qrst, qrst);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_qsafe, qsafe);
|
// WRITE_PARAM_ALL_REG(table, emc_qsafe, qsafe);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_tr_qsafe, qsafe);
|
// WRITE_PARAM_ALL_REG(table, emc_tr_qsafe, qsafe);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_tr_qpop, qpop);
|
// WRITE_PARAM_ALL_REG(table, emc_tr_qpop, qpop);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_qpop, qpop);
|
// WRITE_PARAM_ALL_REG(table, emc_qpop, qpop);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_rdv, rdv);
|
// WRITE_PARAM_ALL_REG(table, emc_rdv, rdv);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_tr_rdv_mask, rdv + 2);
|
// WRITE_PARAM_ALL_REG(table, emc_tr_rdv_mask, rdv + 2);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_rdv_early, rdv - 2);
|
// WRITE_PARAM_ALL_REG(table, emc_rdv_early, rdv - 2);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_rdv_early_mask, rdv);
|
// WRITE_PARAM_ALL_REG(table, emc_rdv_early_mask, rdv);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_rdv_mask, rdv + 2);
|
// WRITE_PARAM_ALL_REG(table, emc_rdv_mask, rdv + 2);
|
||||||
WRITE_PARAM_ALL_REG(table, emc_tr_rdv, rdv);
|
// WRITE_PARAM_ALL_REG(table, emc_tr_rdv, rdv);
|
||||||
table->emc_mrw2 = (table->emc_mrw2 & ~0xFFu) | static_cast<u32>(mrw2);
|
table->emc_mrw2 = (table->emc_mrw2 & ~0xFFu) | static_cast<u32>(mrw2);
|
||||||
table->dram_timings.rl = RL;
|
// table->dram_timings.rl = RL;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
constexpr double MC_ARB_DIV = 4.0;
|
constexpr double MC_ARB_DIV = 4.0;
|
||||||
@@ -224,7 +392,8 @@ namespace ams::ldr::hoc::pcv::erista {
|
|||||||
const u32 tRFCabStock = tRFC_values[0] * 2;
|
const u32 tRFCabStock = tRFC_values[0] * 2;
|
||||||
table->dram_timings.t_rfc = tRFCabStock;
|
table->dram_timings.t_rfc = tRFCabStock;
|
||||||
|
|
||||||
table->emc_mrw = (table->emc_mrw & ~0x70u) | (GetNWrIndex() << 4);
|
table->emc_mrw2 = (table->emc_mrw2 & ~0xFFu) | static_cast<u32>(mrw2);
|
||||||
|
table->emc_mrw = (table->emc_mrw & ~0x70u) | 0x40; /* nWR */
|
||||||
table->emc_cfg_2 = 0x11083D;
|
table->emc_cfg_2 = 0x11083D;
|
||||||
table->min_volt = std::clamp(900 + (C.emcDvbShift * 25), 900, 1050);
|
table->min_volt = std::clamp(900 + (C.emcDvbShift * 25), 900, 1050);
|
||||||
}
|
}
|
||||||
@@ -403,6 +572,33 @@ namespace ams::ldr::hoc::pcv::erista {
|
|||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result GpuFreqPllMax(u32 *ptr) {
|
||||||
|
clk_pll_param *entry = reinterpret_cast<clk_pll_param *>(ptr);
|
||||||
|
|
||||||
|
// All zero except for freq
|
||||||
|
for (size_t i = 1; i < sizeof(clk_pll_param) / sizeof(u32); i++) {
|
||||||
|
R_UNLESS(*(ptr + i) == 0, ldr::ResultInvalidGpuPllEntry());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Double the max clk simply
|
||||||
|
u32 max_clk = entry->freq * 2;
|
||||||
|
entry->freq = max_clk;
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
// patch out 1305MHz limit on erista, don't use this!
|
||||||
|
// Result GpuFreqPllLimit(u32 *ptr) {
|
||||||
|
// u32 prev_freq = *(ptr - 1);
|
||||||
|
|
||||||
|
// if (prev_freq != 128000 && prev_freq != 1300000 && prev_freq != 76800) {
|
||||||
|
// R_THROW(ldr::ResultInvalidGpuPllEntry());
|
||||||
|
// }
|
||||||
|
|
||||||
|
// PATCH_OFFSET(ptr, 3600000);
|
||||||
|
|
||||||
|
// R_SUCCEED();
|
||||||
|
// }
|
||||||
|
|
||||||
HOOK_PAYLOAD_FN EristaMtcTable *GetEristaMtcTableImpl(u32 *count) {
|
HOOK_PAYLOAD_FN EristaMtcTable *GetEristaMtcTableImpl(u32 *count) {
|
||||||
const HookPayloadData *data = HOOK_PAYLOAD_PTR(HookPayloadData, e_HookPayloadData);
|
const HookPayloadData *data = HOOK_PAYLOAD_PTR(HookPayloadData, e_HookPayloadData);
|
||||||
|
|
||||||
@@ -410,18 +606,6 @@ namespace ams::ldr::hoc::pcv::erista {
|
|||||||
return data->mtcTableAsm.mtcTable;
|
return data->mtcTableAsm.mtcTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result MtcInstallHooks(HookPayloadData *data) {
|
|
||||||
R_UNLESS(getMtcTableCache.getEristaMtcTableFnSite != nullptr && getMtcTableCache.mtcTable != nullptr, ldr::ResultInvalidMtcTablePattern());
|
|
||||||
|
|
||||||
/* Copy the data to the payload. */
|
|
||||||
data->mtcTableAsm.mtcTable = reinterpret_cast<EristaMtcTable *>(Hooks().ToVa(getMtcTableCache.mtcTable));
|
|
||||||
data->mtcTableAsm.mtcCount = newEmcList.size();
|
|
||||||
|
|
||||||
R_TRY(INSTALL_IMPL_HOOK(getMtcTableCache.getEristaMtcTableFnSite, GetEristaMtcTableImpl));
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result MemMtcTableAsm(u32 *ptr) {
|
Result MemMtcTableAsm(u32 *ptr) {
|
||||||
/* Return if the pattern was already found. */
|
/* Return if the pattern was already found. */
|
||||||
/* This pattern happens multiple times in this function., we only need to find it once. */
|
/* This pattern happens multiple times in this function., we only need to find it once. */
|
||||||
@@ -437,28 +621,27 @@ namespace ams::ldr::hoc::pcv::erista {
|
|||||||
R_UNLESS(ptr - MovOffset >= nsoStart, ldr::ResultInvalidMtcTablePattern());
|
R_UNLESS(ptr - MovOffset >= nsoStart, ldr::ResultInvalidMtcTablePattern());
|
||||||
|
|
||||||
u32 adrp = *(ptr - AddrpOffset);
|
u32 adrp = *(ptr - AddrpOffset);
|
||||||
R_UNLESS(_asm::Ignoring(adrp, MtcAdrpAsm, _asm::field::ImmAdrpHi, _asm::field::ImmAdrpLo), ldr::ResultInvalidMtcTablePattern());
|
R_UNLESS(AsmCompareAdrpNoImm(adrp, MtcAdrpAsm), ldr::ResultInvalidMtcTablePattern());
|
||||||
|
|
||||||
/* Check for the branch instruction above the cbz to ensure we are patching the right location. */
|
/* Check for the branch instruction above the cbz to ensure we are patching the right location*/
|
||||||
/* Only the opcode is checked; the call target varies by firmware (0x97ffae64 on one build). */
|
|
||||||
u32 bl = *(ptr - BlOffset);
|
u32 bl = *(ptr - BlOffset);
|
||||||
R_UNLESS(_asm::IsOp(bl, _asm::op::Bl, _asm::field::Imm26), ldr::ResultInvalidMtcTablePattern());
|
R_UNLESS(AsmBlCompareOpcodeOnly(bl, MtcBlIns), ldr::ResultInvalidMtcTablePattern());
|
||||||
|
|
||||||
/* Check for the mov that actually sets the mtc table count. */
|
/* Check for the mov that actually sets the mtc table count. */
|
||||||
u32 mov = *(ptr - MovOffset);
|
u32 mov = *(ptr - MovOffset);
|
||||||
bool foundMov = false;
|
bool foundMov = false;
|
||||||
foundMov = _asm::Ignoring(mov, MtcMovAsm, _asm::field::Rd);
|
foundMov = asm_compare_no_rd(mov, MtcMovAsm);
|
||||||
|
|
||||||
if (!foundMov) {
|
if (!foundMov) {
|
||||||
mov = *(ptr + MovOffsetOld);
|
mov = *(ptr + MovOffsetOld);
|
||||||
/* Check old firmware offset. */
|
/* Check old firmware offset. */
|
||||||
foundMov = _asm::Ignoring(mov, MtcMovAsm, _asm::field::Rd);
|
foundMov = asm_compare_no_rd(mov, MtcMovAsm);
|
||||||
}
|
}
|
||||||
|
|
||||||
R_UNLESS(foundMov, ldr::ResultInvalidMtcTablePattern());
|
R_UNLESS(foundMov, ldr::ResultInvalidMtcTablePattern());
|
||||||
|
|
||||||
constexpr u32 PrologueWindow = 140;
|
constexpr u32 PrologueWindow = 140;
|
||||||
u32 *functionPrologue = _asm::FindFnPrologue(ptr, PrologueWindow, nsoStart);
|
u32 *functionPrologue = FindFnPrologue(ptr, PrologueWindow, nsoStart);
|
||||||
R_UNLESS(functionPrologue != nullptr, ldr::ResultInvalidMtcTablePattern());
|
R_UNLESS(functionPrologue != nullptr, ldr::ResultInvalidMtcTablePattern());
|
||||||
|
|
||||||
getMtcTableCache.getEristaMtcTableFnSite = functionPrologue;
|
getMtcTableCache.getEristaMtcTableFnSite = functionPrologue;
|
||||||
@@ -467,4 +650,71 @@ namespace ams::ldr::hoc::pcv::erista {
|
|||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result InstallHooks() {
|
||||||
|
R_TRY(Hooks().CheckEnabled());
|
||||||
|
|
||||||
|
R_TRY(Hooks().CopyPayload());
|
||||||
|
|
||||||
|
R_UNLESS(getMtcTableCache.getEristaMtcTableFnSite != nullptr && getMtcTableCache.mtcTable != nullptr, ldr::ResultInvalidMtcTablePattern());
|
||||||
|
|
||||||
|
/* Copy the data to the payload. */
|
||||||
|
auto *data = Hooks().BindData(e_HookPayloadData);
|
||||||
|
R_UNLESS(data != nullptr, ldr::ResultHookDataOutOfMemory());
|
||||||
|
|
||||||
|
data->mtcTableAsm.mtcTable = reinterpret_cast<EristaMtcTable *>(Hooks().ToVa(getMtcTableCache.mtcTable));
|
||||||
|
data->mtcTableAsm.mtcCount = newEmcList.size();
|
||||||
|
R_TRY(INSTALL_IMPL_HOOK(getMtcTableCache.getEristaMtcTableFnSite, GetEristaMtcTableImpl));
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
||||||
|
nsoStart = reinterpret_cast<u32 *>(mapped_nso);
|
||||||
|
nsoEnd = reinterpret_cast<u32 *>(mapped_nso + nso_size);
|
||||||
|
MtcGenerateFreqTables();
|
||||||
|
|
||||||
|
u32 CpuCvbDefaultMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(CpuCvbTableDefault)->freq);
|
||||||
|
u32 GpuCvbDefaultMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(GpuCvbTableDefault)->freq);
|
||||||
|
|
||||||
|
PatcherEntry<u32> patches[] = {
|
||||||
|
{"CPU Freq Table", CpuFreqCvbTable<false>, 1, nullptr, CpuCvbDefaultMaxFreq },
|
||||||
|
{"CPU Volt DVFS", &CpuVoltDvfs, 1, nullptr, CpuVminOfficial },
|
||||||
|
{"CPU Volt Thermals", &CpuVoltThermals, 1, nullptr, CpuVminOfficial },
|
||||||
|
{"CPU Volt Dfll", &CpuVoltDfll, 1, nullptr, CpuTune0Low },
|
||||||
|
{"GPU Volt DVFS", &GpuVoltDVFS, 1, nullptr, GpuVminOfficial },
|
||||||
|
{"GPU Volt Thermals", &GpuVoltThermals, 1, nullptr, GpuVminOfficial },
|
||||||
|
{"GPU Freq Table", GpuFreqCvbTable<false>, 1, nullptr, GpuCvbDefaultMaxFreq },
|
||||||
|
{"GPU Freq Asm", &GpuFreqMaxAsm, 2, &GpuMaxClockPatternFn },
|
||||||
|
{"GPU PLL Max", &GpuFreqPllMax, 1, nullptr, GpuClkPllMax },
|
||||||
|
// {"GPU PLL Limit", &GpuFreqPllLimit, 4, nullptr, GpuClkPllLimit },
|
||||||
|
{"MEM Table Asm", &MemMtcTableAsm, 4, &MemMtcGetGetTablePatternFn },
|
||||||
|
{"MEM Freq Mtc", &MemFreqMtcTable, 1, nullptr, EmcClkOSLimit },
|
||||||
|
{"MEM Freq Max", &MemFreqMax, 0, nullptr, EmcClkOSLimit },
|
||||||
|
{"MEM Freq PLLM", &MemFreqPllmLimit, 2, nullptr, EmcClkPllmLimit },
|
||||||
|
{"MEM Volt", &MemVoltHandler, 2, nullptr, MemVoltHOS },
|
||||||
|
};
|
||||||
|
|
||||||
|
for (uintptr_t ptr = mapped_nso; ptr <= mapped_nso + nso_size - sizeof(EristaMtcTable); ptr += sizeof(u32)) {
|
||||||
|
u32 *ptr32 = reinterpret_cast<u32 *>(ptr);
|
||||||
|
for (auto &entry : patches) {
|
||||||
|
if (R_SUCCEEDED(entry.SearchAndApply(ptr32))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto &entry : patches) {
|
||||||
|
LOGGING("%s Count: %zu\n", entry.description, entry.patched_count);
|
||||||
|
if (R_FAILED(entry.CheckResult())) {
|
||||||
|
panic::SmcError(panic::Patch);
|
||||||
|
|
||||||
|
CRASH(entry.description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (R_FAILED(InstallHooks())) {
|
||||||
|
panic::SmcError(panic::Patch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) Switch-OC-Suite
|
||||||
|
*
|
||||||
|
* Copyright (c) 2023 hanai3Bi
|
||||||
|
*
|
||||||
|
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../oc_common.hpp"
|
||||||
|
#include "pcv_common.hpp"
|
||||||
|
#include "pcv_asm.hpp"
|
||||||
|
|
||||||
|
namespace ams::ldr::hoc::pcv::erista {
|
||||||
|
|
||||||
|
constexpr cvb_entry_t CpuCvbTableDefault[] = {
|
||||||
|
// CPU_PLL_CVB_TABLE_ODN
|
||||||
|
{ 204000, {721094}, { } },
|
||||||
|
{ 306000, {754040}, { } },
|
||||||
|
{ 408000, {786986}, { } },
|
||||||
|
{ 510000, {819932}, { } },
|
||||||
|
{ 612000, {852878}, { } },
|
||||||
|
{ 714000, {885824}, { } },
|
||||||
|
{ 816000, {918770}, { } },
|
||||||
|
{ 918000, {951716}, { } },
|
||||||
|
{ 1020000, {984662}, { -2875621, 358099, -8585} },
|
||||||
|
{ 1122000, {1017608}, { -52225, 104159, -2816} },
|
||||||
|
{ 1224000, {1050554}, { 1076868, 8356, -727} },
|
||||||
|
{ 1326000, {1083500}, { 2208191, -84659, 1240} },
|
||||||
|
{ 1428000, {1116446}, { 2519460, -105063, 1611} },
|
||||||
|
{ 1581000, {1130000}, { 2889664, -122173, 1834} },
|
||||||
|
{ 1683000, {1168000}, { 5100873, -279186, 4747} },
|
||||||
|
{ 1785000, {1227500}, { 5100873, -279186, 4747} },
|
||||||
|
{ },
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr u32 CpuVoltOfficial = 1227;
|
||||||
|
constexpr u32 CpuVminOfficial = 825;
|
||||||
|
constexpr u32 CpuTune0Low = 0xFFEAD0FF;
|
||||||
|
|
||||||
|
constexpr u32 CpuVoltL4T = 1257'000;
|
||||||
|
|
||||||
|
static const u32 cpuVoltDvfsPattern[] = { 1227, 1000, 100, 1000, 0 };
|
||||||
|
static_assert(sizeof(cpuVoltDvfsPattern) == 0x14, "Invalid cpuVoltDvfsPattern size");
|
||||||
|
|
||||||
|
static const u32 cpuVoltageThermalPattern[] = { 950, 1132, 0, 950, 1227, 0, 825, 1227, 15000, 825, 1170, 60000, 825, 1132, 80000 };
|
||||||
|
static_assert(sizeof(cpuVoltageThermalPattern) == 0x3c, "Invalid cpuVoltageThermalPattern size");
|
||||||
|
|
||||||
|
constexpr u32 GpuClkPllLimit = 2'600'000;
|
||||||
|
constexpr u32 GpuClkPllMax = 921'600'000;
|
||||||
|
constexpr u32 GpuVminOfficial = 810;
|
||||||
|
|
||||||
|
constexpr u16 CpuMinVolts[] = { 950, 850, 825, 810 };
|
||||||
|
|
||||||
|
static const u32 gpuVoltDvfsPattern[] = { 810, 1150, 1000, 100, 1000, 10, };
|
||||||
|
static_assert(sizeof(gpuVoltDvfsPattern) == (sizeof(u32) * 6), "Invalid gpuVoltDvfsPattern");
|
||||||
|
|
||||||
|
static const u32 gpuVoltThermalPattern[] = { 950, 1132, 0, 810, 1132, 15000, 810, 1132, 30000, 810, 1132, 50000, 810, 1132, 70000, 810, 1132, 105000 };
|
||||||
|
static_assert(sizeof(gpuVoltThermalPattern) == 0x48, "Invalid gpuVoltageThermalPattern size");
|
||||||
|
|
||||||
|
/* GPU Max Clock asm Pattern:
|
||||||
|
*
|
||||||
|
* MOV W11, #0x1000 MOV (wide immediate) 0x1000 0xB (11)
|
||||||
|
* sf | opc | | hw | imm16 | Rd
|
||||||
|
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
||||||
|
* 0 | 1 0 | 1 0 0 1 0 1| 0 0| 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 |0 1 0 1 1
|
||||||
|
*
|
||||||
|
* MOVK W11, #0xE, LSL#16 <shift>16 0xE 0xB (11)
|
||||||
|
* sf | opc | | hw | imm16 | Rd
|
||||||
|
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
||||||
|
* 0 | 1 1 | 1 0 0 1 0 1| 0 1| 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 |0 1 0 1 1
|
||||||
|
*/
|
||||||
|
inline constexpr u32 GpuAsmPattern[] = { 0x52820000, 0x72A001C0 };
|
||||||
|
|
||||||
|
inline bool GpuMaxClockPatternFn(u32 *ptr32) {
|
||||||
|
return asm_compare_no_rd(*ptr32, GpuAsmPattern[0]);
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr cvb_entry_t GpuCvbTableDefault[] = {
|
||||||
|
// NA_FREQ_CVB_TABLE
|
||||||
|
{ 76800, {}, { 814294, 8144, -940, 808, -21583, 226, } },
|
||||||
|
{ 153600, {}, { 856185, 8144, -940, 808, -21583, 226, } },
|
||||||
|
{ 230400, {}, { 898077, 8144, -940, 808, -21583, 226, } },
|
||||||
|
{ 307200, {}, { 939968, 8144, -940, 808, -21583, 226, } },
|
||||||
|
{ 384000, {}, { 981860, 8144, -940, 808, -21583, 226, } },
|
||||||
|
{ 460800, {}, { 1023751, 8144, -940, 808, -21583, 226, } },
|
||||||
|
{ 537600, {}, { 1065642, 8144, -940, 808, -21583, 226, } },
|
||||||
|
{ 614400, {}, { 1107534, 8144, -940, 808, -21583, 226, } },
|
||||||
|
{ 691200, {}, { 1149425, 8144, -940, 808, -21583, 226, } },
|
||||||
|
{ 768000, {}, { 1191317, 8144, -940, 808, -21583, 226, } },
|
||||||
|
{ 844800, {}, { 1233208, 8144, -940, 808, -21583, 226, } },
|
||||||
|
{ 921600, {}, { 1275100, 8144, -940, 808, -21583, 226, } },
|
||||||
|
{ },
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr u32 EmcListDefault[] = { 40800, 68000, 102000, 204000, 408000, 665600, 800000, 1065600, 1331200, 1600000, };
|
||||||
|
constexpr u32 EmcListSizeDefault = std::size(EmcListDefault);
|
||||||
|
constexpr u32 EmcListEndDefault = EmcListSizeDefault - 1;
|
||||||
|
|
||||||
|
constexpr u32 MemVoltHOS = 1125'000;
|
||||||
|
constexpr u32 EmcClkPllmLimit = 1866'000'000;
|
||||||
|
|
||||||
|
constexpr u32 MTC_TABLE_REV = 7;
|
||||||
|
constexpr u32 MtcTableCountDefault = 10;
|
||||||
|
|
||||||
|
constexpr size_t MtcFullTableSize = sizeof(EristaMtcTable) * MtcTableCountDefault;
|
||||||
|
constexpr u32 MtcFullTableCount = 3;
|
||||||
|
|
||||||
|
/* These dramids were copied from Hekate -- see /bdk/mem/sdram.h */
|
||||||
|
enum DramId {
|
||||||
|
ICOSA_4GB_SAMSUNG_K4F6E304HB_MGCH = 0,
|
||||||
|
ICOSA_4GB_HYNIX_H9HCNNNBPUMLHR_NLE = 1,
|
||||||
|
ICOSA_4GB_MICRON_MT53B512M32D2NP_062_WTC = 2,
|
||||||
|
ICOSA_6GB_SAMSUNG_K4FHE3D4HM_MGCH = 4,
|
||||||
|
ICOSA_8GB_SAMSUNG_K4FBE3D4HM_MGXX = 7,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum MtcTableIndex {
|
||||||
|
T210SdevEmcDvfsTableS4gb01 = 0, /* HB-MGCH, WT:C */
|
||||||
|
T210SdevEmcDvfsTableS6gb01 = 1, /* HM-MGCH */
|
||||||
|
T210SdevEmcDvfsTableH4gb01 = 2, /* HR-NLE */
|
||||||
|
MtcTableIndex_Invalid = 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct MtcDramIndex {
|
||||||
|
DramId dramId;
|
||||||
|
MtcTableIndex index;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* TODO: Test 6gb and 8gb. */
|
||||||
|
const inline MtcDramIndex mtcIndexTable[] = {
|
||||||
|
{ ICOSA_4GB_SAMSUNG_K4F6E304HB_MGCH, T210SdevEmcDvfsTableS4gb01, },
|
||||||
|
{ ICOSA_4GB_MICRON_MT53B512M32D2NP_062_WTC, T210SdevEmcDvfsTableS4gb01, },
|
||||||
|
{ ICOSA_6GB_SAMSUNG_K4FHE3D4HM_MGCH, T210SdevEmcDvfsTableS6gb01, },
|
||||||
|
{ ICOSA_8GB_SAMSUNG_K4FBE3D4HM_MGXX, T210SdevEmcDvfsTableS6gb01, },
|
||||||
|
{ ICOSA_4GB_HYNIX_H9HCNNNBPUMLHR_NLE, T210SdevEmcDvfsTableH4gb01, },
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr u32 MtcBrAsm = 0xD61F0140;
|
||||||
|
constexpr u32 MtcMovAsm = 0x52800148;
|
||||||
|
constexpr u32 MtcAdrpAsm = 0xD0000081;
|
||||||
|
constexpr u32 MtcBlIns = 0x97ffae64;
|
||||||
|
constexpr u32 MtcAddAsm = 0x91131821;
|
||||||
|
|
||||||
|
ALWAYS_INLINE bool MemMtcGetGetTablePatternFn(u32 *ptr) {
|
||||||
|
/* This builds an address that gets returned, so the register must be x0 by convention. */
|
||||||
|
return AsmCompareAddNoImm12(*ptr, MtcAddAsm);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Patch(uintptr_t mapped_nso, size_t nso_size);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,8 +18,7 @@
|
|||||||
|
|
||||||
#include "../oc_common.hpp"
|
#include "../oc_common.hpp"
|
||||||
|
|
||||||
/* aligned(4) is the ARM64 instruction alignment. This saves some memory over 16 byte padding */
|
#define HOOK_PAYLOAD_FN __attribute__((section("hoc_hookpayload"), used, noinline, visibility("hidden")))
|
||||||
#define HOOK_PAYLOAD_FN __attribute__((section("hoc_hookpayload"), used, noinline, visibility("hidden"), aligned(4)))
|
|
||||||
|
|
||||||
/* Inline asm because fuck compilers: GCC refuses to put a variable and a function in the same section. */
|
/* Inline asm because fuck compilers: GCC refuses to put a variable and a function in the same section. */
|
||||||
/* It wants alloc+write for one and alloc+exec for the other. */
|
/* It wants alloc+write for one and alloc+exec for the other. */
|
||||||
@@ -38,9 +37,6 @@
|
|||||||
".text\n"); \
|
".text\n"); \
|
||||||
extern "C" __attribute__((visibility("hidden"))) type *name
|
extern "C" __attribute__((visibility("hidden"))) type *name
|
||||||
|
|
||||||
#define DECLARE_HOOK_PAYLOAD_PTR(type, name) \
|
|
||||||
extern "C" __attribute__((visibility("hidden"))) type *name
|
|
||||||
|
|
||||||
#define HOOK_PAYLOAD_PTR(type, name) \
|
#define HOOK_PAYLOAD_PTR(type, name) \
|
||||||
([]() -> type * { \
|
([]() -> type * { \
|
||||||
type **_hoc_pp; \
|
type **_hoc_pp; \
|
||||||
@@ -55,7 +51,6 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
|
|
||||||
constexpr size_t HookPageSize = 0x1000;
|
constexpr size_t HookPageSize = 0x1000;
|
||||||
constexpr size_t PcvDataArenaSize = 0x1000;
|
constexpr size_t PcvDataArenaSize = 0x1000;
|
||||||
constexpr size_t HookStubReserve = 0x80;
|
|
||||||
|
|
||||||
inline s64 SignExtend(u64 value, int bits) {
|
inline s64 SignExtend(u64 value, int bits) {
|
||||||
const int shift = 64 - bits;
|
const int shift = 64 - bits;
|
||||||
@@ -128,15 +123,6 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
m_data_used = 0;
|
m_data_used = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCave(uintptr_t cave, size_t cave_size) {
|
|
||||||
m_cave = cave;
|
|
||||||
m_cave_size = cave_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
static size_t RequiredCaveSize() {
|
|
||||||
return util::AlignUp(static_cast<size_t>(__stop_hoc_hookpayload - __start_hoc_hookpayload), sizeof(u32)) + HookStubReserve;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsEnabled() const { return m_cave != 0 && m_cave_size != 0; }
|
bool IsEnabled() const { return m_cave != 0 && m_cave_size != 0; }
|
||||||
|
|
||||||
Result CheckEnabled() const {
|
Result CheckEnabled() const {
|
||||||
@@ -158,10 +144,6 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uintptr_t CaveVa() const { return ToVa(reinterpret_cast<const void *>(m_cave)); }
|
uintptr_t CaveVa() const { return ToVa(reinterpret_cast<const void *>(m_cave)); }
|
||||||
uintptr_t CaveBase() const { return m_cave; }
|
|
||||||
|
|
||||||
/* Todo remove? */
|
|
||||||
u32 *Reserve(size_t words) { return this->AllocCode(words); }
|
|
||||||
|
|
||||||
Result CopyPayload() {
|
Result CopyPayload() {
|
||||||
R_TRY(this->CheckEnabled());
|
R_TRY(this->CheckEnabled());
|
||||||
@@ -299,8 +281,6 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
Result ValidatePayloadFn(const void *fn) const {
|
Result ValidatePayloadFn(const void *fn) const {
|
||||||
constexpr u32 MaxInstructions = 512;
|
constexpr u32 MaxInstructions = 512;
|
||||||
constexpr u32 RetInsn = 0xD65F03C0u;
|
constexpr u32 RetInsn = 0xD65F03C0u;
|
||||||
constexpr u32 BrMask = 0xFFFFFC1Fu;
|
|
||||||
constexpr u32 BrInsn = 0xD61F0000u;
|
|
||||||
|
|
||||||
const uintptr_t lo = m_payload;
|
const uintptr_t lo = m_payload;
|
||||||
const uintptr_t hi = m_payload + m_payload_sz;
|
const uintptr_t hi = m_payload + m_payload_sz;
|
||||||
@@ -319,7 +299,7 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
const u32 insn = insns[i];
|
const u32 insn = insns[i];
|
||||||
const uintptr_t site = base + i * sizeof(u32);
|
const uintptr_t site = base + i * sizeof(u32);
|
||||||
|
|
||||||
if (insn == RetInsn || (insn & BrMask) == BrInsn) {
|
if (insn == RetInsn) {
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,7 +331,7 @@ namespace ams::ldr::hoc::pcv {
|
|||||||
private:
|
private:
|
||||||
u32 *AllocCode(size_t words) {
|
u32 *AllocCode(size_t words) {
|
||||||
const size_t bytes = words * sizeof(u32);
|
const size_t bytes = words * sizeof(u32);
|
||||||
if (!this->IsEnabled() || m_payload == 0 || m_used + bytes > m_cave_size) {
|
if (!this->IsEnabled() || m_used + bytes > m_cave_size) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+554
-117
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) B3711
|
* Copyright (c) B3711
|
||||||
*
|
*
|
||||||
* Copyright (c) Souldbminer, Lightos and Horizon OC Contributors
|
* Copyright (c) Souldbminer and Horizon OC Contributors
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -20,15 +20,333 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../pcv.hpp"
|
#include <vector>
|
||||||
#include "../../mtc_timing_value.hpp"
|
#include "pcv.hpp"
|
||||||
#include "calculate_timings_mariko.hpp"
|
#include "../mtc_timing_value.hpp"
|
||||||
#include "pcv_mariko_mtc.hpp"
|
#include "../mariko/calculate_timings.hpp"
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::mariko {
|
namespace ams::ldr::hoc::pcv::mariko {
|
||||||
|
|
||||||
namespace {
|
Result GpuVoltDVFS(u32 *ptr) {
|
||||||
std::vector<u32> newEmcList;
|
/* Check for valid pattern. */
|
||||||
|
for (size_t i = 0; i < std::size(gpuDVFSPattern); ++i) {
|
||||||
|
if (*(ptr + i + 1) != gpuDVFSPattern[i]) {
|
||||||
|
R_THROW(ldr::ResultInvalidGpuDvfs());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Default value is 1050mV. */
|
||||||
|
if (C.marikoGpuVmax) {
|
||||||
|
PATCH_OFFSET(ptr + 1, C.marikoGpuVmax);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (C.marikoGpuVmin) {
|
||||||
|
PATCH_OFFSET(ptr, C.marikoGpuVmin);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result GpuVoltThermals(u32 *ptr) {
|
||||||
|
if (std::memcmp(ptr - 3, gpuVoltThermalPattern, sizeof(gpuVoltThermalPattern))) {
|
||||||
|
R_THROW(ldr::ResultInvalidGpuDvfs());
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (C.marikoGpuBootVolt) {
|
||||||
|
// PATCH_OFFSET(ptr - 3, C.marikoGpuBootVolt);
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (C.marikoGpuVmin) {
|
||||||
|
PATCH_OFFSET(ptr, C.marikoGpuVmin);
|
||||||
|
PATCH_OFFSET(ptr + 3, C.marikoGpuVmin);
|
||||||
|
PATCH_OFFSET(ptr + 6, C.marikoGpuVmin);
|
||||||
|
PATCH_OFFSET(ptr + 9, C.marikoGpuVmin);
|
||||||
|
PATCH_OFFSET(ptr + 12, C.marikoGpuVmin);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CapCpuClock() {
|
||||||
|
u32 cpuCap = allowedCpuMaxFrequencies[0];
|
||||||
|
|
||||||
|
for (u32 freq : allowedCpuMaxFrequencies) {
|
||||||
|
if (C.marikoCpuMaxClock >= freq) {
|
||||||
|
cpuCap = freq;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cpuCap;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result CpuFreqVdd(u32 *ptr) {
|
||||||
|
dvfs_rail *entry = reinterpret_cast<dvfs_rail *>(reinterpret_cast<u8 *>(ptr) - offsetof(dvfs_rail, freq));
|
||||||
|
|
||||||
|
R_UNLESS(entry->id == 1, ldr::ResultInvalidCpuFreqVddEntry());
|
||||||
|
R_UNLESS(entry->min_mv == 250'000, ldr::ResultInvalidCpuFreqVddEntry());
|
||||||
|
R_UNLESS(entry->step_mv == 5000, ldr::ResultInvalidCpuFreqVddEntry());
|
||||||
|
R_UNLESS(entry->max_mv == 1525'000, ldr::ResultInvalidCpuFreqVddEntry());
|
||||||
|
|
||||||
|
if (C.marikoCpuUVHigh) {
|
||||||
|
PATCH_OFFSET(ptr, CapCpuClock());
|
||||||
|
} else {
|
||||||
|
PATCH_OFFSET(ptr, GetDvfsTableLastEntry(C.marikoCpuDvfsTable)->freq);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result CpuVoltDVFS(u32 *ptr) {
|
||||||
|
CvbMeta *cpuCvbMeta = reinterpret_cast<CvbMeta *>(reinterpret_cast<u8 *>(ptr) - offsetof(CvbMeta, vmin));
|
||||||
|
|
||||||
|
R_UNLESS(cpuCvbMeta->highVmin == CpuHighVminOfficial, ldr::ResultInvalidCpuMinVolt());
|
||||||
|
R_UNLESS(cpuCvbMeta->unkStepMaybe == 38, ldr::ResultInvalidCpuMinVolt());
|
||||||
|
R_UNLESS(cpuCvbMeta->vmax == CpuVoltOfficial, ldr::ResultInvalidCpuMinVolt());
|
||||||
|
R_UNLESS(cpuCvbMeta->unkScale2 == 1000, ldr::ResultInvalidCpuMinVolt());
|
||||||
|
R_UNLESS(cpuCvbMeta->speedoScale == 100, ldr::ResultInvalidCpuMinVolt());
|
||||||
|
R_UNLESS(cpuCvbMeta->voltageScale == 1000, ldr::ResultInvalidCpuMinVolt());
|
||||||
|
R_UNLESS(cpuCvbMeta->unkZero5 == 0, ldr::ResultInvalidCpuMinVolt());
|
||||||
|
|
||||||
|
if (C.marikoCpuLowVmin) {
|
||||||
|
PATCH_OFFSET(&(cpuCvbMeta->vmin), C.marikoCpuLowVmin);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (C.marikoCpuHighVmin) {
|
||||||
|
PATCH_OFFSET(&(cpuCvbMeta->highVmin), C.marikoCpuHighVmin);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (C.marikoCpuMaxVolt) {
|
||||||
|
PATCH_OFFSET(&(cpuCvbMeta->vmax), C.marikoCpuMaxVolt);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result CpuVoltThermals(u32 *ptr) {
|
||||||
|
if (std::memcmp(ptr, cpuVoltThermalData, sizeof(cpuVoltThermalData))) {
|
||||||
|
R_THROW(ldr::ResultInvalidCpuMinVolt());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (C.marikoCpuLowVmin) {
|
||||||
|
PATCH_OFFSET(ptr, C.marikoCpuLowVmin);
|
||||||
|
PATCH_OFFSET(ptr + 3, C.marikoCpuLowVmin);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (C.marikoCpuMaxVolt) {
|
||||||
|
PATCH_OFFSET(ptr - 2, C.marikoCpuMaxVolt);
|
||||||
|
PATCH_OFFSET(ptr - 5, C.marikoCpuMaxVolt);
|
||||||
|
PATCH_OFFSET(ptr + 1, C.marikoCpuMaxVolt);
|
||||||
|
PATCH_OFFSET(ptr + 4, C.marikoCpuMaxVolt);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result CpuVoltDfll(u32 *ptr) {
|
||||||
|
CvbCpuDfllData *entry = reinterpret_cast<CvbCpuDfllData *>(ptr);
|
||||||
|
|
||||||
|
R_UNLESS(entry->tune0_low == 0xFFCF, ldr::ResultInvalidCpuVoltDfllEntry());
|
||||||
|
R_UNLESS(entry->tune0_high == 0x0, ldr::ResultInvalidCpuVoltDfllEntry());
|
||||||
|
R_UNLESS(entry->tune1_low == 0x12207FF, ldr::ResultInvalidCpuVoltDfllEntry());
|
||||||
|
R_UNLESS(entry->tune1_high == 0x3FFF7FF, ldr::ResultInvalidCpuVoltDfllEntry());
|
||||||
|
|
||||||
|
switch (C.marikoCpuUVLow) {
|
||||||
|
case 1:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_low), 0xffa0);
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xffff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_low), 0x21107ff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x0);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_low), 0x21107ff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27207ff);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_low), 0xffdf);
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_low), 0x21107ff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27307ff);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_low), 0xffff);
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_low), 0x21107ff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27407ff);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_low), 0x21607ff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27707ff);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_low), 0x21607ff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27807ff);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_low), 0x21607ff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27b07ff);
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_low), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_low), 0x21707ff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27b07ff);
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_low), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_low), 0x21707ff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27c07ff);
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_low), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_low), 0x21707ff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27d07ff);
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_low), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_low), 0x21707ff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27e07ff);
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_low), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_low), 0x21707ff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27f07ff);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (C.marikoCpuUVHigh) {
|
||||||
|
case 1:
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x0);
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xffff);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27207ff);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27307ff);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27407ff);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27707ff);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xffdf);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27807ff);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
case 8:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27b07ff);
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27c07ff);
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27d07ff);
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27e07ff);
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
PATCH_OFFSET(&(entry->tune0_high), 0xdfff);
|
||||||
|
PATCH_OFFSET(&(entry->tune1_high), 0x27f07ff);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result GpuFreqMaxAsm(u32 *ptr32) {
|
||||||
|
// Check if both two instructions match the pattern
|
||||||
|
u32 ins1 = *ptr32, ins2 = *(ptr32 + 1);
|
||||||
|
if (!(asm_compare_no_rd(ins1, GpuAsmPattern[0]) && asm_compare_no_rd(ins2, GpuAsmPattern[1]))) {
|
||||||
|
R_THROW(ldr::ResultInvalidGpuFreqMaxPattern());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Both instructions should operate on the same register
|
||||||
|
u8 rd = asm_get_rd(ins1);
|
||||||
|
if (rd != asm_get_rd(ins2)) {
|
||||||
|
R_THROW(ldr::ResultInvalidGpuFreqMaxPattern());
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 max_clock;
|
||||||
|
switch (C.marikoGpuUV) {
|
||||||
|
case 0:
|
||||||
|
max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableSLT)->freq;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT15)->freq;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableHighUV)->freq;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 asm_patch[2] = {
|
||||||
|
asm_set_rd(asm_set_imm16(GpuAsmPattern[0], max_clock), rd),
|
||||||
|
asm_set_rd(asm_set_imm16(GpuAsmPattern[1], max_clock >> 16), rd)
|
||||||
|
};
|
||||||
|
|
||||||
|
PATCH_OFFSET(ptr32, asm_patch[0]);
|
||||||
|
PATCH_OFFSET(ptr32 + 1, asm_patch[1]);
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result GpuFreqPllMax(u32 *ptr) {
|
||||||
|
clk_pll_param *entry = reinterpret_cast<clk_pll_param *>(ptr);
|
||||||
|
|
||||||
|
// All zero except for freq
|
||||||
|
for (size_t i = 1; i < sizeof(clk_pll_param) / sizeof(u32); i++) {
|
||||||
|
R_UNLESS(*(ptr + i) == 0, ldr::ResultInvalidGpuPllEntry());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Double the max clk simply
|
||||||
|
u32 max_clk = entry->freq * 2;
|
||||||
|
entry->freq = max_clk;
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result GpuFreqPllLimit(u32 *ptr) {
|
||||||
|
u32 prev_freq = *(ptr - 1);
|
||||||
|
|
||||||
|
if (prev_freq != 128000 && prev_freq != 1300000 && prev_freq != 76800) {
|
||||||
|
R_THROW(ldr::ResultInvalidGpuPllEntry());
|
||||||
|
}
|
||||||
|
|
||||||
|
PATCH_OFFSET(ptr, 3600000);
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemMtcTableAutoAdjust(MarikoMtcTable *table) {
|
void MemMtcTableAutoAdjust(MarikoMtcTable *table) {
|
||||||
@@ -36,8 +354,6 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
* https://developer.nvidia.com/embedded/dlc/tegra-x1-technical-reference-manual
|
* https://developer.nvidia.com/embedded/dlc/tegra-x1-technical-reference-manual
|
||||||
* Section 18.11.1: MC Registers
|
* Section 18.11.1: MC Registers
|
||||||
* Section 18.11.2: EMC Registers
|
* Section 18.11.2: EMC Registers
|
||||||
*
|
|
||||||
* Additional information from reverse-engineering public Tegra K1 (T124) memory characterization tools.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WRITE_PARAM_ALL_REG(TABLE, PARAM, VALUE) \
|
#define WRITE_PARAM_ALL_REG(TABLE, PARAM, VALUE) \
|
||||||
@@ -47,6 +363,8 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
|
|
||||||
const double tCK_avg = 1000'000.0 / table->rate_khz;
|
const double tCK_avg = 1000'000.0 / table->rate_khz;
|
||||||
|
|
||||||
|
#define GET_CYCLE_CEIL(PARAM) u32(CEIL(double(PARAM) / tCK_avg))
|
||||||
|
|
||||||
/* Ram power down */
|
/* Ram power down */
|
||||||
/* B31: DRAM_CLKSTOP_PD */
|
/* B31: DRAM_CLKSTOP_PD */
|
||||||
/* B30: DRAM_CLKSTOP_SR */
|
/* B30: DRAM_CLKSTOP_SR */
|
||||||
@@ -57,12 +375,13 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
WRITE_PARAM_ALL_REG(table, emc_cfg, 0xF3200000);
|
WRITE_PARAM_ALL_REG(table, emc_cfg, 0xF3200000);
|
||||||
}
|
}
|
||||||
|
|
||||||
CalculateTimings(tCK_avg, table->rate_khz);
|
|
||||||
|
|
||||||
u32 trefbw = refresh_raw + 0x40;
|
u32 trefbw = refresh_raw + 0x40;
|
||||||
trefbw = MIN(trefbw, static_cast<u32>(0x3FFF));
|
trefbw = MIN(trefbw, static_cast<u32>(0x3FFF));
|
||||||
|
|
||||||
const u32 dyn_self_ref_control = (static_cast<u32>(7605.0 / tCK_avg) + 260) | (table->burst_regs.emc_dyn_self_ref_control & 0xffff0000);
|
const u32 dyn_self_ref_control = (static_cast<u32>(7605.0 / tCK_avg) + 260) | (table->burst_regs.emc_dyn_self_ref_control & 0xffff0000);
|
||||||
|
|
||||||
|
CalculateTimings(tCK_avg, table->rate_khz);
|
||||||
|
|
||||||
WRITE_PARAM_ALL_REG(table, emc_rd_rcd, GET_CYCLE_CEIL(tRCD));
|
WRITE_PARAM_ALL_REG(table, emc_rd_rcd, GET_CYCLE_CEIL(tRCD));
|
||||||
WRITE_PARAM_ALL_REG(table, emc_wr_rcd, GET_CYCLE_CEIL(tRCD));
|
WRITE_PARAM_ALL_REG(table, emc_wr_rcd, GET_CYCLE_CEIL(tRCD));
|
||||||
WRITE_PARAM_ALL_REG(table, emc_rc, MIN(GET_CYCLE_CEIL(tRC), static_cast<u32>(0xB9)));
|
WRITE_PARAM_ALL_REG(table, emc_rc, MIN(GET_CYCLE_CEIL(tRC), static_cast<u32>(0xB9)));
|
||||||
@@ -235,9 +554,6 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
const u32 tRFCabStock = tRFC_values[0] * 2;
|
const u32 tRFCabStock = tRFC_values[0] * 2;
|
||||||
table->dram_timings.t_rfc = tRFCabStock;
|
table->dram_timings.t_rfc = tRFCabStock;
|
||||||
|
|
||||||
/* dram_timings.rl is used on Erista to calculate specific RL related timings during memory training for a workaround. */
|
|
||||||
/* See fusee or minerva for more details. */
|
|
||||||
/* This is unused on Mariko but we will set it regardless for completion. */
|
|
||||||
table->dram_timings.rl = RL;
|
table->dram_timings.rl = RL;
|
||||||
table->emc_mrw2 = (table->emc_mrw2 & ~0xFFu) | static_cast<u32>(mrw2);
|
table->emc_mrw2 = (table->emc_mrw2 & ~0xFFu) | static_cast<u32>(mrw2);
|
||||||
table->emc_mrw = (table->emc_mrw & ~0x70u) | 0x40; /* nWR */
|
table->emc_mrw = (table->emc_mrw & ~0x70u) | 0x40; /* nWR */
|
||||||
@@ -301,18 +617,13 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppendMaxEmc(std::vector<u32> &emcList) {
|
namespace {
|
||||||
if (emcList.back() != C.marikoEmcMaxClock) {
|
std::vector<u32> newEmcList;
|
||||||
emcList.push_back(static_cast<u32>(C.marikoEmcMaxClock));
|
u32 *nsoStart;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TruncateToLutLimit(std::vector<u32> &emcList, size_t limit) {
|
|
||||||
emcList.resize(std::min(emcList.size(), limit));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MtcGenerateJedecTable() {
|
void MtcGenerateJedecTable() {
|
||||||
const u32 jedecFreqs[] = { 1866000, 1996800, 2133000, 2400000, 2666000, 2933000, 3200000 };
|
const u32 jedecFreqs[] = { 1866000, 1996000, 2133000, 2400000, 2666000, 2933000, 3200000 };
|
||||||
constexpr u32 JedecFreqCount = std::size(jedecFreqs);
|
constexpr u32 JedecFreqCount = std::size(jedecFreqs);
|
||||||
|
|
||||||
for (u32 i = 0; i < JedecFreqCount; ++i) {
|
for (u32 i = 0; i < JedecFreqCount; ++i) {
|
||||||
@@ -323,8 +634,11 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AppendMaxEmc(newEmcList);
|
if (newEmcList.back() != C.marikoEmcMaxClock) {
|
||||||
TruncateToLutLimit(newEmcList, EmcDvfsTableEntryLimit);
|
newEmcList.push_back(static_cast<u32>(C.marikoEmcMaxClock));
|
||||||
|
}
|
||||||
|
|
||||||
|
newEmcList.resize(std::min(newEmcList.size(), DvfsTableEntryLimit));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MtcGenerate133StepTable() {
|
void MtcGenerate133StepTable() {
|
||||||
@@ -339,37 +653,16 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AppendMaxEmc(newEmcList);
|
if (newEmcList.back() != C.marikoEmcMaxClock) {
|
||||||
TruncateToLutLimit(newEmcList, EmcDvfsTableEntryLimit);
|
newEmcList.push_back(static_cast<u32>(C.marikoEmcMaxClock));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MtcGenerate33StepTable() {
|
newEmcList.resize(std::min(newEmcList.size(), DvfsTableEntryLimit));
|
||||||
/* ~33.33MHz but rounded*/
|
|
||||||
const u32 stepFreqs33[] = {
|
|
||||||
1633000, 1666000, 1700000, 1733000, 1766000, 1800000, 1833000, 1866000, 1900000, 1933000,
|
|
||||||
1966000, 2000000, 2033000, 2066000, 2100000, 2133000, 2166000, 2200000, 2233000, 2266000,
|
|
||||||
2300000, 2333000, 2366000, 2400000, 2433000, 2466000, 2500000, 2533000, 2566000, 2600000,
|
|
||||||
2633000, 2666000, 2700000, 2733000, 2766000, 2800000, 2833000, 2866000, 2900000, 2933000,
|
|
||||||
2966000, 3000000, 3033000, 3066000, 3100000, 3133000, 3166000, 3200000, 3233000, 3266000,
|
|
||||||
3300000, 3333000, 3366000, 3400000, 3433000, 3466000, 3500000,
|
|
||||||
};
|
|
||||||
constexpr u32 StepFreqs33Size = std::size(stepFreqs33);
|
|
||||||
|
|
||||||
for (u32 i = 0; i < StepFreqs33Size; ++i) {
|
|
||||||
if (stepFreqs33[i] <= C.marikoEmcMaxClock) {
|
|
||||||
newEmcList.push_back(stepFreqs33[i]);
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AppendMaxEmc(newEmcList);
|
|
||||||
TruncateToLutLimit(newEmcList, EmcDvfsTableEntryLimit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MtcGenerateFreqTables() {
|
void MtcGenerateFreqTables() {
|
||||||
newEmcList.clear();
|
newEmcList.clear();
|
||||||
newEmcList.reserve(EmcDvfsTableEntryCount);
|
newEmcList.reserve(DvfsTableEntryCount);
|
||||||
newEmcList.insert(newEmcList.end(), std::begin(EmcListDefault), std::end(EmcListDefault));
|
newEmcList.insert(newEmcList.end(), std::begin(EmcListDefault), std::end(EmcListDefault));
|
||||||
|
|
||||||
if (C.marikoEmcMaxClock <= EmcClkOSLimit) {
|
if (C.marikoEmcMaxClock <= EmcClkOSLimit) {
|
||||||
@@ -378,9 +671,6 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
|
|
||||||
u32 stepRate = 0;
|
u32 stepRate = 0;
|
||||||
switch (C.stepMode) {
|
switch (C.stepMode) {
|
||||||
case StepMode_33MHz:
|
|
||||||
MtcGenerate33StepTable();
|
|
||||||
return;
|
|
||||||
case StepMode_66MHz:
|
case StepMode_66MHz:
|
||||||
stepRate = 66667;
|
stepRate = 66667;
|
||||||
break;
|
break;
|
||||||
@@ -403,13 +693,15 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
u32 newFreq = EmcClkOSLimit + stepIndex * stepRate;
|
u32 newFreq = EmcClkOSLimit + stepIndex * stepRate;
|
||||||
newFreq = (newFreq / RoundHz) * RoundHz;
|
newFreq = (newFreq / RoundHz) * RoundHz;
|
||||||
if (newFreq > C.marikoEmcMaxClock) {
|
if (newFreq > C.marikoEmcMaxClock) {
|
||||||
AppendMaxEmc(newEmcList);
|
if (newEmcList.back() != C.marikoEmcMaxClock) {
|
||||||
|
newEmcList.push_back(static_cast<u32>(C.marikoEmcMaxClock));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
newEmcList.push_back(newFreq);
|
newEmcList.push_back(newFreq);
|
||||||
}
|
}
|
||||||
|
|
||||||
TruncateToLutLimit(newEmcList, EmcDvfsTableEntryLimit);
|
newEmcList.resize(std::min(newEmcList.size(), DvfsTableEntryLimit));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result VerifyMtcTable(MarikoMtcTable *tableStart, u32 expectedFreq) {
|
Result VerifyMtcTable(MarikoMtcTable *tableStart, u32 expectedFreq) {
|
||||||
@@ -523,24 +815,6 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Get32LutEmcList(std::vector<u32> &emcList) {
|
|
||||||
/* No need to reduce outside of 33MHz stepmode. */
|
|
||||||
if (C.stepMode != StepMode_33MHz || emcList.size() <= DvfsTableEntryLimit) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add every other oc entry. */
|
|
||||||
std::vector<u32> reduced(emcList.begin(), emcList.begin() + mariko::MtcTableCountDefault);
|
|
||||||
for (size_t i = mariko::MtcTableCountDefault; i < emcList.size(); i += 2) {
|
|
||||||
reduced.push_back(emcList[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
TruncateToLutLimit(reduced, DvfsTableEntryLimit);
|
|
||||||
AppendMaxEmc(reduced);
|
|
||||||
|
|
||||||
emcList = std::move(reduced);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result MemFreqDvbTable(u32 *ptr) {
|
Result MemFreqDvbTable(u32 *ptr) {
|
||||||
DvbEntry *default_end = reinterpret_cast<DvbEntry *>(ptr);
|
DvbEntry *default_end = reinterpret_cast<DvbEntry *>(ptr);
|
||||||
DvbEntry *new_start = default_end + 1;
|
DvbEntry *new_start = default_end + 1;
|
||||||
@@ -631,26 +905,24 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
#undef DVB
|
#undef DVB
|
||||||
#undef DVB_OC
|
#undef DVB_OC
|
||||||
|
|
||||||
std::vector<u32> reducedEmcList = newEmcList;
|
DvbEntry emcDvbTableOc[newEmcList.size()];
|
||||||
Get32LutEmcList(reducedEmcList);
|
|
||||||
|
|
||||||
const size_t dvbCount = std::min(reducedEmcList.size(), DvfsTableEntryCount);
|
|
||||||
DvbEntry emcDvbTableOc[DvfsTableEntryCount] = {};
|
|
||||||
|
|
||||||
u32 bracketIndex = 0;
|
u32 bracketIndex = 0;
|
||||||
for (size_t i = 0; i < dvbCount; ++i) {
|
for (u32 i = 0; i < newEmcList.size(); ++i) {
|
||||||
const u32 freq = reducedEmcList[i];
|
while (newEmcList[i] >= emcDvbOcTableBrackets[bracketIndex + 1].freq) {
|
||||||
while (freq >= emcDvbOcTableBrackets[bracketIndex + 1].freq) {
|
|
||||||
++bracketIndex;
|
++bracketIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
emcDvbTableOc[i].freq = freq;
|
emcDvbTableOc[i].freq = newEmcList[i];
|
||||||
std::memcpy(emcDvbTableOc[i].volt, emcDvbOcTableBrackets[bracketIndex].volt, sizeof(emcDvbTableOc[i].volt));
|
std::memcpy(emcDvbTableOc[i].volt, emcDvbOcTableBrackets[bracketIndex].volt, sizeof(emcDvbTableOc[i].volt));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear the entire 32-entry region */
|
std::memset(mem_dvb_table_head, 0, sizeof(EmcDvbTableDefault));
|
||||||
std::memset(mem_dvb_table_head, 0, DvfsTableEntryCount * sizeof(DvbEntry));
|
std::memcpy(mem_dvb_table_head, &emcDvbTableOc, sizeof(emcDvbTableOc));
|
||||||
std::memcpy(mem_dvb_table_head, emcDvbTableOc, dvbCount * sizeof(DvbEntry));
|
|
||||||
|
/* Max dvfs entry is 32, but HOS doesn't seem to boot if exact freq doesn't exist in dvb table,
|
||||||
|
reason why it's like this
|
||||||
|
*/
|
||||||
|
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
@@ -664,37 +936,6 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result MemMtcTableAsm(u32 *ptr) {
|
|
||||||
constexpr u32 AddpOffset = 1;
|
|
||||||
constexpr u32 BrOffset = 12;
|
|
||||||
constexpr u32 MovOffset = 10;
|
|
||||||
|
|
||||||
/* Ensure we don't dereference memory before nso start. */
|
|
||||||
R_UNLESS(ptr - BrOffset >= nsoStart, ldr::ResultInvalidMtcTablePattern());
|
|
||||||
|
|
||||||
u32 adrp = *(ptr - AddpOffset);
|
|
||||||
R_UNLESS(_asm::Ignoring(adrp, MtcAdrpAsm, _asm::field::ImmAdrpHi, _asm::field::ImmAdrpLo), ldr::ResultInvalidMtcTablePattern());
|
|
||||||
|
|
||||||
/* We don't check for matching register because both registers must be x0 in order to pass the previous checks. */
|
|
||||||
/* The correct instructions will always be x0 since the mtcTable pointer is returned. */
|
|
||||||
|
|
||||||
/* Pray this does not break. */
|
|
||||||
u32 br = *(ptr - BrOffset);
|
|
||||||
R_UNLESS(_asm::Ignoring(br, MtcBrAsm, _asm::field::Rn), ldr::ResultInvalidMtcTablePattern());
|
|
||||||
|
|
||||||
/* Pray this does not break either. */
|
|
||||||
u32 mov = *(ptr - MovOffset);
|
|
||||||
R_UNLESS(_asm::Ignoring(mov, MtcMovAsm, _asm::field::Rd), ldr::ResultInvalidMtcTablePattern());
|
|
||||||
|
|
||||||
u8 movRd = _asm::Get(mov, _asm::field::Rd);
|
|
||||||
u32 movCountPatch = _asm::Encode(_asm::op::MovzW, {_asm::field::Rd, movRd}, {_asm::field::Imm16, newEmcList.size()});
|
|
||||||
|
|
||||||
PATCH_OFFSET(ptr - BrOffset, _asm::NopIns);
|
|
||||||
PATCH_OFFSET(ptr - MovOffset, movCountPatch);
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
Result I2cSet_U8(I2cDevice dev, u8 reg, u8 val) {
|
Result I2cSet_U8(I2cDevice dev, u8 reg, u8 val) {
|
||||||
struct {
|
struct {
|
||||||
u8 reg;
|
u8 reg;
|
||||||
@@ -708,7 +949,6 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
cmd.val = val;
|
cmd.val = val;
|
||||||
Result res = i2csessionSendAuto(&_session, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
Result res = i2csessionSendAuto(&_session, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
||||||
i2csessionClose(&_session);
|
i2csessionClose(&_session);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -747,4 +987,201 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
return resultI2C;
|
return resultI2C;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result MemMtcTableAsm(u32 *ptr) {
|
||||||
|
constexpr u32 AddpOffset = 1;
|
||||||
|
constexpr u32 BrOffset = 12;
|
||||||
|
constexpr u32 MovOffset = 10;
|
||||||
|
|
||||||
|
/* Ensure we don't dereference memory before nso start. */
|
||||||
|
R_UNLESS(ptr - BrOffset >= nsoStart, ldr::ResultInvalidMtcTablePattern());
|
||||||
|
|
||||||
|
u32 adrp = *(ptr - AddpOffset);
|
||||||
|
R_UNLESS(AsmCompareAdrpNoImm(adrp, MtcAdrpAsm), ldr::ResultInvalidMtcTablePattern());
|
||||||
|
|
||||||
|
/* We don't check for matching register because both registers must be x0 in order to pass the previous checks. */
|
||||||
|
/* The correct instructions will always be x0 since the mtcTable pointer is returned. */
|
||||||
|
|
||||||
|
/* Pray this does not break. */
|
||||||
|
u32 br = *(ptr - BrOffset);
|
||||||
|
R_UNLESS(AsmCompareBrNoRd(br, MtcBrAsm), ldr::ResultInvalidMtcTablePattern());
|
||||||
|
|
||||||
|
/* Pray this does not break either. */
|
||||||
|
u32 mov = *(ptr - MovOffset);
|
||||||
|
R_UNLESS(asm_compare_no_rd(mov, MtcMovAsm), ldr::ResultInvalidMtcTablePattern());
|
||||||
|
|
||||||
|
u8 movRd = asm_get_rd(mov);
|
||||||
|
u32 movCountPatch = asm_set_rd(asm_set_imm16(MtcMovAsm, newEmcList.size()), movRd);
|
||||||
|
|
||||||
|
PATCH_OFFSET(ptr - BrOffset, NopIns);
|
||||||
|
PATCH_OFFSET(ptr - MovOffset, movCountPatch);
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result GetSocSpeedo(u32 &socSpeedo) {
|
||||||
|
constexpr u64 FusePhysicalAddress = 0x7000F000;
|
||||||
|
u64 virtualAddress = 0;
|
||||||
|
constexpr u64 Size = 0x1000;
|
||||||
|
|
||||||
|
u64 outSize;
|
||||||
|
/* TODO: use svc::QueryMemoryMapping instead. */
|
||||||
|
R_TRY(svcQueryMemoryMapping(&virtualAddress, &outSize, FusePhysicalAddress, Size));
|
||||||
|
|
||||||
|
constexpr u32 FuseOffset = 2048;
|
||||||
|
constexpr u32 SocSpeedoOffset = 308;
|
||||||
|
socSpeedo = *reinterpret_cast<u32 *>(virtualAddress + FuseOffset + SocSpeedoOffset);
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 GetSocProcessId(u32 socSpeedo) {
|
||||||
|
if (socSpeedo <= 1597) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (socSpeedo <= 1708) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* >= 1709. */
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result SocVoltAsm(u32 *compareSpeedos) {
|
||||||
|
constexpr u32 VoltageScanLimit = 10;
|
||||||
|
/* Might actually be speedo id. */
|
||||||
|
u32 *writeProcessId = ScanAssembly(compareSpeedos, VoltageScanLimit, SocVoltWriteProcessIdAsm, asm_compare_no_rd);
|
||||||
|
R_UNLESS(writeProcessId != nullptr, ldr::ResultInvalidSocVoltPattern());
|
||||||
|
u8 writeProcessIdRd = asm_get_rd(*writeProcessId);
|
||||||
|
|
||||||
|
/* This writes 1050mV. */
|
||||||
|
u32 *writeVoltage = ScanAssembly(writeProcessId, VoltageScanLimit, SocVoltWriteVoltageAsm, asm_compare_no_rd);
|
||||||
|
R_UNLESS(writeVoltage != nullptr, ldr::ResultInvalidSocVoltPattern());
|
||||||
|
u8 writeVoltageRd = asm_get_rd(*writeVoltage);
|
||||||
|
|
||||||
|
/* A csel instruction is used to select the soc voltage limit register. */
|
||||||
|
/* We care about its destination register since that is used for verification. */
|
||||||
|
constexpr u32 VoltageSelectScanLimit = 24;
|
||||||
|
u32 *selectVoltage = ScanAssembly(writeVoltage, VoltageSelectScanLimit, SocVoltSelectRegisterAsm, AsmCompareCselNoReg);
|
||||||
|
R_UNLESS(selectVoltage != nullptr, ldr::ResultInvalidSocVoltPattern());
|
||||||
|
/* Todo: check rm and rn? */
|
||||||
|
u8 selectVoltageRd = asm_get_rd(*selectVoltage);
|
||||||
|
|
||||||
|
/* rdCsel is then multiplied by 1000 to convert to uV. */
|
||||||
|
/* This is pretty far down the function. */
|
||||||
|
constexpr u32 MultiplierScanLimit = 200;
|
||||||
|
u32 *multiplier = ScanAssembly(selectVoltage, MultiplierScanLimit, SocVoltMultiplyVoltsAsm, AsmCompareMullNoReg);
|
||||||
|
R_UNLESS(multiplier != nullptr, ldr::ResultInvalidSocVoltPattern());
|
||||||
|
u8 multiplierRn = AsmGetMullRn(*multiplier);
|
||||||
|
u8 multiplierRm = AsmGetMullRm(*multiplier);
|
||||||
|
/* One of the two registers has to be rdCsel. */
|
||||||
|
R_UNLESS((multiplierRn == selectVoltageRd) || (multiplierRm == selectVoltageRd), ldr::ResultInvalidSocVoltPattern());
|
||||||
|
u8 multiplierRd = asm_get_rd(*multiplier);
|
||||||
|
|
||||||
|
/* Subs instruction is then used to verify against absolute limit. */
|
||||||
|
u32 limitValidationPattern = AsmSubsSetRn(SocVoltValidateLimitAsm, multiplierRd);
|
||||||
|
u32 *limitValidation = ScanAssembly(multiplier, VoltageScanLimit, limitValidationPattern, AsmSubsCompareNoReg);
|
||||||
|
R_UNLESS(limitValidation != nullptr, ldr::ResultInvalidSocVoltPattern());
|
||||||
|
|
||||||
|
/* There is a b.gt instruction right after (checks for socVoltageCap < socVoltageMax). */
|
||||||
|
u32 *branchToAbort = limitValidation + 1;
|
||||||
|
R_UNLESS(AsmCompareBrConNoImm19(*branchToAbort, SocVoltBranchToAbortAsm), ldr::ResultInvalidSocVoltPattern());
|
||||||
|
|
||||||
|
if (!C.marikoSocVmax || C.marikoSocVmax <= 1000) {
|
||||||
|
R_SKIP();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Adjust 1598 speedo minimum to ensure it always goes down process id 0 branch. */
|
||||||
|
/* 2200 should be high enough :D */
|
||||||
|
u32 compareSpeedosPatch = AsmSubsSetImm12(*compareSpeedos, 2200);
|
||||||
|
PATCH_OFFSET(compareSpeedos, compareSpeedosPatch);
|
||||||
|
|
||||||
|
u32 socSpeedo = 0;
|
||||||
|
R_TRY(GetSocSpeedo(socSpeedo));
|
||||||
|
|
||||||
|
/* Adjust processId from 0 to [process id of switch booting this]. */
|
||||||
|
/* We're overwriting the orr instruction entirly. */
|
||||||
|
u32 processId = GetSocProcessId(socSpeedo);
|
||||||
|
u32 writeProcessIdPatch = asm_set_rd(asm_set_imm16(SocVoltWriteVoltageAsm, processId), writeProcessIdRd);
|
||||||
|
PATCH_OFFSET(writeProcessId, writeProcessIdPatch);
|
||||||
|
|
||||||
|
/* Adjust voltage limit. */
|
||||||
|
u32 voltageLimitPatch = asm_set_rd(asm_set_imm16(SocVoltWriteVoltageAsm, C.marikoSocVmax), writeVoltageRd);
|
||||||
|
PATCH_OFFSET(writeVoltage, voltageLimitPatch);
|
||||||
|
|
||||||
|
/* Branches to an abort if limits are invalid -- we patch the branch instruction with NOP. */
|
||||||
|
PATCH_OFFSET(branchToAbort, NopIns);
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result SocVoltLimit(u32 *ptr) {
|
||||||
|
R_UNLESS(!std::memcmp(ptr - SocVoltLimitMaxDefaultIndex, socVoltLimitArray, sizeof(socVoltLimitArray)), ldr::ResultInvalidSocVoltLimit());
|
||||||
|
if (!C.marikoSocVmax || C.marikoSocVmax <= SocVoltLimitOfficial) {
|
||||||
|
R_SKIP();
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr u32 Step = 25;
|
||||||
|
u32 maxVolt = C.marikoSocVmax;
|
||||||
|
if (maxVolt % Step) {
|
||||||
|
maxVolt = maxVolt / Step * Step; /* Round. */
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 volt = SocVoltLimitOfficial;
|
||||||
|
for (u32 i = 1; i < DvfsTableEntryCount - SocVoltLimitMaxDefaultIndex && volt < maxVolt; ++i) {
|
||||||
|
volt += Step;
|
||||||
|
PATCH_OFFSET(ptr + i, volt);
|
||||||
|
}
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
||||||
|
nsoStart = reinterpret_cast<u32 *>(mapped_nso);
|
||||||
|
MtcGenerateFreqTables();
|
||||||
|
u32 CpuCvbDefaultMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(CpuCvbTableDefault)->freq);
|
||||||
|
u32 GpuCvbDefaultMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(GpuCvbTableDefault)->freq);
|
||||||
|
|
||||||
|
PatcherEntry<u32> patches[] = {
|
||||||
|
{ "CPU Freq Vdd", &CpuFreqVdd, 1, nullptr, CpuClkOSLimit },
|
||||||
|
{ "CPU Freq Table", CpuFreqCvbTable<true>, 1, nullptr, CpuCvbDefaultMaxFreq },
|
||||||
|
{ "CPU Volt DVFS", &CpuVoltDVFS, 1, nullptr, CpuVminOfficial },
|
||||||
|
{ "CPU Volt Thermals", &CpuVoltThermals, 1, nullptr, CpuVminOfficial },
|
||||||
|
{ "CPU Volt Dfll", &CpuVoltDfll, 1, nullptr, CpuTune0Low },
|
||||||
|
{ "GPU Volt DVFS", &GpuVoltDVFS, 1, nullptr, GpuVminOfficial },
|
||||||
|
{ "GPU Volt Thermals", &GpuVoltThermals, 1, nullptr, GpuVminOfficial },
|
||||||
|
{ "GPU Freq Table", GpuFreqCvbTable<true>, 1, nullptr, GpuCvbDefaultMaxFreq },
|
||||||
|
{ "GPU Freq Asm", &GpuFreqMaxAsm, 2, &GpuMaxClockPatternFn },
|
||||||
|
{ "GPU PLL Max", &GpuFreqPllMax, 1, nullptr, GpuClkPllMax },
|
||||||
|
{ "GPU PLL Limit", &GpuFreqPllLimit, 4, nullptr, GpuClkPllLimit },
|
||||||
|
{ "MEM Freq Mtc", &MemFreqMtcTable, 1, nullptr, EmcClkOSLimit },
|
||||||
|
{ "MEM Freq Dvb", &MemFreqDvbTable, 1, nullptr, EmcClkOSLimit },
|
||||||
|
{ "MEM Freq Max", &MemFreqMax, 0, nullptr, EmcClkOSLimit },
|
||||||
|
{ "MEM Freq PLLM", &MemFreqPllmLimit, 2, nullptr, EmcClkPllmLimit },
|
||||||
|
{ "MEM Vddq", &EmcVddqVolt, 2, nullptr, EmcVddqDefault },
|
||||||
|
{ "MEM Vdd2", &MemVoltHandler, 2, nullptr, MemVdd2Default },
|
||||||
|
{ "MEM Table Asm", &MemMtcTableAsm, 1, &MemMtcGetGetTablePatternFn },
|
||||||
|
{ "SOC Volt Asm", &SocVoltAsm, 1, &SocVoltPatternFn },
|
||||||
|
{ "SOC Volt Limit", &SocVoltLimit, 1, nullptr, SocVoltLimitOfficial },
|
||||||
|
};
|
||||||
|
|
||||||
|
for (uintptr_t ptr = mapped_nso; ptr <= mapped_nso + nso_size - sizeof(MarikoMtcTable); ptr += sizeof(u32)) {
|
||||||
|
u32 *ptr32 = reinterpret_cast<u32 *>(ptr);
|
||||||
|
for (auto &entry : patches) {
|
||||||
|
if (R_SUCCEEDED(entry.SearchAndApply(ptr32))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto &entry : patches) {
|
||||||
|
LOGGING("%s Count: %zu\n", entry.description, entry.patched_count);
|
||||||
|
if (R_FAILED(entry.CheckResult())) {
|
||||||
|
panic::SmcError(panic::Patch);
|
||||||
|
|
||||||
|
CRASH(entry.description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+110
-12
@@ -3,9 +3,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2023 hanai3Bi
|
* Copyright (c) 2023 hanai3Bi
|
||||||
*
|
*
|
||||||
* Copyright (c) B3711
|
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
|
||||||
*
|
|
||||||
* Copyright (c) Souldbminer, Lightos and Horizon OC Contributors
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -22,11 +20,95 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../pcv.hpp"
|
#include "../oc_common.hpp"
|
||||||
|
#include "pcv_common.hpp"
|
||||||
|
#include "pcv_asm.hpp"
|
||||||
|
|
||||||
namespace ams::ldr::hoc::pcv::mariko {
|
namespace ams::ldr::hoc::pcv::mariko {
|
||||||
|
|
||||||
extern u32 *nsoStart;
|
constexpr cvb_entry_t CpuCvbTableDefault[] = {
|
||||||
|
{ 204000, { 721589, -12695, 27 }, { } },
|
||||||
|
{ 306000, { 747134, -14195, 27 }, { } },
|
||||||
|
{ 408000, { 776324, -15705, 27 }, { } },
|
||||||
|
{ 510000, { 809160, -17205, 27 }, { } },
|
||||||
|
{ 612000, { 845641, -18715, 27 }, { } },
|
||||||
|
{ 714000, { 885768, -20215, 27 }, { } },
|
||||||
|
{ 816000, { 929540, -21725, 27 }, { } },
|
||||||
|
{ 918000, { 976958, -23225, 27 }, { } },
|
||||||
|
{ 1020000, { 1028021, -24725, 27 }, { 1120000 } },
|
||||||
|
{ 1122000, { 1082730, -26235, 27 }, { 1120000 } },
|
||||||
|
{ 1224000, { 1141084, -27735, 27 }, { 1120000 } },
|
||||||
|
{ 1326000, { 1203084, -29245, 27 }, { 1120000 } },
|
||||||
|
{ 1428000, { 1268729, -30745, 27 }, { 1120000 } },
|
||||||
|
{ 1581000, { 1374032, -33005, 27 }, { 1120000 } },
|
||||||
|
{ 1683000, { 1448791, -34505, 27 }, { 1120000 } },
|
||||||
|
{ 1785000, { 1527196, -36015, 27 }, { 1120000 } },
|
||||||
|
{ 1887000, { 1609246, -37515, 27 }, { 1120000 } },
|
||||||
|
{ 1963500, { 1675751, -38635, 27 }, { 1120000 } },
|
||||||
|
{ },
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr u32 CpuClkOfficial = 1963'500;
|
||||||
|
constexpr u32 CpuVoltOfficial = 1120;
|
||||||
|
constexpr u32 CpuHighVminOfficial = 850;
|
||||||
|
constexpr u32 CpuVminOfficial = 620;
|
||||||
|
constexpr u32 CpuTune0Low = 0xFFCF;
|
||||||
|
|
||||||
|
static const u32 cpuVoltagePatchValues[] = { 850, 38, 1120, 1000, 100, 1000, 0 };
|
||||||
|
static const s32 cpuVoltagePatchOffsets[] = { -2, -1, 5, 6, 7, 8, 9 };
|
||||||
|
static_assert(sizeof(cpuVoltagePatchValues) == sizeof(cpuVoltagePatchOffsets), "Invalid cpuVoltagePatch size");
|
||||||
|
|
||||||
|
static const u32 cpuVoltThermalData[] = { 620, 1120, 20000, 620, 1120, 70000, 950, 1132, 0, 950, 1227, 0 };
|
||||||
|
|
||||||
|
static const u32 allowedCpuMaxFrequencies[] = { 1'963'500, 2'091'000, 2'193'000, 2'295'000, 2'397'000, 2'499'000, 2'601'000, 2'703'000, 2'805'000 };
|
||||||
|
|
||||||
|
constexpr cvb_entry_t GpuCvbTableDefault[] = {
|
||||||
|
// GPUB01_NA_CVB_TABLE
|
||||||
|
{ 76800, {}, { 610000, } },
|
||||||
|
{ 153600, {}, { 610000, } },
|
||||||
|
{ 230400, {}, { 610000, } },
|
||||||
|
{ 307200, {}, { 610000, } },
|
||||||
|
{ 384000, {}, { 610000, } },
|
||||||
|
{ 460800, {}, { 610000, } },
|
||||||
|
{ 537600, {}, { 801688, -10900, -163, 298, -10599, 162, } },
|
||||||
|
{ 614400, {}, { 824214, -5743, -452, 238, -6325, 81, } },
|
||||||
|
{ 691200, {}, { 848830, -3903, -552, 119, -4030, -2, } },
|
||||||
|
{ 768000, {}, { 891575, -4409, -584, 0, -2849, 39, } },
|
||||||
|
{ 844800, {}, { 940071, -5367, -602, -60, -63, -93, } },
|
||||||
|
{ 921600, {}, { 986765, -6637, -614, -179, 1905, -13, } },
|
||||||
|
{ 998400, {}, { 1098475, -13529, -497, -179, 3626, 9, } },
|
||||||
|
{ 1075200, {}, { 1163644, -12688, -648, 0, 1077, 40, } },
|
||||||
|
{ 1152000, {}, { 1204812, -9908, -830, 0, 1469, 110, } },
|
||||||
|
{ 1228800, {}, { 1277303, -11675, -859, 0, 3722, 313, } },
|
||||||
|
{ 1267200, {}, { 1335531, -12567, -867, 0, 3681, 559, } },
|
||||||
|
{ },
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr u32 GpuClkPllMax = 1300'000'000;
|
||||||
|
constexpr u32 GpuClkPllLimit = 2'600'000;
|
||||||
|
constexpr u32 GpuVminOfficial = 610;
|
||||||
|
|
||||||
|
static const u32 gpuDVFSPattern[] = { 1050, 1000, 100, 1000, 10, };
|
||||||
|
static const u32 gpuVoltThermalPattern[] = { 800, 1120, 0, 610, 1120, 20000, 610, 1120, 30000, 610, 1120, 50000, 610, 1120, 70000, 610, 1120, 90000, };
|
||||||
|
static_assert(sizeof(gpuVoltThermalPattern) == 72, "Invalid gpuVoltThermalPattern");
|
||||||
|
|
||||||
|
/* GPU Max Clock asm Pattern:
|
||||||
|
*
|
||||||
|
* MOV W11, #0x1000 MOV (wide immediate) 0x1000 0xB (11)
|
||||||
|
* sf | opc | | hw | imm16 | Rd
|
||||||
|
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
||||||
|
* 0 | 1 0 | 1 0 0 1 0 1| 0 0| 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 |0 1 0 1 1
|
||||||
|
*
|
||||||
|
* MOVK W11, #0xE, LSL#16 <shift>16 0xE 0xB (11)
|
||||||
|
* sf | opc | | hw | imm16 | Rd
|
||||||
|
* #31 |30 29|28 27 26 25 24 23|22 21|20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 |4 3 2 1 0
|
||||||
|
* 0 | 1 1 | 1 0 0 1 0 1| 0 1| 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 |0 1 0 1 1
|
||||||
|
*/
|
||||||
|
inline constexpr u32 GpuAsmPattern[] = { 0x52820000, 0x72A001C0 };
|
||||||
|
|
||||||
|
inline bool GpuMaxClockPatternFn(u32 *ptr32) {
|
||||||
|
return asm_compare_no_rd(*ptr32, GpuAsmPattern[0]);
|
||||||
|
}
|
||||||
|
|
||||||
struct DvbEntry {
|
struct DvbEntry {
|
||||||
u64 freq;
|
u64 freq;
|
||||||
@@ -42,6 +124,27 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
{ 1600000, { 675, 650, 637, } },
|
{ 1600000, { 675, 650, 637, } },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Movz */
|
||||||
|
/*
|
||||||
|
SF | OPC | HW | Imm16 | RD
|
||||||
|
31 | 30 29 28 27 26 25 24 23 | 22 21 | 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 | 4 3 2 1 0
|
||||||
|
*/
|
||||||
|
constexpr u32 SocVoltCompareSpeedoAsm = 0x7118FAFF; /* subs imm, compares to >=1598 max speedo and then goes down process id 1 route. */
|
||||||
|
constexpr u32 SocVoltWriteProcessIdAsm = 0x2A1F03F4; /* orr, writes id 0. */
|
||||||
|
constexpr u32 SocVoltWriteVoltageAsm = 0x52808358; /* Movz imm, writes 1050mV. */
|
||||||
|
constexpr u32 SocVoltSelectRegisterAsm = 0x1A9A3118; /* Csel, selects the voltage -- we need the register of this. */
|
||||||
|
constexpr u32 SocVoltMultiplyVoltsAsm = 0x1B1A7F0B; /* Mul, converts from mV -> uV */
|
||||||
|
constexpr u32 SocVoltValidateLimitAsm = 0x6B0A017F; /* Subs, checks limits */
|
||||||
|
constexpr u32 SocVoltBranchToAbortAsm = 0x540020AC; /* B.ge Branches to abort if limits are invalid. */
|
||||||
|
|
||||||
|
ALWAYS_INLINE bool SocVoltPatternFn(u32 *ptr) {
|
||||||
|
return asm_compare_no_rd(*ptr, SocVoltCompareSpeedoAsm);
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr u32 SocVoltLimitOfficial = 1050;
|
||||||
|
constexpr u32 SocVoltLimitMaxDefaultIndex = 17;
|
||||||
|
static const u32 socVoltLimitArray[DvfsTableEntryCount] = { 637, 650, 675, 700, 725, 750, 775, 800, 825, 850, 875, 900, 925, 950, 975, 1000, 1025, 1050, };
|
||||||
|
|
||||||
constexpr u32 EmcListDefault[] = { 204000, 1331200, 1600000, };
|
constexpr u32 EmcListDefault[] = { 204000, 1331200, 1600000, };
|
||||||
constexpr u32 EmcListSizeDefault = std::size(EmcListDefault);
|
constexpr u32 EmcListSizeDefault = std::size(EmcListDefault);
|
||||||
constexpr u32 EmcListEndDefault = EmcListSizeDefault - 1;
|
constexpr u32 EmcListEndDefault = EmcListSizeDefault - 1;
|
||||||
@@ -193,14 +296,9 @@ namespace ams::ldr::hoc::pcv::mariko {
|
|||||||
|
|
||||||
ALWAYS_INLINE bool MemMtcGetGetTablePatternFn(u32 *ptr) {
|
ALWAYS_INLINE bool MemMtcGetGetTablePatternFn(u32 *ptr) {
|
||||||
/* This builds an address that gets returned, so the register must be x0 by convention. */
|
/* This builds an address that gets returned, so the register must be x0 by convention. */
|
||||||
return _asm::Ignoring(*ptr, MtcAddAsm, _asm::field::Imm12);
|
return AsmCompareAddNoImm12(*ptr, MtcAddAsm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MtcGenerateFreqTables();
|
void Patch(uintptr_t mapped_nso, size_t nso_size);
|
||||||
Result MemFreqMtcTable(u32 *ptr);
|
|
||||||
Result MemFreqDvbTable(u32 *ptr);
|
|
||||||
Result MemFreqMax(u32 *ptr);
|
|
||||||
Result MemMtcTableAsm(u32 *ptr);
|
|
||||||
Result EmcVddqVolt(u32 *ptr);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
#---------------------------------------------------------------------------------
|
|
||||||
# pull in common stratosphere sysmodule configuration
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
|
||||||
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
|
||||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../libraries/config/templates/stratosphere.mk
|
|
||||||
|
|
||||||
ifneq ($(strip $(HOC_UART_LOG)),)
|
|
||||||
export CFLAGS += -DHOC_UART_LOG=$(HOC_UART_LOG)
|
|
||||||
export CXXFLAGS += -DHOC_UART_LOG=$(HOC_UART_LOG)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ATMOSPHERE_SYSTEM_MODULE_TARGETS := kip
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
|
||||||
# rules for different file extensions
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifneq ($(__RECURSIVE__),1)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export TOPDIR := $(CURDIR)
|
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
||||||
|
|
||||||
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
||||||
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
||||||
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
|
||||||
|
|
||||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# use CXX for linking C++ projects, CC for standard C
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
ifeq ($(strip $(CPPFILES)),)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CC)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
export LD := $(CXX)
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
|
||||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
||||||
$(foreach dir,$(AMS_LIBDIRS),-I$(dir)/include) \
|
|
||||||
-I$(CURDIR)/$(ATMOSPHERE_BUILD_DIR)
|
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) $(foreach dir,$(AMS_LIBDIRS),-L$(dir)/$(ATMOSPHERE_LIBRARY_DIR))
|
|
||||||
|
|
||||||
export BUILD_EXEFS_SRC := $(TOPDIR)/$(EXEFS_SRC)
|
|
||||||
|
|
||||||
ifeq ($(strip $(CONFIG_JSON)),)
|
|
||||||
jsons := $(wildcard *.json)
|
|
||||||
ifneq (,$(findstring $(TARGET).json,$(jsons)))
|
|
||||||
export APP_JSON := $(TOPDIR)/$(TARGET).json
|
|
||||||
else
|
|
||||||
ifneq (,$(findstring config.json,$(jsons)))
|
|
||||||
export APP_JSON := $(TOPDIR)/config.json
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
export APP_JSON := $(TOPDIR)/$(CONFIG_JSON)
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: clean all check_lib
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
all: $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR) $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/$(ATMOSPHERE_LIBRARY_DIR)/libstratosphere.a
|
|
||||||
@$(MAKE) __RECURSIVE__=1 OUTPUT=$(CURDIR)/$(ATMOSPHERE_OUT_DIR)/$(TARGET) \
|
|
||||||
DEPSDIR=$(CURDIR)/$(ATMOSPHERE_BUILD_DIR) \
|
|
||||||
--no-print-directory -C $(ATMOSPHERE_BUILD_DIR) \
|
|
||||||
-f $(THIS_MAKEFILE)
|
|
||||||
|
|
||||||
$(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/$(ATMOSPHERE_LIBRARY_DIR)/libstratosphere.a: check_lib
|
|
||||||
@$(SILENTCMD)echo "Checked library."
|
|
||||||
|
|
||||||
ifeq ($(ATMOSPHERE_CHECKED_LIBSTRATOSPHERE),1)
|
|
||||||
check_lib:
|
|
||||||
else
|
|
||||||
check_lib:
|
|
||||||
@$(MAKE) --no-print-directory -C $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere -f $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/libstratosphere.mk
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR):
|
|
||||||
@[ -d $@ ] || mkdir -p $@
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
clean:
|
|
||||||
@echo clean ...
|
|
||||||
@rm -fr $(ATMOSPHERE_OUT_DIR) $(ATMOSPHERE_BUILD_DIR)
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
else
|
|
||||||
.PHONY: all
|
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# main targets
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
all : $(foreach target,$(ATMOSPHERE_SYSTEM_MODULE_TARGETS),$(OUTPUT).$(target))
|
|
||||||
|
|
||||||
$(OUTPUT).kip : $(OUTPUT).elf
|
|
||||||
$(OUTPUT).nsp : $(OUTPUT).nso $(OUTPUT).npdm
|
|
||||||
$(OUTPUT).nso : $(OUTPUT).elf
|
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
|
||||||
|
|
||||||
$(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/$(ATMOSPHERE_LIBRARY_DIR)/libstratosphere.a
|
|
||||||
|
|
||||||
%.npdm : %.npdm.json
|
|
||||||
@echo built ... $< $@
|
|
||||||
@npdmtool $< $@
|
|
||||||
@echo built ... $(notdir $@)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
# you need a rule like this for each extension you use as binary data
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
%.bin.o : %.bin
|
|
||||||
#---------------------------------------------------------------------------------
|
|
||||||
@echo $(notdir $<)
|
|
||||||
@$(bin2o)
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
endif
|
|
||||||
#---------------------------------------------------------------------------------------
|
|
||||||
@@ -12,14 +12,14 @@ include $(DEVKITPRO)/libnx/switch_rules
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
TARGET := Benchmark-Toolbox
|
TARGET := Benchmark-Toolbox
|
||||||
BUILD := build
|
BUILD := build
|
||||||
SOURCES := source source/furmark source/memtester source/cpustress source/cuda95
|
SOURCES := source source/furmark source/memtester source/cpustress
|
||||||
DATA := data
|
DATA := data
|
||||||
ICON := icon.jpg
|
ICON := icon.jpg
|
||||||
INCLUDES := source source/furmark source/memtester source/cpustress source/cuda95 ../hoc-clk/common/include
|
INCLUDES := source source/furmark source/memtester source/cpustress ../hoc-clk/common/include
|
||||||
|
|
||||||
APP_TITLE := Benchmark Toolbox
|
APP_TITLE := Benchmark Toolbox
|
||||||
APP_AUTHOR := Horizon-OC
|
APP_AUTHOR := Horizon-OC
|
||||||
APP_VERSION := 3.0.0
|
APP_VERSION := 2.0.0
|
||||||
|
|
||||||
ROMFS := resources
|
ROMFS := resources
|
||||||
BOREALIS_PATH := lib/borealis
|
BOREALIS_PATH := lib/borealis
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
#version 430 core
|
|
||||||
layout(local_size_x = 16, local_size_y = 16) in;
|
|
||||||
|
|
||||||
layout(std430, binding = 0) readonly buffer DataBuffer {
|
|
||||||
double data[];
|
|
||||||
};
|
|
||||||
|
|
||||||
layout(std430, binding = 1) buffer ResultBuffer {
|
|
||||||
uint result;
|
|
||||||
};
|
|
||||||
|
|
||||||
layout(std140, binding = 0) uniform Params {
|
|
||||||
uint n_rows;
|
|
||||||
uint n_repeats;
|
|
||||||
};
|
|
||||||
|
|
||||||
const double THRESHOLD = 1e-3LF;
|
|
||||||
|
|
||||||
shared uint s_partial[256];
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
uint total_cols = gl_NumWorkGroups.x * gl_WorkGroupSize.x
|
|
||||||
* gl_NumWorkGroups.y * gl_WorkGroupSize.y;
|
|
||||||
|
|
||||||
uint col = (gl_GlobalInvocationID.y * (gl_NumWorkGroups.x * gl_WorkGroupSize.x))
|
|
||||||
+ gl_GlobalInvocationID.x;
|
|
||||||
|
|
||||||
uint count = 0u;
|
|
||||||
|
|
||||||
if (n_rows >= 2u) {
|
|
||||||
for (uint k = 0u; k < n_repeats; ++k) {
|
|
||||||
double bias = double(k) * 1e-12LF;
|
|
||||||
double ref = data[col] + bias;
|
|
||||||
|
|
||||||
for (uint row = 1u; row < n_rows; ++row) {
|
|
||||||
double val = data[row * total_cols + col];
|
|
||||||
if (abs(ref - val) > THRESHOLD)
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint lid = gl_LocalInvocationIndex;
|
|
||||||
s_partial[lid] = count;
|
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
|
||||||
|
|
||||||
for (uint s = 128u; s > 0u; s >>= 1) {
|
|
||||||
if (lid < s)
|
|
||||||
s_partial[lid] += s_partial[lid + s];
|
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lid == 0u)
|
|
||||||
atomicAdd(result, s_partial[0]);
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
#version 430 core
|
|
||||||
layout(local_size_x = 16, local_size_y = 16) in;
|
|
||||||
|
|
||||||
layout(std430, binding = 0) readonly buffer DataBuffer {
|
|
||||||
float data[];
|
|
||||||
};
|
|
||||||
|
|
||||||
layout(std430, binding = 1) buffer ResultBuffer {
|
|
||||||
uint result;
|
|
||||||
};
|
|
||||||
|
|
||||||
layout(std140, binding = 0) uniform Params {
|
|
||||||
uint n_rows;
|
|
||||||
uint n_repeats;
|
|
||||||
};
|
|
||||||
|
|
||||||
const float THRESHOLD = 0.001f;
|
|
||||||
|
|
||||||
// One partial sum to force one atomic per WGP instead of 256.
|
|
||||||
shared uint s_partial[256];
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
uint total_cols = gl_NumWorkGroups.x * gl_WorkGroupSize.x
|
|
||||||
* gl_NumWorkGroups.y * gl_WorkGroupSize.y;
|
|
||||||
|
|
||||||
uint col = (gl_GlobalInvocationID.y * (gl_NumWorkGroups.x * gl_WorkGroupSize.x))
|
|
||||||
+ gl_GlobalInvocationID.x;
|
|
||||||
|
|
||||||
uint count = 0u;
|
|
||||||
|
|
||||||
if (n_rows >= 2u) {
|
|
||||||
for (uint k = 0u; k < n_repeats; ++k) {
|
|
||||||
// Fuck compiler optimizations, imma start throwing bullshit
|
|
||||||
float bias = float(k) * 1e-9;
|
|
||||||
float ref = data[col] + bias;
|
|
||||||
|
|
||||||
for (uint row = 1u; row < n_rows; ++row) {
|
|
||||||
float val = data[row * total_cols + col];
|
|
||||||
if (abs(ref - val) > THRESHOLD)
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint lid = gl_LocalInvocationIndex;
|
|
||||||
s_partial[lid] = count;
|
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
|
||||||
|
|
||||||
for (uint s = 128u; s > 0u; s >>= 1) {
|
|
||||||
if (lid < s)
|
|
||||||
s_partial[lid] += s_partial[lid + s];
|
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lid == 0u)
|
|
||||||
atomicAdd(result, s_partial[0]);
|
|
||||||
}
|
|
||||||
@@ -1,948 +0,0 @@
|
|||||||
#include "cuda95.h"
|
|
||||||
|
|
||||||
#include <switch.h>
|
|
||||||
#include <deko3d.h>
|
|
||||||
|
|
||||||
#include <atomic>
|
|
||||||
#include <cstdarg>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstring>
|
|
||||||
#include <mutex>
|
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
#ifndef DK_UNIFORM_BUF_ALIGNMENT
|
|
||||||
#define DK_UNIFORM_BUF_ALIGNMENT 0x100
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ALIGN_UP(x, a) (((x) + ((a) - 1)) & ~((uint32_t)(a) - 1))
|
|
||||||
|
|
||||||
#define WG_SIZE_X 16
|
|
||||||
#define WG_SIZE_Y 16
|
|
||||||
// groups are dispatched in a 4x4 grid, for 2048 threads total
|
|
||||||
// 2048 per SM = 4096 on TX1, so we fully saturate the GPU
|
|
||||||
#define NUM_GROUPS_X 4
|
|
||||||
#define NUM_GROUPS_Y 4
|
|
||||||
|
|
||||||
#define N_THREADS ((NUM_GROUPS_X * WG_SIZE_X) * (NUM_GROUPS_Y * WG_SIZE_Y)) // 4096
|
|
||||||
#define N_ROWS 64
|
|
||||||
|
|
||||||
// Thread buffers = N_ROWS * N_THREADS, must be power of 2
|
|
||||||
#define N_VEC ((uint64_t)N_ROWS * N_THREADS) // uvec4 elements, 2^18
|
|
||||||
#define N_ELEMS (N_VEC * 4) // uints, 2^20
|
|
||||||
|
|
||||||
static_assert((N_VEC & (N_VEC - 1)) == 0,
|
|
||||||
"N_ROWS * N_THREADS must be a power of two for the scatter mask");
|
|
||||||
|
|
||||||
// Gather size, 8192 * 16B = 128KB per SM. Fits into L2 perfectly
|
|
||||||
#define L2_WINDOW_VEC 8192u
|
|
||||||
#define DISPATCHES_PER_LIST 32
|
|
||||||
#define NUM_INFLIGHT 3
|
|
||||||
#define MAX_RECORDS 64 // fault records per batch, per slot
|
|
||||||
|
|
||||||
#define FENCE_TIMEOUT_NS (5ULL * 1000000000ULL)
|
|
||||||
#define DATA_CHECK_INTERVAL 512
|
|
||||||
|
|
||||||
#define CODEMEM_SIZE (128 * 1024)
|
|
||||||
#define CMDMEM_SIZE (512 * 1024)
|
|
||||||
|
|
||||||
#define DKSH_MAGIC UINT32_C(0x48534B44)
|
|
||||||
|
|
||||||
// TOOLBOX: console drawing removed, log kept as a ring buffer.
|
|
||||||
#define SCR_COLS 79
|
|
||||||
#define LOG_LINES 14
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint32_t magic;
|
|
||||||
uint32_t header_sz;
|
|
||||||
uint32_t control_sz;
|
|
||||||
uint32_t code_sz;
|
|
||||||
uint32_t programs_off;
|
|
||||||
uint32_t num_programs;
|
|
||||||
} DkshHeaderLocal;
|
|
||||||
|
|
||||||
// Shader parameters
|
|
||||||
typedef struct {
|
|
||||||
uint32_t n_rows;
|
|
||||||
uint32_t n_repeats;
|
|
||||||
uint32_t alu_iters;
|
|
||||||
uint32_t gather_iters;
|
|
||||||
uint32_t max_records;
|
|
||||||
uint32_t mode; // 0 = capture golden, 1 = compare, 2 = ignore
|
|
||||||
uint32_t scatter_mask; // Gather window - 1, used for errors.
|
|
||||||
uint32_t chain_bias;
|
|
||||||
} Params;
|
|
||||||
|
|
||||||
// Result buffer
|
|
||||||
typedef struct {
|
|
||||||
uint32_t mismatches;
|
|
||||||
uint32_t digest;
|
|
||||||
uint32_t selfFail;
|
|
||||||
uint32_t errCount;
|
|
||||||
} GpuResult;
|
|
||||||
|
|
||||||
// Errorlog
|
|
||||||
typedef struct {
|
|
||||||
uint32_t id; // thread index
|
|
||||||
uint32_t stage; // 1 = ALU self-check, 2 = per-thread digest
|
|
||||||
uint32_t got;
|
|
||||||
uint32_t want;
|
|
||||||
} GpuRecord;
|
|
||||||
|
|
||||||
|
|
||||||
// Presets for calibration
|
|
||||||
typedef struct {
|
|
||||||
const char* name;
|
|
||||||
uint32_t alu;
|
|
||||||
uint32_t gather;
|
|
||||||
uint32_t window; // 0 = whole buffer
|
|
||||||
} Profile;
|
|
||||||
|
|
||||||
// Testing modes
|
|
||||||
// Balanced tried to hit both
|
|
||||||
// Core forces 2x chains and not as much memory access, although in practice it strains it enough.
|
|
||||||
// Dram scatters reads accross allocated size (4MB, lol, lmao even)
|
|
||||||
// L2 changes this to 256KB.
|
|
||||||
static const Profile kProfiles[] = {
|
|
||||||
{ "balanced", 64, 32, 0 },
|
|
||||||
{ "core", 512, 4, 0 },
|
|
||||||
{ "dram", 8, 256, 0 },
|
|
||||||
{ "l2", 8, 256, L2_WINDOW_VEC },
|
|
||||||
};
|
|
||||||
#define NUM_PROFILES ((int)(sizeof(kProfiles) / sizeof(kProfiles[0])))
|
|
||||||
|
|
||||||
static uint32_t scatterMaskFor(int profile)
|
|
||||||
{
|
|
||||||
uint32_t win = kProfiles[profile].window;
|
|
||||||
if (win == 0u) win = (uint32_t)N_VEC;
|
|
||||||
return win - 1u;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error storage
|
|
||||||
typedef struct {
|
|
||||||
uint64_t batches;
|
|
||||||
uint64_t detected; // batches where digest=/count
|
|
||||||
uint64_t transient; // corrected by the re-run vote
|
|
||||||
uint64_t persistent; // reproduced on re-run
|
|
||||||
uint64_t selfFail; // ALU DUP/COMP Fails
|
|
||||||
uint64_t dataBad; // corrupt inputs (how did this happen)
|
|
||||||
uint64_t warnings;
|
|
||||||
uint64_t timeouts;
|
|
||||||
} Tally;
|
|
||||||
|
|
||||||
static Tally g_tally;
|
|
||||||
static uint64_t g_tStart;
|
|
||||||
|
|
||||||
static char g_log[LOG_LINES][SCR_COLS + 1];
|
|
||||||
static uint32_t g_logCount;
|
|
||||||
|
|
||||||
// TOOLBOX: shared state
|
|
||||||
static std::thread g_thread;
|
|
||||||
static std::mutex g_lock;
|
|
||||||
static std::atomic<bool> g_stop{ false };
|
|
||||||
static std::atomic<bool> g_running{ false };
|
|
||||||
static cuda95_status_t g_pub{};
|
|
||||||
|
|
||||||
static int s_profile;
|
|
||||||
static unsigned s_repeats;
|
|
||||||
static uint32_t s_goldDigest;
|
|
||||||
static uint32_t s_goldMismatch;
|
|
||||||
static double s_dps;
|
|
||||||
static double s_gbps;
|
|
||||||
static int s_cal;
|
|
||||||
static int s_error;
|
|
||||||
static char s_state[96];
|
|
||||||
|
|
||||||
static int s_cfgProfile;
|
|
||||||
static unsigned s_cfgRepeats;
|
|
||||||
static int s_wantProfile;
|
|
||||||
static unsigned s_wantRepeats;
|
|
||||||
static bool s_wantDirty;
|
|
||||||
|
|
||||||
static uint64_t elapsedSec(void)
|
|
||||||
{
|
|
||||||
return armTicksToNs(armGetSystemTick() - g_tStart) / 1000000000ULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void note(const char* fmt, ...)
|
|
||||||
{
|
|
||||||
char body[SCR_COLS + 1];
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap, fmt);
|
|
||||||
vsnprintf(body, sizeof(body), fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
// TOOLBOX: console branch removed
|
|
||||||
uint32_t idx = g_logCount % LOG_LINES;
|
|
||||||
int n = snprintf(g_log[idx], sizeof(g_log[idx]), "[%5llus] ",
|
|
||||||
(unsigned long long)elapsedSec());
|
|
||||||
if (n < 0) n = 0;
|
|
||||||
size_t off = (size_t)n;
|
|
||||||
if (off > sizeof(g_log[idx]) - 1) off = sizeof(g_log[idx]) - 1;
|
|
||||||
size_t room = sizeof(g_log[idx]) - 1 - off;
|
|
||||||
size_t len = strlen(body);
|
|
||||||
if (len > room) len = room;
|
|
||||||
memcpy(g_log[idx] + off, body, len);
|
|
||||||
g_log[idx][off + len] = 0;
|
|
||||||
g_logCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate seeds
|
|
||||||
static uint32_t hash32(uint32_t x)
|
|
||||||
{
|
|
||||||
x ^= x >> 16;
|
|
||||||
x *= 0x7FEB352Du;
|
|
||||||
x ^= x >> 15;
|
|
||||||
x *= 0x846CA68Bu;
|
|
||||||
x ^= x >> 16;
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// RNG, clamped so nothing fucking explodes too hard
|
|
||||||
static uint32_t dataBits(uint64_t index)
|
|
||||||
{
|
|
||||||
uint32_t bits = hash32((uint32_t)index);
|
|
||||||
uint32_t exp = (bits >> 23) & 0xFFu;
|
|
||||||
if (exp < 0x30u) exp = 0x30u + (exp & 0x0Fu);
|
|
||||||
if (exp > 0xC0u) exp = 0xC0u - (exp & 0x0Fu);
|
|
||||||
return (bits & 0x807FFFFFu) | (exp << 23);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DkMemBlock block;
|
|
||||||
uint32_t offset;
|
|
||||||
uint32_t size;
|
|
||||||
} BumpAlloc;
|
|
||||||
|
|
||||||
static uint32_t bumpAlloc(BumpAlloc* a, uint32_t size, uint32_t align)
|
|
||||||
{
|
|
||||||
uint32_t off = ALIGN_UP(a->offset, align);
|
|
||||||
if (off + size > a->size) {
|
|
||||||
note("out of memory (need %u, have %u)", off + size, a->size);
|
|
||||||
return UINT32_MAX;
|
|
||||||
}
|
|
||||||
a->offset = off + size;
|
|
||||||
return off;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void* cpuPtr(BumpAlloc* a, uint32_t off)
|
|
||||||
{
|
|
||||||
return (uint8_t*)dkMemBlockGetCpuAddr(a->block) + off;
|
|
||||||
}
|
|
||||||
|
|
||||||
static DkGpuAddr gpuPtr(BumpAlloc* a, uint32_t off)
|
|
||||||
{
|
|
||||||
return dkMemBlockGetGpuAddr(a->block) + off;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TOOLBOX: copy worker state for the UI thread.
|
|
||||||
static void publish(void)
|
|
||||||
{
|
|
||||||
cuda95_status_t s{};
|
|
||||||
s.batches = g_tally.batches;
|
|
||||||
s.detected = g_tally.detected;
|
|
||||||
s.transient = g_tally.transient;
|
|
||||||
s.persistent = g_tally.persistent;
|
|
||||||
s.selfFail = g_tally.selfFail;
|
|
||||||
s.dataBad = g_tally.dataBad;
|
|
||||||
s.warnings = g_tally.warnings;
|
|
||||||
s.timeouts = g_tally.timeouts;
|
|
||||||
s.dispPerSec = s_dps;
|
|
||||||
s.gbps = s_gbps;
|
|
||||||
s.goldDigest = s_goldDigest;
|
|
||||||
s.goldMismatch = s_goldMismatch;
|
|
||||||
s.elapsedSec = elapsedSec();
|
|
||||||
s.profile = s_profile;
|
|
||||||
s.repeats = s_repeats;
|
|
||||||
s.calibrating = s_cal;
|
|
||||||
s.running = g_running.load() ? 1 : 0;
|
|
||||||
s.error = s_error;
|
|
||||||
snprintf(s.status, sizeof(s.status), "%s", s_state);
|
|
||||||
|
|
||||||
uint32_t total = g_logCount < LOG_LINES ? g_logCount : LOG_LINES;
|
|
||||||
uint32_t keep = total < CUDA95_LOG_LINES ? total : CUDA95_LOG_LINES;
|
|
||||||
s.logLines = keep;
|
|
||||||
for (unsigned i = 0; i < keep; i++) {
|
|
||||||
uint32_t idx = (g_logCount - keep + i) % LOG_LINES;
|
|
||||||
snprintf(s.log[i], sizeof(s.log[i]), "%s", g_log[idx]);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lk(g_lock);
|
|
||||||
g_pub = s;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void debugCallback(void* userData, const char* context,
|
|
||||||
DkResult result, const char* message)
|
|
||||||
{
|
|
||||||
(void)userData;
|
|
||||||
if (result == DkResult_Success) {
|
|
||||||
g_tally.warnings++;
|
|
||||||
note("deko3d warn [%s]: %s", context, message);
|
|
||||||
publish();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// TOOLBOX: flag the error instead.
|
|
||||||
note("deko3d ERROR [%s]: %s", context, message);
|
|
||||||
s_error = 1;
|
|
||||||
snprintf(s_state, sizeof(s_state), "GPU error");
|
|
||||||
publish();
|
|
||||||
g_stop.store(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool loadShader(DkShader* shader, BumpAlloc* codeMem, const char* path)
|
|
||||||
{
|
|
||||||
FILE* f = fopen(path, "rb");
|
|
||||||
if (!f) { note("cannot open %s", path); return false; }
|
|
||||||
|
|
||||||
DkshHeaderLocal hdr;
|
|
||||||
if (fread(&hdr, sizeof(hdr), 1, f) != 1 || hdr.magic != DKSH_MAGIC) {
|
|
||||||
note("%s is not a DKSH file", path);
|
|
||||||
fclose(f);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* control = malloc(hdr.control_sz);
|
|
||||||
if (!control) { fclose(f); return false; }
|
|
||||||
|
|
||||||
rewind(f);
|
|
||||||
if (fread(control, hdr.control_sz, 1, f) != 1) {
|
|
||||||
free(control); fclose(f); return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t codeOff = bumpAlloc(codeMem, hdr.code_sz, DK_SHADER_CODE_ALIGNMENT);
|
|
||||||
if (codeOff == UINT32_MAX) { free(control); fclose(f); return false; }
|
|
||||||
|
|
||||||
fseek(f, hdr.control_sz, SEEK_SET);
|
|
||||||
if (fread(cpuPtr(codeMem, codeOff), hdr.code_sz, 1, f) != 1) {
|
|
||||||
free(control); fclose(f); return false;
|
|
||||||
}
|
|
||||||
fclose(f);
|
|
||||||
|
|
||||||
DkShaderMaker maker;
|
|
||||||
dkShaderMakerDefaults(&maker, codeMem->block, codeOff);
|
|
||||||
maker.control = control;
|
|
||||||
dkShaderInitialize(shader, &maker);
|
|
||||||
|
|
||||||
free(control);
|
|
||||||
return dkShaderIsValid(shader);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Usual Deko3D memory allocation
|
|
||||||
typedef struct {
|
|
||||||
DkQueue queue;
|
|
||||||
DkCmdBuf cmdbuf;
|
|
||||||
DkShader shader;
|
|
||||||
|
|
||||||
DkGpuAddr uboAddr;
|
|
||||||
uint32_t uboSize;
|
|
||||||
|
|
||||||
//3x slots, two are constantly worked on while a third is checked
|
|
||||||
DkGpuAddr resultAddr[NUM_INFLIGHT];
|
|
||||||
GpuResult* resultCpu[NUM_INFLIGHT];
|
|
||||||
DkGpuAddr recAddr[NUM_INFLIGHT];
|
|
||||||
GpuRecord* recCpu[NUM_INFLIGHT];
|
|
||||||
DkCmdList batch[NUM_INFLIGHT];
|
|
||||||
|
|
||||||
DkGpuAddr dataAddr;
|
|
||||||
uint32_t dataSize;
|
|
||||||
uint32_t* dataCpu;
|
|
||||||
|
|
||||||
// Golden digests
|
|
||||||
DkGpuAddr expAddr;
|
|
||||||
uint32_t expSize;
|
|
||||||
} Ctx;
|
|
||||||
|
|
||||||
static void recordBatches(Ctx* c, Params params, uint32_t dispatches)
|
|
||||||
{
|
|
||||||
dkCmdBufClear(c->cmdbuf);
|
|
||||||
|
|
||||||
for (uint32_t s = 0; s < NUM_INFLIGHT; s++) {
|
|
||||||
const DkShader* shaders[] = { &c->shader };
|
|
||||||
dkCmdBufBindShaders(c->cmdbuf, DkStageFlag_Compute, shaders, 1);
|
|
||||||
|
|
||||||
DkBufExtents ubo = { c->uboAddr, c->uboSize };
|
|
||||||
dkCmdBufBindUniformBuffers(c->cmdbuf, DkStage_Compute, 0, &ubo, 1);
|
|
||||||
dkCmdBufPushConstants(c->cmdbuf, c->uboAddr, c->uboSize,
|
|
||||||
0, sizeof(params), ¶ms);
|
|
||||||
|
|
||||||
DkBufExtents ssbos[4];
|
|
||||||
ssbos[0].addr = c->dataAddr; ssbos[0].size = c->dataSize;
|
|
||||||
ssbos[1].addr = c->resultAddr[s]; ssbos[1].size = sizeof(GpuResult);
|
|
||||||
ssbos[2].addr = c->recAddr[s]; ssbos[2].size = MAX_RECORDS * sizeof(GpuRecord);
|
|
||||||
ssbos[3].addr = c->expAddr; ssbos[3].size = c->expSize;
|
|
||||||
dkCmdBufBindStorageBuffers(c->cmdbuf, DkStage_Compute, 0, ssbos, 4);
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < dispatches; i++)
|
|
||||||
dkCmdBufDispatchCompute(c->cmdbuf, NUM_GROUPS_X, NUM_GROUPS_Y, 1);
|
|
||||||
|
|
||||||
c->batch[s] = dkCmdBufFinishList(c->cmdbuf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef enum { RUN_OK = 0, RUN_TIMEOUT, RUN_QUEUE_ERROR } RunStatus;
|
|
||||||
|
|
||||||
static RunStatus runSync(Ctx* c, uint32_t slot, GpuResult* out, uint64_t* outNs)
|
|
||||||
{
|
|
||||||
memset(c->resultCpu[slot], 0, sizeof(GpuResult));
|
|
||||||
|
|
||||||
DkFence fence;
|
|
||||||
memset(&fence, 0, sizeof(fence));
|
|
||||||
|
|
||||||
uint64_t t0 = armGetSystemTick();
|
|
||||||
dkQueueSubmitCommands(c->queue, c->batch[slot]);
|
|
||||||
// CPU politely asks for the data
|
|
||||||
dkQueueSignalFence(c->queue, &fence, true);
|
|
||||||
dkQueueFlush(c->queue);
|
|
||||||
|
|
||||||
DkResult r = dkFenceWait(&fence, (int64_t)FENCE_TIMEOUT_NS);
|
|
||||||
uint64_t t1 = armGetSystemTick();
|
|
||||||
if (outNs) *outNs = armTicksToNs(t1 - t0);
|
|
||||||
|
|
||||||
// FAHHHHHHH
|
|
||||||
if (r != DkResult_Success)
|
|
||||||
return dkQueueIsInErrorState(c->queue) ? RUN_QUEUE_ERROR : RUN_TIMEOUT;
|
|
||||||
if (dkQueueIsInErrorState(c->queue))
|
|
||||||
return RUN_QUEUE_ERROR;
|
|
||||||
|
|
||||||
*out = *c->resultCpu[slot];
|
|
||||||
return RUN_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gets reports from GPU results, mainly fault records
|
|
||||||
static void reportRecords(Ctx* c, uint32_t slot, uint32_t errCount)
|
|
||||||
{
|
|
||||||
uint32_t shown = errCount < MAX_RECORDS ? errCount : MAX_RECORDS;
|
|
||||||
if (shown > 3) shown = 3;
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < shown; i++) {
|
|
||||||
GpuRecord r = c->recCpu[slot][i];
|
|
||||||
note(" rec thread %u %s got %08x want %08x", r.id,
|
|
||||||
r.stage == 1u ? "ALU" : "digest", r.got, r.want);
|
|
||||||
}
|
|
||||||
if (errCount > shown)
|
|
||||||
note(" (%u more records)", errCount - shown);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Seperated because this way we can distinguish between source corruption and the GPU on a bender.
|
|
||||||
static uint32_t checkDataIntegrity(Ctx* c)
|
|
||||||
{
|
|
||||||
const uint32_t stride = 997;
|
|
||||||
uint32_t bad = 0;
|
|
||||||
for (uint64_t i = 0; i < N_ELEMS; i += stride)
|
|
||||||
if (c->dataCpu[i] != dataBits(i)) bad++;
|
|
||||||
return bad;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Capture golden values to confirm them as valid.
|
|
||||||
// Runs which cannot reproduce their own digests as valid 3 times are assumed as always unstable.
|
|
||||||
// Used to refuse baking in bad data and instead re compute.
|
|
||||||
static bool calibrate(Ctx* c, Params base, uint32_t* goldDigest, uint32_t* goldMismatch)
|
|
||||||
{
|
|
||||||
GpuResult r;
|
|
||||||
Params p = base;
|
|
||||||
|
|
||||||
// Capture data
|
|
||||||
p.mode = 0;
|
|
||||||
recordBatches(c, p, 1);
|
|
||||||
if (runSync(c, 0, &r, NULL) != RUN_OK) {
|
|
||||||
note("calibration: capture run failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compare against what we have
|
|
||||||
p.mode = 1;
|
|
||||||
recordBatches(c, p, 1);
|
|
||||||
|
|
||||||
uint32_t d[3], m[3];
|
|
||||||
for (int i = 0; i < 3; i++) {
|
|
||||||
// TOOLBOX: abort calibration when stopped.
|
|
||||||
if (g_stop.load()) return false;
|
|
||||||
if (runSync(c, 0, &r, NULL) != RUN_OK) {
|
|
||||||
note("calibration: confirm run %d failed", i + 1);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
d[i] = r.digest;
|
|
||||||
m[i] = r.mismatches;
|
|
||||||
if (r.selfFail || r.errCount) {
|
|
||||||
g_tally.selfFail += r.selfFail;
|
|
||||||
note("calibration: run %d reported %u selfFail, %u records",
|
|
||||||
i + 1, r.selfFail, r.errCount);
|
|
||||||
reportRecords(c, 0, r.errCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d[0] == d[1] && d[1] == d[2]) {
|
|
||||||
*goldDigest = d[0];
|
|
||||||
*goldMismatch = m[0];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Weigh the results, if nothing appeared twice, then flag these values.
|
|
||||||
g_tally.detected++;
|
|
||||||
if (d[0] == d[1] || d[0] == d[2]) { *goldDigest = d[0]; *goldMismatch = m[0]; }
|
|
||||||
else if (d[1] == d[2]) { *goldDigest = d[1]; *goldMismatch = m[1]; }
|
|
||||||
else { *goldDigest = d[0]; *goldMismatch = m[0]; }
|
|
||||||
note("CALIBRATION UNSTABLE: %08x %08x %08x -- reference may be wrong",
|
|
||||||
d[0], d[1], d[2]);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TOOLBOX: worker thread, replace runDemo() loop.
|
|
||||||
static void workerMain(void)
|
|
||||||
{
|
|
||||||
g_running.store(true);
|
|
||||||
appletSetAutoSleepDisabled(true);
|
|
||||||
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lk(g_lock);
|
|
||||||
s_profile = s_cfgProfile;
|
|
||||||
s_repeats = s_cfgRepeats;
|
|
||||||
}
|
|
||||||
int profile = s_profile;
|
|
||||||
uint32_t repeats = s_repeats;
|
|
||||||
|
|
||||||
memset(&g_tally, 0, sizeof(g_tally));
|
|
||||||
g_logCount = 0;
|
|
||||||
g_tStart = armGetSystemTick();
|
|
||||||
s_goldDigest = 0;
|
|
||||||
s_goldMismatch = 0;
|
|
||||||
s_dps = 0.0;
|
|
||||||
s_gbps = 0.0;
|
|
||||||
s_cal = 0;
|
|
||||||
s_error = 0;
|
|
||||||
snprintf(s_state, sizeof(s_state), "starting");
|
|
||||||
|
|
||||||
Ctx c;
|
|
||||||
memset(&c, 0, sizeof(c));
|
|
||||||
|
|
||||||
note("CUDA95 %d rows x %d threads", N_ROWS, N_THREADS);
|
|
||||||
|
|
||||||
DkDeviceMaker devMaker;
|
|
||||||
dkDeviceMakerDefaults(&devMaker);
|
|
||||||
devMaker.cbDebug = debugCallback;
|
|
||||||
DkDevice device = dkDeviceCreate(&devMaker);
|
|
||||||
|
|
||||||
// Setup queues
|
|
||||||
DkQueueMaker queueMaker;
|
|
||||||
dkQueueMakerDefaults(&queueMaker, device);
|
|
||||||
queueMaker.flags = DkQueueFlags_Compute
|
|
||||||
| DkQueueFlags_MediumPrio
|
|
||||||
| DkQueueFlags_DisableZcull;
|
|
||||||
queueMaker.commandMemorySize = 512 * 1024;
|
|
||||||
queueMaker.flushThreshold = 128 * 1024;
|
|
||||||
DkQueue queue = dkQueueCreate(&queueMaker);
|
|
||||||
c.queue = queue;
|
|
||||||
|
|
||||||
// Allocate and create memory regions
|
|
||||||
DkMemBlockMaker mbMaker;
|
|
||||||
dkMemBlockMakerDefaults(&mbMaker, device, CODEMEM_SIZE);
|
|
||||||
mbMaker.flags = DkMemBlockFlags_CpuUncached
|
|
||||||
| DkMemBlockFlags_GpuCached
|
|
||||||
| DkMemBlockFlags_Code;
|
|
||||||
BumpAlloc codeMem = { dkMemBlockCreate(&mbMaker), 0, CODEMEM_SIZE };
|
|
||||||
|
|
||||||
uint32_t dataSize = (uint32_t)(N_ELEMS * sizeof(uint32_t)); // 4 MiB
|
|
||||||
uint32_t expSize = N_THREADS * sizeof(uint32_t); // 16 KiB
|
|
||||||
uint32_t recSize = MAX_RECORDS * sizeof(GpuRecord); // 1 KiB
|
|
||||||
uint32_t dataMemSize = ALIGN_UP(CMDMEM_SIZE + dataSize + expSize
|
|
||||||
+ NUM_INFLIGHT * (recSize + 0x100) + 0x4000,
|
|
||||||
DK_MEMBLOCK_ALIGNMENT);
|
|
||||||
|
|
||||||
dkMemBlockMakerDefaults(&mbMaker, device, dataMemSize);
|
|
||||||
mbMaker.flags = DkMemBlockFlags_CpuUncached | DkMemBlockFlags_GpuCached;
|
|
||||||
BumpAlloc dataMem = { dkMemBlockCreate(&mbMaker), 0, dataMemSize };
|
|
||||||
|
|
||||||
DkCmdBufMaker cbMaker;
|
|
||||||
dkCmdBufMakerDefaults(&cbMaker, device);
|
|
||||||
c.cmdbuf = dkCmdBufCreate(&cbMaker);
|
|
||||||
|
|
||||||
uint32_t cmdOff = bumpAlloc(&dataMem, CMDMEM_SIZE, DK_CMDMEM_ALIGNMENT);
|
|
||||||
dkCmdBufAddMemory(c.cmdbuf, dataMem.block, cmdOff, CMDMEM_SIZE);
|
|
||||||
|
|
||||||
c.uboSize = ALIGN_UP(sizeof(Params), DK_UNIFORM_BUF_ALIGNMENT);
|
|
||||||
uint32_t uboOff = bumpAlloc(&dataMem, c.uboSize, DK_UNIFORM_BUF_ALIGNMENT);
|
|
||||||
c.uboAddr = gpuPtr(&dataMem, uboOff);
|
|
||||||
|
|
||||||
// Allocate the result slots so we do not stall
|
|
||||||
for (uint32_t s = 0; s < NUM_INFLIGHT; s++) {
|
|
||||||
uint32_t ro = bumpAlloc(&dataMem, sizeof(GpuResult), 0x100);
|
|
||||||
c.resultAddr[s] = gpuPtr(&dataMem, ro);
|
|
||||||
c.resultCpu[s] = (GpuResult*)cpuPtr(&dataMem, ro);
|
|
||||||
|
|
||||||
uint32_t eo = bumpAlloc(&dataMem, recSize, 0x100);
|
|
||||||
c.recAddr[s] = gpuPtr(&dataMem, eo);
|
|
||||||
c.recCpu[s] = (GpuRecord*)cpuPtr(&dataMem, eo);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t expOff = bumpAlloc(&dataMem, expSize, 0x100);
|
|
||||||
c.expAddr = gpuPtr(&dataMem, expOff);
|
|
||||||
c.expSize = expSize;
|
|
||||||
|
|
||||||
uint32_t dataOff = bumpAlloc(&dataMem, dataSize, 0x100);
|
|
||||||
c.dataAddr = gpuPtr(&dataMem, dataOff);
|
|
||||||
c.dataSize = dataSize;
|
|
||||||
c.dataCpu = (uint32_t*)cpuPtr(&dataMem, dataOff);
|
|
||||||
|
|
||||||
// Fill memory
|
|
||||||
note("filling %u KiB of test data...", dataSize / 1024);
|
|
||||||
for (uint64_t i = 0; i < N_ELEMS; i++) {
|
|
||||||
if ((i & 0xFFFFF) == 0 && g_stop.load()) break;
|
|
||||||
c.dataCpu[i] = dataBits(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t goldDigest = 0, goldMismatch = 0;
|
|
||||||
uint32_t expDigest = 0, expMismatch = 0;
|
|
||||||
bool ready = false;
|
|
||||||
|
|
||||||
// TOOLBOX: host app owns romfs
|
|
||||||
if (!g_stop.load() && loadShader(&c.shader, &codeMem, "romfs:/shaders/stress_csh.dksh")) {
|
|
||||||
Params base = { N_ROWS, repeats,
|
|
||||||
kProfiles[profile].alu, kProfiles[profile].gather,
|
|
||||||
MAX_RECORDS, 1, scatterMaskFor(profile), 0u };
|
|
||||||
|
|
||||||
s_cal = 1;
|
|
||||||
snprintf(s_state, sizeof(s_state), "calibrating");
|
|
||||||
note("calibrating (%s, repeats %u)...", kProfiles[profile].name, repeats);
|
|
||||||
publish();
|
|
||||||
if (!g_stop.load() && calibrate(&c, base, &goldDigest, &goldMismatch)) {
|
|
||||||
expDigest = goldDigest * DISPATCHES_PER_LIST;
|
|
||||||
expMismatch = goldMismatch * DISPATCHES_PER_LIST;
|
|
||||||
s_goldDigest = goldDigest;
|
|
||||||
s_goldMismatch = goldMismatch;
|
|
||||||
note("golden digest %08x, mismatches %u", goldDigest, goldMismatch);
|
|
||||||
|
|
||||||
Params runParams = base;
|
|
||||||
runParams.mode = 1;
|
|
||||||
recordBatches(&c, runParams, DISPATCHES_PER_LIST);
|
|
||||||
ready = true;
|
|
||||||
} else if (!g_stop.load()) {
|
|
||||||
s_error = 1;
|
|
||||||
snprintf(s_state, sizeof(s_state), "calibration failed");
|
|
||||||
note("initial calibration failed, aborting");
|
|
||||||
}
|
|
||||||
s_cal = 0;
|
|
||||||
|
|
||||||
if (ready) {
|
|
||||||
// Dispatches are idential and use atomicAdd, so batches must be DISPATCHES_PER_lIST * 1 dispatch.
|
|
||||||
DkFence fences[NUM_INFLIGHT];
|
|
||||||
memset(fences, 0, sizeof(fences));
|
|
||||||
|
|
||||||
uint64_t submitted = 0;
|
|
||||||
uint64_t windowDisp = 0;
|
|
||||||
uint64_t tWindow = armGetSystemTick();
|
|
||||||
double dps = 0.0;
|
|
||||||
bool dirty = false;
|
|
||||||
bool fatal = false;
|
|
||||||
snprintf(s_state, sizeof(s_state), "running");
|
|
||||||
publish();
|
|
||||||
|
|
||||||
while (!g_stop.load() && !fatal) {
|
|
||||||
// TOOLBOX: settings from the UI
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lk(g_lock);
|
|
||||||
if (s_wantDirty) {
|
|
||||||
s_wantDirty = false;
|
|
||||||
profile = s_wantProfile;
|
|
||||||
repeats = s_wantRepeats;
|
|
||||||
s_profile = profile;
|
|
||||||
s_repeats = repeats;
|
|
||||||
dirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dirty) {
|
|
||||||
// If we get an error, recapture golden digest for comparisons to actually work.
|
|
||||||
dkQueueWaitIdle(queue);
|
|
||||||
|
|
||||||
base.n_repeats = repeats;
|
|
||||||
base.alu_iters = kProfiles[profile].alu;
|
|
||||||
base.gather_iters = kProfiles[profile].gather;
|
|
||||||
base.scatter_mask = scatterMaskFor(profile);
|
|
||||||
base.mode = 1;
|
|
||||||
|
|
||||||
s_cal = 1;
|
|
||||||
snprintf(s_state, sizeof(s_state), "calibrating");
|
|
||||||
note("recalibrating (%s, repeats %u)...", kProfiles[profile].name, repeats);
|
|
||||||
publish();
|
|
||||||
|
|
||||||
if (g_stop.load()) break;
|
|
||||||
if (!calibrate(&c, base, &goldDigest, &goldMismatch)) {
|
|
||||||
note("recalibration failed");
|
|
||||||
s_error = 1;
|
|
||||||
snprintf(s_state, sizeof(s_state), "recalibration failed");
|
|
||||||
fatal = true;
|
|
||||||
s_cal = 0;
|
|
||||||
publish();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
expDigest = goldDigest * DISPATCHES_PER_LIST;
|
|
||||||
expMismatch = goldMismatch * DISPATCHES_PER_LIST;
|
|
||||||
s_goldDigest = goldDigest;
|
|
||||||
s_goldMismatch = goldMismatch;
|
|
||||||
note("calibrated %s repeats %u -> digest %08x",
|
|
||||||
kProfiles[profile].name, repeats, goldDigest);
|
|
||||||
|
|
||||||
Params runParams = base;
|
|
||||||
runParams.mode = 1;
|
|
||||||
recordBatches(&c, runParams, DISPATCHES_PER_LIST);
|
|
||||||
|
|
||||||
memset(fences, 0, sizeof(fences));
|
|
||||||
submitted = 0;
|
|
||||||
dirty = false;
|
|
||||||
s_cal = 0;
|
|
||||||
snprintf(s_state, sizeof(s_state), "running");
|
|
||||||
publish();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t slot = (uint32_t)(submitted % NUM_INFLIGHT);
|
|
||||||
|
|
||||||
if (submitted >= NUM_INFLIGHT) {
|
|
||||||
DkResult r = dkFenceWait(&fences[slot], (int64_t)FENCE_TIMEOUT_NS);
|
|
||||||
|
|
||||||
if (dkQueueIsInErrorState(queue)) {
|
|
||||||
note("FATAL: queue entered error state");
|
|
||||||
s_error = 1;
|
|
||||||
snprintf(s_state, sizeof(s_state), "GPU queue error");
|
|
||||||
fatal = true;
|
|
||||||
publish();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (r != DkResult_Success) {
|
|
||||||
g_tally.timeouts++;
|
|
||||||
note("FATAL: batch exceeded %llu s deadline",
|
|
||||||
(unsigned long long)(FENCE_TIMEOUT_NS / 1000000000ULL));
|
|
||||||
s_error = 1;
|
|
||||||
snprintf(s_state, sizeof(s_state), "batch timeout");
|
|
||||||
fatal = true;
|
|
||||||
publish();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_tally.batches++;
|
|
||||||
GpuResult res = *c.resultCpu[slot];
|
|
||||||
|
|
||||||
bool bad = (res.digest != expDigest) || (res.mismatches != expMismatch);
|
|
||||||
|
|
||||||
// Shader COMP/DUP still occurs even if digests are bad.
|
|
||||||
// Allows to distinguish what died.
|
|
||||||
if (res.selfFail) {
|
|
||||||
g_tally.selfFail += res.selfFail;
|
|
||||||
note("batch %llu: %u ALU self-check failures",
|
|
||||||
(unsigned long long)g_tally.batches, res.selfFail);
|
|
||||||
bad = true;
|
|
||||||
}
|
|
||||||
if (res.errCount) {
|
|
||||||
reportRecords(&c, slot, res.errCount);
|
|
||||||
bad = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We outa stability
|
|
||||||
if (bad) {
|
|
||||||
if (res.digest != expDigest)
|
|
||||||
note("batch %llu: digest %08x want %08x",
|
|
||||||
(unsigned long long)g_tally.batches, res.digest, expDigest);
|
|
||||||
|
|
||||||
g_tally.detected++;
|
|
||||||
|
|
||||||
// Re run batches twice and average, mainly for transience.
|
|
||||||
dkQueueWaitIdle(queue);
|
|
||||||
GpuResult a, b;
|
|
||||||
RunStatus s1 = runSync(&c, slot, &a, NULL);
|
|
||||||
RunStatus s2 = runSync(&c, slot, &b, NULL);
|
|
||||||
if (s1 != RUN_OK || s2 != RUN_OK) {
|
|
||||||
note("FATAL: re-run failed during vote");
|
|
||||||
s_error = 1;
|
|
||||||
snprintf(s_state, sizeof(s_state), "re-run failed");
|
|
||||||
fatal = true;
|
|
||||||
publish();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we rerun, replay the same list so batches are compared to what they should result in, not the golden value for single dispatches
|
|
||||||
bool aOk = (a.digest == expDigest) && !a.selfFail && !a.errCount;
|
|
||||||
bool bOk = (b.digest == expDigest) && !b.selfFail && !b.errCount;
|
|
||||||
|
|
||||||
// If we detect transience, then we sorta ball, if its persistent, fucking overvolt.
|
|
||||||
if (aOk && bOk) {
|
|
||||||
g_tally.transient++;
|
|
||||||
note(" -> transient, corrected");
|
|
||||||
} else {
|
|
||||||
g_tally.persistent++;
|
|
||||||
note(" -> PERSISTENT (re-runs %08x, %08x)", a.digest, b.digest);
|
|
||||||
}
|
|
||||||
|
|
||||||
// How did this happen
|
|
||||||
// A long time ago
|
|
||||||
uint32_t badElems = checkDataIntegrity(&c);
|
|
||||||
if (badElems) {
|
|
||||||
g_tally.dataBad += badElems;
|
|
||||||
note(" -> input buffer: %u sampled elements wrong", badElems);
|
|
||||||
}
|
|
||||||
|
|
||||||
publish();
|
|
||||||
memset(fences, 0, sizeof(fences));
|
|
||||||
submitted = 0;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// que
|
|
||||||
if ((g_tally.batches % DATA_CHECK_INTERVAL) == 0) {
|
|
||||||
uint32_t badElems = checkDataIntegrity(&c);
|
|
||||||
if (badElems) {
|
|
||||||
g_tally.dataBad += badElems;
|
|
||||||
note("input buffer: %u sampled elements wrong", badElems);
|
|
||||||
}
|
|
||||||
publish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(c.resultCpu[slot], 0, sizeof(GpuResult));
|
|
||||||
dkQueueSubmitCommands(queue, c.batch[slot]);
|
|
||||||
dkQueueSignalFence(queue, &fences[slot], true);
|
|
||||||
dkQueueFlush(queue);
|
|
||||||
|
|
||||||
submitted++;
|
|
||||||
windowDisp += DISPATCHES_PER_LIST;
|
|
||||||
|
|
||||||
uint64_t now = armGetSystemTick();
|
|
||||||
uint64_t windowNs = armTicksToNs(now - tWindow);
|
|
||||||
if (windowNs >= 500000000ULL) {
|
|
||||||
double secs = windowNs / 1.0e9;
|
|
||||||
dps = windowDisp / secs;
|
|
||||||
|
|
||||||
double bytesPer = (double)N_THREADS * 16.0 * repeats
|
|
||||||
* ((double)N_ROWS + (double)kProfiles[profile].gather);
|
|
||||||
|
|
||||||
s_dps = dps;
|
|
||||||
s_gbps = (dps * bytesPer) / 1.0e9;
|
|
||||||
publish();
|
|
||||||
|
|
||||||
windowDisp = 0;
|
|
||||||
tWindow = now;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (!g_stop.load()) {
|
|
||||||
s_error = 1;
|
|
||||||
snprintf(s_state, sizeof(s_state), "shader load failed");
|
|
||||||
note("could not load stress_csh.dksh, aborting");
|
|
||||||
publish();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dkQueueIsInErrorState(queue))
|
|
||||||
dkQueueWaitIdle(queue);
|
|
||||||
dkCmdBufDestroy(c.cmdbuf);
|
|
||||||
dkMemBlockDestroy(dataMem.block);
|
|
||||||
dkMemBlockDestroy(codeMem.block);
|
|
||||||
dkQueueDestroy(queue);
|
|
||||||
dkDeviceDestroy(device);
|
|
||||||
|
|
||||||
if (!s_error && g_stop.load())
|
|
||||||
snprintf(s_state, sizeof(s_state), "stopped");
|
|
||||||
publish();
|
|
||||||
|
|
||||||
appletSetAutoSleepDisabled(false);
|
|
||||||
g_running.store(false);
|
|
||||||
publish();
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned normRepeats(unsigned r)
|
|
||||||
{
|
|
||||||
if (r < CUDA95_REPEATS_MIN) r = CUDA95_REPEATS_MIN;
|
|
||||||
if (r > CUDA95_REPEATS_MAX) r = CUDA95_REPEATS_MAX;
|
|
||||||
unsigned p = 1;
|
|
||||||
while (p * 2u <= r) p *= 2u;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int normProfile(int p)
|
|
||||||
{
|
|
||||||
if (p < 0) return 0;
|
|
||||||
if (p >= NUM_PROFILES) return NUM_PROFILES - 1;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
|
|
||||||
void cuda95_start(int profile, unsigned repeats)
|
|
||||||
{
|
|
||||||
cuda95_stop();
|
|
||||||
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lk(g_lock);
|
|
||||||
s_cfgProfile = normProfile(profile);
|
|
||||||
s_cfgRepeats = normRepeats(repeats);
|
|
||||||
s_wantProfile = s_cfgProfile;
|
|
||||||
s_wantRepeats = s_cfgRepeats;
|
|
||||||
s_wantDirty = false;
|
|
||||||
memset(&g_pub, 0, sizeof(g_pub));
|
|
||||||
snprintf(g_pub.status, sizeof(g_pub.status), "starting");
|
|
||||||
}
|
|
||||||
|
|
||||||
g_stop.store(false);
|
|
||||||
g_thread = std::thread(workerMain);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cuda95_stop(void)
|
|
||||||
{
|
|
||||||
g_stop.store(true);
|
|
||||||
if (g_thread.joinable())
|
|
||||||
g_thread.join();
|
|
||||||
}
|
|
||||||
|
|
||||||
int cuda95_running(void)
|
|
||||||
{
|
|
||||||
return g_running.load() ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cuda95_get(cuda95_status_t *out)
|
|
||||||
{
|
|
||||||
if (!out) return;
|
|
||||||
std::lock_guard<std::mutex> lk(g_lock);
|
|
||||||
*out = g_pub;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cuda95_set_profile(int profile)
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lk(g_lock);
|
|
||||||
s_cfgProfile = normProfile(profile);
|
|
||||||
if (g_running.load()) {
|
|
||||||
s_wantProfile = s_cfgProfile;
|
|
||||||
s_wantDirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cuda95_set_repeats(unsigned repeats)
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lk(g_lock);
|
|
||||||
s_cfgRepeats = normRepeats(repeats);
|
|
||||||
if (g_running.load()) {
|
|
||||||
s_wantRepeats = s_cfgRepeats;
|
|
||||||
s_wantDirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *cuda95_profile_name(int profile)
|
|
||||||
{
|
|
||||||
profile = normProfile(profile);
|
|
||||||
return kProfiles[profile].name;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned cuda95_profile_alu(int profile)
|
|
||||||
{
|
|
||||||
profile = normProfile(profile);
|
|
||||||
return kProfiles[profile].alu;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned cuda95_profile_gather(int profile)
|
|
||||||
{
|
|
||||||
profile = normProfile(profile);
|
|
||||||
return kProfiles[profile].gather;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // extern C
|
|
||||||
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
// CUDA-95NX backend.
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CUDA95_NUM_PROFILES 4
|
|
||||||
|
|
||||||
#define CUDA95_REPEATS_MIN 1u
|
|
||||||
#define CUDA95_REPEATS_MAX 256u
|
|
||||||
|
|
||||||
#define CUDA95_LOG_LINES 8
|
|
||||||
#define CUDA95_LOG_COLS 96
|
|
||||||
|
|
||||||
// Profiles
|
|
||||||
// 0 = balanced
|
|
||||||
// 1 = core
|
|
||||||
// 2 = dram
|
|
||||||
// 3 = l2
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint64_t batches;
|
|
||||||
uint64_t detected;
|
|
||||||
uint64_t transient;
|
|
||||||
uint64_t persistent;
|
|
||||||
uint64_t selfFail;
|
|
||||||
uint64_t dataBad;
|
|
||||||
uint64_t warnings;
|
|
||||||
uint64_t timeouts;
|
|
||||||
|
|
||||||
double dispPerSec;
|
|
||||||
double gbps;
|
|
||||||
|
|
||||||
uint32_t goldDigest;
|
|
||||||
uint32_t goldMismatch;
|
|
||||||
|
|
||||||
uint64_t elapsedSec;
|
|
||||||
|
|
||||||
int profile;
|
|
||||||
unsigned repeats;
|
|
||||||
|
|
||||||
int calibrating;
|
|
||||||
int running;
|
|
||||||
int error;
|
|
||||||
char status[96];
|
|
||||||
|
|
||||||
char log[CUDA95_LOG_LINES][CUDA95_LOG_COLS];
|
|
||||||
unsigned logLines;
|
|
||||||
} cuda95_status_t;
|
|
||||||
|
|
||||||
void cuda95_start(int profile, unsigned repeats);
|
|
||||||
void cuda95_stop(void);
|
|
||||||
int cuda95_running(void);
|
|
||||||
void cuda95_get(cuda95_status_t *out);
|
|
||||||
|
|
||||||
void cuda95_set_profile(int profile);
|
|
||||||
void cuda95_set_repeats(unsigned repeats);
|
|
||||||
|
|
||||||
const char *cuda95_profile_name(int profile);
|
|
||||||
unsigned cuda95_profile_alu(int profile);
|
|
||||||
unsigned cuda95_profile_gather(int profile);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,202 +0,0 @@
|
|||||||
#version 430 core
|
|
||||||
// CRAWLING IN MY SKINNNNNN
|
|
||||||
// THESE WOUNDS THEY WILL NOT HEALLLLLLLL
|
|
||||||
// Furmark bored the fuck out of me tbh although the black hole bench I do want to revisit but thats besides the point.
|
|
||||||
|
|
||||||
// Here we are, this compute shitpost draws more power than furmark.
|
|
||||||
|
|
||||||
// TX1 has 2SMs with 4 schedulers with 2x issue. So 256 threads per block, 8 blocks per sm, 2048 threads dispatched as a max
|
|
||||||
layout(local_size_x = 16, local_size_y = 16) in; // 256 threads = 8 warps
|
|
||||||
|
|
||||||
|
|
||||||
// uvec4 used here to use LDG, essentially forcing data to be read from the unified instruction cache, diferenciating from a global/generic load
|
|
||||||
// For us, besdies the speedup this also means that lanes pulls 512 bytes instead of 128, forcing mem/l2 more.
|
|
||||||
layout(std430, binding = 0) readonly buffer DataBuffer {
|
|
||||||
uvec4 data[];
|
|
||||||
};
|
|
||||||
|
|
||||||
layout(std430, binding = 1) buffer ResultBuffer {
|
|
||||||
uint mismatches;
|
|
||||||
uint digest;
|
|
||||||
uint selfFail;
|
|
||||||
uint errCount;
|
|
||||||
};
|
|
||||||
|
|
||||||
// ALU self checks/mismatch storage
|
|
||||||
layout(std430, binding = 2) buffer ErrorLog {
|
|
||||||
uvec4 record[];
|
|
||||||
};
|
|
||||||
|
|
||||||
layout(std430, binding = 3) buffer ExpectedBuffer {
|
|
||||||
uint expected[];
|
|
||||||
};
|
|
||||||
|
|
||||||
layout(std140, binding = 0) uniform Params {
|
|
||||||
uint n_rows;
|
|
||||||
uint n_repeats;
|
|
||||||
uint alu_iters;
|
|
||||||
uint gather_iters;
|
|
||||||
uint max_records;
|
|
||||||
uint mode; // 0 = capture golden, 1 = compare, 2 = ignore
|
|
||||||
uint scatter_mask; // limits size to stay in L2 or not
|
|
||||||
uint chain_bias; // normally 0; see aluChain2
|
|
||||||
};
|
|
||||||
|
|
||||||
const float THRESHOLD = 0.001f;
|
|
||||||
|
|
||||||
|
|
||||||
// "scratchpad", not really.
|
|
||||||
// this is configured for 8kb per block (for 64Kb), any higher drops our block count
|
|
||||||
shared uint s_scratch[2048];
|
|
||||||
|
|
||||||
// FNV-1a. Surpringly heavy because maxwell. (XMAD)
|
|
||||||
uint hmix(uint h, uint v)
|
|
||||||
{
|
|
||||||
h ^= v;
|
|
||||||
h *= 16777619u;
|
|
||||||
return h;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Constant shifts, so every index below must be a mask/add
|
|
||||||
uint xs32(uint x)
|
|
||||||
{
|
|
||||||
x ^= x << 13;
|
|
||||||
x ^= x >> 17;
|
|
||||||
x ^= x << 5;
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
void pushRecord(uint id, uint stage, uint got, uint want)
|
|
||||||
{
|
|
||||||
uint idx = atomicAdd(errCount, 1u);
|
|
||||||
if (idx < max_records)
|
|
||||||
record[idx] = uvec4(id, stage, got, want);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Man fuck current limits.
|
|
||||||
// Here we issue 2 instructions per cycle, intervealing to achive this.
|
|
||||||
// chian_bias is only here to stop the compiler from optimizing it away.
|
|
||||||
// CPU side passes zero so results must be equal, otherwise we know an error occured.
|
|
||||||
// Giving anything else breaks.
|
|
||||||
uvec2 aluChain2(uint seed, uint iters)
|
|
||||||
{
|
|
||||||
uint s2 = seed ^ chain_bias;
|
|
||||||
|
|
||||||
uint h1 = seed, h2 = s2;
|
|
||||||
uint a1 = seed | 1u, a2 = s2 | 1u;
|
|
||||||
float f1 = uintBitsToFloat((seed & 0x007FFFFFu) | 0x3F800000u);
|
|
||||||
float f2 = uintBitsToFloat((s2 & 0x007FFFFFu) | 0x3F800000u);
|
|
||||||
|
|
||||||
for (uint i = 0u; i < iters; ++i) {
|
|
||||||
// int/FP work
|
|
||||||
a1 = xs32(a1) + 0x9E3779B9u;
|
|
||||||
a2 = xs32(a2) + 0x9E3779B9u;
|
|
||||||
f1 = fma(f1, f1, 0.5);
|
|
||||||
f2 = fma(f2, f2, 0.5);
|
|
||||||
// Force values back into [1,2].
|
|
||||||
f1 = uintBitsToFloat((floatBitsToUint(f1) & 0x007FFFFFu) | 0x3F800000u);
|
|
||||||
f2 = uintBitsToFloat((floatBitsToUint(f2) & 0x007FFFFFu) | 0x3F800000u);
|
|
||||||
h1 = hmix(h1 ^ a1, floatBitsToUint(f1));
|
|
||||||
h2 = hmix(h2 ^ a2, floatBitsToUint(f2));
|
|
||||||
}
|
|
||||||
return uvec2(h1, h2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// I hate myself
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
uint gx = gl_NumWorkGroups.x * gl_WorkGroupSize.x;
|
|
||||||
uint tid = gl_GlobalInvocationID.y * gx + gl_GlobalInvocationID.x;
|
|
||||||
|
|
||||||
// Distance in elements between rows. Also serves as the thread count
|
|
||||||
uint stride = gx * gl_NumWorkGroups.y * gl_WorkGroupSize.y;
|
|
||||||
|
|
||||||
uint lid = gl_LocalInvocationIndex;
|
|
||||||
|
|
||||||
uint count = 0u;
|
|
||||||
uint h = 2166136261u ^ tid;
|
|
||||||
|
|
||||||
for (uint k = 0u; k < n_repeats; ++k) {
|
|
||||||
|
|
||||||
// read uvec4 data continously
|
|
||||||
uvec4 ref = data[tid];
|
|
||||||
h = hmix(hmix(hmix(hmix(h, ref.x), ref.y), ref.z), ref.w);
|
|
||||||
|
|
||||||
vec4 fref = uintBitsToFloat(ref);
|
|
||||||
uint idx = tid;
|
|
||||||
|
|
||||||
for (uint row = 1u; row < n_rows; ++row) {
|
|
||||||
|
|
||||||
// On reduced load, adss per row instead of IMAD, which because Nvidia would expand into XMAD competing for resorces.
|
|
||||||
idx += stride;
|
|
||||||
|
|
||||||
uvec4 v = data[idx];
|
|
||||||
h = hmix(hmix(hmix(hmix(h, v.x), v.y), v.z), v.w);
|
|
||||||
|
|
||||||
// FSETP + used instead of creating divergence.
|
|
||||||
bvec4 hit = greaterThan(abs(fref - uintBitsToFloat(v)), vec4(THRESHOLD));
|
|
||||||
count += uint(hit.x) + uint(hit.y) + uint(hit.z) + uint(hit.w);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gather data in a different line every lane.
|
|
||||||
// Sized under L2 max, because fuck cache
|
|
||||||
uint st = xs32(h | 1u);
|
|
||||||
for (uint g = 0u; g < gather_iters; ++g) {
|
|
||||||
st = xs32(st);
|
|
||||||
uvec4 v = data[st & scatter_mask];
|
|
||||||
h = hmix(hmix(hmix(hmix(h, v.x), v.y), v.z), v.w);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2x issue redundancy
|
|
||||||
uvec2 cc = aluChain2(h, alu_iters);
|
|
||||||
if (cc.x != cc.y) {
|
|
||||||
atomicAdd(selfFail, 1u);
|
|
||||||
pushRecord(tid, 1u, cc.x, cc.y);
|
|
||||||
}
|
|
||||||
h = cc.x;
|
|
||||||
|
|
||||||
|
|
||||||
// Write back to memory
|
|
||||||
for (uint j = 0u; j < 8u; ++j)
|
|
||||||
s_scratch[lid + j * 256u] = h + j;
|
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
|
||||||
|
|
||||||
uint t = 0u;
|
|
||||||
for (uint j = 0u; j < 8u; ++j)
|
|
||||||
t = hmix(t, s_scratch[((lid * 37u + 11u) + j * 251u) & 2047u]);
|
|
||||||
h = hmix(h, t);
|
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compare golden samples
|
|
||||||
if (mode == 0u) {
|
|
||||||
expected[tid] = h;
|
|
||||||
} else if (mode == 1u && h != expected[tid]) {
|
|
||||||
pushRecord(tid, 2u, h, expected[tid]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Fused reduction, digest/count reduced to 8 barriers with one pass instead of 2.
|
|
||||||
s_scratch[lid] = h;
|
|
||||||
s_scratch[256u + lid] = count;
|
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
|
||||||
|
|
||||||
for (uint s = 128u; s > 0u; s >>= 1) {
|
|
||||||
if (lid < s) {
|
|
||||||
s_scratch[lid] += s_scratch[lid + s];
|
|
||||||
s_scratch[256u + lid] += s_scratch[256u + lid + s];
|
|
||||||
}
|
|
||||||
memoryBarrierShared();
|
|
||||||
barrier();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Atomic (16 per WGP)
|
|
||||||
if (lid == 0u) {
|
|
||||||
atomicAdd(digest, s_scratch[0]);
|
|
||||||
atomicAdd(mismatches, s_scratch[256u]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,6 @@ extern "C" {
|
|||||||
|
|
||||||
#include "bench.h"
|
#include "bench.h"
|
||||||
#include "cpu_stress.h"
|
#include "cpu_stress.h"
|
||||||
#include "cuda95.h"
|
|
||||||
#include "gpu_bw.h"
|
#include "gpu_bw.h"
|
||||||
#include "gpu_stress.h"
|
#include "gpu_stress.h"
|
||||||
#include "hoc_clk.h"
|
#include "hoc_clk.h"
|
||||||
@@ -437,126 +436,6 @@ class StressTab : public brls::Box {
|
|||||||
brls::Label *statusL, *gflops, *dispatches, *mismatches;
|
brls::Label *statusL, *gflops, *dispatches, *mismatches;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Cuda95Tab : public brls::Box {
|
|
||||||
public:
|
|
||||||
Cuda95Tab() {
|
|
||||||
this->setAxis(brls::Axis::COLUMN);
|
|
||||||
this->setGrow(1.0f);
|
|
||||||
this->setPadding(40.0f, 60.0f, 40.0f, 60.0f);
|
|
||||||
|
|
||||||
auto *profRow = new brls::Box(brls::Axis::ROW);
|
|
||||||
profRow->setMarginBottom(14.0f);
|
|
||||||
auto *pl = new brls::Label();
|
|
||||||
pl->setText("Profile");
|
|
||||||
pl->setGrow(1.0f);
|
|
||||||
profRow->addView(pl);
|
|
||||||
profVal = new brls::Label();
|
|
||||||
profRow->addView(profVal);
|
|
||||||
this->addView(profRow);
|
|
||||||
|
|
||||||
refreshOpts();
|
|
||||||
|
|
||||||
auto *hint = new brls::Label();
|
|
||||||
hint->setText("L / R: profile. A: start / stop.");
|
|
||||||
hint->setFontSize(15.0f);
|
|
||||||
hint->setTextColor(nvgRGB(150, 150, 150));
|
|
||||||
hint->setMarginBottom(18.0f);
|
|
||||||
this->addView(hint);
|
|
||||||
|
|
||||||
toggle = new brls::Button();
|
|
||||||
toggle->setText("Start");
|
|
||||||
toggle->registerClickAction([this](brls::View *) {
|
|
||||||
onToggle();
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
this->addView(toggle);
|
|
||||||
|
|
||||||
this->registerAction("Prev profile", brls::ControllerButton::BUTTON_LB, [this](brls::View *) {
|
|
||||||
cycleProfile(-1);
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
this->registerAction("Next profile", brls::ControllerButton::BUTTON_RB, [this](brls::View *) {
|
|
||||||
cycleProfile(1);
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
statusL = new brls::Label();
|
|
||||||
statusL->setText("Stopped");
|
|
||||||
statusL->setMarginTop(10.0f);
|
|
||||||
statusL->setMarginBottom(8.0f);
|
|
||||||
this->addView(statusL);
|
|
||||||
|
|
||||||
auto *h = new brls::Header();
|
|
||||||
h->setTitle("Info");
|
|
||||||
this->addView(h);
|
|
||||||
rowRate = makeRow(this, "Read rate");
|
|
||||||
rowBatches = makeRow(this, "Batches");
|
|
||||||
rowMismatch = makeRow(this, "Mismatches");
|
|
||||||
}
|
|
||||||
|
|
||||||
~Cuda95Tab() override {
|
|
||||||
if (cuda95_running())
|
|
||||||
cuda95_stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void willDisappear(bool resetState = false) override {
|
|
||||||
if (cuda95_running())
|
|
||||||
cuda95_stop();
|
|
||||||
brls::Box::willDisappear(resetState);
|
|
||||||
}
|
|
||||||
|
|
||||||
void frame(brls::FrameContext *ctx) override {
|
|
||||||
cuda95_status_t st;
|
|
||||||
cuda95_get(&st);
|
|
||||||
if (cuda95_running() || lastRunning) {
|
|
||||||
rowRate->setText(fstr("%.2f GB/s", st.gbps));
|
|
||||||
rowBatches->setText(fstru("%llu", (unsigned long long)st.batches));
|
|
||||||
unsigned long long mm = (unsigned long long)st.detected + (unsigned long long)st.selfFail
|
|
||||||
+ (unsigned long long)st.dataBad + (unsigned long long)st.timeouts;
|
|
||||||
rowMismatch->setText(fstru("%llu", mm));
|
|
||||||
if (cuda95_running())
|
|
||||||
statusL->setText(st.error ? std::string("Error: ") + st.status : std::string(st.status));
|
|
||||||
}
|
|
||||||
syncToggle(cuda95_running() != 0);
|
|
||||||
brls::Box::frame(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void refreshOpts() {
|
|
||||||
char b[64];
|
|
||||||
std::snprintf(b, sizeof b, "%s (%u/%u)", cuda95_profile_name(profile),
|
|
||||||
cuda95_profile_alu(profile), cuda95_profile_gather(profile));
|
|
||||||
profVal->setText(b);
|
|
||||||
}
|
|
||||||
void cycleProfile(int dir) {
|
|
||||||
profile = (profile + dir + CUDA95_NUM_PROFILES) % CUDA95_NUM_PROFILES;
|
|
||||||
refreshOpts();
|
|
||||||
if (cuda95_running())
|
|
||||||
cuda95_set_profile(profile);
|
|
||||||
}
|
|
||||||
void onToggle() {
|
|
||||||
if (cuda95_running()) {
|
|
||||||
cuda95_stop();
|
|
||||||
} else {
|
|
||||||
rowRate->setText("-");
|
|
||||||
rowBatches->setText("-");
|
|
||||||
rowMismatch->setText("-");
|
|
||||||
cuda95_start(profile, 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void syncToggle(bool running) {
|
|
||||||
if (running == lastRunning)
|
|
||||||
return;
|
|
||||||
lastRunning = running;
|
|
||||||
toggle->setText(running ? "Stop" : "Start");
|
|
||||||
if (!running)
|
|
||||||
statusL->setText("Stopped");
|
|
||||||
}
|
|
||||||
int profile = 0;
|
|
||||||
bool lastRunning = false;
|
|
||||||
brls::Label *profVal, *statusL, *rowRate, *rowBatches, *rowMismatch;
|
|
||||||
brls::Button *toggle;
|
|
||||||
};
|
|
||||||
class FurmarkTab : public brls::Box {
|
class FurmarkTab : public brls::Box {
|
||||||
public:
|
public:
|
||||||
FurmarkTab(int which, const char *desc) : which(which) {
|
FurmarkTab(int which, const char *desc) : which(which) {
|
||||||
@@ -970,7 +849,6 @@ class CreditsTab : public brls::Box {
|
|||||||
makeRow(this, "Memtester")->setText("Simon Kirby, Charles Cazabon, KazushiMe & CTCaer");
|
makeRow(this, "Memtester")->setText("Simon Kirby, Charles Cazabon, KazushiMe & CTCaer");
|
||||||
makeRow(this, "FurMark")->setText("StanislavPetrovV & AnxietyTimmy");
|
makeRow(this, "FurMark")->setText("StanislavPetrovV & AnxietyTimmy");
|
||||||
makeRow(this, "GPU Test")->setText("NaGaa95");
|
makeRow(this, "GPU Test")->setText("NaGaa95");
|
||||||
makeRow(this, "CUDA95")->setText("AnxietyTimmy");
|
|
||||||
makeRow(this, "Membench")->setText("Siarhei Siamashka, KazushiMe & Lineon");
|
makeRow(this, "Membench")->setText("Siarhei Siamashka, KazushiMe & Lineon");
|
||||||
makeRow(this, "Stress-ng")->setText("ColinIanKing & Lineon");
|
makeRow(this, "Stress-ng")->setText("ColinIanKing & Lineon");
|
||||||
|
|
||||||
@@ -1066,7 +944,6 @@ class MainActivity : public brls::Activity {
|
|||||||
|
|
||||||
tab->addHeader("GPU");
|
tab->addHeader("GPU");
|
||||||
tab->addTab("GPU Test", [] { return new StressTab(); });
|
tab->addTab("GPU Test", [] { return new StressTab(); });
|
||||||
tab->addTab("CUDA95", [] { return new Cuda95Tab(); });
|
|
||||||
tab->addTab("Furmark", [] { return new FurmarkTab(0, "FurMark for Switch (48 step)"); });
|
tab->addTab("Furmark", [] { return new FurmarkTab(0, "FurMark for Switch (48 step)"); });
|
||||||
tab->addTab("GPU Path Trace", [] { return new FurmarkTab(2, "GPU Path Tracer"); });
|
tab->addTab("GPU Path Trace", [] { return new FurmarkTab(2, "GPU Path Tracer"); });
|
||||||
|
|
||||||
@@ -1111,8 +988,6 @@ int main(int argc, char *argv[]) {
|
|||||||
mt_cpu_stop();
|
mt_cpu_stop();
|
||||||
if (cpu_stress_running())
|
if (cpu_stress_running())
|
||||||
cpu_stress_stop();
|
cpu_stress_stop();
|
||||||
if (cuda95_running())
|
|
||||||
cuda95_stop();
|
|
||||||
|
|
||||||
_exit(EXIT_SUCCESS);
|
_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
build/
|
||||||
|
|
||||||
|
*.ovl
|
||||||
|
|
||||||
|
*.elf
|
||||||
|
|
||||||
|
*.nacp
|
||||||
|
|
||||||
|
*.nro
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-CSn
|
||||||
|
/home/sould/Documents/GitHub/Horizon-OC/Source/Horizon-OC-Monitor/Horizon-OC-Monitor.elf
|
||||||
@@ -0,0 +1,339 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License.
|
||||||
@@ -0,0 +1,243 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
.SUFFIXES:
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
ifeq ($(strip $(DEVKITPRO)),)
|
||||||
|
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
|
||||||
|
endif
|
||||||
|
|
||||||
|
TOPDIR ?= $(CURDIR)
|
||||||
|
include $(DEVKITPRO)/libnx/switch_rules
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# TARGET is the name of the output
|
||||||
|
# BUILD is the directory where object files & intermediate files will be placed
|
||||||
|
# SOURCES is a list of directories containing source code
|
||||||
|
# DATA is a list of directories containing data files
|
||||||
|
# INCLUDES is a list of directories containing header files
|
||||||
|
# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional)
|
||||||
|
#
|
||||||
|
# NO_ICON: if set to anything, do not use icon.
|
||||||
|
# NO_NACP: if set to anything, no .nacp file is generated.
|
||||||
|
# APP_TITLE is the name of the app stored in the .nacp file (Optional)
|
||||||
|
# APP_AUTHOR is the author of the app stored in the .nacp file (Optional)
|
||||||
|
# APP_VERSION is the version of the app stored in the .nacp file (Optional)
|
||||||
|
# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional)
|
||||||
|
# ICON is the filename of the icon (.jpg), relative to the project folder.
|
||||||
|
# If not set, it attempts to use one of the following (in this order):
|
||||||
|
# - <Project name>.jpg
|
||||||
|
# - icon.jpg
|
||||||
|
# - <libnx folder>/default_icon.jpg
|
||||||
|
#
|
||||||
|
# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder.
|
||||||
|
# If not set, it attempts to use one of the following (in this order):
|
||||||
|
# - <Project name>.json
|
||||||
|
# - config.json
|
||||||
|
# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead
|
||||||
|
# of a homebrew executable (.nro). This is intended to be used for sysmodules.
|
||||||
|
# NACP building is skipped as well.
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
APP_TITLE := Horizon OC Monitor
|
||||||
|
APP_VERSION := 1.3.2+r4-hoc-r4
|
||||||
|
TARGET := $(notdir $(CURDIR))
|
||||||
|
BUILD := build
|
||||||
|
SOURCES := source
|
||||||
|
INCLUDES := include lib/Atmosphere-libs/libstratosphere/source/dmnt lib/Atmosphere-libs/libstratosphere/source ../hoc-clk/common/include/
|
||||||
|
NO_ICON := 1
|
||||||
|
#ROMFS := romfs
|
||||||
|
|
||||||
|
# This location should reflect where you place the libultrahand directory (lib can vary between projects).
|
||||||
|
include ${TOPDIR}/lib/libultrahand/ultrahand.mk
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# options for code generation
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ARCH := -march=armv8-a+simd+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE
|
||||||
|
|
||||||
|
CFLAGS := -g -Wall -Wno-address-of-packed-member -O3 -ffunction-sections -ffast-math -flto -fomit-frame-pointer \
|
||||||
|
-fuse-linker-plugin -finline-small-functions \
|
||||||
|
-fno-strict-aliasing -frename-registers -falign-functions=16 \
|
||||||
|
$(ARCH) $(DEFINES)
|
||||||
|
|
||||||
|
# For compiling Ultrahand Overlay only
|
||||||
|
IS_STATUS_MONITOR_DIRECTIVE := 1
|
||||||
|
CFLAGS += -DIS_STATUS_MONITOR_DIRECTIVE=$(IS_STATUS_MONITOR_DIRECTIVE)
|
||||||
|
|
||||||
|
# Enable appearance overriding
|
||||||
|
export MSYS2_ARG_CONV_EXCL := -DUI_OVERRIDE_PATH
|
||||||
|
UI_OVERRIDE_PATH := /config/status-monitor/
|
||||||
|
CFLAGS += -DUI_OVERRIDE_PATH="\"$(UI_OVERRIDE_PATH)\""
|
||||||
|
|
||||||
|
|
||||||
|
CFLAGS += $(INCLUDE) -D__SWITCH__ -DAPP_VERSION="\"$(APP_VERSION)\""
|
||||||
|
|
||||||
|
CXXFLAGS := $(CFLAGS) -std=c++26 -Wno-dangling-else -fno-unwind-tables -fno-asynchronous-unwind-tables
|
||||||
|
|
||||||
|
ASFLAGS := -g $(ARCH)
|
||||||
|
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||||
|
|
||||||
|
LIBS := -lnx
|
||||||
|
|
||||||
|
CXXFLAGS += -fno-exceptions -ffunction-sections -fdata-sections -fno-rtti
|
||||||
|
LDFLAGS += -Wl,--gc-sections -Wl,--as-needed
|
||||||
|
|
||||||
|
|
||||||
|
# For Ensuring Parallel LTRANS Jobs w/ GCC, make -j6
|
||||||
|
CXXFLAGS += -flto -fuse-linker-plugin -flto=6
|
||||||
|
LDFLAGS += -flto=6
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# list of directories containing libraries, this must be the top level containing
|
||||||
|
# include and lib
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
LIBDIRS := $(PORTLIBS) $(LIBNX)
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
|
# rules for different file extensions
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||||
|
export TOPDIR := $(CURDIR)
|
||||||
|
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
|
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||||
|
|
||||||
|
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||||
|
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||||
|
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||||
|
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# use CXX for linking C++ projects, CC for standard C
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CC)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
export LD := $(CXX)
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
||||||
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
||||||
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||||
|
|
||||||
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||||
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
|
-I$(CURDIR)/$(BUILD)
|
||||||
|
|
||||||
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||||
|
|
||||||
|
ifeq ($(strip $(CONFIG_JSON)),)
|
||||||
|
jsons := $(wildcard *.json)
|
||||||
|
ifneq (,$(findstring $(TARGET).json,$(jsons)))
|
||||||
|
export APP_JSON := $(TOPDIR)/$(TARGET).json
|
||||||
|
else
|
||||||
|
ifneq (,$(findstring config.json,$(jsons)))
|
||||||
|
export APP_JSON := $(TOPDIR)/config.json
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
export APP_JSON := $(TOPDIR)/$(CONFIG_JSON)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(ICON)),)
|
||||||
|
icons := $(wildcard *.jpg)
|
||||||
|
ifneq (,$(findstring $(TARGET).jpg,$(icons)))
|
||||||
|
export APP_ICON := $(TOPDIR)/$(TARGET).jpg
|
||||||
|
else
|
||||||
|
ifneq (,$(findstring icon.jpg,$(icons)))
|
||||||
|
export APP_ICON := $(TOPDIR)/icon.jpg
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
export APP_ICON := $(TOPDIR)/$(ICON)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(NO_ICON)),)
|
||||||
|
export NROFLAGS += --icon=$(APP_ICON)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(NO_NACP)),)
|
||||||
|
export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(APP_TITLEID),)
|
||||||
|
export NACPFLAGS += --titleid=$(APP_TITLEID)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(ROMFS),)
|
||||||
|
export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: $(BUILD) clean all
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(BUILD)
|
||||||
|
|
||||||
|
|
||||||
|
$(BUILD):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||||
|
@rm -rf out/
|
||||||
|
@mkdir -p out/switch/.overlays/
|
||||||
|
@cp -a $(CURDIR)/config out/
|
||||||
|
@cp $(CURDIR)/$(TARGET).ovl out/switch/.overlays/$(TARGET).ovl
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
clean:
|
||||||
|
@echo "Cleanning ... $(TARGET)"
|
||||||
|
@rm -fr $(BUILD) $(TARGET).ovl $(TARGET).nro $(TARGET).nacp $(TARGET).elf
|
||||||
|
@rm -rf out/
|
||||||
|
@rm -f $(TARGET).zip
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
dist: all
|
||||||
|
@echo making dist ...
|
||||||
|
@rm -f $(TARGET).zip
|
||||||
|
@cd out; zip -r ../$(TARGET).zip ./*; cd ../
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
.PHONY: all
|
||||||
|
|
||||||
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all : $(OUTPUT).ovl
|
||||||
|
|
||||||
|
$(OUTPUT).ovl : $(OUTPUT).elf $(OUTPUT).nacp
|
||||||
|
@elf2nro $< $@ $(NROFLAGS)
|
||||||
|
@echo "built ... $(notdir $(OUTPUT).ovl)"
|
||||||
|
@printf 'ULTR' >> $@
|
||||||
|
@printf "Ultrahand signature has been added.\n"
|
||||||
|
|
||||||
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
$(OFILES_SRC) : $(HFILES_BIN)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# you need a rule like this for each extension you use as binary data
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o %_bin.h : %.bin
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
Thanks to NaGa for Status Monitor Pro! <br> <br>
|
||||||
|
|
||||||
|
**Horizon-OC-Monitor is deprecated.** If you want to compile it anyway, create a `lib` folder and clone Atmosphere-libs and libultrahand into it: <br> <br>
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir lib
|
||||||
|
git clone https://github.com/Atmosphere-NX/Atmosphere-libs lib/Atmosphere-libs
|
||||||
|
git clone https://github.com/ppkantorski/libultrahand lib/libultrahand
|
||||||
|
```
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
[status-monitor]
|
||||||
|
battery_avg_iir_filter=false
|
||||||
|
battery_time_left_refreshrate=60
|
||||||
|
average_gpu_load=false
|
||||||
|
use_old_fps_average=false
|
||||||
|
|
||||||
|
[full]
|
||||||
|
refresh_rate=1
|
||||||
|
layer_width_align=left
|
||||||
|
show_real_freqs=true
|
||||||
|
show_deltas=true
|
||||||
|
show_target_freqs=true
|
||||||
|
show_fps=true
|
||||||
|
show_res=true
|
||||||
|
show_read_speed=true
|
||||||
|
use_dynamic_colors=true
|
||||||
|
disable_screenshots=false
|
||||||
|
separator_color=#888F
|
||||||
|
cat_color_1=#8FFF
|
||||||
|
cat_color_2=#8CFF
|
||||||
|
text_color=#FFFF
|
||||||
|
|
||||||
|
[mini]
|
||||||
|
refresh_rate=1
|
||||||
|
handheld_font_size=15
|
||||||
|
docked_font_size=15
|
||||||
|
spacing=8
|
||||||
|
real_freqs=true
|
||||||
|
real_volts=true
|
||||||
|
show_full_cpu=false
|
||||||
|
show_full_res=true
|
||||||
|
show_fan_percentage=true
|
||||||
|
show_soc_voltage=false
|
||||||
|
use_dynamic_colors=true
|
||||||
|
show_vddq=false
|
||||||
|
show_vdd2=true
|
||||||
|
decimal_vdd2=false
|
||||||
|
show_dtc=true
|
||||||
|
use_dtc_symbol=true
|
||||||
|
dtc_format=%m-%d-%Y%H:%M:%S
|
||||||
|
show=DTC+BAT+CPU+GPU+RAM+TMP+FPS+RES
|
||||||
|
replace_MB_with_RAM_load=true
|
||||||
|
show_RAM_load_CPU_GPU=false
|
||||||
|
invert_battery_display=true
|
||||||
|
disable_screenshots=false
|
||||||
|
sleep_exit=false
|
||||||
|
frame_offset_x=10
|
||||||
|
frame_offset_y=10
|
||||||
|
frame_padding=10
|
||||||
|
background_color=#0009
|
||||||
|
focus_background_color=#000F
|
||||||
|
separator_color=#888F
|
||||||
|
cat_color=#2DFF
|
||||||
|
text_color=#FFFF
|
||||||
|
|
||||||
|
[micro]
|
||||||
|
refresh_rate=1
|
||||||
|
layer_height_align=top
|
||||||
|
handheld_font_size=15
|
||||||
|
docked_font_size=15
|
||||||
|
text_align=center
|
||||||
|
real_freqs=true
|
||||||
|
real_volts=true
|
||||||
|
show_full_cpu=false
|
||||||
|
show_full_res=false
|
||||||
|
show_soc_voltage=true
|
||||||
|
use_dynamic_colors=true
|
||||||
|
show_vddq=false
|
||||||
|
show_vdd2=true
|
||||||
|
decimal_vdd2=false
|
||||||
|
show_dtc=true
|
||||||
|
use_dtc_symbol=true
|
||||||
|
dtc_format=%H:%M:%S
|
||||||
|
show=FPS+CPU+GPU+RAM+SOC+BAT+DTC
|
||||||
|
replace_GB_with_RAM_load=true
|
||||||
|
invert_battery_display=false
|
||||||
|
disable_screenshots=false
|
||||||
|
sleep_exit=false
|
||||||
|
background_color=#0009
|
||||||
|
separator_color=#888F
|
||||||
|
cat_color=#2DFF
|
||||||
|
text_color=#FFFF
|
||||||
|
|
||||||
|
[fps-counter]
|
||||||
|
refresh_rate=30
|
||||||
|
handheld_font_size=40
|
||||||
|
docked_font_size=40
|
||||||
|
use_integer_counter=false
|
||||||
|
disable_screenshots=false
|
||||||
|
frame_offset_x=10
|
||||||
|
frame_offset_y=10
|
||||||
|
frame_padding=10
|
||||||
|
background_color=#0009
|
||||||
|
focus_background_color=#000F
|
||||||
|
text_color=#8CFF
|
||||||
|
|
||||||
|
[fps-graph]
|
||||||
|
refresh_rate=30
|
||||||
|
show_info=false
|
||||||
|
use_dynamic_colors=true
|
||||||
|
disable_screenshots=false
|
||||||
|
frame_offset_x=10
|
||||||
|
frame_offset_y=10
|
||||||
|
frame_padding=10
|
||||||
|
background_color=#0009
|
||||||
|
focus_background_color=#000F
|
||||||
|
fps_counter_color=#888C
|
||||||
|
border_color=#2DFF
|
||||||
|
dashed_line_color=#8888
|
||||||
|
main_line_color=#FFFF
|
||||||
|
rounded_line_color=#F0FF
|
||||||
|
perfect_line_color=#0C0F
|
||||||
|
max_fps_text_color=#FFFF
|
||||||
|
min_fps_text_color=#FFFF
|
||||||
|
text_color=#FFFF
|
||||||
|
cat_color=#0F0F
|
||||||
|
|
||||||
|
[game_resolutions]
|
||||||
|
refresh_rate=10
|
||||||
|
disable_screenshots=false
|
||||||
|
frame_offset_x=10
|
||||||
|
frame_offset_y=10
|
||||||
|
frame_padding=10
|
||||||
|
background_color=#0009
|
||||||
|
focus_background_color=#000F
|
||||||
|
cat_color=#8FFF
|
||||||
|
text_color=#FFFF
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
# Configuration file
|
||||||
|
|
||||||
|
Configuration file is in `sdmc:/config/status-monitor/`. By default it's named `config.ini.template`. To be detected by overlay it must be renamed to `config.ini`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Explanation of what each setting does.<br>
|
||||||
|
Colors are provided in RGBA4444 format, which means that each character represents different channel: red, green, blue, alpha.
|
||||||
|
|
||||||
|
> [status-monitor]
|
||||||
|
|
||||||
|
| Key | Explanation | Possible values | Default Value |
|
||||||
|
|-----|-------------|-----------------|---------------|
|
||||||
|
| `key_combo` | Buttons combination that allows exiting Full, Mini, Micro, FPS Graph and FPS Counter modes; max 4 buttons, otherwise next buttons will be ignored. Combine different buttons with `+` | `A`, `B`, `X`, `Y`, `L`, `R`, `ZL`, `ZR`, `PLUS`, `MINUS`, `DUP`, `DDOWN`, `DLEFT`, `DRIGHT`, `SL`, `SR`, `LSTICK`, `RSTICK`, `UP`, `DOWN`, `LEFT`, `RIGHT` | `L+DDOWN+RSTICK` |
|
||||||
|
| `battery_avg_iir_filter` | Read voltage + current averages directly from fuel gauge, that uses infinite impulse response filter | `true`, `false` | `false` |
|
||||||
|
| `battery_time_left_refreshrate` | How many seconds must pass to refresh Battery Remaining Time | from `1` to `60` | `60` |
|
||||||
|
| `average_gpu_load` | Average 5 last GPU load readings. Because GPU load by design shows only load for last 1/60s, this option allows for more accurate gpu load readings at the cost of slight bump in CPU Core #3 usage (from 2 to 4 percentage points depending on CPU clock). | `true`, `false` | `false` |
|
||||||
|
| `font_cache` | Allow caching generated glyphs for better performance. Cache is cleaned up when moving between modes. | `true`, `false` | `true` |
|
||||||
|
|
||||||
|
|
||||||
|
> [full]
|
||||||
|
|
||||||
|
| Key | Explanation | Possible values | Default Value |
|
||||||
|
|-----|-------------|-----------------|---------------|
|
||||||
|
| `refresh_rate` | How often per second this mode should be refreshed. Higher value means higher CPU Core #3 usage, that's why it is recommended to stay at 1. | From `1` to `60` | `1` |
|
||||||
|
| `layer_width_align` | On which side of the screen X axis you want this mode | `left`, `right` | `left` |
|
||||||
|
| `show_real_freqs` | This works only if you have sys-clk 2.0.0_rc4+ installed. Show real frequencies for CPU, GPU and RAM | `false`, `true` | `true` |
|
||||||
|
| `show_deltas` | This works only if you have sys-clk 2.0.0_rc4+ installed. Show difference for CPU, GPU and RAM between target frequencies and real frequencies. They are not showed if both keys `show_real_freqs` and `show_target_freqs` are set to `false` | `false`, `true` | `true` |
|
||||||
|
| `show_target_freqs` | Show target frequencies for CPU, GPU and RAM | `false`, `true` | `true` |
|
||||||
|
| `show_fps` | Show game's FPS and PFPS | `false`, `true` | `true` |
|
||||||
|
| `show_res` | Show game's 2 best candidates for internal resolution, it won't show when game is not using NVN | `false`, `true` | `true` |
|
||||||
|
| `show_read_speed` | Show game's read speed per second | `false`, `true` | `true` |
|
||||||
|
|
||||||
|
> [mini]
|
||||||
|
|
||||||
|
| Key | Explanation | Possible values | Default Value |
|
||||||
|
|-----|-------------|-----------------|---------------|
|
||||||
|
| `refresh_rate` | How often per second this mode should be refreshed. Higher value means higher CPU Core #3 usage, that's why it is recommended to stay at 1. | From `1` to `60` | `1` |
|
||||||
|
| `layer_width_align` | On which side of the screen X axis you want this mode | `left`, `center`, `right` | `left` |
|
||||||
|
| `layer_height_align` | On which side of the screen Y axis you want this mode | `top`, `center`, `bottom` | `top` |
|
||||||
|
| `handheld_font_size` | How big should be rendered text in handheld mode | From `8` to `22` | `15` |
|
||||||
|
| `docked_font_size` | How big should be rendered text in docked mode | From `8` to `22` | `15` |
|
||||||
|
| `real_freqs` | This works only if you have sys-clk 2.0.0_rc4+ installed. It shows real frequencies for CPU, GPU and RAM instead of target frequencies | `true`, `false` | `false` |
|
||||||
|
| `show` | Which data should be rendered. Connect different stats with `+` in any order. | `CPU`, `GPU`, `RAM`, `TEMP`, `FAN`, `DRAW`, `FPS`, `RES`, `READ` | `CPU+GPU+RAM+TEMP+FAN+DRAW+FPS+RES+READ` |
|
||||||
|
| `replace_MB_with_RAM_load` | This works only if you have sys-clk 2.0.0_rc4+ installed. Instead of RAM total usage it shows RAM load. | `true`, `false` | `true` |
|
||||||
|
| `background_color` | Background color in RGBA4444 format | From `#0000` to `#FFFF` | `#1117` |
|
||||||
|
| `cat_color` | Category text color (left side) in RGBA4444 format | From `#0000` to `#FFFF` | `#FFFF` |
|
||||||
|
| `text_color` | Stats text color (right side) in RGBA4444 format | From `#0000` to `#FFFF` | `#FFFF` |
|
||||||
|
|
||||||
|
> [micro]
|
||||||
|
|
||||||
|
| Key | Explanation | Possible values | Default Value |
|
||||||
|
|-----|-------------|-----------------|---------------|
|
||||||
|
| `refresh_rate` | How often per second this mode should be refreshed. Higher value means higher CPU Core #3 usage, that's why it is recommended to stay at 1. | From `1` to `60` | `1` |
|
||||||
|
| `layer_height_align` | On which side of the screen Y axis you want this mode | `top`, `bottom` | `top` |
|
||||||
|
| `handheld_font_size` | How big should be rendered text in handheld mode | From `8` to `18` | `18` |
|
||||||
|
| `docked_font_size` | How big should be rendered text in docked mode | From `8` to `18` | `18` |
|
||||||
|
| `text_align` | How shown text should be aligned | `left`, `center`, `right`| `center` |
|
||||||
|
| `real_freqs` | This works only if you have sys-clk 2.0.0_rc4+ installed. It shows real frequencies for CPU, GPU and RAM instead of target frequencies | `true`, `false` | `false` |
|
||||||
|
| `show` | Which data should be rendered. Connect different stats with `+` in any order. | `CPU`, `GPU`, `RAM`, `BRD`, `FAN`, `FPS` | `CPU+GPU+RAM+BRD+FAN+FPS` |
|
||||||
|
| `replace_GB_with_RAM_load` | This works only if you have sys-clk 2.0.0_rc4+ installed. Instead of RAM total usage it shows RAM load. | `true`, `false` | `true` |
|
||||||
|
| `background_color` | Background color in RGBA4444 format | From `#0000` to `#FFFF` | `#1117` |
|
||||||
|
| `cat_color` | Category text color (left side) in RGBA4444 format | From `#0000` to `#FFFF` | `#FCCF` |
|
||||||
|
| `text_color` | Stats text color (right side) in RGBA4444 format | From `#0000` to `#FFFF` | `#FFFF` |
|
||||||
|
|
||||||
|
|
||||||
|
> [fps-counter]
|
||||||
|
|
||||||
|
| Key | Explanation | Possible values | Default Value |
|
||||||
|
|-----|-------------|-----------------|---------------|
|
||||||
|
| `layer_width_align` | On which side of the screen X axis you want this mode | `left`, `center`, `right` | `left` |
|
||||||
|
| `layer_height_align` | On which side of the screen Y axis you want this mode | `top`, `center`, `bottom` | `top` |
|
||||||
|
| `handheld_font_size` | How big should be rendered text in handheld mode | From `8` to `150` | `40` |
|
||||||
|
| `docked_font_size` | How big should be rendered text in docked mode | From `8` to `150` | `40` |
|
||||||
|
| `background_color` | Background color in RGBA4444 format | From `#0000` to `#FFFF` | `#1117` |
|
||||||
|
| `text_color` | Text color in RGBA4444 format | From `#0000` to `#FFFF` | `#FFFF` |
|
||||||
|
|
||||||
|
> [fps-graph]
|
||||||
|
|
||||||
|
| Key | Explanation | Possible values | Default Value |
|
||||||
|
|-----|-------------|-----------------|---------------|
|
||||||
|
| `layer_width_align` | On which side of the screen X axis you want this mode | `left`, `center`, `right` | `left` |
|
||||||
|
| `layer_height_align` | On which side of the screen Y axis you want this mode | `top`, `center`, `bottom` | `top` |
|
||||||
|
| `max_fps_text_color` | Text color of "60" in RGBA4444 format | From `#0000` to `#FFFF` | `#FFFF` |
|
||||||
|
| `min_fps_text_color` | Text color of "0" in RGBA4444 format | From `#0000` to `#FFFF` | `#FFFF` |
|
||||||
|
| `background_color` | Background color in RGBA4444 format | From `#0000` to `#FFFF` | `#1117` |
|
||||||
|
| `fps_counter_color` | Text color of average FPS printed behind graph in RGBA4444 format | From `#0000` to `#FFFF` | `#4444` |
|
||||||
|
| `border_color` | Color of rectangle in RGBA4444 format | From `#0000` to `#FFFF` | `#F77F` |
|
||||||
|
| `dashed_line_color` | Color of dashed line at the center of rectangle in RGBA4444 format | From `#0000` to `#FFFF` | `#8888` |
|
||||||
|
| `main_line_color` | Color of line representing FPS value on graph in RGBA4444 format | From `#0000` to `#FFFF` | `#FFFF` |
|
||||||
|
| `rounded_line_color` | Color of line representing FPS value on graph if it's divisble by 10 in RGBA4444 format | From `#0000` to `#FFFF` | `#F0FF` |
|
||||||
|
| `perfect_line_color` | Color of line representing FPS value on graph if it's divisble by 30 in RGBA4444 format | From `#0000` to `#FFFF` | `#0C0F` |
|
||||||
|
|
||||||
|
> [game_resolutions]
|
||||||
|
|
||||||
|
| Key | Explanation | Possible values | Default Value |
|
||||||
|
|-----|-------------|-----------------|---------------|
|
||||||
|
| `refresh_rate` | How often per second this mode should be refreshed. Higher value means higher CPU Core #3 usage, that's why it is recommended to stay at 1. | From `1` to `60` | `10` |
|
||||||
|
| `layer_width_align` | On which side of the screen X axis you want this mode | `left`, `center`, `right` | `left` |
|
||||||
|
| `layer_height_align` | On which side of the screen Y axis you want this mode | `top`, `center`, `bottom` | `top` |
|
||||||
|
| `background_color` | Background color in RGBA4444 format | From `#0000` to `#FFFF` | `#1117` |
|
||||||
|
| `cat_color` | Category text color (left side) in RGBA4444 format | From `#0000` to `#FFFF` | `#FFFF` |
|
||||||
|
| `text_color` | Stats text color (right side) in RGBA4444 format | From `#0000` to `#FFFF` | `#FFFF` |
|
||||||
@@ -0,0 +1,252 @@
|
|||||||
|
# Modes
|
||||||
|
|
||||||
|
Horizon OC Monitor Overlay from 1.0.0 release contains five modes to choose from Main Menu.<br>
|
||||||
|
For additional functions you need to install:
|
||||||
|
- [SaltyNX](https://github.com/masagrator/SaltyNX/releases)
|
||||||
|
- [sys-clk 2.0.0_rc4+](https://github.com/retronx-team/sys-clk/releases) (using closed source forks of sys-clk can result in retrieving wrong real clockrates and ram load)
|
||||||
|
|
||||||
|
# Full
|
||||||
|
|
||||||
|
This mode you can know from older releases of Horizon OC Monitor. It contains all informations properly described and supported with high precision.
|
||||||
|
|
||||||
|
- CPU Usage
|
||||||
|
- Real Frequency: `%.1f` = Real clockrate of all CPU cores in MHz (This shows only when sys-clk 2.0.0_4c+ is installed)
|
||||||
|
- Target Frequency: `%.1f` = Target clockrate of all CPU cores in MHz
|
||||||
|
- Core #0-#3: `%.2f` = Load of CPU Cores calculated from IdleTickCount to percent value
|
||||||
|
|
||||||
|
- GPU Usage
|
||||||
|
- Real Frequency: `%.1f` = Real clockrate of GPU in MHz (This shows only when sys-clk 2.0.0_rc4+ is installed)
|
||||||
|
- Target Frequency: `%.1f` = Target clockrate of GPU in MHz
|
||||||
|
- Load: `%.1f` = GPU Load provided by PMU in percent
|
||||||
|
|
||||||
|
- RAM Usage
|
||||||
|
- Real Frequency: `%.1f` = Real clockrate of EMC in MHz (This shows only when sys-clk 2.0.0_rc4+ is installed)
|
||||||
|
- Target Frequency: `%.1f` = Target clockrate of EMC in MHz
|
||||||
|
- Load: `%.1f` (CPU `%.1f` | GPU `%.1f`) = RAM Load in % (Which part of that are CPU and GPU (with other hardware, but their impact on GPU readings is negligible))
|
||||||
|
- `%s`: `%.2f`/`%.2f` = %s memory used/%s memory available in MB (not working with FW <5.0.0)
|
||||||
|
|
||||||
|
- Board
|
||||||
|
- Battery Power Flow: `%+.2f`[h:mm] = How much power in watts is discharged from or charged to the battery [time left before shutdown]
|
||||||
|
- Temperatures: SoC: `%.1f` / PCB: `%.1f` / Skin: `%.1f` = SoC / PCB / Skin temperature in Celsius degrees (Explanation provided at the end of file)
|
||||||
|
- Fan Rotation Level: `%.1f` = Fan rotation level in percent
|
||||||
|
|
||||||
|
|
||||||
|
```Optional (shows only when SaltyNX is installed and game is running)```
|
||||||
|
|
||||||
|
| Category | Format | Explanation |
|
||||||
|
|----------|-------------------|--------------------------------------------------------------------------|
|
||||||
|
| PFPS | %u | Pushed Frames Per Second - how many frames were displayed in last second |
|
||||||
|
| FPS | %.2f | Frames Per Second - value calculated by averaging frametime |
|
||||||
|
| Resolutions | %dx%d \|\| %dx%d | Two the most promising candidates for internal game resolution `(^1)` |
|
||||||
|
| Read speed | %.2f MiB/s | Show game read speed in the last second |
|
||||||
|
|
||||||
|
- ^1 - read more informations in explanation for "Game Resolutions" menu
|
||||||
|
|
||||||
|
# Mini
|
||||||
|
|
||||||
|
Contains most of supported informations with lower precision. You can use touch screen to change its position temporarily.
|
||||||
|
|
||||||
|
| Category | Format | Explanation |
|
||||||
|
|----------|---------------------------------------------------|---------------------------------------------------------------------------|
|
||||||
|
| CPU | [%.0f,%.0f,%.0f,%.0f]@%.1f | Core #0 usage, Core #1 usage, Core #2 usage, Core #3 usage@CPU Target/Real frequency`(^1)` |
|
||||||
|
| GPU | %.1f@%.1f | Load@GPU Target/Real Frequency`(^1)` |
|
||||||
|
| RAM | %.0f/%.0f@%.1f<br>`or`<br>%.1f(%.1f \| %.1f)@%.1f | Total RAM used/Total RAM available in MB@EMC Target/Real frequency `or` RAM load (CPU \| GPU)@EMC Target frequency `(^1)` |
|
||||||
|
| TEMP | %2.1f/%2.1f/%2.1f | SoC temperature/PCB temperature/Skin temperature `(^2)` |
|
||||||
|
| FAN | %2.1f | Fan rotation level |
|
||||||
|
| DRAW | %+.2f[h:mm] | How much power in watts is discharged from or charged to the battery [Time left before shutdown] |
|
||||||
|
| RES | %dx%d \|\| %dx%d | Two the most promising candidates for internal game resolution `(^3)` |
|
||||||
|
| READ | %.2f MiB/s | Show game read speed in the last second |
|
||||||
|
|
||||||
|
- ^1 - Real Frequency + RAM Load available only with sys-clk 2.0.0_rc4+
|
||||||
|
- ^2 - Explanation provided at the end of file
|
||||||
|
- ^3 - read more informations in explanation for "Game Resolutions" menu
|
||||||
|
|
||||||
|
```Optional```
|
||||||
|
|
||||||
|
> shows only when SaltyNX is installed and game is running
|
||||||
|
>
|
||||||
|
| Category | Format | Explanation |
|
||||||
|
|----------|-------------------|--------------------------------------------------------------------------|
|
||||||
|
| FPS | %.2f | Frames Per Second |
|
||||||
|
|
||||||
|
# Micro
|
||||||
|
|
||||||
|
Contains most of supported informations with lower precision in one line.
|
||||||
|
|
||||||
|
| Category | Format | Explanation |
|
||||||
|
|----------|------------------------------------------------------------|---------------------------------------------------------------------------|
|
||||||
|
| CPU | [%.0f,%.0f,%.0f,%.0f]%s%.1f | [Core #0 usage, Core #1 usage, Core #2 usage, Core #3 usage] `(^1)` CPU Target/Real Frequency `(^3)` |
|
||||||
|
| GPU | %.1f%s%.1f | Load (^1) GPU Target/Real Frequency |
|
||||||
|
| RAM | %.1f/%.1f%s%.1f `or` %.1f%s%.1f | Total RAM used/Total RAM available in GB `(^1)` EMC Target frequency `or` RAM Load in % `(^1)` EMC Target frequency |
|
||||||
|
| BRD | %2.1f/%2.1f/%2.1f@+.1f[h:mm] | SoC temperature/PCB temperature/Skin temperature(^2)/Battery Power Flow[Time left before shutdown] |
|
||||||
|
| FAN | %2.1f | Fan rotation level |
|
||||||
|
|
||||||
|
- ^1 - by default it's `@`, but if you have sys-clk 2.0.0_rc4+ installed, this changes depending on difference between real clocks and targeted clocks. <br>
|
||||||
|
- `△` - real clocks are higher by at least 20 MHz than expected
|
||||||
|
- `▽` - real clocks are lower by at least 20 MHz than expected
|
||||||
|
- `≠` - real clocks are lower by at least 50 MHz than expected (If this shows constantly for longer than few seconds, this is a sign of throttling, usually caused by bad overclocking configuration)
|
||||||
|
- ^2 - Explanation provided at the end of file
|
||||||
|
- ^3 - Real frequencies + RAM Load available only with sys-clk 2.0.0_rc4+
|
||||||
|
|
||||||
|
```Optional```
|
||||||
|
|
||||||
|
> shows only when SaltyNX is installed and game is running
|
||||||
|
|
||||||
|
| Category | Format | Explanation |
|
||||||
|
|----------|--------------------|--------------------------------------------------------------------------|
|
||||||
|
| FPS | %.1f | Frames Per Second |
|
||||||
|
|
||||||
|
|
||||||
|
# FPS
|
||||||
|
|
||||||
|
> Counter
|
||||||
|
|
||||||
|
It shows only FPS value in 31Hz + vsync signal. <br>
|
||||||
|
If game is not launched, it will show always `n/d` aka `no data`.<br>
|
||||||
|
|
||||||
|
Mode available only with SaltyNX installed. You can use touch screen to change its position temporarily.
|
||||||
|
|
||||||
|
> Graph
|
||||||
|
|
||||||
|
It shows average FPS graph in 31Hz + vsync signal. In background of graph you can see rendered actual average FPS.<br>
|
||||||
|
If game is not launched, graph will be empty.<br>
|
||||||
|
If game is not rendering any new frame, graph is not updated.
|
||||||
|
|
||||||
|
If line is within rounding error of graph line, it's colored. Average FPS must be between -0.05 and +0.04 of graph line target FPS. So for 30 FPS it's between 29.95 - 30.04 FPS. For 43 FPS it's 42.95 - 43.04 FPS.
|
||||||
|
If it's in display refresh rate or half of it rounding error range, it's green. Any other FPS graph target is purple.
|
||||||
|
|
||||||
|
Colors can be changed in config file.
|
||||||
|
|
||||||
|
Mode available only with SaltyNX installed. You can use touch screen to change its position temporarily.
|
||||||
|
|
||||||
|
# Other
|
||||||
|
|
||||||
|
> Battery
|
||||||
|
|
||||||
|
- Battery Actual Capacity: `%d` = Battery Designed Capacity multiplied by Battery Age in mAh
|
||||||
|
- Battery Designed Capacity: `%d` = Battery capacity targeted by manufacturer in mAh
|
||||||
|
- Battery Temperature: `%.1f` = Battery temperature in Celsius
|
||||||
|
- Battery Raw Charge: `%.1f` = Raw battery charged capacity in percent
|
||||||
|
- Battery Age: `%.1f` = How much of designed capacity was charged last time battery was charged completely in percent
|
||||||
|
- Battery Voltage: `%.0f` = Battery average voltage in mV (time period: 5s, or with `battery_avg_iir_filter` enabled: 45s)
|
||||||
|
- Battery Current Flow: `%+.0f` = Battery average current flow in mA (time period: 5s, or with `battery_avg_iir_filter` enabled: 11.25s)
|
||||||
|
- Battery Power Flow: `%+.3f` = Battery average power flow in W calculated from Battery Voltage and Battery Current Flow
|
||||||
|
- Battery Remaining Time: h:mm - How much time is left before shutdown
|
||||||
|
|
||||||
|
Shows only if charger is connected:
|
||||||
|
| Category | Format | Explanation |
|
||||||
|
|---------------------------|--------------|----------------------------------------------------------------------------------|
|
||||||
|
| Charger Type | %u | Connected charger type, more in Battery.hpp "BatteryChargeInfoFieldsChargerType" |
|
||||||
|
| Charger Max Voltage | %u | Charger and external device voltage limit in mV |
|
||||||
|
| Charger Max Current | %u | Charger and external device current limit in mA |
|
||||||
|
|
||||||
|
> Miscellaneous
|
||||||
|
|
||||||
|
| Category | Format | Explanation |
|
||||||
|
|------------------------|-------------------|----------------------------------------------------------------------------------|
|
||||||
|
| DSP Usage | %u | In percent (not available on 17.0.0+) |
|
||||||
|
| NVDEC | %.2f | Target frequency in MHz (shows 0 if chip is not active) |
|
||||||
|
| NVENC | %.2f | Target frequency in MHz (shows 0 if chip is not active) |
|
||||||
|
| NVJPG | %.2f | Target frequency in MHz (shows 0 if chip is not active) |
|
||||||
|
| Network Type | %s | It shows if Switch is connected to internet, and if it's using Ethernet or Wi-Fi |
|
||||||
|
|
||||||
|
If Network Type is "Wi-Fi", you can press Y to show password. Since max password length is 64 characters, it may show in up to 3 lines.
|
||||||
|
|
||||||
|
> Game Resolutions
|
||||||
|
|
||||||
|
For this mode to show and work properly you must have SaltyNX 0.9.0+ installed. You can use touch screen to change its position temporarily.
|
||||||
|
|
||||||
|
When game runs, this menu shows what resolutions and how many times they were passed to GPU via two functions:
|
||||||
|
- __Depth__ shows info from depth texture passed to `nvnCommandBufferSetRenderTargets`
|
||||||
|
- __Viewport__ shows info from arguments passed to:
|
||||||
|
- for NVN: `nvnCommandBufferSetViewport`, `nvnCommandBufferSetViewports`, `nvnCommandBufferSetScissor` and `nvnCommandBufferSetScissors`
|
||||||
|
- for EGL: `glViewport`, `glViewportArrayv`, `glViewportIndexedf`, `glViewportIndexedfv` and all their variations
|
||||||
|
- for Vulkan: `vkCmdSetViewport` and `vkCmdSetViewportWithCount`
|
||||||
|
|
||||||
|
This menu shows first 8 resolutions passed to those functions in last frame rendering loop, sorted in descending order of calls number.<br>
|
||||||
|
Its main purpose is to catch game rendering resolution, but user must deduce which ones are correct.<br>
|
||||||
|
I have limited catched resolutions only to ones that have ratio higher than 0.6 and lower than 1.8. Such low value comes from the fact that some games are rendering at width lower than height (f.e. 480x720). There is also a limit where it won't accept resolutions which height is lower than 160 px or higher than 1440 px.<br>
|
||||||
|
|
||||||
|
Remember that resolutions you can see in this mode may be used in different ways - for example Tokyo Xanadu Ex+ max dynamic resolution in handheld will show 1280x736, but it's not that game will squeeze this into 720p screen, it's just removing those additional 16 pixels from showing on screen.
|
||||||
|
|
||||||
|
Those commands are used by all 3D games using NVN, EGL and Vulkan APIs (that's why it may not work with games using 2D engines).<br>
|
||||||
|
This mode is not 100% fullproof, so it can show that nothing is catched or it won't catch what is used for 3D rendering (if this happens for some 3D game, please report an issue).
|
||||||
|
|
||||||
|
By default refresh rate of this menu is 10 FPS. You can change that in config.ini, more in config.md<br>
|
||||||
|
Exiting is done by using the same combo buttons used in other main modes.
|
||||||
|
|
||||||
|
Games that don't mesh well with RES category in `Mini` and Resolution in `Full` modes while showing properly rendering resolutions in this menu:
|
||||||
|
- `Kirby and The Forgotten Land`: dynamic resolution has much less calls than other resolutions, it shows up correctly only when it's max dynamic resolution set. It shows up always first in Depth category of Game Resolutions menu.
|
||||||
|
- `Darksiders 2`: Dynamic resolution is randomly showing up, fighting for attention with native resolution call. In Game Resolutions menu it shows up either at 2nd or 3rd place of Viewport.
|
||||||
|
|
||||||
|
# Additional info
|
||||||
|
|
||||||
|
> How Battery Remaining Time is calculated
|
||||||
|
|
||||||
|
It is calculated from the last 3 minutes of power draw readings. In the first minute of running any mode, it is updated every 0.5s, after one minute it's updated every minute. When exiting the currently used mode, calculations are reset. When connecting or disconnecting the charger, calculations are reset. When Battery Power Draw is positive instead of negative, time is shown as [-:--] and calculations are reset.
|
||||||
|
|
||||||
|
> What is Skin temperature ($\mathbf{T}skin$)?
|
||||||
|
|
||||||
|
This is temperature calculated from SoC and PCB temperatures that is mainly used to prevent Switch from overheating. Reading it is not supported on FWs <5.0.0.
|
||||||
|
|
||||||
|
Explanation provided by CTCaer
|
||||||
|
>Temperature ($\mathbf{T}skin$) calculation.
|
||||||
|
>
|
||||||
|
>
|
||||||
|
>Console and Handheld:
|
||||||
|
>
|
||||||
|
>$\mathbf{T}soc >= 84°C$ - Immediate sleep. No questions asked.
|
||||||
|
>
|
||||||
|
>$\mathbf{T}pcb >= 84°C$ - Immediate sleep. No questions asked.
|
||||||
|
>
|
||||||
|
>
|
||||||
|
>Console only:
|
||||||
|
>
|
||||||
|
>$\mathbf{T}skin < 63°C$ - Clears both timers.
|
||||||
|
>
|
||||||
|
>$\mathbf{T}skin >= 63°C$ - Immediate sleep. No questions asked.
|
||||||
|
>
|
||||||
|
>
|
||||||
|
>Handheld only:
|
||||||
|
>
|
||||||
|
>$\mathbf{T}skin < 58°C$ - Clears both timers.
|
||||||
|
>
|
||||||
|
>$58°C <= \mathbf{T}skin < 61°C$ - Starts 60s timer and clears 10s timer.
|
||||||
|
>
|
||||||
|
>$61°C <= \mathbf{T}skin < 63°C$ - Starts 10s timer.
|
||||||
|
>
|
||||||
|
>$\mathbf{T}skin >= 63°C$ - Immediate sleep. No questions asked.
|
||||||
|
>
|
||||||
|
>
|
||||||
|
>The two timers are separate. If 61°C is reached, the 10s timer is immediatly started.
|
||||||
|
>
|
||||||
|
>If a timer ends and the temperature is not dropped, goes into sleep.
|
||||||
|
>
|
||||||
|
>
|
||||||
|
>tskin is the specific calculation below:
|
||||||
|
```
|
||||||
|
soc_adj = (temps.iir_filter_gain_soc * (temps.soc - temps.soc_adj_prev)) + temps.soc_adj_prev;
|
||||||
|
pcb_adj = (temps.iir_filter_gain_pcb * (temps.pcb - temps.pcb_adj_prev)) + temps.pcb_adj_prev;
|
||||||
|
temps.soc_adj_prev = soc_adj;
|
||||||
|
temps.pcb_adj_prev = pcb_adj;
|
||||||
|
|
||||||
|
if (soc_adj >= 38000)
|
||||||
|
{
|
||||||
|
if (temps.handheld)
|
||||||
|
soc_adj = (temps.tskin_soc_coeff_handheld[0] * soc_adj) + (1000 * temps.tskin_soc_coeff_handheld[1]);
|
||||||
|
else
|
||||||
|
soc_adj = (temps.tskin_soc_coeff_console[0] * soc_adj) + (1000 * temps.tskin_soc_coeff_console[1]);
|
||||||
|
soc_adj = (soc_adj / 10000) + 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pcb_adj >= 38000)
|
||||||
|
{
|
||||||
|
if (temps.handheld)
|
||||||
|
pcb_adj = (temps.tskin_pcb_coeff_handheld[0] * pcb_adj) + (1000 * temps.tskin_pcb_coeff_handheld[1]);
|
||||||
|
else
|
||||||
|
pcb_adj = (temps.tskin_pcb_coeff_console[0] * soc_adj) + (1000 * temps.tskin_pcb_coeff_console[1]);
|
||||||
|
pcb_adj = (pcb_adj / 10000) + 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
skin_adj = MAX(soc_adj, pcb_adj); //tskin
|
||||||
|
```
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
///* Notes VoltageAvg
|
||||||
|
//
|
||||||
|
// Vavg time = 175.8ms x 2^(6+VOLT), default: VOLT = 2 (Vavg time = 45s)
|
||||||
|
//
|
||||||
|
///End of Notes
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
NoHub = BIT(0), //If hub is disconnected
|
||||||
|
Rail = BIT(8), //At least one Joy-con is charging from rail
|
||||||
|
SPDSRC = BIT(12), //OTG
|
||||||
|
ACC = BIT(16) //Accessory
|
||||||
|
} BatteryChargeInfoFieldsFlags;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
NewPDO = 1, //Received new Power Data Object
|
||||||
|
NoPD = 2, //No Power Delivery source is detected
|
||||||
|
AcceptedRDO = 3 //Received and accepted Request Data Object
|
||||||
|
} BatteryChargeInfoFieldsPDControllerState; //BM92T series
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
None = 0,
|
||||||
|
PD = 1,
|
||||||
|
TypeC_1500mA = 2,
|
||||||
|
TypeC_3000mA = 3,
|
||||||
|
DCP = 4,
|
||||||
|
CDP = 5,
|
||||||
|
SDP = 6,
|
||||||
|
Apple_500mA = 7,
|
||||||
|
Apple_1000mA = 8,
|
||||||
|
Apple_2000mA = 9
|
||||||
|
} BatteryChargeInfoFieldsChargerType;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
Sink = 1,
|
||||||
|
Source = 2
|
||||||
|
} BatteryChargeInfoFieldsPowerRole;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32_t InputCurrentLimit; //Input (Sink) current limit in mA
|
||||||
|
int32_t VBUSCurrentLimit; //Output (Source/VBUS/OTG) current limit in mA
|
||||||
|
int32_t ChargeCurrentLimit; //Battery charging current limit in mA (512mA when Docked, 768mA when BatteryTemperature < 17.0 C)
|
||||||
|
int32_t ChargeVoltageLimit; //Battery charging voltage limit in mV (3952mV when BatteryTemperature >= 51.0 C)
|
||||||
|
int32_t unk_x10; //Possibly an emum, getting the same value as PowerRole in all tested cases
|
||||||
|
int32_t unk_x14; //Possibly flags
|
||||||
|
BatteryChargeInfoFieldsPDControllerState PDControllerState; //Power Delivery Controller State
|
||||||
|
int32_t BatteryTemperature; //Battery temperature in milli C
|
||||||
|
int32_t RawBatteryCharge; //Raw battery charged capacity per cent-mille (i.e. 100% = 100000 pcm)
|
||||||
|
int32_t VoltageAvg; //Voltage avg in mV (more in Notes)
|
||||||
|
int32_t BatteryAge; //Battery age (capacity full / capacity design) per cent-mille (i.e. 100% = 100000 pcm)
|
||||||
|
BatteryChargeInfoFieldsPowerRole PowerRole;
|
||||||
|
BatteryChargeInfoFieldsChargerType ChargerType;
|
||||||
|
int32_t ChargerVoltageLimit; //Charger and external device voltage limit in mV
|
||||||
|
int32_t ChargerCurrentLimit; //Charger and external device current limit in mA
|
||||||
|
BatteryChargeInfoFieldsFlags Flags; //Unknown flags
|
||||||
|
char reserved[0x14]; //17.0.0+ data
|
||||||
|
} BatteryChargeInfoFields;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32_t InputCurrentLimit; //Input (Sink) current limit in mA
|
||||||
|
int32_t VBUSCurrentLimit; //Output (Source/VBUS/OTG) current limit in mA
|
||||||
|
int32_t ChargeCurrentLimit; //Battery charging current limit in mA (512mA when Docked, 768mA when BatteryTemperature < 17.0 C)
|
||||||
|
int32_t ChargeVoltageLimit; //Battery charging voltage limit in mV (3952mV when BatteryTemperature >= 51.0 C)
|
||||||
|
int32_t unk_x10; //Possibly an emum, getting the same value as PowerRole in all tested cases
|
||||||
|
int32_t unk_x14; //Possibly flags
|
||||||
|
BatteryChargeInfoFieldsPDControllerState PDControllerState; //Power Delivery Controller State
|
||||||
|
int32_t BatteryTemperature; //Battery temperature in milli C
|
||||||
|
int32_t RawBatteryCharge; //Raw battery charged capacity per cent-mille (i.e. 100% = 100000 pcm)
|
||||||
|
int32_t VoltageAvg; //Voltage avg in mV (more in Notes)
|
||||||
|
int32_t BatteryAge; //Battery age (capacity full / capacity design) per cent-mille (i.e. 100% = 100000 pcm)
|
||||||
|
char reserved[4]; //17.0.0+ data
|
||||||
|
BatteryChargeInfoFieldsPowerRole PowerRole;
|
||||||
|
BatteryChargeInfoFieldsChargerType ChargerType;
|
||||||
|
int32_t ChargerVoltageLimit; //Charger and external device voltage limit in mV
|
||||||
|
int32_t ChargerCurrentLimit; //Charger and external device current limit in mA
|
||||||
|
BatteryChargeInfoFieldsFlags Flags; //Unknown flags
|
||||||
|
char reserved2[0x10]; //17.0.0+ data
|
||||||
|
} BatteryChargeInfoFields17;
|
||||||
|
|
||||||
|
Result psmGetBatteryChargeInfoFields(Service* psmService, BatteryChargeInfoFields *out) {
|
||||||
|
return serviceDispatchOut(psmService, 17, *out);
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
typedef struct {
|
||||||
|
u8 ssid_len; ///< NifmSfWirelessSettingData::ssid_len
|
||||||
|
char ssid[0x21]; ///< NifmSfWirelessSettingData::ssid
|
||||||
|
u8 unk_x22; ///< NifmSfWirelessSettingData::unk_x21
|
||||||
|
u8 pad; ///< Padding
|
||||||
|
u32 unk_x24; ///< NifmSfWirelessSettingData::unk_x22
|
||||||
|
u32 unk_x28; ///< NifmSfWirelessSettingData::unk_x23
|
||||||
|
u8 passphrase_len; ///< Passphrase length
|
||||||
|
u8 passphrase[0x41]; ///< NifmSfWirelessSettingData::passphrase
|
||||||
|
u8 pad2[0x2]; ///< Padding
|
||||||
|
} NifmWirelessSettingData_new;
|
||||||
|
|
||||||
|
/// NetworkProfileData. Converted from/to \ref NifmSfNetworkProfileData.
|
||||||
|
typedef struct {
|
||||||
|
Uuid uuid; ///< NifmSfNetworkProfileData::uuid
|
||||||
|
char network_name[0x40]; ///< NifmSfNetworkProfileData::network_name
|
||||||
|
u32 unk_x50; ///< NifmSfNetworkProfileData::unk_x112
|
||||||
|
u32 unk_x54; ///< NifmSfNetworkProfileData::unk_x113
|
||||||
|
u8 unk_x58; ///< NifmSfNetworkProfileData::unk_x114
|
||||||
|
u8 unk_x59; ///< NifmSfNetworkProfileData::unk_x115
|
||||||
|
u8 pad[2]; ///< Padding
|
||||||
|
NifmWirelessSettingData_new wireless_setting_data; ///< \ref NifmWirelessSettingData
|
||||||
|
NifmIpSettingData ip_setting_data; ///< \ref NifmIpSettingData
|
||||||
|
} NifmNetworkProfileData_new;
|
||||||
|
|
||||||
|
Result getNvChannelClockRate(NvChannel *channel, u32 module_id, u32 *clock_rate) {
|
||||||
|
struct nvhost_clk_rate_args {
|
||||||
|
uint32_t rate;
|
||||||
|
uint32_t moduleid;
|
||||||
|
} args = {
|
||||||
|
.rate = 0,
|
||||||
|
.moduleid = module_id,
|
||||||
|
};
|
||||||
|
|
||||||
|
const u32 id = hosversionBefore(8,0,0) ? _NV_IOWR(0, 0x14, args) : _NV_IOWR(0, 0x23, args);
|
||||||
|
Result rc = nvIoctl(channel->fd, id, &args);
|
||||||
|
if (R_SUCCEEDED(rc) && clock_rate)
|
||||||
|
*clock_rate = args.rate;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
@@ -0,0 +1,231 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "ipc.h"
|
||||||
|
|
||||||
|
Handle saltysd_orig;
|
||||||
|
|
||||||
|
Result SaltySD_Connect() {
|
||||||
|
for (int i = 0; i < 200; i++) {
|
||||||
|
if (!svcConnectToNamedPort(&saltysd_orig, "SaltySD"))
|
||||||
|
return 0;
|
||||||
|
svcSleepThread(1000*1000);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result SaltySD_Term()
|
||||||
|
{
|
||||||
|
Result ret;
|
||||||
|
IpcCommand c;
|
||||||
|
|
||||||
|
ipcInitialize(&c);
|
||||||
|
ipcSendPid(&c);
|
||||||
|
|
||||||
|
struct input
|
||||||
|
{
|
||||||
|
u64 magic;
|
||||||
|
u64 cmd_id;
|
||||||
|
u64 zero;
|
||||||
|
u64 reserved[2];
|
||||||
|
} *raw;
|
||||||
|
|
||||||
|
raw = (input*)ipcPrepareHeader(&c, sizeof(*raw));
|
||||||
|
|
||||||
|
raw->magic = SFCI_MAGIC;
|
||||||
|
raw->cmd_id = 0;
|
||||||
|
raw->zero = 0;
|
||||||
|
|
||||||
|
ret = ipcDispatch(saltysd_orig);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(ret))
|
||||||
|
{
|
||||||
|
IpcParsedCommand r;
|
||||||
|
ipcParse(&r);
|
||||||
|
|
||||||
|
struct output {
|
||||||
|
u64 magic;
|
||||||
|
u64 result;
|
||||||
|
} *resp = (output*)r.Raw;
|
||||||
|
|
||||||
|
ret = resp->result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Session terminated works too.
|
||||||
|
svcCloseHandle(saltysd_orig);
|
||||||
|
if (ret == 0xf601) return 0;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result SaltySD_CheckIfSharedMemoryAvailable(ptrdiff_t *offset, u64 size)
|
||||||
|
{
|
||||||
|
Result ret = 0;
|
||||||
|
|
||||||
|
// Send a command
|
||||||
|
IpcCommand c;
|
||||||
|
ipcInitialize(&c);
|
||||||
|
ipcSendPid(&c);
|
||||||
|
|
||||||
|
struct input {
|
||||||
|
u64 magic;
|
||||||
|
u64 cmd_id;
|
||||||
|
u64 size;
|
||||||
|
u32 reserved[2];
|
||||||
|
} *raw;
|
||||||
|
|
||||||
|
raw = (input*)ipcPrepareHeader(&c, sizeof(*raw));
|
||||||
|
|
||||||
|
raw->magic = SFCI_MAGIC;
|
||||||
|
raw->cmd_id = 6;
|
||||||
|
raw->size = size;
|
||||||
|
|
||||||
|
ret = ipcDispatch(saltysd_orig);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(ret)) {
|
||||||
|
IpcParsedCommand r;
|
||||||
|
ipcParse(&r);
|
||||||
|
|
||||||
|
struct output {
|
||||||
|
u64 magic;
|
||||||
|
u64 result;
|
||||||
|
u64 offset;
|
||||||
|
} *resp = (output*)r.Raw;
|
||||||
|
|
||||||
|
ret = resp->result;
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
*offset = resp->offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result SaltySD_GetSharedMemoryHandle(Handle *retrieve)
|
||||||
|
{
|
||||||
|
Result ret = 0;
|
||||||
|
|
||||||
|
// Send a command
|
||||||
|
IpcCommand c;
|
||||||
|
ipcInitialize(&c);
|
||||||
|
ipcSendPid(&c);
|
||||||
|
|
||||||
|
struct input {
|
||||||
|
u64 magic;
|
||||||
|
u64 cmd_id;
|
||||||
|
u32 reserved[4];
|
||||||
|
} *raw;
|
||||||
|
|
||||||
|
raw = (input*)ipcPrepareHeader(&c, sizeof(*raw));
|
||||||
|
|
||||||
|
raw->magic = SFCI_MAGIC;
|
||||||
|
raw->cmd_id = 7;
|
||||||
|
|
||||||
|
ret = ipcDispatch(saltysd_orig);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(ret)) {
|
||||||
|
IpcParsedCommand r;
|
||||||
|
ipcParse(&r);
|
||||||
|
|
||||||
|
struct output {
|
||||||
|
u64 magic;
|
||||||
|
u64 result;
|
||||||
|
u64 reserved[2];
|
||||||
|
} *resp = (output*)r.Raw;
|
||||||
|
|
||||||
|
ret = resp->result;
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
*retrieve = r.Handles[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result SaltySD_GetDisplayRefreshRate(uint8_t* refreshRate)
|
||||||
|
{
|
||||||
|
Result ret = 0;
|
||||||
|
|
||||||
|
// Send a command
|
||||||
|
IpcCommand c;
|
||||||
|
ipcInitialize(&c);
|
||||||
|
ipcSendPid(&c);
|
||||||
|
|
||||||
|
struct input {
|
||||||
|
u64 magic;
|
||||||
|
u64 cmd_id;
|
||||||
|
u64 zero;
|
||||||
|
u64 reserved;
|
||||||
|
} *raw;
|
||||||
|
|
||||||
|
raw = (input*)ipcPrepareHeader(&c, sizeof(*raw));
|
||||||
|
|
||||||
|
raw->magic = SFCI_MAGIC;
|
||||||
|
raw->cmd_id = 10;
|
||||||
|
raw->zero = 0;
|
||||||
|
|
||||||
|
ret = ipcDispatch(saltysd_orig);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(ret)) {
|
||||||
|
IpcParsedCommand r;
|
||||||
|
ipcParse(&r);
|
||||||
|
|
||||||
|
struct output {
|
||||||
|
u64 magic;
|
||||||
|
u64 result;
|
||||||
|
u64 refreshRate;
|
||||||
|
u64 reserved;
|
||||||
|
} *resp = (output*)r.Raw;
|
||||||
|
|
||||||
|
ret = resp->result;
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
*refreshRate = (uint8_t)(resp->refreshRate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result SaltySD_SetDisplayRefreshRate(uint8_t refreshRate)
|
||||||
|
{
|
||||||
|
Result ret = 0;
|
||||||
|
|
||||||
|
// Send a command
|
||||||
|
IpcCommand c;
|
||||||
|
ipcInitialize(&c);
|
||||||
|
ipcSendPid(&c);
|
||||||
|
|
||||||
|
struct input {
|
||||||
|
u64 magic;
|
||||||
|
u64 cmd_id;
|
||||||
|
u64 refreshRate;
|
||||||
|
u64 reserved;
|
||||||
|
} *raw;
|
||||||
|
|
||||||
|
raw = (input*)ipcPrepareHeader(&c, sizeof(*raw));
|
||||||
|
|
||||||
|
raw->magic = SFCI_MAGIC;
|
||||||
|
raw->cmd_id = 11;
|
||||||
|
raw->refreshRate = refreshRate;
|
||||||
|
|
||||||
|
ret = ipcDispatch(saltysd_orig);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(ret)) {
|
||||||
|
IpcParsedCommand r;
|
||||||
|
ipcParse(&r);
|
||||||
|
|
||||||
|
struct output {
|
||||||
|
u64 magic;
|
||||||
|
u64 result;
|
||||||
|
u64 reserved[2];
|
||||||
|
} *resp = (output*)r.Raw;
|
||||||
|
|
||||||
|
ret = resp->result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <switch.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Result audsnoopInitialize(void);
|
||||||
|
void audsnoopExit(void);
|
||||||
|
|
||||||
|
Result audsnoopEnableDspUsageMeasurement(void);
|
||||||
|
Result audsnoopDisableDspUsageMeasurement(void);
|
||||||
|
|
||||||
|
Result audsnoopGetDspUsage(u32 *usage);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
Result I2cReadRegHandler16(u8 reg, I2cDevice dev, u16 *out)
|
||||||
|
{
|
||||||
|
struct readReg {
|
||||||
|
u8 send;
|
||||||
|
u8 sendLength;
|
||||||
|
u8 sendData;
|
||||||
|
u8 receive;
|
||||||
|
u8 receiveLength;
|
||||||
|
};
|
||||||
|
|
||||||
|
I2cSession _session;
|
||||||
|
|
||||||
|
Result res = i2cOpenSession(&_session, dev);
|
||||||
|
if (res)
|
||||||
|
return res;
|
||||||
|
|
||||||
|
u16 val;
|
||||||
|
|
||||||
|
struct readReg readRegister = {
|
||||||
|
.send = 0 | (I2cTransactionOption_Start << 6),
|
||||||
|
.sendLength = sizeof(reg),
|
||||||
|
.sendData = reg,
|
||||||
|
.receive = 1 | (I2cTransactionOption_All << 6),
|
||||||
|
.receiveLength = sizeof(val),
|
||||||
|
};
|
||||||
|
|
||||||
|
res = i2csessionExecuteCommandList(&_session, &val, sizeof(val), &readRegister, sizeof(readRegister));
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
i2csessionClose(&_session);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
*out = val;
|
||||||
|
i2csessionClose(&_session);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result I2cReadRegHandler8(u8 reg, I2cDevice dev, u8 *out)
|
||||||
|
{
|
||||||
|
struct readReg {
|
||||||
|
u8 send;
|
||||||
|
u8 sendLength;
|
||||||
|
u8 sendData;
|
||||||
|
u8 receive;
|
||||||
|
u8 receiveLength;
|
||||||
|
};
|
||||||
|
|
||||||
|
I2cSession _session;
|
||||||
|
|
||||||
|
Result res = i2cOpenSession(&_session, dev);
|
||||||
|
if (res)
|
||||||
|
return res;
|
||||||
|
|
||||||
|
u8 val;
|
||||||
|
|
||||||
|
struct readReg readRegister = {
|
||||||
|
.send = 0 | (I2cTransactionOption_Start << 6),
|
||||||
|
.sendLength = sizeof(reg),
|
||||||
|
.sendData = reg,
|
||||||
|
.receive = 1 | (I2cTransactionOption_All << 6),
|
||||||
|
.receiveLength = sizeof(val),
|
||||||
|
};
|
||||||
|
|
||||||
|
res = i2csessionExecuteCommandList(&_session, &val, sizeof(val), &readRegister, sizeof(readRegister));
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
i2csessionClose(&_session);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
*out = val;
|
||||||
|
i2csessionClose(&_session);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,755 @@
|
|||||||
|
/**
|
||||||
|
* @file ipc.h
|
||||||
|
* @brief Inter-process communication handling
|
||||||
|
* @author plutoo
|
||||||
|
* @copyright libnx Authors
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
/// IPC input header magic
|
||||||
|
#define SFCI_MAGIC 0x49434653
|
||||||
|
/// IPC output header magic
|
||||||
|
#define SFCO_MAGIC 0x4f434653
|
||||||
|
|
||||||
|
/// IPC invalid object ID
|
||||||
|
#define IPC_INVALID_OBJECT_ID UINT32_MAX
|
||||||
|
|
||||||
|
///@name IPC request building
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/// IPC command (request) structure.
|
||||||
|
#define IPC_MAX_BUFFERS 8
|
||||||
|
#define IPC_MAX_OBJECTS 8
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
BufferType_Normal=0, ///< Regular buffer.
|
||||||
|
BufferType_Type1=1, ///< Allows ProcessMemory and shared TransferMemory.
|
||||||
|
BufferType_Invalid=2,
|
||||||
|
BufferType_Type3=3 ///< Same as Type1 except remote process is not allowed to use device-mapping.
|
||||||
|
} BufferType;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
BufferDirection_Send=0,
|
||||||
|
BufferDirection_Recv=1,
|
||||||
|
BufferDirection_Exch=2,
|
||||||
|
} BufferDirection;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
IpcCommandType_Invalid = 0,
|
||||||
|
IpcCommandType_LegacyRequest = 1,
|
||||||
|
IpcCommandType_Close = 2,
|
||||||
|
IpcCommandType_LegacyControl = 3,
|
||||||
|
IpcCommandType_Request = 4,
|
||||||
|
IpcCommandType_Control = 5,
|
||||||
|
IpcCommandType_RequestWithContext = 6,
|
||||||
|
IpcCommandType_ControlWithContext = 7,
|
||||||
|
} IpcCommandType;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DomainMessageType_Invalid = 0,
|
||||||
|
DomainMessageType_SendMessage = 1,
|
||||||
|
DomainMessageType_Close = 2,
|
||||||
|
} DomainMessageType;
|
||||||
|
|
||||||
|
/// IPC domain message header.
|
||||||
|
typedef struct {
|
||||||
|
u8 Type;
|
||||||
|
u8 NumObjectIds;
|
||||||
|
u16 Length;
|
||||||
|
u32 ThisObjectId;
|
||||||
|
u32 Pad[2];
|
||||||
|
} DomainMessageHeader;
|
||||||
|
|
||||||
|
/// IPC domain response header.
|
||||||
|
typedef struct {
|
||||||
|
u32 NumObjectIds;
|
||||||
|
u32 Pad[3];
|
||||||
|
} DomainResponseHeader;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
size_t NumSend; // A
|
||||||
|
size_t NumRecv; // B
|
||||||
|
size_t NumExch; // W
|
||||||
|
const void* Buffers[IPC_MAX_BUFFERS];
|
||||||
|
size_t BufferSizes[IPC_MAX_BUFFERS];
|
||||||
|
BufferType BufferTypes[IPC_MAX_BUFFERS];
|
||||||
|
|
||||||
|
size_t NumStaticIn; // X
|
||||||
|
size_t NumStaticOut; // C
|
||||||
|
const void* Statics[IPC_MAX_BUFFERS];
|
||||||
|
size_t StaticSizes[IPC_MAX_BUFFERS];
|
||||||
|
u8 StaticIndices[IPC_MAX_BUFFERS];
|
||||||
|
|
||||||
|
bool SendPid;
|
||||||
|
size_t NumHandlesCopy;
|
||||||
|
size_t NumHandlesMove;
|
||||||
|
Handle Handles[IPC_MAX_OBJECTS];
|
||||||
|
|
||||||
|
size_t NumObjectIds;
|
||||||
|
u32 ObjectIds[IPC_MAX_OBJECTS];
|
||||||
|
} IpcCommand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initializes an IPC command structure.
|
||||||
|
* @param cmd IPC command structure.
|
||||||
|
*/
|
||||||
|
static inline void ipcInitialize(IpcCommand* cmd) {
|
||||||
|
*cmd = (IpcCommand){};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// IPC buffer descriptor.
|
||||||
|
typedef struct {
|
||||||
|
u32 Size; ///< Size of the buffer.
|
||||||
|
u32 Addr; ///< Lower 32-bits of the address of the buffer
|
||||||
|
u32 Packed; ///< Packed data (including higher bits of the address)
|
||||||
|
} IpcBufferDescriptor;
|
||||||
|
|
||||||
|
/// IPC static send-buffer descriptor.
|
||||||
|
typedef struct {
|
||||||
|
u32 Packed; ///< Packed data (including higher bits of the address)
|
||||||
|
u32 Addr; ///< Lower 32-bits of the address
|
||||||
|
} IpcStaticSendDescriptor;
|
||||||
|
|
||||||
|
/// IPC static receive-buffer descriptor.
|
||||||
|
typedef struct {
|
||||||
|
u32 Addr; ///< Lower 32-bits of the address of the buffer
|
||||||
|
u32 Packed; ///< Packed data (including higher bits of the address)
|
||||||
|
} IpcStaticRecvDescriptor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Adds a buffer to an IPC command structure.
|
||||||
|
* @param cmd IPC command structure.
|
||||||
|
* @param buffer Address of the buffer.
|
||||||
|
* @param size Size of the buffer.
|
||||||
|
* @param type Buffer type.
|
||||||
|
*/
|
||||||
|
static inline void ipcAddSendBuffer(IpcCommand* cmd, const void* buffer, size_t size, BufferType type) {
|
||||||
|
const size_t off = cmd->NumSend;
|
||||||
|
cmd->Buffers[off] = buffer;
|
||||||
|
cmd->BufferSizes[off] = size;
|
||||||
|
cmd->BufferTypes[off] = type;
|
||||||
|
cmd->NumSend++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Adds a receive-buffer to an IPC command structure.
|
||||||
|
* @param cmd IPC command structure.
|
||||||
|
* @param buffer Address of the buffer.
|
||||||
|
* @param size Size of the buffer.
|
||||||
|
* @param type Buffer type.
|
||||||
|
*/
|
||||||
|
static inline void ipcAddRecvBuffer(IpcCommand* cmd, void* buffer, size_t size, BufferType type) {
|
||||||
|
const size_t off = cmd->NumSend + cmd->NumRecv;
|
||||||
|
cmd->Buffers[off] = buffer;
|
||||||
|
cmd->BufferSizes[off] = size;
|
||||||
|
cmd->BufferTypes[off] = type;
|
||||||
|
cmd->NumRecv++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Adds an exchange-buffer to an IPC command structure.
|
||||||
|
* @param cmd IPC command structure.
|
||||||
|
* @param buffer Address of the buffer.
|
||||||
|
* @param size Size of the buffer.
|
||||||
|
* @param type Buffer type.
|
||||||
|
*/
|
||||||
|
static inline void ipcAddExchBuffer(IpcCommand* cmd, void* buffer, size_t size, BufferType type) {
|
||||||
|
const size_t off = cmd->NumSend + cmd->NumRecv + cmd->NumExch;
|
||||||
|
cmd->Buffers[off] = buffer;
|
||||||
|
cmd->BufferSizes[off] = size;
|
||||||
|
cmd->BufferTypes[off] = type;
|
||||||
|
cmd->NumExch++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Adds a static-buffer to an IPC command structure.
|
||||||
|
* @param cmd IPC command structure.
|
||||||
|
* @param buffer Address of the buffer.
|
||||||
|
* @param size Size of the buffer.
|
||||||
|
* @param index Index of buffer.
|
||||||
|
*/
|
||||||
|
static inline void ipcAddSendStatic(IpcCommand* cmd, const void* buffer, size_t size, u8 index) {
|
||||||
|
const size_t off = cmd->NumStaticIn;
|
||||||
|
cmd->Statics[off] = buffer;
|
||||||
|
cmd->StaticSizes[off] = size;
|
||||||
|
cmd->StaticIndices[off] = index;
|
||||||
|
cmd->NumStaticIn++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Adds a static-receive-buffer to an IPC command structure.
|
||||||
|
* @param cmd IPC command structure.
|
||||||
|
* @param buffer Address of the buffer.
|
||||||
|
* @param size Size of the buffer.
|
||||||
|
* @param index Index of buffer.
|
||||||
|
*/
|
||||||
|
static inline void ipcAddRecvStatic(IpcCommand* cmd, void* buffer, size_t size, u8 index) {
|
||||||
|
const size_t off = cmd->NumStaticIn + cmd->NumStaticOut;
|
||||||
|
cmd->Statics[off] = buffer;
|
||||||
|
cmd->StaticSizes[off] = size;
|
||||||
|
cmd->StaticIndices[off] = index;
|
||||||
|
cmd->NumStaticOut++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Adds a smart-buffer (buffer + static-buffer pair) to an IPC command structure.
|
||||||
|
* @param cmd IPC command structure.
|
||||||
|
* @param pointer_buffer_size Pointer buffer size.
|
||||||
|
* @param buffer Address of the buffer.
|
||||||
|
* @param size Size of the buffer.
|
||||||
|
* @param index Index of buffer.
|
||||||
|
*/
|
||||||
|
static inline void ipcAddSendSmart(IpcCommand* cmd, size_t pointer_buffer_size, const void* buffer, size_t size, u8 index) {
|
||||||
|
if (pointer_buffer_size != 0 && size <= pointer_buffer_size) {
|
||||||
|
ipcAddSendBuffer(cmd, NULL, 0, BufferType_Normal);
|
||||||
|
ipcAddSendStatic(cmd, buffer, size, index);
|
||||||
|
} else {
|
||||||
|
ipcAddSendBuffer(cmd, buffer, size, BufferType_Normal);
|
||||||
|
ipcAddSendStatic(cmd, NULL, 0, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Adds a smart-receive-buffer (buffer + static-receive-buffer pair) to an IPC command structure.
|
||||||
|
* @param cmd IPC command structure.
|
||||||
|
* @param pointer_buffer_size Pointer buffer size.
|
||||||
|
* @param buffer Address of the buffer.
|
||||||
|
* @param size Size of the buffer.
|
||||||
|
* @param index Index of buffer.
|
||||||
|
*/
|
||||||
|
static inline void ipcAddRecvSmart(IpcCommand* cmd, size_t pointer_buffer_size, void* buffer, size_t size, u8 index) {
|
||||||
|
if (pointer_buffer_size != 0 && size <= pointer_buffer_size) {
|
||||||
|
ipcAddRecvBuffer(cmd, NULL, 0, BufferType_Normal);
|
||||||
|
ipcAddRecvStatic(cmd, buffer, size, index);
|
||||||
|
} else {
|
||||||
|
ipcAddRecvBuffer(cmd, buffer, size, BufferType_Normal);
|
||||||
|
ipcAddRecvStatic(cmd, NULL, 0, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Tags an IPC command structure to send the PID.
|
||||||
|
* @param cmd IPC command structure.
|
||||||
|
*/
|
||||||
|
static inline void ipcSendPid(IpcCommand* cmd) {
|
||||||
|
cmd->SendPid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Adds a copy-handle to be sent through an IPC command structure.
|
||||||
|
* @param cmd IPC command structure.
|
||||||
|
* @param h Handle to send.
|
||||||
|
* @remark The receiving process gets a copy of the handle.
|
||||||
|
*/
|
||||||
|
static inline void ipcSendHandleCopy(IpcCommand* cmd, Handle h) {
|
||||||
|
cmd->Handles[cmd->NumHandlesCopy++] = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Adds a move-handle to be sent through an IPC command structure.
|
||||||
|
* @param cmd IPC command structure.
|
||||||
|
* @param h Handle to send.
|
||||||
|
* @remark The sending process loses ownership of the handle, which is transferred to the receiving process.
|
||||||
|
*/
|
||||||
|
static inline void ipcSendHandleMove(IpcCommand* cmd, Handle h) {
|
||||||
|
cmd->Handles[cmd->NumHandlesCopy + cmd->NumHandlesMove++] = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Prepares the header of an IPC command structure.
|
||||||
|
* @param cmd IPC command structure.
|
||||||
|
* @param sizeof_raw Size in bytes of the raw data structure to embed inside the IPC request
|
||||||
|
* @return Pointer to the raw embedded data structure in the request, ready to be filled out.
|
||||||
|
*/
|
||||||
|
static inline void* ipcPrepareHeader(IpcCommand* cmd, size_t sizeof_raw) {
|
||||||
|
u32* buf = (u32*)armGetTls();
|
||||||
|
size_t i;
|
||||||
|
*buf++ = IpcCommandType_Request | (cmd->NumStaticIn << 16) | (cmd->NumSend << 20) | (cmd->NumRecv << 24) | (cmd->NumExch << 28);
|
||||||
|
|
||||||
|
u32* fill_in_size_later = buf;
|
||||||
|
|
||||||
|
if (cmd->NumStaticOut > 0) {
|
||||||
|
*buf = (cmd->NumStaticOut + 2) << 10;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
*buf = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmd->SendPid || cmd->NumHandlesCopy > 0 || cmd->NumHandlesMove > 0) {
|
||||||
|
*buf++ |= 0x80000000;
|
||||||
|
*buf++ = (!!cmd->SendPid) | (cmd->NumHandlesCopy << 1) | (cmd->NumHandlesMove << 5);
|
||||||
|
|
||||||
|
if (cmd->SendPid)
|
||||||
|
buf += 2;
|
||||||
|
|
||||||
|
for (i=0; i<(cmd->NumHandlesCopy + cmd->NumHandlesMove); i++)
|
||||||
|
*buf++ = cmd->Handles[i];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
buf++;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0; i<cmd->NumStaticIn; i++, buf+=2) {
|
||||||
|
IpcStaticSendDescriptor* desc = (IpcStaticSendDescriptor*) buf;
|
||||||
|
|
||||||
|
const uintptr_t ptr = (uintptr_t) cmd->Statics[i];
|
||||||
|
desc->Addr = ptr;
|
||||||
|
desc->Packed = cmd->StaticIndices[i] | (cmd->StaticSizes[i] << 16) |
|
||||||
|
(((ptr >> 32) & 15) << 12) | (((ptr >> 36) & 15) << 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0; i<(cmd->NumSend + cmd->NumRecv + cmd->NumExch); i++, buf+=3) {
|
||||||
|
IpcBufferDescriptor* desc = (IpcBufferDescriptor*) buf;
|
||||||
|
desc->Size = cmd->BufferSizes[i];
|
||||||
|
|
||||||
|
const uintptr_t ptr = (uintptr_t) cmd->Buffers[i];
|
||||||
|
desc->Addr = ptr;
|
||||||
|
desc->Packed = cmd->BufferTypes[i] |
|
||||||
|
(((ptr >> 32) & 15) << 28) | ((ptr >> 36) << 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
const u32 padding = ((16 - (((uintptr_t) buf) & 15)) & 15) / 4;
|
||||||
|
u32* raw = (u32*) (buf + padding);
|
||||||
|
|
||||||
|
size_t raw_size = (sizeof_raw/4) + 4;
|
||||||
|
buf += raw_size;
|
||||||
|
|
||||||
|
u16* buf_u16 = (u16*) buf;
|
||||||
|
|
||||||
|
for (i=0; i<cmd->NumStaticOut; i++) {
|
||||||
|
const size_t off = cmd->NumStaticIn + i;
|
||||||
|
const size_t sz = (uintptr_t) cmd->StaticSizes[off];
|
||||||
|
|
||||||
|
buf_u16[i] = (sz > 0xFFFF) ? 0 : sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
const size_t u16s_size = ((2*cmd->NumStaticOut) + 3)/4;
|
||||||
|
buf += u16s_size;
|
||||||
|
raw_size += u16s_size;
|
||||||
|
|
||||||
|
*fill_in_size_later |= raw_size;
|
||||||
|
|
||||||
|
for (i=0; i<cmd->NumStaticOut; i++, buf+=2) {
|
||||||
|
IpcStaticRecvDescriptor* desc = (IpcStaticRecvDescriptor*) buf;
|
||||||
|
const size_t off = cmd->NumStaticIn + i;
|
||||||
|
|
||||||
|
const uintptr_t ptr = (uintptr_t) cmd->Statics[off];
|
||||||
|
desc->Addr = ptr;
|
||||||
|
desc->Packed = (ptr >> 32) | (cmd->StaticSizes[off] << 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (void*) raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Dispatches an IPC request.
|
||||||
|
* @param session IPC session handle.
|
||||||
|
* @return Result code.
|
||||||
|
*/
|
||||||
|
static inline Result ipcDispatch(Handle session) {
|
||||||
|
return svcSendSyncRequest(session);
|
||||||
|
}
|
||||||
|
|
||||||
|
///@}
|
||||||
|
|
||||||
|
///@name IPC response parsing
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/// IPC parsed command (response) structure.
|
||||||
|
typedef struct {
|
||||||
|
IpcCommandType CommandType; ///< Type of the command
|
||||||
|
|
||||||
|
bool HasPid; ///< true if the 'Pid' field is filled out.
|
||||||
|
u64 Pid; ///< PID included in the response (only if HasPid is true)
|
||||||
|
|
||||||
|
size_t NumHandles; ///< Number of handles copied.
|
||||||
|
Handle Handles[IPC_MAX_OBJECTS]; ///< Handles.
|
||||||
|
bool WasHandleCopied[IPC_MAX_OBJECTS]; ///< true if the handle was moved, false if it was copied.
|
||||||
|
|
||||||
|
bool IsDomainRequest; ///< true if the the message is a Domain message.
|
||||||
|
DomainMessageType InMessageType; ///< Type of the domain message.
|
||||||
|
u32 InMessageLength; ///< Size of rawdata (for domain messages).
|
||||||
|
u32 InThisObjectId; ///< Object ID to call the command on (for domain messages).
|
||||||
|
size_t InNumObjectIds; ///< Number of object IDs (for domain messages).
|
||||||
|
u32 InObjectIds[IPC_MAX_OBJECTS]; ///< Object IDs (for domain messages).
|
||||||
|
|
||||||
|
bool IsDomainResponse; ///< true if the the message is a Domain response.
|
||||||
|
size_t OutNumObjectIds; ///< Number of object IDs (for domain responses).
|
||||||
|
u32 OutObjectIds[IPC_MAX_OBJECTS]; ///< Object IDs (for domain responses).
|
||||||
|
|
||||||
|
size_t NumBuffers; ///< Number of buffers in the response.
|
||||||
|
void* Buffers[IPC_MAX_BUFFERS]; ///< Pointers to the buffers.
|
||||||
|
size_t BufferSizes[IPC_MAX_BUFFERS]; ///< Sizes of the buffers.
|
||||||
|
BufferType BufferTypes[IPC_MAX_BUFFERS]; ///< Types of the buffers.
|
||||||
|
BufferDirection BufferDirections[IPC_MAX_BUFFERS]; ///< Direction of each buffer.
|
||||||
|
|
||||||
|
size_t NumStatics; ///< Number of statics in the response.
|
||||||
|
void* Statics[IPC_MAX_BUFFERS]; ///< Pointers to the statics.
|
||||||
|
size_t StaticSizes[IPC_MAX_BUFFERS]; ///< Sizes of the statics.
|
||||||
|
u8 StaticIndices[IPC_MAX_BUFFERS]; ///< Indices of the statics.
|
||||||
|
|
||||||
|
size_t NumStaticsOut; ///< Number of output statics available in the response.
|
||||||
|
|
||||||
|
void* Raw; ///< Pointer to the raw embedded data structure in the response.
|
||||||
|
void* RawWithoutPadding; ///< Pointer to the raw embedded data structure, without padding.
|
||||||
|
size_t RawSize; ///< Size of the raw embedded data.
|
||||||
|
} IpcParsedCommand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Parse an IPC command response into an IPC parsed command structure.
|
||||||
|
* @param r IPC parsed command structure to fill in.
|
||||||
|
* @return Result code.
|
||||||
|
*/
|
||||||
|
static inline Result ipcParse(IpcParsedCommand* r) {
|
||||||
|
u32* buf = (u32*)armGetTls();
|
||||||
|
u32 ctrl0 = *buf++;
|
||||||
|
u32 ctrl1 = *buf++;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
r->IsDomainRequest = false;
|
||||||
|
r->IsDomainResponse = false;
|
||||||
|
|
||||||
|
r->CommandType = (IpcCommandType) (ctrl0 & 0xffff);
|
||||||
|
r->HasPid = false;
|
||||||
|
r->RawSize = (ctrl1 & 0x1ff) * 4;
|
||||||
|
r->NumHandles = 0;
|
||||||
|
|
||||||
|
r->NumStaticsOut = (ctrl1 >> 10) & 15;
|
||||||
|
if (r->NumStaticsOut >> 1) r->NumStaticsOut--; // Value 2 -> Single descriptor
|
||||||
|
if (r->NumStaticsOut >> 1) r->NumStaticsOut--; // Value 3+ -> (Value - 2) descriptors
|
||||||
|
|
||||||
|
if (ctrl1 & 0x80000000) {
|
||||||
|
u32 ctrl2 = *buf++;
|
||||||
|
|
||||||
|
if (ctrl2 & 1) {
|
||||||
|
r->HasPid = true;
|
||||||
|
r->Pid = *buf++;
|
||||||
|
r->Pid |= ((u64)(*buf++)) << 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
const size_t num_handles_copy = ((ctrl2 >> 1) & 15);
|
||||||
|
const size_t num_handles_move = ((ctrl2 >> 5) & 15);
|
||||||
|
|
||||||
|
size_t num_handles = num_handles_copy + num_handles_move;
|
||||||
|
u32* buf_after_handles = buf + num_handles;
|
||||||
|
|
||||||
|
if (num_handles > IPC_MAX_OBJECTS)
|
||||||
|
num_handles = IPC_MAX_OBJECTS;
|
||||||
|
|
||||||
|
for (i=0; i<num_handles; i++)
|
||||||
|
{
|
||||||
|
r->Handles[i] = *(buf+i);
|
||||||
|
r->WasHandleCopied[i] = (i < num_handles_copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
r->NumHandles = num_handles;
|
||||||
|
buf = buf_after_handles;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t num_statics = (ctrl0 >> 16) & 15;
|
||||||
|
u32* buf_after_statics = buf + num_statics*2;
|
||||||
|
|
||||||
|
if (num_statics > IPC_MAX_BUFFERS)
|
||||||
|
num_statics = IPC_MAX_BUFFERS;
|
||||||
|
|
||||||
|
for (i=0; i<num_statics; i++, buf+=2) {
|
||||||
|
IpcStaticSendDescriptor* desc = (IpcStaticSendDescriptor*) buf;
|
||||||
|
const u64 packed = (u64) desc->Packed;
|
||||||
|
|
||||||
|
r->Statics[i] = (void*) (desc->Addr | (((packed >> 12) & 15) << 32) | (((packed >> 6) & 15) << 36));
|
||||||
|
r->StaticSizes[i] = packed >> 16;
|
||||||
|
r->StaticIndices[i] = packed & 63;
|
||||||
|
}
|
||||||
|
|
||||||
|
r->NumStatics = num_statics;
|
||||||
|
buf = buf_after_statics;
|
||||||
|
|
||||||
|
const size_t num_bufs_send = (ctrl0 >> 20) & 15;
|
||||||
|
const size_t num_bufs_recv = (ctrl0 >> 24) & 15;
|
||||||
|
const size_t num_bufs_exch = (ctrl0 >> 28) & 15;
|
||||||
|
|
||||||
|
size_t num_bufs = num_bufs_send + num_bufs_recv + num_bufs_exch;
|
||||||
|
r->Raw = (void*)(((uintptr_t)(buf + num_bufs*3) + 15) &~ 15);
|
||||||
|
r->RawWithoutPadding = (void*)((uintptr_t)(buf + num_bufs*3));
|
||||||
|
|
||||||
|
if (num_bufs > IPC_MAX_BUFFERS)
|
||||||
|
num_bufs = IPC_MAX_BUFFERS;
|
||||||
|
|
||||||
|
for (i=0; i<num_bufs; i++, buf+=3) {
|
||||||
|
IpcBufferDescriptor* desc = (IpcBufferDescriptor*) buf;
|
||||||
|
u64 packed = (u64) desc->Packed;
|
||||||
|
|
||||||
|
r->Buffers[i] = (void*) (desc->Addr | ((packed >> 28) << 32) | (((packed >> 2) & 15) << 36));
|
||||||
|
r->BufferSizes[i] = desc->Size;
|
||||||
|
r->BufferTypes[i] = (BufferType) (packed & 3);
|
||||||
|
|
||||||
|
if (i < num_bufs_send)
|
||||||
|
r->BufferDirections[i] = BufferDirection_Send;
|
||||||
|
else if (i < (num_bufs_send + num_bufs_recv))
|
||||||
|
r->BufferDirections[i] = BufferDirection_Recv;
|
||||||
|
else
|
||||||
|
r->BufferDirections[i] = BufferDirection_Exch;
|
||||||
|
}
|
||||||
|
|
||||||
|
r->NumBuffers = num_bufs;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Queries the size of an IPC pointer buffer.
|
||||||
|
* @param session IPC session handle.
|
||||||
|
* @param size Output variable in which to store the size.
|
||||||
|
* @return Result code.
|
||||||
|
*/
|
||||||
|
static inline Result ipcQueryPointerBufferSize(Handle session, size_t *size) {
|
||||||
|
u32* buf = (u32*)armGetTls();
|
||||||
|
|
||||||
|
buf[0] = IpcCommandType_Control;
|
||||||
|
buf[1] = 8;
|
||||||
|
buf[2] = 0;
|
||||||
|
buf[3] = 0;
|
||||||
|
buf[4] = SFCI_MAGIC;
|
||||||
|
buf[5] = 0;
|
||||||
|
buf[6] = 3;
|
||||||
|
buf[7] = 0;
|
||||||
|
|
||||||
|
Result rc = ipcDispatch(session);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) {
|
||||||
|
IpcParsedCommand r;
|
||||||
|
ipcParse(&r);
|
||||||
|
|
||||||
|
struct ipcQueryPointerBufferSizeResponse {
|
||||||
|
u64 magic;
|
||||||
|
u64 result;
|
||||||
|
u32 size;
|
||||||
|
} *raw = (struct ipcQueryPointerBufferSizeResponse*)r.Raw;
|
||||||
|
|
||||||
|
rc = raw->result;
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) {
|
||||||
|
*size = raw->size & 0xffff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Closes the IPC session with proper clean up.
|
||||||
|
* @param session IPC session handle.
|
||||||
|
* @return Result code.
|
||||||
|
*/
|
||||||
|
static inline Result ipcCloseSession(Handle session) {
|
||||||
|
u32* buf = (u32*)armGetTls();
|
||||||
|
buf[0] = IpcCommandType_Close;
|
||||||
|
buf[1] = 0;
|
||||||
|
return ipcDispatch(session);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clones an IPC session.
|
||||||
|
* @param session IPC session handle.
|
||||||
|
* @param unk Unknown.
|
||||||
|
* @param new_session_out Output cloned IPC session handle.
|
||||||
|
* @return Result code.
|
||||||
|
*/
|
||||||
|
static inline Result ipcCloneSession(Handle session, u32 unk, Handle* new_session_out) {
|
||||||
|
u32* buf = (u32*)armGetTls();
|
||||||
|
|
||||||
|
buf[0] = IpcCommandType_Control;
|
||||||
|
buf[1] = 9;
|
||||||
|
buf[2] = 0;
|
||||||
|
buf[3] = 0;
|
||||||
|
buf[4] = SFCI_MAGIC;
|
||||||
|
buf[5] = 0;
|
||||||
|
buf[6] = 4;
|
||||||
|
buf[7] = 0;
|
||||||
|
buf[8] = unk;
|
||||||
|
|
||||||
|
Result rc = ipcDispatch(session);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) {
|
||||||
|
IpcParsedCommand r;
|
||||||
|
ipcParse(&r);
|
||||||
|
|
||||||
|
struct ipcCloneSessionResponse {
|
||||||
|
u64 magic;
|
||||||
|
u64 result;
|
||||||
|
} *raw = (struct ipcCloneSessionResponse*)r.Raw;
|
||||||
|
|
||||||
|
rc = raw->result;
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc) && new_session_out) {
|
||||||
|
*new_session_out = r.Handles[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
///@}
|
||||||
|
|
||||||
|
///@name IPC domain handling
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Converts an IPC session handle into a domain.
|
||||||
|
* @param session IPC session handle.
|
||||||
|
* @param object_id_out Output variable in which to store the object ID.
|
||||||
|
* @return Result code.
|
||||||
|
*/
|
||||||
|
static inline Result ipcConvertSessionToDomain(Handle session, u32* object_id_out) {
|
||||||
|
u32* buf = (u32*)armGetTls();
|
||||||
|
|
||||||
|
buf[0] = IpcCommandType_Control;
|
||||||
|
buf[1] = 8;
|
||||||
|
buf[4] = SFCI_MAGIC;
|
||||||
|
buf[5] = 0;
|
||||||
|
buf[6] = 0;
|
||||||
|
buf[7] = 0;
|
||||||
|
|
||||||
|
Result rc = ipcDispatch(session);
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) {
|
||||||
|
IpcParsedCommand r;
|
||||||
|
ipcParse(&r);
|
||||||
|
|
||||||
|
struct ipcConvertSessionToDomainResponse {
|
||||||
|
u64 magic;
|
||||||
|
u64 result;
|
||||||
|
u32 object_id;
|
||||||
|
} *raw = (struct ipcConvertSessionToDomainResponse*)r.Raw;
|
||||||
|
|
||||||
|
rc = raw->result;
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) {
|
||||||
|
*object_id_out = raw->object_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Adds an object ID to be sent through an IPC domain command structure.
|
||||||
|
* @param cmd IPC domain command structure.
|
||||||
|
* @param object_id Object ID to send.
|
||||||
|
*/
|
||||||
|
static inline void ipcSendObjectId(IpcCommand* cmd, u32 object_id) {
|
||||||
|
cmd->ObjectIds[cmd->NumObjectIds++] = object_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Prepares the header of an IPC command structure (domain version).
|
||||||
|
* @param cmd IPC command structure.
|
||||||
|
* @param sizeof_raw Size in bytes of the raw data structure to embed inside the IPC request
|
||||||
|
* @param object_id Domain object ID.
|
||||||
|
* @return Pointer to the raw embedded data structure in the request, ready to be filled out.
|
||||||
|
*/
|
||||||
|
static inline void* ipcPrepareHeaderForDomain(IpcCommand* cmd, size_t sizeof_raw, u32 object_id) {
|
||||||
|
void* raw = ipcPrepareHeader(cmd, sizeof_raw + sizeof(DomainMessageHeader) + cmd->NumObjectIds*sizeof(u32));
|
||||||
|
DomainMessageHeader* hdr = (DomainMessageHeader*) raw;
|
||||||
|
u32 *object_ids = (u32*)(((uintptr_t) raw) + sizeof(DomainMessageHeader) + sizeof_raw);
|
||||||
|
|
||||||
|
hdr->Type = DomainMessageType_SendMessage;
|
||||||
|
hdr->NumObjectIds = (u8)cmd->NumObjectIds;
|
||||||
|
hdr->Length = sizeof_raw;
|
||||||
|
hdr->ThisObjectId = object_id;
|
||||||
|
hdr->Pad[0] = hdr->Pad[1] = 0;
|
||||||
|
|
||||||
|
for(size_t i = 0; i < cmd->NumObjectIds; i++)
|
||||||
|
object_ids[i] = cmd->ObjectIds[i];
|
||||||
|
return (void*)(((uintptr_t) raw) + sizeof(DomainMessageHeader));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Parse an IPC command request into an IPC parsed command structure (domain version).
|
||||||
|
* @param r IPC parsed command structure to fill in.
|
||||||
|
* @return Result code.
|
||||||
|
*/
|
||||||
|
static inline Result ipcParseDomainRequest(IpcParsedCommand* r) {
|
||||||
|
Result rc = ipcParse(r);
|
||||||
|
DomainMessageHeader *hdr;
|
||||||
|
u32 *object_ids;
|
||||||
|
if(R_FAILED(rc))
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
hdr = (DomainMessageHeader*) r->Raw;
|
||||||
|
object_ids = (u32*)(((uintptr_t) hdr) + sizeof(DomainMessageHeader) + hdr->Length);
|
||||||
|
r->Raw = (void*)(((uintptr_t) r->Raw) + sizeof(DomainMessageHeader));
|
||||||
|
|
||||||
|
r->IsDomainRequest = true;
|
||||||
|
r->InMessageType = (DomainMessageType)(hdr->Type);
|
||||||
|
switch (r->InMessageType) {
|
||||||
|
case DomainMessageType_SendMessage:
|
||||||
|
case DomainMessageType_Close:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return MAKERESULT(Module_Libnx, LibnxError_DomainMessageUnknownType);
|
||||||
|
}
|
||||||
|
|
||||||
|
r->InThisObjectId = hdr->ThisObjectId;
|
||||||
|
r->InNumObjectIds = hdr->NumObjectIds > 8 ? 8 : hdr->NumObjectIds;
|
||||||
|
if ((uintptr_t)object_ids + sizeof(u32) * r->InNumObjectIds - (uintptr_t)armGetTls() >= 0x100) {
|
||||||
|
return MAKERESULT(Module_Libnx, LibnxError_DomainMessageTooManyObjectIds);
|
||||||
|
}
|
||||||
|
for(size_t i = 0; i < r->InNumObjectIds; i++)
|
||||||
|
r->InObjectIds[i] = object_ids[i];
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Parse an IPC command response into an IPC parsed command structure (domain version).
|
||||||
|
* @param r IPC parsed command structure to fill in.
|
||||||
|
* @param sizeof_raw Size in bytes of the raw data structure.
|
||||||
|
* @return Result code.
|
||||||
|
*/
|
||||||
|
static inline Result ipcParseDomainResponse(IpcParsedCommand* r, size_t sizeof_raw) {
|
||||||
|
Result rc = ipcParse(r);
|
||||||
|
DomainResponseHeader *hdr;
|
||||||
|
u32 *object_ids;
|
||||||
|
if(R_FAILED(rc))
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
hdr = (DomainResponseHeader*) r->Raw;
|
||||||
|
r->Raw = (void*)(((uintptr_t) r->Raw) + sizeof(DomainResponseHeader));
|
||||||
|
object_ids = (u32*)(((uintptr_t) r->Raw) + sizeof_raw);//Official sw doesn't align this.
|
||||||
|
|
||||||
|
r->IsDomainResponse = true;
|
||||||
|
|
||||||
|
r->OutNumObjectIds = hdr->NumObjectIds > 8 ? 8 : hdr->NumObjectIds;
|
||||||
|
if ((uintptr_t)object_ids + sizeof(u32) * r->OutNumObjectIds - (uintptr_t)armGetTls() >= 0x100) {
|
||||||
|
return MAKERESULT(Module_Libnx, LibnxError_DomainMessageTooManyObjectIds);
|
||||||
|
}
|
||||||
|
for(size_t i = 0; i < r->OutNumObjectIds; i++)
|
||||||
|
r->OutObjectIds[i] = object_ids[i];
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Closes a domain object by ID.
|
||||||
|
* @param session IPC session handle.
|
||||||
|
* @param object_id ID of the object to close.
|
||||||
|
* @return Result code.
|
||||||
|
*/
|
||||||
|
static inline Result ipcCloseObjectById(Handle session, u32 object_id) {
|
||||||
|
IpcCommand c;
|
||||||
|
DomainMessageHeader* hdr;
|
||||||
|
|
||||||
|
ipcInitialize(&c);
|
||||||
|
hdr = (DomainMessageHeader*)ipcPrepareHeader(&c, sizeof(DomainMessageHeader));
|
||||||
|
|
||||||
|
hdr->Type = DomainMessageType_Close;
|
||||||
|
hdr->NumObjectIds = 0;
|
||||||
|
hdr->Length = 0;
|
||||||
|
hdr->ThisObjectId = object_id;
|
||||||
|
hdr->Pad[0] = hdr->Pad[1] = 0;
|
||||||
|
|
||||||
|
return ipcDispatch(session); // this command has no associated response
|
||||||
|
}
|
||||||
|
|
||||||
|
///@}
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
/*
|
||||||
|
* Fuel gauge driver for Nintendo Switch's Maxim 17050
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011 Samsung Electronics
|
||||||
|
* MyungJoo Ham <myungjoo.ham@samsung.com>
|
||||||
|
* Copyright (c) 2018-2020 CTCaer
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Modified by: MasaGratoR
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __MAX17050_H_
|
||||||
|
#define __MAX17050_H_
|
||||||
|
|
||||||
|
//#include <utils/types.h>
|
||||||
|
#include "i2c.h"
|
||||||
|
|
||||||
|
/* Board default values */
|
||||||
|
#define MAX17050_BOARD_CGAIN 2 /* Actual: 1.99993 */
|
||||||
|
#define MAX17050_BOARD_SNS_RESISTOR_UOHM 5000 /* 0.005 Ohm */
|
||||||
|
|
||||||
|
//#define MAX17050_STATUS_BattAbsent BIT(3)
|
||||||
|
|
||||||
|
/* Consider RepCap which is less then 10 units below FullCAP full */
|
||||||
|
/*
|
||||||
|
#define MAX17050_FULL_THRESHOLD 10
|
||||||
|
|
||||||
|
#define MAX17050_CHARACTERIZATION_DATA_SIZE 48
|
||||||
|
|
||||||
|
#define MAXIM17050_I2C_ADDR 0x36
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MAX17050_WAIT_NS 1000000000
|
||||||
|
|
||||||
|
constexpr float max17050SenseResistor = MAX17050_BOARD_SNS_RESISTOR_UOHM / 1000; // in uOhm
|
||||||
|
constexpr float max17050CGain = 1.99993;
|
||||||
|
|
||||||
|
|
||||||
|
enum MAX17050_reg {
|
||||||
|
MAX17050_STATUS = 0x00,
|
||||||
|
MAX17050_VALRT_Th = 0x01,
|
||||||
|
MAX17050_TALRT_Th = 0x02,
|
||||||
|
MAX17050_SALRT_Th = 0x03,
|
||||||
|
MAX17050_AtRate = 0x04,
|
||||||
|
MAX17050_RepCap = 0x05,
|
||||||
|
MAX17050_RepSOC = 0x06,
|
||||||
|
MAX17050_Age = 0x07,
|
||||||
|
MAX17050_TEMP = 0x08,
|
||||||
|
MAX17050_VCELL = 0x09,
|
||||||
|
MAX17050_Current = 0x0A,
|
||||||
|
MAX17050_AvgCurrent = 0x0B,
|
||||||
|
|
||||||
|
MAX17050_SOC = 0x0D,
|
||||||
|
MAX17050_AvSOC = 0x0E,
|
||||||
|
MAX17050_RemCap = 0x0F,
|
||||||
|
MAX17050_FullCAP = 0x10,
|
||||||
|
MAX17050_TTE = 0x11,
|
||||||
|
MAX17050_QRTbl00 = 0x12,
|
||||||
|
MAX17050_FullSOCThr = 0x13,
|
||||||
|
MAX17050_RSLOW = 0x14,
|
||||||
|
|
||||||
|
MAX17050_AvgTA = 0x16,
|
||||||
|
MAX17050_Cycles = 0x17,
|
||||||
|
MAX17050_DesignCap = 0x18,
|
||||||
|
MAX17050_AvgVCELL = 0x19,
|
||||||
|
MAX17050_MinMaxTemp = 0x1A,
|
||||||
|
MAX17050_MinMaxVolt = 0x1B,
|
||||||
|
MAX17050_MinMaxCurr = 0x1C,
|
||||||
|
MAX17050_CONFIG = 0x1D,
|
||||||
|
MAX17050_ICHGTerm = 0x1E,
|
||||||
|
MAX17050_AvCap = 0x1F,
|
||||||
|
MAX17050_ManName = 0x20,
|
||||||
|
MAX17050_DevName = 0x21,
|
||||||
|
MAX17050_QRTbl10 = 0x22,
|
||||||
|
MAX17050_FullCAPNom = 0x23,
|
||||||
|
MAX17050_TempNom = 0x24,
|
||||||
|
MAX17050_TempLim = 0x25,
|
||||||
|
MAX17050_TempHot = 0x26,
|
||||||
|
MAX17050_AIN = 0x27,
|
||||||
|
MAX17050_LearnCFG = 0x28,
|
||||||
|
MAX17050_FilterCFG = 0x29,
|
||||||
|
MAX17050_RelaxCFG = 0x2A,
|
||||||
|
MAX17050_MiscCFG = 0x2B,
|
||||||
|
MAX17050_TGAIN = 0x2C,
|
||||||
|
MAX17050_TOFF = 0x2D,
|
||||||
|
MAX17050_CGAIN = 0x2E,
|
||||||
|
MAX17050_COFF = 0x2F,
|
||||||
|
|
||||||
|
MAX17050_QRTbl20 = 0x32,
|
||||||
|
MAX17050_SOC_empty = 0x33,
|
||||||
|
MAX17050_T_empty = 0x34,
|
||||||
|
MAX17050_FullCAP0 = 0x35,
|
||||||
|
MAX17050_LAvg_empty = 0x36,
|
||||||
|
MAX17050_FCTC = 0x37,
|
||||||
|
MAX17050_RCOMP0 = 0x38,
|
||||||
|
MAX17050_TempCo = 0x39,
|
||||||
|
MAX17050_V_empty = 0x3A,
|
||||||
|
MAX17050_K_empty0 = 0x3B,
|
||||||
|
MAX17050_TaskPeriod = 0x3C,
|
||||||
|
MAX17050_FSTAT = 0x3D,
|
||||||
|
MAX17050_TIMER = 0x3E,
|
||||||
|
MAX17050_SHDNTIMER = 0x3F,
|
||||||
|
|
||||||
|
MAX17050_QRTbl30 = 0x42,
|
||||||
|
|
||||||
|
MAX17050_dQacc = 0x45,
|
||||||
|
MAX17050_dPacc = 0x46,
|
||||||
|
|
||||||
|
MAX17050_VFSOC0 = 0x48,
|
||||||
|
|
||||||
|
Max17050_QH0 = 0x4C,
|
||||||
|
MAX17050_QH = 0x4D,
|
||||||
|
MAX17050_QL = 0x4E,
|
||||||
|
|
||||||
|
MAX17050_MinVolt = 0x50, // Custom ID. Not to be sent to i2c.
|
||||||
|
MAX17050_MaxVolt = 0x51, // Custom ID. Not to be sent to i2c.
|
||||||
|
|
||||||
|
MAX17050_VFSOC0Enable = 0x60,
|
||||||
|
MAX17050_MODELEnable1 = 0x62,
|
||||||
|
MAX17050_MODELEnable2 = 0x63,
|
||||||
|
|
||||||
|
MAX17050_MODELChrTbl = 0x80,
|
||||||
|
|
||||||
|
MAX17050_OCV = 0xEE,
|
||||||
|
|
||||||
|
MAX17050_OCVInternal = 0xFB,
|
||||||
|
|
||||||
|
MAX17050_VFSOC = 0xFF,
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
int max17050_get_property(enum MAX17050_reg reg, int *value);
|
||||||
|
int max17050_fix_configuration();
|
||||||
|
u32 max17050_get_cached_batt_volt();
|
||||||
|
*/
|
||||||
|
#endif /* __MAX17050_H_ */
|
||||||
|
|
||||||
|
Result Max17050ReadReg(u8 reg, u16 *out)
|
||||||
|
{
|
||||||
|
u16 data = 0;
|
||||||
|
Result res = I2cReadRegHandler16(reg, I2cDevice_Max17050, &data);
|
||||||
|
|
||||||
|
if (R_FAILED(res))
|
||||||
|
{
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
*out = data;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
typedef enum {
|
||||||
|
PcvPowerDomain_Max77620_Sd0 = 0,
|
||||||
|
PcvPowerDomain_Max77620_Sd1 = 1,
|
||||||
|
PcvPowerDomain_Max77620_Sd2 = 2,
|
||||||
|
PcvPowerDomain_Max77620_Sd3 = 3,
|
||||||
|
PcvPowerDomain_Max77620_Ldo0 = 4,
|
||||||
|
PcvPowerDomain_Max77620_Ldo1 = 5,
|
||||||
|
PcvPowerDomain_Max77620_Ldo2 = 6,
|
||||||
|
PcvPowerDomain_Max77620_Ldo3 = 7,
|
||||||
|
PcvPowerDomain_Max77620_Ldo4 = 8,
|
||||||
|
PcvPowerDomain_Max77620_Ldo5 = 9,
|
||||||
|
PcvPowerDomain_Max77620_Ldo6 = 10,
|
||||||
|
PcvPowerDomain_Max77620_Ldo7 = 11,
|
||||||
|
PcvPowerDomain_Max77620_Ldo8 = 12,
|
||||||
|
PcvPowerDomain_Max77621_Cpu = 13,
|
||||||
|
PcvPowerDomain_Max77621_Gpu = 14,
|
||||||
|
PcvPowerDomain_Max77812_Cpu = 15,
|
||||||
|
PcvPowerDomain_Max77812_Gpu = 16,
|
||||||
|
PcvPowerDomain_Max77812_Dram = 17,
|
||||||
|
} PowerDomain;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
PcvPowerDomainId_Max77620_Sd0 = 0x3A000080,
|
||||||
|
PcvPowerDomainId_Max77620_Sd1 = 0x3A000081,
|
||||||
|
PcvPowerDomainId_Max77620_Sd2 = 0x3A000082,
|
||||||
|
PcvPowerDomainId_Max77620_Sd3 = 0x3A000083,
|
||||||
|
PcvPowerDomainId_Max77620_Ldo0 = 0x3A0000A0,
|
||||||
|
PcvPowerDomainId_Max77620_Ldo1 = 0x3A0000A1,
|
||||||
|
PcvPowerDomainId_Max77620_Ldo2 = 0x3A0000A2,
|
||||||
|
PcvPowerDomainId_Max77620_Ldo3 = 0x3A0000A3,
|
||||||
|
PcvPowerDomainId_Max77620_Ldo4 = 0x3A0000A4,
|
||||||
|
PcvPowerDomainId_Max77620_Ldo5 = 0x3A0000A5,
|
||||||
|
PcvPowerDomainId_Max77620_Ldo6 = 0x3A0000A6,
|
||||||
|
PcvPowerDomainId_Max77620_Ldo7 = 0x3A0000A7,
|
||||||
|
PcvPowerDomainId_Max77620_Ldo8 = 0x3A0000A8,
|
||||||
|
PcvPowerDomainId_Max77621_Cpu = 0x3A000003,
|
||||||
|
PcvPowerDomainId_Max77621_Gpu = 0x3A000004,
|
||||||
|
PcvPowerDomainId_Max77812_Cpu = 0x3A000003,
|
||||||
|
PcvPowerDomainId_Max77812_Gpu = 0x3A000004,
|
||||||
|
PcvPowerDomainId_Max77812_Dram = 0x3A000005,
|
||||||
|
} PowerDomainId;
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <switch.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Service s;
|
||||||
|
} PwmChannelSession;
|
||||||
|
|
||||||
|
Result pwmInitialize(void);
|
||||||
|
void pwmExit(void);
|
||||||
|
Service* pwmGetServiceSession(void);
|
||||||
|
Result pwmOpenSession2(PwmChannelSession *out, u32 device_code);
|
||||||
|
Result pwmChannelSessionGetDutyCycle(PwmChannelSession *c, double* out);
|
||||||
|
void pwmChannelSessionClose(PwmChannelSession *c);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <switch.h>
|
||||||
|
#include "pcv_types.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Service s;
|
||||||
|
} RgltrSession;
|
||||||
|
|
||||||
|
Result rgltrInitialize(void);
|
||||||
|
|
||||||
|
void rgltrExit(void);
|
||||||
|
|
||||||
|
Service* rgltrGetServiceSession(void);
|
||||||
|
|
||||||
|
Result rgltrOpenSession(RgltrSession* session_out, PowerDomainId module_id);
|
||||||
|
void rgltrCloseSession(RgltrSession* session);
|
||||||
|
Result rgltrGetVoltage(RgltrSession* session, u32 *out_volt);
|
||||||
|
Result rgltrGetPowerModuleNumLimit(u32 *out);
|
||||||
|
Result rgltrGetVoltageEnabled(RgltrSession* session, u32 *out);
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
// rgltr_services.h
|
||||||
|
// ========
|
||||||
|
// Minimal header declarations for rgltr‐related functionality.
|
||||||
|
// Any file that wants to call rgltrOpenSession(), rgltrGetVoltage(), etc. should
|
||||||
|
// simply do `#include "infonx.h"` (NOT infonx.cpp).
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <switch.h> // for Service, Result, hosversionBefore(), smGetService(), serviceClose(), etc.
|
||||||
|
#include "rgltr.h" // for RgltrSession, PowerDomainId, etc.
|
||||||
|
|
||||||
|
// Global service handle for "rgltr". Defined in infonx.cpp.
|
||||||
|
extern Service g_rgltrSrv;
|
||||||
|
|
||||||
|
// Open/close the "rgltr" service. You must call rgltrInitialize() (once) before using
|
||||||
|
// rgltrOpenSession() & friends. Call rgltrExit() when your app is shutting down.
|
||||||
|
Result rgltrInitialize(void);
|
||||||
|
void rgltrExit(void);
|
||||||
|
|
||||||
|
// Open a regulator session for the given PowerDomainId (e.g. CPU, GPU, DRAM).
|
||||||
|
// On success, (*session_out).s will contain a valid Service handle.
|
||||||
|
Result rgltrOpenSession(RgltrSession* session_out, PowerDomainId module_id);
|
||||||
|
|
||||||
|
// Query the current voltage (in microvolts, µV) from a previously opened session.
|
||||||
|
// Writes the result into *out_volt.
|
||||||
|
Result rgltrGetVoltage(RgltrSession* session, u32* out_volt);
|
||||||
|
|
||||||
|
// Close a previously opened regulator session.
|
||||||
|
void rgltrCloseSession(RgltrSession* session);
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
* SOC/PCB Temperature driver for Nintendo Switch's TI TMP451
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 CTCaer
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Modified by: MasaGratoR
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __TMP451_H_
|
||||||
|
#define __TMP451_H_
|
||||||
|
|
||||||
|
//#include <utils/types.h>
|
||||||
|
#include "i2c.h"
|
||||||
|
|
||||||
|
//#define TMP451_I2C_ADDR 0x4C
|
||||||
|
|
||||||
|
#define TMP451_PCB_TEMP_REG 0x00
|
||||||
|
#define TMP451_SOC_TEMP_REG 0x01
|
||||||
|
|
||||||
|
/*
|
||||||
|
#define TMP451_CONFIG_REG 0x09
|
||||||
|
#define TMP451_CNV_RATE_REG 0x0A
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define TMP451_SOC_TEMP_DEC_REG 0x10
|
||||||
|
#define TMP451_PCB_TEMP_DEC_REG 0x15
|
||||||
|
|
||||||
|
/*
|
||||||
|
#define TMP451_SOC_TMP_OFH_REG 0x11
|
||||||
|
#define TMP451_SOC_TMP_OFL_REG 0x12
|
||||||
|
*/
|
||||||
|
|
||||||
|
// If input is false, the return value is packed. MSByte is the integer in oC
|
||||||
|
// and the LSByte is the decimal point truncated to 2 decimal places.
|
||||||
|
// Otherwise it's an integer oC.
|
||||||
|
/*
|
||||||
|
u16 tmp451_get_soc_temp(bool integer);
|
||||||
|
u16 tmp451_get_pcb_temp(bool integer);
|
||||||
|
void tmp451_init();
|
||||||
|
void tmp451_end();
|
||||||
|
*/
|
||||||
|
|
||||||
|
Result Tmp451ReadReg(u8 reg, u8 *out)
|
||||||
|
{
|
||||||
|
u8 data = 0;
|
||||||
|
Result res = I2cReadRegHandler8(reg, I2cDevice_Tmp451, &data);
|
||||||
|
|
||||||
|
if (R_FAILED(res))
|
||||||
|
{
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
*out = data;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Tmp451GetSocTemp(float* temperature) {
|
||||||
|
u8 integer = 0;
|
||||||
|
u8 decimals = 0;
|
||||||
|
|
||||||
|
Result rc = Tmp451ReadReg(TMP451_SOC_TEMP_REG, &integer);
|
||||||
|
if (R_FAILED(rc))
|
||||||
|
return rc;
|
||||||
|
rc = Tmp451ReadReg(TMP451_SOC_TEMP_DEC_REG, &decimals);
|
||||||
|
if (R_FAILED(rc))
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
decimals = ((u16)(decimals >> 4) * 625) / 100;
|
||||||
|
*temperature = (float)(integer) + ((float)(decimals) / 100);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result Tmp451GetPcbTemp(float* temperature) {
|
||||||
|
u8 integer = 0;
|
||||||
|
u8 decimals = 0;
|
||||||
|
|
||||||
|
Result rc = Tmp451ReadReg(TMP451_PCB_TEMP_REG, &integer);
|
||||||
|
if (R_FAILED(rc))
|
||||||
|
return rc;
|
||||||
|
rc = Tmp451ReadReg(TMP451_PCB_TEMP_DEC_REG, &decimals);
|
||||||
|
if (R_FAILED(rc))
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
decimals = ((u16)(decimals >> 4) * 625) / 100;
|
||||||
|
*temperature = (float)(integer) + ((float)(decimals) / 100);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __TMP451_H_ */
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
{
|
||||||
|
"Horizon OC Monitor": "Horizon OC Monitor",
|
||||||
|
"Modes": "Modi",
|
||||||
|
"Modes Configure": "Modi Konfigurieren",
|
||||||
|
"Full": "Voll",
|
||||||
|
"Mini": "Mini",
|
||||||
|
"Micro": "Mikro",
|
||||||
|
"FPS Graph": "FPS-Diagramm",
|
||||||
|
"FPS Counter": "FPS-Zähler",
|
||||||
|
"Game Resolutions": "Spielauflösungen",
|
||||||
|
"Other": "Sonstiges",
|
||||||
|
"Battery/Charger": "Akku/Ladegerät",
|
||||||
|
"Miscellaneous": "Verschiedenes",
|
||||||
|
"CPU Usage": "CPU-Auslastung",
|
||||||
|
"GPU Usage": "GPU-Auslastung",
|
||||||
|
"RAM Usage": "RAM-Auslastung",
|
||||||
|
"Target Frequency": "Ziel-Frequenz",
|
||||||
|
"Real Frequency": "Aktuelle Frequenz",
|
||||||
|
"Core 0 ": "Kern 0 ",
|
||||||
|
"Core 1 ": "Kern 1 ",
|
||||||
|
"Core 2 ": "Kern 2 ",
|
||||||
|
"Core 3 ": "Kern 3 ",
|
||||||
|
"Load": "Auslastung",
|
||||||
|
"Total\nApplication\nApplet\nSystem\nSystem Unsafe": "Gesamt\nAnwendung\nApplet\nSystem\nSystem (unsicher)",
|
||||||
|
"Board": "Board",
|
||||||
|
"Battery Power Flow": "Akkuleistungsfluss",
|
||||||
|
"\nTemperatures": "\nTemperaturen",
|
||||||
|
"SoC\nPCB\nSkin": "SoC\nPCB\nSkin",
|
||||||
|
"Fan Rotation Level": "Lüfterdrehzahl",
|
||||||
|
"Game": "Spiel",
|
||||||
|
"PFPS ": "PFPS ",
|
||||||
|
"FPS ": "FPS ",
|
||||||
|
"Resolutions ": "Auflösungen ",
|
||||||
|
"Read Speed ": "Lesegeschwindigkeit ",
|
||||||
|
"Press ": "Drücke ",
|
||||||
|
" to Exit": " zum Beenden",
|
||||||
|
"Depth": "Tiefe",
|
||||||
|
"Viewport": "Viewport",
|
||||||
|
"Game is not running\nor it's incompatible.": "Spiel läuft nicht\noder ist inkompatibel.",
|
||||||
|
"Battery Stats": "Akkustatistiken",
|
||||||
|
"Actual Capacity": "Aktuelle Kapazität",
|
||||||
|
"Designed Capacity": "Nennkapazität",
|
||||||
|
"Temperature": "Temperatur",
|
||||||
|
"Raw Charge": "Rohladung",
|
||||||
|
"Age": "Alter",
|
||||||
|
"Voltage": "Spannung",
|
||||||
|
"Current Flow": "Stromfluss",
|
||||||
|
"Power Flow": "Leistungsfluss",
|
||||||
|
"Remaining Time": "Verbleibende Zeit",
|
||||||
|
"Charger Stats": "Ladegerät-Statistiken",
|
||||||
|
"Input Current Limit": "Eingangsstrombegrenzung",
|
||||||
|
"VBUS Current Limit": "VBUS-Strombegrenzung",
|
||||||
|
"Voltage Limit": "Spannungsbegrenzung",
|
||||||
|
"Current Limit": "Strombegrenzung",
|
||||||
|
"Type": "Typ",
|
||||||
|
"Max Voltage": "Max. Spannung",
|
||||||
|
"Max Current": "Max. Strom",
|
||||||
|
"Multimedia Clock Rates": "Multimedia-Taktraten",
|
||||||
|
"NVDEC": "NVDEC",
|
||||||
|
"NVENC": "NVENC",
|
||||||
|
"NVJPG": "NVJPG",
|
||||||
|
"Network": "Netzwerk",
|
||||||
|
"Type: Wi-Fi": "Typ: Wi-Fi",
|
||||||
|
"Press Y to show password": "Drücke Y, um Passwort anzuzeigen",
|
||||||
|
"Type: Ethernet": "Typ: Ethernet",
|
||||||
|
"Type: Not connected": "Typ: Nicht verbunden",
|
||||||
|
"CPU\nGPU\nRAM\nSOC\nPCB\nSKN": "CPU\nGPU\nRAM\nSOC\nPCB\nSKN",
|
||||||
|
"Elements Move Down Move Up": "Elemente Nach unten Nach oben",
|
||||||
|
"Transparent": "Transparent",
|
||||||
|
"Opaque": "Undurchsichtig",
|
||||||
|
"Alpha": "Alpha",
|
||||||
|
"Pretty": "Hübsch",
|
||||||
|
"Compact": "Kompakt",
|
||||||
|
"FileSafe": "Dateisicher",
|
||||||
|
"Day+Time": "Tag+Uhrzeit",
|
||||||
|
"Date+Time(s)": "Datum+Uhrzeit(s)",
|
||||||
|
"Date+Time AM/PM": "Datum+Uhrzeit AM/PM",
|
||||||
|
"Date+Time(s) AM/PM": "Datum+Uhrzeit(s) AM/PM",
|
||||||
|
"Date+Time EU": "Datum+Uhrzeit EU",
|
||||||
|
"Date+Time EU AM/PM": "Datum+Uhrzeit EU AM/PM",
|
||||||
|
"Date+Time(s) EU AM/PM": "Datum+Uhrzeit(s) EU AM/PM",
|
||||||
|
"Date+Time ISO": "Datum+Uhrzeit ISO",
|
||||||
|
"Time 24h": "Uhrzeit 24h",
|
||||||
|
"Time AM/PM": "Uhrzeit AM/PM",
|
||||||
|
"Time(s) 24h": "Uhrzeit(s) 24h",
|
||||||
|
"Time(s) AM/PM": "Uhrzeit(s) AM/PM",
|
||||||
|
"Date US": "Datum US",
|
||||||
|
"Date EU": "Datum EU",
|
||||||
|
"Date ISO": "Datum ISO",
|
||||||
|
"Date Short": "Datum kurz",
|
||||||
|
"DTC Format": "DTC-Format",
|
||||||
|
"Toggles": "Schalter",
|
||||||
|
"Info": "Info anzeigen",
|
||||||
|
"Disable Screenshots": "Bildschirmfotos deaktivieren",
|
||||||
|
"Real Freqs": "Aktuelle Frequenzen",
|
||||||
|
"Deltas": "Deltas",
|
||||||
|
"Target Freqs": "Ziel-Frequenzen",
|
||||||
|
"FPS": "FPS",
|
||||||
|
"RES": "AUFL",
|
||||||
|
"Read Speed": "Lesegeschwindigkeit",
|
||||||
|
"Real Frequencies": "Aktuelle Frequenzen",
|
||||||
|
"Real Voltages": "Aktuelle Spannungen",
|
||||||
|
"Full CPU": "Volle CPU",
|
||||||
|
"VDDQ": "VDDQ",
|
||||||
|
"VDD2": "VDD2",
|
||||||
|
"Full Resolution": "Volle Auflösung",
|
||||||
|
"SOC Voltage": "SOC-Spannung",
|
||||||
|
"RAM Load CPU/GPU": "RAM-Last CPU/GPU",
|
||||||
|
"Use DTC Symbol": "DTC-Symbol verwenden",
|
||||||
|
"Use Dynamic Colors": "Dynamische Farben verwenden",
|
||||||
|
"Sleep Exit": "Beenden aus Ruhezustand",
|
||||||
|
"Configuration": "Konfiguration",
|
||||||
|
"Refresh Rate": "Bildwiederholrate",
|
||||||
|
"Frame Padding": "Rahmenabstand",
|
||||||
|
" Font Size": " Schriftgröße",
|
||||||
|
"Font Sizes": "Schriftgrößen",
|
||||||
|
"Handheld Font Size": "Handheld-Schriftgröße",
|
||||||
|
"Docked Font Size": "Docked-Schriftgröße",
|
||||||
|
"Black": "Schwarz",
|
||||||
|
"Dark Gray": "Dunkelgrau",
|
||||||
|
"Gray": "Grau",
|
||||||
|
"Light Gray": "Hellgrau",
|
||||||
|
"Silver": "Silber",
|
||||||
|
"White": "Weiß",
|
||||||
|
"Dark Red": "Dunkelrot",
|
||||||
|
"Red": "Rot",
|
||||||
|
"Light Red": "Hellrot",
|
||||||
|
"Pink": "Pink",
|
||||||
|
"Dark Green": "Dunkelgrün",
|
||||||
|
"Green": "Grün",
|
||||||
|
"Lime Green": "Limette",
|
||||||
|
"Light Green": "Hellgrün",
|
||||||
|
"Dark Blue": "Dunkelblau",
|
||||||
|
"Blue": "Blau",
|
||||||
|
"Light Blue": "Hellblau",
|
||||||
|
"Sky Blue": "Himmelblau",
|
||||||
|
"Dark Purple": "Dunkellila",
|
||||||
|
"Purple": "Lila",
|
||||||
|
"Light Purple": "Helllila",
|
||||||
|
"Violet": "Violett",
|
||||||
|
"Orange": "Orange",
|
||||||
|
"Yellow": "Gelb",
|
||||||
|
"Light Yellow": "Hellgelb",
|
||||||
|
"Teal": "Petrol",
|
||||||
|
"Cyan": "Cyan",
|
||||||
|
"Light Cyan": "Hellcyan",
|
||||||
|
"Magenta": "Magenta",
|
||||||
|
"Hot Pink": "Knallpink",
|
||||||
|
"Brown": "Braun",
|
||||||
|
"Light Brown": "Hellbraun",
|
||||||
|
"Colors": "Farben",
|
||||||
|
"Background Color": "Hintergrundfarbe",
|
||||||
|
"Background Alpha": "Hintergrund-Alpha",
|
||||||
|
"Focus Color": "Fokusfarbe",
|
||||||
|
"Focus Alpha": "Fokus-Alpha",
|
||||||
|
"Text Color": "Textfarbe",
|
||||||
|
"Border": "Rahmen",
|
||||||
|
"Dashed Line": "Gestrichelte Linie",
|
||||||
|
"Max FPS Text": "Max-FPS-Text",
|
||||||
|
"Min FPS Text": "Min-FPS-Text",
|
||||||
|
"Main Line": "Hauptlinie",
|
||||||
|
"Rounded Line": "Abgerundete Linie",
|
||||||
|
"Perfect Line": "Perfekte Linie",
|
||||||
|
" Color": " Farbe",
|
||||||
|
" Alpha": " Alpha",
|
||||||
|
"Category Color": "Kategoriefarbe",
|
||||||
|
"Category Color 1": "Kategoriefarbe 1",
|
||||||
|
"Category Color 2": "Kategoriefarbe 2",
|
||||||
|
"Separator Color": "Trennlinienfarbe",
|
||||||
|
"Elements": "Elemente",
|
||||||
|
"Text Alignment": "Textausrichtung",
|
||||||
|
"Vertical Position": "Vertikale Position",
|
||||||
|
"Horizontal Position": "Horizontale Position",
|
||||||
|
"Left": "Links",
|
||||||
|
"Right": "Rechts",
|
||||||
|
"Top": "Oben",
|
||||||
|
"Center": "Mitte",
|
||||||
|
"Bottom": "Unten",
|
||||||
|
"FPS Counter Color": "FPS-Zähler-Farbe",
|
||||||
|
"FPS Counter Alpha": "FPS-Zähler-Alpha",
|
||||||
|
"Border Color": "Rahmenfarbe",
|
||||||
|
"Dashed Line Color": "Gestrichelte-Linie-Farbe",
|
||||||
|
"Dashed Line Alpha": "Gestrichelte-Linie-Alpha",
|
||||||
|
"Max FPS Text Color": "Max-FPS-Textfarbe",
|
||||||
|
"Min FPS Text Color": "Min-FPS-Textfarbe",
|
||||||
|
"Main Line Color": "Hauptlinienfarbe",
|
||||||
|
"Rounded Line Color": "Abgerundete-Linienfarbe",
|
||||||
|
"Perfect Line Color": "Perfekte-Linienfarbe"
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
{
|
||||||
|
"Horizon OC Monitor": "Horizon OC Monitor",
|
||||||
|
"Modes": "Modes",
|
||||||
|
"Modes Configure": "Modes Configure",
|
||||||
|
"Full": "Full",
|
||||||
|
"Mini": "Mini",
|
||||||
|
"Micro": "Micro",
|
||||||
|
"FPS Graph": "FPS Graph",
|
||||||
|
"FPS Counter": "FPS Counter",
|
||||||
|
"Game Resolutions": "Game Resolutions",
|
||||||
|
"Other": "Other",
|
||||||
|
"Battery/Charger": "Battery/Charger",
|
||||||
|
"Miscellaneous": "Miscellaneous",
|
||||||
|
"CPU Usage": "CPU Usage",
|
||||||
|
"GPU Usage": "GPU Usage",
|
||||||
|
"RAM Usage": "RAM Usage",
|
||||||
|
"Target Frequency": "Target Frequency",
|
||||||
|
"Real Frequency": "Real Frequency",
|
||||||
|
"Core 0 ": "Core 0 ",
|
||||||
|
"Core 1 ": "Core 1 ",
|
||||||
|
"Core 2 ": "Core 2 ",
|
||||||
|
"Core 3 ": "Core 3 ",
|
||||||
|
"Load": "Load",
|
||||||
|
"Total\nApplication\nApplet\nSystem\nSystem Unsafe": "Total\nApplication\nApplet\nSystem\nSystem Unsafe",
|
||||||
|
"Board": "Board",
|
||||||
|
"Battery Power Flow": "Battery Power Flow",
|
||||||
|
"\nTemperatures": "\nTemperatures",
|
||||||
|
"SoC\nPCB\nSkin": "SoC\nPCB\nSkin",
|
||||||
|
"Fan Rotation Level": "Fan Rotation Level",
|
||||||
|
"Game": "Game",
|
||||||
|
"PFPS ": "PFPS ",
|
||||||
|
"FPS ": "FPS ",
|
||||||
|
"Resolutions ": "Resolutions ",
|
||||||
|
"Read Speed ": "Read speed ",
|
||||||
|
"Press ": "Press ",
|
||||||
|
" to Exit": " to Exit",
|
||||||
|
"Depth": "Depth",
|
||||||
|
"Viewport": "Viewport",
|
||||||
|
"Game is not running\nor it's incompatible.": "Game is not running\nor it's incompatible.",
|
||||||
|
"Battery Stats": "Battery Stats",
|
||||||
|
"Actual Capacity": "Actual Capacity",
|
||||||
|
"Designed Capacity": "Designed Capacity",
|
||||||
|
"Temperature": "Temperature",
|
||||||
|
"Raw Charge": "Raw Charge",
|
||||||
|
"Age": "Age",
|
||||||
|
"Voltage": "Voltage",
|
||||||
|
"Current Flow": "Current Flow",
|
||||||
|
"Power Flow": "Power Flow",
|
||||||
|
"Remaining Time": "Remaining Time",
|
||||||
|
"Charger Stats": "Charger Stats",
|
||||||
|
"Input Current Limit": "Input Current Limit",
|
||||||
|
"VBUS Current Limit": "VBUS Current Limit",
|
||||||
|
"Voltage Limit": "Voltage Limit",
|
||||||
|
"Current Limit": "Current Limit",
|
||||||
|
"Type": "Type",
|
||||||
|
"Max Voltage": "Max Voltage",
|
||||||
|
"Max Current": "Max Current",
|
||||||
|
"Multimedia Clock Rates": "Multimedia Clock Rates",
|
||||||
|
"NVDEC": "NVDEC",
|
||||||
|
"NVENC": "NVENC",
|
||||||
|
"NVJPG": "NVJPG",
|
||||||
|
"Network": "Network",
|
||||||
|
"Type: Wi-Fi": "Type: Wi-Fi",
|
||||||
|
"Press Y to show password": "Press Y to show password",
|
||||||
|
"Type: Ethernet": "Type: Ethernet",
|
||||||
|
"Type: Not connected": "Tipo: Not connected",
|
||||||
|
"CPU\nGPU\nRAM\nSOC\nPCB\nSKN": "CPU\nGPU\nRAM\nSOC\nPCB\nSKN",
|
||||||
|
"Elements Move Down Move Up": "Elements Move Down Move Up",
|
||||||
|
"Transparent": "Transparent",
|
||||||
|
"Opaque": "Opaque",
|
||||||
|
"Alpha": "Alpha",
|
||||||
|
"Pretty": "Pretty",
|
||||||
|
"Compact": "Compact",
|
||||||
|
"FileSafe": "FileSafe",
|
||||||
|
"Day+Time": "Day+Time",
|
||||||
|
"Date+Time(s)": "Date+Time(s)",
|
||||||
|
"Date+Time AM/PM": "Date+Time AM/PM",
|
||||||
|
"Date+Time(s) AM/PM": "Date+Time(s) AM/PM",
|
||||||
|
"Date+Time EU": "Date+Time EU",
|
||||||
|
"Date+Time EU AM/PM": "Date+Time EU AM/PM",
|
||||||
|
"Date+Time(s) EU AM/PM": "Date+Time(s) EU AM/PM",
|
||||||
|
"Date+Time ISO": "Date+Time ISO",
|
||||||
|
"Time 24h": "Time 24h",
|
||||||
|
"Time AM/PM": "Time AM/PM",
|
||||||
|
"Time(s) 24h": "Time(s) 24h",
|
||||||
|
"Time(s) AM/PM": "Time(s) AM/PM",
|
||||||
|
"Date US": "Date US",
|
||||||
|
"Date EU": "Date EU",
|
||||||
|
"Date ISO": "Date ISO",
|
||||||
|
"Date Short": "Date Short",
|
||||||
|
"DTC Format": "DTC Format",
|
||||||
|
"Toggles": "Toggles",
|
||||||
|
"Info": "Show Info",
|
||||||
|
"Disable Screenshots": "Disable Screenshots",
|
||||||
|
"Real Freqs": "Real Freqs",
|
||||||
|
"Deltas": "Deltas",
|
||||||
|
"Target Freqs": "Target Freqs",
|
||||||
|
"FPS": "FPS",
|
||||||
|
"RES": "RES",
|
||||||
|
"Read Speed": "Read Speed",
|
||||||
|
"Real Frequencies": "Real Frequencies",
|
||||||
|
"Real Voltages": "Real Voltages",
|
||||||
|
"Full CPU": "Full CPU",
|
||||||
|
"VDDQ": "VDDQ",
|
||||||
|
"VDD2": "VDD2",
|
||||||
|
"Full Resolution": "Full Resolution",
|
||||||
|
"SOC Voltage": "SOC Voltage",
|
||||||
|
"RAM Load CPU/GPU": "RAM Load CPU/GPU",
|
||||||
|
"Use DTC Symbol": "Use DTC Symbol",
|
||||||
|
"Use Dynamic Colors": "Use Dynamic Colors",
|
||||||
|
"Sleep Exit": "Sleep Exit",
|
||||||
|
"Configuration": "Configuration",
|
||||||
|
"Refresh Rate": "Refresh Rate",
|
||||||
|
"Frame Padding": "Frame Padding",
|
||||||
|
" Font Size": " Font Size",
|
||||||
|
"Font Sizes": "Font Sizes",
|
||||||
|
"Handheld Font Size": "Handheld Font Size",
|
||||||
|
"Docked Font Size": "Docked Font Size",
|
||||||
|
"Black": "Black",
|
||||||
|
"Dark Gray": "Dark Gray",
|
||||||
|
"Gray": "Gray",
|
||||||
|
"Light Gray": "Light Gray",
|
||||||
|
"Silver": "Silver",
|
||||||
|
"White": "White",
|
||||||
|
"Dark Red": "Dark Red",
|
||||||
|
"Red": "Red",
|
||||||
|
"Light Red": "Light Red",
|
||||||
|
"Pink": "Pink",
|
||||||
|
"Dark Green": "Dark Green",
|
||||||
|
"Green": "Green",
|
||||||
|
"Lime Green": "Lime Green",
|
||||||
|
"Light Green": "Light Green",
|
||||||
|
"Dark Blue": "Dark Blue",
|
||||||
|
"Blue": "Blue",
|
||||||
|
"Light Blue": "Light Blue",
|
||||||
|
"Sky Blue": "Sky Blue",
|
||||||
|
"Dark Purple": "Dark Purple",
|
||||||
|
"Purple": "Purple",
|
||||||
|
"Light Purple": "Light Purple",
|
||||||
|
"Violet": "Violet",
|
||||||
|
"Orange": "Orange",
|
||||||
|
"Yellow": "Yellow",
|
||||||
|
"Light Yellow": "Light Yellow",
|
||||||
|
"Teal": "Teal",
|
||||||
|
"Cyan": "Cyan",
|
||||||
|
"Light Cyan": "Light Cyan",
|
||||||
|
"Magenta": "Magenta",
|
||||||
|
"Hot Pink": "Hot Pink",
|
||||||
|
"Brown": "Brown",
|
||||||
|
"Light Brown": "Light Brown",
|
||||||
|
"Colors": "Colors",
|
||||||
|
"Background Color": "Background Color",
|
||||||
|
"Background Alpha": "Background Alpha",
|
||||||
|
"Focus Color": "Focus Color",
|
||||||
|
"Focus Alpha": "Focus Alpha",
|
||||||
|
"Text Color": "Text Color",
|
||||||
|
"Border": "Border",
|
||||||
|
"Dashed Line": "Dashed Line",
|
||||||
|
"Max FPS Text": "Max FPS Text",
|
||||||
|
"Min FPS Text": "Min FPS Text",
|
||||||
|
"Main Line": "Main Line",
|
||||||
|
"Rounded Line": "Rounded Line",
|
||||||
|
"Perfect Line": "Perfect Line",
|
||||||
|
" Color": " Color",
|
||||||
|
" Alpha": " Alpha",
|
||||||
|
"Category Color": "Category Color",
|
||||||
|
"Category Color 1": "Category Color 1",
|
||||||
|
"Category Color 2": "Category Color 2",
|
||||||
|
"Separator Color": "Separator Color",
|
||||||
|
"Elements": "Elements",
|
||||||
|
"Text Alignment": "Text Alignment",
|
||||||
|
"Vertical Position": "Vertical Position",
|
||||||
|
"Horizontal Position": "Horizontal Position",
|
||||||
|
"Left": "Left",
|
||||||
|
"Right": "Right",
|
||||||
|
"Top": "Top",
|
||||||
|
"Center": "Center",
|
||||||
|
"Bottom": "Bottom",
|
||||||
|
"FPS Counter Color":"FPS Counter Color",
|
||||||
|
"FPS Counter Alpha":"FPS Counter Alpha",
|
||||||
|
"Border Color":"Border Color",
|
||||||
|
"Dashed Line Color":"Dashed Line Color",
|
||||||
|
"Dashed Line Alpha":"Dashed Line Alpha",
|
||||||
|
"Max FPS Text Color":"Max FPS Text Color",
|
||||||
|
"Min FPS Text Color":"Min FPS Text Color",
|
||||||
|
"Main Line Color":"Main Line Color",
|
||||||
|
"Rounded Line Color":"Rounded Line Color",
|
||||||
|
"Perfect Line Color":"Perfect Line Color"
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
{
|
||||||
|
"Horizon OC Monitor": "Horizon OC Monitor",
|
||||||
|
"Modes": "Modos",
|
||||||
|
"Modes Configure": "Modos Configurar",
|
||||||
|
"Full": "Completo",
|
||||||
|
"Mini": "Mini",
|
||||||
|
"Micro": "Micro",
|
||||||
|
"FPS Graph": "Gráfico FPS",
|
||||||
|
"FPS Counter": "Contador FPS",
|
||||||
|
"Game Resolutions": "Resoluciones del juego",
|
||||||
|
"Other": "Otros",
|
||||||
|
"Battery/Charger": "Batería/Cargador",
|
||||||
|
"Miscellaneous": "Varios",
|
||||||
|
"CPU Usage": "Uso de CPU",
|
||||||
|
"GPU Usage": "Uso de GPU",
|
||||||
|
"RAM Usage": "Uso de RAM",
|
||||||
|
"Target Frequency": "Frecuencia objetivo",
|
||||||
|
"Real Frequency": "Frecuencia real",
|
||||||
|
"Core 0 ": "Núcleo 0 ",
|
||||||
|
"Core 1 ": "Núcleo 1 ",
|
||||||
|
"Core 2 ": "Núcleo 2 ",
|
||||||
|
"Core 3 ": "Núcleo 3 ",
|
||||||
|
"Load": "Carga",
|
||||||
|
"Total\nApplication\nApplet\nSystem\nSystem Unsafe": "Total\nAplicación\nApplet\nSistema\nSistema (inseguro)",
|
||||||
|
"Board": "Placa",
|
||||||
|
"Battery Power Flow": "Flujo de energía de batería",
|
||||||
|
"\nTemperatures": "\nTemperaturas",
|
||||||
|
"SoC\nPCB\nSkin": "SoC\nPCB\nSkin",
|
||||||
|
"Fan Rotation Level": "Nivel de rotación del ventilador",
|
||||||
|
"Game": "Juego",
|
||||||
|
"PFPS ": "PFPS ",
|
||||||
|
"FPS ": "FPS ",
|
||||||
|
"Resolutions ": "Resoluciones ",
|
||||||
|
"Read Speed ": "Velocidad de lectura ",
|
||||||
|
"Press ": "Pulsa ",
|
||||||
|
" to Exit": " para salir",
|
||||||
|
"Depth": "Profundidad",
|
||||||
|
"Viewport": "Viewport",
|
||||||
|
"Game is not running\nor it's incompatible.": "El juego no está en ejecución\no es incompatible.",
|
||||||
|
"Battery Stats": "Estadísticas de batería",
|
||||||
|
"Actual Capacity": "Capacidad actual",
|
||||||
|
"Designed Capacity": "Capacidad nominal",
|
||||||
|
"Temperature": "Temperatura",
|
||||||
|
"Raw Charge": "Carga bruta",
|
||||||
|
"Age": "Edad",
|
||||||
|
"Voltage": "Voltaje",
|
||||||
|
"Current Flow": "Flujo de corriente",
|
||||||
|
"Power Flow": "Flujo de potencia",
|
||||||
|
"Remaining Time": "Tiempo restante",
|
||||||
|
"Charger Stats": "Estadísticas del cargador",
|
||||||
|
"Input Current Limit": "Límite de corriente de entrada",
|
||||||
|
"VBUS Current Limit": "Límite de corriente VBUS",
|
||||||
|
"Voltage Limit": "Límite de voltaje",
|
||||||
|
"Current Limit": "Límite de corriente",
|
||||||
|
"Type": "Tipo",
|
||||||
|
"Max Voltage": "Voltaje máx.",
|
||||||
|
"Max Current": "Corriente máx.",
|
||||||
|
"Multimedia Clock Rates": "Frecuencias de reloj multimedia",
|
||||||
|
"NVDEC": "NVDEC",
|
||||||
|
"NVENC": "NVENC",
|
||||||
|
"NVJPG": "NVJPG",
|
||||||
|
"Network": "Red",
|
||||||
|
"Type: Wi-Fi": "Tipo: Wi-Fi",
|
||||||
|
"Press Y to show password": "Pulsa Y para mostrar contraseña",
|
||||||
|
"Type: Ethernet": "Tipo: Ethernet",
|
||||||
|
"Type: Not connected": "Tipo: No conectado",
|
||||||
|
"CPU\nGPU\nRAM\nSOC\nPCB\nSKN": "CPU\nGPU\nRAM\nSOC\nPCB\nSKN",
|
||||||
|
"Elements Move Down Move Up": "Elementos Bajar Subir",
|
||||||
|
"Transparent": "Transparente",
|
||||||
|
"Opaque": "Opaco",
|
||||||
|
"Alpha": "Alfa",
|
||||||
|
"Pretty": "Bonito",
|
||||||
|
"Compact": "Compacto",
|
||||||
|
"FileSafe": "FileSafe",
|
||||||
|
"Day+Time": "Día+Hora",
|
||||||
|
"Date+Time(s)": "Fecha+Hora(s)",
|
||||||
|
"Date+Time AM/PM": "Fecha+Hora AM/PM",
|
||||||
|
"Date+Time(s) AM/PM": "Fecha+Hora(s) AM/PM",
|
||||||
|
"Date+Time EU": "Fecha+Hora EU",
|
||||||
|
"Date+Time EU AM/PM": "Fecha+Hora EU AM/PM",
|
||||||
|
"Date+Time(s) EU AM/PM": "Fecha+Hora(s) EU AM/PM",
|
||||||
|
"Date+Time ISO": "Fecha+Hora ISO",
|
||||||
|
"Time 24h": "Hora 24h",
|
||||||
|
"Time AM/PM": "Hora AM/PM",
|
||||||
|
"Time(s) 24h": "Hora(s) 24h",
|
||||||
|
"Time(s) AM/PM": "Hora(s) AM/PM",
|
||||||
|
"Date US": "Fecha EE.UU.",
|
||||||
|
"Date EU": "Fecha EU",
|
||||||
|
"Date ISO": "Fecha ISO",
|
||||||
|
"Date Short": "Fecha corta",
|
||||||
|
"DTC Format": "Formato DTC",
|
||||||
|
"Toggles": "Conmutadores",
|
||||||
|
"Info": "Mostrar info",
|
||||||
|
"Disable Screenshots": "Desactivar capturas",
|
||||||
|
"Real Freqs": "Frecuencias reales",
|
||||||
|
"Deltas": "Deltas",
|
||||||
|
"Target Freqs": "Frecuencias objetivo",
|
||||||
|
"FPS": "FPS",
|
||||||
|
"RES": "RES",
|
||||||
|
"Read Speed": "Velocidad de lectura",
|
||||||
|
"Real Frequencies": "Frecuencias reales",
|
||||||
|
"Real Voltages": "Voltajes reales",
|
||||||
|
"Full CPU": "CPU completo",
|
||||||
|
"VDDQ": "VDDQ",
|
||||||
|
"VDD2": "VDD2",
|
||||||
|
"Full Resolution": "Resolución completa",
|
||||||
|
"SOC Voltage": "Voltaje SOC",
|
||||||
|
"RAM Load CPU/GPU": "Carga RAM CPU/GPU",
|
||||||
|
"Use DTC Symbol": "Usar símbolo DTC",
|
||||||
|
"Use Dynamic Colors": "Usar colores dinámicos",
|
||||||
|
"Sleep Exit": "Salir del reposo",
|
||||||
|
"Configuration": "Configuración",
|
||||||
|
"Refresh Rate": "Tasa de refresco",
|
||||||
|
"Frame Padding": "Relleno de marco",
|
||||||
|
" Font Size": " Tamaño de fuente",
|
||||||
|
"Font Sizes": "Tamaños de fuente",
|
||||||
|
"Handheld Font Size": "Tamaño fuente portátil",
|
||||||
|
"Docked Font Size": "Tamaño fuente acoplado",
|
||||||
|
"Black": "Negro",
|
||||||
|
"Dark Gray": "Gris oscuro",
|
||||||
|
"Gray": "Gris",
|
||||||
|
"Light Gray": "Gris claro",
|
||||||
|
"Silver": "Plata",
|
||||||
|
"White": "Blanco",
|
||||||
|
"Dark Red": "Rojo oscuro",
|
||||||
|
"Red": "Rojo",
|
||||||
|
"Light Red": "Rojo claro",
|
||||||
|
"Pink": "Rosa",
|
||||||
|
"Dark Green": "Verde oscuro",
|
||||||
|
"Green": "Verde",
|
||||||
|
"Lime Green": "Verde lima",
|
||||||
|
"Light Green": "Verde claro",
|
||||||
|
"Dark Blue": "Azul oscuro",
|
||||||
|
"Blue": "Azul",
|
||||||
|
"Light Blue": "Azul claro",
|
||||||
|
"Sky Blue": "Azul cielo",
|
||||||
|
"Dark Purple": "Púrpura oscuro",
|
||||||
|
"Purple": "Púrpura",
|
||||||
|
"Light Purple": "Púrpura claro",
|
||||||
|
"Violet": "Violeta",
|
||||||
|
"Orange": "Naranja",
|
||||||
|
"Yellow": "Amarillo",
|
||||||
|
"Light Yellow": "Amarillo claro",
|
||||||
|
"Teal": "Verde azulado",
|
||||||
|
"Cyan": "Cian",
|
||||||
|
"Light Cyan": "Cian claro",
|
||||||
|
"Magenta": "Magenta",
|
||||||
|
"Hot Pink": "Rosa intenso",
|
||||||
|
"Brown": "Marrón",
|
||||||
|
"Light Brown": "Marrón claro",
|
||||||
|
"Colors": "Colores",
|
||||||
|
"Background Color": "Color de fondo",
|
||||||
|
"Background Alpha": "Alfa de fondo",
|
||||||
|
"Focus Color": "Color de foco",
|
||||||
|
"Focus Alpha": "Alfa de foco",
|
||||||
|
"Text Color": "Color de texto",
|
||||||
|
"Border": "Borde",
|
||||||
|
"Dashed Line": "Línea discontinua",
|
||||||
|
"Max FPS Text": "Texto FPS máx.",
|
||||||
|
"Min FPS Text": "Texto FPS mín.",
|
||||||
|
"Main Line": "Línea principal",
|
||||||
|
"Rounded Line": "Línea redondeada",
|
||||||
|
"Perfect Line": "Línea perfecta",
|
||||||
|
" Color": " Color",
|
||||||
|
" Alpha": " Alfa",
|
||||||
|
"Category Color": "Color de categoría",
|
||||||
|
"Category Color 1": "Color categoría 1",
|
||||||
|
"Category Color 2": "Color categoría 2",
|
||||||
|
"Separator Color": "Color separador",
|
||||||
|
"Elements": "Elementos",
|
||||||
|
"Text Alignment": "Alineación de texto",
|
||||||
|
"Vertical Position": "Posición vertical",
|
||||||
|
"Horizontal Position": "Posición horizontal",
|
||||||
|
"Left": "Izquierda",
|
||||||
|
"Right": "Derecha",
|
||||||
|
"Top": "Arriba",
|
||||||
|
"Center": "Centro",
|
||||||
|
"Bottom": "Abajo",
|
||||||
|
"FPS Counter Color": "Color contador FPS",
|
||||||
|
"FPS Counter Alpha": "Alfa contador FPS",
|
||||||
|
"Border Color": "Color de borde",
|
||||||
|
"Dashed Line Color": "Color línea discontinua",
|
||||||
|
"Dashed Line Alpha": "Alfa línea discontinua",
|
||||||
|
"Max FPS Text Color": "Color texto FPS máx.",
|
||||||
|
"Min FPS Text Color": "Color texto FPS mín.",
|
||||||
|
"Main Line Color": "Color línea principal",
|
||||||
|
"Rounded Line Color": "Color línea redondeada",
|
||||||
|
"Perfect Line Color": "Color línea perfecta"
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
{
|
||||||
|
"Horizon OC Monitor": "Horizon OC Monitor",
|
||||||
|
"Modes": "Modes",
|
||||||
|
"Modes Configure": "Modes Configurer",
|
||||||
|
"Full": "Complet",
|
||||||
|
"Mini": "Mini",
|
||||||
|
"Micro": "Micro",
|
||||||
|
"FPS Graph": "Graphique FPS",
|
||||||
|
"FPS Counter": "Compteur FPS",
|
||||||
|
"Game Resolutions": "Résolutions du jeu",
|
||||||
|
"Other": "Autres",
|
||||||
|
"Battery/Charger": "Batterie/Chargeur",
|
||||||
|
"Miscellaneous": "Divers",
|
||||||
|
"CPU Usage": "Utilisation CPU",
|
||||||
|
"GPU Usage": "Utilisation GPU",
|
||||||
|
"RAM Usage": "Utilisation RAM",
|
||||||
|
"Target Frequency": "Fréquence cible",
|
||||||
|
"Real Frequency": "Fréquence réelle",
|
||||||
|
"Core 0 ": "Cœur 0 ",
|
||||||
|
"Core 1 ": "Cœur 1 ",
|
||||||
|
"Core 2 ": "Cœur 2 ",
|
||||||
|
"Core 3 ": "Cœur 3 ",
|
||||||
|
"Load": "Charge",
|
||||||
|
"Total\nApplication\nApplet\nSystem\nSystem Unsafe": "Total\nApplication\nApplet\nSystème\nSystème non sécurisé",
|
||||||
|
"Board": "Carte",
|
||||||
|
"Battery Power Flow": "Flux de puissance batterie",
|
||||||
|
"\nTemperatures": "\nTempératures",
|
||||||
|
"SoC\nPCB\nSkin": "SoC\nPCB\nSkin",
|
||||||
|
"Fan Rotation Level": "Niveau de rotation ventilateur",
|
||||||
|
"Game": "Jeu",
|
||||||
|
"PFPS ": "PFPS ",
|
||||||
|
"FPS ": "FPS ",
|
||||||
|
"Resolutions ": "Résolutions ",
|
||||||
|
"Read Speed ": "Vitesse de lecture ",
|
||||||
|
"Press ": "Appuyez sur ",
|
||||||
|
" to Exit": " pour quitter",
|
||||||
|
"Depth": "Profondeur",
|
||||||
|
"Viewport": "Viewport",
|
||||||
|
"Game is not running\nor it's incompatible.": "Le jeu ne fonctionne pas\nou est incompatible.",
|
||||||
|
"Battery Stats": "Statistiques batterie",
|
||||||
|
"Actual Capacity": "Capacité actuelle",
|
||||||
|
"Designed Capacity": "Capacité nominale",
|
||||||
|
"Temperature": "Température",
|
||||||
|
"Raw Charge": "Charge brute",
|
||||||
|
"Age": "Âge",
|
||||||
|
"Voltage": "Tension",
|
||||||
|
"Current Flow": "Flux de courant",
|
||||||
|
"Power Flow": "Flux de puissance",
|
||||||
|
"Remaining Time": "Temps restant",
|
||||||
|
"Charger Stats": "Statistiques chargeur",
|
||||||
|
"Input Current Limit": "Limite courant entrée",
|
||||||
|
"VBUS Current Limit": "Limite courant VBUS",
|
||||||
|
"Voltage Limit": "Limite tension",
|
||||||
|
"Current Limit": "Limite courant",
|
||||||
|
"Type": "Type",
|
||||||
|
"Max Voltage": "Tension max",
|
||||||
|
"Max Current": "Courant max",
|
||||||
|
"Multimedia Clock Rates": "Fréquences horloge multimédia",
|
||||||
|
"NVDEC": "NVDEC",
|
||||||
|
"NVENC": "NVENC",
|
||||||
|
"NVJPG": "NVJPG",
|
||||||
|
"Network": "Réseau",
|
||||||
|
"Type: Wi-Fi": "Type : Wi-Fi",
|
||||||
|
"Press Y to show password": "Appuyez sur Y pour afficher le mot de passe",
|
||||||
|
"Type: Ethernet": "Type : Ethernet",
|
||||||
|
"Type: Not connected": "Type : Non connecté",
|
||||||
|
"CPU\nGPU\nRAM\nSOC\nPCB\nSKN": "CPU\nGPU\nRAM\nSOC\nPCB\nSKN",
|
||||||
|
"Elements Move Down Move Up": "Éléments Descendre Monter",
|
||||||
|
"Transparent": "Transparent",
|
||||||
|
"Opaque": "Opaque",
|
||||||
|
"Alpha": "Alpha",
|
||||||
|
"Pretty": "Joli",
|
||||||
|
"Compact": "Compact",
|
||||||
|
"FileSafe": "FileSafe",
|
||||||
|
"Day+Time": "Jour+Heure",
|
||||||
|
"Date+Time(s)": "Date+Heure(s)",
|
||||||
|
"Date+Time AM/PM": "Date+Heure AM/PM",
|
||||||
|
"Date+Time(s) AM/PM": "Date+Heure(s) AM/PM",
|
||||||
|
"Date+Time EU": "Date+Heure EU",
|
||||||
|
"Date+Time EU AM/PM": "Date+Heure EU AM/PM",
|
||||||
|
"Date+Time(s) EU AM/PM": "Date+Heure(s) EU AM/PM",
|
||||||
|
"Date+Time ISO": "Date+Heure ISO",
|
||||||
|
"Time 24h": "Heure 24h",
|
||||||
|
"Time AM/PM": "Heure AM/PM",
|
||||||
|
"Time(s) 24h": "Heure(s) 24h",
|
||||||
|
"Time(s) AM/PM": "Heure(s) AM/PM",
|
||||||
|
"Date US": "Date US",
|
||||||
|
"Date EU": "Date EU",
|
||||||
|
"Date ISO": "Date ISO",
|
||||||
|
"Date Short": "Date courte",
|
||||||
|
"DTC Format": "Format DTC",
|
||||||
|
"Toggles": "Basculement",
|
||||||
|
"Info": "Afficher infos",
|
||||||
|
"Disable Screenshots": "Désactiver captures d'écran",
|
||||||
|
"Real Freqs": "Fréquences réelles",
|
||||||
|
"Deltas": "Deltas",
|
||||||
|
"Target Freqs": "Fréquences cibles",
|
||||||
|
"FPS": "FPS",
|
||||||
|
"RES": "RÉS",
|
||||||
|
"Read Speed": "Vitesse de lecture",
|
||||||
|
"Real Frequencies": "Fréquences réelles",
|
||||||
|
"Real Voltages": "Tensions réelles",
|
||||||
|
"Full CPU": "CPU complet",
|
||||||
|
"VDDQ": "VDDQ",
|
||||||
|
"VDD2": "VDD2",
|
||||||
|
"Full Resolution": "Résolution complète",
|
||||||
|
"SOC Voltage": "Tension SOC",
|
||||||
|
"RAM Load CPU/GPU": "Charge RAM CPU/GPU",
|
||||||
|
"Use DTC Symbol": "Utiliser symbole DTC",
|
||||||
|
"Use Dynamic Colors": "Utiliser couleurs dynamiques",
|
||||||
|
"Sleep Exit": "Sortie veille",
|
||||||
|
"Configuration": "Configuration",
|
||||||
|
"Refresh Rate": "Taux de rafraîchissement",
|
||||||
|
"Frame Padding": "Marge de cadre",
|
||||||
|
" Font Size": " Taille police",
|
||||||
|
"Font Sizes": "Tailles de police",
|
||||||
|
"Handheld Font Size": "Taille police portable",
|
||||||
|
"Docked Font Size": "Taille police dockée",
|
||||||
|
"Black": "Noir",
|
||||||
|
"Dark Gray": "Gris foncé",
|
||||||
|
"Gray": "Gris",
|
||||||
|
"Light Gray": "Gris clair",
|
||||||
|
"Silver": "Argent",
|
||||||
|
"White": "Blanc",
|
||||||
|
"Dark Red": "Rouge foncé",
|
||||||
|
"Red": "Rouge",
|
||||||
|
"Light Red": "Rouge clair",
|
||||||
|
"Pink": "Rose",
|
||||||
|
"Dark Green": "Vert foncé",
|
||||||
|
"Green": "Vert",
|
||||||
|
"Lime Green": "Vert citron",
|
||||||
|
"Light Green": "Vert clair",
|
||||||
|
"Dark Blue": "Bleu foncé",
|
||||||
|
"Blue": "Bleu",
|
||||||
|
"Light Blue": "Bleu clair",
|
||||||
|
"Sky Blue": "Bleu ciel",
|
||||||
|
"Dark Purple": "Violet foncé",
|
||||||
|
"Purple": "Violet",
|
||||||
|
"Light Purple": "Violet clair",
|
||||||
|
"Violet": "Violet",
|
||||||
|
"Orange": "Orange",
|
||||||
|
"Yellow": "Jaune",
|
||||||
|
"Light Yellow": "Jaune clair",
|
||||||
|
"Teal": "Sarcelle",
|
||||||
|
"Cyan": "Cyan",
|
||||||
|
"Light Cyan": "Cyan clair",
|
||||||
|
"Magenta": "Magenta",
|
||||||
|
"Hot Pink": "Rose vif",
|
||||||
|
"Brown": "Marron",
|
||||||
|
"Light Brown": "Marron clair",
|
||||||
|
"Colors": "Couleurs",
|
||||||
|
"Background Color": "Couleur d'arrière-plan",
|
||||||
|
"Background Alpha": "Alpha d'arrière-plan",
|
||||||
|
"Focus Color": "Couleur de focus",
|
||||||
|
"Focus Alpha": "Alpha de focus",
|
||||||
|
"Text Color": "Couleur du texte",
|
||||||
|
"Border": "Bordure",
|
||||||
|
"Dashed Line": "Ligne pointillée",
|
||||||
|
"Max FPS Text": "Texte FPS max",
|
||||||
|
"Min FPS Text": "Texte FPS min",
|
||||||
|
"Main Line": "Ligne principale",
|
||||||
|
"Rounded Line": "Ligne arrondie",
|
||||||
|
"Perfect Line": "Ligne parfaite",
|
||||||
|
" Color": " Couleur",
|
||||||
|
" Alpha": " Alpha",
|
||||||
|
"Category Color": "Couleur de catégorie",
|
||||||
|
"Category Color 1": "Couleur catégorie 1",
|
||||||
|
"Category Color 2": "Couleur catégorie 2",
|
||||||
|
"Separator Color": "Couleur de séparateur",
|
||||||
|
"Elements": "Éléments",
|
||||||
|
"Text Alignment": "Alignement du texte",
|
||||||
|
"Vertical Position": "Position verticale",
|
||||||
|
"Horizontal Position": "Position horizontale",
|
||||||
|
"Left": "Gauche",
|
||||||
|
"Right": "Droite",
|
||||||
|
"Top": "Haut",
|
||||||
|
"Center": "Centre",
|
||||||
|
"Bottom": "Bas",
|
||||||
|
"FPS Counter Color": "Couleur compteur FPS",
|
||||||
|
"FPS Counter Alpha": "Alpha compteur FPS",
|
||||||
|
"Border Color": "Couleur de bordure",
|
||||||
|
"Dashed Line Color": "Couleur ligne pointillée",
|
||||||
|
"Dashed Line Alpha": "Alpha ligne pointillée",
|
||||||
|
"Max FPS Text Color": "Couleur texte FPS max",
|
||||||
|
"Min FPS Text Color": "Couleur texte FPS min",
|
||||||
|
"Main Line Color": "Couleur ligne principale",
|
||||||
|
"Rounded Line Color": "Couleur ligne arrondie",
|
||||||
|
"Perfect Line Color": "Couleur ligne parfaite"
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
{
|
||||||
|
"Horizon OC Monitor": "Horizon OC Monitor",
|
||||||
|
"Modes": "Modalità",
|
||||||
|
"Modes Configure": "Modalità Configura",
|
||||||
|
"Full": "Completo",
|
||||||
|
"Mini": "Mini",
|
||||||
|
"Micro": "Micro",
|
||||||
|
"FPS Graph": "Grafico FPS",
|
||||||
|
"FPS Counter": "Contatore FPS",
|
||||||
|
"Game Resolutions": "Risoluzioni di gioco",
|
||||||
|
"Other": "Altro",
|
||||||
|
"Battery/Charger": "Batteria/Caricatore",
|
||||||
|
"Miscellaneous": "Varie",
|
||||||
|
"CPU Usage": "Utilizzo CPU",
|
||||||
|
"GPU Usage": "Utilizzo GPU",
|
||||||
|
"RAM Usage": "Utilizzo RAM",
|
||||||
|
"Target Frequency": "Frequenza target",
|
||||||
|
"Real Frequency": "Frequenza reale",
|
||||||
|
"Core 0 ": "Core 0 ",
|
||||||
|
"Core 1 ": "Core 1 ",
|
||||||
|
"Core 2 ": "Core 2 ",
|
||||||
|
"Core 3 ": "Core 3 ",
|
||||||
|
"Load": "Carico",
|
||||||
|
"Total\nApplication\nApplet\nSystem\nSystem Unsafe": "Totale\nApplicazione\nApplet\nSistema\nSistema non sicuro",
|
||||||
|
"Board": "Scheda",
|
||||||
|
"Battery Power Flow": "Flusso potenza batteria",
|
||||||
|
"\nTemperatures": "\nTemperature",
|
||||||
|
"SoC\nPCB\nSkin": "SoC\nPCB\nSkin",
|
||||||
|
"Fan Rotation Level": "Livello rotazione ventola",
|
||||||
|
"Game": "Gioco",
|
||||||
|
"PFPS ": "PFPS ",
|
||||||
|
"FPS ": "FPS ",
|
||||||
|
"Resolutions ": "Risoluzioni ",
|
||||||
|
"Read Speed ": "Velocità di lettura ",
|
||||||
|
"Press ": "Premi ",
|
||||||
|
" to Exit": " per uscire",
|
||||||
|
"Depth": "Profondità",
|
||||||
|
"Viewport": "Viewport",
|
||||||
|
"Game is not running\nor it's incompatible.": "Il gioco non è in esecuzione\no è incompatibile.",
|
||||||
|
"Battery Stats": "Statistiche batteria",
|
||||||
|
"Actual Capacity": "Capacità attuale",
|
||||||
|
"Designed Capacity": "Capacità nominale",
|
||||||
|
"Temperature": "Temperatura",
|
||||||
|
"Raw Charge": "Carica grezza",
|
||||||
|
"Age": "Età",
|
||||||
|
"Voltage": "Voltaggio",
|
||||||
|
"Current Flow": "Flusso corrente",
|
||||||
|
"Power Flow": "Flusso potenza",
|
||||||
|
"Remaining Time": "Tempo rimanente",
|
||||||
|
"Charger Stats": "Statistiche caricatore",
|
||||||
|
"Input Current Limit": "Limite corrente ingresso",
|
||||||
|
"VBUS Current Limit": "Limite corrente VBUS",
|
||||||
|
"Voltage Limit": "Limite tensione",
|
||||||
|
"Current Limit": "Limite corrente",
|
||||||
|
"Type": "Tipo",
|
||||||
|
"Max Voltage": "Tensione max",
|
||||||
|
"Max Current": "Corrente max",
|
||||||
|
"Multimedia Clock Rates": "Frequenze clock multimediali",
|
||||||
|
"NVDEC": "NVDEC",
|
||||||
|
"NVENC": "NVENC",
|
||||||
|
"NVJPG": "NVJPG",
|
||||||
|
"Network": "Rete",
|
||||||
|
"Type: Wi-Fi": "Tipo: Wi-Fi",
|
||||||
|
"Press Y to show password": "Premi Y per mostrare la password",
|
||||||
|
"Type: Ethernet": "Tipo: Ethernet",
|
||||||
|
"Type: Not connected": "Tipo: Non connesso",
|
||||||
|
"CPU\nGPU\nRAM\nSOC\nPCB\nSKN": "CPU\nGPU\nRAM\nSOC\nPCB\nSKN",
|
||||||
|
"Elements Move Down Move Up": "Elementi Sposta giù Sposta su",
|
||||||
|
"Transparent": "Trasparente",
|
||||||
|
"Opaque": "Opaco",
|
||||||
|
"Alpha": "Alfa",
|
||||||
|
"Pretty": "Carino",
|
||||||
|
"Compact": "Compatto",
|
||||||
|
"FileSafe": "FileSafe",
|
||||||
|
"Day+Time": "Giorno+Ora",
|
||||||
|
"Date+Time(s)": "Data+Ora(s)",
|
||||||
|
"Date+Time AM/PM": "Data+Ora AM/PM",
|
||||||
|
"Date+Time(s) AM/PM": "Data+Ora(s) AM/PM",
|
||||||
|
"Date+Time EU": "Data+Ora EU",
|
||||||
|
"Date+Time EU AM/PM": "Data+Ora EU AM/PM",
|
||||||
|
"Date+Time(s) EU AM/PM": "Data+Ora(s) EU AM/PM",
|
||||||
|
"Date+Time ISO": "Data+Ora ISO",
|
||||||
|
"Time 24h": "Ora 24h",
|
||||||
|
"Time AM/PM": "Ora AM/PM",
|
||||||
|
"Time(s) 24h": "Ora(s) 24h",
|
||||||
|
"Time(s) AM/PM": "Ora(s) AM/PM",
|
||||||
|
"Date US": "Data US",
|
||||||
|
"Date EU": "Data EU",
|
||||||
|
"Date ISO": "Data ISO",
|
||||||
|
"Date Short": "Data breve",
|
||||||
|
"DTC Format": "Formato DTC",
|
||||||
|
"Toggles": "Interruttori",
|
||||||
|
"Info": "Mostra info",
|
||||||
|
"Disable Screenshots": "Disabilita screenshot",
|
||||||
|
"Real Freqs": "Frequenze reali",
|
||||||
|
"Deltas": "Delta",
|
||||||
|
"Target Freqs": "Frequenze target",
|
||||||
|
"FPS": "FPS",
|
||||||
|
"RES": "RIS",
|
||||||
|
"Read Speed": "Velocità di lettura",
|
||||||
|
"Real Frequencies": "Frequenze reali",
|
||||||
|
"Real Voltages": "Voltaggi reali",
|
||||||
|
"Full CPU": "CPU completo",
|
||||||
|
"VDDQ": "VDDQ",
|
||||||
|
"VDD2": "VDD2",
|
||||||
|
"Full Resolution": "Risoluzione completa",
|
||||||
|
"SOC Voltage": "Voltaggio SOC",
|
||||||
|
"RAM Load CPU/GPU": "Carico RAM CPU/GPU",
|
||||||
|
"Use DTC Symbol": "Usa simbolo DTC",
|
||||||
|
"Use Dynamic Colors": "Usa colori dinamici",
|
||||||
|
"Sleep Exit": "Uscita standby",
|
||||||
|
"Configuration": "Configurazione",
|
||||||
|
"Refresh Rate": "Frequenza di aggiornamento",
|
||||||
|
"Frame Padding": "Spaziatura cornice",
|
||||||
|
" Font Size": " Dimensione font",
|
||||||
|
"Font Sizes": "Dimensioni font",
|
||||||
|
"Handheld Font Size": "Dimensione font portatile",
|
||||||
|
"Docked Font Size": "Dimensione font docked",
|
||||||
|
"Black": "Nero",
|
||||||
|
"Dark Gray": "Grigio scuro",
|
||||||
|
"Gray": "Grigio",
|
||||||
|
"Light Gray": "Grigio chiaro",
|
||||||
|
"Silver": "Argento",
|
||||||
|
"White": "Bianco",
|
||||||
|
"Dark Red": "Rosso scuro",
|
||||||
|
"Red": "Rosso",
|
||||||
|
"Light Red": "Rosso chiaro",
|
||||||
|
"Pink": "Rosa",
|
||||||
|
"Dark Green": "Verde scuro",
|
||||||
|
"Green": "Verde",
|
||||||
|
"Lime Green": "Verde lime",
|
||||||
|
"Light Green": "Verde chiaro",
|
||||||
|
"Dark Blue": "Blu scuro",
|
||||||
|
"Blue": "Blu",
|
||||||
|
"Light Blue": "Azzurro",
|
||||||
|
"Sky Blue": "Azzurro cielo",
|
||||||
|
"Dark Purple": "Viola scuro",
|
||||||
|
"Purple": "Viola",
|
||||||
|
"Light Purple": "Viola chiaro",
|
||||||
|
"Violet": "Viola",
|
||||||
|
"Orange": "Arancione",
|
||||||
|
"Yellow": "Giallo",
|
||||||
|
"Light Yellow": "Giallo chiaro",
|
||||||
|
"Teal": "Verde acqua",
|
||||||
|
"Cyan": "Ciano",
|
||||||
|
"Light Cyan": "Ciano chiaro",
|
||||||
|
"Magenta": "Magenta",
|
||||||
|
"Hot Pink": "Rosa shocking",
|
||||||
|
"Brown": "Marrone",
|
||||||
|
"Light Brown": "Marrone chiaro",
|
||||||
|
"Colors": "Colori",
|
||||||
|
"Background Color": "Colore sfondo",
|
||||||
|
"Background Alpha": "Alfa sfondo",
|
||||||
|
"Focus Color": "Colore focus",
|
||||||
|
"Focus Alpha": "Alfa focus",
|
||||||
|
"Text Color": "Colore testo",
|
||||||
|
"Border": "Bordo",
|
||||||
|
"Dashed Line": "Linea tratteggiata",
|
||||||
|
"Max FPS Text": "Testo FPS max",
|
||||||
|
"Min FPS Text": "Testo FPS min",
|
||||||
|
"Main Line": "Linea principale",
|
||||||
|
"Rounded Line": "Linea arrotondata",
|
||||||
|
"Perfect Line": "Linea perfetta",
|
||||||
|
" Color": " Colore",
|
||||||
|
" Alpha": " Alfa",
|
||||||
|
"Category Color": "Colore categoria",
|
||||||
|
"Category Color 1": "Colore categoria 1",
|
||||||
|
"Category Color 2": "Colore categoria 2",
|
||||||
|
"Separator Color": "Colore separatore",
|
||||||
|
"Elements": "Elementi",
|
||||||
|
"Text Alignment": "Allineamento testo",
|
||||||
|
"Vertical Position": "Posizione verticale",
|
||||||
|
"Horizontal Position": "Posizione orizzontale",
|
||||||
|
"Left": "Sinistra",
|
||||||
|
"Right": "Destra",
|
||||||
|
"Top": "Sopra",
|
||||||
|
"Center": "Centro",
|
||||||
|
"Bottom": "Sotto",
|
||||||
|
"FPS Counter Color": "Colore contatore FPS",
|
||||||
|
"FPS Counter Alpha": "Alfa contatore FPS",
|
||||||
|
"Border Color": "Colore bordo",
|
||||||
|
"Dashed Line Color": "Colore linea tratteggiata",
|
||||||
|
"Dashed Line Alpha": "Alfa linea tratteggiata",
|
||||||
|
"Max FPS Text Color": "Colore testo FPS max",
|
||||||
|
"Min FPS Text Color": "Colore testo FPS min",
|
||||||
|
"Main Line Color": "Colore linea principale",
|
||||||
|
"Rounded Line Color": "Colore linea arrotondata",
|
||||||
|
"Perfect Line Color": "Colore linea perfetta"
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
{
|
||||||
|
"Horizon OC Monitor": "Horizon OC Monitor",
|
||||||
|
"Modes": "モード",
|
||||||
|
"Modes Configure": "モード 設定",
|
||||||
|
"Full": "フル",
|
||||||
|
"Mini": "ミニ",
|
||||||
|
"Micro": "マイクロ",
|
||||||
|
"FPS Graph": "FPSグラフ",
|
||||||
|
"FPS Counter": "FPSカウンター",
|
||||||
|
"Game Resolutions": "ゲーム解像度",
|
||||||
|
"Other": "その他",
|
||||||
|
"Battery/Charger": "バッテリー/充電器",
|
||||||
|
"Miscellaneous": "その他",
|
||||||
|
"CPU Usage": "CPU使用率",
|
||||||
|
"GPU Usage": "GPU使用率",
|
||||||
|
"RAM Usage": "RAM使用率",
|
||||||
|
"Target Frequency": "目標周波数",
|
||||||
|
"Real Frequency": "実際の周波数",
|
||||||
|
"Core 0 ": "コア 0 ",
|
||||||
|
"Core 1 ": "コア 1 ",
|
||||||
|
"Core 2 ": "コア 2 ",
|
||||||
|
"Core 3 ": "コア 3 ",
|
||||||
|
"Load": "負荷",
|
||||||
|
"Total\nApplication\nApplet\nSystem\nSystem Unsafe": "合計\nアプリケーション\nアプレット\nシステム\nシステム(非安全)",
|
||||||
|
"Board": "ボード",
|
||||||
|
"Battery Power Flow": "バッテリー電力フロー",
|
||||||
|
"\nTemperatures": "\n温度",
|
||||||
|
"SoC\nPCB\nSkin": "SoC\nPCB\nSkin",
|
||||||
|
"Fan Rotation Level": "ファン回転レベル",
|
||||||
|
"Game": "ゲーム",
|
||||||
|
"PFPS ": "PFPS ",
|
||||||
|
"FPS ": "FPS ",
|
||||||
|
"Resolutions ": "解像度 ",
|
||||||
|
"Read Speed ": "読み込み速度 ",
|
||||||
|
"Press ": "押す ",
|
||||||
|
" to Exit": " で終了",
|
||||||
|
"Depth": "深度",
|
||||||
|
"Viewport": "ビューポート",
|
||||||
|
"Game is not running\nor it's incompatible.": "ゲームが実行されていない\nまたは非対応です。",
|
||||||
|
"Battery Stats": "バッテリー統計",
|
||||||
|
"Actual Capacity": "実際の容量",
|
||||||
|
"Designed Capacity": "設計容量",
|
||||||
|
"Temperature": "温度",
|
||||||
|
"Raw Charge": "生充電量",
|
||||||
|
"Age": "経年",
|
||||||
|
"Voltage": "電圧",
|
||||||
|
"Current Flow": "電流フロー",
|
||||||
|
"Power Flow": "電力フロー",
|
||||||
|
"Remaining Time": "残り時間",
|
||||||
|
"Charger Stats": "充電器統計",
|
||||||
|
"Input Current Limit": "入力電流制限",
|
||||||
|
"VBUS Current Limit": "VBUS電流制限",
|
||||||
|
"Voltage Limit": "電圧制限",
|
||||||
|
"Current Limit": "電流制限",
|
||||||
|
"Type": "タイプ",
|
||||||
|
"Max Voltage": "最大電圧",
|
||||||
|
"Max Current": "最大電流",
|
||||||
|
"Multimedia Clock Rates": "マルチメディアクロックレート",
|
||||||
|
"NVDEC": "NVDEC",
|
||||||
|
"NVENC": "NVENC",
|
||||||
|
"NVJPG": "NVJPG",
|
||||||
|
"Network": "ネットワーク",
|
||||||
|
"Type: Wi-Fi": "タイプ: Wi-Fi",
|
||||||
|
"Press Y to show password": "Yを押してパスワードを表示",
|
||||||
|
"Type: Ethernet": "タイプ: Ethernet",
|
||||||
|
"Type: Not connected": "タイプ: 未接続",
|
||||||
|
"CPU\nGPU\nRAM\nSOC\nPCB\nSKN": "CPU\nGPU\nRAM\nSOC\nPCB\nSKN",
|
||||||
|
"Elements Move Down Move Up": "要素 下へ 上へ",
|
||||||
|
"Transparent": "透明",
|
||||||
|
"Opaque": "不透明",
|
||||||
|
"Alpha": "アルファ",
|
||||||
|
"Pretty": "プリティ",
|
||||||
|
"Compact": "コンパクト",
|
||||||
|
"FileSafe": "ファイルセーフ",
|
||||||
|
"Day+Time": "日+時間",
|
||||||
|
"Date+Time(s)": "日付+時間(s)",
|
||||||
|
"Date+Time AM/PM": "日付+時間 AM/PM",
|
||||||
|
"Date+Time(s) AM/PM": "日付+時間(s) AM/PM",
|
||||||
|
"Date+Time EU": "日付+時間 EU",
|
||||||
|
"Date+Time EU AM/PM": "日付+時間 EU AM/PM",
|
||||||
|
"Date+Time(s) EU AM/PM": "日付+時間(s) EU AM/PM",
|
||||||
|
"Date+Time ISO": "日付+時間 ISO",
|
||||||
|
"Time 24h": "時間 24h",
|
||||||
|
"Time AM/PM": "時間 AM/PM",
|
||||||
|
"Time(s) 24h": "時間(s) 24h",
|
||||||
|
"Time(s) AM/PM": "時間(s) AM/PM",
|
||||||
|
"Date US": "日付 US",
|
||||||
|
"Date EU": "日付 EU",
|
||||||
|
"Date ISO": "日付 ISO",
|
||||||
|
"Date Short": "短い日付",
|
||||||
|
"DTC Format": "DTC形式",
|
||||||
|
"Toggles": "トグル",
|
||||||
|
"Info": "情報表示",
|
||||||
|
"Disable Screenshots": "スクリーンショット無効",
|
||||||
|
"Real Freqs": "実際の周波数",
|
||||||
|
"Deltas": "デルタ",
|
||||||
|
"Target Freqs": "目標周波数",
|
||||||
|
"FPS": "FPS",
|
||||||
|
"RES": "解像度",
|
||||||
|
"Read Speed": "読み込み速度",
|
||||||
|
"Real Frequencies": "実際の周波数",
|
||||||
|
"Real Voltages": "実際の電圧",
|
||||||
|
"Full CPU": "フルCPU",
|
||||||
|
"VDDQ": "VDDQ",
|
||||||
|
"VDD2": "VDD2",
|
||||||
|
"Full Resolution": "フル解像度",
|
||||||
|
"SOC Voltage": "SOC電圧",
|
||||||
|
"RAM Load CPU/GPU": "RAM負荷 CPU/GPU",
|
||||||
|
"Use DTC Symbol": "DTCシンボル使用",
|
||||||
|
"Use Dynamic Colors": "ダイナミックカラー使用",
|
||||||
|
"Sleep Exit": "スリープ解除",
|
||||||
|
"Configuration": "設定",
|
||||||
|
"Refresh Rate": "リフレッシュレート",
|
||||||
|
"Frame Padding": "フレームパディング",
|
||||||
|
" Font Size": " フォントサイズ",
|
||||||
|
"Font Sizes": "フォントサイズ",
|
||||||
|
"Handheld Font Size": "携帯モードフォントサイズ",
|
||||||
|
"Docked Font Size": "ドックモードフォントサイズ",
|
||||||
|
"Black": "黒",
|
||||||
|
"Dark Gray": "ダークグレー",
|
||||||
|
"Gray": "グレー",
|
||||||
|
"Light Gray": "ライトグレー",
|
||||||
|
"Silver": "シルバー",
|
||||||
|
"White": "白",
|
||||||
|
"Dark Red": "ダークレッド",
|
||||||
|
"Red": "赤",
|
||||||
|
"Light Red": "ライト レッド",
|
||||||
|
"Pink": "ピンク",
|
||||||
|
"Dark Green": "ダークグリーン",
|
||||||
|
"Green": "緑",
|
||||||
|
"Lime Green": "ライムグリーン",
|
||||||
|
"Light Green": "ライトグリーン",
|
||||||
|
"Dark Blue": "ダークブルー",
|
||||||
|
"Blue": "青",
|
||||||
|
"Light Blue": "ライトブルー",
|
||||||
|
"Sky Blue": "スカイブルー",
|
||||||
|
"Dark Purple": "ダークパープル",
|
||||||
|
"Purple": "パープル",
|
||||||
|
"Light Purple": "ライトパープル",
|
||||||
|
"Violet": "バイオレット",
|
||||||
|
"Orange": "オレンジ",
|
||||||
|
"Yellow": "黄",
|
||||||
|
"Light Yellow": "ライトイエロー",
|
||||||
|
"Teal": "ティール",
|
||||||
|
"Cyan": "シアン",
|
||||||
|
"Light Cyan": "ライトシアン",
|
||||||
|
"Magenta": "マゼンタ",
|
||||||
|
"Hot Pink": "ホットピンク",
|
||||||
|
"Brown": "ブラウン",
|
||||||
|
"Light Brown": "ライトブラウン",
|
||||||
|
"Colors": "色",
|
||||||
|
"Background Color": "背景色",
|
||||||
|
"Background Alpha": "背景アルファ",
|
||||||
|
"Focus Color": "フォーカス色",
|
||||||
|
"Focus Alpha": "フォーカスアルファ",
|
||||||
|
"Text Color": "文字色",
|
||||||
|
"Border": "枠線",
|
||||||
|
"Dashed Line": "破線",
|
||||||
|
"Max FPS Text": "最大FPSテキスト",
|
||||||
|
"Min FPS Text": "最小FPSテキスト",
|
||||||
|
"Main Line": "主線",
|
||||||
|
"Rounded Line": "丸角線",
|
||||||
|
"Perfect Line": "完璧線",
|
||||||
|
" Color": " 色",
|
||||||
|
" Alpha": " アルファ",
|
||||||
|
"Category Color": "カテゴリ色",
|
||||||
|
"Category Color 1": "カテゴリ色 1",
|
||||||
|
"Category Color 2": "カテゴリ色 2",
|
||||||
|
"Separator Color": "セパレータ色",
|
||||||
|
"Elements": "要素",
|
||||||
|
"Text Alignment": "テキスト配置",
|
||||||
|
"Vertical Position": "垂直位置",
|
||||||
|
"Horizontal Position": "水平位置",
|
||||||
|
"Left": "左",
|
||||||
|
"Right": "右",
|
||||||
|
"Top": "上",
|
||||||
|
"Center": "中央",
|
||||||
|
"Bottom": "下",
|
||||||
|
"FPS Counter Color": "FPSカウンター色",
|
||||||
|
"FPS Counter Alpha": "FPSカウンターアルファ",
|
||||||
|
"Border Color": "枠線色",
|
||||||
|
"Dashed Line Color": "破線色",
|
||||||
|
"Dashed Line Alpha": "破線アルファ",
|
||||||
|
"Max FPS Text Color": "最大FPSテキスト色",
|
||||||
|
"Min FPS Text Color": "最小FPSテキスト色",
|
||||||
|
"Main Line Color": "主線色",
|
||||||
|
"Rounded Line Color": "丸角線色",
|
||||||
|
"Perfect Line Color": "完璧線色"
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
{
|
||||||
|
"Horizon OC Monitor": "Horizon OC Monitor",
|
||||||
|
"Modes": "모드",
|
||||||
|
"Modes Configure": "모드 설정",
|
||||||
|
"Full": "전체",
|
||||||
|
"Mini": "미니",
|
||||||
|
"Micro": "마이크로",
|
||||||
|
"FPS Graph": "FPS 그래프",
|
||||||
|
"FPS Counter": "FPS 카운터",
|
||||||
|
"Game Resolutions": "게임 해상도",
|
||||||
|
"Other": "기타",
|
||||||
|
"Battery/Charger": "배터리/충전기",
|
||||||
|
"Miscellaneous": "기타",
|
||||||
|
"CPU Usage": "CPU 사용량",
|
||||||
|
"GPU Usage": "GPU 사용량",
|
||||||
|
"RAM Usage": "RAM 사용량",
|
||||||
|
"Target Frequency": "목표 주파수",
|
||||||
|
"Real Frequency": "실제 주파수",
|
||||||
|
"Core 0 ": "코어 0 ",
|
||||||
|
"Core 1 ": "코어 1 ",
|
||||||
|
"Core 2 ": "코어 2 ",
|
||||||
|
"Core 3 ": "코어 3 ",
|
||||||
|
"Load": "부하",
|
||||||
|
"Total\nApplication\nApplet\nSystem\nSystem Unsafe": "합계\n앱\n애플릿\n시스템\n시스템(비안전)",
|
||||||
|
"Board": "보드",
|
||||||
|
"Battery Power Flow": "배터리 전력 흐름",
|
||||||
|
"\nTemperatures": "\n온도",
|
||||||
|
"SoC\nPCB\nSkin": "SoC\nPCB\nSkin",
|
||||||
|
"Fan Rotation Level": "팬 회전 레벨",
|
||||||
|
"Game": "게임",
|
||||||
|
"PFPS ": "PFPS ",
|
||||||
|
"FPS ": "FPS ",
|
||||||
|
"Resolutions ": "해상도 ",
|
||||||
|
"Read Speed ": "읽기 속도 ",
|
||||||
|
"Press ": "누르기 ",
|
||||||
|
" to Exit": " 종료",
|
||||||
|
"Depth": "깊이",
|
||||||
|
"Viewport": "뷰포트",
|
||||||
|
"Game is not running\nor it's incompatible.": "게임이 실행 중이 아니거나\n호환되지 않습니다.",
|
||||||
|
"Battery Stats": "배터리 통계",
|
||||||
|
"Actual Capacity": "실제 용량",
|
||||||
|
"Designed Capacity": "설계 용량",
|
||||||
|
"Temperature": "온도",
|
||||||
|
"Raw Charge": "원시 충전량",
|
||||||
|
"Age": "수명",
|
||||||
|
"Voltage": "전압",
|
||||||
|
"Current Flow": "전류 흐름",
|
||||||
|
"Power Flow": "전력 흐름",
|
||||||
|
"Remaining Time": "남은 시간",
|
||||||
|
"Charger Stats": "충전기 통계",
|
||||||
|
"Input Current Limit": "입력 전류 제한",
|
||||||
|
"VBUS Current Limit": "VBUS 전류 제한",
|
||||||
|
"Voltage Limit": "전압 제한",
|
||||||
|
"Current Limit": "전류 제한",
|
||||||
|
"Type": "유형",
|
||||||
|
"Max Voltage": "최대 전압",
|
||||||
|
"Max Current": "최대 전류",
|
||||||
|
"Multimedia Clock Rates": "멀티미디어 클럭 속도",
|
||||||
|
"NVDEC": "NVDEC",
|
||||||
|
"NVENC": "NVENC",
|
||||||
|
"NVJPG": "NVJPG",
|
||||||
|
"Network": "네트워크",
|
||||||
|
"Type: Wi-Fi": "유형: Wi-Fi",
|
||||||
|
"Press Y to show password": "Y를 눌러 비밀번호 표시",
|
||||||
|
"Type: Ethernet": "유형: 이더넷",
|
||||||
|
"Type: Not connected": "유형: 연결 안 됨",
|
||||||
|
"CPU\nGPU\nRAM\nSOC\nPCB\nSKN": "CPU\nGPU\nRAM\nSOC\nPCB\nSKN",
|
||||||
|
"Elements Move Down Move Up": "요소 아래로 위로",
|
||||||
|
"Transparent": "투명",
|
||||||
|
"Opaque": "불투명",
|
||||||
|
"Alpha": "알파",
|
||||||
|
"Pretty": "예쁨",
|
||||||
|
"Compact": "컴팩트",
|
||||||
|
"FileSafe": "파일세이프",
|
||||||
|
"Day+Time": "일+시간",
|
||||||
|
"Date+Time(s)": "날짜+시간(s)",
|
||||||
|
"Date+Time AM/PM": "날짜+시간 AM/PM",
|
||||||
|
"Date+Time(s) AM/PM": "날짜+시간(s) AM/PM",
|
||||||
|
"Date+Time EU": "날짜+시간 EU",
|
||||||
|
"Date+Time EU AM/PM": "날짜+시간 EU AM/PM",
|
||||||
|
"Date+Time(s) EU AM/PM": "날짜+시간(s) EU AM/PM",
|
||||||
|
"Date+Time ISO": "날짜+시간 ISO",
|
||||||
|
"Time 24h": "시간 24시",
|
||||||
|
"Time AM/PM": "시간 AM/PM",
|
||||||
|
"Time(s) 24h": "시간(s) 24시",
|
||||||
|
"Time(s) AM/PM": "시간(s) AM/PM",
|
||||||
|
"Date US": "날짜 US",
|
||||||
|
"Date EU": "날짜 EU",
|
||||||
|
"Date ISO": "날짜 ISO",
|
||||||
|
"Date Short": "짧은 날짜",
|
||||||
|
"DTC Format": "DTC 형식",
|
||||||
|
"Toggles": "토글",
|
||||||
|
"Info": "정보 표시",
|
||||||
|
"Disable Screenshots": "스크린샷 비활성화",
|
||||||
|
"Real Freqs": "실제 주파수",
|
||||||
|
"Deltas": "델타",
|
||||||
|
"Target Freqs": "목표 주파수",
|
||||||
|
"FPS": "FPS",
|
||||||
|
"RES": "해상도",
|
||||||
|
"Read Speed": "읽기 속도",
|
||||||
|
"Real Frequencies": "실제 주파수",
|
||||||
|
"Real Voltages": "실제 전압",
|
||||||
|
"Full CPU": "전체 CPU",
|
||||||
|
"VDDQ": "VDDQ",
|
||||||
|
"VDD2": "VDD2",
|
||||||
|
"Full Resolution": "전체 해상도",
|
||||||
|
"SOC Voltage": "SOC 전압",
|
||||||
|
"RAM Load CPU/GPU": "RAM 부하 CPU/GPU",
|
||||||
|
"Use DTC Symbol": "DTC 심볼 사용",
|
||||||
|
"Use Dynamic Colors": "동적 색상 사용",
|
||||||
|
"Sleep Exit": "절전 종료",
|
||||||
|
"Configuration": "설정",
|
||||||
|
"Refresh Rate": "리프레시 레이트",
|
||||||
|
"Frame Padding": "프레임 패딩",
|
||||||
|
" Font Size": " 글꼴 크기",
|
||||||
|
"Font Sizes": "글꼴 크기",
|
||||||
|
"Handheld Font Size": "핸드헬드 글꼴 크기",
|
||||||
|
"Docked Font Size": "도킹 글꼴 크기",
|
||||||
|
"Black": "검정",
|
||||||
|
"Dark Gray": "짙은 회색",
|
||||||
|
"Gray": "회색",
|
||||||
|
"Light Gray": "밝은 회색",
|
||||||
|
"Silver": "은색",
|
||||||
|
"White": "흰색",
|
||||||
|
"Dark Red": "짙은 빨강",
|
||||||
|
"Red": "빨강",
|
||||||
|
"Light Red": "밝은 빨강",
|
||||||
|
"Pink": "분홍",
|
||||||
|
"Dark Green": "짙은 초록",
|
||||||
|
"Green": "초록",
|
||||||
|
"Lime Green": "라임 그린",
|
||||||
|
"Light Green": "밝은 초록",
|
||||||
|
"Dark Blue": "짙은 파랑",
|
||||||
|
"Blue": "파랑",
|
||||||
|
"Light Blue": "밝은 파랑",
|
||||||
|
"Sky Blue": "하늘색",
|
||||||
|
"Dark Purple": "짙은 보라",
|
||||||
|
"Purple": "보라",
|
||||||
|
"Light Purple": "밝은 보라",
|
||||||
|
"Violet": "바이올렛",
|
||||||
|
"Orange": "주황",
|
||||||
|
"Yellow": "노랑",
|
||||||
|
"Light Yellow": "밝은 노랑",
|
||||||
|
"Teal": "청록",
|
||||||
|
"Cyan": "시안",
|
||||||
|
"Light Cyan": "밝은 시안",
|
||||||
|
"Magenta": "마젠타",
|
||||||
|
"Hot Pink": "핫핑크",
|
||||||
|
"Brown": "갈색",
|
||||||
|
"Light Brown": "밝은 갈색",
|
||||||
|
"Colors": "색상",
|
||||||
|
"Background Color": "배경색",
|
||||||
|
"Background Alpha": "배경 투명도",
|
||||||
|
"Focus Color": "포커스 색상",
|
||||||
|
"Focus Alpha": "포커스 투명도",
|
||||||
|
"Text Color": "텍스트 색상",
|
||||||
|
"Border": "테두리",
|
||||||
|
"Dashed Line": "점선",
|
||||||
|
"Max FPS Text": "최대 FPS 텍스트",
|
||||||
|
"Min FPS Text": "최소 FPS 텍스트",
|
||||||
|
"Main Line": "주선",
|
||||||
|
"Rounded Line": "둥근 선",
|
||||||
|
"Perfect Line": "완벽 선",
|
||||||
|
" Color": " 색상",
|
||||||
|
" Alpha": " 투명도",
|
||||||
|
"Category Color": "카테고리 색상",
|
||||||
|
"Category Color 1": "카테고리 색상 1",
|
||||||
|
"Category Color 2": "카테고리 색상 2",
|
||||||
|
"Separator Color": "구분선 색상",
|
||||||
|
"Elements": "요소",
|
||||||
|
"Text Alignment": "텍스트 정렬",
|
||||||
|
"Vertical Position": "세로 위치",
|
||||||
|
"Horizontal Position": "가로 위치",
|
||||||
|
"Left": "왼쪽",
|
||||||
|
"Right": "오른쪽",
|
||||||
|
"Top": "위",
|
||||||
|
"Center": "가운데",
|
||||||
|
"Bottom": "아래",
|
||||||
|
"FPS Counter Color": "FPS 카운터 색상",
|
||||||
|
"FPS Counter Alpha": "FPS 카운터 투명도",
|
||||||
|
"Border Color": "테두리 색상",
|
||||||
|
"Dashed Line Color": "점선 색상",
|
||||||
|
"Dashed Line Alpha": "점선 투명도",
|
||||||
|
"Max FPS Text Color": "최대 FPS 텍스트 색상",
|
||||||
|
"Min FPS Text Color": "최소 FPS 텍스트 색상",
|
||||||
|
"Main Line Color": "주선 색상",
|
||||||
|
"Rounded Line Color": "둥근 선 색상",
|
||||||
|
"Perfect Line Color": "완벽 선 색상"
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
{
|
||||||
|
"Horizon OC Monitor": "Horizon OC Monitor",
|
||||||
|
"Modes": "Modi",
|
||||||
|
"Modes Configure": "Modi Configureren",
|
||||||
|
"Full": "Volledig",
|
||||||
|
"Mini": "Mini",
|
||||||
|
"Micro": "Micro",
|
||||||
|
"FPS Graph": "FPS-grafiek",
|
||||||
|
"FPS Counter": "FPS-teller",
|
||||||
|
"Game Resolutions": "Spelresoluties",
|
||||||
|
"Other": "Overig",
|
||||||
|
"Battery/Charger": "Batterij/Oplader",
|
||||||
|
"Miscellaneous": "Diversen",
|
||||||
|
"CPU Usage": "CPU-gebruik",
|
||||||
|
"GPU Usage": "GPU-gebruik",
|
||||||
|
"RAM Usage": "RAM-gebruik",
|
||||||
|
"Target Frequency": "Doelfrequentie",
|
||||||
|
"Real Frequency": "Werkelijke frequentie",
|
||||||
|
"Core 0 ": "Kern 0 ",
|
||||||
|
"Core 1 ": "Kern 1 ",
|
||||||
|
"Core 2 ": "Kern 2 ",
|
||||||
|
"Core 3 ": "Kern 3 ",
|
||||||
|
"Load": "Belasting",
|
||||||
|
"Total\nApplication\nApplet\nSystem\nSystem Unsafe": "Totaal\nApplicatie\nApplet\nSysteem\nSysteem onveilig",
|
||||||
|
"Board": "Bord",
|
||||||
|
"Battery Power Flow": "Batterijstroom",
|
||||||
|
"\nTemperatures": "\nTemperaturen",
|
||||||
|
"SoC\nPCB\nSkin": "SoC\nPCB\nSkin",
|
||||||
|
"Fan Rotation Level": "Ventilatorrotatieniveau",
|
||||||
|
"Game": "Spel",
|
||||||
|
"PFPS ": "PFPS ",
|
||||||
|
"FPS ": "FPS ",
|
||||||
|
"Resolutions ": "Resoluties ",
|
||||||
|
"Read Speed ": "Leessnelheid ",
|
||||||
|
"Press ": "Druk op ",
|
||||||
|
" to Exit": " om af te sluiten",
|
||||||
|
"Depth": "Diepte",
|
||||||
|
"Viewport": "Viewport",
|
||||||
|
"Game is not running\nor it's incompatible.": "Spel draait niet\nof is incompatibel.",
|
||||||
|
"Battery Stats": "Batterijstatistieken",
|
||||||
|
"Actual Capacity": "Werkelijke capaciteit",
|
||||||
|
"Designed Capacity": "Ontworpen capaciteit",
|
||||||
|
"Temperature": "Temperatuur",
|
||||||
|
"Raw Charge": "Ruwe lading",
|
||||||
|
"Age": "Leeftijd",
|
||||||
|
"Voltage": "Spanning",
|
||||||
|
"Current Flow": "Stroomstroom",
|
||||||
|
"Power Flow": "Stroomverbruik",
|
||||||
|
"Remaining Time": "Resterende tijd",
|
||||||
|
"Charger Stats": "Opladerstatistieken",
|
||||||
|
"Input Current Limit": "Ingangsstroomlimiet",
|
||||||
|
"VBUS Current Limit": "VBUS-stroomlimiet",
|
||||||
|
"Voltage Limit": "Spanningslimiet",
|
||||||
|
"Current Limit": "Stroomlimiet",
|
||||||
|
"Type": "Type",
|
||||||
|
"Max Voltage": "Max spanning",
|
||||||
|
"Max Current": "Max stroom",
|
||||||
|
"Multimedia Clock Rates": "Multimedia kloksnelheden",
|
||||||
|
"NVDEC": "NVDEC",
|
||||||
|
"NVENC": "NVENC",
|
||||||
|
"NVJPG": "NVJPG",
|
||||||
|
"Network": "Netwerk",
|
||||||
|
"Type: Wi-Fi": "Type: Wi-Fi",
|
||||||
|
"Press Y to show password": "Druk op Y om wachtwoord te tonen",
|
||||||
|
"Type: Ethernet": "Type: Ethernet",
|
||||||
|
"Type: Not connected": "Type: Niet verbonden",
|
||||||
|
"CPU\nGPU\nRAM\nSOC\nPCB\nSKN": "CPU\nGPU\nRAM\nSOC\nPCB\nSKN",
|
||||||
|
"Elements Move Down Move Up": "Elementen Omlaag verplaatsen Omhoog verplaatsen",
|
||||||
|
"Transparent": "Transparant",
|
||||||
|
"Opaque": "Ondoorzichtig",
|
||||||
|
"Alpha": "Alpha",
|
||||||
|
"Pretty": "Mooi",
|
||||||
|
"Compact": "Compact",
|
||||||
|
"FileSafe": "FileSafe",
|
||||||
|
"Day+Time": "Dag+Tijd",
|
||||||
|
"Date+Time(s)": "Datum+Tijd(s)",
|
||||||
|
"Date+Time AM/PM": "Datum+Tijd AM/PM",
|
||||||
|
"Date+Time(s) AM/PM": "Datum+Tijd(s) AM/PM",
|
||||||
|
"Date+Time EU": "Datum+Tijd EU",
|
||||||
|
"Date+Time EU AM/PM": "Datum+Tijd EU AM/PM",
|
||||||
|
"Date+Time(s) EU AM/PM": "Datum+Tijd(s) EU AM/PM",
|
||||||
|
"Date+Time ISO": "Datum+Tijd ISO",
|
||||||
|
"Time 24h": "Tijd 24u",
|
||||||
|
"Time AM/PM": "Tijd AM/PM",
|
||||||
|
"Time(s) 24h": "Tijd(s) 24u",
|
||||||
|
"Time(s) AM/PM": "Tijd(s) AM/PM",
|
||||||
|
"Date US": "Datum VS",
|
||||||
|
"Date EU": "Datum EU",
|
||||||
|
"Date ISO": "Datum ISO",
|
||||||
|
"Date Short": "Datum kort",
|
||||||
|
"DTC Format": "DTC-formaat",
|
||||||
|
"Toggles": "Schakelaars",
|
||||||
|
"Info": "Info tonen",
|
||||||
|
"Disable Screenshots": "Schermafbeeldingen uitschakelen",
|
||||||
|
"Real Freqs": "Werkelijke frequenties",
|
||||||
|
"Deltas": "Delta's",
|
||||||
|
"Target Freqs": "Doelfrequenties",
|
||||||
|
"FPS": "FPS",
|
||||||
|
"RES": "RES",
|
||||||
|
"Read Speed": "Leessnelheid",
|
||||||
|
"Real Frequencies": "Werkelijke frequenties",
|
||||||
|
"Real Voltages": "Werkelijke spanningen",
|
||||||
|
"Full CPU": "Volledige CPU",
|
||||||
|
"VDDQ": "VDDQ",
|
||||||
|
"VDD2": "VDD2",
|
||||||
|
"Full Resolution": "Volledige resolutie",
|
||||||
|
"SOC Voltage": "SOC-spanning",
|
||||||
|
"RAM Load CPU/GPU": "RAM-belasting CPU/GPU",
|
||||||
|
"Use DTC Symbol": "DTC-symbool gebruiken",
|
||||||
|
"Use Dynamic Colors": "Dynamische kleuren gebruiken",
|
||||||
|
"Sleep Exit": "Slaap afsluiten",
|
||||||
|
"Configuration": "Configuratie",
|
||||||
|
"Refresh Rate": "Vernieuwingsfrequentie",
|
||||||
|
"Frame Padding": "Frame opvulling",
|
||||||
|
" Font Size": " Lettergrootte",
|
||||||
|
"Font Sizes": "Lettergroottes",
|
||||||
|
"Handheld Font Size": "Handheld lettergrootte",
|
||||||
|
"Docked Font Size": "Docked lettergrootte",
|
||||||
|
"Black": "Zwart",
|
||||||
|
"Dark Gray": "Donkergrijs",
|
||||||
|
"Gray": "Grijs",
|
||||||
|
"Light Gray": "Lichtgrijs",
|
||||||
|
"Silver": "Zilver",
|
||||||
|
"White": "Wit",
|
||||||
|
"Dark Red": "Donkerrood",
|
||||||
|
"Red": "Rood",
|
||||||
|
"Light Red": "Lichtrood",
|
||||||
|
"Pink": "Roze",
|
||||||
|
"Dark Green": "Donkergroen",
|
||||||
|
"Green": "Groen",
|
||||||
|
"Lime Green": "Limoengroen",
|
||||||
|
"Light Green": "Lichtgroen",
|
||||||
|
"Dark Blue": "Donkerblauw",
|
||||||
|
"Blue": "Blauw",
|
||||||
|
"Light Blue": "Lichtblauw",
|
||||||
|
"Sky Blue": "Hemelsblauw",
|
||||||
|
"Dark Purple": "Donkerpaars",
|
||||||
|
"Purple": "Paars",
|
||||||
|
"Light Purple": "Lichtpaars",
|
||||||
|
"Violet": "Violet",
|
||||||
|
"Orange": "Oranje",
|
||||||
|
"Yellow": "Geel",
|
||||||
|
"Light Yellow": "Lichtgeel",
|
||||||
|
"Teal": "Teal",
|
||||||
|
"Cyan": "Cyaan",
|
||||||
|
"Light Cyan": "Lichtcyaan",
|
||||||
|
"Magenta": "Magenta",
|
||||||
|
"Hot Pink": "Felroze",
|
||||||
|
"Brown": "Bruin",
|
||||||
|
"Light Brown": "Lichtbruin",
|
||||||
|
"Colors": "Kleuren",
|
||||||
|
"Background Color": "Achtergrondkleur",
|
||||||
|
"Background Alpha": "Achtergrond alpha",
|
||||||
|
"Focus Color": "Focuskleur",
|
||||||
|
"Focus Alpha": "Focus alpha",
|
||||||
|
"Text Color": "Tekstkleur",
|
||||||
|
"Border": "Rand",
|
||||||
|
"Dashed Line": "Gestippelde lijn",
|
||||||
|
"Max FPS Text": "Max FPS tekst",
|
||||||
|
"Min FPS Text": "Min FPS tekst",
|
||||||
|
"Main Line": "Hoofdlijn",
|
||||||
|
"Rounded Line": "Afgeronde lijn",
|
||||||
|
"Perfect Line": "Perfecte lijn",
|
||||||
|
" Color": " Kleur",
|
||||||
|
" Alpha": " Alpha",
|
||||||
|
"Category Color": "Categoriekleur",
|
||||||
|
"Category Color 1": "Categoriekleur 1",
|
||||||
|
"Category Color 2": "Categoriekleur 2",
|
||||||
|
"Separator Color": "Scheidingskleur",
|
||||||
|
"Elements": "Elementen",
|
||||||
|
"Text Alignment": "Tekstuitlijning",
|
||||||
|
"Vertical Position": "Verticale positie",
|
||||||
|
"Horizontal Position": "Horizontale positie",
|
||||||
|
"Left": "Links",
|
||||||
|
"Right": "Rechts",
|
||||||
|
"Top": "Boven",
|
||||||
|
"Center": "Midden",
|
||||||
|
"Bottom": "Onder",
|
||||||
|
"FPS Counter Color":"FPS-tellerkleur",
|
||||||
|
"FPS Counter Alpha":"FPS-teller alpha",
|
||||||
|
"Border Color":"Randkleur",
|
||||||
|
"Dashed Line Color":"Gestippelde lijnkleur",
|
||||||
|
"Dashed Line Alpha":"Gestippelde lijn alpha",
|
||||||
|
"Max FPS Text Color":"Max FPS tekstkleur",
|
||||||
|
"Min FPS Text Color":"Min FPS tekstkleur",
|
||||||
|
"Main Line Color":"Hoofdlijnkleur",
|
||||||
|
"Rounded Line Color":"Afgeronde lijnkleur",
|
||||||
|
"Perfect Line Color":"Perfecte lijnkleur"
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
{
|
||||||
|
"Horizon OC Monitor": "Horizon OC Monitor",
|
||||||
|
"Modes": "Tryby",
|
||||||
|
"Modes Configure": "Tryby Konfiguruj",
|
||||||
|
"Full": "Pełny",
|
||||||
|
"Mini": "Mini",
|
||||||
|
"Micro": "Mikro",
|
||||||
|
"FPS Graph": "Wykres FPS",
|
||||||
|
"FPS Counter": "Licznik FPS",
|
||||||
|
"Game Resolutions": "Rozdzielczości gry",
|
||||||
|
"Other": "Inne",
|
||||||
|
"Battery/Charger": "Bateria/Ładowarka",
|
||||||
|
"Miscellaneous": "Różne",
|
||||||
|
"CPU Usage": "Użycie CPU",
|
||||||
|
"GPU Usage": "Użycie GPU",
|
||||||
|
"RAM Usage": "Użycie RAM",
|
||||||
|
"Target Frequency": "Częstotliwość docelowa",
|
||||||
|
"Real Frequency": "Rzeczywista częstotliwość",
|
||||||
|
"Core 0 ": "Rdzeń 0 ",
|
||||||
|
"Core 1 ": "Rdzeń 1 ",
|
||||||
|
"Core 2 ": "Rdzeń 2 ",
|
||||||
|
"Core 3 ": "Rdzeń 3 ",
|
||||||
|
"Load": "Obciążenie",
|
||||||
|
"Total\nApplication\nApplet\nSystem\nSystem Unsafe": "Razem\nAplikacja\nApplet\nSystem\nSystem (niebezpieczny)",
|
||||||
|
"Board": "Płyta",
|
||||||
|
"Battery Power Flow": "Przepływ mocy baterii",
|
||||||
|
"\nTemperatures": "\nTemperatury",
|
||||||
|
"SoC\nPCB\nSkin": "SoC\nPCB\nSkin",
|
||||||
|
"Fan Rotation Level": "Poziom obrotów wentylatora",
|
||||||
|
"Game": "Gra",
|
||||||
|
"PFPS ": "PFPS ",
|
||||||
|
"FPS ": "FPS ",
|
||||||
|
"Resolutions ": "Rozdzielczości ",
|
||||||
|
"Read Speed ": "Prędkość odczytu ",
|
||||||
|
"Press ": "Naciśnij ",
|
||||||
|
" to Exit": " aby wyjść",
|
||||||
|
"Depth": "Głębia",
|
||||||
|
"Viewport": "Viewport",
|
||||||
|
"Game is not running\nor it's incompatible.": "Gra nie jest uruchomiona\nlub jest niekompatybilna.",
|
||||||
|
"Battery Stats": "Statystyki baterii",
|
||||||
|
"Actual Capacity": "Rzeczywista pojemność",
|
||||||
|
"Designed Capacity": "Pojemność znamionowa",
|
||||||
|
"Temperature": "Temperatura",
|
||||||
|
"Raw Charge": "Surowy poziom naładowania",
|
||||||
|
"Age": "Wiek",
|
||||||
|
"Voltage": "Napięcie",
|
||||||
|
"Current Flow": "Przepływ prądu",
|
||||||
|
"Power Flow": "Przepływ mocy",
|
||||||
|
"Remaining Time": "Pozostały czas",
|
||||||
|
"Charger Stats": "Statystyki ładowarki",
|
||||||
|
"Input Current Limit": "Limit prądu wejściowego",
|
||||||
|
"VBUS Current Limit": "Limit prądu VBUS",
|
||||||
|
"Voltage Limit": "Limit napięcia",
|
||||||
|
"Current Limit": "Limit prądu",
|
||||||
|
"Type": "Typ",
|
||||||
|
"Max Voltage": "Maks. napięcie",
|
||||||
|
"Max Current": "Maks. prąd",
|
||||||
|
"Multimedia Clock Rates": "Taktowanie multimediów",
|
||||||
|
"NVDEC": "NVDEC",
|
||||||
|
"NVENC": "NVENC",
|
||||||
|
"NVJPG": "NVJPG",
|
||||||
|
"Network": "Sieć",
|
||||||
|
"Type: Wi-Fi": "Typ: Wi-Fi",
|
||||||
|
"Press Y to show password": "Naciśnij Y, aby pokazać hasło",
|
||||||
|
"Type: Ethernet": "Typ: Ethernet",
|
||||||
|
"Type: Not connected": "Typ: Nie połączono",
|
||||||
|
"CPU\nGPU\nRAM\nSOC\nPCB\nSKN": "CPU\nGPU\nRAM\nSOC\nPCB\nSKN",
|
||||||
|
"Elements Move Down Move Up": "Elementy Przesuń w dół Przesuń w górę",
|
||||||
|
"Transparent": "Przezroczysty",
|
||||||
|
"Opaque": "Nieprzezroczysty",
|
||||||
|
"Alpha": "Alfa",
|
||||||
|
"Pretty": "Ładny",
|
||||||
|
"Compact": "Kompaktowy",
|
||||||
|
"FileSafe": "FileSafe",
|
||||||
|
"Day+Time": "Dzień+Czas",
|
||||||
|
"Date+Time(s)": "Data+Czas(s)",
|
||||||
|
"Date+Time AM/PM": "Data+Czas AM/PM",
|
||||||
|
"Date+Time(s) AM/PM": "Data+Czas(s) AM/PM",
|
||||||
|
"Date+Time EU": "Data+Czas EU",
|
||||||
|
"Date+Time EU AM/PM": "Data+Czas EU AM/PM",
|
||||||
|
"Date+Time(s) EU AM/PM": "Data+Czas(s) EU AM/PM",
|
||||||
|
"Date+Time ISO": "Data+Czas ISO",
|
||||||
|
"Time 24h": "Czas 24h",
|
||||||
|
"Time AM/PM": "Czas AM/PM",
|
||||||
|
"Time(s) 24h": "Czas(s) 24h",
|
||||||
|
"Time(s) AM/PM": "Czas(s) AM/PM",
|
||||||
|
"Date US": "Data US",
|
||||||
|
"Date EU": "Data EU",
|
||||||
|
"Date ISO": "Data ISO",
|
||||||
|
"Date Short": "Krótka data",
|
||||||
|
"DTC Format": "Format DTC",
|
||||||
|
"Toggles": "Przełączniki",
|
||||||
|
"Info": "Pokaż informacje",
|
||||||
|
"Disable Screenshots": "Wyłącz zrzuty ekranu",
|
||||||
|
"Real Freqs": "Rzeczywiste częstotliwości",
|
||||||
|
"Deltas": "Delty",
|
||||||
|
"Target Freqs": "Docelowe częstotliwości",
|
||||||
|
"FPS": "FPS",
|
||||||
|
"RES": "ROZDZ.",
|
||||||
|
"Read Speed": "Prędkość odczytu",
|
||||||
|
"Real Frequencies": "Rzeczywiste częstotliwości",
|
||||||
|
"Real Voltages": "Rzeczywiste napięcia",
|
||||||
|
"Full CPU": "Pełny CPU",
|
||||||
|
"VDDQ": "VDDQ",
|
||||||
|
"VDD2": "VDD2",
|
||||||
|
"Full Resolution": "Pełna rozdzielczość",
|
||||||
|
"SOC Voltage": "Napięcie SOC",
|
||||||
|
"RAM Load CPU/GPU": "Obciążenie RAM CPU/GPU",
|
||||||
|
"Use DTC Symbol": "Użyj symbolu DTC",
|
||||||
|
"Use Dynamic Colors": "Użyj dynamicznych kolorów",
|
||||||
|
"Sleep Exit": "Wyjście z uśpienia",
|
||||||
|
"Configuration": "Konfiguracja",
|
||||||
|
"Refresh Rate": "Częstotliwość odświeżania",
|
||||||
|
"Frame Padding": "Wypełnienie ramki",
|
||||||
|
" Font Size": " Rozmiar czcionki",
|
||||||
|
"Font Sizes": "Rozmiary czcionki",
|
||||||
|
"Handheld Font Size": "Rozmiar czcionki w trybie przenośnym",
|
||||||
|
"Docked Font Size": "Rozmiar czcionki w trybie stacjonarnym",
|
||||||
|
"Black": "Czarny",
|
||||||
|
"Dark Gray": "Ciemnoszary",
|
||||||
|
"Gray": "Szary",
|
||||||
|
"Light Gray": "Jasnoszary",
|
||||||
|
"Silver": "Srebrny",
|
||||||
|
"White": "Biały",
|
||||||
|
"Dark Red": "Ciemnoczerwony",
|
||||||
|
"Red": "Czerwony",
|
||||||
|
"Light Red": "Jasnoczerwony",
|
||||||
|
"Pink": "Różowy",
|
||||||
|
"Dark Green": "Ciemnozielony",
|
||||||
|
"Green": "Zielony",
|
||||||
|
"Lime Green": "Limonkowy",
|
||||||
|
"Light Green": "Jasnozielony",
|
||||||
|
"Dark Blue": "Ciemnoniebieski",
|
||||||
|
"Blue": "Niebieski",
|
||||||
|
"Light Blue": "Jasnoniebieski",
|
||||||
|
"Sky Blue": "Błękitny",
|
||||||
|
"Dark Purple": "Ciemnofioletowy",
|
||||||
|
"Purple": "Fioletowy",
|
||||||
|
"Light Purple": "Jasnofioletowy",
|
||||||
|
"Violet": "Fiolet",
|
||||||
|
"Orange": "Pomarańczowy",
|
||||||
|
"Yellow": "Żółty",
|
||||||
|
"Light Yellow": "Jasnożółty",
|
||||||
|
"Teal": "Morski",
|
||||||
|
"Cyan": "Cyjan",
|
||||||
|
"Light Cyan": "Jasny cyjan",
|
||||||
|
"Magenta": "Magenta",
|
||||||
|
"Hot Pink": "Jaskrawo różowy",
|
||||||
|
"Brown": "Brązowy",
|
||||||
|
"Light Brown": "Jasnobrązowy",
|
||||||
|
"Colors": "Kolory",
|
||||||
|
"Background Color": "Kolor tła",
|
||||||
|
"Background Alpha": "Przezroczystość tła",
|
||||||
|
"Focus Color": "Kolor fokusu",
|
||||||
|
"Focus Alpha": "Przezroczystość fokusu",
|
||||||
|
"Text Color": "Kolor tekstu",
|
||||||
|
"Border": "Obramowanie",
|
||||||
|
"Dashed Line": "Linia przerywana",
|
||||||
|
"Max FPS Text": "Tekst maks. FPS",
|
||||||
|
"Min FPS Text": "Tekst min. FPS",
|
||||||
|
"Main Line": "Główna linia",
|
||||||
|
"Rounded Line": "Zaokrąglona linia",
|
||||||
|
"Perfect Line": "Idealna linia",
|
||||||
|
" Color": " Kolor",
|
||||||
|
" Alpha": " Alfa",
|
||||||
|
"Category Color": "Kolor kategorii",
|
||||||
|
"Category Color 1": "Kolor kategorii 1",
|
||||||
|
"Category Color 2": "Kolor kategorii 2",
|
||||||
|
"Separator Color": "Kolor separatora",
|
||||||
|
"Elements": "Elementy",
|
||||||
|
"Text Alignment": "Wyrównanie tekstu",
|
||||||
|
"Vertical Position": "Pozycja pionowa",
|
||||||
|
"Horizontal Position": "Pozycja pozioma",
|
||||||
|
"Left": "Lewo",
|
||||||
|
"Right": "Prawo",
|
||||||
|
"Top": "Góra",
|
||||||
|
"Center": "Środek",
|
||||||
|
"Bottom": "Dół",
|
||||||
|
"FPS Counter Color": "Kolor licznika FPS",
|
||||||
|
"FPS Counter Alpha": "Alfa licznika FPS",
|
||||||
|
"Border Color": "Kolor obramowania",
|
||||||
|
"Dashed Line Color": "Kolor linii przerywanej",
|
||||||
|
"Dashed Line Alpha": "Alfa linii przerywanej",
|
||||||
|
"Max FPS Text Color": "Kolor tekstu maks. FPS",
|
||||||
|
"Min FPS Text Color": "Kolor tekstu min. FPS",
|
||||||
|
"Main Line Color": "Kolor głównej linii",
|
||||||
|
"Rounded Line Color": "Kolor zaokrąglonej linii",
|
||||||
|
"Perfect Line Color": "Kolor idealnej linii"
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
{
|
||||||
|
"Horizon OC Monitor": "Horizon OC Monitor",
|
||||||
|
"Modes": "Modos",
|
||||||
|
"Modes Configure": "Modos Configurar",
|
||||||
|
"Full": "Completo",
|
||||||
|
"Mini": "Mini",
|
||||||
|
"Micro": "Micro",
|
||||||
|
"FPS Graph": "Gráfico FPS",
|
||||||
|
"FPS Counter": "Contador FPS",
|
||||||
|
"Game Resolutions": "Resoluções no Jogo",
|
||||||
|
"Other": "Outros",
|
||||||
|
"Battery/Charger": "Bateria/Carregador",
|
||||||
|
"Miscellaneous": "Diversos",
|
||||||
|
"CPU Usage": "Uso da CPU",
|
||||||
|
"GPU Usage": "Uso da GPU",
|
||||||
|
"RAM Usage": "Uso da RAM",
|
||||||
|
"Target Frequency": "Frequência Alvo",
|
||||||
|
"Real Frequency": "Frequência Real",
|
||||||
|
"Core 0 ": "Núcleo 0 ",
|
||||||
|
"Core 1 ": "Núcleo 1 ",
|
||||||
|
"Core 2 ": "Núcleo 2 ",
|
||||||
|
"Core 3 ": "Núcleo 3 ",
|
||||||
|
"Load": "Carga",
|
||||||
|
"Total\nApplication\nApplet\nSystem\nSystem Unsafe": "Total\nAplicativo\nMiniAplicativo\nSistema\nSistema Inseguro",
|
||||||
|
"Board": "Placa",
|
||||||
|
"Battery Power Flow": "Fluxo de Energia",
|
||||||
|
"\nTemperatures": "\nTemperaturas",
|
||||||
|
"SoC\nPCB\nSkin": "SoC\nPCB\nSkin",
|
||||||
|
"Fan Rotation Level": "Rotação da Fan",
|
||||||
|
"Game": "Jogo",
|
||||||
|
"PFPS ": "PFPS ",
|
||||||
|
"FPS ": "FPS ",
|
||||||
|
"Resolutions ": "Resoluções ",
|
||||||
|
"Read Speed ": "Velocidade de Leitura ",
|
||||||
|
"Press ": "Pressione ",
|
||||||
|
" to Exit": " para Sair",
|
||||||
|
"Depth": "Profundidade",
|
||||||
|
"Viewport": "Visualização",
|
||||||
|
"Game is not running\nor it's incompatible.": "O jogo não está rodando\n ou não é compatível.",
|
||||||
|
"Battery Stats": "Estatísticas da Bateria",
|
||||||
|
"Actual Capacity": "Capacidade Atual",
|
||||||
|
"Designed Capacity": "Capacidade Designada",
|
||||||
|
"Temperature": "Temperatura",
|
||||||
|
"Raw Charge": "Carga Bruta",
|
||||||
|
"Age": "Idade",
|
||||||
|
"Voltage": "Voltagem",
|
||||||
|
"Current Flow": "Fluxo de Corrente",
|
||||||
|
"Power Flow": "Fluxo de Potência",
|
||||||
|
"Remaining Time": "Tempo Restante",
|
||||||
|
"Charger Stats": "Estatísticas do Carregador",
|
||||||
|
"Input Current Limit": "Limite Corrente Entrada",
|
||||||
|
"VBUS Current Limit": "Limite Corrente VBUS",
|
||||||
|
"Voltage Limit": "Limite de Voltagem",
|
||||||
|
"Current Limit": "Limite Atual",
|
||||||
|
"Type": "Tipo",
|
||||||
|
"Max Voltage": "Voltagem Máxima",
|
||||||
|
"Max Current": "Corrente Máxima",
|
||||||
|
"Multimedia Clock Rates": "Frequências Multimídia",
|
||||||
|
"NVDEC": "NVDEC",
|
||||||
|
"NVENC": "NVENC",
|
||||||
|
"NVJPG": "NVJPG",
|
||||||
|
"Network": "Rede",
|
||||||
|
"Type: Wi-Fi": "Tipo: Wi-Fi",
|
||||||
|
"Press Y to show password": "Pressione Y para exibir a senha",
|
||||||
|
"Type: Ethernet": "Tipo: Ethernet",
|
||||||
|
"Type: Not connected": "Tipo: Não conectado",
|
||||||
|
"CPU\nGPU\nRAM\nSOC\nPCB\nSKN": "CPU\nGPU\nRAM\nSOC\nPCB\nSKN",
|
||||||
|
"Elements Move Down Move Up": "Elementos Descer Subir",
|
||||||
|
"Transparent": "Transparente",
|
||||||
|
"Opaque": "Opaco",
|
||||||
|
"Alpha": "Alfa",
|
||||||
|
"Pretty": "Bonito",
|
||||||
|
"Compact": "Compacto",
|
||||||
|
"FileSafe": "Seguro",
|
||||||
|
"Day+Time": "Dia+Hora",
|
||||||
|
"Date+Time(s)": "Data+Hora(s)",
|
||||||
|
"Date+Time AM/PM": "Data+Hora AM/PM",
|
||||||
|
"Date+Time(s) AM/PM": "Data+Hora(s) AM/PM",
|
||||||
|
"Date+Time EU": "Data+Hora EU",
|
||||||
|
"Date+Time EU AM/PM": "Data+Hora EU AM/PM",
|
||||||
|
"Date+Time(s) EU AM/PM": "Data+Hora(s) EU AM/PM",
|
||||||
|
"Date+Time ISO": "Data+Hora ISO",
|
||||||
|
"Time 24h": "Hora 24h",
|
||||||
|
"Time AM/PM": "Hora AM/PM",
|
||||||
|
"Time(s) 24h": "Hora(s) 24h",
|
||||||
|
"Time(s) AM/PM": "Hora(s) AM/PM",
|
||||||
|
"Date US": "Data US",
|
||||||
|
"Date EU": "Data EU",
|
||||||
|
"Date ISO": "Data ISO",
|
||||||
|
"Date Short": "Data Abreviada",
|
||||||
|
"DTC Format": "Formato DTC",
|
||||||
|
"Toggles": "Alternar",
|
||||||
|
"Info": "Informações",
|
||||||
|
"Disable Screenshots": "Desativar Capturas",
|
||||||
|
"Real Freqs": "Frequências Reais",
|
||||||
|
"Deltas": "Deltas",
|
||||||
|
"Target Freqs": "Frequências Alvo",
|
||||||
|
"FPS": "FPS",
|
||||||
|
"RES": "RES",
|
||||||
|
"Read Speed": "Velocidade de Leitura",
|
||||||
|
"Real Frequencies": "Frequências Reais",
|
||||||
|
"Real Voltages": "Voltagens Reais",
|
||||||
|
"Full CPU": "CPU Completa",
|
||||||
|
"VDDQ": "VDDQ",
|
||||||
|
"VDD2": "VDD2",
|
||||||
|
"Full Resolution": "Resolução Completa",
|
||||||
|
"SOC Voltage": "Voltagem do SOC",
|
||||||
|
"RAM Load CPU/GPU": "Carga na CPU/GPU",
|
||||||
|
"Use DTC Symbol": "Usar Símbolo DTC",
|
||||||
|
"Use Dynamic Colors": "Usar Cores Dinâmicas",
|
||||||
|
"Sleep Exit": "Sair do Repouso",
|
||||||
|
"Configuration": "Configuração",
|
||||||
|
"Refresh Rate": "Taxa de Atualização",
|
||||||
|
"Frame Padding": "Preenc. de Quadro",
|
||||||
|
" Font Size": " Tamanho da Fonte",
|
||||||
|
"Font Sizes": "Tamanho das Fontes",
|
||||||
|
"Handheld Font Size": "Modo Portátil",
|
||||||
|
"Docked Font Size": "Modo Dock",
|
||||||
|
"Black": "Preto",
|
||||||
|
"Dark Gray": "Cinza Escuro",
|
||||||
|
"Gray": "Cinza",
|
||||||
|
"Light Gray": "Cinza Claro",
|
||||||
|
"Silver": "Prata",
|
||||||
|
"White": "Branco",
|
||||||
|
"Dark Red": "Vermelho Escuro",
|
||||||
|
"Red": "Vermelho",
|
||||||
|
"Light Red": "LVermelho Claro",
|
||||||
|
"Pink": "Rosa",
|
||||||
|
"Dark Green": "Verde Escuro",
|
||||||
|
"Green": "Verde",
|
||||||
|
"Lime Green": "Verde Limão",
|
||||||
|
"Light Green": "Verde Claro",
|
||||||
|
"Dark Blue": "Azul Escuro",
|
||||||
|
"Blue": "Azul",
|
||||||
|
"Light Blue": "Azul Claro",
|
||||||
|
"Sky Blue": "Azul Céu",
|
||||||
|
"Dark Purple": "Roxo Escuro",
|
||||||
|
"Purple": "Roxo",
|
||||||
|
"Light Purple": "Roxo Claro",
|
||||||
|
"Violet": "Violeta",
|
||||||
|
"Orange": "Laranja",
|
||||||
|
"Yellow": "Amarelo",
|
||||||
|
"Light Yellow": "Amarelo Claro",
|
||||||
|
"Teal": "Verde Azulado",
|
||||||
|
"Cyan": "Ciano",
|
||||||
|
"Light Cyan": "Ciano Claro",
|
||||||
|
"Magenta": "Magenta",
|
||||||
|
"Hot Pink": "Rosa Choque",
|
||||||
|
"Brown": "Marrom",
|
||||||
|
"Light Brown": "Marrom Claro",
|
||||||
|
"Colors": "Cores",
|
||||||
|
"Background Color": "Cor de Fundo",
|
||||||
|
"Background Alpha": "Opacidade",
|
||||||
|
"Focus Color": "Cor em Foco",
|
||||||
|
"Focus Alpha": "Alfa em Foco",
|
||||||
|
"Text Color": "Cor do Texto",
|
||||||
|
"Border": "Borda",
|
||||||
|
"Dashed Line": "Linha Tracejada",
|
||||||
|
"Max FPS Text": "Texto Máx. FPS",
|
||||||
|
"Min FPS Text": "Texto Min. FPS",
|
||||||
|
"Main Line": "Linha Principal",
|
||||||
|
"Rounded Line": "Linha Arredondada",
|
||||||
|
"Perfect Line": "Linha Perfeita",
|
||||||
|
" Color": " Cor",
|
||||||
|
" Alpha": " Alfa",
|
||||||
|
"Category Color": "Cor da Categoria",
|
||||||
|
"Category Color 1": "Cor Categoria 1",
|
||||||
|
"Category Color 2": "Cor Categoria 2",
|
||||||
|
"Separator Color": "Cor do Separador",
|
||||||
|
"Elements": "Elementos",
|
||||||
|
"Text Alignment": "Alinhamento do Texto",
|
||||||
|
"Vertical Position": "Posição Vertical",
|
||||||
|
"Horizontal Position": "Posição Horizontal",
|
||||||
|
"Left": "Esquerdo",
|
||||||
|
"Right": "Direito",
|
||||||
|
"Top": "Topo",
|
||||||
|
"Center": "Centro",
|
||||||
|
"Bottom": "Baixo",
|
||||||
|
"FPS Counter Color":"Cor Contador FPS",
|
||||||
|
"FPS Counter Alpha":"Opac. Contador FPS",
|
||||||
|
"Border Color":"Cor da Borda",
|
||||||
|
"Dashed Line Color":"Cor Linha Trac.",
|
||||||
|
"Dashed Line Alpha":"Opac. Linha Trac.",
|
||||||
|
"Max FPS Text Color":"Cor Texto FPS Máx.",
|
||||||
|
"Min FPS Text Color":"Cor Texto FPS Min.",
|
||||||
|
"Main Line Color":"Cor Linha Principal",
|
||||||
|
"Rounded Line Color":"Cor Linha Arrend.",
|
||||||
|
"Perfect Line Color":"Cor Linha Perfeita"
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
{
|
||||||
|
"Horizon OC Monitor": "Horizon OC Monitor",
|
||||||
|
"Modes": "Режимы",
|
||||||
|
"Modes Configure": "Режимы Настроить",
|
||||||
|
"Full": "Полный",
|
||||||
|
"Mini": "Мини",
|
||||||
|
"Micro": "Микро",
|
||||||
|
"FPS Graph": "График FPS",
|
||||||
|
"FPS Counter": "Счётчик FPS",
|
||||||
|
"Game Resolutions": "Разрешения игры",
|
||||||
|
"Other": "Прочее",
|
||||||
|
"Battery/Charger": "Аккумулятор/Зарядка",
|
||||||
|
"Miscellaneous": "Разное",
|
||||||
|
"CPU Usage": "Загрузка CPU",
|
||||||
|
"GPU Usage": "Загрузка GPU",
|
||||||
|
"RAM Usage": "Загрузка RAM",
|
||||||
|
"Target Frequency": "Целевая частота",
|
||||||
|
"Real Frequency": "Реальная частота",
|
||||||
|
"Core 0 ": "Ядро 0 ",
|
||||||
|
"Core 1 ": "Ядро 1 ",
|
||||||
|
"Core 2 ": "Ядро 2 ",
|
||||||
|
"Core 3 ": "Ядро 3 ",
|
||||||
|
"Load": "Нагрузка",
|
||||||
|
"Total\nApplication\nApplet\nSystem\nSystem Unsafe": "Всего\nПриложение\nАпплет\nСистема\nСистема (небезопасно)",
|
||||||
|
"Board": "Плата",
|
||||||
|
"Battery Power Flow": "Поток энергии аккумулятора",
|
||||||
|
"\nTemperatures": "\nТемпературы",
|
||||||
|
"SoC\nPCB\nSkin": "SoC\nPCB\nSkin",
|
||||||
|
"Fan Rotation Level": "Уровень вращения вентилятора",
|
||||||
|
"Game": "Игра",
|
||||||
|
"PFPS ": "PFPS ",
|
||||||
|
"FPS ": "FPS ",
|
||||||
|
"Resolutions ": "Разрешения ",
|
||||||
|
"Read Speed ": "Скорость чтения ",
|
||||||
|
"Press ": "Нажмите ",
|
||||||
|
" to Exit": " для выхода",
|
||||||
|
"Depth": "Глубина",
|
||||||
|
"Viewport": "Viewport",
|
||||||
|
"Game is not running\nor it's incompatible.": "Игра не запущена\nили несовместима.",
|
||||||
|
"Battery Stats": "Статистика аккумулятора",
|
||||||
|
"Actual Capacity": "Фактическая ёмкость",
|
||||||
|
"Designed Capacity": "Номинальная ёмкость",
|
||||||
|
"Temperature": "Температура",
|
||||||
|
"Raw Charge": "Сырой заряд",
|
||||||
|
"Age": "Возраст",
|
||||||
|
"Voltage": "Напряжение",
|
||||||
|
"Current Flow": "Ток",
|
||||||
|
"Power Flow": "Мощность",
|
||||||
|
"Remaining Time": "Оставшееся время",
|
||||||
|
"Charger Stats": "Статистика зарядки",
|
||||||
|
"Input Current Limit": "Лимит входного тока",
|
||||||
|
"VBUS Current Limit": "Лимит тока VBUS",
|
||||||
|
"Voltage Limit": "Лимит напряжения",
|
||||||
|
"Current Limit": "Лимит тока",
|
||||||
|
"Type": "Тип",
|
||||||
|
"Max Voltage": "Макс. напряжение",
|
||||||
|
"Max Current": "Макс. ток",
|
||||||
|
"Multimedia Clock Rates": "Частоты мультимедиа",
|
||||||
|
"NVDEC": "NVDEC",
|
||||||
|
"NVENC": "NVENC",
|
||||||
|
"NVJPG": "NVJPG",
|
||||||
|
"Network": "Сеть",
|
||||||
|
"Type: Wi-Fi": "Тип: Wi-Fi",
|
||||||
|
"Press Y to show password": "Нажмите Y, чтобы показать пароль",
|
||||||
|
"Type: Ethernet": "Тип: Ethernet",
|
||||||
|
"Type: Not connected": "Тип: Не подключено",
|
||||||
|
"CPU\nGPU\nRAM\nSOC\nPCB\nSKN": "CPU\nGPU\nRAM\nSOC\nPCB\nSKN",
|
||||||
|
"Elements Move Down Move Up": "Элементы Вниз Вверх",
|
||||||
|
"Transparent": "Прозрачный",
|
||||||
|
"Opaque": "Непрозрачный",
|
||||||
|
"Alpha": "Альфа",
|
||||||
|
"Pretty": "Красивый",
|
||||||
|
"Compact": "Компактный",
|
||||||
|
"FileSafe": "FileSafe",
|
||||||
|
"Day+Time": "День+Время",
|
||||||
|
"Date+Time(s)": "Дата+Время(с)",
|
||||||
|
"Date+Time AM/PM": "Дата+Время AM/PM",
|
||||||
|
"Date+Time(s) AM/PM": "Дата+Время(с) AM/PM",
|
||||||
|
"Date+Time EU": "Дата+Время EU",
|
||||||
|
"Date+Time EU AM/PM": "Дата+Время EU AM/PM",
|
||||||
|
"Date+Time(s) EU AM/PM": "Дата+Время(с) EU AM/PM",
|
||||||
|
"Date+Time ISO": "Дата+Время ISO",
|
||||||
|
"Time 24h": "Время 24ч",
|
||||||
|
"Time AM/PM": "Время AM/PM",
|
||||||
|
"Time(s) 24h": "Время(с) 24ч",
|
||||||
|
"Time(s) AM/PM": "Время(с) AM/PM",
|
||||||
|
"Date US": "Дата US",
|
||||||
|
"Date EU": "Дата EU",
|
||||||
|
"Date ISO": "Дата ISO",
|
||||||
|
"Date Short": "Краткая дата",
|
||||||
|
"DTC Format": "Формат DTC",
|
||||||
|
"Toggles": "Переключатели",
|
||||||
|
"Info": "Показать информацию",
|
||||||
|
"Disable Screenshots": "Отключить скриншоты",
|
||||||
|
"Real Freqs": "Реальные частоты",
|
||||||
|
"Deltas": "Дельты",
|
||||||
|
"Target Freqs": "Целевые частоты",
|
||||||
|
"FPS": "FPS",
|
||||||
|
"RES": "РАЗР.",
|
||||||
|
"Read Speed": "Скорость чтения",
|
||||||
|
"Real Frequencies": "Реальные частоты",
|
||||||
|
"Real Voltages": "Реальные напряжения",
|
||||||
|
"Full CPU": "Полный CPU",
|
||||||
|
"VDDQ": "VDDQ",
|
||||||
|
"VDD2": "VDD2",
|
||||||
|
"Full Resolution": "Полное разрешение",
|
||||||
|
"SOC Voltage": "Напряжение SOC",
|
||||||
|
"RAM Load CPU/GPU": "Нагрузка RAM CPU/GPU",
|
||||||
|
"Use DTC Symbol": "Использовать символ DTC",
|
||||||
|
"Use Dynamic Colors": "Использовать динамические цвета",
|
||||||
|
"Sleep Exit": "Выход из сна",
|
||||||
|
"Configuration": "Конфигурация",
|
||||||
|
"Refresh Rate": "Частота обновления",
|
||||||
|
"Frame Padding": "Отступ кадра",
|
||||||
|
" Font Size": " Размер шрифта",
|
||||||
|
"Font Sizes": "Размеры шрифта",
|
||||||
|
"Handheld Font Size": "Размер шрифта в портативном режиме",
|
||||||
|
"Docked Font Size": "Размер шрифта в док-режиме",
|
||||||
|
"Black": "Чёрный",
|
||||||
|
"Dark Gray": "Тёмно-серый",
|
||||||
|
"Gray": "Серый",
|
||||||
|
"Light Gray": "Светло-серый",
|
||||||
|
"Silver": "Серебряный",
|
||||||
|
"White": "Белый",
|
||||||
|
"Dark Red": "Тёмно-красный",
|
||||||
|
"Red": "Красный",
|
||||||
|
"Light Red": "Светло-красный",
|
||||||
|
"Pink": "Розовый",
|
||||||
|
"Dark Green": "Тёмно-зелёный",
|
||||||
|
"Green": "Зелёный",
|
||||||
|
"Lime Green": "Лаймовый",
|
||||||
|
"Light Green": "Светло-зелёный",
|
||||||
|
"Dark Blue": "Тёмно-синий",
|
||||||
|
"Blue": "Синий",
|
||||||
|
"Light Blue": "Светло-синий",
|
||||||
|
"Sky Blue": "Небесно-голубой",
|
||||||
|
"Dark Purple": "Тёмно-фиолетовый",
|
||||||
|
"Purple": "Фиолетовый",
|
||||||
|
"Light Purple": "Светло-фиолетовый",
|
||||||
|
"Violet": "Фиолетовый",
|
||||||
|
"Orange": "Оранжевый",
|
||||||
|
"Yellow": "Жёлтый",
|
||||||
|
"Light Yellow": "Светло-жёлтый",
|
||||||
|
"Teal": "Бирюзовый",
|
||||||
|
"Cyan": "Голубой",
|
||||||
|
"Light Cyan": "Светло-голубой",
|
||||||
|
"Magenta": "Пурпурный",
|
||||||
|
"Hot Pink": "Ярко-розовый",
|
||||||
|
"Brown": "Коричневый",
|
||||||
|
"Light Brown": "Светло-коричневый",
|
||||||
|
"Colors": "Цвета",
|
||||||
|
"Background Color": "Цвет фона",
|
||||||
|
"Background Alpha": "Прозрачность фона",
|
||||||
|
"Focus Color": "Цвет фокуса",
|
||||||
|
"Focus Alpha": "Прозрачность фокуса",
|
||||||
|
"Text Color": "Цвет текста",
|
||||||
|
"Border": "Граница",
|
||||||
|
"Dashed Line": "Пунктирная линия",
|
||||||
|
"Max FPS Text": "Текст макс. FPS",
|
||||||
|
"Min FPS Text": "Текст мин. FPS",
|
||||||
|
"Main Line": "Основная линия",
|
||||||
|
"Rounded Line": "Скруглённая линия",
|
||||||
|
"Perfect Line": "Идеальная линия",
|
||||||
|
" Color": " Цвет",
|
||||||
|
" Alpha": " Прозрачность",
|
||||||
|
"Category Color": "Цвет категории",
|
||||||
|
"Category Color 1": "Цвет категории 1",
|
||||||
|
"Category Color 2": "Цвет категории 2",
|
||||||
|
"Separator Color": "Цвет разделителя",
|
||||||
|
"Elements": "Элементы",
|
||||||
|
"Text Alignment": "Выравнивание текста",
|
||||||
|
"Vertical Position": "Вертикальная позиция",
|
||||||
|
"Horizontal Position": "Горизонтальная позиция",
|
||||||
|
"Left": "Слева",
|
||||||
|
"Right": "Справа",
|
||||||
|
"Top": "Сверху",
|
||||||
|
"Center": "По центру",
|
||||||
|
"Bottom": "Снизу",
|
||||||
|
"FPS Counter Color": "Цвет счётчика FPS",
|
||||||
|
"FPS Counter Alpha": "Прозрачность счётчика FPS",
|
||||||
|
"Border Color": "Цвет границы",
|
||||||
|
"Dashed Line Color": "Цвет пунктирной линии",
|
||||||
|
"Dashed Line Alpha": "Прозрачность пунктирной линии",
|
||||||
|
"Max FPS Text Color": "Цвет текста макс. FPS",
|
||||||
|
"Min FPS Text Color": "Цвет текста мин. FPS",
|
||||||
|
"Main Line Color": "Цвет основной линии",
|
||||||
|
"Rounded Line Color": "Цвет скруглённой линии",
|
||||||
|
"Perfect Line Color": "Цвет идеальной линии"
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
{
|
||||||
|
"Horizon OC Monitor": "Horizon OC Monitor",
|
||||||
|
"Modes": "Режими",
|
||||||
|
"Modes Configure": "Режими Налаштувати",
|
||||||
|
"Full": "Повний",
|
||||||
|
"Mini": "Міні",
|
||||||
|
"Micro": "Мікро",
|
||||||
|
"FPS Graph": "Графік FPS",
|
||||||
|
"FPS Counter": "Лічильник FPS",
|
||||||
|
"Game Resolutions": "Роздільна здатність гри",
|
||||||
|
"Other": "Інше",
|
||||||
|
"Battery/Charger": "Акумулятор/Зарядка",
|
||||||
|
"Miscellaneous": "Різне",
|
||||||
|
"CPU Usage": "Завантаження CPU",
|
||||||
|
"GPU Usage": "Завантаження GPU",
|
||||||
|
"RAM Usage": "Завантаження RAM",
|
||||||
|
"Target Frequency": "Цільова частота",
|
||||||
|
"Real Frequency": "Реальна частота",
|
||||||
|
"Core 0 ": "Ядро 0 ",
|
||||||
|
"Core 1 ": "Ядро 1 ",
|
||||||
|
"Core 2 ": "Ядро 2 ",
|
||||||
|
"Core 3 ": "Ядро 3 ",
|
||||||
|
"Load": "Навантаження",
|
||||||
|
"Total\nApplication\nApplet\nSystem\nSystem Unsafe": "Всього\nДодаток\nАплет\nСистема\nСистема (небезпечно)",
|
||||||
|
"Board": "Плата",
|
||||||
|
"Battery Power Flow": "Потік енергії акумулятора",
|
||||||
|
"\nTemperatures": "\nТемператури",
|
||||||
|
"SoC\nPCB\nSkin": "SoC\nPCB\nSkin",
|
||||||
|
"Fan Rotation Level": "Рівень обертання вентилятора",
|
||||||
|
"Game": "Гра",
|
||||||
|
"PFPS ": "PFPS ",
|
||||||
|
"FPS ": "FPS ",
|
||||||
|
"Resolutions ": "Роздільна здатність ",
|
||||||
|
"Read Speed ": "Швидкість зчитування ",
|
||||||
|
"Press ": "Натисніть ",
|
||||||
|
" to Exit": " для виходу",
|
||||||
|
"Depth": "Глибина",
|
||||||
|
"Viewport": "Viewport",
|
||||||
|
"Game is not running\nor it's incompatible.": "Гра не запущена\nабо несумісна.",
|
||||||
|
"Battery Stats": "Статистика акумулятора",
|
||||||
|
"Actual Capacity": "Фактична ємність",
|
||||||
|
"Designed Capacity": "Номінальна ємність",
|
||||||
|
"Temperature": "Температура",
|
||||||
|
"Raw Charge": "Сирий заряд",
|
||||||
|
"Age": "Вік",
|
||||||
|
"Voltage": "Напруга",
|
||||||
|
"Current Flow": "Струм",
|
||||||
|
"Power Flow": "Потужність",
|
||||||
|
"Remaining Time": "Залишковий час",
|
||||||
|
"Charger Stats": "Статистика зарядки",
|
||||||
|
"Input Current Limit": "Ліміт вхідного струму",
|
||||||
|
"VBUS Current Limit": "Ліміт струму VBUS",
|
||||||
|
"Voltage Limit": "Ліміт напруги",
|
||||||
|
"Current Limit": "Ліміт струму",
|
||||||
|
"Type": "Тип",
|
||||||
|
"Max Voltage": "Макс. напруга",
|
||||||
|
"Max Current": "Макс. струм",
|
||||||
|
"Multimedia Clock Rates": "Частоти мультимедіа",
|
||||||
|
"NVDEC": "NVDEC",
|
||||||
|
"NVENC": "NVENC",
|
||||||
|
"NVJPG": "NVJPG",
|
||||||
|
"Network": "Мережа",
|
||||||
|
"Type: Wi-Fi": "Тип: Wi-Fi",
|
||||||
|
"Press Y to show password": "Натисніть Y, щоб показати пароль",
|
||||||
|
"Type: Ethernet": "Тип: Ethernet",
|
||||||
|
"Type: Not connected": "Тип: Не підключено",
|
||||||
|
"CPU\nGPU\nRAM\nSOC\nPCB\nSKN": "CPU\nGPU\nRAM\nSOC\nPCB\nSKN",
|
||||||
|
"Elements Move Down Move Up": "Елементи Вниз Вгору",
|
||||||
|
"Transparent": "Прозорий",
|
||||||
|
"Opaque": "Непрозорий",
|
||||||
|
"Alpha": "Альфа",
|
||||||
|
"Pretty": "Красивий",
|
||||||
|
"Compact": "Компактний",
|
||||||
|
"FileSafe": "FileSafe",
|
||||||
|
"Day+Time": "День+Час",
|
||||||
|
"Date+Time(s)": "Дата+Час(с)",
|
||||||
|
"Date+Time AM/PM": "Дата+Час AM/PM",
|
||||||
|
"Date+Time(s) AM/PM": "Дата+Час(с) AM/PM",
|
||||||
|
"Date+Time EU": "Дата+Час EU",
|
||||||
|
"Date+Time EU AM/PM": "Дата+Час EU AM/PM",
|
||||||
|
"Date+Time(s) EU AM/PM": "Дата+Час(с) EU AM/PM",
|
||||||
|
"Date+Time ISO": "Дата+Час ISO",
|
||||||
|
"Time 24h": "Час 24год",
|
||||||
|
"Time AM/PM": "Час AM/PM",
|
||||||
|
"Time(s) 24h": "Час(с) 24год",
|
||||||
|
"Time(s) AM/PM": "Час(с) AM/PM",
|
||||||
|
"Date US": "Дата US",
|
||||||
|
"Date EU": "Дата EU",
|
||||||
|
"Date ISO": "Дата ISO",
|
||||||
|
"Date Short": "Коротка дата",
|
||||||
|
"DTC Format": "Формат DTC",
|
||||||
|
"Toggles": "Перемикачі",
|
||||||
|
"Info": "Показати інформацію",
|
||||||
|
"Disable Screenshots": "Вимкнути знімки екрана",
|
||||||
|
"Real Freqs": "Реальні частоти",
|
||||||
|
"Deltas": "Дельти",
|
||||||
|
"Target Freqs": "Цільові частоти",
|
||||||
|
"FPS": "FPS",
|
||||||
|
"RES": "РОЗД.",
|
||||||
|
"Read Speed": "Швидкість зчитування",
|
||||||
|
"Real Frequencies": "Реальні частоти",
|
||||||
|
"Real Voltages": "Реальні напруги",
|
||||||
|
"Full CPU": "Повний CPU",
|
||||||
|
"VDDQ": "VDDQ",
|
||||||
|
"VDD2": "VDD2",
|
||||||
|
"Full Resolution": "Повна роздільна здатність",
|
||||||
|
"SOC Voltage": "Напруга SOC",
|
||||||
|
"RAM Load CPU/GPU": "Навантаження RAM CPU/GPU",
|
||||||
|
"Use DTC Symbol": "Використовувати символ DTC",
|
||||||
|
"Use Dynamic Colors": "Використовувати динамічні кольори",
|
||||||
|
"Sleep Exit": "Вихід зі сну",
|
||||||
|
"Configuration": "Конфігурація",
|
||||||
|
"Refresh Rate": "Частота оновлення",
|
||||||
|
"Frame Padding": "Відступ кадру",
|
||||||
|
" Font Size": " Розмір шрифту",
|
||||||
|
"Font Sizes": "Розміри шрифту",
|
||||||
|
"Handheld Font Size": "Розмір шрифту в портативному режимі",
|
||||||
|
"Docked Font Size": "Розмір шрифту в док-режимі",
|
||||||
|
"Black": "Чорний",
|
||||||
|
"Dark Gray": "Темно-сірий",
|
||||||
|
"Gray": "Сірий",
|
||||||
|
"Light Gray": "Світло-сірий",
|
||||||
|
"Silver": "Сріблястий",
|
||||||
|
"White": "Білий",
|
||||||
|
"Dark Red": "Темно-червоний",
|
||||||
|
"Red": "Червоний",
|
||||||
|
"Light Red": "Світло-червоний",
|
||||||
|
"Pink": "Рожевий",
|
||||||
|
"Dark Green": "Темно-зелений",
|
||||||
|
"Green": "Зелений",
|
||||||
|
"Lime Green": "Лаймовий",
|
||||||
|
"Light Green": "Світло-зелений",
|
||||||
|
"Dark Blue": "Темно-синій",
|
||||||
|
"Blue": "Синій",
|
||||||
|
"Light Blue": "Світло-синій",
|
||||||
|
"Sky Blue": "Небесно-блакитний",
|
||||||
|
"Dark Purple": "Темно-фіолетовий",
|
||||||
|
"Purple": "Фіолетовий",
|
||||||
|
"Light Purple": "Світло-фіолетовий",
|
||||||
|
"Violet": "Фіолетовий",
|
||||||
|
"Orange": "Помаранчевий",
|
||||||
|
"Yellow": "Жовтий",
|
||||||
|
"Light Yellow": "Світло-жовтий",
|
||||||
|
"Teal": "Бірюзовий",
|
||||||
|
"Cyan": "Блакитний",
|
||||||
|
"Light Cyan": "Світло-блакитний",
|
||||||
|
"Magenta": "Пурпуровий",
|
||||||
|
"Hot Pink": "Яскраво-рожевий",
|
||||||
|
"Brown": "Коричневий",
|
||||||
|
"Light Brown": "Світло-коричневий",
|
||||||
|
"Colors": "Кольори",
|
||||||
|
"Background Color": "Колір фону",
|
||||||
|
"Background Alpha": "Прозорість фону",
|
||||||
|
"Focus Color": "Колір фокусу",
|
||||||
|
"Focus Alpha": "Прозорість фокусу",
|
||||||
|
"Text Color": "Колір тексту",
|
||||||
|
"Border": "Межа",
|
||||||
|
"Dashed Line": "Пунктирна лінія",
|
||||||
|
"Max FPS Text": "Текст макс. FPS",
|
||||||
|
"Min FPS Text": "Текст мін. FPS",
|
||||||
|
"Main Line": "Основна лінія",
|
||||||
|
"Rounded Line": "Закруглена лінія",
|
||||||
|
"Perfect Line": "Ідеальна лінія",
|
||||||
|
" Color": " Колір",
|
||||||
|
" Alpha": " Прозорість",
|
||||||
|
"Category Color": "Колір категорії",
|
||||||
|
"Category Color 1": "Колір категорії 1",
|
||||||
|
"Category Color 2": "Колір категорії 2",
|
||||||
|
"Separator Color": "Колір роздільника",
|
||||||
|
"Elements": "Елементи",
|
||||||
|
"Text Alignment": "Вирівнювання тексту",
|
||||||
|
"Vertical Position": "Вертикальна позиція",
|
||||||
|
"Horizontal Position": "Горизонтальна позиція",
|
||||||
|
"Left": "Зліва",
|
||||||
|
"Right": "Справа",
|
||||||
|
"Top": "Зверху",
|
||||||
|
"Center": "По центру",
|
||||||
|
"Bottom": "Знизу",
|
||||||
|
"FPS Counter Color": "Колір лічильника FPS",
|
||||||
|
"FPS Counter Alpha": "Прозорість лічильника FPS",
|
||||||
|
"Border Color": "Колір межі",
|
||||||
|
"Dashed Line Color": "Колір пунктирної лінії",
|
||||||
|
"Dashed Line Alpha": "Прозорість пунктирної лінії",
|
||||||
|
"Max FPS Text Color": "Колір тексту макс. FPS",
|
||||||
|
"Min FPS Text Color": "Колір тексту мін. FPS",
|
||||||
|
"Main Line Color": "Колір основної лінії",
|
||||||
|
"Rounded Line Color": "Колір закругленої лінії",
|
||||||
|
"Perfect Line Color": "Колір ідеальної лінії"
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
{
|
||||||
|
"Horizon OC Monitor": "Horizon OC Monitor",
|
||||||
|
"Modes": "模式",
|
||||||
|
"Modes Configure": "模式 配置",
|
||||||
|
"Full": "完整",
|
||||||
|
"Mini": "迷你",
|
||||||
|
"Micro": "微型",
|
||||||
|
"FPS Graph": "FPS 图表",
|
||||||
|
"FPS Counter": "FPS 计数器",
|
||||||
|
"Game Resolutions": "游戏分辨率",
|
||||||
|
"Other": "其他",
|
||||||
|
"Battery/Charger": "电池/充电器",
|
||||||
|
"Miscellaneous": "杂项",
|
||||||
|
"CPU Usage": "CPU 使用率",
|
||||||
|
"GPU Usage": "GPU 使用率",
|
||||||
|
"RAM Usage": "RAM 使用率",
|
||||||
|
"Target Frequency": "目标频率",
|
||||||
|
"Real Frequency": "实际频率",
|
||||||
|
"Core 0 ": "核心 0 ",
|
||||||
|
"Core 1 ": "核心 1 ",
|
||||||
|
"Core 2 ": "核心 2 ",
|
||||||
|
"Core 3 ": "核心 3 ",
|
||||||
|
"Load": "负载",
|
||||||
|
"Total\nApplication\nApplet\nSystem\nSystem Unsafe": "总计\n应用\n小程序\n系统\n系统(不安全)",
|
||||||
|
"Board": "主板",
|
||||||
|
"Battery Power Flow": "电池功率流",
|
||||||
|
"\nTemperatures": "\n温度",
|
||||||
|
"SoC\nPCB\nSkin": "SoC\nPCB\nSkin",
|
||||||
|
"Fan Rotation Level": "风扇转速级别",
|
||||||
|
"Game": "游戏",
|
||||||
|
"PFPS ": "PFPS ",
|
||||||
|
"FPS ": "FPS ",
|
||||||
|
"Resolutions ": "分辨率 ",
|
||||||
|
"Read Speed ": "读取速度 ",
|
||||||
|
"Press ": "按 ",
|
||||||
|
" to Exit": " 退出",
|
||||||
|
"Depth": "深度",
|
||||||
|
"Viewport": "视口",
|
||||||
|
"Game is not running\nor it's incompatible.": "游戏未运行\n或不兼容。",
|
||||||
|
"Battery Stats": "电池统计",
|
||||||
|
"Actual Capacity": "实际容量",
|
||||||
|
"Designed Capacity": "设计容量",
|
||||||
|
"Temperature": "温度",
|
||||||
|
"Raw Charge": "原始电量",
|
||||||
|
"Age": "寿命",
|
||||||
|
"Voltage": "电压",
|
||||||
|
"Current Flow": "电流",
|
||||||
|
"Power Flow": "功率",
|
||||||
|
"Remaining Time": "剩余时间",
|
||||||
|
"Charger Stats": "充电器统计",
|
||||||
|
"Input Current Limit": "输入电流限制",
|
||||||
|
"VBUS Current Limit": "VBUS 电流限制",
|
||||||
|
"Voltage Limit": "电压限制",
|
||||||
|
"Current Limit": "电流限制",
|
||||||
|
"Type": "类型",
|
||||||
|
"Max Voltage": "最大电压",
|
||||||
|
"Max Current": "最大电流",
|
||||||
|
"Multimedia Clock Rates": "多媒体时钟频率",
|
||||||
|
"NVDEC": "NVDEC",
|
||||||
|
"NVENC": "NVENC",
|
||||||
|
"NVJPG": "NVJPG",
|
||||||
|
"Network": "网络",
|
||||||
|
"Type: Wi-Fi": "类型:Wi-Fi",
|
||||||
|
"Press Y to show password": "按 Y 显示密码",
|
||||||
|
"Type: Ethernet": "类型:以太网",
|
||||||
|
"Type: Not connected": "类型:未连接",
|
||||||
|
"CPU\nGPU\nRAM\nSOC\nPCB\nSKN": "CPU\nGPU\nRAM\nSOC\nPCB\nSKN",
|
||||||
|
"Elements Move Down Move Up": "元素 下移 上移",
|
||||||
|
"Transparent": "透明",
|
||||||
|
"Opaque": "不透明",
|
||||||
|
"Alpha": "透明度",
|
||||||
|
"Pretty": "美观",
|
||||||
|
"Compact": "紧凑",
|
||||||
|
"FileSafe": "文件安全",
|
||||||
|
"Day+Time": "日期+时间",
|
||||||
|
"Date+Time(s)": "日期+时间(秒)",
|
||||||
|
"Date+Time AM/PM": "日期+时间 AM/PM",
|
||||||
|
"Date+Time(s) AM/PM": "日期+时间(秒) AM/PM",
|
||||||
|
"Date+Time EU": "日期+时间 EU",
|
||||||
|
"Date+Time EU AM/PM": "日期+时间 EU AM/PM",
|
||||||
|
"Date+Time(s) EU AM/PM": "日期+时间(秒) EU AM/PM",
|
||||||
|
"Date+Time ISO": "日期+时间 ISO",
|
||||||
|
"Time 24h": "时间 24时",
|
||||||
|
"Time AM/PM": "时间 AM/PM",
|
||||||
|
"Time(s) 24h": "时间(秒) 24时",
|
||||||
|
"Time(s) AM/PM": "时间(秒) AM/PM",
|
||||||
|
"Date US": "日期 US",
|
||||||
|
"Date EU": "日期 EU",
|
||||||
|
"Date ISO": "日期 ISO",
|
||||||
|
"Date Short": "短日期",
|
||||||
|
"DTC Format": "DTC 格式",
|
||||||
|
"Toggles": "开关",
|
||||||
|
"Info": "显示信息",
|
||||||
|
"Disable Screenshots": "禁用截图",
|
||||||
|
"Real Freqs": "实际频率",
|
||||||
|
"Deltas": "差值",
|
||||||
|
"Target Freqs": "目标频率",
|
||||||
|
"FPS": "FPS",
|
||||||
|
"RES": "分辨率",
|
||||||
|
"Read Speed": "读取速度",
|
||||||
|
"Real Frequencies": "实际频率",
|
||||||
|
"Real Voltages": "实际电压",
|
||||||
|
"Full CPU": "完整 CPU",
|
||||||
|
"VDDQ": "VDDQ",
|
||||||
|
"VDD2": "VDD2",
|
||||||
|
"Full Resolution": "完整分辨率",
|
||||||
|
"SOC Voltage": "SOC 电压",
|
||||||
|
"RAM Load CPU/GPU": "RAM 负载 CPU/GPU",
|
||||||
|
"Use DTC Symbol": "使用 DTC 符号",
|
||||||
|
"Use Dynamic Colors": "使用动态颜色",
|
||||||
|
"Sleep Exit": "退出睡眠",
|
||||||
|
"Configuration": "配置",
|
||||||
|
"Refresh Rate": "刷新率",
|
||||||
|
"Frame Padding": "帧填充",
|
||||||
|
" Font Size": " 字体大小",
|
||||||
|
"Font Sizes": "字体大小",
|
||||||
|
"Handheld Font Size": "手持模式字体大小",
|
||||||
|
"Docked Font Size": "底座模式字体大小",
|
||||||
|
"Black": "黑色",
|
||||||
|
"Dark Gray": "深灰",
|
||||||
|
"Gray": "灰色",
|
||||||
|
"Light Gray": "浅灰",
|
||||||
|
"Silver": "银色",
|
||||||
|
"White": "白色",
|
||||||
|
"Dark Red": "深红",
|
||||||
|
"Red": "红色",
|
||||||
|
"Light Red": "浅红",
|
||||||
|
"Pink": "粉红",
|
||||||
|
"Dark Green": "深绿",
|
||||||
|
"Green": "绿色",
|
||||||
|
"Lime Green": "酸橙绿",
|
||||||
|
"Light Green": "浅绿",
|
||||||
|
"Dark Blue": "深蓝",
|
||||||
|
"Blue": "蓝色",
|
||||||
|
"Light Blue": "浅蓝",
|
||||||
|
"Sky Blue": "天蓝",
|
||||||
|
"Dark Purple": "深紫",
|
||||||
|
"Purple": "紫色",
|
||||||
|
"Light Purple": "浅紫",
|
||||||
|
"Violet": "紫罗兰",
|
||||||
|
"Orange": "橙色",
|
||||||
|
"Yellow": "黄色",
|
||||||
|
"Light Yellow": "浅黄",
|
||||||
|
"Teal": "蓝绿",
|
||||||
|
"Cyan": "青色",
|
||||||
|
"Light Cyan": "浅青",
|
||||||
|
"Magenta": "品红",
|
||||||
|
"Hot Pink": "艳粉",
|
||||||
|
"Brown": "棕色",
|
||||||
|
"Light Brown": "浅棕",
|
||||||
|
"Colors": "颜色",
|
||||||
|
"Background Color": "背景颜色",
|
||||||
|
"Background Alpha": "背景透明度",
|
||||||
|
"Focus Color": "焦点颜色",
|
||||||
|
"Focus Alpha": "焦点透明度",
|
||||||
|
"Text Color": "文字颜色",
|
||||||
|
"Border": "边框",
|
||||||
|
"Dashed Line": "虚线",
|
||||||
|
"Max FPS Text": "最大 FPS 文字",
|
||||||
|
"Min FPS Text": "最小 FPS 文字",
|
||||||
|
"Main Line": "主线",
|
||||||
|
"Rounded Line": "圆角线",
|
||||||
|
"Perfect Line": "完美线",
|
||||||
|
" Color": " 颜色",
|
||||||
|
" Alpha": " 透明度",
|
||||||
|
"Category Color": "分类颜色",
|
||||||
|
"Category Color 1": "分类颜色 1",
|
||||||
|
"Category Color 2": "分类颜色 2",
|
||||||
|
"Separator Color": "分隔线颜色",
|
||||||
|
"Elements": "元素",
|
||||||
|
"Text Alignment": "文字对齐",
|
||||||
|
"Vertical Position": "垂直位置",
|
||||||
|
"Horizontal Position": "水平位置",
|
||||||
|
"Left": "左",
|
||||||
|
"Right": "右",
|
||||||
|
"Top": "上",
|
||||||
|
"Center": "中",
|
||||||
|
"Bottom": "下",
|
||||||
|
"FPS Counter Color": "FPS 计数器颜色",
|
||||||
|
"FPS Counter Alpha": "FPS 计数器透明度",
|
||||||
|
"Border Color": "边框颜色",
|
||||||
|
"Dashed Line Color": "虚线颜色",
|
||||||
|
"Dashed Line Alpha": "虚线透明度",
|
||||||
|
"Max FPS Text Color": "最大 FPS 文字颜色",
|
||||||
|
"Min FPS Text Color": "最小 FPS 文字颜色",
|
||||||
|
"Main Line Color": "主线颜色",
|
||||||
|
"Rounded Line Color": "圆角线颜色",
|
||||||
|
"Perfect Line Color": "完美线颜色"
|
||||||
|
}
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
{
|
||||||
|
"Horizon OC Monitor": "Horizon OC Monitor",
|
||||||
|
"Modes": "模式",
|
||||||
|
"Modes Configure": "模式 設定",
|
||||||
|
"Full": "完整",
|
||||||
|
"Mini": "迷你",
|
||||||
|
"Micro": "微型",
|
||||||
|
"FPS Graph": "FPS 圖表",
|
||||||
|
"FPS Counter": "FPS 計數器",
|
||||||
|
"Game Resolutions": "遊戲解析度",
|
||||||
|
"Other": "其他",
|
||||||
|
"Battery/Charger": "電池/充電器",
|
||||||
|
"Miscellaneous": "雜項",
|
||||||
|
"CPU Usage": "CPU 使用率",
|
||||||
|
"GPU Usage": "GPU 使用率",
|
||||||
|
"RAM Usage": "RAM 使用率",
|
||||||
|
"Target Frequency": "目標頻率",
|
||||||
|
"Real Frequency": "實際頻率",
|
||||||
|
"Core 0 ": "核心 0 ",
|
||||||
|
"Core 1 ": "核心 1 ",
|
||||||
|
"Core 2 ": "核心 2 ",
|
||||||
|
"Core 3 ": "核心 3 ",
|
||||||
|
"Load": "負載",
|
||||||
|
"Total\nApplication\nApplet\nSystem\nSystem Unsafe": "總計\n應用程式\n小程式\n系統\n系統(不安全)",
|
||||||
|
"Board": "主機板",
|
||||||
|
"Battery Power Flow": "電池功率流",
|
||||||
|
"\nTemperatures": "\n溫度",
|
||||||
|
"SoC\nPCB\nSkin": "SoC\nPCB\nSkin",
|
||||||
|
"Fan Rotation Level": "風扇轉速等級",
|
||||||
|
"Game": "遊戲",
|
||||||
|
"PFPS ": "PFPS ",
|
||||||
|
"FPS ": "FPS ",
|
||||||
|
"Resolutions ": "解析度 ",
|
||||||
|
"Read Speed ": "讀取速度 ",
|
||||||
|
"Press ": "按 ",
|
||||||
|
" to Exit": " 退出",
|
||||||
|
"Depth": "深度",
|
||||||
|
"Viewport": "視口",
|
||||||
|
"Game is not running\nor it's incompatible.": "遊戲未執行\n或不相容。",
|
||||||
|
"Battery Stats": "電池統計",
|
||||||
|
"Actual Capacity": "實際容量",
|
||||||
|
"Designed Capacity": "設計容量",
|
||||||
|
"Temperature": "溫度",
|
||||||
|
"Raw Charge": "原始電量",
|
||||||
|
"Age": "壽命",
|
||||||
|
"Voltage": "電壓",
|
||||||
|
"Current Flow": "電流",
|
||||||
|
"Power Flow": "功率",
|
||||||
|
"Remaining Time": "剩餘時間",
|
||||||
|
"Charger Stats": "充電器統計",
|
||||||
|
"Input Current Limit": "輸入電流限制",
|
||||||
|
"VBUS Current Limit": "VBUS 電流限制",
|
||||||
|
"Voltage Limit": "電壓限制",
|
||||||
|
"Current Limit": "電流限制",
|
||||||
|
"Type": "類型",
|
||||||
|
"Max Voltage": "最大電壓",
|
||||||
|
"Max Current": "最大電流",
|
||||||
|
"Multimedia Clock Rates": "多媒體時脈頻率",
|
||||||
|
"NVDEC": "NVDEC",
|
||||||
|
"NVENC": "NVENC",
|
||||||
|
"NVJPG": "NVJPG",
|
||||||
|
"Network": "網路",
|
||||||
|
"Type: Wi-Fi": "類型:Wi-Fi",
|
||||||
|
"Press Y to show password": "按 Y 顯示密碼",
|
||||||
|
"Type: Ethernet": "類型:乙太網路",
|
||||||
|
"Type: Not connected": "類型:未連線",
|
||||||
|
"CPU\nGPU\nRAM\nSOC\nPCB\nSKN": "CPU\nGPU\nRAM\nSOC\nPCB\nSKN",
|
||||||
|
"Elements Move Down Move Up": "元素 下移 上移",
|
||||||
|
"Transparent": "透明",
|
||||||
|
"Opaque": "不透明",
|
||||||
|
"Alpha": "透明度",
|
||||||
|
"Pretty": "美觀",
|
||||||
|
"Compact": "緊湊",
|
||||||
|
"FileSafe": "檔案安全",
|
||||||
|
"Day+Time": "日期+時間",
|
||||||
|
"Date+Time(s)": "日期+時間(秒)",
|
||||||
|
"Date+Time AM/PM": "日期+時間 AM/PM",
|
||||||
|
"Date+Time(s) AM/PM": "日期+時間(秒) AM/PM",
|
||||||
|
"Date+Time EU": "日期+時間 EU",
|
||||||
|
"Date+Time EU AM/PM": "日期+時間 EU AM/PM",
|
||||||
|
"Date+Time(s) EU AM/PM": "日期+時間(秒) EU AM/PM",
|
||||||
|
"Date+Time ISO": "日期+時間 ISO",
|
||||||
|
"Time 24h": "時間 24時",
|
||||||
|
"Time AM/PM": "時間 AM/PM",
|
||||||
|
"Time(s) 24h": "時間(秒) 24時",
|
||||||
|
"Time(s) AM/PM": "時間(秒) AM/PM",
|
||||||
|
"Date US": "日期 US",
|
||||||
|
"Date EU": "日期 EU",
|
||||||
|
"Date ISO": "日期 ISO",
|
||||||
|
"Date Short": "短日期",
|
||||||
|
"DTC Format": "DTC 格式",
|
||||||
|
"Toggles": "開關",
|
||||||
|
"Info": "顯示資訊",
|
||||||
|
"Disable Screenshots": "停用截圖",
|
||||||
|
"Real Freqs": "實際頻率",
|
||||||
|
"Deltas": "差值",
|
||||||
|
"Target Freqs": "目標頻率",
|
||||||
|
"FPS": "FPS",
|
||||||
|
"RES": "解析度",
|
||||||
|
"Read Speed": "讀取速度",
|
||||||
|
"Real Frequencies": "實際頻率",
|
||||||
|
"Real Voltages": "實際電壓",
|
||||||
|
"Full CPU": "完整 CPU",
|
||||||
|
"VDDQ": "VDDQ",
|
||||||
|
"VDD2": "VDD2",
|
||||||
|
"Full Resolution": "完整解析度",
|
||||||
|
"SOC Voltage": "SOC 電壓",
|
||||||
|
"RAM Load CPU/GPU": "RAM 負載 CPU/GPU",
|
||||||
|
"Use DTC Symbol": "使用 DTC 符號",
|
||||||
|
"Use Dynamic Colors": "使用動態顏色",
|
||||||
|
"Sleep Exit": "退出睡眠",
|
||||||
|
"Configuration": "設定",
|
||||||
|
"Refresh Rate": "更新率",
|
||||||
|
"Frame Padding": "畫面邊距",
|
||||||
|
" Font Size": " 字型大小",
|
||||||
|
"Font Sizes": "字型大小",
|
||||||
|
"Handheld Font Size": "掌機模式字型大小",
|
||||||
|
"Docked Font Size": "主機模式字型大小",
|
||||||
|
"Black": "黑色",
|
||||||
|
"Dark Gray": "深灰",
|
||||||
|
"Gray": "灰色",
|
||||||
|
"Light Gray": "淺灰",
|
||||||
|
"Silver": "銀色",
|
||||||
|
"White": "白色",
|
||||||
|
"Dark Red": "深紅",
|
||||||
|
"Red": "紅色",
|
||||||
|
"Light Red": "淺紅",
|
||||||
|
"Pink": "粉紅",
|
||||||
|
"Dark Green": "深綠",
|
||||||
|
"Green": "綠色",
|
||||||
|
"Lime Green": "萊姆綠",
|
||||||
|
"Light Green": "淺綠",
|
||||||
|
"Dark Blue": "深藍",
|
||||||
|
"Blue": "藍色",
|
||||||
|
"Light Blue": "淺藍",
|
||||||
|
"Sky Blue": "天空藍",
|
||||||
|
"Dark Purple": "深紫",
|
||||||
|
"Purple": "紫色",
|
||||||
|
"Light Purple": "淺紫",
|
||||||
|
"Violet": "紫羅蘭",
|
||||||
|
"Orange": "橙色",
|
||||||
|
"Yellow": "黃色",
|
||||||
|
"Light Yellow": "淺黃",
|
||||||
|
"Teal": "藍綠",
|
||||||
|
"Cyan": "青色",
|
||||||
|
"Light Cyan": "淺青",
|
||||||
|
"Magenta": "洋紅",
|
||||||
|
"Hot Pink": "熱粉",
|
||||||
|
"Brown": "棕色",
|
||||||
|
"Light Brown": "淺棕",
|
||||||
|
"Colors": "顏色",
|
||||||
|
"Background Color": "背景顏色",
|
||||||
|
"Background Alpha": "背景透明度",
|
||||||
|
"Focus Color": "焦點顏色",
|
||||||
|
"Focus Alpha": "焦點透明度",
|
||||||
|
"Text Color": "文字顏色",
|
||||||
|
"Border": "邊框",
|
||||||
|
"Dashed Line": "虛線",
|
||||||
|
"Max FPS Text": "最大 FPS 文字",
|
||||||
|
"Min FPS Text": "最小 FPS 文字",
|
||||||
|
"Main Line": "主線",
|
||||||
|
"Rounded Line": "圓角線",
|
||||||
|
"Perfect Line": "完美線",
|
||||||
|
" Color": " 顏色",
|
||||||
|
" Alpha": " 透明度",
|
||||||
|
"Category Color": "分類顏色",
|
||||||
|
"Category Color 1": "分類顏色 1",
|
||||||
|
"Category Color 2": "分類顏色 2",
|
||||||
|
"Separator Color": "分隔線顏色",
|
||||||
|
"Elements": "元素",
|
||||||
|
"Text Alignment": "文字對齊",
|
||||||
|
"Vertical Position": "垂直位置",
|
||||||
|
"Horizontal Position": "水平位置",
|
||||||
|
"Left": "左",
|
||||||
|
"Right": "右",
|
||||||
|
"Top": "上",
|
||||||
|
"Center": "中",
|
||||||
|
"Bottom": "下",
|
||||||
|
"FPS Counter Color": "FPS 計數器顏色",
|
||||||
|
"FPS Counter Alpha": "FPS 計數器透明度",
|
||||||
|
"Border Color": "邊框顏色",
|
||||||
|
"Dashed Line Color": "虛線顏色",
|
||||||
|
"Dashed Line Alpha": "虛線透明度",
|
||||||
|
"Max FPS Text Color": "最大 FPS 文字顏色",
|
||||||
|
"Min FPS Text Color": "最小 FPS 文字顏色",
|
||||||
|
"Main Line Color": "主線顏色",
|
||||||
|
"Rounded Line Color": "圓角線顏色",
|
||||||
|
"Perfect Line Color": "完美線顏色"
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
[status-monitor]
|
||||||
|
battery_avg_iir_filter=false
|
||||||
|
battery_time_left_refreshrate=60
|
||||||
|
average_gpu_load=false
|
||||||
|
use_old_fps_average=false
|
||||||
|
|
||||||
|
[full]
|
||||||
|
refresh_rate=1
|
||||||
|
layer_width_align=left
|
||||||
|
show_real_freqs=true
|
||||||
|
show_deltas=true
|
||||||
|
show_target_freqs=true
|
||||||
|
show_fps=true
|
||||||
|
show_res=true
|
||||||
|
show_read_speed=true
|
||||||
|
use_dynamic_colors=true
|
||||||
|
disable_screenshots=false
|
||||||
|
separator_color=#888F
|
||||||
|
cat_color_1=#8FFF
|
||||||
|
cat_color_2=#8CFF
|
||||||
|
text_color=#FFFF
|
||||||
|
|
||||||
|
[mini]
|
||||||
|
refresh_rate=1
|
||||||
|
handheld_font_size=15
|
||||||
|
docked_font_size=15
|
||||||
|
spacing=8
|
||||||
|
real_freqs=true
|
||||||
|
real_volts=true
|
||||||
|
show_full_cpu=false
|
||||||
|
show_full_res=true
|
||||||
|
show_fan_percentage=true
|
||||||
|
show_soc_voltage=false
|
||||||
|
use_dynamic_colors=true
|
||||||
|
show_vddq=false
|
||||||
|
show_vdd2=true
|
||||||
|
decimal_vdd2=false
|
||||||
|
show_dtc=true
|
||||||
|
use_dtc_symbol=true
|
||||||
|
dtc_format=%m-%d-%Y%H:%M:%S
|
||||||
|
show=DTC+BAT+CPU+GPU+RAM+TMP+FPS+RES
|
||||||
|
replace_MB_with_RAM_load=true
|
||||||
|
show_RAM_load_CPU_GPU=false
|
||||||
|
invert_battery_display=true
|
||||||
|
disable_screenshots=false
|
||||||
|
sleep_exit=false
|
||||||
|
frame_offset_x=10
|
||||||
|
frame_offset_y=10
|
||||||
|
frame_padding=10
|
||||||
|
background_color=#0009
|
||||||
|
focus_background_color=#000F
|
||||||
|
separator_color=#888F
|
||||||
|
cat_color=#2DFF
|
||||||
|
text_color=#FFFF
|
||||||
|
|
||||||
|
[micro]
|
||||||
|
refresh_rate=1
|
||||||
|
layer_height_align=top
|
||||||
|
handheld_font_size=15
|
||||||
|
docked_font_size=15
|
||||||
|
text_align=center
|
||||||
|
real_freqs=true
|
||||||
|
real_volts=true
|
||||||
|
show_full_cpu=false
|
||||||
|
show_full_res=false
|
||||||
|
show_soc_voltage=true
|
||||||
|
use_dynamic_colors=true
|
||||||
|
show_vddq=false
|
||||||
|
show_vdd2=true
|
||||||
|
decimal_vdd2=false
|
||||||
|
show_dtc=true
|
||||||
|
use_dtc_symbol=true
|
||||||
|
dtc_format=%H:%M:%S
|
||||||
|
show=FPS+CPU+GPU+RAM+SOC+BAT+DTC
|
||||||
|
replace_GB_with_RAM_load=true
|
||||||
|
invert_battery_display=false
|
||||||
|
disable_screenshots=false
|
||||||
|
sleep_exit=false
|
||||||
|
background_color=#0009
|
||||||
|
separator_color=#888F
|
||||||
|
cat_color=#2DFF
|
||||||
|
text_color=#FFFF
|
||||||
|
|
||||||
|
[fps-counter]
|
||||||
|
refresh_rate=30
|
||||||
|
handheld_font_size=40
|
||||||
|
docked_font_size=40
|
||||||
|
use_integer_counter=false
|
||||||
|
disable_screenshots=false
|
||||||
|
frame_offset_x=10
|
||||||
|
frame_offset_y=10
|
||||||
|
frame_padding=10
|
||||||
|
background_color=#0009
|
||||||
|
focus_background_color=#000F
|
||||||
|
text_color=#8CFF
|
||||||
|
|
||||||
|
[fps-graph]
|
||||||
|
refresh_rate=30
|
||||||
|
show_info=false
|
||||||
|
use_dynamic_colors=true
|
||||||
|
disable_screenshots=false
|
||||||
|
frame_offset_x=10
|
||||||
|
frame_offset_y=10
|
||||||
|
frame_padding=10
|
||||||
|
background_color=#0009
|
||||||
|
focus_background_color=#000F
|
||||||
|
fps_counter_color=#888C
|
||||||
|
border_color=#2DFF
|
||||||
|
dashed_line_color=#8888
|
||||||
|
main_line_color=#FFFF
|
||||||
|
rounded_line_color=#F0FF
|
||||||
|
perfect_line_color=#0C0F
|
||||||
|
max_fps_text_color=#FFFF
|
||||||
|
min_fps_text_color=#FFFF
|
||||||
|
text_color=#FFFF
|
||||||
|
cat_color=#0F0F
|
||||||
|
|
||||||
|
[game_resolutions]
|
||||||
|
refresh_rate=10
|
||||||
|
disable_screenshots=false
|
||||||
|
frame_offset_x=10
|
||||||
|
frame_offset_y=10
|
||||||
|
frame_padding=10
|
||||||
|
background_color=#0009
|
||||||
|
focus_background_color=#000F
|
||||||
|
cat_color=#8FFF
|
||||||
|
text_color=#FFFF
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,35 @@
|
|||||||
|
#define NX_SERVICE_ASSUME_NON_DOMAIN
|
||||||
|
#include <switch.h>
|
||||||
|
#include <service_guard.h>
|
||||||
|
|
||||||
|
static Service g_audsnoopSrv;
|
||||||
|
|
||||||
|
NX_GENERATE_SERVICE_GUARD(audsnoop);
|
||||||
|
|
||||||
|
Result _audsnoopInitialize(void) {
|
||||||
|
return smGetService(&g_audsnoopSrv, "auddev");
|
||||||
|
}
|
||||||
|
|
||||||
|
void _audsnoopCleanup(void) {
|
||||||
|
serviceClose(&g_audsnoopSrv);
|
||||||
|
}
|
||||||
|
|
||||||
|
Service* audsnoopGetServiceSession(void) {
|
||||||
|
return &g_audsnoopSrv;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result audsnoopEnableDspUsageMeasurement(void) {
|
||||||
|
return serviceDispatch(&g_audsnoopSrv, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result audsnoopDisableDspUsageMeasurement(void) {
|
||||||
|
return serviceDispatch(&g_audsnoopSrv, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result audsnoopGetDspUsage(u32 *usage) {
|
||||||
|
u32 tmp = 0;
|
||||||
|
Result rc = serviceDispatchOut(&g_audsnoopSrv, 6, tmp);
|
||||||
|
if (R_SUCCEEDED(rc) && usage)
|
||||||
|
*usage = tmp;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
Loaded 100 of 194 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user