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