Skip to content

Commit

Permalink
Happy New 2021 fixes & features
Browse files Browse the repository at this point in the history
fixes:
 * override some Navi 21 fields and arrays into float type
 * improve ROM extract (more info including checksums verification)
 * improve output of float values (more reasonable rounding)
 * re-generate most of the atom_gen stuff, based on kernel changes

new stuff:
 * implement functional tests (test script and data under test dir)
 * re-write README
 * bump package version to 0.8.0
  • Loading branch information
sibradzic committed Jan 4, 2021
1 parent c43e757 commit 99a2946
Show file tree
Hide file tree
Showing 22 changed files with 7,118 additions and 185 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
test/ROMs/
test/tmp/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
193 changes: 83 additions & 110 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,153 +12,126 @@ allow PowerPlay tables to be dynamically modified on runtime, which may be
known as "soft" PowerPlay table. On Linux, the PowerPlay table is by default
found at: `/sys/class/drm/card0/device/pp_table`.

### Requirements

Python 2.7 or 3.6+, click library. Optionally, for reading "soft" PowerPlay
table from Windows registry: python-registry. Should work on Windows as well
(testers wanted).

### Usage

Note that if you need to run upp deployed with pip in '--user' mode with sudo,
you'll need to add some parameters to sudo command to make user env available
to super-user. For example:

sudo -E env "PATH=$PATH" upp --help

At its current form this is a CLI only tool. Getting help:
Alternatively, one can use this tool to get PowerPlay data by:

Usage: upp [OPTIONS] COMMAND [ARGS]...
* Extracting PowerPlay table from Video ROM image (see extract command)
* Importing "Soft PowerPlay" table from Windows registry, directly from
offline Windows/System32/config/SYSTEM file on disk, so it would work
from Linux distro that has acces to mounted Windows partition
(path to SYSTEM registry file is specified with --from-registry option)

UPP: Uplift Power Play
This tool currently supports parsing and modifying PowerPlay tables found
on the following AMD GPU families:

A tool for parsing, dumping and modifying data in Radeon PowerPlay tables.
* Polaris
* Vega
* Radeon VII
* Navi 10
* Navi 14
* Navi 21 (Sienna Cichlid)

UPP is able to parse and modify binary data structures of PowerPlay tables
commonly found on certain AMD Radeon GPUs. Drivers on recent AMD GPUs
allow PowerPlay tables to be dynamically modified on runtime, which may be
known as "soft PowerPlay tables". On Linux, the PowerPlay table is by
default found at:
Note: iGPUs found in many recent AMD APUs are using completely different
PowerPlay control methods, this tool does not support them.

/sys/class/drm/card0/device/pp_table
If you have bugs to report or features to request please create an issue on:
https://github.com/sibradzic/upp

There are also two alternative ways of getting PowerPlay data that this
tool supports:

- By extracting PowerPlay table from Video ROM image (see extract command)
- Import "Soft PowerPlay" table from Windows registry, directly from
offline Windows/System32/config/SYSTEM file on disk, so it would work
from Linux distro that has acces to mounted Windows partition
(path to SYSTEM registry file is specified with --from-registry option)

This tool currently supports parsing and modifying PowerPlay tables found
on the following AMD GPU families:

- Polaris
- Vega
- Radeon VII
- Navi 10
- Navi 14
- Navi 21 (Sienna Cichlid)

Note: iGPUs found in many recent AMD APUs are using completely different
PowerPlay control methods, this tool does not support them.

If you have bugs to report or features to request please check:
### Requirements

github.com/sibradzic/upp
Python 3.6+, click library. Optionally, for reading "soft" PowerPlay table
from Windows registry: python-registry. Should work on Windows as well
(testers wanted).

Options:
-p, --pp-file <filename> Input/output PP table binary file.
-f, --from-registry <filename> Import PP_PhmSoftPowerPlayTable from Windows
registry (overrides -p / --pp-file option).
-d, --debug / --no-debug Debug mode.
-h, --help Show this message and exit.
### Usage

Commands:
dump Dumps all PowerPlay parameters to console.
extract Extract PowerPlay table from Video BIOS ROM image.
get Get current value of a PowerPlay parameter(s).
set Set value to PowerPlay parameter(s).
version Show UPP version.
At its current form this is a CLI only tool. Getting help:

Dumping all data:
upp --help

Usage: upp dump [OPTIONS]
or

Dump all PowerPlay data to console
upp <command> --help

De-serializes PowerPlay binary data into a human-readable text output. For
example:
Upp will only work by specifying a command which tells it what to do to one's
Radeon PowerPlay table data. Currently available commands are:

upp --pp-file=radeon.pp_table dump
* **dump** - Dumps all PowerPlay data to console
* **extract** - Extracts PowerPlay data from full VBIOS ROM image
* **get** - Retrieves current value of one or multiple PowerPlay parametter(s)
* **set** - Sets value to one or multiple PowerPlay parameters
* **version** - Shows UPP version

In standard mode all data will be dumped to console, where data tree
hierarchy is indicated by indentation.
So, an usage pattern would be like this:

In raw mode a table showing all hex and binary data, as well as variable
names and values, will be dumped.
upp [OPTIONS] COMMAND [ARGS]...

Options:
-r, --raw / --no-raw Show raw binary data.
-h, --help Show this message and exit.
Some generic options applicable to all commands may be used, but please note
that they have to be specified *before* an actual command:

Extracting PowerPlay table from Video ROM image:
-p, --pp-file <filename> Input/output PP table file.
-f, --from-registry <filename> Import PP_PhmSoftPowerPlayTable from Windows
-d, --debug / --no-debug Debug mode.
-h, --help Show help.

Usage: upp extract [OPTIONS]
#### Dumping all data:

Extracts PowerPlay data from full VBIOS ROM image
The **dump** command de-serializes PowerPlay binary data into a human-readable
text output. For example:

The source video ROM binary must be specified with -r/--video-rom
parameter, and extracted PowerPlay table will be saved into file specified
with -p/--pp-file. For example:
upp dump

upp --pp-file=extracted.pp_table extract -r VIDEO.rom
In standard mode all data will be dumped to console, where data tree hierarchy
is indicated by indentation. In raw mode a table showing all hex and binary
data, as well as variable names and values, will be dumped.

Default output file name will be an original ROM file name with an
additional .pp_table extension.
#### Extracting PowerPlay table from Video ROM image:

Options:
-r, --video-rom <filename> Input Video ROM binary image file [required].
-h, --help Show this message and exit.
Use **extract** command for this. The source video ROM binary must be specified
with `-r/--video-rom` parameter, and extracted PowerPlay table will be saved
into file specified with generic `-p/--pp-file` option. For example:

Getting parameter:
upp --pp-file=extracted.pp_table extract -r VIDEO.rom

Usage: upp get [OPTIONS] VARIABLE_PATH_SET...
Default output file name will be an original ROM file name with an
additional .pp_table extension.

Retrieves current value of one or multiple PP parameters
#### Getting PowerPlay table parameter value(s):

The parameter variable path must be specified in "/<param> notation", for
example:
The **get** command retrieves current value of one or multiple PowerPlay table
parameter value(s). The parameter variable path must be specified in `/<param>`
notation, for example:

upp get /FanTable/TargetTemperature /VddgfxLookupTable/7/Vdd
upp get smc_pptable/FreqTableGfx/1 smc_pptable/FreqTableGfx/2
1850
1400

The raw value of the parameter will be retrieved, decoded and displayed on
console. Multiple PP parameters can be specified at the same time.
The order of the output values will match the order of the parameter variable
paths specified.

Options:
-h, --help Show this message and exit.
#### Setting PowerPlay table parameter value(s):

Setting parameters:
The **set** command sets value to one or multiple PowerPlay table
parameter(s). The parameter path and value must be specified in
`/<param>=<value>` notation, for example:

Usage: upp set [OPTIONS] VARIABLE_PATH_SET...
upp -p /tmp/custom-pp_table set --write \
smc_pptable/SocketPowerLimitAc/0=100 \
smc_pptable/SocketPowerLimitDc/0=100 \
smc_pptable/FanStartTemp=100 \
smc_pptable/FreqTableGfx/1=1550

Sets value to one or multiple PP parameters
Note the `--write` parameter, which has to be specified to actually commit
changes to the PowerPlay table file.

The parameter path and value must be specified in "/<param>=<value>
notation", for example:
#### Getting upp version

upp set /PowerTuneTable/TDP=75 /SclkDependencyTable/7/Sclk=107000
upp version

Multiple PP parameters can be set at the same time. The PP tables will not
be changed unless additional --write option is set.
#### Running as sudo

Optionally, if --to-reg output is used an additional Windows registry
format file will be generated, named same as PowerPlay output target
filename with an additional '.reg' extension.
Note that if you need to run upp deployed with **pip** in `--user` mode with
sudo, you'll need to add some parameters to sudo command to make user env
available to super-user. For example:

Options:
-t, --to-reg Save output to Windows registry .reg file as well.
-w, --write Write changes to PP binary.
-h, --help Show this message and exit.
sudo -E env "PATH=$PATH" upp --help

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name='upp',
version='0.0.7.post2',
version='0.0.8',
author='Samir Ibradžić',
description='Uplift Power Play',
long_description=long_description,
Expand Down
Loading

0 comments on commit 99a2946

Please sign in to comment.