diff --git a/.gitignore b/.gitignore index 894a44c..9b1b029 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +test/ROMs/ +test/tmp/ + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/README.md b/README.md index 2240771..b906ceb 100644 --- a/README.md +++ b/README.md @@ -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 Input/output PP table binary file. - -f, --from-registry 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 --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 Input/output PP table file. + -f, --from-registry 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 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 "/ 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 `/` +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 +`/=` 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 "/= - 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 diff --git a/setup.py b/setup.py index 0d4c02b..b09e642 100644 --- a/setup.py +++ b/setup.py @@ -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, diff --git a/src/upp/atom_gen/atombios.py b/src/upp/atom_gen/atombios.py index b942b91..5ab442a 100644 --- a/src/upp/atom_gen/atombios.py +++ b/src/upp/atom_gen/atombios.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# TARGET arch is: ['--include', 'stdint.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atom-types.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''] +# TARGET arch is: ['--include', 'stdint.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atom-types.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''] # WORD_SIZE is: 8 # POINTER_SIZE is: 8 # LONGDOUBLE_SIZE is: 16 @@ -255,13 +255,6 @@ class struct__COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V4(ctypes.Structure): class struct__COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V5(ctypes.Structure): pass -class union__COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V5_1(ctypes.Union): - _pack_ = True # source:False - _fields_ = [ - ('ucCntlFlag', ctypes.c_ubyte), - ('ucInputFlag', ctypes.c_ubyte), - ] - class union__COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V5_0(ctypes.Union): _pack_ = True # source:False _fields_ = [ @@ -270,6 +263,13 @@ class union__COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V5_0(ctypes.Union): ('ulFbDiv', ATOM_S_MPLL_FB_DIVIDER), ] +class union__COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V5_1(ctypes.Union): + _pack_ = True # source:False + _fields_ = [ + ('ucCntlFlag', ctypes.c_ubyte), + ('ucInputFlag', ctypes.c_ubyte), + ] + struct__COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V5._pack_ = True # source:False struct__COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V5._fields_ = [ ('_0', union__COMPUTE_MEMORY_ENGINE_PLL_PARAMETERS_V5_0), @@ -328,18 +328,18 @@ class struct__COMPUTE_GPU_CLOCK_OUTPUT_PARAMETERS_V1_7(ctypes.Structure): class struct__COMPUTE_MEMORY_CLOCK_PARAM_PARAMETERS_V2_1(ctypes.Structure): pass -class union__COMPUTE_MEMORY_CLOCK_PARAM_PARAMETERS_V2_1_0(ctypes.Union): +class union__COMPUTE_MEMORY_CLOCK_PARAM_PARAMETERS_V2_1_1(ctypes.Union): _pack_ = True # source:False _fields_ = [ - ('ulClock', ctypes.c_uint32), - ('ulFbDiv', ATOM_S_MPLL_FB_DIVIDER), + ('ucInputFlag', ctypes.c_ubyte), + ('ucPllCntlFlag', ctypes.c_ubyte), ] -class union__COMPUTE_MEMORY_CLOCK_PARAM_PARAMETERS_V2_1_1(ctypes.Union): +class union__COMPUTE_MEMORY_CLOCK_PARAM_PARAMETERS_V2_1_0(ctypes.Union): _pack_ = True # source:False _fields_ = [ - ('ucInputFlag', ctypes.c_ubyte), - ('ucPllCntlFlag', ctypes.c_ubyte), + ('ulClock', ctypes.c_uint32), + ('ulFbDiv', ATOM_S_MPLL_FB_DIVIDER), ] struct__COMPUTE_MEMORY_CLOCK_PARAM_PARAMETERS_V2_1._pack_ = True # source:False @@ -580,7 +580,6 @@ class struct__ATOM_DIG_ENCODER_CONFIG_V3(ctypes.Structure): class struct__DIG_ENCODER_CONTROL_PARAMETERS_V3(ctypes.Structure): pass -ATOM_DIG_ENCODER_CONFIG_V3 = struct__ATOM_DIG_ENCODER_CONFIG_V3 class union__DIG_ENCODER_CONTROL_PARAMETERS_V3_0(ctypes.Union): _pack_ = True # source:False _fields_ = [ @@ -588,6 +587,7 @@ class union__DIG_ENCODER_CONTROL_PARAMETERS_V3_0(ctypes.Union): ('ucPanelMode', ctypes.c_ubyte), ] +ATOM_DIG_ENCODER_CONFIG_V3 = struct__ATOM_DIG_ENCODER_CONFIG_V3 struct__DIG_ENCODER_CONTROL_PARAMETERS_V3._pack_ = True # source:False struct__DIG_ENCODER_CONTROL_PARAMETERS_V3._fields_ = [ ('usPixelClock', ctypes.c_uint16), @@ -759,6 +759,7 @@ class struct__ATOM_DIG_TRANSMITTER_CONFIG_V3(ctypes.Structure): class struct__DIG_TRANSMITTER_CONTROL_PARAMETERS_V3(ctypes.Structure): pass +ATOM_DIG_TRANSMITTER_CONFIG_V3 = struct__ATOM_DIG_TRANSMITTER_CONFIG_V3 class union__DIG_TRANSMITTER_CONTROL_PARAMETERS_V3_0(ctypes.Union): _pack_ = True # source:False _fields_ = [ @@ -767,7 +768,6 @@ class union__DIG_TRANSMITTER_CONTROL_PARAMETERS_V3_0(ctypes.Union): ('asMode', ATOM_DP_VS_MODE), ] -ATOM_DIG_TRANSMITTER_CONFIG_V3 = struct__ATOM_DIG_TRANSMITTER_CONFIG_V3 struct__DIG_TRANSMITTER_CONTROL_PARAMETERS_V3._pack_ = True # source:False struct__DIG_TRANSMITTER_CONTROL_PARAMETERS_V3._fields_ = [ ('_0', union__DIG_TRANSMITTER_CONTROL_PARAMETERS_V3_0), @@ -817,6 +817,16 @@ class struct__ATOM_DIG_TRANSMITTER_CONFIG_V4(ctypes.Structure): class struct__DIG_TRANSMITTER_CONTROL_PARAMETERS_V4(ctypes.Structure): pass +class union__DIG_TRANSMITTER_CONTROL_PARAMETERS_V4_1(ctypes.Union): + pass + +ATOM_DIG_TRANSMITTER_CONFIG_V4 = struct__ATOM_DIG_TRANSMITTER_CONFIG_V4 +union__DIG_TRANSMITTER_CONTROL_PARAMETERS_V4_1._pack_ = True # source:False +union__DIG_TRANSMITTER_CONTROL_PARAMETERS_V4_1._fields_ = [ + ('acConfig', ATOM_DIG_TRANSMITTER_CONFIG_V4), + ('ucConfig', ctypes.c_ubyte), +] + class union__DIG_TRANSMITTER_CONTROL_PARAMETERS_V4_0(ctypes.Union): pass @@ -828,16 +838,6 @@ class union__DIG_TRANSMITTER_CONTROL_PARAMETERS_V4_0(ctypes.Union): ('asMode', ATOM_DP_VS_MODE_V4), ] -class union__DIG_TRANSMITTER_CONTROL_PARAMETERS_V4_1(ctypes.Union): - pass - -ATOM_DIG_TRANSMITTER_CONFIG_V4 = struct__ATOM_DIG_TRANSMITTER_CONFIG_V4 -union__DIG_TRANSMITTER_CONTROL_PARAMETERS_V4_1._pack_ = True # source:False -union__DIG_TRANSMITTER_CONTROL_PARAMETERS_V4_1._fields_ = [ - ('acConfig', ATOM_DIG_TRANSMITTER_CONFIG_V4), - ('ucConfig', ctypes.c_ubyte), -] - struct__DIG_TRANSMITTER_CONTROL_PARAMETERS_V4._pack_ = True # source:False struct__DIG_TRANSMITTER_CONTROL_PARAMETERS_V4._fields_ = [ ('_0', union__DIG_TRANSMITTER_CONTROL_PARAMETERS_V4_0), @@ -3000,8 +3000,8 @@ class struct__ATOM_VOLTAGE_CONTROL(ctypes.Structure): class struct__ATOM_VOLTAGE_OBJECT(ctypes.Structure): pass -ATOM_VOLTAGE_CONTROL = struct__ATOM_VOLTAGE_CONTROL ATOM_VOLTAGE_FORMULA = struct__ATOM_VOLTAGE_FORMULA +ATOM_VOLTAGE_CONTROL = struct__ATOM_VOLTAGE_CONTROL struct__ATOM_VOLTAGE_OBJECT._pack_ = True # source:False struct__ATOM_VOLTAGE_OBJECT._fields_ = [ ('ucVoltageType', ctypes.c_ubyte), @@ -3146,11 +3146,11 @@ class struct__ATOM_VOLTAGE_OBJECT_INFO_V3_1(ctypes.Structure): class union__ATOM_VOLTAGE_OBJECT_V3(ctypes.Union): pass +ATOM_LEAKAGE_VOLTAGE_OBJECT_V3 = struct__ATOM_LEAKAGE_VOLTAGE_OBJECT_V3 ATOM_I2C_VOLTAGE_OBJECT_V3 = struct__ATOM_I2C_VOLTAGE_OBJECT_V3 +ATOM_SVID2_VOLTAGE_OBJECT_V3 = struct__ATOM_SVID2_VOLTAGE_OBJECT_V3 ATOM_EVV_VOLTAGE_OBJECT_V3 = struct__ATOM_EVV_VOLTAGE_OBJECT_V3 -ATOM_LEAKAGE_VOLTAGE_OBJECT_V3 = struct__ATOM_LEAKAGE_VOLTAGE_OBJECT_V3 ATOM_GPIO_VOLTAGE_OBJECT_V3 = struct__ATOM_GPIO_VOLTAGE_OBJECT_V3 -ATOM_SVID2_VOLTAGE_OBJECT_V3 = struct__ATOM_SVID2_VOLTAGE_OBJECT_V3 union__ATOM_VOLTAGE_OBJECT_V3._pack_ = True # source:False union__ATOM_VOLTAGE_OBJECT_V3._fields_ = [ ('asGpioVoltageObj', ATOM_GPIO_VOLTAGE_OBJECT_V3), @@ -4554,6 +4554,20 @@ class struct__ATOM_VRAM_MODULE_V2(ctypes.Structure): class struct__ATOM_MEMORY_TIMING_FORMAT(ctypes.Structure): pass +class union__ATOM_MEMORY_TIMING_FORMAT_0(ctypes.Union): + _pack_ = True # source:False + _fields_ = [ + ('usMRS', ctypes.c_uint16), + ('usDDR3_MR0', ctypes.c_uint16), + ] + +class union__ATOM_MEMORY_TIMING_FORMAT_1(ctypes.Union): + _pack_ = True # source:False + _fields_ = [ + ('usEMRS', ctypes.c_uint16), + ('usDDR3_MR1', ctypes.c_uint16), + ] + class union__ATOM_MEMORY_TIMING_FORMAT_2(ctypes.Union): pass @@ -4570,20 +4584,6 @@ class struct__ATOM_MEMORY_TIMING_FORMAT_2_0(ctypes.Structure): ('usDDR3_MR2', ctypes.c_uint16), ] -class union__ATOM_MEMORY_TIMING_FORMAT_0(ctypes.Union): - _pack_ = True # source:False - _fields_ = [ - ('usMRS', ctypes.c_uint16), - ('usDDR3_MR0', ctypes.c_uint16), - ] - -class union__ATOM_MEMORY_TIMING_FORMAT_1(ctypes.Union): - _pack_ = True # source:False - _fields_ = [ - ('usEMRS', ctypes.c_uint16), - ('usDDR3_MR1', ctypes.c_uint16), - ] - struct__ATOM_MEMORY_TIMING_FORMAT._pack_ = True # source:False struct__ATOM_MEMORY_TIMING_FORMAT._fields_ = [ ('ulClkRange', ctypes.c_uint32), @@ -4678,18 +4678,18 @@ class struct__ATOM_MEMORY_TIMING_FORMAT_V2(ctypes.Structure): class struct__ATOM_MEMORY_FORMAT(ctypes.Structure): pass -class union__ATOM_MEMORY_FORMAT_1(ctypes.Union): +class union__ATOM_MEMORY_FORMAT_0(ctypes.Union): _pack_ = True # source:False _fields_ = [ - ('usEMRS3Value', ctypes.c_uint16), - ('usDDR3_MR3', ctypes.c_uint16), + ('usEMRS2Value', ctypes.c_uint16), + ('usDDR3_Reserved', ctypes.c_uint16), ] -class union__ATOM_MEMORY_FORMAT_0(ctypes.Union): +class union__ATOM_MEMORY_FORMAT_1(ctypes.Union): _pack_ = True # source:False _fields_ = [ - ('usEMRS2Value', ctypes.c_uint16), - ('usDDR3_Reserved', ctypes.c_uint16), + ('usEMRS3Value', ctypes.c_uint16), + ('usDDR3_MR3', ctypes.c_uint16), ] struct__ATOM_MEMORY_FORMAT._pack_ = True # source:False @@ -4734,18 +4734,18 @@ class struct__ATOM_VRAM_MODULE_V3(ctypes.Structure): class struct__ATOM_VRAM_MODULE_V4(ctypes.Structure): pass -class union__ATOM_VRAM_MODULE_V4_0(ctypes.Union): +class union__ATOM_VRAM_MODULE_V4_1(ctypes.Union): _pack_ = True # source:False _fields_ = [ - ('usEMRS2Value', ctypes.c_uint16), - ('usDDR3_Reserved', ctypes.c_uint16), + ('usEMRS3Value', ctypes.c_uint16), + ('usDDR3_MR3', ctypes.c_uint16), ] -class union__ATOM_VRAM_MODULE_V4_1(ctypes.Union): +class union__ATOM_VRAM_MODULE_V4_0(ctypes.Union): _pack_ = True # source:False _fields_ = [ - ('usEMRS3Value', ctypes.c_uint16), - ('usDDR3_MR3', ctypes.c_uint16), + ('usEMRS2Value', ctypes.c_uint16), + ('usDDR3_Reserved', ctypes.c_uint16), ] struct__ATOM_VRAM_MODULE_V4._pack_ = True # source:False @@ -5309,8 +5309,8 @@ class struct__DP_ENCODER_SERVICE_PARAMETERS_V2(ctypes.Structure): class struct__DP_ENCODER_SERVICE_PS_ALLOCATION_V2(ctypes.Structure): pass -DP_ENCODER_SERVICE_PARAMETERS_V2 = struct__DP_ENCODER_SERVICE_PARAMETERS_V2 PROCESS_AUX_CHANNEL_TRANSACTION_PARAMETERS_V2 = struct__PROCESS_AUX_CHANNEL_TRANSACTION_PARAMETERS_V2 +DP_ENCODER_SERVICE_PARAMETERS_V2 = struct__DP_ENCODER_SERVICE_PARAMETERS_V2 struct__DP_ENCODER_SERVICE_PS_ALLOCATION_V2._pack_ = True # source:False struct__DP_ENCODER_SERVICE_PS_ALLOCATION_V2._fields_ = [ ('asDPServiceParam', DP_ENCODER_SERVICE_PARAMETERS_V2), diff --git a/src/upp/atom_gen/pptable_v1_0.py b/src/upp/atom_gen/pptable_v1_0.py index c0c234c..746417f 100644 --- a/src/upp/atom_gen/pptable_v1_0.py +++ b/src/upp/atom_gen/pptable_v1_0.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# TARGET arch is: ['--include', 'stdint.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atom-types.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atombios.h'] +# TARGET arch is: ['--include', 'stdint.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atom-types.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atombios.h'] # WORD_SIZE is: 8 # POINTER_SIZE is: 8 # LONGDOUBLE_SIZE is: 16 diff --git a/src/upp/atom_gen/smu_v11_0_navi10.py b/src/upp/atom_gen/smu_v11_0_navi10.py index 97eabe3..50cb158 100644 --- a/src/upp/atom_gen/smu_v11_0_navi10.py +++ b/src/upp/atom_gen/smu_v11_0_navi10.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# TARGET arch is: ['--include', 'stdint.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atom-types.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atomfirmware.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if_navi10.h', ''] +# TARGET arch is: ['--include', 'stdint.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atom-types.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atomfirmware.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/pm/inc/smu11_driver_if_navi10.h', ''] # WORD_SIZE is: 8 # POINTER_SIZE is: 8 # LONGDOUBLE_SIZE is: 16 diff --git a/src/upp/atom_gen/vega10_pptable.py b/src/upp/atom_gen/vega10_pptable.py index 44fffd1..f96dca3 100644 --- a/src/upp/atom_gen/vega10_pptable.py +++ b/src/upp/atom_gen/vega10_pptable.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# TARGET arch is: ['--include', 'stdint.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atom-types.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atomfirmware.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atombios.h'] +# TARGET arch is: ['--include', 'stdint.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atom-types.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atomfirmware.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atombios.h'] # WORD_SIZE is: 8 # POINTER_SIZE is: 8 # LONGDOUBLE_SIZE is: 16 diff --git a/src/upp/atom_gen/vega20_pptable.py b/src/upp/atom_gen/vega20_pptable.py index 17186d4..81ddc82 100644 --- a/src/upp/atom_gen/vega20_pptable.py +++ b/src/upp/atom_gen/vega20_pptable.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# TARGET arch is: ['--include', 'stdint.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atom-types.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atomfirmware.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/powerplay/inc/smu11_driver_if.h', ''] +# TARGET arch is: ['--include', 'stdint.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atom-types.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/include/atomfirmware.h', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '--include', 'linux/drivers/gpu/drm/amd/pm/inc/smu11_driver_if.h', ''] # WORD_SIZE is: 8 # POINTER_SIZE is: 8 # LONGDOUBLE_SIZE is: 16 diff --git a/src/upp/decode.py b/src/upp/decode.py index b69637e..914364f 100644 --- a/src/upp/decode.py +++ b/src/upp/decode.py @@ -22,6 +22,10 @@ ctypes.c_uint32, ctypes.c_float ] +# Defined as uint in kernel, but in reality these are float +float_fields = ['a', 'b', 'c', 'm', + 'VcBtcPsmA', 'VcBtcPsmB', 'VcBtcVminA', 'VcBtcVminB'] +float_arrays = ['Fset', 'Vdroop'] def odict(init_data=None): """ @@ -109,14 +113,26 @@ def extract_rom(vrom_file, out_pp_file): rom_partn_offset = struct.unpack(' ${TMP_DIR}/${VBIOS#*/}.dump + python3 -m upp.upp -p ${TMP_DIR}/${VBIOS#*/}.pp_table dump -r > ${TMP_DIR}/${VBIOS#*/}.rawdump + diff -s ${TEST_ROOT}/${VBIOS#*/}.dump ${TMP_DIR}/${VBIOS#*/}.dump + if [ $? -ne "0" ]; then + echo "ERROR in ${TMP_DIR}/${VBIOS#*/}.dump:" + diff -u ${TEST_ROOT}/${VBIOS#*/}.dump ${TMP_DIR}/${VBIOS#*/}.dump + exit 2 + fi + diff -s ${TEST_ROOT}/${VBIOS#*/}.rawdump ${TMP_DIR}/${VBIOS#*/}.rawdump + if [ $? -ne "0" ]; then + echo "ERROR in ${TMP_DIR}/${VBIOS#*/}.rawdump:" + diff -u ${TEST_ROOT}/${VBIOS#*/}.rawdump ${TMP_DIR}/${VBIOS#*/}.rawdump + exit 2 + fi +done + +python3 -m upp.upp -p ${TMP_DIR}/${ROM_RX5700#*/}.pp_table set --write \ + smc_pptable/SocketPowerLimitAc/0=110 \ + smc_pptable/SocketPowerLimitDc/0=110 \ + smc_pptable/FanStartTemp=100 \ + smc_pptable/MinVoltageGfx=2800 \ + smc_pptable/MaxVoltageGfx=3900 \ + smc_pptable/MinVoltageSoc=2800 \ + smc_pptable/MaxVoltageSoc=3800 \ + smc_pptable/qStaticVoltageOffset/0/c=-0.03 \ + smc_pptable/UlvVoltageOffsetSoc=0 \ + smc_pptable/UlvVoltageOffsetGfx=0 \ + smc_pptable/FreqTableGfx/1=1650 \ + smc_pptable/MemMvddVoltage/0=4400 \ + smc_pptable/MemVddciVoltage/0=2600 \ + smc_pptable/MemMvddVoltage/1=4600 \ + smc_pptable/MemVddciVoltage/1=3200 \ + smc_pptable/MemMvddVoltage/2=4800 \ + smc_pptable/MemVddciVoltage/2=3200 \ + smc_pptable/MemMvddVoltage/3=5000 \ + smc_pptable/MemVddciVoltage/3=3200 \ + smc_pptable/FreqTableUclk/3=750 + +python3 -m upp.upp -p ${TMP_DIR}/${ROM_RX5700#*/}.pp_table get \ + smc_pptable/SocketPowerLimitAc/0 \ + smc_pptable/SocketPowerLimitDc/0 \ + smc_pptable/FanStartTemp \ + smc_pptable/MinVoltageGfx \ + smc_pptable/MaxVoltageGfx \ + smc_pptable/MinVoltageSoc \ + smc_pptable/MaxVoltageSoc \ + smc_pptable/qStaticVoltageOffset/0/c \ + smc_pptable/UlvVoltageOffsetSoc \ + smc_pptable/UlvVoltageOffsetGfx \ + smc_pptable/FreqTableGfx/1 \ + smc_pptable/MemMvddVoltage/0 \ + smc_pptable/MemVddciVoltage/0 \ + smc_pptable/MemMvddVoltage/1 \ + smc_pptable/MemVddciVoltage/1 \ + smc_pptable/MemMvddVoltage/2 \ + smc_pptable/MemVddciVoltage/2 \ + smc_pptable/MemMvddVoltage/3 \ + smc_pptable/MemVddciVoltage/3 \ + smc_pptable/FreqTableUclk/3 \ + > ${TMP_DIR}/${ROM_RX5700#*/}.check + +diff -s ${TEST_ROOT}/${ROM_RX5700#*/}.check ${TMP_DIR}/${ROM_RX5700#*/}.check +if [ $? -ne "0" ]; then + echo "ERROR in ${TMP_DIR}/${ROM_RX5700#*/}.check:" + diff -u ${TEST_ROOT}/${ROM_RX5700#*/}.check ${TMP_DIR}/${ROM_RX5700#*/}.check + exit 2 +fi