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