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