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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
/* SPDX-License-Identifier: GPL-2.0-only */
Device (UCSI)
{
Name (_HID, "GOOG000E")
Name (_CID, EisaId ("PNP0CA0"))
Name (_DDN, "Wilco EC UCSI")
Name (_UID, One)
Name (_STA, 0xf)
/* Value written to EC control register to start UCSI command */
Name (UCMD, 0xE0)
/* Shared memory fields are defined in the SSDT */
External (VER0, FieldUnitObj)
External (VER1, FieldUnitObj)
External (CCI0, FieldUnitObj)
External (CCI1, FieldUnitObj)
External (CCI2, FieldUnitObj)
External (CCI3, FieldUnitObj)
External (CTL0, FieldUnitObj)
External (CTL1, FieldUnitObj)
External (CTL2, FieldUnitObj)
External (CTL3, FieldUnitObj)
External (CTL4, FieldUnitObj)
External (CTL5, FieldUnitObj)
External (CTL6, FieldUnitObj)
External (CTL7, FieldUnitObj)
External (MGI0, FieldUnitObj)
External (MGI1, FieldUnitObj)
External (MGI2, FieldUnitObj)
External (MGI3, FieldUnitObj)
External (MGI4, FieldUnitObj)
External (MGI5, FieldUnitObj)
External (MGI6, FieldUnitObj)
External (MGI7, FieldUnitObj)
External (MGI8, FieldUnitObj)
External (MGI9, FieldUnitObj)
External (MGIA, FieldUnitObj)
External (MGIB, FieldUnitObj)
External (MGIC, FieldUnitObj)
External (MGID, FieldUnitObj)
External (MGIE, FieldUnitObj)
External (MGIF, FieldUnitObj)
External (MGO0, FieldUnitObj)
External (MGO1, FieldUnitObj)
External (MGO2, FieldUnitObj)
External (MGO3, FieldUnitObj)
External (MGO4, FieldUnitObj)
External (MGO5, FieldUnitObj)
External (MGO6, FieldUnitObj)
External (MGO7, FieldUnitObj)
External (MGO8, FieldUnitObj)
External (MGO9, FieldUnitObj)
External (MGOA, FieldUnitObj)
External (MGOB, FieldUnitObj)
External (MGOC, FieldUnitObj)
External (MGOD, FieldUnitObj)
External (MGOE, FieldUnitObj)
External (MGOF, FieldUnitObj)
Method (INIT)
{
/* Read UCSI version from EC into shared memory */
^VER0 = R (^^UVR0)
^VER1 = R (^^UVR1)
}
Method (_DSM, 4, Serialized)
{
If (Arg0 != ToUUID ("6f8398c2-7ca4-11e4-ad36-631042b5008f")) {
Return (Buffer (One) { Zero })
}
Switch (ToInteger (Arg2))
{
Case (Zero)
{
Return (Buffer (One) { 0x07 })
}
Case (One)
{
/* Write Message Out */
W (^^UMO0, ^MGO0)
W (^^UMO1, ^MGO1)
W (^^UMO2, ^MGO2)
W (^^UMO3, ^MGO3)
W (^^UMO4, ^MGO4)
W (^^UMO5, ^MGO5)
W (^^UMO6, ^MGO6)
W (^^UMO7, ^MGO7)
W (^^UMO8, ^MGO8)
W (^^UMO9, ^MGO9)
W (^^UMOA, ^MGOA)
W (^^UMOB, ^MGOB)
W (^^UMOC, ^MGOC)
W (^^UMOD, ^MGOD)
W (^^UMOE, ^MGOE)
W (^^UMOF, ^MGOF)
/* Write Control */
W (^^UCL0, ^CTL0)
W (^^UCL1, ^CTL1)
W (^^UCL2, ^CTL2)
W (^^UCL3, ^CTL3)
W (^^UCL4, ^CTL4)
W (^^UCL5, ^CTL5)
W (^^UCL6, ^CTL6)
W (^^UCL7, ^CTL7)
/* Start EC Command */
W (^^UCTL, ^UCMD)
}
Case (2)
{
/* Read Message In */
^MGI0 = R (^^UMI0)
^MGI1 = R (^^UMI1)
^MGI2 = R (^^UMI2)
^MGI3 = R (^^UMI3)
^MGI4 = R (^^UMI4)
^MGI5 = R (^^UMI5)
^MGI6 = R (^^UMI6)
^MGI7 = R (^^UMI7)
^MGI8 = R (^^UMI8)
^MGI9 = R (^^UMI9)
^MGIA = R (^^UMIA)
^MGIB = R (^^UMIB)
^MGIC = R (^^UMIC)
^MGID = R (^^UMID)
^MGIE = R (^^UMIE)
^MGIF = R (^^UMIF)
/* Read Status */
^CCI0 = R (^^UCI0)
^CCI1 = R (^^UCI1)
^CCI2 = R (^^UCI2)
^CCI3 = R (^^UCI3)
}
}
Return (Buffer (One) { Zero })
}
}
|