summaryrefslogtreecommitdiff
path: root/src/mainboard/google/brox/acpi/gpu_top.asl
blob: 492502c3d48cfb571d8a203290bc14e7dda63793 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* SPDX-License-Identifier: GPL-2.0-or-later */

#include "gpu_defines.h"

Scope (\_SB.PCI0.PEG0)
{
	#include "peg.asl"

	Device (PEGP)
	{
		Name (_ADR, 0x0)
		OperationRegion (PCIC, PCI_Config, 0x00, 0x100)
		Field (PCIC, DWordAcc, NoLock, Preserve)
		{
			NVID,	16,
			NDID,	16,
			CMDR,	8,
			VGAR,	2008,			/* VGA Registers */
		}

		#include "utility.asl"
		#include "power.asl"
		#include "nvop.asl"
		#include "nvjt.asl"
		#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
		* Arg0 == Shared value
		* Arg1 == force notification if no change (0 or 1)
		*/
		Name (CDNV, D1_EC)
		Method (DNOT, 2, Serialized)
		{
			Printf ("EC: GPU D-Notify, %o", Arg0)
			If ((Arg0 != CDNV) || (Arg1 == 1))
			{
				CDNV = Arg0
				Local0 = CNVD (Arg0)
				Notify (\_SB.PCI0.PEG0.PEGP, Local0)
			}
		}

		Method (_DSM, 4, Serialized)
		{
			If (Arg0 == ToUUID (UUID_NVOP))
			{
				If (ToInteger(Arg1) >= REVISION_MIN_NVOP)
				{
					Return (NVOP (Arg2, Arg3))
				}
			}
			ElseIf (Arg0 == ToUUID (UUID_NVJT))
			{
				If (ToInteger (Arg1) >= REVISION_MIN_NVJT)
				{
					Return (NVJT (Arg2, Arg3))
				}
			}
			ElseIf (Arg0 == ToUUID (UUID_NBCI))
			{
				If (ToInteger (Arg1) >= REVISION_MIN_NBCI)
				{
					Return (NBCI (Arg2, Arg3))
				}
			}
			ElseIf (Arg0 == ToUUID (UUID_NVPCF))
			{
				If (ToInteger (Arg1) >= REVISION_MIN_NVPCF)
				{
					Return (NPCF (Arg2, Arg3))
				}
			}
			ElseIf (Arg0 == ToUUID (UUID_GPS))
			{
				If (ToInteger (Arg1) >= REVISION_MIN_GPS)
				{
					Return (GPS (Arg2, Arg3))
				}
			}

			Return (NV_ERROR_UNSUPPORTED)
		}
	}
}