]> git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
SecurityPkg: Tcg: New field for User Confirmation Status
[mirror_edk2.git] / SecurityPkg / Tcg / Tcg2Smm / Tpm.asl
1 /** @file
2 The TPM2 definition block in ACPI table for TCG2 physical presence
3 and MemoryClear.
4
5 Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
6 (c)Copyright 2016 HP Development Company, L.P.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15 **/
16
17 DefinitionBlock (
18 "Tpm.aml",
19 "SSDT",
20 2,
21 "INTEL ",
22 "Tpm2Tabl",
23 0x1000
24 )
25 {
26 Scope (\_SB)
27 {
28 Device (TPM)
29 {
30 //
31 // TCG2
32 //
33 Name (_HID, "MSFT0101")
34
35 //
36 // Readable name of this device, don't know if this way is correct yet
37 //
38 Name (_STR, Unicode ("TPM 2.0 Device"))
39
40 //
41 // Return the resource consumed by TPM device
42 //
43 Name (_CRS, ResourceTemplate () {
44 Memory32Fixed (ReadWrite, 0xfed40000, 0x5000)
45 })
46
47 //
48 // Operational region for Smi port access
49 //
50 OperationRegion (SMIP, SystemIO, 0xB2, 1)
51 Field (SMIP, ByteAcc, NoLock, Preserve)
52 {
53 IOB2, 8
54 }
55
56 //
57 // Operational region for TPM access
58 //
59 OperationRegion (TPMR, SystemMemory, 0xfed40000, 0x5000)
60 Field (TPMR, AnyAcc, NoLock, Preserve)
61 {
62 ACC0, 8,
63 }
64
65 //
66 // Operational region for TPM support, TPM Physical Presence and TPM Memory Clear
67 // Region Offset 0xFFFF0000 and Length 0xF0 will be fixed in C code.
68 //
69 OperationRegion (TNVS, SystemMemory, 0xFFFF0000, 0xF0)
70 Field (TNVS, AnyAcc, NoLock, Preserve)
71 {
72 PPIN, 8, // Software SMI for Physical Presence Interface
73 PPIP, 32, // Used for save physical presence paramter
74 PPRP, 32, // Physical Presence request operation response
75 PPRQ, 32, // Physical Presence request operation
76 PPRM, 32, // Physical Presence request operation parameter
77 LPPR, 32, // Last Physical Presence request operation
78 FRET, 32, // Physical Presence function return code
79 MCIN, 8, // Software SMI for Memory Clear Interface
80 MCIP, 32, // Used for save the Mor paramter
81 MORD, 32, // Memory Overwrite Request Data
82 MRET, 32, // Memory Overwrite function return code
83 UCRQ, 32 // Phyical Presence request operation to Get User Confirmation Status
84 }
85
86 Method (PTS, 1, Serialized)
87 {
88 //
89 // Detect Sx state for MOR, only S4, S5 need to handle
90 //
91 If (LAnd (LLess (Arg0, 6), LGreater (Arg0, 3)))
92 {
93 //
94 // Bit4 -- DisableAutoDetect. 0 -- Firmware MAY autodetect.
95 //
96 If (LNot (And (MORD, 0x10)))
97 {
98 //
99 // Triggle the SMI through ACPI _PTS method.
100 //
101 Store (0x02, MCIP)
102
103 //
104 // Triggle the SMI interrupt
105 //
106 Store (MCIN, IOB2)
107 }
108 }
109 Return (0)
110 }
111
112 Method (_STA, 0)
113 {
114 if (LEqual (ACC0, 0xff))
115 {
116 Return (0)
117 }
118 Return (0x0f)
119 }
120
121 //
122 // TCG Hardware Information
123 //
124 Method (HINF, 3, Serialized, 0, {BuffObj, PkgObj}, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj
125 {
126 //
127 // Switch by function index
128 //
129 Switch (ToInteger(Arg1))
130 {
131 Case (0)
132 {
133 //
134 // Standard query
135 //
136 Return (Buffer () {0x03})
137 }
138 Case (1)
139 {
140 //
141 // Return failure if no TPM present
142 //
143 Name(TPMV, Package () {0x01, Package () {0x2, 0x0}})
144 if (LEqual (_STA (), 0x00))
145 {
146 Return (Package () {0x00})
147 }
148
149 //
150 // Return TPM version
151 //
152 Return (TPMV)
153 }
154 Default {BreakPoint}
155 }
156 Return (Buffer () {0})
157 }
158
159 Name(TPM2, Package (0x02){
160 Zero,
161 Zero
162 })
163
164 Name(TPM3, Package (0x03){
165 Zero,
166 Zero,
167 Zero
168 })
169
170 //
171 // TCG Physical Presence Interface
172 //
173 Method (TPPI, 3, Serialized, 0, {BuffObj, PkgObj, IntObj, StrObj}, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj
174 {
175 //
176 // Switch by function index
177 //
178 Switch (ToInteger(Arg1))
179 {
180 Case (0)
181 {
182 //
183 // Standard query, supports function 1-8
184 //
185 Return (Buffer () {0xFF, 0x01})
186 }
187 Case (1)
188 {
189 //
190 // a) Get Physical Presence Interface Version
191 //
192 Return ("$PV")
193 }
194 Case (2)
195 {
196 //
197 // b) Submit TPM Operation Request to Pre-OS Environment
198 //
199
200 Store (DerefOf (Index (Arg2, 0x00)), PPRQ)
201 Store (0x02, PPIP)
202
203 //
204 // Triggle the SMI interrupt
205 //
206 Store (PPIN, IOB2)
207 Return (FRET)
208
209
210 }
211 Case (3)
212 {
213 //
214 // c) Get Pending TPM Operation Requested By the OS
215 //
216
217 Store (PPRQ, Index (TPM2, 0x01))
218 Return (TPM2)
219 }
220 Case (4)
221 {
222 //
223 // d) Get Platform-Specific Action to Transition to Pre-OS Environment
224 //
225 Return (2)
226 }
227 Case (5)
228 {
229 //
230 // e) Return TPM Operation Response to OS Environment
231 //
232 Store (0x05, PPIP)
233
234 //
235 // Triggle the SMI interrupt
236 //
237 Store (PPIN, IOB2)
238
239 Store (LPPR, Index (TPM3, 0x01))
240 Store (PPRP, Index (TPM3, 0x02))
241
242 Return (TPM3)
243 }
244 Case (6)
245 {
246
247 //
248 // f) Submit preferred user language (Not implemented)
249 //
250
251 Return (3)
252
253 }
254 Case (7)
255 {
256 //
257 // g) Submit TPM Operation Request to Pre-OS Environment 2
258 //
259 Store (7, PPIP)
260 Store (DerefOf (Index (Arg2, 0x00)), PPRQ)
261 Store (0, PPRM)
262 If (LEqual (PPRQ, 23)) {
263 Store (DerefOf (Index (Arg2, 0x01)), PPRM)
264 }
265
266 //
267 // Triggle the SMI interrupt
268 //
269 Store (PPIN, IOB2)
270 Return (FRET)
271 }
272 Case (8)
273 {
274 //
275 // e) Get User Confirmation Status for Operation
276 //
277 Store (8, PPIP)
278 Store (DerefOf (Index (Arg2, 0x00)), UCRQ)
279
280 //
281 // Triggle the SMI interrupt
282 //
283 Store (PPIN, IOB2)
284
285 Return (FRET)
286 }
287
288 Default {BreakPoint}
289 }
290 Return (1)
291 }
292
293 Method (TMCI, 3, Serialized, 0, IntObj, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj
294 {
295 //
296 // Switch by function index
297 //
298 Switch (ToInteger (Arg1))
299 {
300 Case (0)
301 {
302 //
303 // Standard query, supports function 1-1
304 //
305 Return (Buffer () {0x03})
306 }
307 Case (1)
308 {
309 //
310 // Save the Operation Value of the Request to MORD (reserved memory)
311 //
312 Store (DerefOf (Index (Arg2, 0x00)), MORD)
313
314 //
315 // Triggle the SMI through ACPI _DSM method.
316 //
317 Store (0x01, MCIP)
318
319 //
320 // Triggle the SMI interrupt
321 //
322 Store (MCIN, IOB2)
323 Return (MRET)
324 }
325 Default {BreakPoint}
326 }
327 Return (1)
328 }
329
330 Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj})
331 {
332
333 //
334 // TCG Hardware Information
335 //
336 If(LEqual(Arg0, ToUUID ("cf8e16a5-c1e8-4e25-b712-4f54a96702c8")))
337 {
338 Return (HINF (Arg1, Arg2, Arg3))
339 }
340
341 //
342 // TCG Physical Presence Interface
343 //
344 If(LEqual(Arg0, ToUUID ("3dddfaa6-361b-4eb4-a424-8d10089d1653")))
345 {
346 Return (TPPI (Arg1, Arg2, Arg3))
347 }
348
349 //
350 // TCG Memory Clear Interface
351 //
352 If(LEqual(Arg0, ToUUID ("376054ed-cc13-4675-901c-4756d7f2d45d")))
353 {
354 Return (TMCI (Arg1, Arg2, Arg3))
355 }
356
357 Return (Buffer () {0})
358 }
359 }
360 }
361 }