payloads/edk2: Disable the CPU Timer Lib unless supported
[coreboot.git] / src / mainboard / system76 / bonw14 / acpi / dgpu.asl
blob6521ee947e7f3898cab25b98ee8063273762696a
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 Device (\_SB.PCI0.PEG0)
5         Name (_ADR, 0x00010000)
7         Device (PEGP)
8         {
9                 Name (_ADR, 0)
11                 // Convert a byte to a hex string, trimming extra parts
12                 Method (BHEX, 1)
13                 {
14                         Local0 = ToHexString(Arg0)
15                         Return (Mid(Local0, SizeOf(Local0) - 2, 2))
16                 }
18                 // UUID to string
19                 Method (IDST, 1)
20                 {
21                         Local0 = ""
22                         Fprintf(
23                                 Local0,
24                                 "%o%o%o%o-%o%o-%o%o-%o%o-%o%o%o%o%o%o",
25                                 BHEX(DerefOf(Arg0[3])),
26                                 BHEX(DerefOf(Arg0[2])),
27                                 BHEX(DerefOf(Arg0[1])),
28                                 BHEX(DerefOf(Arg0[0])),
29                                 BHEX(DerefOf(Arg0[5])),
30                                 BHEX(DerefOf(Arg0[4])),
31                                 BHEX(DerefOf(Arg0[7])),
32                                 BHEX(DerefOf(Arg0[6])),
33                                 BHEX(DerefOf(Arg0[8])),
34                                 BHEX(DerefOf(Arg0[9])),
35                                 BHEX(DerefOf(Arg0[10])),
36                                 BHEX(DerefOf(Arg0[11])),
37                                 BHEX(DerefOf(Arg0[12])),
38                                 BHEX(DerefOf(Arg0[13])),
39                                 BHEX(DerefOf(Arg0[14])),
40                                 BHEX(DerefOf(Arg0[15]))
41                         )
42                         Return (Local0)
43                 }
45                 // Safe hex conversion, checks type first
46                 Method (SFST, 1)
47                 {
48                         Local0 = ObjectType(Arg0)
49                         If (Local0 == 1 || Local0 == 2 || Local0 == 3) {
50                                 Return (ToHexString(Arg0))
51                         } Else {
52                                 Return (Concatenate("Type: ", Arg0))
53                         }
54                 }
56                 Method (_DSM, 4, Serialized)
57                 {
58                         Debug = "NVIDIA _DSM"
59                         Printf("  Arg0: %o", IDST(Arg0))
60                         Printf("  Arg1: %o", SFST(Arg1))
61                         Printf("  Arg2: %o", SFST(Arg2))
62                         Printf("  Arg3: %o", SFST(Arg3))
64                         If (Arg0 == ToUUID ("d4a50b75-65c7-46f7-bfb7-41514cea0244")) {
65                                 If (Arg1 != 0x0102) {
66                                         Printf("  Invalid Arg1, return 0x80000002")
67                                         Return (0x80000002)
68                                 }
70                                 If (Arg2 == 0) {
71                                         Printf("  Arg2 == 0x00, return supported functions")
72                                         Return (Buffer (4) { 0x01, 0x00, 0x10, 0x00 })
73                                 }
75                                 If (Arg2 == 0x14) {
76                                         Printf("  Arg2 == 0x14, return backlight package")
77                                         Return (Package (9) {
78                                                 0x8000A450,
79                                                 0x0200,
80                                                 0,
81                                                 0,
82                                                 1,
83                                                 1,
84                                                 200,
85                                                 32,
86                                                 1000
87                                         })
88                                 }
90                                 Printf("  Unknown Arg2, return 0x80000002")
91                                 Return (0x80000002)
92                         }
94                         Printf("  Unknown Arg0, return 0x80000001")
95                         Return (0x80000001)
96                 }
98                 // _DOD: Display Output Devices
99                 Method (_DOD, 0, NotSerialized)
100                 {
101                         Return (Package (3) {
102                                 0x80008320,
103                                 0x80006330,
104                                 0x8000A450
105                         })
106                 }
108                 Device (HDM0)
109                 {
110                         Name (_ADR, 0x80008320)
111                 }
113                 Device (DSP0)
114                 {
115                         Name (_ADR, 0x80006330)
116                 }
118                 Device (DSP1)
119                 {
120                         Name (_ADR, 0x8000A450)
121                 }
122         }