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