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