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>
This commit is contained in:
parent
b97a303fa6
commit
3d79f7f13e
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
Loading…
Reference in New Issue