summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2022-06-06 10:11:41 -0600
committerFelix Held <felix-coreboot@felixheld.de>2022-06-08 12:51:33 +0000
commit5e1f33bf6aaa16316b155d56c35cbdbca2d7d3ec (patch)
treeb7f4a6c8e39790520237b40a933a5c5784a947ef /src
parent9803964301ba574e92218ed953f78ae0b9db784b (diff)
mb/google/brya: Add GPS _DSM subfunction support for Nvidia GPU
The _DSM subfunction for the Nvidia GN20 supports 1 additional subfunction, known as GPS, which is required to support GPU Boost. This implementation is minimal, essentially letting the GPU manage its own temperature. BUG=b:214581372 TEST=abuild Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Change-Id: I21331bd811a13212f3825bda44be44d1b5ae7c74 Reviewed-on: https://review.coreboot.org/c/coreboot/+/64995 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Diffstat (limited to 'src')
-rw-r--r--src/mainboard/google/brya/acpi/gps.asl94
-rw-r--r--src/mainboard/google/brya/acpi/gpu_defines.h2
-rw-r--r--src/mainboard/google/brya/acpi/gpu_top.asl8
3 files changed, 104 insertions, 0 deletions
diff --git a/src/mainboard/google/brya/acpi/gps.asl b/src/mainboard/google/brya/acpi/gps.asl
new file mode 100644
index 0000000000..2e07a678cb
--- /dev/null
+++ b/src/mainboard/google/brya/acpi/gps.asl
@@ -0,0 +1,94 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#define GPS_FUNC_SUPPORT 0
+#define GPS_FUNC_GETCALLBACKS 0x13
+#define GPS_FUNC_PSHARESTATUS 0x20
+#define GPS_FUNC_PSHAREPARAMS 0x2a
+
+#define QUERY_GET_STATUS 0
+#define QUERY_GET_SUPPORTED_FIELDS 1
+#define QUERY_GET_CURRENT_LIMITS 2
+
+/* GPS return Package */
+Name (GPSP, Buffer (0x28) {0x0})
+CreateDWordField (GPSP, 0, RETN)
+CreateDWordField (GPSP, 4, VRV1)
+CreateDWordField (GPSP, 8, TGPU)
+
+/* GETCALLBACKS return value
+ [0]: Callback for post-mode set
+ [1]: Callback for pre-mode set
+ [2]: Callback for post power state transition */
+Name (GPSR, Buffer (4) { 0x4, 0x0, 0x0, 0x0 })
+
+Method (GPS, 2, Serialized)
+{
+ Switch (ToInteger (Arg0))
+ {
+ Case (GPS_FUNC_SUPPORT)
+ {
+ Return (ITOB(
+ (1 << GPS_FUNC_SUPPORT) |
+ (1 << GPS_FUNC_GETCALLBACKS) |
+ (1 << GPS_FUNC_PSHARESTATUS) |
+ (1 << GPS_FUNC_PSHAREPARAMS)))
+ }
+ Case (GPS_FUNC_GETCALLBACKS)
+ {
+ CreateDWordField (Arg1, 0, QURY)
+
+ /* Driver querying for which callbacks the ACPI code
+ wants callbacks for. */
+ If (QURY == 0)
+ {
+ Return (GPSR)
+ }
+
+ If (QURY & 0x4)
+ {
+ Printf("GPS: Kernel driver callback post power state transition")
+ Return (GPSR)
+ }
+ }
+ Case (GPS_FUNC_PSHARESTATUS)
+ {
+ Return (ITOB(
+ (0 << 0) | /* GPS_FUNC_PSHAREPARAMS should not be called
+ again after initialization, i.e., its return
+ value is not dynamically updated. */
+ (1 << 0) | /* System uses both a GPIO and ACPI notification
+ codes to set multiple GPU power limits. */
+ (0 << 21))) /* EDPpeak limit is default */
+ }
+ Case (GPS_FUNC_PSHAREPARAMS)
+ {
+ CreateField (Arg1, 0, 4, QUTY) /* Query type */
+
+ /* Version of return value */
+ VRV1 = 0x10000
+ Switch (ToInteger (QUTY))
+ {
+ Case (QUERY_GET_STATUS)
+ {
+ Return (GPSP)
+ }
+ Case (QUERY_GET_SUPPORTED_FIELDS)
+ {
+ /* Only GPU temperature is supported */
+ RETN = 0x100 | ToInteger (QUTY)
+ Return (GPSP)
+ }
+ Case (QUERY_GET_CURRENT_LIMITS)
+ {
+ /* Request a limit of '0' for the GPU temperature,
+ meaning there is no limit. */
+ RETN = 0x102
+ TGPU = 0
+ Return (GPSP)
+ }
+ }
+ }
+ }
+
+ Return (NV_ERROR_UNSUPPORTED)
+}
diff --git a/src/mainboard/google/brya/acpi/gpu_defines.h b/src/mainboard/google/brya/acpi/gpu_defines.h
index ec79f81b7d..ec17a1c452 100644
--- a/src/mainboard/google/brya/acpi/gpu_defines.h
+++ b/src/mainboard/google/brya/acpi/gpu_defines.h
@@ -39,8 +39,10 @@
#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 UUID_GPS "a3132d01-8cda-49ba-a52e-bc9d46df6b81"
#define REVISION_MIN_NVOP 0x100
#define REVISION_MIN_NVJT 0x100
#define REVISION_MIN_NBCI 0x102
#define REVISION_MIN_NVPCF 0x200
+#define REVISION_MIN_GPS 0x200
diff --git a/src/mainboard/google/brya/acpi/gpu_top.asl b/src/mainboard/google/brya/acpi/gpu_top.asl
index 6b492231e3..f3b348aba8 100644
--- a/src/mainboard/google/brya/acpi/gpu_top.asl
+++ b/src/mainboard/google/brya/acpi/gpu_top.asl
@@ -24,6 +24,7 @@ Scope (\_SB.PCI0.PEG0)
#include "nvjt.asl"
#include "nbci.asl"
#include "nvpcf.asl"
+ #include "gps.asl"
Method (_DSM, 4, Serialized)
{
@@ -55,6 +56,13 @@ Scope (\_SB.PCI0.PEG0)
Return (NPCF (Arg2, Arg3))
}
}
+ ElseIf (Arg0 == ToUUID (UUID_GPS))
+ {
+ If (ToInteger (Arg1) != REVISION_MIN_GPS)
+ {
+ Return (GPS (Arg2, Arg3))
+ }
+ }
Return (NV_ERROR_UNSUPPORTED)
}