summaryrefslogtreecommitdiff
path: root/src/mainboard
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2022-06-28 12:08:52 -0600
committerFelix Held <felix-coreboot@felixheld.de>2022-07-20 12:35:59 +0000
commit8702450e51114d6e366005ac78331661bc5ad93b (patch)
tree36c0c414334234434ff0752a065cd00e13b5becd /src/mainboard
parentde21ba07588f5bbf8f763de215dcf6fd1cb6ba2f (diff)
mb/google/brya/acpi: Add support for D Notify event from the Chrome EC
The agah EC code includes a driver to keep track of the current D Notify level that the GPU should be at. When it changes, it will send a host event to the ACPI FW, which will then pass that Notify on to the kernel driver. This patch adds support for that feature, which is described in the Nvidia Software Design Guide. BUG=b:229405562 TEST=add Printf() calls to the ACPI, and work through the various scenarios on the EC that will cause D Notify levels to change; this will cause the Printfs() to show up in the kernel log. Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Change-Id: I5cd8bd7d177ea10a165613ed0726a6d6fd86c226 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65486 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Robert Zieba <robertzieba@google.com> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/google/brya/acpi/gpu_defines.h12
-rw-r--r--src/mainboard/google/brya/acpi/gpu_ec.asl13
-rw-r--r--src/mainboard/google/brya/acpi/gpu_top.asl27
3 files changed, 52 insertions, 0 deletions
diff --git a/src/mainboard/google/brya/acpi/gpu_defines.h b/src/mainboard/google/brya/acpi/gpu_defines.h
index ec17a1c452..1cb03145b0 100644
--- a/src/mainboard/google/brya/acpi/gpu_defines.h
+++ b/src/mainboard/google/brya/acpi/gpu_defines.h
@@ -46,3 +46,15 @@
#define REVISION_MIN_NBCI 0x102
#define REVISION_MIN_NVPCF 0x200
#define REVISION_MIN_GPS 0x200
+
+#define D1_EC 0
+#define D2_EC 1
+#define D3_EC 2
+#define D4_EC 3
+#define D5_EC 4
+
+#define D1_GPU 0xD1
+#define D2_GPU 0xD2
+#define D3_GPU 0xD3
+#define D4_GPU 0xD4
+#define D5_GPU 0xD5
diff --git a/src/mainboard/google/brya/acpi/gpu_ec.asl b/src/mainboard/google/brya/acpi/gpu_ec.asl
new file mode 100644
index 0000000000..998d9c0e6a
--- /dev/null
+++ b/src/mainboard/google/brya/acpi/gpu_ec.asl
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#define EC_D_NOTIFY_MASK 0x7
+
+Scope (\_SB.PCI0.LPCB.EC0)
+{
+ /* EC has data for GPU in memmap */
+ Method (_Q0C, 0, Serialized)
+ {
+ Local0 = ToInteger(GPUD) & EC_D_NOTIFY_MASK
+ \_SB.PCI0.PEG0.PEGP.DNOT (Local0)
+ }
+}
diff --git a/src/mainboard/google/brya/acpi/gpu_top.asl b/src/mainboard/google/brya/acpi/gpu_top.asl
index f3b348aba8..c98358ff8d 100644
--- a/src/mainboard/google/brya/acpi/gpu_top.asl
+++ b/src/mainboard/google/brya/acpi/gpu_top.asl
@@ -25,6 +25,33 @@ Scope (\_SB.PCI0.PEG0)
#include "nbci.asl"
#include "nvpcf.asl"
#include "gps.asl"
+ #include "gpu_ec.asl"
+
+ /* Convert D Notify from EC to GPU */
+ Method (CNVD, 1, NotSerialized)
+ {
+ Switch (ToInteger(Arg0)) {
+ Case (D1_EC) { Return (D1_GPU) }
+ Case (D2_EC) { Return (D2_GPU) }
+ Case (D3_EC) { Return (D3_GPU) }
+ Case (D4_EC) { Return (D4_GPU) }
+ Case (D5_EC) { Return (D5_GPU) }
+ Default { Return (D5_GPU) }
+ }
+ }
+
+ /* Current D Notify Value, defaults to D1 */
+ Name (CDNV, D1_EC)
+ Method (DNOT, 1, Serialized)
+ {
+ Printf ("EC: GPU D-Notify, %o", Arg0)
+ If (Arg0 != CDNV)
+ {
+ CDNV = Arg0
+ Local0 = CNVD (Arg0)
+ Notify (\_SB.PCI0.PEG0.PEGP, Local0)
+ }
+ }
Method (_DSM, 4, Serialized)
{