Tim Wawrzynczak | 3d79f7f | 2022-05-19 16:06:38 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | |
| 3 | #define NVPCF_FUNC_SUPPORT 0 |
| 4 | #define NVPCF_FUNC_GET_STATIC_CONFIG_TABLES 1 |
| 5 | #define NVPCF_FUNC_UPDATE_DYNAMIC_PARAMS 2 |
| 6 | |
| 7 | Method (NPCF, 2, Serialized) |
| 8 | { |
| 9 | Switch (ToInteger (Arg0)) |
| 10 | { |
| 11 | Case (NVPCF_FUNC_SUPPORT) |
| 12 | { |
| 13 | Return (ITOB( |
| 14 | (1 << NVPCF_FUNC_SUPPORT) | |
| 15 | (1 << NVPCF_FUNC_GET_STATIC_CONFIG_TABLES) | |
| 16 | (1 << NVPCF_FUNC_UPDATE_DYNAMIC_PARAMS))) |
| 17 | } |
| 18 | Case (NVPCF_FUNC_GET_STATIC_CONFIG_TABLES) |
| 19 | { |
| 20 | Return (Buffer () { |
| 21 | /* System Device Table Header (v2.0) */ |
| 22 | 0x20, 0x03, 0x01, |
| 23 | |
| 24 | /* System Device Table Entries */ |
| 25 | 0x00, /* [3:0] CPU type (0=Intel, 1=AMD), |
| 26 | [7:4] GPU type (0=Nvidia) */ |
| 27 | |
| 28 | /* System Controller Table Header (v2.2), 1 controller entry */ |
| 29 | 0x22, 0x04, 0x05, 0x01, |
| 30 | |
| 31 | /* Controller #1 Flags */ |
| 32 | 0x01, /* [3:0] Controller class |
| 33 | 0=Disabled, 1=Dynamic Boost, |
| 34 | 2=CTGP-only. |
| 35 | [7:4] Reserved. Set to 0. */ |
| 36 | /* Controller #1 Params */ |
| 37 | 0x00, /* Class = Dynamic Boost |
| 38 | [0:0] DC support |
| 39 | 0=Not supported, 1=Supported |
| 40 | [31:1] Reserved. Set to 0. */ |
| 41 | 0x00, 0x00, 0x00, 0x00, |
| 42 | |
| 43 | /* Twos-complement checksum */ |
| 44 | 0xad |
| 45 | }) |
| 46 | } |
| 47 | Case (NVPCF_FUNC_UPDATE_DYNAMIC_PARAMS) |
| 48 | { |
| 49 | Local0 = Buffer (0x31) { |
| 50 | /* Dynamic Params Table Header (1 controller entry, 0x1c bytes) */ |
| 51 | 0x22, 0x05, 0x10, 0x1c, 0x01 } |
| 52 | |
Tarun Tuli | b81ad9c | 2022-11-15 16:32:30 +0000 | [diff] [blame^] | 53 | CreateWordField (Local0, 0x1d, MAGA) |
| 54 | CreateWordField (Local0, 0x19, TPPA) |
Tim Wawrzynczak | 3d79f7f | 2022-05-19 16:06:38 -0600 | [diff] [blame] | 55 | CreateDWordField (Local0, 0x15, CEO0) |
| 56 | |
Tarun Tuli | b81ad9c | 2022-11-15 16:32:30 +0000 | [diff] [blame^] | 57 | MAGA = 0x50 /* TGP on AC = 10W in 1/8-Watt increments */ |
| 58 | TPPA = 0xc8 /* TPPA = 25W in 1/8-Watt increments */ |
Tim Wawrzynczak | 3d79f7f | 2022-05-19 16:06:38 -0600 | [diff] [blame] | 59 | CEO0 = 0x200 /* [7:0] Controller index |
| 60 | [8:8] Disable controller on AC |
| 61 | [9:9] Disable controller on DC */ |
| 62 | Return (Local0) |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | Return (NV_ERROR_UNSUPPORTED) |
| 67 | } |