Compare commits
114 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0bc9547701 | ||
|
|
96ac254022 | ||
|
|
92f378a80f | ||
|
|
589af01ad8 | ||
|
|
e7f14b88e5 | ||
|
|
35a269e4a7 | ||
|
|
ff95ca527f | ||
|
|
550e4e5204 | ||
|
|
a088c4795a | ||
|
|
e8a264fa11 | ||
|
|
de681c20a0 | ||
|
|
22aef264ab | ||
|
|
309717c468 | ||
|
|
9b91d7487c | ||
|
|
c0b458243c | ||
|
|
7d9c60cdfe | ||
|
|
12c9effec2 | ||
|
|
6eeab63075 | ||
|
|
2d81c5e127 | ||
|
|
b1739cea74 | ||
|
|
aa607ab1a7 | ||
|
|
d1242a17d4 | ||
|
|
80701c2891 | ||
|
|
cfd0d84ac8 | ||
|
|
c33aabdc84 | ||
|
|
c70fd82e60 | ||
|
|
574c248d68 | ||
|
|
ebcf07dab8 | ||
|
|
d170ca92ad | ||
|
|
cab8a14b99 | ||
|
|
b623dabce5 | ||
|
|
e5eb49f2e5 | ||
|
|
9f0a609735 | ||
|
|
19a2e562bc | ||
|
|
73c3311251 | ||
|
|
eb7fca1c1a | ||
|
|
ad1f070a6b | ||
|
|
0ae65c8740 | ||
|
|
39fbe25afc | ||
|
|
3bad144280 | ||
|
|
123d4b6080 | ||
|
|
2f6ed69b92 | ||
|
|
337f7e6ac0 | ||
|
|
a5efa7ae72 | ||
|
|
a8ee389681 | ||
|
|
54554bacea | ||
|
|
3da2fc4b6d | ||
|
|
83287b1f5c | ||
|
|
4f6756c609 | ||
|
|
ef2434c457 | ||
|
|
b0237a2042 | ||
|
|
c6275eb977 | ||
|
|
72961aa2f1 | ||
|
|
9c60697344 | ||
|
|
f786d97de1 | ||
|
|
20389043ac | ||
|
|
00b9d8550e | ||
|
|
0c0a4b3d6b | ||
|
|
61fd9d74d3 | ||
|
|
f36383d0e7 | ||
|
|
606cafbaad | ||
|
|
cff4267a68 | ||
|
|
65e7d83972 | ||
|
|
e2533e2bb0 | ||
|
|
0d4ca24538 | ||
|
|
6c94f5754c | ||
|
|
aaf77997e1 | ||
|
|
c933e02aed | ||
|
|
770c25dbcb | ||
|
|
bf8a6c4785 | ||
|
|
dbb4d698a0 | ||
|
|
6ae084433f | ||
|
|
32f19c4f0e | ||
|
|
05cf2ab4dd | ||
|
|
13a4ea4ca0 | ||
|
|
e2ef52e095 | ||
|
|
bbd3b1a0fc | ||
|
|
8dcfb55646 | ||
|
|
ae0f4c7963 | ||
|
|
222db76200 | ||
|
|
2376b85d3a | ||
|
|
26fb76e448 | ||
|
|
159c7567c0 | ||
|
|
39366ce238 | ||
|
|
da631ad268 | ||
|
|
d508177d4b | ||
|
|
d8527410de | ||
|
|
bae7216de0 | ||
|
|
b3ddf172e8 | ||
|
|
cdaea8f729 | ||
|
|
918ca5757c | ||
|
|
93cb0e99c4 | ||
|
|
4692529346 | ||
|
|
8de1191ed5 | ||
|
|
1c21187f73 | ||
|
|
2646995b72 | ||
|
|
cf21342b2e | ||
|
|
3709fb3fba | ||
|
|
ea754707ee | ||
|
|
bb96267d6c | ||
|
|
a1fa16da3c | ||
|
|
aad126d611 | ||
|
|
835189febc | ||
|
|
a9cf59fe28 | ||
|
|
7708e4bae6 | ||
|
|
8c71227c63 | ||
|
|
627732326b | ||
|
|
f5d9761853 | ||
|
|
1d219e9425 | ||
|
|
2c14ddad5c | ||
|
|
fee7e7a4f4 | ||
|
|
caeee5920b | ||
|
|
71fbeef32a | ||
|
|
86fce20b27 |
163
.github/workflows/build.yml
vendored
Normal file
163
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
name: Build Horizon OC Zeus
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ develop, main, master ]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Minimal devkitA64 container
|
||||
container:
|
||||
image: devkitpro/devkita64:20251231
|
||||
|
||||
steps:
|
||||
- name: Checkout repository and submodules # needed for hoc-clk
|
||||
uses: actions/checkout@v6.0.2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
|
||||
# -------------------------------------------------
|
||||
# Fix PATH for devkitA64 and devkitARM
|
||||
# -------------------------------------------------
|
||||
- name: Set devkitPro PATH
|
||||
run: |
|
||||
echo "DEVKITPRO=/opt/devkitpro" >> $GITHUB_ENV
|
||||
echo "DEVKITA64=/opt/devkitpro/devkitA64" >> $GITHUB_ENV
|
||||
echo "DEVKITARM=/opt/devkitpro/devkitARM" >> $GITHUB_ENV
|
||||
echo "PATH=/opt/devkitpro/devkitA64/bin:/opt/devkitpro/devkitARM/bin:$PATH" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Check devkitPro gcc and g++ versions
|
||||
run: |
|
||||
aarch64-none-elf-gcc --version
|
||||
aarch64-none-elf-g++ --version
|
||||
shell: bash # is this even needed? but for consistency let's keep using it
|
||||
|
||||
- name: Install ccache
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y ccache
|
||||
shell: bash
|
||||
|
||||
# -------------------------------------------------
|
||||
# Get short commit SHA
|
||||
# -------------------------------------------------
|
||||
- name: Set commit SHA & dist
|
||||
id: vars
|
||||
run: |
|
||||
echo "SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
|
||||
echo $SHORT_SHA > dist/.commit
|
||||
echo $GITHUB_SHA >> dist/.commit
|
||||
|
||||
- name: Clone Atmosphere
|
||||
run: git clone --depth=1 --single-branch https://github.com/Atmosphere-NX/Atmosphere.git atmosphere -b $(cat ams_ver.txt)
|
||||
|
||||
- name: Prepare build folder
|
||||
run: |
|
||||
mkdir -p build
|
||||
cp -r atmosphere/* build/
|
||||
|
||||
- name: Override ldr_process_creation.cpp
|
||||
run: |
|
||||
cp -rf Source/Atmosphere/stratosphere/loader/source/* build/stratosphere/loader/source/
|
||||
|
||||
- name: Cache ccache
|
||||
uses: actions/cache@v5.0.3
|
||||
with:
|
||||
path: /root/.cache/ccache
|
||||
key: ccache-${{ runner.os }}-devkitpro-ams-${{ hashFiles('ams_ver.txt') }} # last key was utter garbage, stick to ams versions,
|
||||
restore-keys: |
|
||||
ccache-${{ runner.os }}-devkitpro-
|
||||
|
||||
- name: Configure ccache
|
||||
run: |
|
||||
export CCACHE_DIR=/root/.cache/ccache
|
||||
echo "CCACHE_DIR=/root/.cache/ccache" >> $GITHUB_ENV
|
||||
ccache --set-config=max_size=10G
|
||||
ccache --set-config=compiler_check=content
|
||||
ccache --zero-stats
|
||||
|
||||
- name: Build hoc-clk sysmodule and overlay
|
||||
shell: bash
|
||||
run: |
|
||||
export CC="ccache aarch64-none-elf-gcc"
|
||||
export CXX="ccache aarch64-none-elf-g++"
|
||||
|
||||
ROOT_DIR="$GITHUB_WORKSPACE/Source/sys-clk"
|
||||
DIST_DIR="$ROOT_DIR/dist"
|
||||
|
||||
mkdir -p "$DIST_DIR"
|
||||
|
||||
echo "*** sysmodule ***"
|
||||
|
||||
TITLE_ID="$(grep -oP '"title_id":\s*"0x\K(\w+)' \
|
||||
"$ROOT_DIR/sysmodule/perms.json")"
|
||||
|
||||
echo "TITLE_ID: $TITLE_ID"
|
||||
|
||||
pushd "$ROOT_DIR/sysmodule"
|
||||
make -j$(($(nproc) * 2)) CXX="ccache aarch64-none-elf-g++" CC="ccache aarch64-none-elf-gcc"
|
||||
popd
|
||||
|
||||
mkdir -p "$DIST_DIR/atmosphere/contents/$TITLE_ID/flags"
|
||||
|
||||
cp -vf \
|
||||
"$ROOT_DIR/sysmodule/out/horizon-oc.nsp" \
|
||||
"$DIST_DIR/atmosphere/contents/$TITLE_ID/exefs.nsp"
|
||||
|
||||
: >"$DIST_DIR/atmosphere/contents/$TITLE_ID/flags/boot2.flag"
|
||||
|
||||
cp -vf \
|
||||
"$ROOT_DIR/sysmodule/toolbox.json" \
|
||||
"$DIST_DIR/atmosphere/contents/$TITLE_ID/toolbox.json"
|
||||
|
||||
echo "*** overlay ***"
|
||||
|
||||
pushd "$ROOT_DIR/overlay"
|
||||
make -j$(($(nproc) * 2)) CXX="ccache aarch64-none-elf-g++" CC="ccache aarch64-none-elf-gcc"
|
||||
popd
|
||||
|
||||
mkdir -p "$DIST_DIR/switch/.overlays"
|
||||
|
||||
cp -vf \
|
||||
"$ROOT_DIR/overlay/out/horizon-oc-overlay.ovl" \
|
||||
"$DIST_DIR/switch/.overlays/horizon-oc-overlay.ovl"
|
||||
|
||||
echo "*** assets ***"
|
||||
|
||||
mkdir -p "$DIST_DIR/config/horizon-oc"
|
||||
|
||||
cp -vf \
|
||||
"$ROOT_DIR/config.ini.template" \
|
||||
"$DIST_DIR/config/horizon-oc/config.ini.template"
|
||||
|
||||
cp -vf \
|
||||
"$ROOT_DIR/README.md" \
|
||||
"$DIST_DIR/README.md"
|
||||
|
||||
- name: Build kip
|
||||
working-directory: build/stratosphere/loader
|
||||
run: |
|
||||
export CC="ccache aarch64-none-elf-gcc"
|
||||
export CXX="ccache aarch64-none-elf-g++"
|
||||
make -j$(($(nproc) * 4)) CXX="ccache aarch64-none-elf-g++" CC="ccache aarch64-none-elf-gcc"
|
||||
hactool -t kip1 out/nintendo_nx_arm64_armv8a/release/loader.kip --uncompress=hoc.kip
|
||||
cp hoc.kip ../../../dist/atmosphere/kips/hoc.kip
|
||||
|
||||
- name: ccache stats
|
||||
run: ccache --show-stats
|
||||
|
||||
# -------------------------------------------------
|
||||
# Upload ZIP artifact
|
||||
# -------------------------------------------------
|
||||
- name: Upload build artifact
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: horizon-oc-zeus-dist
|
||||
path: dist/
|
||||
compression-level: 3
|
||||
78
README.md
78
README.md
@@ -7,7 +7,7 @@
|
||||
|
||||

|
||||

|
||||
[](https://discord.com/invite/S3eX47dHsB)
|
||||
[](https://dsc.gg/horizonoc)
|
||||

|
||||

|
||||

|
||||
@@ -41,9 +41,7 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to
|
||||
* Built-in configurator
|
||||
* Compatible with most homebrew
|
||||
|
||||
> *Higher (potentially dangerous) frequencies are unlockable via configuration.*
|
||||
> *Erista and Mariko units can usually push a bit further fully safely with a bit of undervolting, however this may not work on all units.*
|
||||
> *The exact maximum overclock possible varies per console, although most consoles should be able to do this safely.*
|
||||
> It is reccomended to read the [guide](https://rentry.co/howtoget60fps) before proceeding, as this can help you get a *significant* performance boost over the default settings, often times with less power draw and heat output
|
||||
|
||||
---
|
||||
|
||||
@@ -69,7 +67,7 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to
|
||||
|
||||
1. Open the Horizon OC Overlay
|
||||
2. Open the settings menu
|
||||
3. Adjust your overclocking settings as desired.
|
||||
3. Adjust your overclocking settings as desired. A helpful guide can be found [here.](https://rentry.co/mariko#oc-settings-for-horizon-oc)
|
||||
4. Click **Save KIP Settings** to apply your configuration.
|
||||
|
||||
---
|
||||
@@ -78,6 +76,73 @@ It enables advanced CPU, GPU, and RAM tuning with user-friendly configuration to
|
||||
|
||||
Refer to COMPILATION.md
|
||||
|
||||
---
|
||||
## Clock table
|
||||
|
||||
### MEM clocks
|
||||
* 3200 → max on mariko, JEDEC.
|
||||
* 2933 → JEDEC.
|
||||
* 2666 → JEDEC.
|
||||
* 2400 → max on erista, JEDEC.
|
||||
* 2133 → mariko safe max (4266 Modules), JEDEC.
|
||||
* 1996 → JEDEC.
|
||||
* 1866 → mariko safe max (3733 Modules), JEDEC.
|
||||
* 1600 → official docked, boost mode, erista safe max, JEDEC.
|
||||
* 1331 → official handheld, JEDEC.
|
||||
* 1065
|
||||
* 800
|
||||
* 665
|
||||
|
||||
### CPU clocks
|
||||
* 2601 → mariko absolute max, very dangerous
|
||||
* 2499
|
||||
* 2397 → mariko safe max with UV (low speedo)
|
||||
* 2295
|
||||
* 2193
|
||||
* 2091
|
||||
* 1963 → mariko no UV max clock
|
||||
* 1887
|
||||
* 1785 → erista no UV max clock, boost mode
|
||||
* 1683
|
||||
* 1581
|
||||
* 1428
|
||||
* 1326
|
||||
* 1224 → sdev oc
|
||||
* 1122
|
||||
* 1020 → official docked & handheld
|
||||
* 918
|
||||
* 816
|
||||
* 714
|
||||
* 612 → sleep mode
|
||||
|
||||
### GPU clocks
|
||||
* 1536 → absolute max clock on mariko. very dangerous
|
||||
* 1459
|
||||
* 1382
|
||||
* 1305
|
||||
* 1267 → NVIDIA T214 rating
|
||||
* 1228 → mariko HiOPT safe clock
|
||||
* 1152 → mariko SLT max clock
|
||||
* 1075 → mariko no UV max clock. absolute max clock on erista. very dangerous
|
||||
* 998 → NVIDIA T210 rating
|
||||
* 960 (erista only) → erista slt/hiopt safe max clock
|
||||
* 921 → erista no UV max clock
|
||||
* 844
|
||||
* 768 → official docked
|
||||
* 691
|
||||
* 614
|
||||
* 537
|
||||
* 460 → max handheld
|
||||
* 384 → official handheld
|
||||
* 307 → official handheld
|
||||
* 230
|
||||
* 153
|
||||
* 76 → boost mode
|
||||
|
||||
**Notes:**
|
||||
1. GPU overclock is capped at 460MHz in handheld and capped at 768MHz if charging, unless you're using the official charger.
|
||||
2. Clocks higher than 768MHz need the official charger is plugged in.
|
||||
|
||||
---
|
||||
|
||||
## Credits
|
||||
@@ -86,6 +151,7 @@ Refer to COMPILATION.md
|
||||
* **Souldbminer** – hoc-clk and loader development
|
||||
* **Lightos** – loader patches development
|
||||
* **SciresM** - Atmosphere CFW
|
||||
* **CTCaer** - L4T, Hekate, perfect ram timings
|
||||
* **KazushiMe** – Switch OC Suite
|
||||
* **hanai3bi (meha)** – Switch OC Suite, EOS, sys-clk-eos
|
||||
* **NaGaa95** – L4T-OC-kernel
|
||||
@@ -95,4 +161,4 @@ Refer to COMPILATION.md
|
||||
* **MasaGratoR and ZachyCatGames** - General help
|
||||
* **MasaGratoR** - Status Monitor & Display Refresh Rate Driver
|
||||
* **Dom, Samybigio, Arcdelta, Miki, Happy, Flopsider, Winnerboi77, Blaise, Alvise, TDRR, agjeococh and Xenshen** - Testing
|
||||
* **Samybigio2011** - Italian translations
|
||||
* **Samybigio2011** - Italian translations
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) Atmosphère-NX
|
||||
*
|
||||
* 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.
|
||||
@@ -692,11 +694,11 @@ namespace ams::ldr {
|
||||
|
||||
/* Apply PCV and PTM patches */
|
||||
if (g_is_pcv) {
|
||||
oc::pcv::Patch(map_address, nso_size);
|
||||
hoc::pcv::Patch(map_address, nso_size);
|
||||
}
|
||||
|
||||
if (g_is_ptm) {
|
||||
oc::ptm::Patch(map_address, nso_size);
|
||||
hoc::ptm::Patch(map_address, nso_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2023 hanai3Bi
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -22,23 +22,24 @@
|
||||
|
||||
/* Never edit these. */
|
||||
#define AUTO 0
|
||||
#define AUTO_RAM 0
|
||||
#define ENABLED 1
|
||||
#define DISABLED 0
|
||||
#define DEACTIVATED_GPU_FREQ 2000
|
||||
#define GPU_MIN_MIN_VOLT 480000
|
||||
#define CPU_MAX_MAX_VOLT 1235000
|
||||
|
||||
namespace ams::ldr::oc {
|
||||
namespace ams::ldr::hoc {
|
||||
|
||||
volatile CustomizeTable C = {
|
||||
|
||||
/* Disables RAM powerdown */
|
||||
.hpMode = DISABLED,
|
||||
|
||||
.commonEmcMemVolt = 1175000, // LPDDR4X JEDEC Specification
|
||||
.eristaEmcMaxClock = 1600000, // Maximum HB-MGCH ram rating
|
||||
.commonEmcMemVolt = 1175000, /* LPDDR4X JEDEC Specification */
|
||||
.eristaEmcMaxClock = 1600000, /* Maximum HB-MGCH ram rating */
|
||||
|
||||
.marikoEmcMaxClock = 1866000,
|
||||
.marikoEmcVddqVolt = 600000,
|
||||
.marikoEmcMaxClock = 1866000, /* 1866MHz @ 1866tWRL is guaranteed to work on all Mariko units */
|
||||
.marikoEmcVddqVolt = 600000, /* Micron: 600mV, other manafacturers: 640mV */
|
||||
.emcDvbShift = 0,
|
||||
|
||||
// Primary
|
||||
@@ -52,9 +53,7 @@ volatile CustomizeTable C = {
|
||||
.t7_tWTR = 0,
|
||||
.t8_tREFI = 0,
|
||||
|
||||
/* Set to 4 read and 2 write for 1866b tWRL. */
|
||||
/* For 2133 tWRL: 8 read and 4 write. */
|
||||
|
||||
/* You can mix and match different latencies if needed */
|
||||
/*
|
||||
* Read:
|
||||
* 2133RL = 40
|
||||
@@ -67,8 +66,9 @@ volatile CustomizeTable C = {
|
||||
* 1600WL = 14
|
||||
* 1331WL = 12
|
||||
*/
|
||||
.mem_burst_read_latency = 36,
|
||||
.mem_burst_write_latency = 16,
|
||||
|
||||
.mem_burst_read_latency = RL_1866,
|
||||
.mem_burst_write_latency = WL_1866,
|
||||
|
||||
.eristaCpuUV = 0,
|
||||
.eristaCpuVmin = 800,
|
||||
@@ -78,9 +78,11 @@ volatile CustomizeTable C = {
|
||||
|
||||
.marikoCpuUVLow = 0, // No undervolt
|
||||
.marikoCpuUVHigh = 0, // No undervolt
|
||||
|
||||
.tableConf = DEFAULT_TABLE,
|
||||
.marikoCpuLowVmin = 620,
|
||||
.marikoCpuHighVmin = 750,
|
||||
/* 1120mV is NVIDIA rating */
|
||||
.marikoCpuMaxVolt = 1120,
|
||||
|
||||
/* Supported values: 1963000, 2091000, 2193000, 2295000, 2397000, 2499000, 2601000, 2703000. */
|
||||
@@ -96,22 +98,25 @@ volatile CustomizeTable C = {
|
||||
.marikoCpuBoostClock = 1963000, // Default boost clock
|
||||
|
||||
.eristaGpuUV = 0,
|
||||
.eristaGpuVmin = 800,
|
||||
.eristaGpuVmin = 810,
|
||||
|
||||
.marikoGpuUV = 0,
|
||||
|
||||
/* For automatic vmin detection, set this to AUTO. */
|
||||
/* vmin past 795mV won't work due to HOS limitation */
|
||||
/* Vmin is automatically set to 800mV when SoC temperature is below 20C */
|
||||
.marikoGpuVmin = AUTO,
|
||||
|
||||
.marikoGpuVmax = 800,
|
||||
|
||||
.commonGpuVoltOffset = 0,
|
||||
|
||||
/* Speedo is automatically set by hoc-clk on first boot */
|
||||
.gpuSpeedo = 1450,
|
||||
|
||||
/* This table is used with a gpu uv mode of 2. */
|
||||
/* Setting DEACTIVATED_GPU_FREQ on any freq will disable it and all freqs greater than it. (the latter is a bug :/) */
|
||||
/* AUTO: Voltage is optimally chosen; with commonGpuVoltOffset applied. */
|
||||
/* AUTO only works up to 1305 GPU on Mariko and 921 GPU on Erista */
|
||||
/* AUTO only works up to 1305 GPU on Mariko and 998 GPU on Erista (it is reccomended to manually set your 998MHz voltage though) */
|
||||
/* You can overwrite auto with any voltage (in mv) of your choice - offset will not be applied. */
|
||||
|
||||
.eristaGpuVoltArray = {
|
||||
@@ -159,8 +164,8 @@ volatile CustomizeTable C = {
|
||||
AUTO /* 921 */,
|
||||
AUTO /* 998 */,
|
||||
AUTO /* 1075 */,
|
||||
DEACTIVATED_GPU_FREQ /* 1152 */,
|
||||
DEACTIVATED_GPU_FREQ /* 1228 */,
|
||||
AUTO /* 1152 (SLT / HiOPT Only!) */,
|
||||
AUTO /* 1228 (HiOPT Only!) */,
|
||||
DEACTIVATED_GPU_FREQ /* 1267 (Disabled by default) */,
|
||||
DEACTIVATED_GPU_FREQ /* 1305 (Disabled by default) */,
|
||||
DEACTIVATED_GPU_FREQ /* 1344 (Disabled by default) */,
|
||||
@@ -171,6 +176,8 @@ volatile CustomizeTable C = {
|
||||
DEACTIVATED_GPU_FREQ /* 1536 (Disabled by default) */,
|
||||
},
|
||||
|
||||
.fineTune_t7_tWTR = 0,
|
||||
|
||||
/* You shouldn't have to anything past here. */
|
||||
.eristaCpuDvfsTable = {
|
||||
{ 204000, { 721094, }, { } },
|
||||
@@ -327,7 +334,7 @@ volatile CustomizeTable C = {
|
||||
{ 2703000, { 1838820, -36648, 113, }, { CPU_MAX_MAX_VOLT, } },
|
||||
},
|
||||
|
||||
.marikoCpuDvfsTableHelios {
|
||||
.marikoCpuDvfsTableExtreme {
|
||||
{ 204000, { 732856, -17335, 113, }, { } },
|
||||
{ 306000, { 760024, -18195, 113, }, { } },
|
||||
{ 408000, { 789258, -19055, 113, }, { } },
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2023 hanai3Bi
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -20,25 +20,47 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define CUST_REV 11
|
||||
#define CUST_REV 1
|
||||
|
||||
#include "oc_common.hpp"
|
||||
#include "pcv/pcv_common.hpp"
|
||||
|
||||
namespace ams::ldr::oc {
|
||||
namespace ams::ldr::hoc {
|
||||
|
||||
#include "mtc_timing_table.hpp"
|
||||
|
||||
enum MtcConfig: u32 {
|
||||
AUTO_ADJ = 0,
|
||||
AUTO_ADJ_BL = 1,
|
||||
};
|
||||
|
||||
enum TableConfig: u32 {
|
||||
DEFAULT_TABLE = 1,
|
||||
TBREAK_1581 = 2,
|
||||
TBREAK_1683 = 3,
|
||||
HELIOS_TABLE = 4,
|
||||
EXTREME_TABLE = 4,
|
||||
};
|
||||
|
||||
/*
|
||||
* Read:
|
||||
* 2133RL = 40
|
||||
* 1866RL = 36
|
||||
* 1600RL = 32
|
||||
* 1331RL = 28
|
||||
* Write:
|
||||
* 2133WL = 18
|
||||
* 1866WL = 16
|
||||
* 1600WL = 14
|
||||
* 1331WL = 12
|
||||
*/
|
||||
|
||||
enum ReadLatency: u32 {
|
||||
RL_2133 = 40,
|
||||
RL_1866 = 36,
|
||||
RL_1600 = 32,
|
||||
RL_1331 = 28,
|
||||
};
|
||||
|
||||
enum WriteLatency: u32 {
|
||||
WL_2133 = 18,
|
||||
WL_1866 = 16,
|
||||
WL_1600 = 14,
|
||||
WL_1331 = 12,
|
||||
};
|
||||
|
||||
using CustomizeCpuDvfsTable = pcv::cvb_entry_t[pcv::DvfsTableEntryLimit];
|
||||
@@ -53,16 +75,14 @@ typedef struct CustomizeTable {
|
||||
u8 cust[4] = {'C', 'U', 'S', 'T'};
|
||||
u32 custRev = CUST_REV;
|
||||
|
||||
u32 mtcConf;
|
||||
u32 placeholder;
|
||||
u32 hpMode;
|
||||
|
||||
u32 commonEmcMemVolt;
|
||||
u32 eristaEmcMaxClock;
|
||||
|
||||
u32 marikoEmcMaxClock;
|
||||
u32 marikoEmcVddqVolt;
|
||||
u32 emcDvbShift;
|
||||
|
||||
// advanced config
|
||||
u32 t1_tRCD;
|
||||
u32 t2_tRP;
|
||||
@@ -101,12 +121,15 @@ typedef struct CustomizeTable {
|
||||
|
||||
u32 commonGpuVoltOffset;
|
||||
|
||||
/* TODO: Automatically detect speedo. */
|
||||
u32 gpuSpeedo;
|
||||
|
||||
u32 eristaGpuVoltArray[27];
|
||||
u32 marikoGpuVoltArray[24];
|
||||
|
||||
u32 fineTune_t7_tWTR;
|
||||
|
||||
u32 reserved[60];
|
||||
|
||||
CustomizeCpuDvfsTable eristaCpuDvfsTable;
|
||||
CustomizeCpuDvfsTable eristaCpuDvfsTableSLT;
|
||||
|
||||
@@ -114,7 +137,7 @@ typedef struct CustomizeTable {
|
||||
CustomizeCpuDvfsTable marikoCpuDvfsTableSLT;
|
||||
CustomizeCpuDvfsTable marikoCpuDvfsTable1581Tbreak;
|
||||
CustomizeCpuDvfsTable marikoCpuDvfsTable1683Tbreak;
|
||||
CustomizeCpuDvfsTable marikoCpuDvfsTableHelios;
|
||||
CustomizeCpuDvfsTable marikoCpuDvfsTableExtreme;
|
||||
|
||||
CustomizeGpuDvfsTable eristaGpuDvfsTable;
|
||||
CustomizeGpuDvfsTable eristaGpuDvfsTableSLT;
|
||||
|
||||
@@ -18,49 +18,16 @@
|
||||
#include "../mtc_timing_value.hpp"
|
||||
#include "timing_tables.hpp"
|
||||
|
||||
namespace ams::ldr::oc::pcv::mariko {
|
||||
namespace ams::ldr::hoc::pcv::mariko {
|
||||
|
||||
u32 GetRext() {
|
||||
void GetRext() {
|
||||
if (auto r = FindRext()) {
|
||||
return r->correct;
|
||||
rext = r->rext;
|
||||
return;
|
||||
}
|
||||
return 0x1A;
|
||||
}
|
||||
|
||||
void CalculateTWTPDEN() {
|
||||
tWTPDEN = tW2P + 1 + CEIL(tDQSS_max / tCK_avg) + CEIL(tDQS2DQ_max / tCK_avg) + 6;
|
||||
if (C.marikoEmcMaxClock >= 2'233'000 && C.marikoEmcMaxClock < 2'533'000) tWTPDEN++;
|
||||
if (C.marikoEmcMaxClock >= 2'433'000 && C.marikoEmcMaxClock < 2'800'000) tWTPDEN--;
|
||||
}
|
||||
|
||||
void CalculateTR2W() {
|
||||
tR2W = CEIL(RL_DBI + (tDQSCK_max / tCK_avg) + (BL / 2) - WL + tWPRE + FLOOR(tRPST) + 9.0) - (C.t6_tRTW * 3);
|
||||
|
||||
if (auto patch = FindTR2WPatch()) {
|
||||
tR2W += patch->adjust;
|
||||
}
|
||||
}
|
||||
|
||||
void CalculatePdex2rw() {
|
||||
double freq_mhz = C.marikoEmcMaxClock / 1000.0;
|
||||
|
||||
double pdex_local = (0.011 * freq_mhz) - 1.443;
|
||||
pdex2rw = static_cast<u32>(ROUND(pdex_local));
|
||||
|
||||
if (pdex2rw < 22) pdex2rw = 22;
|
||||
if (pdex2rw > 33) pdex2rw = 33;
|
||||
|
||||
if (auto patch = FindPdex2rwPatch()) {
|
||||
pdex2rw += patch->adjust;
|
||||
}
|
||||
}
|
||||
|
||||
void CalculateCke2pden() {
|
||||
cke2pden = (static_cast<double>((C.marikoEmcMaxClock / 1000.0) * 0.00875) - 0.65);
|
||||
|
||||
if (auto patch = FindCke2pdenPatch()) {
|
||||
cke2pden += patch->adjust;
|
||||
}
|
||||
/* Fallback. */
|
||||
rext = 0x1A;
|
||||
}
|
||||
|
||||
void CalculateMrw2() {
|
||||
@@ -93,11 +60,7 @@ namespace ams::ldr::oc::pcv::mariko {
|
||||
}
|
||||
|
||||
void CalculateTimings() {
|
||||
rext = GetRext();
|
||||
CalculateTWTPDEN();
|
||||
CalculateTR2W();
|
||||
CalculatePdex2rw();
|
||||
CalculateCke2pden();
|
||||
GetRext();
|
||||
CalculateMrw2();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace ams::ldr::oc::pcv::mariko {
|
||||
namespace ams::ldr::hoc::pcv::mariko {
|
||||
|
||||
void CalculateTimings();
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "../mtc_timing_value.hpp"
|
||||
#include "timing_tables.hpp"
|
||||
|
||||
namespace ams::ldr::oc::pcv::mariko {
|
||||
namespace ams::ldr::hoc::pcv::mariko {
|
||||
|
||||
const ReplacePatch g_rext_table[] = {
|
||||
{2'133'000, 0x1A}, {2'166'000, 0x19}, {2'200'000, 0x19},
|
||||
@@ -36,78 +36,11 @@ namespace ams::ldr::oc::pcv::mariko {
|
||||
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)
|
||||
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;
|
||||
}
|
||||
|
||||
const AdjustPatch g_tr2w_patches[] = {
|
||||
{2'500'000, 1},
|
||||
{2'533'000, 1},
|
||||
{2'566'000, 1},
|
||||
{2'866'000, -1},
|
||||
{3'100'000, 1},
|
||||
{3'133'000, 1},
|
||||
};
|
||||
|
||||
const u32 g_tr2w_table_size = sizeof(g_tr2w_patches) / sizeof(g_tr2w_patches[0]);
|
||||
|
||||
const AdjustPatch *FindTR2WPatch() {
|
||||
for (u32 i = 0; i < g_tr2w_table_size; i++)
|
||||
if (g_tr2w_patches[i].freq == C.marikoEmcMaxClock)
|
||||
return &g_tr2w_patches[i];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const AdjustPatch g_pdex2rw_patches[] = {
|
||||
{2'166'000, 1},
|
||||
{2'300'000, 1},
|
||||
{2'333'000, 1},
|
||||
{2'433'000, 1},
|
||||
{2'533'000, 0},
|
||||
{2'633'000, -1},
|
||||
{2'666'000, -1},
|
||||
{2'733'000, -1},
|
||||
{2'766'000, -1},
|
||||
{2'800'000, -1},
|
||||
{2'833'000, -1},
|
||||
{2'933'000, -1},
|
||||
{3'066'000, 1},
|
||||
};
|
||||
|
||||
const u32 g_pdex2rw_table_size = sizeof(g_pdex2rw_patches) / sizeof(g_pdex2rw_patches[0]);
|
||||
|
||||
const AdjustPatch *FindPdex2rwPatch() {
|
||||
for (u32 i = 0; i < g_pdex2rw_table_size; i++)
|
||||
if (g_pdex2rw_patches[i].freq == C.marikoEmcMaxClock)
|
||||
return &g_pdex2rw_patches[i];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const AdjustPatch g_cke2pden_patches[] = {
|
||||
{2'133'000, 1},
|
||||
{2'166'000, 1},
|
||||
{2'266'000, 1},
|
||||
{2'300'000, 1},
|
||||
{2'366'000, 1},
|
||||
{2'400'000, 1},
|
||||
{2'500'000, 1},
|
||||
{2'633'000, 1},
|
||||
{2'733'000, 1},
|
||||
{2'833'000, 1},
|
||||
{2'866'000, 1},
|
||||
{2'966'000, 1},
|
||||
{3'066'000, 1},
|
||||
{3'100'000, 1},
|
||||
};
|
||||
|
||||
const u32 g_cke2pden_table_size = sizeof(g_cke2pden_patches) / sizeof(g_cke2pden_patches[0]);
|
||||
|
||||
const AdjustPatch *FindCke2pdenPatch() {
|
||||
for (u32 i = 0; i < g_cke2pden_table_size; i++)
|
||||
if (g_cke2pden_patches[i].freq == C.marikoEmcMaxClock)
|
||||
return &g_cke2pden_patches[i];
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,32 +17,15 @@
|
||||
#pragma once
|
||||
#include "../mtc_timing_value.hpp"
|
||||
|
||||
namespace ams::ldr::oc::pcv::mariko {
|
||||
namespace ams::ldr::hoc::pcv::mariko {
|
||||
|
||||
struct ReplacePatch {
|
||||
u32 freq;
|
||||
u32 correct;
|
||||
u32 rext;
|
||||
};
|
||||
|
||||
extern const ReplacePatch g_rext_table[];
|
||||
extern const u32 g_rext_table_size;
|
||||
const ReplacePatch *FindRext();
|
||||
|
||||
struct AdjustPatch {
|
||||
u32 freq;
|
||||
s32 adjust;
|
||||
};
|
||||
|
||||
extern const AdjustPatch g_tr2w_patches[];
|
||||
extern const u32 g_tr2w_table_size;
|
||||
const AdjustPatch *FindTR2WPatch();
|
||||
|
||||
extern const AdjustPatch g_pdex2rw_patches[];
|
||||
extern const u32 g_pdex2rw_table_size;
|
||||
const AdjustPatch *FindPdex2rwPatch();
|
||||
|
||||
extern const AdjustPatch g_cke2pden_patches[];
|
||||
extern const u32 g_cke2pden_table_size;
|
||||
const AdjustPatch *FindCke2pdenPatch();
|
||||
|
||||
}
|
||||
|
||||
@@ -20,20 +20,20 @@
|
||||
|
||||
#include "oc_common.hpp"
|
||||
|
||||
namespace ams::ldr::oc {
|
||||
#define MAX(A, B) std::max(A, B)
|
||||
#define MIN(A, B) std::min(A, B)
|
||||
#define CEIL(A) std::ceil(A)
|
||||
#define FLOOR(A) std::floor(A)
|
||||
#define ROUND(A) std::lround(A)
|
||||
namespace ams::ldr::hoc {
|
||||
#define MAX(A, B) std::max(A, B)
|
||||
#define MIN(A, B) std::min(A, B)
|
||||
#define CEIL(A) std::ceil(A)
|
||||
#define FLOOR(A) std::floor(A)
|
||||
#define ROUND(A) std::lround(A)
|
||||
|
||||
#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))
|
||||
|
||||
/* Primary timings. */
|
||||
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, 10> tRAS_values = { 42, 36, 34, 32, 30, 28, 26, 24, 22, 20 };
|
||||
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, 10> tRAS_values = { 42, 36, 34, 32, 30, 28, 26, 24, 22, 20 };
|
||||
const std::array<double, 7> tRRD_values = { /*10.0,*/ 7.5, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0 }; /* 10.0 is used for <2133mhz; do we care? 8gb uses 7.5 tRRD on >=1331. */
|
||||
const std::array<u32, 11> tRFC_values = { 140, 130, 120, 110, 100, 90, 80, 70, 60, 50, 40 };
|
||||
const std::array<u32, 10> tWTR_values = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
|
||||
@@ -77,7 +77,49 @@ namespace ams::ldr::oc {
|
||||
|
||||
/* TOOD: Fix erista */
|
||||
namespace pcv::erista {
|
||||
const double tCK_avg = 1000'000.0 / C.eristaEmcMaxClock;
|
||||
|
||||
const u32 tRCD = tRCD_values[C.t1_tRCD];
|
||||
const u32 tRPpb = tRP_values[C.t2_tRP];
|
||||
const u32 tRAS = tRAS_values[C.t3_tRAS];
|
||||
const double tRRD = tRRD_values[C.t4_tRRD];
|
||||
const u32 tRFCpb = tRFC_values[C.t5_tRFC];
|
||||
const u32 tWTR = 10 - tWTR_values[C.t7_tWTR];
|
||||
|
||||
const u32 tRC = tRAS + tRPpb;
|
||||
const u32 tRFCab = tRFCpb * 2;
|
||||
const double tXSR = (double) (tRFCab + 7.5);
|
||||
const u32 tFAW = static_cast<u32>(tRRD * 4.0);
|
||||
const double tRPab = tRPpb + 3;
|
||||
|
||||
const u32 tR2P = 12;
|
||||
|
||||
const u32 tW2P = (CEIL(WL * 1.7303) * 2) - 5;
|
||||
const u32 tW2R = CEIL(MAX(WL + (0.010322547033278747 * (C.eristaEmcMaxClock / 1000.0)), (WL * -0.2067922202979121) + FLOOR(((RL_DBI * -0.1331159971685554) + WL) * 3.654131957826108)) - (tWTR / tCK_avg));
|
||||
|
||||
const u32 wdv = WL;
|
||||
const u32 wsv = WL - 2;
|
||||
const u32 wev = 0xA + (WL - 14);
|
||||
|
||||
const double freq_mhz = C.eristaEmcMaxClock / 1000.0;
|
||||
|
||||
const u32 quse_width = CEIL(((3.7165006256863955 - freq_mhz) + (-0.002446584377651142 * freq_mhz)) - FLOOR(freq_mhz / -0.9952024303111688));
|
||||
const u32 quse = CEIL(MIN(RL_DBI + (2.991255208275918 - (quse_width + (-0.00511180626826906 * freq_mhz))), freq_mhz * 0.021333773138874437));
|
||||
const u32 ibdly = 0x10000000 + FLOOR(MAX(RL_DBI - 1.9999956603408224, quse - 5.9999987787411175) + (-0.0011929079761504341 * freq_mhz));
|
||||
const u32 obdlyHigh = 3 / FLOOR(MIN(static_cast<double>(2), tCK_avg * (WL - 7)));
|
||||
const u32 obdlyLow = WL - MIN(static_cast<double>(WL), 12 - (CEIL(-0.0003991 * freq_mhz) * 2));
|
||||
const u32 obdly = PACK_U32_NIBBLE_HIGH_BYTE_LOW(obdlyHigh, obdlyLow);
|
||||
const u32 tCKE = CEIL(1.0795 * CEIL(0.0074472 * (C.eristaEmcMaxClock / 1000.0)));
|
||||
|
||||
const double tMMRI = tRCD + (tCK_avg * 3);
|
||||
const double pdex2mrr = tMMRI + 10;
|
||||
const u32 tWTPDEN = tW2P + 1 + CEIL(tDQSS_max / tCK_avg) + CEIL(tDQS2DQ_max / tCK_avg) + 6;
|
||||
const u32 tR2W = CEIL(RL_DBI + (tDQSCK_max / tCK_avg) + (BL / 2) - WL + tWPRE + FLOOR(tRPST) + 9.0) - (C.t6_tRTW * 3);
|
||||
|
||||
const double pdex_local = (0.011 * freq_mhz) - 1.443;
|
||||
const u32 pdex2rw = static_cast<u32>(ROUND(pdex_local)) < 22 ? 22 : (static_cast<u32>(ROUND(pdex_local)) > 33 ? 33 : static_cast<u32>(ROUND(pdex_local)));
|
||||
|
||||
const double cke2pden = (static_cast<double>((C.eristaEmcMaxClock / 1000.0) * 0.00875) - 0.65);
|
||||
}
|
||||
|
||||
namespace pcv::mariko {
|
||||
@@ -90,6 +132,7 @@ namespace ams::ldr::oc {
|
||||
const double tRRD = tRRD_values[C.t4_tRRD];
|
||||
const u32 tRFCpb = tRFC_values[C.t5_tRFC];
|
||||
const u32 tWTR = 10 - tWTR_values[C.t7_tWTR];
|
||||
const s32 finetWTR = C.fineTune_t7_tWTR;
|
||||
|
||||
const u32 tRC = tRAS + tRPpb;
|
||||
const u32 tRFCab = tRFCpb * 2;
|
||||
@@ -97,43 +140,41 @@ namespace ams::ldr::oc {
|
||||
const u32 tFAW = static_cast<u32>(tRRD * 4.0);
|
||||
const double tRPab = tRPpb + 3;
|
||||
|
||||
const u32 tR2P = 12 + ((RL_DBI - 32) / 2);
|
||||
inline u32 tR2W;
|
||||
const u32 tRTM = RL + 9 + (tDQSCK_max / tCK_avg) + FLOOR(tRPST) + CEIL(10 / tCK_avg); // Fix?
|
||||
const u32 tRATM = tRTM + CEIL(10 / tCK_avg) - 12; // Fix?
|
||||
const u32 tR2P = CEIL((RL_DBI * 0.426) - 2.0);
|
||||
const u32 tR2W = FLOOR(FLOOR((5.0 / tCK_avg) + ((FLOOR(48.0 / WL) - 0.478) * 3.0)) / 1.501) + RL_DBI - (C.t6_tRTW * 3);
|
||||
const u32 tRTM = FLOOR((10.0 + RL_DBI) + (3.502 / tCK_avg)) + FLOOR(7.489 / tCK_avg);
|
||||
const u32 tRATM = CEIL((tRTM - 10.0) + (RL_DBI * 0.426));
|
||||
inline u32 rext;
|
||||
|
||||
const u32 rdv = FLOOR(17.02046755653219 + (RL_DBI + (ramFreqMhz * 0.00510056573299173)));
|
||||
const u32 qpop = rdv - 14;
|
||||
const u32 quse_width = CEIL(((3.7165006256863955 - ramFreqMhz) + (-0.002446584377651142 * ramFreqMhz)) - FLOOR(ramFreqMhz / -0.9952024303111688));
|
||||
const u32 quse = CEIL(MIN(RL_DBI + (2.991255208275918 - (quse_width + (-0.00511180626826906 * ramFreqMhz))), ramFreqMhz * 0.021333773138874437));
|
||||
const u32 einput_duration = CEIL(quse_width + (ramFreqMhz * 0.01) + 4);
|
||||
const u32 einput = 5 + qpop - einput_duration;
|
||||
const u32 ibdly = 0x10000000 + FLOOR(MAX(RL_DBI - 1.9999956603408224, quse - 5.9999987787411175) + (-0.0011929079761504341 * ramFreqMhz));
|
||||
const u32 qrst_duration = FLOOR((ramFreqMhz * 0.001477125119082522) + 4.272302254983803);
|
||||
const u32 qrstLow = MAX(static_cast<s32>(einput - qrst_duration - 2), static_cast<s32>(0));
|
||||
const u32 qrst = PACK_U32(qrst_duration, qrstLow);
|
||||
const u32 qsafe = (einput_duration + 3) + MAX(MIN(qrstLow * rdv, qrst_duration + qrst_duration), einput);
|
||||
|
||||
const u32 tW2P = (CEIL(WL * 1.7303) * 2) - 5;
|
||||
inline u32 tWTPDEN;
|
||||
const u32 tW2R = CEIL(MAX(WL + (0.010322547033278747 * ramFreqMhz), (WL * -0.2067922202979121) + FLOOR(((RL_DBI * -0.1331159971685554) + WL) * 3.654131957826108)) - (tWTR / tCK_avg));
|
||||
const u32 tWTM = WL + (BL / 2) + 1 + CEIL(7.5 / tCK_avg);
|
||||
const u32 tWATM = tWTM + CEIL(tWR / tCK_avg);
|
||||
const u32 rdv = RL_DBI + FLOOR((5.105 / tCK_avg) + 17.017);
|
||||
const u32 qpop = rdv - 14;
|
||||
const u32 quse_width = CEIL(((4.897 / tCK_avg) - FLOOR(2.538 / tCK_avg)) + 3.782);
|
||||
const u32 quse = FLOOR(RL_DBI + ((5.082 / tCK_avg) + FLOOR(2.560 / tCK_avg))) - CEIL(4.820 / tCK_avg);
|
||||
const u32 einput_duration = FLOOR(9.936 / tCK_avg) + 5.0 + quse_width;
|
||||
const u32 einput = quse - CEIL(9.928 / tCK_avg);
|
||||
const u32 qrst_duration = FLOOR(8.399 - tCK_avg);
|
||||
const u32 qrstLow = MAX(static_cast<s32>(einput - qrst_duration - 2), static_cast<s32>(0));
|
||||
const u32 qrst = PACK_U32(qrst_duration, qrstLow);
|
||||
const u32 ibdly = PACK_U32_NIBBLE_HIGH_BYTE_LOW(1, quse - qrst_duration - 2.0);
|
||||
const u32 qsafe = (einput_duration + 3) + MAX(MIN(qrstLow * rdv, qrst_duration + qrst_duration), einput);
|
||||
const u32 tW2P = (CEIL(WL * 1.7303) * 2) - 5;
|
||||
const u32 tWTPDEN = CEIL(((1.803 / tCK_avg) + MAX(RL_DBI + (2.694 / tCK_avg), static_cast<double>(tW2P))) + (BL / 2));
|
||||
const u32 tW2R = FLOOR(MAX((5.020 / tCK_avg) + 1.130, WL - MAX(-CEIL(0.258 * (WL - RL_DBI)), 1.964)) * 1.964) + WL - CEIL(tWTR / tCK_avg) + finetWTR;
|
||||
const u32 tWTM = CEIL(WL + ((7.570 / tCK_avg) + 8.753));
|
||||
const u32 tWATM = (tWTM + (FLOOR(WL / 0.816) * 2.0)) - 4.0;
|
||||
|
||||
const u32 wdv = WL;
|
||||
const u32 wsv = WL - 2;
|
||||
const u32 wev = 0xA + (WL - 14);
|
||||
|
||||
const u32 obdlyHigh = 3 / FLOOR(MIN(static_cast<double>(2), tCK_avg * (WL - 7)));
|
||||
const u32 obdlyLow = WL - MIN(static_cast<double>(WL), 12 - (CEIL(-0.0003991 * ramFreqMhz) * 2));
|
||||
const u32 obdlyLow = MAX(WL - FLOOR((126.0 / CEIL(tCK_avg + 8.601))), 0.0);
|
||||
|
||||
const u32 obdly = PACK_U32_NIBBLE_HIGH_BYTE_LOW(obdlyHigh, obdlyLow);
|
||||
|
||||
inline u32 pdex2rw;
|
||||
inline u32 cke2pden;
|
||||
const u32 pdex2rw = CEIL((CEIL(12.335 - tCK_avg) + (7.430 / tCK_avg) - CEIL(tCK_avg * 11.361)));
|
||||
|
||||
const u32 tCKE = CEIL(1.0795 * CEIL(0.0074472 * ramFreqMhz));
|
||||
const u32 tCLKSTOP = FLOOR(MIN(8.488 / tCK_avg, 23.0)) + 8.0;
|
||||
|
||||
const double tMMRI = tRCD + (tCK_avg * 3);
|
||||
const double pdex2mrr = tMMRI + 10; /* Do this properly? */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -52,7 +52,7 @@ namespace ams::ldr {
|
||||
R_DEFINE_ERROR_RESULT(SafetyCheckFailure, 1015);
|
||||
}
|
||||
|
||||
namespace ams::ldr::oc {
|
||||
namespace ams::ldr::hoc {
|
||||
template<typename Pointer>
|
||||
struct PatcherEntry {
|
||||
using patternFn = bool(*)(Pointer* ptr);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -65,7 +65,7 @@ void saveExec(const char* file_loc, const void* buf, size_t size) {
|
||||
}
|
||||
|
||||
Result Test_PcvDvfsTable() {
|
||||
using namespace ams::ldr::oc::pcv;
|
||||
using namespace ams::ldr::hoc::pcv;
|
||||
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&mariko::CpuCvbTableDefault)) == 18);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&erista::CpuCvbTableDefault)) == 16);
|
||||
@@ -76,19 +76,19 @@ Result Test_PcvDvfsTable() {
|
||||
cvb_entry_t last_mariko_cpu_cvb_entry_default = { 1963500, { 1675751, -38635, 27 }, { 1120000 } };
|
||||
assert(memcmp(GetDvfsTableLastEntry((cvb_entry_t *)(&mariko::CpuCvbTableDefault)), (void *)&last_mariko_cpu_cvb_entry_default, sizeof(last_mariko_cpu_cvb_entry_default)) == 0);
|
||||
assert(GetDvfsTableLastEntry((cvb_entry_t *)(&erista::GpuCvbTableDefault))->freq == 921600);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.marikoCpuDvfsTableSLT)) == 25);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.marikoCpuDvfsTableSLT)) == 25);
|
||||
|
||||
// Customized table default
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.eristaCpuDvfsTable)) == 19);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.marikoCpuDvfsTable)) == 21);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.marikoCpuDvfsTableSLT)) == 22);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.eristaCpuDvfsTable)) == 19);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.marikoCpuDvfsTable)) == 21);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.marikoCpuDvfsTableSLT)) == 22);
|
||||
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.eristaGpuDvfsTable)) == 12);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.marikoGpuDvfsTable)) == 17);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.marikoGpuDvfsTableSLT)) == 17);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::oc::C.marikoGpuDvfsTableHiOPT)) == 17);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.eristaGpuDvfsTable)) == 12);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.marikoGpuDvfsTable)) == 17);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.marikoGpuDvfsTableSLT)) == 17);
|
||||
assert(GetDvfsTableEntryCount((cvb_entry_t *)(&ams::ldr::hoc::C.marikoGpuDvfsTableHiOPT)) == 17);
|
||||
|
||||
constexpr size_t limit = ams::ldr::oc::pcv::DvfsTableEntryLimit;
|
||||
constexpr size_t limit = ams::ldr::hoc::pcv::DvfsTableEntryLimit;
|
||||
cvb_entry_t customized_table[limit] = {};
|
||||
for (size_t i = 0; i < limit; i++) {
|
||||
assert(GetDvfsTableEntryCount(customized_table) == i);
|
||||
@@ -156,14 +156,14 @@ int main(int argc, char** argv) {
|
||||
size_t exec_path_patched_len = exec_path_len + std::max(strlen(mariko_ext), strlen(erista_ext)) + 1;
|
||||
|
||||
if (exe_opt == EXE_PCV) {
|
||||
ams::ldr::oc::pcv::SafetyCheck();
|
||||
ams::ldr::hoc::pcv::SafetyCheck();
|
||||
|
||||
{
|
||||
void* erista_buf = malloc(file_size);
|
||||
std::memcpy(erista_buf, file_buffer, file_size);
|
||||
|
||||
printf("Patching %s for Erista...\n", pcv_opt);
|
||||
ams::ldr::oc::pcv::erista::Patch(reinterpret_cast<uintptr_t>(erista_buf), file_size);
|
||||
ams::ldr::hoc::pcv::erista::Patch(reinterpret_cast<uintptr_t>(erista_buf), file_size);
|
||||
if (save_patched) {
|
||||
char* exec_path_erista = reinterpret_cast<char *>(malloc(exec_path_patched_len));
|
||||
strncpy(exec_path_erista, exec_path, exec_path_patched_len);
|
||||
@@ -179,7 +179,7 @@ int main(int argc, char** argv) {
|
||||
std::memcpy(mariko_buf, file_buffer, file_size);
|
||||
|
||||
printf("Patching %s for Mariko...\n", pcv_opt);
|
||||
ams::ldr::oc::pcv::mariko::Patch(reinterpret_cast<uintptr_t>(mariko_buf), file_size);
|
||||
ams::ldr::hoc::pcv::mariko::Patch(reinterpret_cast<uintptr_t>(mariko_buf), file_size);
|
||||
if (save_patched) {
|
||||
char* exec_path_mariko = reinterpret_cast<char *>(malloc(exec_path_patched_len));
|
||||
strncpy(exec_path_mariko, exec_path, exec_path_patched_len);
|
||||
@@ -196,7 +196,7 @@ int main(int argc, char** argv) {
|
||||
std::memcpy(mariko_buf, file_buffer, file_size);
|
||||
|
||||
printf("Patching %s (Mariko Only)...\n", ptm_opt);
|
||||
ams::ldr::oc::ptm::Patch(reinterpret_cast<uintptr_t>(mariko_buf), file_size);
|
||||
ams::ldr::hoc::ptm::Patch(reinterpret_cast<uintptr_t>(mariko_buf), file_size);
|
||||
if (save_patched) {
|
||||
char* exec_path_mariko = reinterpret_cast<char *>(malloc(exec_path_patched_len));
|
||||
strncpy(exec_path_mariko, exec_path, exec_path_patched_len);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2023 hanai3Bi
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "pcv.hpp"
|
||||
|
||||
namespace ams::ldr::oc::pcv {
|
||||
namespace ams::ldr::hoc::pcv {
|
||||
|
||||
Result MemFreqPllmLimit(u32* ptr) {
|
||||
clk_pll_param* entry = reinterpret_cast<clk_pll_param *>(ptr);
|
||||
@@ -115,7 +115,6 @@ void SafetyCheck() {
|
||||
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTableSLT)->freq);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTableHiOPT)->freq);
|
||||
break;
|
||||
default:
|
||||
@@ -132,7 +131,6 @@ void SafetyCheck() {
|
||||
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTableSLT)->freq);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq);
|
||||
break;
|
||||
default:
|
||||
@@ -143,12 +141,12 @@ void SafetyCheck() {
|
||||
sValidator validators[] = {
|
||||
{ C.eristaCpuBoostClock, 1020'000, 2295'000, true },
|
||||
{ C.marikoCpuBoostClock, 1020'000, 2703'000, true },
|
||||
{ C.commonEmcMemVolt, 1100'000, 1350'000 }, // Official burst vmax for the RAMs is 1500mV
|
||||
{ C.eristaCpuMaxVolt, 1100, 1257 },
|
||||
{ C.eristaEmcMaxClock, 1600'000, 2600'200 },
|
||||
{ C.marikoCpuMaxVolt, 1100, 1235 },
|
||||
{ C.commonEmcMemVolt, 912'500, 1350'000 }, // Official burst vmax for the RAMs is 1500mV
|
||||
{ C.eristaCpuMaxVolt, 1000, 1257 },
|
||||
{ C.eristaEmcMaxClock, 1600'000, 2600'000 },
|
||||
{ C.marikoCpuMaxVolt, 1000, 1235 },
|
||||
{ C.marikoEmcMaxClock, 1600'000, 3500'000 },
|
||||
{ C.marikoEmcVddqVolt, 550'000, 700'000 },
|
||||
{ C.marikoEmcVddqVolt, 250'000, 700'000 },
|
||||
{ eristaCpuDvfsMaxFreq, 1785'000, 2295'000 },
|
||||
{ marikoCpuDvfsMaxFreq, 1785'000, 2703'000 },
|
||||
{ eristaGpuDvfsMaxFreq, 768'000, 1152'000 },
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2023 hanai3Bi
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "../oc_common.hpp"
|
||||
#include "pcv_common.hpp"
|
||||
|
||||
namespace ams::ldr::oc::pcv {
|
||||
namespace ams::ldr::hoc::pcv {
|
||||
|
||||
namespace mariko {
|
||||
constexpr cvb_entry_t CpuCvbTableDefault[] = {
|
||||
@@ -122,6 +122,16 @@ namespace ams::ldr::oc::pcv {
|
||||
{0xFFFFFFFF, 35},
|
||||
};
|
||||
|
||||
static const u32 ramBrackets[][22] = {
|
||||
{ 2133, 2200, 2266, 2300, 2366, 2400, 2433, 2466, 2533, 2566, 2600, 2633, 2700, 2733, 2766, 2833, 2866, 2900, 2933, 3033, 3066, 3100, },
|
||||
{ 2300, 2366, 2433, 2466, 2533, 2566, 2633, 2700, 2733, 2800, 2833, 2900, 2933, 2966, 3033, 3066, 3100, 3133, 3166, 3200, 3233, 3266, },
|
||||
{ 2433, 2466, 2533, 2600, 2666, 2733, 2766, 2800, 2833, 2866, 2933, 2966, 3033, 3066, 3100, 3133, 3166, 3200, 3233, 3300, 3333, 3366, },
|
||||
{ 2500, 2533, 2600, 2633, 2666, 2733, 2800, 2866, 2900, 2966, 3033, 3100, 3166, 3200, 3233, 3266, 3300, 3333, 3366, 3400, 3400, 3400, },
|
||||
};
|
||||
|
||||
static const u32 gpuBudgetDvfsArray[] = { 590, 600, 610, 620, 630, 640, 650, 660, 670, 680, 690, 700, 710, 720, 730, 740, 750, 760, 770, 780, 790, 800};
|
||||
|
||||
|
||||
/* GPU Max Clock asm Pattern:
|
||||
*
|
||||
* MOV W11, #0x1000 MOV (wide immediate) 0x1000 0xB (11)
|
||||
@@ -216,9 +226,8 @@ namespace ams::ldr::oc::pcv {
|
||||
constexpr u32 GpuClkPllLimit = 921'600'000;
|
||||
constexpr u32 GpuVminOfficial = 810;
|
||||
|
||||
static const u32 gpuVoltDvfsPattern[] = { 1150, 1000, 100, 1000, 10, };
|
||||
static const u32 gpuVoltDvfsOffsets[] = { 1, 2, 3, 4, 5, };
|
||||
static_assert(sizeof(gpuVoltDvfsPattern) == sizeof(gpuVoltDvfsOffsets), "Invalid gpuVoltDvfsPattern");
|
||||
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");
|
||||
@@ -309,8 +318,8 @@ namespace ams::ldr::oc::pcv {
|
||||
customize_table = const_cast<cvb_entry_t *>(C.marikoCpuDvfsTable1581Tbreak);
|
||||
break;
|
||||
}
|
||||
case HELIOS_TABLE: {
|
||||
customize_table = const_cast<cvb_entry_t *>(C.marikoCpuDvfsTableHelios);
|
||||
case EXTREME_TABLE: {
|
||||
customize_table = const_cast<cvb_entry_t *>(C.marikoCpuDvfsTableExtreme);
|
||||
break;
|
||||
}
|
||||
case DEFAULT_TABLE:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace ams::ldr::oc::pcv {
|
||||
namespace ams::ldr::hoc::pcv {
|
||||
|
||||
typedef struct cvb_coefficients {
|
||||
s32 c0 = 0;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2023 hanai3Bi
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "pcv.hpp"
|
||||
#include "../mtc_timing_value.hpp"
|
||||
|
||||
namespace ams::ldr::oc::pcv::erista {
|
||||
namespace ams::ldr::hoc::pcv::erista {
|
||||
|
||||
Result CpuVoltDvfs(u32 *ptr) {
|
||||
if (MatchesPattern(ptr, cpuVoltDvfsPattern, cpuVoltDvfsOffsets)) {
|
||||
@@ -66,10 +66,10 @@ namespace ams::ldr::oc::pcv::erista {
|
||||
|
||||
Result CpuVoltDfll(u32* ptr) {
|
||||
cvb_cpu_dfll_data *entry = reinterpret_cast<cvb_cpu_dfll_data *>(ptr);
|
||||
R_UNLESS(entry->tune0_low == 0x0000FFCF, ldr::ResultInvalidCpuVoltDfllEntry());
|
||||
R_UNLESS(entry->tune0_high == 0x00000000, ldr::ResultInvalidCpuVoltDfllEntry());
|
||||
R_UNLESS(entry->tune1_low == 0x012207FF, ldr::ResultInvalidCpuVoltDfllEntry());
|
||||
R_UNLESS(entry->tune1_high == 0x03FFF7FF, ldr::ResultInvalidCpuVoltDfllEntry());
|
||||
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();
|
||||
@@ -103,14 +103,15 @@ namespace ams::ldr::oc::pcv::erista {
|
||||
}
|
||||
|
||||
Result GpuVoltDVFS(u32 *ptr) {
|
||||
if (MatchesPattern(ptr, gpuVoltDvfsPattern, gpuVoltDvfsOffsets)) {
|
||||
if (C.eristaGpuVmin) {
|
||||
PATCH_OFFSET(ptr, C.eristaGpuVmin);
|
||||
}
|
||||
R_SUCCEED();
|
||||
}
|
||||
u32 result = std::memcmp(ptr, gpuVoltDvfsPattern, sizeof(gpuVoltDvfsPattern));
|
||||
|
||||
R_THROW(ldr::ResultInvalidGpuDvfs());
|
||||
if (result)
|
||||
R_THROW(ldr::ResultInvalidGpuDvfs());
|
||||
|
||||
if (C.eristaGpuVmin)
|
||||
PATCH_OFFSET(ptr, C.eristaGpuVmin);
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result GpuVoltThermals(u32 *ptr) {
|
||||
@@ -492,206 +493,154 @@ namespace ams::ldr::oc::pcv::erista {
|
||||
|
||||
/* These timings are slightly off from eos, I am not sure why but I am going to figure it out at some point. */
|
||||
void MemMtcTableAutoAdjust(EristaMtcTable *table) {
|
||||
(void) table;
|
||||
|
||||
// using namespace pcv::erista;
|
||||
//
|
||||
/* #define WRITE_PARAM_ALL_REG(TABLE, PARAM, VALUE) // note: add backslashes to make the macro definition work
|
||||
TABLE->burst_regs.PARAM = VALUE; \
|
||||
TABLE->shadow_regs_ca_train.PARAM = VALUE; \
|
||||
TABLE->shadow_regs_quse_train.PARAM = VALUE; \
|
||||
#define WRITE_PARAM_ALL_REG(TABLE, PARAM, VALUE) \
|
||||
TABLE->burst_regs.PARAM = VALUE; \
|
||||
TABLE->shadow_regs_ca_train.PARAM = VALUE; \
|
||||
TABLE->shadow_regs_rdwr_train.PARAM = VALUE;
|
||||
*/
|
||||
// #define GET_CYCLE(PARAM) ((u32)((double)(PARAM) / (1000000.0 / 1600000.0)))
|
||||
//
|
||||
// /* This condition is insane but it's done in eos. */
|
||||
// /* Need to clean up at some point. */
|
||||
// u32 rext;
|
||||
// u32 wext;
|
||||
// if (C.eristaEmcMaxClock < 3200001) {
|
||||
// if (C.eristaEmcMaxClock < 2133001) {
|
||||
// rext = 26;
|
||||
// wext = 22;
|
||||
// } else {
|
||||
// rext = 28;
|
||||
// wext = 22;
|
||||
//
|
||||
// if (2400000 < C.eristaEmcMaxClock) {
|
||||
// wext = 25;
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// rext = 30;
|
||||
// wext = 25;
|
||||
// }
|
||||
//
|
||||
// u32 refresh_raw = 0xFFFF;
|
||||
// u32 trefbw = 0;
|
||||
//
|
||||
// if (C.t8_tREFI != 6) {
|
||||
// refresh_raw = static_cast<u32>(std::floor(static_cast<double>(tREFpb_values[C.t8_tREFI]) / tCK_avg)) - 0x40;
|
||||
// refresh_raw = MIN(refresh_raw, static_cast<u32>(0xFFFF));
|
||||
// }
|
||||
//
|
||||
// trefbw = refresh_raw + 0x40;
|
||||
// trefbw = MIN(trefbw, static_cast<u32>(0x3FFF));
|
||||
//
|
||||
// /* Primary timings. */
|
||||
// WRITE_PARAM_ALL_REG(table, emc_rd_rcd, GET_CYCLE(tRCD));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_wr_rcd, GET_CYCLE(tRCD));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_ras, GET_CYCLE(tRAS));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_rp, GET_CYCLE(tRPpb));
|
||||
//
|
||||
// /* Secondary timings. */
|
||||
// WRITE_PARAM_ALL_REG(table, emc_rrd, GET_CYCLE(tRRD));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_rfc, GET_CYCLE(tRFCab));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_rfcpb, GET_CYCLE(tRFCpb));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_r2w, tR2W);
|
||||
// WRITE_PARAM_ALL_REG(table, emc_w2r, tW2R);
|
||||
// WRITE_PARAM_ALL_REG(table, emc_r2p, (u32) 0xC);
|
||||
// WRITE_PARAM_ALL_REG(table, emc_w2p, (u32) 0x2D);
|
||||
//
|
||||
// WRITE_PARAM_ALL_REG(table, emc_rext, rext);
|
||||
// WRITE_PARAM_ALL_REG(table, emc_wext, wext);
|
||||
//
|
||||
// WRITE_PARAM_ALL_REG(table, emc_trpab, GET_CYCLE(tRPab));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_tfaw, GET_CYCLE(tFAW));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_rc, GET_CYCLE(tRC));
|
||||
//
|
||||
// WRITE_PARAM_ALL_REG(table, emc_tckesr, GET_CYCLE(tSR));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_tcke, GET_CYCLE(tXP) + 1);
|
||||
// WRITE_PARAM_ALL_REG(table, emc_tpd, GET_CYCLE(tXP));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_tclkstop, GET_CYCLE(tXP) + 8);
|
||||
//
|
||||
// WRITE_PARAM_ALL_REG(table, emc_txsr, MIN(GET_CYCLE(tXSR), (u32) 1022));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_txsrdll, MIN(GET_CYCLE(tXSR), (u32) 1022));
|
||||
//
|
||||
// const u32 dyn_self_ref_control = (((u32)(7605.0 / tCK_avg)) + 260U) | (table->burst_regs.emc_dyn_self_ref_control & 0xffff0000U);
|
||||
// WRITE_PARAM_ALL_REG(table, emc_dyn_self_ref_control, dyn_self_ref_control);
|
||||
//
|
||||
// WRITE_PARAM_ALL_REG(table, emc_rw2pden, tRW2PDEN);
|
||||
// WRITE_PARAM_ALL_REG(table, emc_pdex2wr, GET_CYCLE(10.0));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_pdex2rd, GET_CYCLE(10.0));
|
||||
//
|
||||
// WRITE_PARAM_ALL_REG(table, emc_pchg2pden, GET_CYCLE(1.75));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_ar2pden, GET_CYCLE(1.75));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_pdex2cke, GET_CYCLE(1.75));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_act2pden, GET_CYCLE(14.0));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_cke2pden, GET_CYCLE(5.0));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_pdex2mrr, GET_CYCLE(pdex2mrr));
|
||||
//
|
||||
// WRITE_PARAM_ALL_REG(table, emc_refresh, refresh_raw);
|
||||
// WRITE_PARAM_ALL_REG(table, emc_pre_refresh_req_cnt, (u32) (refresh_raw / 4));
|
||||
// WRITE_PARAM_ALL_REG(table, emc_trefbw, trefbw);
|
||||
//
|
||||
// const u32 mc_tRCD = (int)((double)(GET_CYCLE(tRCD) >> 2) - 2.0);
|
||||
// const u32 mc_tRPpb = (int)(((double)(GET_CYCLE(tRPpb) >> 2) - 1.0) + 2.0);
|
||||
// const u32 mc_tRC = (uint)((double)(GET_CYCLE(tRC) >> 2) - 1.0);
|
||||
// const u32 mc_tR2W = (uint)(((double)((uint)tR2W >> 2) - 1.0) + 2.0);
|
||||
// const u32 mc_tW2R = (uint)(((double)(tW2R >> 2) - 1.0) + 2.0);
|
||||
// const u32 mc_tRAS = MIN(GET_CYCLE(tRAS), (u32) 0x7F);
|
||||
// const u32 mc_tRRD = MIN(GET_CYCLE(tRRD), (u32) 31);
|
||||
//
|
||||
// table->burst_mc_regs.mc_emem_arb_cfg = (int)(((double) C.eristaEmcMaxClock / 33300.0) * 0.25);
|
||||
// table->burst_mc_regs.mc_emem_arb_timing_ras = (int) ((double) (mc_tRAS >> 2) - 2.0);
|
||||
// table->burst_mc_regs.mc_emem_arb_timing_rcd = (int) ((double) (GET_CYCLE(tRCD) >> 2) - 2.0);
|
||||
// table->burst_mc_regs.mc_emem_arb_timing_rp = (int) (((double) (GET_CYCLE(tRPpb) >> 2) - 1.0) + 2.0);
|
||||
// table->burst_mc_regs.mc_emem_arb_timing_rc = (int) ((double) (GET_CYCLE(tRC) >> 2) - 1.0);
|
||||
// table->burst_mc_regs.mc_emem_arb_timing_faw = (int) ((double)(GET_CYCLE(tFAW) >> 2) - 1.0);
|
||||
// table->burst_mc_regs.mc_emem_arb_timing_rrd = (int)((double)(mc_tRRD >> 2) - 1.0);
|
||||
// table->burst_mc_regs.mc_emem_arb_timing_rap2pre = 3;
|
||||
// table->burst_mc_regs.mc_emem_arb_timing_wap2pre = 11;
|
||||
// table->burst_mc_regs.mc_emem_arb_timing_r2w = (uint)(((double)((uint)tR2W >> 2) - 1.0) + 2.0);
|
||||
// table->burst_mc_regs.mc_emem_arb_timing_w2r = (uint)(((double)(tW2R >> 2) - 1.0) + 2.0);
|
||||
//
|
||||
// u32 mc_r2r = table->burst_mc_regs.mc_emem_arb_timing_r2r;
|
||||
// if (mc_r2r > 1) {
|
||||
// mc_r2r = (uint)(((double)(long)((double)rext * 0.25) - 1.0) + 2.0);
|
||||
// table->burst_mc_regs.mc_emem_arb_timing_r2r = mc_r2r;
|
||||
// }
|
||||
//
|
||||
// u32 mc_w2w = table->burst_mc_regs.mc_emem_arb_timing_w2w;
|
||||
// if (mc_w2w > 1) {
|
||||
// mc_w2w = (uint)(((double)(long)((double)wext / 4.0) - 1.0) + 2.0);
|
||||
// table->burst_mc_regs.mc_emem_arb_timing_w2w = mc_w2w;
|
||||
// }
|
||||
//
|
||||
// table->burst_mc_regs.mc_emem_arb_da_turns = ((mc_tW2R >> 1) << 0x18) | ((mc_tR2W >> 1) << 0x10) | ((mc_r2r >> 1) << 8) | ((mc_w2w >> 1));
|
||||
// table->burst_mc_regs.mc_emem_arb_da_covers = (((uint)(mc_tRCD + 3 + mc_tRPpb) >> 1 & 0xff) << 8) | (((uint)(mc_tRCD + 11 + mc_tRPpb) >> 1 & 0xff) << 0x10) | ((mc_tRC >> 1) & 0xff);
|
||||
// table->burst_mc_regs.mc_emem_arb_misc0 = (table->burst_mc_regs.mc_emem_arb_misc0 & 0xffe08000U) | ((mc_tRC + 1) & 0xff);
|
||||
// table->la_scale_regs.mc_mll_mpcorer_ptsa_rate = MIN((u32)((C.eristaEmcMaxClock / 1600000) * 0xd0U), (u32)0x115);
|
||||
// table->la_scale_regs.mc_ftop_ptsa_rate = MIN((u32)((C.eristaEmcMaxClock / 1600000) * 0x18U), (u32)0x1f);
|
||||
// table->la_scale_regs.mc_ptsa_grant_decrement = MIN((u32)((C.eristaEmcMaxClock / 1600000) * 0x1203U), (u32)0x17ff);
|
||||
//
|
||||
// u32 mc_latency_allowance = 0;
|
||||
// if (C.eristaEmcMaxClock / 1000 != 0) {
|
||||
// mc_latency_allowance = 204800 / (C.eristaEmcMaxClock / 1000);
|
||||
// }
|
||||
//
|
||||
// const u32 mc_latency_allowance2 = mc_latency_allowance & 0xFF;
|
||||
// const u32 mc_latency_allowance3 = (mc_latency_allowance & 0xFF) << 0x10;
|
||||
// table->la_scale_regs.mc_latency_allowance_xusb_0 = (table->la_scale_regs.mc_latency_allowance_xusb_0 & 0xff00ffffU) | mc_latency_allowance3;
|
||||
// table->la_scale_regs.mc_latency_allowance_sdmmc_0 = (table->la_scale_regs.mc_latency_allowance_sdmmc_0 & 0xff00ffffU) | mc_latency_allowance3;
|
||||
// table->la_scale_regs.mc_latency_allowance_xusb_1 = (table->la_scale_regs.mc_latency_allowance_xusb_1 & 0xff00ffffU) | mc_latency_allowance3;
|
||||
// table->la_scale_regs.mc_latency_allowance_tsec_0 = (table->la_scale_regs.mc_latency_allowance_tsec_0 & 0xff00ffffU) | mc_latency_allowance3;
|
||||
// table->la_scale_regs.mc_latency_allowance_sdmmca_0 = (table->la_scale_regs.mc_latency_allowance_sdmmca_0 & 0xff00ffffU) | mc_latency_allowance3;
|
||||
// table->la_scale_regs.mc_latency_allowance_sdmmcaa_0 = (table->la_scale_regs.mc_latency_allowance_sdmmcaa_0 & 0xff00ffffU) | mc_latency_allowance3;
|
||||
// table->la_scale_regs.mc_latency_allowance_sdmmcab_0 = (table->la_scale_regs.mc_latency_allowance_sdmmcab_0 & 0xff00ffffU) | mc_latency_allowance3;
|
||||
// table->la_scale_regs.mc_latency_allowance_ppcs_1 = (table->la_scale_regs.mc_latency_allowance_ppcs_1 & 0xff00ffffU) | mc_latency_allowance3;
|
||||
// table->la_scale_regs.mc_latency_allowance_mpcore_0 = (table->la_scale_regs.mc_latency_allowance_mpcore_0 & 0xff00ffffU) | mc_latency_allowance3;
|
||||
// table->la_scale_regs.mc_latency_allowance_avpc_0 = (table->la_scale_regs.mc_latency_allowance_avpc_0 & 0xff00ffffU) | mc_latency_allowance3;
|
||||
//
|
||||
// u32 mc_latency_allowance_hc_0 = 0;
|
||||
// if (C.eristaEmcMaxClock / 1000 != 0) {
|
||||
// mc_latency_allowance_hc_0 = 35200 / (C.eristaEmcMaxClock / 1000);
|
||||
// }
|
||||
//
|
||||
// table->la_scale_regs.mc_latency_allowance_nvdec_0 = (table->la_scale_regs.mc_latency_allowance_nvdec_0 & 0xff00ffffU) | mc_latency_allowance3;
|
||||
// table->la_scale_regs.mc_latency_allowance_hc_0 = (table->la_scale_regs.mc_latency_allowance_hc_0 & 0xffffff00U) | mc_latency_allowance_hc_0;
|
||||
//
|
||||
// table->la_scale_regs.mc_latency_allowance_isp2_1 = (table->la_scale_regs.mc_latency_allowance_isp2_1 & 0xff00ff00U) | mc_latency_allowance3 | mc_latency_allowance2;
|
||||
// table->la_scale_regs.mc_latency_allowance_hc_1 = (table->la_scale_regs.mc_latency_allowance_hc_1 & 0xffffff00U) | mc_latency_allowance2;
|
||||
//
|
||||
// u32 mc_latency_allowance_gpu_0 = 0;
|
||||
// if (C.eristaEmcMaxClock / 1000 != 0) {
|
||||
// mc_latency_allowance_gpu_0 = 40000 / (C.eristaEmcMaxClock / 1000);
|
||||
// }
|
||||
//
|
||||
// table->la_scale_regs.mc_latency_allowance_gpu_0 = ((mc_latency_allowance_gpu_0 | table->la_scale_regs.mc_latency_allowance_gpu_0) & 0xff00ff00U) | mc_latency_allowance3;
|
||||
//
|
||||
// u32 mc_latency_allowance_gpu2_0 = 0;
|
||||
// if (C.eristaEmcMaxClock / 1000 != 0) {
|
||||
// mc_latency_allowance_gpu2_0 = 40000 / (C.eristaEmcMaxClock / 1000);
|
||||
// }
|
||||
//
|
||||
// table->la_scale_regs.mc_latency_allowance_gpu2_0 = ((mc_latency_allowance_gpu2_0 | table->la_scale_regs.mc_latency_allowance_gpu2_0) & 0xff00ff00U) | mc_latency_allowance3;
|
||||
//
|
||||
// u32 mc_latency_allowance_nvenc_0 = 0;
|
||||
// if (C.eristaEmcMaxClock / 1000 != 0) {
|
||||
// mc_latency_allowance_nvenc_0 = 38400 / (C.eristaEmcMaxClock / 1000);
|
||||
// }
|
||||
//
|
||||
// table->la_scale_regs.mc_latency_allowance_nvenc_0 = ((mc_latency_allowance_nvenc_0 | table->la_scale_regs.mc_latency_allowance_nvenc_0) & 0xff00ff00U) | mc_latency_allowance3;
|
||||
//
|
||||
// u32 mc_latency_allowance_vic_0 = 0;
|
||||
// if (C.eristaEmcMaxClock / 1000 != 0) {
|
||||
// mc_latency_allowance_vic_0 = 0xb540 / (C.eristaEmcMaxClock / 1000);
|
||||
// }
|
||||
//
|
||||
// table->la_scale_regs.mc_latency_allowance_vic_0 = ((mc_latency_allowance_vic_0 | table->la_scale_regs.mc_latency_allowance_vic_0) & 0xff00ff00U) | mc_latency_allowance3;
|
||||
// table->la_scale_regs.mc_latency_allowance_vi2_0 = (table->la_scale_regs.mc_latency_allowance_vi2_0 & 0xffffff00U) | mc_latency_allowance2;
|
||||
//
|
||||
// table->burst_mc_regs.mc_emem_arb_timing_rfcpb = GET_CYCLE(tRFCpb) >> 2;
|
||||
//
|
||||
// if (C.hpMode) {
|
||||
// WRITE_PARAM_ALL_REG(table, emc_cfg, 0x13200000);
|
||||
// }
|
||||
//
|
||||
// table->dram_timings.t_rp = tRFCpb;
|
||||
// table->dram_timings.t_rfc = tRFCab;
|
||||
// table->emc_cfg_2 = 0x11083d;
|
||||
// #undef GET_CYCLE
|
||||
}
|
||||
|
||||
#define GET_CYCLE_CEIL(PARAM) u32(CEIL(double(PARAM) / tCK_avg))
|
||||
/* Ram power down */
|
||||
/* B31: DRAM_CLKSTOP_PD */
|
||||
/* B30: DRAM_CLKSTOP_SR */
|
||||
/* B29: DRAM_ACPD */
|
||||
if (C.hpMode) {
|
||||
WRITE_PARAM_ALL_REG(table, emc_cfg, 0x13200000);
|
||||
} else {
|
||||
WRITE_PARAM_ALL_REG(table, emc_cfg, 0xF3200000);
|
||||
}
|
||||
|
||||
u32 refresh_raw = 0xFFFF;
|
||||
if (C.t8_tREFI != 6) {
|
||||
refresh_raw = CEIL(tREFpb_values[C.t8_tREFI] / tCK_avg) - 0x40;
|
||||
refresh_raw = MIN(refresh_raw, static_cast<u32>(0xFFFF));
|
||||
}
|
||||
|
||||
u32 trefbw = refresh_raw + 0x40;
|
||||
trefbw = MIN(trefbw, static_cast<u32>(0x3FFF));
|
||||
|
||||
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_rc, MIN(GET_CYCLE_CEIL(tRC), static_cast<u32>(0xB8)));
|
||||
WRITE_PARAM_ALL_REG(table, emc_ras, MIN(GET_CYCLE_CEIL(tRAS), static_cast<u32>(0x7F)));
|
||||
WRITE_PARAM_ALL_REG(table, emc_rrd, GET_CYCLE_CEIL(tRRD));
|
||||
WRITE_PARAM_ALL_REG(table, emc_rfcpb, GET_CYCLE_CEIL(tRFCpb));
|
||||
WRITE_PARAM_ALL_REG(table, emc_rfc, GET_CYCLE_CEIL(tRFCab));
|
||||
WRITE_PARAM_ALL_REG(table, emc_rp, GET_CYCLE_CEIL(tRPpb));
|
||||
WRITE_PARAM_ALL_REG(table, emc_txsr, MIN(GET_CYCLE_CEIL(tXSR), static_cast<u32>(0x3fe)));
|
||||
WRITE_PARAM_ALL_REG(table, emc_txsrdll, MIN(GET_CYCLE_CEIL(tXSR), static_cast<u32>(0x3fe)));
|
||||
WRITE_PARAM_ALL_REG(table, emc_tfaw, GET_CYCLE_CEIL(tFAW));
|
||||
WRITE_PARAM_ALL_REG(table, emc_trpab, MIN(GET_CYCLE_CEIL(tRPab), static_cast<u32>(0x3F)));
|
||||
WRITE_PARAM_ALL_REG(table, emc_tckesr, GET_CYCLE_CEIL(tSR));
|
||||
WRITE_PARAM_ALL_REG(table, emc_tcke, tCKE);
|
||||
WRITE_PARAM_ALL_REG(table, emc_tpd, GET_CYCLE_CEIL(tXP));
|
||||
WRITE_PARAM_ALL_REG(table, emc_tclkstop, GET_CYCLE_CEIL(tXP) + 8);
|
||||
WRITE_PARAM_ALL_REG(table, emc_r2p, tR2P);
|
||||
WRITE_PARAM_ALL_REG(table, emc_r2w, tR2W);
|
||||
WRITE_PARAM_ALL_REG(table, emc_w2p, tW2P);
|
||||
WRITE_PARAM_ALL_REG(table, emc_w2r, tW2R);
|
||||
WRITE_PARAM_ALL_REG(table, emc_rext, C.eristaEmcMaxClock < 2133001 ? 26 : 28); // rext shouldn't be causing issues?
|
||||
WRITE_PARAM_ALL_REG(table, emc_wext, (C.eristaEmcMaxClock >= 2533000) ? 0x19 : 0x16);
|
||||
WRITE_PARAM_ALL_REG(table, emc_refresh, refresh_raw);
|
||||
WRITE_PARAM_ALL_REG(table, emc_pre_refresh_req_cnt, refresh_raw / 4);
|
||||
WRITE_PARAM_ALL_REG(table, emc_trefbw, trefbw);
|
||||
const u32 dyn_self_ref_control = (static_cast<u32>(7605.0 / tCK_avg) + 260) | (table->burst_regs.emc_dyn_self_ref_control & 0xffff0000);
|
||||
WRITE_PARAM_ALL_REG(table, emc_dyn_self_ref_control, dyn_self_ref_control);
|
||||
WRITE_PARAM_ALL_REG(table, emc_pdex2wr, pdex2rw);
|
||||
WRITE_PARAM_ALL_REG(table, emc_pdex2rd, pdex2rw);
|
||||
WRITE_PARAM_ALL_REG(table, emc_pchg2pden, 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_act2pden, GET_CYCLE_CEIL(14.0));
|
||||
WRITE_PARAM_ALL_REG(table, emc_cke2pden, /* cke2pden */ GET_CYCLE_CEIL(8.5));
|
||||
(void) cke2pden;
|
||||
WRITE_PARAM_ALL_REG(table, emc_pdex2mrr, GET_CYCLE_CEIL(pdex2mrr));
|
||||
WRITE_PARAM_ALL_REG(table, emc_rw2pden, tWTPDEN);
|
||||
|
||||
/* This needs some clean up. */
|
||||
constexpr double MC_ARB_DIV = 4.0;
|
||||
constexpr u32 MC_ARB_SFA = 2;
|
||||
|
||||
table->burst_mc_regs.mc_emem_arb_cfg = C.eristaEmcMaxClock / (33.3 * 1000) / MC_ARB_DIV;
|
||||
table->burst_mc_regs.mc_emem_arb_timing_rcd = CEIL(GET_CYCLE_CEIL(tRCD) / MC_ARB_DIV) - 2;
|
||||
table->burst_mc_regs.mc_emem_arb_timing_rp = CEIL(GET_CYCLE_CEIL(tRPpb) / MC_ARB_DIV) - 1;
|
||||
table->burst_mc_regs.mc_emem_arb_timing_rc = CEIL(GET_CYCLE_CEIL(tRC) / MC_ARB_DIV) - 1;
|
||||
table->burst_mc_regs.mc_emem_arb_timing_ras = CEIL(GET_CYCLE_CEIL(tRAS) / MC_ARB_DIV) - 2;
|
||||
table->burst_mc_regs.mc_emem_arb_timing_faw = CEIL(GET_CYCLE_CEIL(tFAW) / MC_ARB_DIV) - 1;
|
||||
table->burst_mc_regs.mc_emem_arb_timing_rrd = CEIL(GET_CYCLE_CEIL(tRRD) / MC_ARB_DIV) - 1;
|
||||
table->burst_mc_regs.mc_emem_arb_timing_rfcpb = CEIL(GET_CYCLE_CEIL(tRFCpb) / MC_ARB_DIV) - 1;
|
||||
table->burst_mc_regs.mc_emem_arb_timing_rap2pre = CEIL(tR2P / MC_ARB_DIV);
|
||||
table->burst_mc_regs.mc_emem_arb_timing_wap2pre = CEIL(tW2P / MC_ARB_DIV) + MC_ARB_SFA;
|
||||
|
||||
if (table->burst_mc_regs.mc_emem_arb_timing_r2r > 1) {
|
||||
table->burst_mc_regs.mc_emem_arb_timing_r2r = CEIL(table->burst_regs.emc_rext / 4) - 1 + MC_ARB_SFA;
|
||||
}
|
||||
|
||||
table->burst_mc_regs.mc_emem_arb_timing_r2w = CEIL(tR2W / MC_ARB_DIV) - 1 + MC_ARB_SFA;
|
||||
table->burst_mc_regs.mc_emem_arb_timing_w2r = CEIL(tW2R / MC_ARB_DIV) - 1 + MC_ARB_SFA;
|
||||
|
||||
u32 da_turns = 0;
|
||||
da_turns |= u8(table->burst_mc_regs.mc_emem_arb_timing_r2w / 2) << 16;
|
||||
da_turns |= u8(table->burst_mc_regs.mc_emem_arb_timing_w2r / 2) << 24;
|
||||
table->burst_mc_regs.mc_emem_arb_da_turns = da_turns;
|
||||
|
||||
u32 da_covers = 0;
|
||||
u8 r_cover = (table->burst_mc_regs.mc_emem_arb_timing_rap2pre + table->burst_mc_regs.mc_emem_arb_timing_rp + table->burst_mc_regs.mc_emem_arb_timing_rcd) / 2;
|
||||
u8 w_cover = (table->burst_mc_regs.mc_emem_arb_timing_wap2pre + table->burst_mc_regs.mc_emem_arb_timing_rp + table->burst_mc_regs.mc_emem_arb_timing_rcd) / 2;
|
||||
da_covers |= (table->burst_mc_regs.mc_emem_arb_timing_rc / 2);
|
||||
da_covers |= (r_cover << 8);
|
||||
da_covers |= (w_cover << 16);
|
||||
table->burst_mc_regs.mc_emem_arb_da_covers = da_covers;
|
||||
|
||||
table->burst_mc_regs.mc_emem_arb_misc0 = (table->burst_mc_regs.mc_emem_arb_misc0 & 0xFFE08000) | (table->burst_mc_regs.mc_emem_arb_timing_rc + 1);
|
||||
|
||||
table->la_scale_regs.mc_mll_mpcorer_ptsa_rate = 0x115;
|
||||
|
||||
if (C.eristaEmcMaxClock >= 2133000) {
|
||||
table->la_scale_regs.mc_ftop_ptsa_rate = 0x1F;
|
||||
} else {
|
||||
table->la_scale_regs.mc_ftop_ptsa_rate = 0x1B;
|
||||
}
|
||||
|
||||
table->la_scale_regs.mc_ptsa_grant_decrement = 0x17ff;
|
||||
|
||||
constexpr u32 MaskHigh = 0xFF00FFFF;
|
||||
constexpr u32 Mask2 = 0xFFFFFF00;
|
||||
constexpr u32 Mask3 = 0xFF00FF00;
|
||||
|
||||
const u32 allowance1 = static_cast<u32>(0x32000 / (C.eristaEmcMaxClock / 0x3E8)) & 0xFF;
|
||||
const u32 allowance2 = static_cast<u32>(0x9C40 / (C.eristaEmcMaxClock / 0x3E8)) & 0xFF;
|
||||
const u32 allowance3 = static_cast<u32>(0xB540 / (C.eristaEmcMaxClock / 0x3E8)) & 0xFF;
|
||||
const u32 allowance4 = static_cast<u32>(0x9600 / (C.eristaEmcMaxClock / 0x3E8)) & 0xFF;
|
||||
const u32 allowance5 = static_cast<u32>(0x8980 / (C.eristaEmcMaxClock / 0x3E8)) & 0xFF;
|
||||
|
||||
table->la_scale_regs.mc_latency_allowance_xusb_0 = (table->la_scale_regs.mc_latency_allowance_xusb_0 & MaskHigh) | (allowance1 << 16);
|
||||
table->la_scale_regs.mc_latency_allowance_xusb_1 = (table->la_scale_regs.mc_latency_allowance_xusb_1 & MaskHigh) | (allowance1 << 16);
|
||||
table->la_scale_regs.mc_latency_allowance_tsec_0 = (table->la_scale_regs.mc_latency_allowance_tsec_0 & MaskHigh) | (allowance1 << 16);
|
||||
table->la_scale_regs.mc_latency_allowance_sdmmcaa_0 = (table->la_scale_regs.mc_latency_allowance_sdmmcaa_0 & MaskHigh) | (allowance1 << 16);
|
||||
table->la_scale_regs.mc_latency_allowance_sdmmcab_0 = (table->la_scale_regs.mc_latency_allowance_sdmmcab_0 & MaskHigh) | (allowance1 << 16);
|
||||
table->la_scale_regs.mc_latency_allowance_sdmmc_0 = (table->la_scale_regs.mc_latency_allowance_sdmmc_0 & MaskHigh) | (allowance1 << 16);
|
||||
table->la_scale_regs.mc_latency_allowance_sdmmca_0 = (table->la_scale_regs.mc_latency_allowance_sdmmca_0 & MaskHigh) | (allowance1 << 16);
|
||||
table->la_scale_regs.mc_latency_allowance_ppcs_1 = (table->la_scale_regs.mc_latency_allowance_ppcs_1 & MaskHigh) | (allowance1 << 16);
|
||||
table->la_scale_regs.mc_latency_allowance_nvdec_0 = (table->la_scale_regs.mc_latency_allowance_nvdec_0 & MaskHigh) | (allowance1 << 16);
|
||||
table->la_scale_regs.mc_latency_allowance_mpcore_0 = (table->la_scale_regs.mc_latency_allowance_mpcore_0 & MaskHigh) | (allowance1 << 16);
|
||||
table->la_scale_regs.mc_latency_allowance_avpc_0 = (table->la_scale_regs.mc_latency_allowance_avpc_0 & MaskHigh) | (allowance1 << 16);
|
||||
table->la_scale_regs.mc_latency_allowance_vic_0 = allowance3 | (table->la_scale_regs.mc_latency_allowance_vic_0 & Mask3) | (allowance1 << 16);
|
||||
table->la_scale_regs.mc_latency_allowance_isp2_1 = (table->la_scale_regs.mc_latency_allowance_isp2_1 & Mask3) | (allowance1 << 16) | allowance1;
|
||||
table->la_scale_regs.mc_latency_allowance_nvenc_0 = allowance4 | (table->la_scale_regs.mc_latency_allowance_nvenc_0 & Mask3) | (allowance1 << 16);
|
||||
table->la_scale_regs.mc_latency_allowance_hc_0 = (table->la_scale_regs.mc_latency_allowance_hc_0 & Mask2) | allowance5;
|
||||
table->la_scale_regs.mc_latency_allowance_gpu_0 = allowance2 | (table->la_scale_regs.mc_latency_allowance_gpu_0 & Mask3) | (allowance1 << 16);
|
||||
table->la_scale_regs.mc_latency_allowance_gpu2_0 = allowance2 | (table->la_scale_regs.mc_latency_allowance_gpu2_0 & Mask3) | (allowance1 << 16);
|
||||
table->la_scale_regs.mc_latency_allowance_hc_1 = (table->la_scale_regs.mc_latency_allowance_hc_1 & Mask2) | allowance1;
|
||||
table->la_scale_regs.mc_latency_allowance_vi2_0 = (table->la_scale_regs.mc_latency_allowance_vi2_0 & Mask2) | allowance1;
|
||||
|
||||
table->dram_timings.t_rp = tRFCpb;
|
||||
table->dram_timings.t_rfc = tRFCab;
|
||||
table->dram_timings.rl = RL_DBI;
|
||||
// WRITE_PARAM_ALL_REG(table, emc_obdly, obdly);
|
||||
// WRITE_PARAM_ALL_REG(table, emc_ibdly, ibdly);
|
||||
|
||||
table->emc_cfg_2 = 0x11083D;
|
||||
}
|
||||
|
||||
Result MemFreqMtcTable(u32 *ptr) {
|
||||
u32 khz_list[] = {1600000, 1331200, 1065600, 800000, 665600, 408000, 204000, 102000, 68000, 40800};
|
||||
@@ -730,17 +679,14 @@ namespace ams::ldr::oc::pcv::erista {
|
||||
}
|
||||
|
||||
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
||||
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 Freq Table", CpuFreqCvbTable<false>, 1, nullptr, static_cast<u32>(GetDvfsTableLastEntry(CpuCvbTableDefault)->freq)},
|
||||
{"CPU Volt DVFS", &CpuVoltDvfs, 1, nullptr, 825},
|
||||
{"CPU Volt Thermals", &CpuVoltThermals, 1, nullptr, 825},
|
||||
{"CPU Volt Dfll", &CpuVoltDfll, 1, nullptr, 0xFFD0EAFF},
|
||||
{"CPU Volt Dfll", &CpuVoltDfll, 1, nullptr, 0xFFEAD0FF},
|
||||
{"GPU Volt DVFS", &GpuVoltDVFS, 1, nullptr, 810},
|
||||
{"GPU Volt Thermals", &GpuVoltThermals, 1, nullptr, 810},
|
||||
{"GPU Freq Table", GpuFreqCvbTable<false>, 1, nullptr, GpuCvbDefaultMaxFreq},
|
||||
{"GPU Freq Table", GpuFreqCvbTable<false>, 1, nullptr, static_cast<u32>(GetDvfsTableLastEntry(GpuCvbTableDefault)->freq)},
|
||||
{"GPU Freq Asm", &GpuFreqMaxAsm, 2, &GpuMaxClockPatternFn},
|
||||
{"GPU Freq PLL", &GpuFreqPllLimit, 1, nullptr, GpuClkPllLimit},
|
||||
{"MEM Freq Mtc", &MemFreqMtcTable, 0, nullptr, EmcClkOSLimit},
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "../mtc_timing_value.hpp"
|
||||
#include "../mariko/calculate_timings.hpp"
|
||||
|
||||
namespace ams::ldr::oc::pcv::mariko {
|
||||
namespace ams::ldr::hoc::pcv::mariko {
|
||||
|
||||
u32 GetGpuVminVoltage() {
|
||||
for (auto e : vminTable) {
|
||||
@@ -50,6 +50,30 @@ namespace ams::ldr::oc::pcv::mariko {
|
||||
return ramScale;
|
||||
}
|
||||
|
||||
u32 GetSpeedoBracket() {
|
||||
u32 speedoBracket = 3;
|
||||
if ((C.gpuSpeedo < 1754) && (speedoBracket = 2, C.gpuSpeedo < 1690)) {
|
||||
speedoBracket = !!(1625 < C.gpuSpeedo);
|
||||
}
|
||||
|
||||
return speedoBracket;
|
||||
}
|
||||
|
||||
u32 GetGpuBudgetDvfsVoltage() {
|
||||
u32 bracket = GetSpeedoBracket();
|
||||
|
||||
if (ramFreqMhz <= 1600)
|
||||
return 0;
|
||||
|
||||
for (u32 voltageIndex = 0; voltageIndex < 22; voltageIndex++) {
|
||||
if (ramFreqMhz <= ramBrackets[bracket][voltageIndex]) {
|
||||
return gpuBudgetDvfsArray[voltageIndex];
|
||||
}
|
||||
}
|
||||
|
||||
return 800;
|
||||
}
|
||||
|
||||
/* Note: EOS (probably?) has a bug in this function that always results in high vmin, this is fixed here. */
|
||||
u32 GetAutoVoltage() {
|
||||
u32 voltage = GetGpuVminVoltage();
|
||||
@@ -78,38 +102,38 @@ namespace ams::ldr::oc::pcv::mariko {
|
||||
}
|
||||
|
||||
/* C.marikoGpuVmin is non zero, user sets manual voltage. */
|
||||
if (C.marikoGpuVmin) {
|
||||
if (C.marikoGpuVmin != 0 && C.marikoGpuVmin != 1) {
|
||||
PATCH_OFFSET(ptr, C.marikoGpuVmin);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
/* C.marikoGpuVmin is zero, auto voltage is applied. */
|
||||
/* C.marikoGpuVmin is zero OR one, auto voltage is applied. */
|
||||
/* Get vmin depending on speedo and ram clock. */
|
||||
u32 autoVmin = GetAutoVoltage();
|
||||
u32 autoVmin = C.marikoGpuVmin == 0 ? GetAutoVoltage() : GetGpuBudgetDvfsVoltage();
|
||||
PATCH_OFFSET(ptr, autoVmin);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result GpuVoltThermals(u32 *ptr) {
|
||||
u32 vmin = std::memcmp(ptr - 3, gpuVoltThermalPattern, sizeof(gpuVoltThermalPattern));
|
||||
if (vmin) {
|
||||
if (std::memcmp(ptr - 3, gpuVoltThermalPattern, sizeof(gpuVoltThermalPattern))) {
|
||||
R_THROW(ldr::ResultInvalidGpuDvfs());
|
||||
}
|
||||
|
||||
u32 vmin = C.marikoGpuVmin;
|
||||
|
||||
/* Automatic voltage. */
|
||||
if (!C.marikoGpuVmin) {
|
||||
vmin = GetAutoVoltage();
|
||||
if (!C.marikoGpuVmin || C.marikoGpuVmin == 1) {
|
||||
vmin = C.marikoGpuVmin == 0 ? GetAutoVoltage() : GetGpuBudgetDvfsVoltage();
|
||||
PATCH_OFFSET(ptr, vmin);
|
||||
PATCH_OFFSET(ptr + 3, vmin);
|
||||
PATCH_OFFSET(ptr + 6, vmin);
|
||||
PATCH_OFFSET(ptr + 9, vmin);
|
||||
} else {
|
||||
/* Manual voltage. */
|
||||
PATCH_OFFSET(ptr, C.marikoGpuVmin);
|
||||
PATCH_OFFSET(ptr + 3, C.marikoGpuVmin);
|
||||
PATCH_OFFSET(ptr + 6, C.marikoGpuVmin);
|
||||
PATCH_OFFSET(ptr + 9, C.marikoGpuVmin);
|
||||
vmin = C.marikoGpuVmin;
|
||||
PATCH_OFFSET(ptr, vmin);
|
||||
PATCH_OFFSET(ptr + 3, vmin);
|
||||
PATCH_OFFSET(ptr + 6, vmin);
|
||||
PATCH_OFFSET(ptr + 9, vmin);
|
||||
}
|
||||
|
||||
PATCH_OFFSET(ptr + 12, vmin);
|
||||
@@ -432,9 +456,9 @@ namespace ams::ldr::oc::pcv::mariko {
|
||||
WRITE_PARAM_ALL_REG(table, emc_tfaw, GET_CYCLE_CEIL(tFAW));
|
||||
WRITE_PARAM_ALL_REG(table, emc_trpab, MIN(GET_CYCLE_CEIL(tRPab), static_cast<u32>(0x3F)));
|
||||
WRITE_PARAM_ALL_REG(table, emc_tckesr, GET_CYCLE_CEIL(tSR));
|
||||
WRITE_PARAM_ALL_REG(table, emc_tcke, tCKE);
|
||||
WRITE_PARAM_ALL_REG(table, emc_tcke, GET_CYCLE_CEIL(7.425) + 2);
|
||||
WRITE_PARAM_ALL_REG(table, emc_tpd, GET_CYCLE_CEIL(tXP));
|
||||
WRITE_PARAM_ALL_REG(table, emc_tclkstop, GET_CYCLE_CEIL(tXP) + 8); // TODO analyse
|
||||
WRITE_PARAM_ALL_REG(table, emc_tclkstop, tCLKSTOP);
|
||||
WRITE_PARAM_ALL_REG(table, emc_r2p, tR2P);
|
||||
WRITE_PARAM_ALL_REG(table, emc_r2w, tR2W);
|
||||
WRITE_PARAM_ALL_REG(table, emc_trtm, tRTM);
|
||||
@@ -452,12 +476,11 @@ namespace ams::ldr::oc::pcv::mariko {
|
||||
WRITE_PARAM_ALL_REG(table, emc_dyn_self_ref_control, dyn_self_ref_control);
|
||||
WRITE_PARAM_ALL_REG(table, emc_pdex2wr, pdex2rw);
|
||||
WRITE_PARAM_ALL_REG(table, emc_pdex2rd, pdex2rw);
|
||||
WRITE_PARAM_ALL_REG(table, emc_pchg2pden, GET_CYCLE_CEIL(1.75));
|
||||
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_pdex2cke, GET_CYCLE_CEIL(1.05));
|
||||
WRITE_PARAM_ALL_REG(table, emc_act2pden, GET_CYCLE_CEIL(14.0));
|
||||
WRITE_PARAM_ALL_REG(table, emc_cke2pden, /* cke2pden */ GET_CYCLE_CEIL(8.5));
|
||||
(void) cke2pden;
|
||||
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_rw2pden, tWTPDEN);
|
||||
WRITE_PARAM_ALL_REG(table, emc_einput, einput);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "ptm.hpp"
|
||||
|
||||
namespace ams::ldr::oc::ptm {
|
||||
namespace ams::ldr::hoc::ptm {
|
||||
|
||||
Result CpuPtmBoost(perf_conf_entry* entry) {
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) Switch-OC-Suite
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "../oc_common.hpp"
|
||||
|
||||
namespace ams::ldr::oc::ptm {
|
||||
namespace ams::ldr::hoc::ptm {
|
||||
|
||||
typedef struct {
|
||||
u32 conf_id;
|
||||
|
||||
@@ -83,7 +83,7 @@ Result nvdecCheck = 1;
|
||||
Result nvencCheck = 1;
|
||||
Result nvjpgCheck = 1;
|
||||
Result nifmCheck = 1;
|
||||
Result sysclkCheck = 1;
|
||||
Result sysclkCheck = 0;
|
||||
Result pwmDutyCycleCheck = 1;
|
||||
|
||||
//Wi-Fi
|
||||
@@ -572,21 +572,19 @@ void Misc(void*) {
|
||||
}
|
||||
|
||||
// Get sys-clk data
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
SysClkContext sysclkCTX;
|
||||
if (R_SUCCEEDED(sysclkIpcGetCurrentContext(&sysclkCTX))) {
|
||||
realCPU_Hz = sysclkCTX.realFreqs[SysClkModule_CPU];
|
||||
realGPU_Hz = sysclkCTX.realFreqs[SysClkModule_GPU];
|
||||
realRAM_Hz = sysclkCTX.realFreqs[SysClkModule_MEM];
|
||||
partLoad[SysClkPartLoad_EMC] = sysclkCTX.partLoad[SysClkPartLoad_EMC];
|
||||
partLoad[SysClkPartLoad_EMCCpu] = sysclkCTX.partLoad[SysClkPartLoad_EMCCpu];
|
||||
|
||||
realCPU_mV = sysclkCTX.voltages[HocClkVoltage_CPU];
|
||||
realGPU_mV = sysclkCTX.voltages[HocClkVoltage_GPU];
|
||||
realVDD2_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDD2];
|
||||
realVDDQ_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDDQ_MarikoOnly];
|
||||
realSOC_mV = sysclkCTX.voltages[HocClkVoltage_SOC];
|
||||
}
|
||||
SysClkContext sysclkCTX;
|
||||
if (R_SUCCEEDED(sysclkIpcGetCurrentContext(&sysclkCTX))) {
|
||||
realCPU_Hz = sysclkCTX.realFreqs[SysClkModule_CPU];
|
||||
realGPU_Hz = sysclkCTX.realFreqs[SysClkModule_GPU];
|
||||
realRAM_Hz = sysclkCTX.realFreqs[SysClkModule_MEM];
|
||||
partLoad[SysClkPartLoad_EMC] = sysclkCTX.partLoad[SysClkPartLoad_EMC];
|
||||
partLoad[SysClkPartLoad_EMCCpu] = sysclkCTX.partLoad[SysClkPartLoad_EMCCpu];
|
||||
|
||||
realCPU_mV = sysclkCTX.voltages[HocClkVoltage_CPU];
|
||||
realGPU_mV = sysclkCTX.voltages[HocClkVoltage_GPU];
|
||||
realVDD2_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDD2];
|
||||
realVDDQ_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDDQ_MarikoOnly];
|
||||
realSOC_mV = sysclkCTX.voltages[HocClkVoltage_SOC];
|
||||
}
|
||||
|
||||
// Temperatures
|
||||
@@ -699,21 +697,7 @@ void Misc3(void*) {
|
||||
|
||||
do {
|
||||
mutexLock(&mutex_Misc);
|
||||
|
||||
// Get sys-clk data
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
SysClkContext sysclkCTX;
|
||||
if (R_SUCCEEDED(sysclkIpcGetCurrentContext(&sysclkCTX))) {
|
||||
partLoad[SysClkPartLoad_EMC] = sysclkCTX.partLoad[SysClkPartLoad_EMC];
|
||||
partLoad[SysClkPartLoad_EMCCpu] = sysclkCTX.partLoad[SysClkPartLoad_EMCCpu];
|
||||
|
||||
realCPU_mV = sysclkCTX.voltages[HocClkVoltage_CPU];
|
||||
realGPU_mV = sysclkCTX.voltages[HocClkVoltage_GPU];
|
||||
realSOC_mV = sysclkCTX.voltages[HocClkVoltage_SOC];
|
||||
realVDD2_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDD2];
|
||||
realVDDQ_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDDQ_MarikoOnly];
|
||||
}
|
||||
}
|
||||
|
||||
// Temperatures
|
||||
if (R_SUCCEEDED(i2cCheck)) {
|
||||
Tmp451GetSocTemp(&SOC_temperatureF);
|
||||
|
||||
@@ -446,14 +446,6 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemoryAndRefreshRate();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer < 4) {
|
||||
sysclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
splGetConfig(SplConfigItem_HardwareType, &sku);
|
||||
@@ -466,16 +458,14 @@ public:
|
||||
}
|
||||
}
|
||||
splExit();
|
||||
|
||||
sysclkIpcInitialize();
|
||||
});
|
||||
Hinted = envIsSyscallHinted(0x6F);
|
||||
}
|
||||
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
}
|
||||
sysclkIpcExit();
|
||||
shmemClose(&_sharedmemory);
|
||||
//Exit services
|
||||
clkrstExit();
|
||||
@@ -530,14 +520,6 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemory();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer < 4) {
|
||||
sysclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
splGetConfig(SplConfigItem_HardwareType, &sku);
|
||||
@@ -550,6 +532,7 @@ public:
|
||||
}
|
||||
}
|
||||
splExit();
|
||||
sysclkIpcInitialize();
|
||||
});
|
||||
Hinted = envIsSyscallHinted(0x6F);
|
||||
}
|
||||
@@ -557,9 +540,7 @@ public:
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
shmemClose(&_sharedmemory);
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
}
|
||||
sysclkIpcExit();
|
||||
//Exit services
|
||||
clkrstExit();
|
||||
pcvExit();
|
||||
@@ -617,14 +598,6 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemory();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer < 4) {
|
||||
sysclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
splGetConfig(SplConfigItem_HardwareType, &sku);
|
||||
@@ -637,6 +610,7 @@ public:
|
||||
}
|
||||
}
|
||||
splExit();
|
||||
sysclkIpcInitialize();
|
||||
});
|
||||
Hinted = envIsSyscallHinted(0x6F);
|
||||
|
||||
@@ -645,9 +619,7 @@ public:
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
shmemClose(&_sharedmemory);
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
}
|
||||
sysclkIpcExit();
|
||||
// Exit services
|
||||
clkrstExit();
|
||||
pcvExit();
|
||||
@@ -707,14 +679,6 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemoryAndRefreshRate();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer < 4) {
|
||||
sysclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
splGetConfig(SplConfigItem_HardwareType, &sku);
|
||||
@@ -727,6 +691,7 @@ public:
|
||||
}
|
||||
}
|
||||
splExit();
|
||||
sysclkIpcInitialize();
|
||||
});
|
||||
Hinted = envIsSyscallHinted(0x6F);
|
||||
}
|
||||
@@ -734,9 +699,7 @@ public:
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
shmemClose(&_sharedmemory);
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
}
|
||||
sysclkIpcExit();
|
||||
clkrstExit();
|
||||
pcvExit();
|
||||
tsExit();
|
||||
@@ -790,14 +753,6 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemoryAndRefreshRate();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer < 4) {
|
||||
sysclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
splGetConfig(SplConfigItem_HardwareType, &sku);
|
||||
@@ -810,6 +765,7 @@ public:
|
||||
}
|
||||
}
|
||||
splExit();
|
||||
sysclkIpcInitialize();
|
||||
});
|
||||
Hinted = envIsSyscallHinted(0x6F);
|
||||
}
|
||||
@@ -817,9 +773,7 @@ public:
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
shmemClose(&_sharedmemory);
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
}
|
||||
sysclkIpcExit();
|
||||
clkrstExit();
|
||||
pcvExit();
|
||||
tsExit();
|
||||
@@ -873,14 +827,6 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemoryAndRefreshRate();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer < 4) {
|
||||
sysclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
splGetConfig(SplConfigItem_HardwareType, &sku);
|
||||
@@ -893,6 +839,7 @@ public:
|
||||
}
|
||||
}
|
||||
splExit();
|
||||
sysclkIpcInitialize();
|
||||
});
|
||||
Hinted = envIsSyscallHinted(0x6F);
|
||||
}
|
||||
@@ -900,9 +847,7 @@ public:
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
shmemClose(&_sharedmemory);
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
}
|
||||
sysclkIpcExit();
|
||||
clkrstExit();
|
||||
pcvExit();
|
||||
tsExit();
|
||||
|
||||
@@ -233,12 +233,10 @@ public:
|
||||
else if (realRAM_Hz && settings.showDeltas && (settings.showRealFreqs || settings.showTargetFreqs)) {
|
||||
renderer->drawString(DeltaRAM_c, false, COMMON_MARGIN + deltaOffset, height_offset, 15, (settings.textColor));
|
||||
}
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
static std::vector<std::string> PartLoadColoredChars = {"CPU", "GPU"};
|
||||
//static auto loadLabelWidth = renderer->getTextDimensions("Load: ", false, 15).first;
|
||||
renderer->drawString("Load", false, COMMON_MARGIN, height_offset+15, 15, (settings.catColor2));
|
||||
renderer->drawStringWithColoredSections(RAM_load_c, false, PartLoadColoredChars, COMMON_MARGIN + valueOffset, height_offset+15, 15, (settings.textColor), settings.catColor2);
|
||||
}
|
||||
static std::vector<std::string> PartLoadColoredChars = {"CPU", "GPU"};
|
||||
//static auto loadLabelWidth = renderer->getTextDimensions("Load: ", false, 15).first;
|
||||
renderer->drawString("Load", false, COMMON_MARGIN, height_offset+15, 15, (settings.catColor2));
|
||||
renderer->drawStringWithColoredSections(RAM_load_c, false, PartLoadColoredChars, COMMON_MARGIN + valueOffset, height_offset+15, 15, (settings.textColor), settings.catColor2);
|
||||
}
|
||||
if (R_SUCCEEDED(Hinted)) {
|
||||
//static auto textWidth = renderer->getTextDimensions("Total \nApplication \nApplet \nSystem \nSystem Unsafe ", false, 15).first;
|
||||
|
||||
@@ -354,7 +354,7 @@ public:
|
||||
else
|
||||
width = renderer->getTextDimensions("100%@4444.4444 mV", false, fontsize).first;
|
||||
}
|
||||
} else if (key == "GPU" || (key == "RAM" && settings.showRAMLoad && R_SUCCEEDED(sysclkCheck))) {
|
||||
} else if (key == "GPU" || (key == "RAM" && settings.showRAMLoad)) {
|
||||
//dimensions = renderer->drawString("100.0%@4444.4", false, 0, 0, fontsize, renderer->a(0x0000));
|
||||
|
||||
if (!settings.showRAMLoadCPUGPU) {
|
||||
@@ -370,7 +370,7 @@ public:
|
||||
width = renderer->getTextDimensions("100%[100%,100%]@4444.4444 mV", false, fontsize).first;
|
||||
}
|
||||
}
|
||||
} else if (key == "RAM" && (!settings.showRAMLoad || R_FAILED(sysclkCheck))) {
|
||||
} else if (key == "RAM" && (!settings.showRAMLoad)) {
|
||||
//dimensions = renderer->drawString("44444444MB@4444.4", false, 0, 0, fontsize, renderer->a(0x0000));
|
||||
if (!settings.realVolts) {
|
||||
width = renderer->getTextDimensions("100%@4444.4", false, fontsize).first;
|
||||
@@ -993,51 +993,33 @@ public:
|
||||
} else {
|
||||
unsigned PartLoadInt;
|
||||
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
PartLoadInt = partLoad[SysClkPartLoad_EMC] / 10;
|
||||
|
||||
if (settings.showRAMLoadCPUGPU) {
|
||||
unsigned ramCpuLoadInt = partLoad[SysClkPartLoad_EMCCpu] / 10;
|
||||
int RAM_GPU_Load = partLoad[SysClkPartLoad_EMC] - partLoad[SysClkPartLoad_EMCCpu];
|
||||
unsigned ramGpuLoadInt = RAM_GPU_Load / 10;
|
||||
|
||||
if (settings.realFrequencies && realRAM_Hz) {
|
||||
snprintf(MINI_RAM_var_compressed_c, sizeof(MINI_RAM_var_compressed_c),
|
||||
"%u%%[%u%%,%u%%]@%hu.%hhu",
|
||||
PartLoadInt, ramCpuLoadInt, ramGpuLoadInt,
|
||||
realRAM_Hz / 1000000, (realRAM_Hz / 100000) % 10);
|
||||
} else {
|
||||
snprintf(MINI_RAM_var_compressed_c, sizeof(MINI_RAM_var_compressed_c),
|
||||
"%u%%[%u%%,%u%%]@%hu.%hhu",
|
||||
PartLoadInt, ramCpuLoadInt, ramGpuLoadInt,
|
||||
RAM_Hz / 1000000, (RAM_Hz / 100000) % 10);
|
||||
}
|
||||
} else {
|
||||
if (settings.realFrequencies && realRAM_Hz) {
|
||||
snprintf(MINI_RAM_var_compressed_c, sizeof(MINI_RAM_var_compressed_c),
|
||||
"%u%%@%hu.%hhu", PartLoadInt,
|
||||
realRAM_Hz / 1000000, (realRAM_Hz / 100000) % 10);
|
||||
} else {
|
||||
snprintf(MINI_RAM_var_compressed_c, sizeof(MINI_RAM_var_compressed_c),
|
||||
"%u%%@%hu.%hhu", PartLoadInt,
|
||||
RAM_Hz / 1000000, (RAM_Hz / 100000) % 10);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const uint64_t RAM_Total_all = RAM_Total_application_u + RAM_Total_applet_u +
|
||||
RAM_Total_system_u + RAM_Total_systemunsafe_u;
|
||||
const uint64_t RAM_Used_all = RAM_Used_application_u + RAM_Used_applet_u +
|
||||
RAM_Used_system_u + RAM_Used_systemunsafe_u;
|
||||
PartLoadInt = (RAM_Total_all > 0) ? (unsigned)((RAM_Used_all * 100) / RAM_Total_all) : 0;
|
||||
PartLoadInt = partLoad[SysClkPartLoad_EMC] / 10;
|
||||
|
||||
if (settings.showRAMLoadCPUGPU) {
|
||||
unsigned ramCpuLoadInt = partLoad[SysClkPartLoad_EMCCpu] / 10;
|
||||
int RAM_GPU_Load = partLoad[SysClkPartLoad_EMC] - partLoad[SysClkPartLoad_EMCCpu];
|
||||
unsigned ramGpuLoadInt = RAM_GPU_Load / 10;
|
||||
|
||||
if (settings.realFrequencies && realRAM_Hz) {
|
||||
snprintf(MINI_RAM_var_compressed_c, sizeof(MINI_RAM_var_compressed_c),
|
||||
"%u%%@%hu.%hhu", PartLoadInt,
|
||||
realRAM_Hz / 1000000, (realRAM_Hz / 100000) % 10);
|
||||
"%u%%[%u%%,%u%%]@%hu.%hhu",
|
||||
PartLoadInt, ramCpuLoadInt, ramGpuLoadInt,
|
||||
realRAM_Hz / 1000000, (realRAM_Hz / 100000) % 10);
|
||||
} else {
|
||||
snprintf(MINI_RAM_var_compressed_c, sizeof(MINI_RAM_var_compressed_c),
|
||||
"%u%%@%hu.%hhu", PartLoadInt,
|
||||
RAM_Hz / 1000000, (RAM_Hz / 100000) % 10);
|
||||
"%u%%[%u%%,%u%%]@%hu.%hhu",
|
||||
PartLoadInt, ramCpuLoadInt, ramGpuLoadInt,
|
||||
RAM_Hz / 1000000, (RAM_Hz / 100000) % 10);
|
||||
}
|
||||
} else {
|
||||
if (settings.realFrequencies && realRAM_Hz) {
|
||||
snprintf(MINI_RAM_var_compressed_c, sizeof(MINI_RAM_var_compressed_c),
|
||||
"%u%%@%hu.%hhu", PartLoadInt,
|
||||
realRAM_Hz / 1000000, (realRAM_Hz / 100000) % 10);
|
||||
} else {
|
||||
snprintf(MINI_RAM_var_compressed_c, sizeof(MINI_RAM_var_compressed_c),
|
||||
"%u%%@%hu.%hhu", PartLoadInt,
|
||||
RAM_Hz / 1000000, (RAM_Hz / 100000) % 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
/*
|
||||
* --------------------------------------------------------------------------
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* "THE BEER-WARE LICENSE" (Revision 42):
|
||||
* <p-sam@d3vs.net>, <natinusala@gmail.com>, <m4x@m4xw.net>
|
||||
* wrote this file. As long as you retain this notice you can do whatever you
|
||||
@@ -8,11 +24,12 @@
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#define NX_SERVICE_ASSUME_NON_DOMAIN
|
||||
#include <sysclk/client/ipc.h>
|
||||
#include <switch.h>
|
||||
#include <string.h>
|
||||
#include <stdatomic.h>
|
||||
#include <sysclk/client/ipc.h>
|
||||
|
||||
static Service g_sysclkSrv;
|
||||
static atomic_size_t g_refCnt;
|
||||
@@ -20,7 +37,7 @@ static atomic_size_t g_refCnt;
|
||||
bool sysclkIpcRunning()
|
||||
{
|
||||
Handle handle;
|
||||
const bool running = R_FAILED(smRegisterService(&handle, smEncodeName(SYSCLK_IPC_SERVICE_NAME), false, 1));
|
||||
bool running = R_FAILED(smRegisterService(&handle, smEncodeName(SYSCLK_IPC_SERVICE_NAME), false, 1));
|
||||
|
||||
if (!running)
|
||||
{
|
||||
@@ -94,7 +111,10 @@ Result sysclkIpcSetOverride(SysClkModule module, u32 hz)
|
||||
|
||||
Result sysclkIpcGetProfiles(u64 tid, SysClkTitleProfileList* out_profiles)
|
||||
{
|
||||
return serviceDispatchInOut(&g_sysclkSrv, SysClkIpcCmd_GetProfiles, tid, *out_profiles);
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_GetProfiles, tid,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||
.buffers = {{out_profiles, sizeof(SysClkTitleProfileList)}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetProfiles(u64 tid, SysClkTitleProfileList* profiles)
|
||||
@@ -107,12 +127,18 @@ Result sysclkIpcSetProfiles(u64 tid, SysClkTitleProfileList* profiles)
|
||||
|
||||
Result sysclkIpcGetConfigValues(SysClkConfigValueList* out_configValues)
|
||||
{
|
||||
return serviceDispatchOut(&g_sysclkSrv, SysClkIpcCmd_GetConfigValues, *out_configValues);
|
||||
return serviceDispatch(&g_sysclkSrv, SysClkIpcCmd_GetConfigValues,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||
.buffers = {{out_configValues, sizeof(SysClkConfigValueList)}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetConfigValues(SysClkConfigValueList* configValues)
|
||||
{
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetConfigValues, *configValues);
|
||||
return serviceDispatch(&g_sysclkSrv, SysClkIpcCmd_SetConfigValues,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In },
|
||||
.buffers = {{configValues, sizeof(SysClkConfigValueList)}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* outCount)
|
||||
@@ -125,4 +151,33 @@ Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* o
|
||||
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
|
||||
.buffers = {{list, maxCount * sizeof(u32)}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetReverseNXRTMode(ReverseNXMode mode)
|
||||
{
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetReverseNXRTMode, mode);
|
||||
}
|
||||
|
||||
|
||||
Result hocClkIpcSetKipData()
|
||||
{
|
||||
u32 temp = 0;
|
||||
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_SetKipData, temp);
|
||||
}
|
||||
|
||||
Result hocClkIpcGetKipData()
|
||||
{
|
||||
u32 temp = 0;
|
||||
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_GetKipData, temp);
|
||||
}
|
||||
|
||||
Result hocClkIpcUpdateEmcRegs()
|
||||
{
|
||||
u32 temp = 0;
|
||||
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_UpdateEmcRegs, temp);
|
||||
}
|
||||
Result hocClkIpcCalculateGpuVmin()
|
||||
{
|
||||
u32 temp = 0;
|
||||
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_CalculateGpuVmin, temp);
|
||||
}
|
||||
@@ -1,287 +0,0 @@
|
||||
diff --git a/Overlay/Makefile b/Overlay/Makefile
|
||||
index 9656834..3b2ebd5 100644
|
||||
--- a/Overlay/Makefile
|
||||
+++ b/Overlay/Makefile
|
||||
@@ -38,7 +38,7 @@ include $(DEVKITPRO)/libnx/switch_rules
|
||||
# NACP building is skipped as well.
|
||||
#---------------------------------------------------------------------------------
|
||||
APP_TITLE := ReverseNX-RT
|
||||
-APP_VERSION := 1.1.1
|
||||
+APP_VERSION := 1.1.1-OC
|
||||
|
||||
TARGET := ReverseNX-RT-ovl
|
||||
BUILD := build
|
||||
diff --git a/Overlay/source/main.cpp b/Overlay/source/main.cpp
|
||||
index 810295c..2b3aa52 100644
|
||||
--- a/Overlay/source/main.cpp
|
||||
+++ b/Overlay/source/main.cpp
|
||||
@@ -1,7 +1,202 @@
|
||||
#define TESLA_INIT_IMPL // If you have more than one file using the tesla header, only define this in the main one
|
||||
#include <tesla.hpp> // The Tesla Header
|
||||
+#include <atomic>
|
||||
#include "SaltyNX.h"
|
||||
|
||||
+class ModeSync {
|
||||
+public:
|
||||
+ enum ReverseNXMode {
|
||||
+ ReverseNX_NotValid = 0,
|
||||
+ ReverseNX_SystemDefault = 0,
|
||||
+ ReverseNX_Handheld,
|
||||
+ ReverseNX_Docked,
|
||||
+ ReverseNX_Undefined,
|
||||
+ };
|
||||
+
|
||||
+ void SetMode(bool isDefault, bool setDock, char* descBuf, size_t bufSize) {
|
||||
+ auto changeHandler = [this](ReverseNXMode newMode) {
|
||||
+ if (this->currentMode == ReverseNX_Undefined || this->currentMode != newMode) {
|
||||
+ if (R_FAILED(this->ipc->SetMode(newMode))) {
|
||||
+ this->ipc->ipcStatus = Ipc::IpcStatus_ConnectFailed;
|
||||
+ return;
|
||||
+ }
|
||||
+ this->currentMode = newMode;
|
||||
+ }
|
||||
+ };
|
||||
+
|
||||
+ tsl::hlp::ScopeGuard updateBufGuard([&] { this->ipc->UpdateStatusDesc(descBuf, bufSize); });
|
||||
+
|
||||
+ if (isDefault) {
|
||||
+ changeHandler(ReverseNX_SystemDefault);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ changeHandler(setDock ? ReverseNX_Docked : ReverseNX_Handheld);
|
||||
+ }
|
||||
+
|
||||
+ ModeSync() {
|
||||
+ this->ipc = new Ipc;
|
||||
+ this->ipc->Init();
|
||||
+ }
|
||||
+
|
||||
+ ~ModeSync() {
|
||||
+ this->ipc->Exit();
|
||||
+ delete this->ipc;
|
||||
+ }
|
||||
+
|
||||
+protected:
|
||||
+ struct Ipc {
|
||||
+ #define API_VER 2
|
||||
+ #define SERVICE_NAME "sysclkOC"
|
||||
+
|
||||
+ enum SysClkIpcCmd {
|
||||
+ SysClkIpcCmd_GetApiVersion = 0,
|
||||
+ SysClkIpcCmd_GetConfigValues = 9,
|
||||
+ SysClkIpcCmd_SetReverseNXRTMode = 11,
|
||||
+ };
|
||||
+
|
||||
+ enum SysClkConfigValue {
|
||||
+ SysClkConfigValue_SyncReverseNXMode = 4,
|
||||
+ SysClkConfigValue_EnumMax = 8,
|
||||
+ };
|
||||
+
|
||||
+ struct SysClkConfigValueList {
|
||||
+ uint64_t values[SysClkConfigValue_EnumMax];
|
||||
+ };
|
||||
+
|
||||
+ enum IpcStatus {
|
||||
+ IpcStatus_OK,
|
||||
+
|
||||
+ IpcStatus_Unknown,
|
||||
+ IpcStatus_NotRunning,
|
||||
+ IpcStatus_InitFailed,
|
||||
+ IpcStatus_ConnectFailed,
|
||||
+ IpcStatus_UnsupportedVer,
|
||||
+
|
||||
+ IpcStatus_Count,
|
||||
+ };
|
||||
+
|
||||
+ static constexpr const char* IpcStatusStr[IpcStatus_Count] = {
|
||||
+ "",
|
||||
+
|
||||
+ "Unknown",
|
||||
+ "Err: Not running",
|
||||
+ "Err: Failed to init",
|
||||
+ "Err: Failed to connect",
|
||||
+ "Err: Unsupported version",
|
||||
+ };
|
||||
+
|
||||
+ Result Init() {
|
||||
+ Result rc = 0;
|
||||
+
|
||||
+ rc = IpcInitialize();
|
||||
+
|
||||
+ rc = GetStatus();
|
||||
+
|
||||
+ return rc;
|
||||
+ }
|
||||
+
|
||||
+ void Exit() {
|
||||
+ if (--refCnt == 0)
|
||||
+ serviceClose(&service);
|
||||
+ }
|
||||
+
|
||||
+ bool IsServiceRunning() {
|
||||
+ Handle handle;
|
||||
+ SmServiceName name = smEncodeName(SERVICE_NAME);
|
||||
+ if (R_FAILED(smRegisterService(&handle, name, false, 1))) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ svcCloseHandle(handle);
|
||||
+ smUnregisterService(name);
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ Result IpcInitialize(void) {
|
||||
+ Result rc = 0;
|
||||
+ refCnt++;
|
||||
+
|
||||
+ if (serviceIsActive(&service))
|
||||
+ return 0;
|
||||
+
|
||||
+ rc = smGetService(&service, SERVICE_NAME);
|
||||
+
|
||||
+ if (R_FAILED(rc)) {
|
||||
+ this->ipcStatus = IpcStatus_InitFailed;
|
||||
+ rc = this->ipcStatus;
|
||||
+ this->Exit();
|
||||
+ return rc;
|
||||
+ }
|
||||
+
|
||||
+ return rc;
|
||||
+ }
|
||||
+
|
||||
+ Result GetApiVersion(u32* outVer) {
|
||||
+ return serviceDispatchOut(&service, SysClkIpcCmd_GetApiVersion, *outVer);
|
||||
+ }
|
||||
+
|
||||
+ Result GetConfigValues(SysClkConfigValueList* outConfigValues) {
|
||||
+ return serviceDispatchOut(&service, SysClkIpcCmd_GetConfigValues, *outConfigValues);
|
||||
+ }
|
||||
+
|
||||
+ Result SetMode(ReverseNXMode mode) {
|
||||
+ return serviceDispatchIn(&service, SysClkIpcCmd_SetReverseNXRTMode, mode);
|
||||
+ }
|
||||
+
|
||||
+ Result GetStatus() {
|
||||
+ if (!IsServiceRunning()) {
|
||||
+ this->ipcStatus = IpcStatus_NotRunning;
|
||||
+ return this->ipcStatus;
|
||||
+ }
|
||||
+
|
||||
+ tsl::hlp::ScopeGuard exitSrvGuard([&] { this->Exit(); });
|
||||
+
|
||||
+ uint32_t api_ver;
|
||||
+ if (R_FAILED(GetApiVersion(&api_ver))) {
|
||||
+ this->ipcStatus = IpcStatus_ConnectFailed;
|
||||
+ return this->ipcStatus;
|
||||
+ }
|
||||
+
|
||||
+ if (api_ver != API_VER) {
|
||||
+ this->ipcStatus = IpcStatus_UnsupportedVer;
|
||||
+ return this->ipcStatus;
|
||||
+ }
|
||||
+
|
||||
+ SysClkConfigValueList* list = new SysClkConfigValueList;
|
||||
+ tsl::hlp::ScopeGuard listGuard([&] { delete list; });
|
||||
+
|
||||
+ if (R_FAILED(GetConfigValues(list))) {
|
||||
+ this->ipcStatus = IpcStatus_ConnectFailed;
|
||||
+ return this->ipcStatus;
|
||||
+ }
|
||||
+
|
||||
+ exitSrvGuard.dismiss();
|
||||
+
|
||||
+ shouldSync = bool(list->values[SysClkConfigValue_SyncReverseNXMode]);
|
||||
+ this->ipcStatus = IpcStatus_OK;
|
||||
+ return this->ipcStatus;
|
||||
+ }
|
||||
+
|
||||
+ void UpdateStatusDesc(char* buffer, size_t size) {
|
||||
+ snprintf(buffer, size,
|
||||
+ "Mode Sync: %s%s",
|
||||
+ IpcStatusStr[ipcStatus],
|
||||
+ (ipcStatus == IpcStatus_OK) ? (
|
||||
+ shouldSync ? "ON" : "OFF"
|
||||
+ ) : ""
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ Service service = {};
|
||||
+ std::atomic<std::size_t> refCnt = 0;
|
||||
+ IpcStatus ipcStatus = IpcStatus_Unknown;
|
||||
+ bool shouldSync = false;
|
||||
+ };
|
||||
+
|
||||
+ Ipc* ipc = nullptr;
|
||||
+ ReverseNXMode currentMode = ReverseNX_Undefined;
|
||||
+};
|
||||
+
|
||||
bool* def = 0;
|
||||
bool* isDocked = 0;
|
||||
bool* pluginActive = 0;
|
||||
@@ -17,6 +212,7 @@ bool plugin = false;
|
||||
char DockedChar[32];
|
||||
char SystemChar[32];
|
||||
char PluginChar[36];
|
||||
+char SysclkChar[0x40];
|
||||
uint64_t PID = 0;
|
||||
Handle remoteSharedMemory = 1;
|
||||
SharedMemory _sharedmemory = {};
|
||||
@@ -73,7 +269,7 @@ bool CheckPort () {
|
||||
|
||||
class GuiTest : public tsl::Gui {
|
||||
public:
|
||||
- GuiTest(u8 arg1, u8 arg2, bool arg3) { }
|
||||
+ GuiTest(ModeSync* p) : modeSync(p) { }
|
||||
|
||||
// Called when this Gui gets loaded to create the UI
|
||||
// Allocate all elements on the heap. libtesla will make sure to clean them up when not needed anymore
|
||||
@@ -112,6 +308,7 @@ public:
|
||||
else {
|
||||
renderer->drawString(SystemChar, false, x, y+40, 20, renderer->a(0xFFFF));
|
||||
renderer->drawString(DockedChar, false, x, y+60, 20, renderer->a(0xFFFF));
|
||||
+ renderer->drawString(SysclkChar, false, x, y+80, 20, renderer->a(0xFFFF));
|
||||
}
|
||||
}
|
||||
}), 100);
|
||||
@@ -190,6 +387,8 @@ public:
|
||||
|
||||
if (_def) sprintf(SystemChar, "Controlled by system: Yes");
|
||||
else sprintf(SystemChar, "Controlled by system: No");
|
||||
+
|
||||
+ modeSync->SetMode(_def, _isDocked, SysclkChar, sizeof(SysclkChar));
|
||||
}
|
||||
else i++;
|
||||
}
|
||||
@@ -200,6 +399,8 @@ public:
|
||||
virtual bool handleInput(u64 keysDown, u64 keysHeld, const HidTouchState &touchPos, HidAnalogStickState joyStickPosLeft, HidAnalogStickState joyStickPosRight) override {
|
||||
return false; // Return true here to singal the inputs have been consumed
|
||||
}
|
||||
+
|
||||
+ ModeSync* modeSync;
|
||||
};
|
||||
|
||||
class OverlayTest : public tsl::Overlay {
|
||||
@@ -248,9 +449,11 @@ public:
|
||||
|
||||
});
|
||||
|
||||
+ modeSync = new ModeSync;
|
||||
} // Called at the start to initialize all services necessary for this Overlay
|
||||
|
||||
virtual void exitServices() override {
|
||||
+ delete modeSync;
|
||||
shmemClose(&_sharedmemory);
|
||||
fsdevUnmountDevice("sdmc");
|
||||
} // Callet at the end to clean up all services previously initialized
|
||||
@@ -260,8 +463,10 @@ public:
|
||||
virtual void onHide() override {} // Called before overlay wants to change from visible to invisible state
|
||||
|
||||
virtual std::unique_ptr<tsl::Gui> loadInitialGui() override {
|
||||
- return initially<GuiTest>(1, 2, true); // Initial Gui to load. It's possible to pass arguments to it's constructor like this
|
||||
+ return initially<GuiTest>(modeSync); // Initial Gui to load. It's possible to pass arguments to it's constructor like this
|
||||
}
|
||||
+
|
||||
+ ModeSync* modeSync = nullptr;
|
||||
};
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
@@ -1,241 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
#include <switch.h>
|
||||
|
||||
/* Recompile nx-hbloader with following added in config.json "kernel_capabilities"
|
||||
{
|
||||
"type": "map",
|
||||
"value": {
|
||||
"address": "0x60006000",
|
||||
"size": "0x1000",
|
||||
"is_ro": false,
|
||||
"is_io": true
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void waitForKey(PadState pad) {
|
||||
while (appletMainLoop())
|
||||
{
|
||||
padUpdate(&pad);
|
||||
|
||||
u64 kDown = padGetButtonsDown(&pad);
|
||||
|
||||
if (kDown & HidNpadButton_A)
|
||||
break;
|
||||
|
||||
if (kDown & HidNpadButton_Plus || kDown & HidNpadButton_B) {
|
||||
consoleExit(NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
consoleUpdate(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
#define CLK_RST_IO_BASE 0x60006000
|
||||
#define CLK_RST_IO_SIZE 0x1000
|
||||
|
||||
#define REG(OFFSET) (*reinterpret_cast<volatile u32 *>(OFFSET))
|
||||
#define GET_BITS(VAL, HIGH, LOW) ((VAL & ((1UL << (HIGH + 1UL)) - 1UL)) >> LOW)
|
||||
#define GET_BIT(VAL, BIT) GET_BITS(VAL, BIT, BIT)
|
||||
|
||||
static u64 clkrst_base = 0;
|
||||
static u64 clkrst_size = 0;
|
||||
|
||||
// From jetson nano kernel
|
||||
typedef enum {
|
||||
/* divider = 2 */
|
||||
CLK_PLLX = 5,
|
||||
CLK_PLLM = 2,
|
||||
CLK_PLLMB = 37,
|
||||
/* PLLX & PLLG are backup PLLs for CPU & GPU */
|
||||
/* divider = 1 */
|
||||
CLK_CCLK_G = 18, // A57 CPU cluster
|
||||
CLK_EMC = 36,
|
||||
} PTO_ID; // PLL Test Output Register ID
|
||||
|
||||
/* See if GM20B clock GPC PLL regs are accessible. */
|
||||
|
||||
#define PLLX_MISC0 0xE4
|
||||
#define PLLM_MISC2 0x9C
|
||||
|
||||
double ptoGetMHz(PTO_ID pto_id, u32 divider = 1, u32 presel_reg = 0, u32 presel_mask = 0) {
|
||||
u32 pre_val, val, presel_val;
|
||||
|
||||
if (presel_reg) {
|
||||
val = REG(clkrst_base + presel_reg);
|
||||
usleep(10);
|
||||
presel_val = val & presel_mask;
|
||||
val &= ~presel_mask;
|
||||
val |= presel_mask;
|
||||
REG(clkrst_base + presel_reg) = val;
|
||||
usleep(10);
|
||||
}
|
||||
|
||||
constexpr u32 cycle_count = 16;
|
||||
pre_val = REG(clkrst_base + 0x60);
|
||||
val = BIT(23) | BIT(13) | (cycle_count - 1);
|
||||
val |= pto_id << 14;
|
||||
|
||||
REG(clkrst_base + 0x60) = val;
|
||||
usleep(10);
|
||||
REG(clkrst_base + 0x60) = val | BIT(10);
|
||||
usleep(10);
|
||||
REG(clkrst_base + 0x60) = val;
|
||||
usleep(10);
|
||||
REG(clkrst_base + 0x60) = val | BIT(9);
|
||||
usleep(500);
|
||||
|
||||
while(REG(clkrst_base + 0x64) & BIT(31))
|
||||
;
|
||||
|
||||
val = REG(clkrst_base + 0x64);
|
||||
val &= 0xFFFFFF;
|
||||
val *= divider;
|
||||
|
||||
double rate_mhz = (u64)val * 32768. / cycle_count / 1000. / 1000.;
|
||||
usleep(10);
|
||||
REG(clkrst_base + 0x60) = pre_val;
|
||||
usleep(10);
|
||||
|
||||
if (presel_reg) {
|
||||
val = REG(clkrst_base + presel_reg);
|
||||
usleep(10);
|
||||
val &= ~presel_mask;
|
||||
val |= presel_val;
|
||||
REG(clkrst_base + presel_reg) = val;
|
||||
usleep(10);
|
||||
}
|
||||
|
||||
return rate_mhz;
|
||||
}
|
||||
|
||||
int main() {
|
||||
consoleInit(NULL);
|
||||
PadState pad;
|
||||
padConfigureInput(1, HidNpadStyleSet_NpadStandard);
|
||||
padInitializeDefault(&pad);
|
||||
|
||||
// Get clkrst MMIO virtual address
|
||||
Result rc = svcQueryIoMapping(&clkrst_base, &clkrst_size, CLK_RST_IO_BASE, CLK_RST_IO_SIZE);
|
||||
if (R_FAILED(rc)) {
|
||||
printf("[ERROR] svcQueryIoMapping: 0x%X\n", rc);
|
||||
consoleUpdate(NULL);
|
||||
waitForKey(pad);
|
||||
consoleExit(NULL);
|
||||
}
|
||||
|
||||
printf("clkrst_base: 0x%lX\nclkrst_size: 0x%lX\n", clkrst_base, clkrst_size);
|
||||
|
||||
{
|
||||
#define CLKRST_PLLX_BASE 0xE0
|
||||
u32 pllx_base = REG(clkrst_base + CLKRST_PLLX_BASE);
|
||||
printf("\n"\
|
||||
"PLLX_BASE: 0x%X\n"\
|
||||
"PLLX_ENABLE: %lu\n"\
|
||||
"PLLX_REF_DIS: %lu\n"\
|
||||
"PLLX_LOCK: %lu\n"\
|
||||
"PLLX_DIVP: %lu\n"\
|
||||
"PLLX_DIVN: %lu\n"\
|
||||
"PLLX_DIVM: %lu\n",
|
||||
pllx_base,
|
||||
GET_BIT(pllx_base, 30),
|
||||
GET_BIT(pllx_base, 29),
|
||||
GET_BIT(pllx_base, 27),
|
||||
GET_BITS(pllx_base, 24, 20),
|
||||
GET_BITS(pllx_base, 15, 8),
|
||||
GET_BITS(pllx_base, 7, 0));
|
||||
}
|
||||
|
||||
{
|
||||
#define CLKRST_PLLX_MISC 0xE4
|
||||
u32 pllx_misc = REG(clkrst_base + CLKRST_PLLX_MISC);
|
||||
printf("\n"\
|
||||
"PLLX_MISC: 0x%X\n"\
|
||||
"PLLX_FO_G_DISABLE: %lu\n"\
|
||||
"PLLX_PTS: %lu\n"\
|
||||
"PLLX_LOCK_ENABLE: %lu\n",
|
||||
pllx_misc,
|
||||
GET_BIT(pllx_misc, 28),
|
||||
GET_BITS(pllx_misc, 23, 22),
|
||||
GET_BIT(pllx_misc, 18));
|
||||
}
|
||||
|
||||
{
|
||||
#define CLKRST_PLLMB_SS_CFG 0x780
|
||||
u32 pllmb_ss_cfg = REG(clkrst_base + CLKRST_PLLMB_SS_CFG);
|
||||
printf("\n"\
|
||||
"PLLMB_SS_CFG: 0x%X\n"\
|
||||
"PLLMB_EN_SDM: %lu\n"\
|
||||
"PLLMB_EN_SSC: %lu\n",
|
||||
pllmb_ss_cfg,
|
||||
GET_BIT(pllmb_ss_cfg, 31),
|
||||
GET_BIT(pllmb_ss_cfg, 30));
|
||||
}
|
||||
|
||||
{
|
||||
#define CLKRST_PLLMB_SS_CTRL1 0x784
|
||||
u32 pllmb_ss_ctrl1 = REG(clkrst_base + CLKRST_PLLMB_SS_CTRL1);
|
||||
printf("\n"\
|
||||
"PLLMB_SS_CTRL1: 0x%X\n"\
|
||||
"PLLMB_SDM_SSC_MAX: %lu\n"\
|
||||
"PLLMB_SDM_SSC_MIN: %lu\n",
|
||||
pllmb_ss_ctrl1,
|
||||
GET_BITS(pllmb_ss_ctrl1, 31, 16),
|
||||
GET_BITS(pllmb_ss_ctrl1, 15, 0));
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
#define CLKRST_PLLM_BASE 0x90
|
||||
u32 pllm_base = REG(clkrst_base + CLKRST_PLLM_BASE);
|
||||
printf("\n"\
|
||||
"PLLM_BASE: 0x%X\n"\
|
||||
"PLLM_DIVP: %lu\n"\
|
||||
"PLLM_DIVN: %lu\n"\
|
||||
"PLLM_DIVM: %lu\n",
|
||||
pllm_base,
|
||||
GET_BITS(pllm_base, 24, 20),
|
||||
GET_BITS(pllm_base, 15, 8),
|
||||
GET_BITS(pllm_base, 7, 0));
|
||||
}
|
||||
|
||||
{
|
||||
#define CLKRST_PLLMB_BASE 0x5e8
|
||||
u32 pllmb_base = REG(clkrst_base + CLKRST_PLLMB_BASE);
|
||||
printf("\n"\
|
||||
"PLLMB_BASE: 0x%X\n"\
|
||||
"PLLMB_DIVP: %lu\n"\
|
||||
"PLLMB_DIVN: %lu\n"\
|
||||
"PLLMB_DIVM: %lu\n",
|
||||
pllmb_base,
|
||||
GET_BITS(pllmb_base, 24, 20),
|
||||
GET_BITS(pllmb_base, 15, 8),
|
||||
GET_BITS(pllmb_base, 7, 0));
|
||||
}
|
||||
|
||||
printf("\n"\
|
||||
"EMC: %6.1f MHz\n"\
|
||||
"CCLK_G: %6.1f MHz\n"\
|
||||
"PLLX: %6.1f MHz\n"\
|
||||
"PLLM: %6.1f MHz\n"\
|
||||
"PLLMB: %6.1f MHz\n",
|
||||
ptoGetMHz(CLK_EMC),
|
||||
ptoGetMHz(CLK_CCLK_G),
|
||||
ptoGetMHz(CLK_PLLX, 2, PLLX_MISC0, BIT(22)),
|
||||
ptoGetMHz(CLK_PLLM, 2, PLLM_MISC2, BIT(8)),
|
||||
ptoGetMHz(CLK_PLLMB, 2, PLLM_MISC2, BIT(9))
|
||||
);
|
||||
|
||||
waitForKey(pad);
|
||||
|
||||
consoleExit(NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
53
Source/sys-clk/bitmap.py
Normal file
53
Source/sys-clk/bitmap.py
Normal file
@@ -0,0 +1,53 @@
|
||||
from PIL import Image
|
||||
import argparse
|
||||
import os
|
||||
|
||||
def image_to_rgba8888_array(image_path, output_path):
|
||||
# Open and convert to RGBA
|
||||
img = Image.open(image_path).convert('RGBA')
|
||||
width, height = img.size
|
||||
|
||||
# Get pixel data
|
||||
pixels = img.tobytes()
|
||||
|
||||
# Write as C header file
|
||||
with open(output_path, 'w') as f:
|
||||
f.write('// This is a automatically generated file, do not edit manually.\n')
|
||||
f.write(f'// {os.path.basename(image_path)} - {width}x{height}\n')
|
||||
f.write(f'const unsigned int IMG_WIDTH = {width};\n')
|
||||
f.write(f'const unsigned int IMG_HEIGHT = {height};\n')
|
||||
f.write('const unsigned char IMG_DATA[] = {\n ')
|
||||
|
||||
for i, byte in enumerate(pixels):
|
||||
f.write(f'0x{byte:02X}')
|
||||
if i < len(pixels) - 1:
|
||||
f.write(', ')
|
||||
if (i + 1) % 12 == 0:
|
||||
f.write('\n ')
|
||||
|
||||
f.write('\n};\n')
|
||||
|
||||
print(f'Converted: {width}x{height} -> {len(pixels)} bytes')
|
||||
print(f'Output: {output_path}')
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='PNG to RGB8888 script'
|
||||
)
|
||||
parser.add_argument('input', help='Input image file (e.g. cat.png)')
|
||||
parser.add_argument(
|
||||
'-o', '--output',
|
||||
help='Output header file (default: <input>.h)'
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
output_path = args.output
|
||||
if not output_path:
|
||||
base, _ = os.path.splitext(args.input)
|
||||
output_path = base + '.h'
|
||||
|
||||
image_to_rgba8888_array(args.input, output_path)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
56
Source/sys-clk/common/include/crc32.h
Normal file
56
Source/sys-clk/common/include/crc32.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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 <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t crc32(const uint8_t *data, size_t length) {
|
||||
uint32_t crc = 0xFFFFFFFF;
|
||||
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
crc ^= data[i];
|
||||
for (int j = 0; j < 8; j++) {
|
||||
crc = (crc >> 1) ^ (0xEDB88320 & -(crc & 1));
|
||||
}
|
||||
}
|
||||
return ~crc;
|
||||
}
|
||||
|
||||
uint32_t checksum_file(const char *filename) {
|
||||
FILE *file = fopen(filename, "rb");
|
||||
if (!file) {
|
||||
perror("[crc32] Error opening file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t buffer[1024];
|
||||
uint32_t crc = 0xFFFFFFFF;
|
||||
size_t bytes_read;
|
||||
|
||||
while ((bytes_read = fread(buffer, 1, sizeof(buffer), file)) > 0) {
|
||||
for (size_t i = 0; i < bytes_read; i++) {
|
||||
crc ^= buffer[i];
|
||||
for (int j = 0; j < 8; j++) {
|
||||
crc = (crc >> 1) ^ (0xEDB88320 & -(crc & 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
return ~crc;
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <cstdio>
|
||||
|
||||
static void writeNotification(const std::string& message) {
|
||||
const char* flagPath = "sdmc:/config/ultrahand/flags/NOTIFICATIONS.flag";
|
||||
static const char* flagPath = "sdmc:/config/ultrahand/flags/NOTIFICATIONS.flag";
|
||||
|
||||
FILE* flagFile = fopen(flagPath, "r");
|
||||
if (!flagFile) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) MasaGratoR
|
||||
*
|
||||
* 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
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -125,6 +125,13 @@ typedef enum {
|
||||
HorizonOCSpeedo_EnumMax,
|
||||
} HorizonOCSpeedo;
|
||||
|
||||
typedef enum {
|
||||
GPUUVLevel_NoUV = 0,
|
||||
GPUUVLevel_SLT,
|
||||
GPUUVLevel_HiOPT,
|
||||
GPUUVLevel_EnumMax,
|
||||
} GPUUndervoltLevel;
|
||||
|
||||
#define SYSCLK_ENUM_VALID(n, v) ((v) < n##_EnumMax)
|
||||
|
||||
static inline const char* sysclkFormatModule(SysClkModule module, bool pretty)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -12,9 +12,9 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* "THE BEER-WARE LICENSE" (Revision 42):
|
||||
* <p-sam@d3vs.net>, <natinusala@gmail.com>, <m4x@m4xw.net>
|
||||
@@ -41,11 +41,7 @@ typedef enum {
|
||||
HocClkConfigValue_OverwriteBoostMode,
|
||||
|
||||
HocClkConfigValue_EristaMaxCpuClock,
|
||||
HocClkConfigValue_EristaMaxGpuClock,
|
||||
HocClkConfigValue_EristaMaxMemClock,
|
||||
HocClkConfigValue_MarikoMaxCpuClock,
|
||||
HocClkConfigValue_MarikoMaxGpuClock,
|
||||
HocClkConfigValue_MarikoMaxMemClock,
|
||||
|
||||
HocClkConfigValue_ThermalThrottle,
|
||||
HocClkConfigValue_ThermalThrottleThreshold,
|
||||
@@ -56,9 +52,6 @@ typedef enum {
|
||||
HocClkConfigValue_LiteTDPLimit,
|
||||
|
||||
HocClkConfigValue_EnforceBoardLimit,
|
||||
|
||||
HocClkConfigValue_KipEditing,
|
||||
HocClkConfigValue_KipFileName,
|
||||
|
||||
HorizonOCConfigValue_BatteryChargeCurrent,
|
||||
|
||||
@@ -67,7 +60,7 @@ typedef enum {
|
||||
HocClkConfigValue_FixCpuVoltBug,
|
||||
|
||||
KipConfigValue_custRev,
|
||||
KipConfigValue_mtcConf,
|
||||
// KipConfigValue_mtcConf,
|
||||
KipConfigValue_hpMode,
|
||||
|
||||
KipConfigValue_commonEmcMemVolt,
|
||||
@@ -165,6 +158,10 @@ typedef enum {
|
||||
KipConfigValue_g_volt_e_1036800,
|
||||
KipConfigValue_g_volt_e_1075200,
|
||||
|
||||
KipConfigValue_t7_tWTR_fine_tune,
|
||||
|
||||
KipCrc32,
|
||||
HocClkConfigValue_IsFirstLoad,
|
||||
SysClkConfigValue_EnumMax,
|
||||
} SysClkConfigValue;
|
||||
|
||||
@@ -194,17 +191,9 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
|
||||
|
||||
case HocClkConfigValue_EristaMaxCpuClock:
|
||||
return pretty ? "CPU Max Display Clock" : "cpu_max_e";
|
||||
case HocClkConfigValue_EristaMaxGpuClock:
|
||||
return pretty ? "Max GPU Clock" : "gpu_max_e";
|
||||
case HocClkConfigValue_EristaMaxMemClock:
|
||||
return pretty ? "Erista Max MEM Clock" : "mem_max_e";
|
||||
|
||||
case HocClkConfigValue_MarikoMaxCpuClock:
|
||||
return pretty ? "CPU Max Display Clock" : "cpu_max_m";
|
||||
case HocClkConfigValue_MarikoMaxGpuClock:
|
||||
return pretty ? "Mariko Max GPU Clock" : "gpu_max_m";
|
||||
case HocClkConfigValue_MarikoMaxMemClock:
|
||||
return pretty ? "Mariko Max MEM Clock" : "mem_max_m";
|
||||
|
||||
case HocClkConfigValue_ThermalThrottle:
|
||||
return pretty ? "Thermal Throttle" : "thermal_throttle";
|
||||
@@ -224,12 +213,6 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
|
||||
case HocClkConfigValue_EnforceBoardLimit:
|
||||
return pretty ? "Enforce Board Limit" : "enforce_board_limit";
|
||||
|
||||
case HocClkConfigValue_KipEditing:
|
||||
return pretty ? "Enable KIP Editing" : "kip_editing";
|
||||
|
||||
case HocClkConfigValue_KipFileName:
|
||||
return pretty ? "KIP File Name" : "kip_file_name";
|
||||
|
||||
case HorizonOCConfigValue_BatteryChargeCurrent:
|
||||
return pretty ? "Battery Charge Current" : "bat_charge_current";
|
||||
|
||||
@@ -245,8 +228,8 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
|
||||
// KIP config values
|
||||
case KipConfigValue_custRev:
|
||||
return pretty ? "Custom Revision" : "kip_cust_rev";
|
||||
case KipConfigValue_mtcConf:
|
||||
return pretty ? "MTC Config" : "kip_mtc_conf";
|
||||
// case KipConfigValue_mtcConf:
|
||||
// return pretty ? "MTC Config" : "kip_mtc_conf";
|
||||
case KipConfigValue_hpMode:
|
||||
return pretty ? "HP Mode" : "kip_hp_mode";
|
||||
|
||||
@@ -389,7 +372,11 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
|
||||
case KipConfigValue_g_volt_e_998400: return pretty ? "Erista GPU Volt 998 MHz" : "g_volt_e_998400";
|
||||
case KipConfigValue_g_volt_e_1036800: return pretty ? "Erista GPU Volt 1036 MHz" : "g_volt_e_1036800";
|
||||
case KipConfigValue_g_volt_e_1075200: return pretty ? "Erista GPU Volt 1075 MHz" : "g_volt_e_1075200";
|
||||
|
||||
case KipConfigValue_t7_tWTR_fine_tune: return pretty ? "t7 - tWTR Fine Tune" : "t7_tWTR_fine_tune";
|
||||
case KipCrc32:
|
||||
return pretty ? "CRC32" : "crc32";
|
||||
case HocClkConfigValue_IsFirstLoad:
|
||||
return pretty ? "Is First Load" : "is_first_load";
|
||||
default:
|
||||
return pretty ? "[cfg] no enum format string" : "err_no_format_string";
|
||||
}
|
||||
@@ -407,37 +394,28 @@ static inline uint64_t sysclkDefaultConfigValue(SysClkConfigValue val)
|
||||
case SysClkConfigValue_CsvWriteIntervalMs:
|
||||
case HocClkConfigValue_UncappedClocks:
|
||||
case HocClkConfigValue_OverwriteBoostMode:
|
||||
case HocClkConfigValue_KipFileName:
|
||||
case HorizonOCConfigValue_BatteryChargeCurrent:
|
||||
case HorizonOCConfigValue_OverwriteRefreshRate:
|
||||
case HorizonOCConfigValue_EnableUnsafeDisplayFreqs:
|
||||
return 0ULL;
|
||||
case HocClkConfigValue_EristaMaxCpuClock:
|
||||
return 1785ULL;
|
||||
case HocClkConfigValue_EristaMaxGpuClock:
|
||||
return 921ULL;
|
||||
case HocClkConfigValue_EristaMaxMemClock:
|
||||
return 1600ULL;
|
||||
|
||||
case HocClkConfigValue_MarikoMaxCpuClock:
|
||||
return 1963ULL;
|
||||
case HocClkConfigValue_MarikoMaxGpuClock:
|
||||
return 1075ULL;
|
||||
case HocClkConfigValue_MarikoMaxMemClock:
|
||||
return 1862ULL;
|
||||
|
||||
case HocClkConfigValue_ThermalThrottle:
|
||||
case HocClkConfigValue_HandheldTDP:
|
||||
case HocClkConfigValue_EnforceBoardLimit:
|
||||
case HocClkConfigValue_KipEditing:
|
||||
case HocClkConfigValue_FixCpuVoltBug:
|
||||
case HocClkConfigValue_IsFirstLoad:
|
||||
return 1ULL;
|
||||
case HocClkConfigValue_ThermalThrottleThreshold:
|
||||
return 70ULL;
|
||||
case HocClkConfigValue_HandheldTDPLimit:
|
||||
return 8600ULL;
|
||||
return 9600ULL; // 8600mW will trigger on erista stock, so raise it a bit
|
||||
case HocClkConfigValue_LiteTDPLimit:
|
||||
return 6400ULL;
|
||||
return 6400ULL; // 0.5C
|
||||
default:
|
||||
return 0ULL;
|
||||
}
|
||||
@@ -448,17 +426,13 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
|
||||
switch(val)
|
||||
{
|
||||
case HocClkConfigValue_EristaMaxCpuClock:
|
||||
case HocClkConfigValue_EristaMaxGpuClock:
|
||||
case HocClkConfigValue_EristaMaxMemClock:
|
||||
case HocClkConfigValue_MarikoMaxCpuClock:
|
||||
case HocClkConfigValue_MarikoMaxGpuClock:
|
||||
case HocClkConfigValue_MarikoMaxMemClock:
|
||||
case HocClkConfigValue_ThermalThrottleThreshold:
|
||||
case HocClkConfigValue_HandheldTDPLimit:
|
||||
case HocClkConfigValue_LiteTDPLimit:
|
||||
case SysClkConfigValue_PollingIntervalMs:
|
||||
return input > 0;
|
||||
|
||||
|
||||
case SysClkConfigValue_TempLogIntervalMs:
|
||||
case SysClkConfigValue_FreqLogIntervalMs:
|
||||
case SysClkConfigValue_PowerLogIntervalMs:
|
||||
@@ -468,15 +442,14 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
|
||||
case HocClkConfigValue_ThermalThrottle:
|
||||
case HocClkConfigValue_HandheldTDP:
|
||||
case HocClkConfigValue_EnforceBoardLimit:
|
||||
case HocClkConfigValue_KipEditing:
|
||||
case HocClkConfigValue_KipFileName:
|
||||
case HorizonOCConfigValue_OverwriteRefreshRate:
|
||||
case HocClkConfigValue_FixCpuVoltBug:
|
||||
case HorizonOCConfigValue_EnableUnsafeDisplayFreqs:
|
||||
case HocClkConfigValue_IsFirstLoad:
|
||||
return (input & 0x1) == input;
|
||||
|
||||
|
||||
case KipConfigValue_custRev:
|
||||
case KipConfigValue_mtcConf:
|
||||
// case KipConfigValue_mtcConf:
|
||||
case KipConfigValue_hpMode:
|
||||
case KipConfigValue_commonEmcMemVolt:
|
||||
case KipConfigValue_eristaEmcMaxClock:
|
||||
@@ -564,6 +537,8 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
|
||||
case KipConfigValue_g_volt_e_1075200:
|
||||
case KipConfigValue_eristaCpuVmin:
|
||||
case KipConfigValue_eristaCpuUnlock:
|
||||
case KipConfigValue_t7_tWTR_fine_tune:
|
||||
case KipCrc32:
|
||||
return true;
|
||||
case HorizonOCConfigValue_BatteryChargeCurrent:
|
||||
return ((input >= 1024) && (input <= 3072)) || !input;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -31,8 +31,8 @@
|
||||
#include "board.h"
|
||||
#include "clock_manager.h"
|
||||
|
||||
#define SYSCLK_IPC_API_VERSION 4
|
||||
#define SYSCLK_IPC_SERVICE_NAME "sys:clk"
|
||||
#define SYSCLK_IPC_API_VERSION 1
|
||||
#define SYSCLK_IPC_SERVICE_NAME "hoc:clk"
|
||||
|
||||
enum SysClkIpcCmd
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -39,7 +39,7 @@ include ${TOPDIR}/lib/libultrahand/ultrahand.mk
|
||||
# version control constants
|
||||
#---------------------------------------------------------------------------------
|
||||
#TARGET_VERSION := $(shell git describe --dirty --always --tags)
|
||||
APP_VERSION := 0.31
|
||||
APP_VERSION := 0.35
|
||||
TARGET_VERSION := $(APP_VERSION)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "../format.h"
|
||||
#include "fatal_gui.h"
|
||||
#include "labels.h"
|
||||
AppProfileGui::AppProfileGui(std::uint64_t applicationId, SysClkTitleProfileList* profileList)
|
||||
{
|
||||
this->applicationId = applicationId;
|
||||
@@ -50,7 +51,13 @@ void AppProfileGui::openFreqChoiceGui(tsl::elm::ListItem* listItem, SysClkProfil
|
||||
FatalGui::openWithResultCode("sysclkIpcGetFreqList", rc);
|
||||
return;
|
||||
}
|
||||
std::map<uint32_t, std::string> labels = {};
|
||||
|
||||
if (module == SysClkModule_CPU) {
|
||||
labels = IsMariko() ? cpu_freq_label_m : cpu_freq_label_e;
|
||||
} else if (module == SysClkModule_GPU) {
|
||||
labels = IsMariko() ? gpu_freq_label_m : gpu_freq_label_e;
|
||||
}
|
||||
tsl::changeTo<FreqChoiceGui>(this->profileList->mhzMap[profile][module] * 1000000, hzList, hzCount, module, [this, listItem, profile, module](std::uint32_t hz) {
|
||||
this->profileList->mhzMap[profile][module] = hz / 1000000;
|
||||
listItem->setValue(formatListFreqMHz(this->profileList->mhzMap[profile][module]));
|
||||
@@ -62,7 +69,7 @@ void AppProfileGui::openFreqChoiceGui(tsl::elm::ListItem* listItem, SysClkProfil
|
||||
}
|
||||
|
||||
return true;
|
||||
}, true
|
||||
}, true, labels
|
||||
);
|
||||
}
|
||||
|
||||
@@ -282,7 +289,7 @@ void AppProfileGui::addProfileUI(SysClkProfile profile)
|
||||
ValueThresholds lcdThresholds(60, 65);
|
||||
if(!IsHoag() && configList.values[HorizonOCConfigValue_OverwriteRefreshRate]) {
|
||||
if(profile != SysClkProfile_Docked)
|
||||
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", 40, configList.values[HorizonOCConfigValue_EnableUnsafeDisplayFreqs] ? 72 : 60, 1, " Hz", 1, 0, lcdThresholds);
|
||||
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", 40, configList.values[HorizonOCConfigValue_EnableUnsafeDisplayFreqs] ? IsAula() ? 65 : 72 : 60, 1, " Hz", 1, 0, lcdThresholds);
|
||||
else
|
||||
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", 50, 120, 5, " Hz", 1, 0);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// this is a generated file, do not edit manually.
|
||||
// cat.png - 96x128
|
||||
static const unsigned int CAT_WIDTH = 96;
|
||||
static const unsigned int CAT_HEIGHT = 128;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -59,7 +59,6 @@ tsl::elm::ListItem* FreqChoiceGui::createFreqListItem(std::uint32_t hz, bool sel
|
||||
if (selected)
|
||||
text += " \uE14B";
|
||||
|
||||
// NEW: Right-side label
|
||||
std::string rightText = "";
|
||||
auto it = labels.find(hz);
|
||||
if (it != labels.end())
|
||||
@@ -137,9 +136,9 @@ void FreqChoiceGui::listUI()
|
||||
this->configList->values[HocClkConfigValue_EristaMaxCpuClock] < mhz)
|
||||
continue;
|
||||
|
||||
if (moduleName == "gpu" &&
|
||||
this->configList->values[HocClkConfigValue_EristaMaxGpuClock] < mhz)
|
||||
continue;
|
||||
// if (moduleName == "gpu" &&
|
||||
// this->configList->values[HocClkConfigValue_EristaMaxGpuClock] < mhz)
|
||||
// continue;
|
||||
|
||||
// if (moduleName == "mem" &&
|
||||
// this->configList->values[HocClkConfigValue_EristaMaxMemClock] < mhz)
|
||||
@@ -156,16 +155,26 @@ void FreqChoiceGui::listUI()
|
||||
|
||||
if (IsMariko())
|
||||
{
|
||||
unsafe_cpu = 1964;
|
||||
unsafe_gpu = 1076;
|
||||
danger_cpu = 2398;
|
||||
unsafe_cpu = this->configList->values[KipConfigValue_marikoCpuUVHigh] ? 2296 : 1963;
|
||||
if(this->configList->values[KipConfigValue_marikoGpuUV] == 0) {
|
||||
unsafe_gpu = 1076;
|
||||
} else if (this->configList->values[KipConfigValue_marikoGpuUV] == 1) {
|
||||
unsafe_gpu = 1153;
|
||||
} else {
|
||||
unsafe_gpu = 1229;
|
||||
}
|
||||
danger_cpu = this->configList->values[KipConfigValue_marikoCpuUVHigh] ? 2500 : 2398;
|
||||
danger_gpu = 1306;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsafe_cpu = 1786;
|
||||
unsafe_gpu = 922;
|
||||
danger_cpu = 2092;
|
||||
unsafe_cpu = this->configList->values[KipConfigValue_eristaCpuUV] ? 1964 : 1786;
|
||||
if(this->configList->values[KipConfigValue_eristaGpuUV] == 0) {
|
||||
unsafe_gpu = 922;
|
||||
} else {
|
||||
unsafe_gpu = 961;
|
||||
}
|
||||
danger_cpu = this->configList->values[KipConfigValue_eristaCpuUV] ? 2194 : 1964;
|
||||
danger_gpu = 999;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "fatal_gui.h"
|
||||
#include "global_override_gui.h"
|
||||
#include "value_choice_gui.h"
|
||||
|
||||
#include "labels.h"
|
||||
GlobalOverrideGui::GlobalOverrideGui()
|
||||
{
|
||||
for (std::uint16_t m = 0; m < SysClkModule_EnumMax; m++) {
|
||||
@@ -38,6 +38,14 @@ void GlobalOverrideGui::openFreqChoiceGui(SysClkModule module)
|
||||
FatalGui::openWithResultCode("sysclkIpcGetFreqList", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<uint32_t, std::string> labels = {};
|
||||
|
||||
if (module == SysClkModule_CPU) {
|
||||
labels = IsMariko() ? cpu_freq_label_m : cpu_freq_label_e;
|
||||
} else if (module == SysClkModule_GPU) {
|
||||
labels = IsMariko() ? gpu_freq_label_m : gpu_freq_label_e;
|
||||
}
|
||||
tsl::changeTo<FreqChoiceGui>(
|
||||
this->context->overrideFreqs[module], hzList, hzCount, module,
|
||||
[this, module](std::uint32_t hz) {
|
||||
@@ -52,7 +60,8 @@ void GlobalOverrideGui::openFreqChoiceGui(SysClkModule module)
|
||||
|
||||
return true;
|
||||
},
|
||||
true);
|
||||
true, labels
|
||||
);
|
||||
}
|
||||
|
||||
void GlobalOverrideGui::openValueChoiceGui(
|
||||
@@ -283,7 +292,7 @@ void GlobalOverrideGui::listUI()
|
||||
#if IS_MINIMAL == 0
|
||||
ValueThresholds lcdThresholds(60, 65);
|
||||
if(!IsHoag() && configList.values[HorizonOCConfigValue_OverwriteRefreshRate])
|
||||
this->addModuleListItemValue(HorizonOCModule_Display, "Display", 40, configList.values[HorizonOCConfigValue_EnableUnsafeDisplayFreqs] ? 72 : 60, 1, " Hz", 1, 0, lcdThresholds);
|
||||
this->addModuleListItemValue(HorizonOCModule_Display, "Display", 40, configList.values[HorizonOCConfigValue_EnableUnsafeDisplayFreqs] ? IsAula() ? 65 : 72 : 60, 1, " Hz", 1, 0, lcdThresholds);
|
||||
#endif
|
||||
this->addModuleToggleItem(HorizonOCModule_Governor);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
63
Source/sys-clk/overlay/src/ui/gui/labels.cpp
Normal file
63
Source/sys-clk/overlay/src/ui/gui/labels.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 <map>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
std::map<uint32_t, std::string> cpu_freq_label_m = {
|
||||
{612000000, "Sleep Mode"},
|
||||
{1020000000, "Stock"},
|
||||
{1224000000, "Dev OC"},
|
||||
{1785000000, "Boost Mode"},
|
||||
{1963000000, "Safe Max"},
|
||||
{2397000000, "Unsafe Max"},
|
||||
{2703000000, "Absolute Max"},
|
||||
};
|
||||
|
||||
std::map<uint32_t, std::string> cpu_freq_label_e = {
|
||||
{612000000, "Sleep Mode"},
|
||||
{1020000000, "Stock"},
|
||||
{1224000000, "Dev OC"},
|
||||
{1785000000, "Boost Mode & Safe Max"},
|
||||
{2091000000, "Unsafe Max"},
|
||||
{2295000000, "Absolute Max"},
|
||||
};
|
||||
std::map<uint32_t, std::string> gpu_freq_label_e = {
|
||||
{76800000, "Boost Mode"},
|
||||
{307200000, "Handheld"},
|
||||
{345600000, "Handheld"},
|
||||
{384000000, "Handheld"},
|
||||
{422400000, "Handheld"},
|
||||
{460800000, "Handheld Safe Max"},
|
||||
{768000000, "Docked"},
|
||||
{921600000, "Safe Max"},
|
||||
{960000000, "Unsafe Max"},
|
||||
{1075200000, "Aboslute Max"},
|
||||
};
|
||||
|
||||
std::map<uint32_t, std::string> gpu_freq_label_m = {
|
||||
{76800000, "Boost Mode"},
|
||||
{307200000, "Handheld"},
|
||||
{384000000, "Handheld"},
|
||||
{460800000, "Handheld"},
|
||||
{614400000, "Handheld Safe Max"},
|
||||
{768000000, "Docked"},
|
||||
{1075200000, "Safe Max"},
|
||||
{1305600000, "Unsafe Max"},
|
||||
{1536000000, "Aboslute Max"},
|
||||
};
|
||||
26
Source/sys-clk/overlay/src/ui/gui/labels.h
Normal file
26
Source/sys-clk/overlay/src/ui/gui/labels.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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 <map>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
extern std::map<uint32_t, std::string> cpu_freq_label_m;
|
||||
extern std::map<uint32_t, std::string> cpu_freq_label_e;
|
||||
extern std::map<uint32_t, std::string> gpu_freq_label_m;
|
||||
extern std::map<uint32_t, std::string> gpu_freq_label_e;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -23,9 +23,11 @@
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include <notification.h>
|
||||
#include "labels.h"
|
||||
#if IS_MINIMAL == 1
|
||||
#pragma message("Compiling with minimal features")
|
||||
#endif
|
||||
|
||||
class RamSubmenuGui;
|
||||
class RamTimingsSubmenuGui;
|
||||
class RamLatenciesSubmenuGui;
|
||||
@@ -33,25 +35,6 @@ class CpuSubmenuGui;
|
||||
class GpuSubmenuGui;
|
||||
class GpuCustomTableSubmenuGui;
|
||||
|
||||
std::map<uint32_t, std::string> cpu_freq_label_m = {
|
||||
{612000000, "Sleep Mode"},
|
||||
{1020000000, "Stock"},
|
||||
{1224000000, "Dev OC"},
|
||||
{1785000000, "Boost Mode"},
|
||||
{1963000000, "Safe Max"},
|
||||
{2397000000, "Unsafe Max"},
|
||||
{2805000000, "Absolute Max"},
|
||||
};
|
||||
|
||||
std::map<uint32_t, std::string> cpu_freq_label_e = {
|
||||
{612000000, "Sleep Mode"},
|
||||
{1020000000, "Stock"},
|
||||
{1224000000, "Dev OC"},
|
||||
{1785000000, "Boost Mode & Safe Max"},
|
||||
{2091000000, "Unsafe Max"},
|
||||
{2295000000, "Absolute Max"},
|
||||
};
|
||||
|
||||
MiscGui::MiscGui()
|
||||
{
|
||||
this->configList = new SysClkConfigValueList {};
|
||||
@@ -273,9 +256,6 @@ void MiscGui::listUI()
|
||||
addConfigToggle(HocClkConfigValue_EnforceBoardLimit, nullptr);
|
||||
|
||||
#if IS_MINIMAL == 0
|
||||
std::map<uint32_t, std::string> labels_pwr_r = {
|
||||
{8600, "Official Rating"}
|
||||
};
|
||||
std::map<uint32_t, std::string> labels_pwr_l = {
|
||||
{6400, "Official Rating"}
|
||||
};
|
||||
@@ -291,14 +271,13 @@ void MiscGui::listUI()
|
||||
labels_pwr_l
|
||||
);
|
||||
} else {
|
||||
ValueThresholds tdpThresholds(8600, 9500);
|
||||
ValueThresholds tdpThresholds(9600, 11000);
|
||||
addConfigButton(
|
||||
HocClkConfigValue_HandheldTDPLimit,
|
||||
"TDP Threshold",
|
||||
ValueRange(5000, 10000, 100, "mW", 1),
|
||||
ValueRange(8000, 12000, 100, "mW", 1),
|
||||
"Power",
|
||||
&tdpThresholds,
|
||||
labels_pwr_r
|
||||
&tdpThresholds
|
||||
);
|
||||
}
|
||||
|
||||
@@ -459,8 +438,10 @@ protected:
|
||||
|
||||
addConfigToggle(KipConfigValue_hpMode, "HP Mode");
|
||||
|
||||
ValueThresholds eristaRamThresholds(2208000, 2304000);
|
||||
|
||||
std::vector<NamedValue> marikoMaxEmcClock = {
|
||||
NamedValue("1600MHz", 1600000),
|
||||
NamedValue("1600MHz", 1600000, "JEDEC."),
|
||||
NamedValue("1633MHz", 1633000),
|
||||
NamedValue("1666MHz", 1666000),
|
||||
NamedValue("1700MHz", 1700000),
|
||||
@@ -468,17 +449,16 @@ protected:
|
||||
NamedValue("1766MHz", 1766000),
|
||||
NamedValue("1800MHz", 1800000),
|
||||
NamedValue("1833MHz", 1833000),
|
||||
NamedValue("1862MHz", 1862400),
|
||||
NamedValue("1866MHz", 1866000),
|
||||
NamedValue("1866MHz", 1866000, "JEDEC."),
|
||||
NamedValue("1900MHz", 1900000),
|
||||
NamedValue("1933MHz", 1933000),
|
||||
NamedValue("1966MHz", 1966000),
|
||||
NamedValue("1996MHz", 1996800),
|
||||
NamedValue("1996MHz", 1996800, "JEDEC."),
|
||||
NamedValue("2000MHz", 2000000),
|
||||
NamedValue("2033MHz", 2033000),
|
||||
NamedValue("2066MHz", 2066000),
|
||||
NamedValue("2100MHz", 2100000),
|
||||
NamedValue("2133MHz", 2133000),
|
||||
NamedValue("2133MHz", 2133000, "JEDEC."),
|
||||
NamedValue("2166MHz", 2166000),
|
||||
NamedValue("2200MHz", 2200000),
|
||||
NamedValue("2233MHz", 2233000),
|
||||
@@ -486,7 +466,7 @@ protected:
|
||||
NamedValue("2300MHz", 2300000),
|
||||
NamedValue("2333MHz", 2333000),
|
||||
NamedValue("2366MHz", 2366000),
|
||||
NamedValue("2400MHz", 2400000),
|
||||
NamedValue("2400MHz", 2400000, "JEDEC."),
|
||||
NamedValue("2433MHz", 2433000),
|
||||
NamedValue("2466MHz", 2466000),
|
||||
NamedValue("2500MHz", 2500000),
|
||||
@@ -494,7 +474,7 @@ protected:
|
||||
NamedValue("2566MHz", 2566000),
|
||||
NamedValue("2600MHz", 2600000),
|
||||
NamedValue("2633MHz", 2633000),
|
||||
NamedValue("2666MHz", 2666000),
|
||||
NamedValue("2666MHz", 2666000, "JEDEC."),
|
||||
NamedValue("2700MHz", 2700000),
|
||||
NamedValue("2733MHz", 2733000),
|
||||
NamedValue("2766MHz", 2766000),
|
||||
@@ -502,7 +482,7 @@ protected:
|
||||
NamedValue("2833MHz", 2833000),
|
||||
NamedValue("2866MHz", 2866000),
|
||||
NamedValue("2900MHz", 2900000),
|
||||
NamedValue("2933MHz", 2933000),
|
||||
NamedValue("2933MHz", 2933000, "JEDEC."),
|
||||
NamedValue("2966MHz", 2966000),
|
||||
NamedValue("3000MHz", 3000000),
|
||||
NamedValue("3033MHz", 3033000),
|
||||
@@ -510,20 +490,20 @@ protected:
|
||||
NamedValue("3100MHz", 3100000),
|
||||
NamedValue("3133MHz", 3133000),
|
||||
NamedValue("3166MHz", 3166000),
|
||||
NamedValue("3200MHz", 3200000),
|
||||
NamedValue("3233MHz (Needs high Speedo/PLL)", 3233000),
|
||||
NamedValue("3266MHz (Needs high Speedo/PLL)", 3266000),
|
||||
NamedValue("3300MHz (Needs high Speedo/PLL)", 3300000),
|
||||
NamedValue("3333MHz (Needs extreme Speedo/PLL)", 3333000),
|
||||
NamedValue("3366MHz (Needs extreme Speedo/PLL)", 3366000),
|
||||
NamedValue("3400MHz (Needs extreme Speedo/PLL)", 3400000),
|
||||
NamedValue("3433MHz (Needs ridiculous Speedo/PLL)", 3433000),
|
||||
NamedValue("3466MHz (Needs ridiculous Speedo/PLL)", 3466000),
|
||||
NamedValue("3500MHz (Needs ridiculous Speedo/PLL)", 3500000),
|
||||
NamedValue("3200MHz", 3200000, "JEDEC."),
|
||||
NamedValue("3233MHz", 3233000, "High speedo needed!"),
|
||||
NamedValue("3266MHz", 3266000, "High speedo needed!"),
|
||||
NamedValue("3300MHz", 3300000, "High speedo needed!"),
|
||||
// NamedValue("3333MHz (Needs extreme Speedo/PLL)", 3333000),
|
||||
// NamedValue("3366MHz (Needs extreme Speedo/PLL)", 3366000),
|
||||
// NamedValue("3400MHz (Needs extreme Speedo/PLL)", 3400000),
|
||||
// NamedValue("3433MHz (Needs ridiculous Speedo/PLL)", 3433000),
|
||||
// NamedValue("3466MHz (Needs ridiculous Speedo/PLL)", 3466000),
|
||||
// NamedValue("3500MHz (Needs ridiculous Speedo/PLL)", 3500000),
|
||||
};
|
||||
|
||||
std::vector<NamedValue> eristaMaxEmcClock = {
|
||||
NamedValue("1600MHz", 1600000),
|
||||
NamedValue("1600MHz", 1600000, "JEDEC."),
|
||||
NamedValue("1633MHz", 1633000),
|
||||
NamedValue("1666MHz", 1666000),
|
||||
NamedValue("1700MHz", 1700000),
|
||||
@@ -531,32 +511,44 @@ protected:
|
||||
NamedValue("1766MHz", 1766000),
|
||||
NamedValue("1800MHz", 1800000),
|
||||
NamedValue("1833MHz", 1833000),
|
||||
NamedValue("1866MHz", 1866000),
|
||||
NamedValue("1900MHz", 1900000),
|
||||
NamedValue("1933MHz", 1933000),
|
||||
NamedValue("1966MHz", 1966000),
|
||||
NamedValue("2000MHz", 2000000),
|
||||
NamedValue("2033MHz", 2033000),
|
||||
NamedValue("2066MHz", 2066000),
|
||||
NamedValue("2100MHz", 2100000),
|
||||
NamedValue("2133MHz", 2133000),
|
||||
NamedValue("2166MHz", 2166000),
|
||||
NamedValue("2200MHz (high power draw!)", 2200000),
|
||||
NamedValue("2233MHz (high power draw!)", 2233000),
|
||||
NamedValue("2266MHz (high power draw!)", 2266000),
|
||||
NamedValue("2300MHz (high power draw!)", 2300000),
|
||||
NamedValue("2333MHz (high power draw!)", 2333000),
|
||||
NamedValue("2366MHz (high power draw!)", 2366000),
|
||||
NamedValue("2400MHz (high power draw!)", 2400000),
|
||||
NamedValue("1862MHz", 1862400, "JEDEC."),
|
||||
NamedValue("1881MHz", 1881600),
|
||||
NamedValue("1900MHz", 1900800),
|
||||
NamedValue("1920MHz", 1920000),
|
||||
NamedValue("1939MHz", 1939200),
|
||||
NamedValue("1958MHz", 1958400),
|
||||
NamedValue("1977MHz", 1977600),
|
||||
NamedValue("1996MHz", 1996800, "JEDEC."),
|
||||
NamedValue("2016MHz", 2016000),
|
||||
NamedValue("2035MHz", 2035200),
|
||||
NamedValue("2054MHz", 2054400),
|
||||
NamedValue("2073MHz", 2073600),
|
||||
NamedValue("2092MHz", 2092800),
|
||||
NamedValue("2112MHz", 2112000),
|
||||
NamedValue("2131MHz", 2131200, "JEDEC."),
|
||||
NamedValue("2150MHz", 2150400),
|
||||
NamedValue("2169MHz", 2169600),
|
||||
NamedValue("2188MHz", 2188800),
|
||||
NamedValue("2208MHz", 2208000),
|
||||
NamedValue("2227MHz", 2227200),
|
||||
NamedValue("2246MHz", 2246400),
|
||||
NamedValue("2265MHz", 2265600),
|
||||
NamedValue("2284MHz", 2284800),
|
||||
NamedValue("2304MHz", 2304000),
|
||||
NamedValue("2323MHz", 2323200),
|
||||
NamedValue("2342MHz", 2342400),
|
||||
NamedValue("2361MHz", 2361600),
|
||||
NamedValue("2380MHz", 2380800),
|
||||
NamedValue("2400MHz", 2400000, "JEDEC."),
|
||||
};
|
||||
|
||||
if(IsErista()) {
|
||||
addConfigButton(
|
||||
KipConfigValue_eristaEmcMaxClock,
|
||||
"EMC Max Clock",
|
||||
"RAM Max Clock",
|
||||
ValueRange(0, 1, 1, "", 1),
|
||||
"EMC Max Clock",
|
||||
&thresholdsDisabled,
|
||||
"RAM Max Clock",
|
||||
&eristaRamThresholds,
|
||||
{},
|
||||
eristaMaxEmcClock,
|
||||
false
|
||||
@@ -564,9 +556,9 @@ protected:
|
||||
} else {
|
||||
addConfigButton(
|
||||
KipConfigValue_marikoEmcMaxClock,
|
||||
"EMC Max Clock",
|
||||
"RAM Max Clock",
|
||||
ValueRange(0, 1, 1, "", 1),
|
||||
"EMC Max Clock",
|
||||
"RAM Max Clock",
|
||||
&thresholdsDisabled,
|
||||
{},
|
||||
marikoMaxEmcClock,
|
||||
@@ -586,7 +578,7 @@ protected:
|
||||
ValueThresholds vdd2Thresholds(1212500, 1250000);
|
||||
addConfigButton(
|
||||
KipConfigValue_commonEmcMemVolt,
|
||||
"EMC VDD2 Voltage",
|
||||
"RAM VDD2 Voltage",
|
||||
ValueRange(912500, 1350000, 12500, "mV", 1000, 1),
|
||||
"Voltage",
|
||||
&vdd2Thresholds,
|
||||
@@ -598,9 +590,9 @@ protected:
|
||||
if(IsMariko()) {
|
||||
addConfigButton(
|
||||
KipConfigValue_marikoEmcVddqVolt,
|
||||
"EMC VDDQ Voltage",
|
||||
"RAM VDDQ Voltage",
|
||||
ValueRange(550000, 700000, 5000, "mV", 1000),
|
||||
"EMC VDDQ Voltage",
|
||||
"RAM VDDQ Voltage",
|
||||
&thresholdsDisabled,
|
||||
{},
|
||||
{},
|
||||
@@ -610,16 +602,16 @@ protected:
|
||||
|
||||
addConfigButton(
|
||||
KipConfigValue_emcDvbShift,
|
||||
"DVB Shift",
|
||||
"SoC DVB Shift",
|
||||
ValueRange(0, 10, 1, "", 1),
|
||||
"DVB Shift",
|
||||
"SoC DVB Shift",
|
||||
&thresholdsDisabled,
|
||||
{},
|
||||
{},
|
||||
false
|
||||
);
|
||||
|
||||
tsl::elm::ListItem* timingsSubmenu = new tsl::elm::ListItem("Memory Timings");
|
||||
tsl::elm::ListItem* timingsSubmenu = new tsl::elm::ListItem("RAM Timing Reductions");
|
||||
timingsSubmenu->setClickListener([](u64 keys) {
|
||||
if (keys & HidNpadButton_A) {
|
||||
tsl::changeTo<RamTimingsSubmenuGui>();
|
||||
@@ -629,7 +621,7 @@ protected:
|
||||
});
|
||||
this->listElement->addItem(timingsSubmenu);
|
||||
|
||||
tsl::elm::ListItem* latenciesSubmenu = new tsl::elm::ListItem("Memory Latencies");
|
||||
tsl::elm::ListItem* latenciesSubmenu = new tsl::elm::ListItem("RAM Latencies");
|
||||
latenciesSubmenu->setClickListener([](u64 keys) {
|
||||
if (keys & HidNpadButton_A) {
|
||||
tsl::changeTo<RamLatenciesSubmenuGui>();
|
||||
@@ -659,33 +651,49 @@ protected:
|
||||
addConfigButton(KipConfigValue_t6_tRTW, "t6 tRTW", ValueRange(0, 10, 1, "", 1), "tRTW", &thresholdsDisabled, {}, {}, false);
|
||||
addConfigButton(KipConfigValue_t7_tWTR, "t7 tWTR", ValueRange(0, 10, 1, "", 1), "tWTR", &thresholdsDisabled, {}, {}, false);
|
||||
addConfigButton(KipConfigValue_t8_tREFI, "t8 tREFI", ValueRange(0, 6, 1, "", 1), "tREFI", &thresholdsDisabled, {}, {}, false);
|
||||
#if IS_MINIMAL == 0
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("Experimental"));
|
||||
|
||||
tsl::elm::ListItem* emcUpdBtn = new tsl::elm::ListItem("Update RAM Timings");
|
||||
emcUpdBtn->setClickListener([this](u64 keys) {
|
||||
if (keys & HidNpadButton_A) {
|
||||
if(this->context->freqs[SysClkModule_MEM] > 1600000000) {
|
||||
Result rc = hocClkIpcUpdateEmcRegs();
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("hocClkIpcUpdateEmcRegs", rc);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
writeNotification("Horizon OC\nSet your ram frequency to max\nbefore applying timings!");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
this->listElement->addItem(emcUpdBtn);
|
||||
tsl::elm::CustomDrawer* warningText = new tsl::elm::CustomDrawer([](tsl::gfx::Renderer *renderer, s32 x, s32 y, s32 w, s32 h) {
|
||||
renderer->drawString("\uE150 This feature is EXPERIMENTAL", false, x + 20, y + 30, 18, tsl::style::color::ColorText);
|
||||
renderer->drawString("and should only be used for testing!", false, x + 20, y + 50, 18, tsl::style::color::ColorText);
|
||||
});
|
||||
warningText->setBoundaries(0, 0, tsl::cfg::FramebufferWidth, 70);
|
||||
this->listElement->addItem(warningText);
|
||||
std::vector<NamedValue> t7_tWTR_fine_tune = {
|
||||
NamedValue("-3", 0xFFFFFFFD),
|
||||
NamedValue("-2", 0xFFFFFFFE),
|
||||
NamedValue("-1", 0xFFFFFFFF),
|
||||
NamedValue(" 0", 0),
|
||||
NamedValue("+1", 1),
|
||||
NamedValue("+2", 2),
|
||||
NamedValue("+3", 3),
|
||||
};
|
||||
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("Advanced"));
|
||||
addConfigButton(KipConfigValue_t7_tWTR_fine_tune, "t7 tWTR Fine Tune", ValueRange(0, 6, 1, "", 0), "t7 tWTR Fine Tune", &thresholdsDisabled, {}, t7_tWTR_fine_tune, false);
|
||||
|
||||
#if IS_MINIMAL == 0
|
||||
if(IsMariko()) {
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("Experimental"));
|
||||
|
||||
tsl::elm::ListItem* emcUpdBtn = new tsl::elm::ListItem("Update RAM Timings");
|
||||
emcUpdBtn->setClickListener([this](u64 keys) {
|
||||
if (keys & HidNpadButton_A) {
|
||||
if(this->context->freqs[SysClkModule_MEM] > 1600000000) {
|
||||
Result rc = hocClkIpcUpdateEmcRegs();
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("hocClkIpcUpdateEmcRegs", rc);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
writeNotification("Horizon OC\nSet your ram frequency to max\nbefore applying timings!");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
this->listElement->addItem(emcUpdBtn);
|
||||
tsl::elm::CustomDrawer* warningText = new tsl::elm::CustomDrawer([](tsl::gfx::Renderer *renderer, s32 x, s32 y, s32 w, s32 h) {
|
||||
renderer->drawString("\uE150 This feature is EXPERIMENTAL", false, x + 20, y + 30, 18, tsl::style::color::ColorText);
|
||||
renderer->drawString("and should only be used for testing!", false, x + 20, y + 50, 18, tsl::style::color::ColorText);
|
||||
});
|
||||
warningText->setBoundaries(0, 0, tsl::cfg::FramebufferWidth, 70);
|
||||
this->listElement->addItem(warningText);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
@@ -701,17 +709,17 @@ protected:
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("Memory Latencies"));
|
||||
|
||||
std::vector<NamedValue> rlLabels = {
|
||||
NamedValue("1333RL", 28),
|
||||
NamedValue("1600RL", 32),
|
||||
NamedValue("1866RL", 36),
|
||||
NamedValue("2133RL", 40)
|
||||
NamedValue("1333 RL", 28),
|
||||
NamedValue("1600 RL", 32),
|
||||
NamedValue("1866 RL", 36),
|
||||
NamedValue("2133 RL", 40)
|
||||
};
|
||||
|
||||
std::vector<NamedValue> wlLabels = {
|
||||
NamedValue("1333WL", 12),
|
||||
NamedValue("1600WL", 14),
|
||||
NamedValue("1866WL", 16),
|
||||
NamedValue("2133WL", 18)
|
||||
NamedValue("1333 WL", 12),
|
||||
NamedValue("1600 WL", 14),
|
||||
NamedValue("1866 WL", 16),
|
||||
NamedValue("2133 WL", 18)
|
||||
};
|
||||
|
||||
addConfigButton(
|
||||
@@ -747,11 +755,51 @@ protected:
|
||||
ValueThresholds thresholdsDisabled(0, 0);
|
||||
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("CPU Settings"));
|
||||
if(IsMariko())
|
||||
addFreqButton(KipConfigValue_marikoCpuBoostClock, nullptr, SysClkModule_CPU, cpu_freq_label_m);
|
||||
else
|
||||
addFreqButton(KipConfigValue_eristaCpuBoostClock, nullptr, SysClkModule_CPU, cpu_freq_label_e);
|
||||
|
||||
if(IsMariko()) {
|
||||
std::vector<NamedValue> ClkOptions = {
|
||||
NamedValue("1785 MHz", 1785000),
|
||||
NamedValue("1887 MHz", 1887000),
|
||||
NamedValue("1963 MHz", 1963000),
|
||||
NamedValue("2091 MHz", 2091000),
|
||||
NamedValue("2193 MHz", 2193000),
|
||||
NamedValue("2295 MHz", 2295000),
|
||||
NamedValue("2397 MHz", 2397000),
|
||||
NamedValue("2499 MHz", 2499000),
|
||||
NamedValue("2601 MHz", 2601000),
|
||||
NamedValue("2703 MHz", 2703000),
|
||||
};
|
||||
ValueThresholds mCpuClockThresholds(1963000, 2397000);
|
||||
addConfigButton(
|
||||
KipConfigValue_marikoCpuBoostClock,
|
||||
"CPU Boost Clock",
|
||||
ValueRange(0, 0, 1, "", 1),
|
||||
"CPU Boost Clock",
|
||||
&mCpuClockThresholds,
|
||||
{},
|
||||
ClkOptions,
|
||||
false
|
||||
);
|
||||
} else {
|
||||
std::vector<NamedValue> ClkOptionsE = {
|
||||
NamedValue("1785 MHz", 1785000),
|
||||
NamedValue("1887 MHz", 1887000),
|
||||
NamedValue("1963 MHz", 1963000),
|
||||
NamedValue("2091 MHz", 2091000),
|
||||
NamedValue("2193 MHz", 2193000),
|
||||
NamedValue("2295 MHz", 2295000),
|
||||
};
|
||||
ValueThresholds eCpuClockThresholds(1785000, 2091000);
|
||||
addConfigButton(
|
||||
KipConfigValue_eristaCpuBoostClock,
|
||||
"CPU Boost Clock",
|
||||
ValueRange(0, 0, 1, "", 1),
|
||||
"CPU Boost Clock",
|
||||
&eCpuClockThresholds,
|
||||
{},
|
||||
ClkOptionsE,
|
||||
false
|
||||
);
|
||||
}
|
||||
if(IsErista()) {
|
||||
addConfigButton(
|
||||
KipConfigValue_eristaCpuUV,
|
||||
@@ -826,6 +874,8 @@ protected:
|
||||
);
|
||||
|
||||
std::vector<NamedValue> maxClkOptions = {
|
||||
NamedValue("1785 MHz", 1785000),
|
||||
NamedValue("1887 MHz", 1887000),
|
||||
NamedValue("1963 MHz", 1963000),
|
||||
NamedValue("2091 MHz", 2091000),
|
||||
NamedValue("2193 MHz", 2193000),
|
||||
@@ -896,13 +946,13 @@ protected:
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("GPU Settings"));
|
||||
|
||||
std::vector<NamedValue> gpuUvConf = {
|
||||
NamedValue("No UV", 0),
|
||||
NamedValue("No Undervolt", 0),
|
||||
NamedValue("SLT Table", 1),
|
||||
NamedValue("HiOPT Table", 2),
|
||||
};
|
||||
|
||||
std::vector<NamedValue> mGpuVoltsVmin = {
|
||||
NamedValue("Auto", 0),
|
||||
NamedValue("Auto", 0), NamedValue("Auto (RAM)", 1),
|
||||
NamedValue("480mV", 480), NamedValue("485mV", 485), NamedValue("490mV", 490),
|
||||
NamedValue("495mV", 495), NamedValue("500mV", 500), NamedValue("505mV", 505),
|
||||
NamedValue("510mV", 510), NamedValue("515mV", 515), NamedValue("520mV", 520),
|
||||
@@ -940,9 +990,9 @@ protected:
|
||||
);
|
||||
addConfigButton(
|
||||
KipConfigValue_eristaGpuVmin,
|
||||
"GPU VMIN",
|
||||
"GPU Minimum Voltage",
|
||||
ValueRange(700, 875, 5, "mV", 1),
|
||||
"GPU VMIN",
|
||||
"GPU Minimum Voltage",
|
||||
&thresholdsDisabled,
|
||||
{},
|
||||
{},
|
||||
@@ -977,9 +1027,9 @@ protected:
|
||||
ValueThresholds MgpuVmaxThresholds(800, 850);
|
||||
addConfigButton(
|
||||
KipConfigValue_marikoGpuVmax,
|
||||
"GPU VMAX",
|
||||
"GPU Maximum Voltage",
|
||||
ValueRange(750, 960, 5, "mV", 1),
|
||||
"GPU VMAX",
|
||||
"GPU Maximum Voltage",
|
||||
&MgpuVmaxThresholds,
|
||||
{},
|
||||
{},
|
||||
@@ -989,9 +1039,9 @@ protected:
|
||||
|
||||
addConfigButton(
|
||||
KipConfigValue_commonGpuVoltOffset,
|
||||
"GPU Volt Offset",
|
||||
"GPU Voltage Offset",
|
||||
ValueRange(0, 50, 5, "mV", 1),
|
||||
"GPU Volt Offset",
|
||||
"GPU Voltage Offset",
|
||||
&thresholdsDisabled,
|
||||
{},
|
||||
{},
|
||||
@@ -1016,6 +1066,13 @@ public:
|
||||
|
||||
protected:
|
||||
void listUI() override {
|
||||
|
||||
Result rc = sysclkIpcGetConfigValues(this->configList); // populate config list early otherwise wont work
|
||||
if (R_FAILED(rc)) [[unlikely]] {
|
||||
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("GPU Custom Table (mV)"));
|
||||
|
||||
ValueThresholds MgpuVmaxThresholds(800, 850);
|
||||
@@ -1146,7 +1203,7 @@ protected:
|
||||
};
|
||||
|
||||
if (IsMariko()) {
|
||||
|
||||
|
||||
tsl::elm::CustomDrawer* warningText = new tsl::elm::CustomDrawer([](tsl::gfx::Renderer *renderer, s32 x, s32 y, s32 w, s32 h) {
|
||||
renderer->drawString("\uE150 Setting GPU Clocks past", false, x + 20, y + 30, 18, tsl::style::color::ColorText);
|
||||
renderer->drawString("1075MHz without UV, 1152MHz on SLT", false, x + 20, y + 50, 18, tsl::style::color::ColorText);
|
||||
@@ -1171,16 +1228,20 @@ protected:
|
||||
addConfigButton(KipConfigValue_g_volt_921600, "921.6MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_998400, "998.4MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1075200, "1075.2MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1152000, "1152.0MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1228800, "1228.8MHz (SLT/HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1267200, "1267.2MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1305600, "1305.6MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1344000, "1344.0MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1382400, "1382.4MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1420800, "1420.8MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1459200, "1459.2MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1497600, "1497.6MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1536000, "1536.0MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
|
||||
if(this->configList->values[KipConfigValue_marikoGpuUV] >= GPUUVLevel_SLT)
|
||||
addConfigButton(KipConfigValue_g_volt_1152000, "1152.0MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
|
||||
if(this->configList->values[KipConfigValue_marikoGpuUV] >= GPUUVLevel_HiOPT) {
|
||||
addConfigButton(KipConfigValue_g_volt_1228800, "1228.8MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1267200, "1267.2MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1305600, "1305.6MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1344000, "1344.0MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1382400, "1382.4MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1420800, "1420.8MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1459200, "1459.2MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1497600, "1497.6MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
|
||||
addConfigButton(KipConfigValue_g_volt_1536000, "1536.0MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
tsl::elm::CustomDrawer* warningText = new tsl::elm::CustomDrawer([](tsl::gfx::Renderer *renderer, s32 x, s32 y, s32 w, s32 h) {
|
||||
@@ -1216,10 +1277,13 @@ protected:
|
||||
addConfigButton(KipConfigValue_g_volt_e_844800, "844.8MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_e_883200, "883.2MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_e_921600, "921.6MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_e_960000, "960.0MHz (SLT/HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_e_998400, "998.4MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_e_1036800, "1036.8MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts_noAuto, false);
|
||||
addConfigButton(KipConfigValue_g_volt_e_1075200, "1075.2MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts_noAuto, false);
|
||||
if(this->configList->values[KipConfigValue_eristaGpuUV] >= GPUUVLevel_SLT)
|
||||
addConfigButton(KipConfigValue_g_volt_e_960000, "960.0MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false);
|
||||
if(this->configList->values[KipConfigValue_eristaGpuUV] >= GPUUVLevel_HiOPT) {
|
||||
addConfigButton(KipConfigValue_g_volt_e_998400, "998.4MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false);
|
||||
addConfigButton(KipConfigValue_g_volt_e_1036800, "1036.8MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts_noAuto, false);
|
||||
addConfigButton(KipConfigValue_g_volt_e_1075200, "1075.2MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts_noAuto, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "sys:clk",
|
||||
"name": "hoc:clk",
|
||||
"title_id": "0x00FF0000636C6BFF",
|
||||
"title_id_range_min": "0x00FF0000636C6BFF",
|
||||
"title_id_range_max": "0x00FF0000636C6BFF",
|
||||
@@ -18,7 +18,7 @@
|
||||
"*"
|
||||
],
|
||||
"service_host": [
|
||||
"sys:clk"
|
||||
"hoc:clk"
|
||||
],
|
||||
"kernel_capabilities": [
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -766,7 +766,7 @@ std::uint32_t Board::GetPartLoad(SysClkPartLoad loadSource)
|
||||
return idletick0;
|
||||
case HocClkPartLoad_BAT:
|
||||
batteryInfoGetChargeInfo(&info);
|
||||
return info.BatteryAge;
|
||||
return info.RawBatteryCharge;
|
||||
case HocClkPartLoad_FAN:
|
||||
return fanLevel;
|
||||
default:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <display_refresh_rate.h>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <crc32.h>
|
||||
|
||||
#define HOSPPC_HAS_BOOST (hosversionAtLeast(7,0,0))
|
||||
bool isGovernorEnabled = false; // to avoid thread messes
|
||||
@@ -46,7 +47,6 @@ bool hasChanged = true;
|
||||
ClockManager *ClockManager::instance = NULL;
|
||||
Thread governorTHREAD;
|
||||
u32 initialConfigValues[SysClkConfigValue_EnumMax]; // initial config. used for safety checks
|
||||
bool writeBootConfigValues = true; // do we write the initial config values?
|
||||
|
||||
bool kipAvailable = false;
|
||||
ClockManager *ClockManager::GetInstance()
|
||||
@@ -114,37 +114,40 @@ ClockManager::ClockManager()
|
||||
|
||||
|
||||
void ClockManager::FixCpuBug() {
|
||||
u32 targetHz = 0;
|
||||
u32 maxHz = 0;
|
||||
u32 nearestHz = 0;
|
||||
if(this->config->Refresh() && this->RefreshContext()) {
|
||||
u32 targetHz = 0;
|
||||
u32 maxHz = 0;
|
||||
u32 nearestHz = 0;
|
||||
|
||||
ResetToStockClocks();
|
||||
// ResetToStockClocks();
|
||||
|
||||
targetHz = this->context->overrideFreqs[SysClkModule_CPU];
|
||||
if (!targetHz) {
|
||||
targetHz = this->config->GetAutoClockHz(this->context->applicationId, SysClkModule_CPU, this->context->profile, false);
|
||||
if(!targetHz)
|
||||
targetHz = this->config->GetAutoClockHz(GLOBAL_PROFILE_ID, SysClkModule_CPU, this->context->profile, false);
|
||||
}
|
||||
targetHz = this->context->overrideFreqs[SysClkModule_CPU];
|
||||
if (!targetHz) {
|
||||
targetHz = this->config->GetAutoClockHz(this->context->applicationId, SysClkModule_CPU, this->context->profile, false);
|
||||
if(!targetHz)
|
||||
targetHz = this->config->GetAutoClockHz(GLOBAL_PROFILE_ID, SysClkModule_CPU, this->context->profile, false);
|
||||
}
|
||||
|
||||
if (targetHz) {
|
||||
maxHz = this->GetMaxAllowedHz(SysClkModule_CPU, this->context->profile);
|
||||
nearestHz = this->GetNearestHz(SysClkModule_CPU, targetHz, maxHz);
|
||||
if (targetHz) {
|
||||
maxHz = this->GetMaxAllowedHz(SysClkModule_CPU, this->context->profile);
|
||||
nearestHz = this->GetNearestHz(SysClkModule_CPU, targetHz, maxHz);
|
||||
|
||||
while ((nearestHz = this->GetNearestHz(SysClkModule_CPU, targetHz, maxHz)) != targetHz) {
|
||||
Board::SetHz(SysClkModule_CPU, 1020000000);
|
||||
svcSleepThread(2'500'000);
|
||||
Board::SetHz(SysClkModule_CPU, nearestHz);
|
||||
this->context->freqs[SysClkModule_CPU] = nearestHz;
|
||||
while ((nearestHz = this->GetNearestHz(SysClkModule_CPU, targetHz, maxHz)) != targetHz) {
|
||||
Board::SetHz(SysClkModule_CPU, 1020000000);
|
||||
svcSleepThread(1'000'000);
|
||||
Board::SetHz(SysClkModule_CPU, maxHz);
|
||||
this->context->freqs[SysClkModule_CPU] = maxHz;
|
||||
}
|
||||
Board::SetHz(SysClkModule_CPU, targetHz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ClockManager::~ClockManager()
|
||||
{
|
||||
threadClose(&governorTHREAD);
|
||||
delete this->config;
|
||||
delete this->context;
|
||||
threadClose(&governorTHREAD);
|
||||
}
|
||||
|
||||
SysClkContext ClockManager::GetCurrentContext()
|
||||
@@ -181,7 +184,7 @@ bool ClockManager::IsAssignableHz(SysClkModule module, std::uint32_t hz)
|
||||
switch (module)
|
||||
{
|
||||
case SysClkModule_CPU:
|
||||
return hz >= 400000000;
|
||||
return hz >= 500000000;
|
||||
case SysClkModule_MEM:
|
||||
return hz >= 665600000;
|
||||
default:
|
||||
@@ -205,14 +208,45 @@ std::uint32_t ClockManager::GetMaxAllowedHz(SysClkModule module, SysClkProfile p
|
||||
case SysClkSocType_Erista:
|
||||
return 460800000;
|
||||
case SysClkSocType_Mariko:
|
||||
return 614400000;
|
||||
switch(this->config->GetConfigValue(KipConfigValue_marikoGpuUV)) {
|
||||
case 0:
|
||||
return 614400000;
|
||||
case 1:
|
||||
return 691200000;
|
||||
case 2:
|
||||
return 768000000;
|
||||
default:
|
||||
return 614400000;
|
||||
}
|
||||
default:
|
||||
return 4294967294;
|
||||
return 460800000;
|
||||
}
|
||||
}
|
||||
else if (profile <= SysClkProfile_HandheldChargingUSB)
|
||||
{
|
||||
return 768000000;
|
||||
switch(Board::GetSocType()) {
|
||||
case SysClkSocType_Erista:
|
||||
return 768000000;
|
||||
case SysClkSocType_Mariko:
|
||||
switch(this->config->GetConfigValue(KipConfigValue_marikoGpuUV)) {
|
||||
case 0:
|
||||
return 844800000;
|
||||
case 1:
|
||||
return 921600000;
|
||||
case 2:
|
||||
return 998400000;
|
||||
default:
|
||||
return 844800000;
|
||||
}
|
||||
default:
|
||||
return 768000000;
|
||||
}
|
||||
}
|
||||
} else if(module == SysClkModule_CPU) {
|
||||
if(profile < SysClkProfile_HandheldCharging && Board::GetSocType() == SysClkSocType_Erista) {
|
||||
return 1581000000;
|
||||
} else {
|
||||
return 4294967294;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -315,7 +349,6 @@ void ClockManager::GovernorThread(void* arg)
|
||||
continue;
|
||||
}
|
||||
|
||||
std::scoped_lock lock{mgr->contextMutex};
|
||||
|
||||
if (!isGovernorEnabled)
|
||||
{
|
||||
@@ -330,6 +363,8 @@ void ClockManager::GovernorThread(void* arg)
|
||||
continue;
|
||||
}
|
||||
|
||||
std::scoped_lock lock{mgr->contextMutex};
|
||||
|
||||
u32 currentHz = Board::GetHz(SysClkModule_GPU);
|
||||
|
||||
u32 index = 0;
|
||||
@@ -416,12 +451,12 @@ void ClockManager::Tick()
|
||||
|
||||
if(this->config->GetConfigValue(HocClkConfigValue_HandheldTDP) && opMode == AppletOperationMode_Handheld) {
|
||||
if(Board::GetConsoleType() == HorizonOCConsoleType_Hoag) {
|
||||
if(Board::GetPowerMw(SysClkPowerSensor_Now) < -(int)this->config->GetConfigValue(HocClkConfigValue_LiteTDPLimit)) {
|
||||
if(Board::GetPowerMw(SysClkPowerSensor_Avg) < -(int)this->config->GetConfigValue(HocClkConfigValue_LiteTDPLimit)) {
|
||||
ResetToStockClocks();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if(Board::GetPowerMw(SysClkPowerSensor_Now) < -(int)this->config->GetConfigValue(HocClkConfigValue_HandheldTDPLimit)) {
|
||||
if(Board::GetPowerMw(SysClkPowerSensor_Avg) < -(int)this->config->GetConfigValue(HocClkConfigValue_HandheldTDPLimit)) {
|
||||
ResetToStockClocks();
|
||||
return;
|
||||
}
|
||||
@@ -440,7 +475,9 @@ void ClockManager::Tick()
|
||||
return;
|
||||
}
|
||||
bool isBoost = apmExtIsBoostMode(mode);
|
||||
|
||||
// if(isBoost) {
|
||||
// Board::SetHz(SysClkModule_CPU, Board::GetSocType() == SysClkSocType_Mariko ? this->config->GetConfigValue(HocClkConfigValue_MarikoBoostCpuClock) * 1000'000 : this->config->GetConfigValue(HocClkConfigValue_EristaBoostCpuClock) * 1000'000);
|
||||
// }
|
||||
prevBoostMode = isBoost;
|
||||
|
||||
bool noGPU = false;
|
||||
@@ -455,9 +492,10 @@ void ClockManager::Tick()
|
||||
std::uint32_t nearestHz = 0;
|
||||
|
||||
if(apmExtIsBoostMode(mode) && !this->config->GetConfigValue(HocClkConfigValue_OverwriteBoostMode)) {
|
||||
ResetToStockClocks();
|
||||
// ResetToStockClocks();
|
||||
return;
|
||||
}
|
||||
|
||||
bool returnRaw = false;
|
||||
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++)
|
||||
{
|
||||
@@ -549,6 +587,10 @@ bool ClockManager::RefreshContext()
|
||||
{
|
||||
bool hasChanged = false;
|
||||
|
||||
std::uint32_t mode = 0;
|
||||
Result rc = apmExtGetCurrentPerformanceConfiguration(&mode);
|
||||
ASSERT_RESULT_OK(rc, "apmExtGetCurrentPerformanceConfiguration");
|
||||
|
||||
std::uint64_t applicationId = ProcessManagement::GetCurrentApplicationId();
|
||||
if (applicationId != this->context->applicationId)
|
||||
{
|
||||
@@ -598,7 +640,8 @@ bool ClockManager::RefreshContext()
|
||||
switch (module)
|
||||
{
|
||||
case SysClkModule_CPU:
|
||||
Board::ResetToStockCpu();
|
||||
if(!(apmExtIsBoostMode(mode) || (this->config->GetConfigValue(HocClkConfigValue_OverwriteBoostMode) && apmExtIsBoostMode(mode))))
|
||||
Board::ResetToStockCpu();
|
||||
break;
|
||||
case SysClkModule_GPU:
|
||||
Board::ResetToStockGpu();
|
||||
@@ -670,10 +713,7 @@ bool ClockManager::RefreshContext()
|
||||
FileUtils::WriteContextToCsv(this->context);
|
||||
}
|
||||
|
||||
if(this->context->profile == SysClkProfile_Docked && Board::GetConsoleType() != HorizonOCConsoleType_Hoag)
|
||||
this->context->maxDisplayFreq = Board::GetHighestDockedDisplayRate();
|
||||
else
|
||||
this->context->maxDisplayFreq = 60;
|
||||
this->context->maxDisplayFreq = Board::GetHighestDockedDisplayRate();
|
||||
|
||||
u32 targetHz = this->context->overrideFreqs[HorizonOCModule_Display];
|
||||
if (!targetHz)
|
||||
@@ -723,7 +763,7 @@ void ClockManager::SetKipData() {
|
||||
}
|
||||
|
||||
CUST_WRITE_FIELD_BATCH(&table, custRev, this->config->GetConfigValue(KipConfigValue_custRev));
|
||||
CUST_WRITE_FIELD_BATCH(&table, mtcConf, this->config->GetConfigValue(KipConfigValue_mtcConf));
|
||||
// CUST_WRITE_FIELD_BATCH(&table, mtcConf, this->config->GetConfigValue(KipConfigValue_mtcConf));
|
||||
CUST_WRITE_FIELD_BATCH(&table, hpMode, this->config->GetConfigValue(KipConfigValue_hpMode));
|
||||
|
||||
CUST_WRITE_FIELD_BATCH(&table, commonEmcMemVolt, this->config->GetConfigValue(KipConfigValue_commonEmcMemVolt));
|
||||
@@ -742,7 +782,6 @@ void ClockManager::SetKipData() {
|
||||
CUST_WRITE_FIELD_BATCH(&table, t8_tREFI, this->config->GetConfigValue(KipConfigValue_t8_tREFI));
|
||||
CUST_WRITE_FIELD_BATCH(&table, mem_burst_read_latency, this->config->GetConfigValue(KipConfigValue_mem_burst_read_latency));
|
||||
CUST_WRITE_FIELD_BATCH(&table, mem_burst_write_latency, this->config->GetConfigValue(KipConfigValue_mem_burst_write_latency));
|
||||
|
||||
CUST_WRITE_FIELD_BATCH(&table, eristaCpuUV, this->config->GetConfigValue(KipConfigValue_eristaCpuUV));
|
||||
CUST_WRITE_FIELD_BATCH(&table, eristaCpuVmin, this->config->GetConfigValue(KipConfigValue_eristaCpuVmin));
|
||||
CUST_WRITE_FIELD_BATCH(&table, eristaCpuMaxVolt, this->config->GetConfigValue(KipConfigValue_eristaCpuMaxVolt));
|
||||
@@ -754,10 +793,10 @@ void ClockManager::SetKipData() {
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoCpuLowVmin, this->config->GetConfigValue(KipConfigValue_marikoCpuLowVmin));
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoCpuHighVmin, this->config->GetConfigValue(KipConfigValue_marikoCpuHighVmin));
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoCpuMaxVolt, this->config->GetConfigValue(KipConfigValue_marikoCpuMaxVolt));
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoCpuMaxClock, this->config->GetConfigValue(KipConfigValue_marikoCpuMaxClock) * 1000);
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoCpuMaxClock, this->config->GetConfigValue(KipConfigValue_marikoCpuMaxClock));
|
||||
|
||||
CUST_WRITE_FIELD_BATCH(&table, eristaCpuBoostClock, this->config->GetConfigValue(KipConfigValue_eristaCpuBoostClock) * 1000);
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoCpuBoostClock, this->config->GetConfigValue(KipConfigValue_marikoCpuBoostClock) * 1000);
|
||||
CUST_WRITE_FIELD_BATCH(&table, eristaCpuBoostClock, this->config->GetConfigValue(KipConfigValue_eristaCpuBoostClock));
|
||||
CUST_WRITE_FIELD_BATCH(&table, marikoCpuBoostClock, this->config->GetConfigValue(KipConfigValue_marikoCpuBoostClock));
|
||||
|
||||
CUST_WRITE_FIELD_BATCH(&table, eristaGpuUV, this->config->GetConfigValue(KipConfigValue_eristaGpuUV));
|
||||
CUST_WRITE_FIELD_BATCH(&table, eristaGpuVmin, this->config->GetConfigValue(KipConfigValue_eristaGpuVmin));
|
||||
@@ -777,10 +816,24 @@ void ClockManager::SetKipData() {
|
||||
table.eristaGpuVoltArray[i] = this->config->GetConfigValue((SysClkConfigValue)(KipConfigValue_g_volt_e_76800 + i));
|
||||
}
|
||||
|
||||
CUST_WRITE_FIELD_BATCH(&table, t7_tWTR_fine_tune, this->config->GetConfigValue(KipConfigValue_t7_tWTR_fine_tune));
|
||||
|
||||
if (!cust_write_table("sdmc:/atmosphere/kips/hoc.kip", &table)) {
|
||||
FileUtils::LogLine("[clock_manager] Failed to write KIP file");
|
||||
writeNotification("Horizon OC\nKip write failed");
|
||||
}
|
||||
|
||||
SysClkConfigValueList configValues;
|
||||
this->config->GetConfigValues(&configValues);
|
||||
|
||||
configValues.values[KipCrc32] = (u64)checksum_file("sdmc:/atmosphere/kips/hoc.kip"); // write checksum
|
||||
|
||||
if (this->config->SetConfigValues(&configValues, false)) {
|
||||
FileUtils::LogLine("[clock_manager] Successfully loaded KIP data into config");
|
||||
} else {
|
||||
FileUtils::LogLine("[clock_manager] Warning: Failed to set config values from KIP");
|
||||
writeNotification("Horizon OC\nKip config set failed");
|
||||
}
|
||||
}
|
||||
|
||||
// I know this is very hacky, but the config system in the sysmodule doesn't really support writing
|
||||
@@ -800,6 +853,8 @@ void ClockManager::GetKipData() {
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
SysClkConfigValueList configValues;
|
||||
this->config->GetConfigValues(&configValues);
|
||||
|
||||
@@ -811,10 +866,26 @@ void ClockManager::GetKipData() {
|
||||
return;
|
||||
}
|
||||
|
||||
if((u64)checksum_file("sdmc:/atmosphere/kips/hoc.kip") != this->config->GetConfigValue(KipCrc32) && !this->config->GetConfigValue(HocClkConfigValue_IsFirstLoad)) {
|
||||
SetKipData();
|
||||
writeNotification("Horizon OC\nKIP has been updated");
|
||||
writeNotification("Horizon OC\nPlease reboot your console");
|
||||
writeNotification("Horizon OC\nto complete the update");
|
||||
return;
|
||||
}
|
||||
if(this->config->GetConfigValue(HocClkConfigValue_IsFirstLoad) == true) {
|
||||
configValues.values[HocClkConfigValue_IsFirstLoad] = (u64)false;
|
||||
writeNotification("Horizon OC has been installed");
|
||||
}
|
||||
static bool writeBootConfigValues = true;
|
||||
|
||||
configValues.values[KipCrc32] = (u64)checksum_file("sdmc:/atmosphere/kips/hoc.kip"); // write checksum
|
||||
|
||||
|
||||
if(writeBootConfigValues) {
|
||||
writeBootConfigValues = false;
|
||||
|
||||
initialConfigValues[KipConfigValue_mtcConf] = cust_get_mtc_conf(&table);
|
||||
// initialConfigValues[KipConfigValue_mtcConf] = cust_get_mtc_conf(&table);
|
||||
initialConfigValues[KipConfigValue_hpMode] = cust_get_hp_mode(&table);
|
||||
|
||||
initialConfigValues[KipConfigValue_commonEmcMemVolt] = cust_get_common_emc_volt(&table);
|
||||
@@ -839,16 +910,15 @@ void ClockManager::GetKipData() {
|
||||
initialConfigValues[KipConfigValue_eristaCpuMaxVolt] = cust_get_erista_cpu_max_volt(&table);
|
||||
initialConfigValues[KipConfigValue_eristaCpuUnlock] = cust_get_eristaCpuUnlock(&table);
|
||||
|
||||
|
||||
initialConfigValues[KipConfigValue_marikoCpuUVLow] = cust_get_mariko_cpu_uv_low(&table);
|
||||
initialConfigValues[KipConfigValue_marikoCpuUVHigh] = cust_get_mariko_cpu_uv_high(&table);
|
||||
initialConfigValues[KipConfigValue_tableConf] = cust_get_table_conf(&table);
|
||||
initialConfigValues[KipConfigValue_marikoCpuLowVmin] = cust_get_mariko_cpu_low_vmin(&table);
|
||||
initialConfigValues[KipConfigValue_marikoCpuHighVmin] = cust_get_mariko_cpu_high_vmin(&table);
|
||||
initialConfigValues[KipConfigValue_marikoCpuMaxVolt] = cust_get_mariko_cpu_max_volt(&table);
|
||||
initialConfigValues[KipConfigValue_marikoCpuMaxClock] = cust_get_marikoCpuMaxClock(&table) / 1000;
|
||||
initialConfigValues[KipConfigValue_eristaCpuBoostClock] = cust_get_erista_cpu_boost(&table) / 1000;
|
||||
initialConfigValues[KipConfigValue_marikoCpuBoostClock] = cust_get_mariko_cpu_boost(&table) / 1000;
|
||||
initialConfigValues[KipConfigValue_marikoCpuMaxClock] = cust_get_marikoCpuMaxClock(&table);
|
||||
initialConfigValues[KipConfigValue_eristaCpuBoostClock] = cust_get_erista_cpu_boost(&table);
|
||||
initialConfigValues[KipConfigValue_marikoCpuBoostClock] = cust_get_mariko_cpu_boost(&table);
|
||||
|
||||
initialConfigValues[KipConfigValue_eristaGpuUV] = cust_get_erista_gpu_uv(&table);
|
||||
initialConfigValues[KipConfigValue_eristaGpuVmin] = cust_get_erista_gpu_vmin(&table);
|
||||
@@ -857,17 +927,10 @@ void ClockManager::GetKipData() {
|
||||
initialConfigValues[KipConfigValue_marikoGpuVmax] = cust_get_mariko_gpu_vmax(&table);
|
||||
initialConfigValues[KipConfigValue_commonGpuVoltOffset] = cust_get_common_gpu_offset(&table);
|
||||
initialConfigValues[KipConfigValue_gpuSpeedo] = cust_get_gpu_speedo(&table);
|
||||
|
||||
for (int i = 0; i < 24; i++) {
|
||||
initialConfigValues[KipConfigValue_g_volt_76800 + i] = cust_get_mariko_gpu_volt(&table, i);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 27; i++) {
|
||||
initialConfigValues[KipConfigValue_g_volt_e_76800 + i] = cust_get_erista_gpu_volt(&table, i);
|
||||
}
|
||||
initialConfigValues[KipConfigValue_t7_tWTR_fine_tune] = cust_get_tWTR_fine_tune(&table);
|
||||
}
|
||||
|
||||
configValues.values[KipConfigValue_mtcConf] = cust_get_mtc_conf(&table);
|
||||
// configValues.values[KipConfigValue_mtcConf] = cust_get_mtc_conf(&table);
|
||||
configValues.values[KipConfigValue_hpMode] = cust_get_hp_mode(&table);
|
||||
|
||||
configValues.values[KipConfigValue_commonEmcMemVolt] = cust_get_common_emc_volt(&table);
|
||||
@@ -899,9 +962,9 @@ void ClockManager::GetKipData() {
|
||||
configValues.values[KipConfigValue_marikoCpuLowVmin] = cust_get_mariko_cpu_low_vmin(&table);
|
||||
configValues.values[KipConfigValue_marikoCpuHighVmin] = cust_get_mariko_cpu_high_vmin(&table);
|
||||
configValues.values[KipConfigValue_marikoCpuMaxVolt] = cust_get_mariko_cpu_max_volt(&table);
|
||||
configValues.values[KipConfigValue_marikoCpuMaxClock] = cust_get_marikoCpuMaxClock(&table) / 1000;
|
||||
configValues.values[KipConfigValue_eristaCpuBoostClock] = cust_get_erista_cpu_boost(&table) / 1000;
|
||||
configValues.values[KipConfigValue_marikoCpuBoostClock] = cust_get_mariko_cpu_boost(&table) / 1000;
|
||||
configValues.values[KipConfigValue_marikoCpuMaxClock] = cust_get_marikoCpuMaxClock(&table);
|
||||
configValues.values[KipConfigValue_eristaCpuBoostClock] = cust_get_erista_cpu_boost(&table);
|
||||
configValues.values[KipConfigValue_marikoCpuBoostClock] = cust_get_mariko_cpu_boost(&table);
|
||||
|
||||
configValues.values[KipConfigValue_eristaGpuUV] = cust_get_erista_gpu_uv(&table);
|
||||
configValues.values[KipConfigValue_eristaGpuVmin] = cust_get_erista_gpu_vmin(&table);
|
||||
@@ -913,12 +976,16 @@ void ClockManager::GetKipData() {
|
||||
|
||||
for (int i = 0; i < 24; i++) {
|
||||
configValues.values[KipConfigValue_g_volt_76800 + i] = cust_get_mariko_gpu_volt(&table, i);
|
||||
initialConfigValues[KipConfigValue_g_volt_76800 + i] = cust_get_mariko_gpu_volt(&table, i);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 27; i++) {
|
||||
configValues.values[KipConfigValue_g_volt_e_76800 + i] = cust_get_erista_gpu_volt(&table, i);
|
||||
initialConfigValues[KipConfigValue_g_volt_e_76800 + i] = cust_get_erista_gpu_volt(&table, i);
|
||||
}
|
||||
|
||||
configValues.values[KipConfigValue_t7_tWTR_fine_tune] = cust_get_tWTR_fine_tune(&table);
|
||||
|
||||
// if(cust_get_cust_rev(&table) == KIP_CUST_REV)
|
||||
// return;
|
||||
|
||||
@@ -940,44 +1007,20 @@ void ClockManager::GetKipData() {
|
||||
}
|
||||
|
||||
void ClockManager::UpdateRamTimings() {
|
||||
FILE* fp;
|
||||
fp = fopen("sdmc:/atmosphere/kips/hoc.kip", "r");
|
||||
u32 t1_tRCD = this->config->GetConfigValue(KipConfigValue_t1_tRCD);
|
||||
u32 t2_tRP = this->config->GetConfigValue(KipConfigValue_t2_tRP);
|
||||
u32 t3_tRAS = this->config->GetConfigValue(KipConfigValue_t3_tRAS);
|
||||
u32 t4_tRRD = this->config->GetConfigValue(KipConfigValue_t4_tRRD);
|
||||
u32 t5_tRFC = this->config->GetConfigValue(KipConfigValue_t5_tRFC);
|
||||
u32 t6_tRTW = this->config->GetConfigValue(KipConfigValue_t6_tRTW);
|
||||
u32 t7_tWTR = this->config->GetConfigValue(KipConfigValue_t7_tWTR);
|
||||
u32 t8_tREFI = this->config->GetConfigValue(KipConfigValue_t8_tREFI);
|
||||
bool hpMode = (bool)this->config->GetConfigValue(KipConfigValue_hpMode);
|
||||
|
||||
if (fp == NULL) {
|
||||
writeNotification("Horizon OC\nKip opening failed");
|
||||
kipAvailable = false;
|
||||
return;
|
||||
} else {
|
||||
kipAvailable = true;
|
||||
fclose(fp);
|
||||
}
|
||||
CustomizeTable table;
|
||||
|
||||
if (!cust_read_and_cache("sdmc:/atmosphere/kips/hoc.kip", &table)) {
|
||||
FileUtils::LogLine("[clock_manager] Failed to read KIP file for UpdateRamTimings");
|
||||
writeNotification("Horizon OC\nKip read failed");
|
||||
return;
|
||||
}
|
||||
|
||||
// if(this->config->GetConfigValue(KipConfigValue_marikoEmcMaxClock) != initialConfigValues[KipConfigValue_marikoEmcMaxClock] ||
|
||||
// this->config->GetConfigValue(KipConfigValue_mem_burst_read_latency) != initialConfigValues[KipConfigValue_mem_burst_read_latency] ||
|
||||
// this->config->GetConfigValue(KipConfigValue_mem_burst_write_latency) != initialConfigValues[KipConfigValue_mem_burst_write_latency]
|
||||
// ) {
|
||||
// writeNotification("Horizon OC\nCritical values changed!\nUnable to write timings");
|
||||
// return;
|
||||
// }
|
||||
u32 t1_tRCD = initialConfigValues[KipConfigValue_t1_tRCD];
|
||||
u32 t2_tRP = initialConfigValues[KipConfigValue_t2_tRP];
|
||||
u32 t3_tRAS = initialConfigValues[KipConfigValue_t3_tRAS];
|
||||
u32 t4_tRRD = initialConfigValues[KipConfigValue_t4_tRRD];
|
||||
u32 t5_tRFC = initialConfigValues[KipConfigValue_t5_tRFC];
|
||||
u32 t6_tRTW = initialConfigValues[KipConfigValue_t6_tRTW];
|
||||
u32 t7_tWTR = initialConfigValues[KipConfigValue_t7_tWTR];
|
||||
u32 t8_tREFI = initialConfigValues[KipConfigValue_t8_tREFI];
|
||||
u64 ramFreq = initialConfigValues[KipConfigValue_marikoEmcMaxClock];
|
||||
u32 rlAdd = initialConfigValues[KipConfigValue_mem_burst_read_latency];
|
||||
u32 wlAdd = initialConfigValues[KipConfigValue_mem_burst_write_latency];
|
||||
bool hpMode = (bool)initialConfigValues[KipConfigValue_hpMode];
|
||||
|
||||
|
||||
Board::UpdateShadowRegs(t1_tRCD, t2_tRP, t3_tRAS, t4_tRRD, t5_tRFC, t6_tRTW, t7_tWTR, t8_tREFI, ramFreq, rlAdd, wlAdd, hpMode);
|
||||
}
|
||||
@@ -1008,7 +1051,7 @@ unsigned int ClockManager::GetGpuVoltage (unsigned int freq, int speedo)
|
||||
int bracket = GetSpeedoBracket(speedo);
|
||||
|
||||
if (freq < 1601)
|
||||
return 0;
|
||||
return 610;
|
||||
|
||||
loop = 0;
|
||||
do
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Souldbminer 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
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user