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>
This commit is contained in:
Tim Wawrzynczak 2022-06-28 12:08:52 -06:00 committed by Felix Held
parent de21ba0758
commit 8702450e51
3 changed files with 52 additions and 0 deletions

View File

@ -46,3 +46,15 @@
#define REVISION_MIN_NBCI 0x102 #define REVISION_MIN_NBCI 0x102
#define REVISION_MIN_NVPCF 0x200 #define REVISION_MIN_NVPCF 0x200
#define REVISION_MIN_GPS 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

View File

@ -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)
}
}

View File

@ -25,6 +25,33 @@ Scope (\_SB.PCI0.PEG0)
#include "nbci.asl" #include "nbci.asl"
#include "nvpcf.asl" #include "nvpcf.asl"
#include "gps.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) Method (_DSM, 4, Serialized)
{ {