summaryrefslogtreecommitdiffstats
path: root/src/mainboard/google/brya/acpi
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2022-05-19 16:06:38 -0600
committerTim Wawrzynczak <twawrzynczak@chromium.org>2022-06-06 16:18:43 +0000
commit3d79f7f13ee643507d4130d2be357e1505e81f53 (patch)
treee59628e3c2b9db814b7c51ab295e18c490255869 /src/mainboard/google/brya/acpi
parentb97a303fa69f54e8a880f5c4607d8ee9c9173b16 (diff)
downloadcoreboot-3d79f7f13ee643507d4130d2be357e1505e81f53.tar.gz
coreboot-3d79f7f13ee643507d4130d2be357e1505e81f53.tar.bz2
coreboot-3d79f7f13ee643507d4130d2be357e1505e81f53.zip
mb/google/brya/acpi: Add support for NVPCF _DSM subfunction
The Nvidia GPU kernel driver supports another _DSM subfunction which is known as NVPCF (Nvidia Platform and Control Framework). The subfunction informs the kernel driver about Dynamic Boost parameters, which is done at init time, but can also be changed dynamically. BUG=b:214581372 TEST=build Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Change-Id: I7887bfc2e8e1cae606e12502a9eda3a7954c8d7a Reviewed-on: https://review.coreboot.org/c/coreboot/+/64535 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Diffstat (limited to 'src/mainboard/google/brya/acpi')
-rw-r--r--src/mainboard/google/brya/acpi/gpu_defines.h2
-rw-r--r--src/mainboard/google/brya/acpi/gpu_top.asl8
-rw-r--r--src/mainboard/google/brya/acpi/nvpcf.asl65
3 files changed, 75 insertions, 0 deletions
diff --git a/src/mainboard/google/brya/acpi/gpu_defines.h b/src/mainboard/google/brya/acpi/gpu_defines.h
index 65a8ee942e5e..ec79f81b7db7 100644
--- a/src/mainboard/google/brya/acpi/gpu_defines.h
+++ b/src/mainboard/google/brya/acpi/gpu_defines.h
@@ -38,7 +38,9 @@
#define UUID_NVOP "a486d8f8-0bda-471b-a72b-6042a6b5bee0"
#define UUID_NVJT "cbeca351-067b-4924-9cbd-b46b00b86f34"
#define UUID_NBCI "d4a50b75-65c7-46f7-bfb7-41514cea0244"
+#define UUID_NVPCF "36b49710-2483-11e7-9598-0800200c9a66"
#define REVISION_MIN_NVOP 0x100
#define REVISION_MIN_NVJT 0x100
#define REVISION_MIN_NBCI 0x102
+#define REVISION_MIN_NVPCF 0x200
diff --git a/src/mainboard/google/brya/acpi/gpu_top.asl b/src/mainboard/google/brya/acpi/gpu_top.asl
index b7e90335b695..6b492231e391 100644
--- a/src/mainboard/google/brya/acpi/gpu_top.asl
+++ b/src/mainboard/google/brya/acpi/gpu_top.asl
@@ -23,6 +23,7 @@ Scope (\_SB.PCI0.PEG0)
#include "nvop.asl"
#include "nvjt.asl"
#include "nbci.asl"
+ #include "nvpcf.asl"
Method (_DSM, 4, Serialized)
{
@@ -47,6 +48,13 @@ Scope (\_SB.PCI0.PEG0)
Return (NBCI (Arg2, Arg3))
}
}
+ ElseIf (Arg0 == ToUUID (UUID_NVPCF))
+ {
+ If (ToInteger (Arg1) >= REVISION_MIN_NVPCF)
+ {
+ Return (NPCF (Arg2, Arg3))
+ }
+ }
Return (NV_ERROR_UNSUPPORTED)
}
diff --git a/src/mainboard/google/brya/acpi/nvpcf.asl b/src/mainboard/google/brya/acpi/nvpcf.asl
new file mode 100644
index 000000000000..019a5c1742ad
--- /dev/null
+++ b/src/mainboard/google/brya/acpi/nvpcf.asl
@@ -0,0 +1,65 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#define NVPCF_FUNC_SUPPORT 0
+#define NVPCF_FUNC_GET_STATIC_CONFIG_TABLES 1
+#define NVPCF_FUNC_UPDATE_DYNAMIC_PARAMS 2
+
+Method (NPCF, 2, Serialized)
+{
+ Switch (ToInteger (Arg0))
+ {
+ Case (NVPCF_FUNC_SUPPORT)
+ {
+ Return (ITOB(
+ (1 << NVPCF_FUNC_SUPPORT) |
+ (1 << NVPCF_FUNC_GET_STATIC_CONFIG_TABLES) |
+ (1 << NVPCF_FUNC_UPDATE_DYNAMIC_PARAMS)))
+ }
+ Case (NVPCF_FUNC_GET_STATIC_CONFIG_TABLES)
+ {
+ Return (Buffer () {
+ /* System Device Table Header (v2.0) */
+ 0x20, 0x03, 0x01,
+
+ /* System Device Table Entries */
+ 0x00, /* [3:0] CPU type (0=Intel, 1=AMD),
+ [7:4] GPU type (0=Nvidia) */
+
+ /* System Controller Table Header (v2.2), 1 controller entry */
+ 0x22, 0x04, 0x05, 0x01,
+
+ /* Controller #1 Flags */
+ 0x01, /* [3:0] Controller class
+ 0=Disabled, 1=Dynamic Boost,
+ 2=CTGP-only.
+ [7:4] Reserved. Set to 0. */
+ /* Controller #1 Params */
+ 0x00, /* Class = Dynamic Boost
+ [0:0] DC support
+ 0=Not supported, 1=Supported
+ [31:1] Reserved. Set to 0. */
+ 0x00, 0x00, 0x00, 0x00,
+
+ /* Twos-complement checksum */
+ 0xad
+ })
+ }
+ Case (NVPCF_FUNC_UPDATE_DYNAMIC_PARAMS)
+ {
+ Local0 = Buffer (0x31) {
+ /* Dynamic Params Table Header (1 controller entry, 0x1c bytes) */
+ 0x22, 0x05, 0x10, 0x1c, 0x01 }
+
+ CreateWordField (Local0, 0x05, TGPA)
+ CreateDWordField (Local0, 0x15, CEO0)
+
+ TGPA = 0x50 /* TGP on AC = 10W in 1/8-Watt increments */
+ CEO0 = 0x200 /* [7:0] Controller index
+ [8:8] Disable controller on AC
+ [9:9] Disable controller on DC */
+ Return (Local0)
+ }
+ }
+
+ Return (NV_ERROR_UNSUPPORTED)
+}