--- /dev/null
+/** @file\r
+ The TPM2 definition block in ACPI table for TrEE physical presence \r
+ and MemoryClear.\r
+\r
+Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+DefinitionBlock (\r
+ "Tpm.aml",\r
+ "SSDT",\r
+ 1,\r
+ "INTEL ",\r
+ "Tpm2Tabl",\r
+ 0x1000\r
+ )\r
+{\r
+ Scope (\_SB)\r
+ {\r
+ Device (TPM)\r
+ {\r
+ //\r
+ // TREE\r
+ //\r
+ Name (_HID, "MSFT0101")\r
+ \r
+ //\r
+ // Readable name of this device, don't know if this way is correct yet\r
+ //\r
+ Name (_STR, Unicode ("TPM 2.0 Device"))\r
+\r
+ //\r
+ // Return the resource consumed by TPM device\r
+ //\r
+ Name (_CRS, ResourceTemplate () {\r
+ Memory32Fixed (ReadOnly, 0xfed40000, 0x5000)\r
+ })\r
+\r
+ //\r
+ // Operational region for Smi port access\r
+ //\r
+ OperationRegion (SMIP, SystemIO, 0xB2, 1)\r
+ Field (SMIP, ByteAcc, NoLock, Preserve)\r
+ { \r
+ IOB2, 8\r
+ }\r
+\r
+ //\r
+ // Operational region for TPM access\r
+ //\r
+ OperationRegion (TPMR, SystemMemory, 0xfed40000, 0x5000)\r
+ Field (TPMR, AnyAcc, NoLock, Preserve)\r
+ {\r
+ ACC0, 8,\r
+ }\r
+\r
+ //\r
+ // Operational region for TPM support, TPM Physical Presence and TPM Memory Clear\r
+ // Region Offset 0xFFFF0000 and Length 0xF0 will be fixed in C code.\r
+ //\r
+ OperationRegion (TNVS, SystemMemory, 0xFFFF0000, 0xF0)\r
+ Field (TNVS, AnyAcc, NoLock, Preserve)\r
+ {\r
+ PPIN, 8, // Software SMI for Physical Presence Interface\r
+ PPIP, 32, // Used for save physical presence paramter\r
+ PPRP, 32, // Physical Presence request operation response\r
+ PPRQ, 32, // Physical Presence request operation\r
+ LPPR, 32, // Last Physical Presence request operation\r
+ FRET, 32, // Physical Presence function return code\r
+ MCIN, 8, // Software SMI for Memory Clear Interface\r
+ MCIP, 32, // Used for save the Mor paramter\r
+ MORD, 32, // Memory Overwrite Request Data\r
+ MRET, 32 // Memory Overwrite function return code\r
+ }\r
+\r
+ Method (PTS, 1, Serialized)\r
+ { \r
+ //\r
+ // Detect Sx state for MOR, only S4, S5 need to handle\r
+ //\r
+ If (LAnd (LLess (Arg0, 6), LGreater (Arg0, 3)))\r
+ { \r
+ //\r
+ // Bit4 -- DisableAutoDetect. 0 -- Firmware MAY autodetect.\r
+ //\r
+ If (LNot (And (MORD, 0x10)))\r
+ {\r
+ //\r
+ // Triggle the SMI through ACPI _PTS method.\r
+ //\r
+ Store (0x02, MCIP)\r
+ \r
+ //\r
+ // Triggle the SMI interrupt\r
+ //\r
+ Store (MCIN, IOB2)\r
+ }\r
+ }\r
+ Return (0)\r
+ } \r
+\r
+ Method (_STA, 0)\r
+ {\r
+ if (LEqual (ACC0, 0xff))\r
+ {\r
+ Return (0)\r
+ }\r
+ Return (0x0f)\r
+ }\r
+\r
+ //\r
+ // TCG Hardware Information\r
+ //\r
+ Method (HINF, 3, Serialized, 0, {BuffObj, PkgObj}, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj\r
+ {\r
+ //\r
+ // Switch by function index\r
+ //\r
+ Switch (ToInteger(Arg1))\r
+ {\r
+ Case (0)\r
+ {\r
+ //\r
+ // Standard query\r
+ //\r
+ Return (Buffer () {0x03})\r
+ }\r
+ Case (1)\r
+ {\r
+ //\r
+ // Return failure if no TPM present\r
+ //\r
+ Name(TPMV, Package () {0x01, Package () {0x2, 0x0}})\r
+ if (LEqual (_STA (), 0x00))\r
+ {\r
+ Return (Package () {0x00})\r
+ }\r
+\r
+ //\r
+ // Return TPM version\r
+ //\r
+ Return (TPMV)\r
+ }\r
+ Default {BreakPoint}\r
+ }\r
+ Return (Buffer () {0})\r
+ }\r
+\r
+ Name(TPM2, Package (0x02){\r
+ Zero, \r
+ Zero\r
+ })\r
+\r
+ Name(TPM3, Package (0x03){\r
+ Zero, \r
+ Zero,\r
+ Zero\r
+ })\r
+\r
+ //\r
+ // TCG Physical Presence Interface\r
+ //\r
+ Method (TPPI, 3, Serialized, 0, {BuffObj, PkgObj, IntObj, StrObj}, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj\r
+ { \r
+ //\r
+ // Switch by function index\r
+ //\r
+ Switch (ToInteger(Arg1))\r
+ {\r
+ Case (0)\r
+ {\r
+ //\r
+ // Standard query, supports function 1-8\r
+ //\r
+ Return (Buffer () {0xFF, 0x01})\r
+ }\r
+ Case (1)\r
+ {\r
+ //\r
+ // a) Get Physical Presence Interface Version\r
+ //\r
+ Return ("1.2")\r
+ }\r
+ Case (2)\r
+ {\r
+ //\r
+ // b) Submit TPM Operation Request to Pre-OS Environment\r
+ //\r
+ \r
+ Store (DerefOf (Index (Arg2, 0x00)), PPRQ)\r
+ Store (0x02, PPIP)\r
+ \r
+ //\r
+ // Triggle the SMI interrupt\r
+ //\r
+ Store (PPIN, IOB2)\r
+ Return (FRET)\r
+\r
+\r
+ }\r
+ Case (3)\r
+ {\r
+ //\r
+ // c) Get Pending TPM Operation Requested By the OS\r
+ //\r
+ \r
+ Store (PPRQ, Index (TPM2, 0x01))\r
+ Return (TPM2)\r
+ }\r
+ Case (4)\r
+ {\r
+ //\r
+ // d) Get Platform-Specific Action to Transition to Pre-OS Environment\r
+ //\r
+ Return (2)\r
+ }\r
+ Case (5)\r
+ {\r
+ //\r
+ // e) Return TPM Operation Response to OS Environment\r
+ //\r
+ Store (0x05, PPIP)\r
+ \r
+ //\r
+ // Triggle the SMI interrupt\r
+ //\r
+ Store (PPIN, IOB2)\r
+ \r
+ Store (LPPR, Index (TPM3, 0x01))\r
+ Store (PPRP, Index (TPM3, 0x02))\r
+\r
+ Return (TPM3)\r
+ }\r
+ Case (6)\r
+ {\r
+\r
+ //\r
+ // f) Submit preferred user language (Not implemented)\r
+ //\r
+\r
+ Return (3)\r
+\r
+ }\r
+ Case (7)\r
+ {\r
+ //\r
+ // g) Submit TPM Operation Request to Pre-OS Environment 2\r
+ //\r
+ Store (7, PPIP)\r
+ Store (DerefOf (Index (Arg2, 0x00)), PPRQ)\r
+ \r
+ //\r
+ // Triggle the SMI interrupt \r
+ //\r
+ Store (PPIN, IOB2) \r
+ Return (FRET)\r
+ }\r
+ Case (8)\r
+ {\r
+ //\r
+ // e) Get User Confirmation Status for Operation\r
+ //\r
+ Store (8, PPIP)\r
+ Store (DerefOf (Index (Arg2, 0x00)), PPRQ)\r
+ \r
+ //\r
+ // Triggle the SMI interrupt\r
+ //\r
+ Store (PPIN, IOB2)\r
+ \r
+ Return (FRET)\r
+ }\r
+\r
+ Default {BreakPoint}\r
+ }\r
+ Return (1)\r
+ }\r
+\r
+ Method (TMCI, 3, Serialized, 0, IntObj, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj\r
+ {\r
+ //\r
+ // Switch by function index\r
+ //\r
+ Switch (ToInteger (Arg1))\r
+ {\r
+ Case (0)\r
+ {\r
+ //\r
+ // Standard query, supports function 1-1\r
+ //\r
+ Return (Buffer () {0x03})\r
+ }\r
+ Case (1)\r
+ {\r
+ //\r
+ // Save the Operation Value of the Request to MORD (reserved memory)\r
+ //\r
+ Store (DerefOf (Index (Arg2, 0x00)), MORD)\r
+ \r
+ //\r
+ // Triggle the SMI through ACPI _DSM method.\r
+ //\r
+ Store (0x01, MCIP)\r
+ \r
+ //\r
+ // Triggle the SMI interrupt\r
+ //\r
+ Store (MCIN, IOB2)\r
+ Return (MRET)\r
+ }\r
+ Default {BreakPoint}\r
+ }\r
+ Return (1) \r
+ }\r
+\r
+ Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj})\r
+ {\r
+\r
+ //\r
+ // TCG Hardware Information\r
+ //\r
+ If(LEqual(Arg0, ToUUID ("cf8e16a5-c1e8-4e25-b712-4f54a96702c8")))\r
+ {\r
+ Return (HINF (Arg1, Arg2, Arg3))\r
+ }\r
+\r
+ //\r
+ // TCG Physical Presence Interface\r
+ //\r
+ If(LEqual(Arg0, ToUUID ("3dddfaa6-361b-4eb4-a424-8d10089d1653")))\r
+ {\r
+ Return (TPPI (Arg1, Arg2, Arg3))\r
+ }\r
+\r
+ //\r
+ // TCG Memory Clear Interface\r
+ //\r
+ If(LEqual(Arg0, ToUUID ("376054ed-cc13-4675-901c-4756d7f2d45d")))\r
+ {\r
+ Return (TMCI (Arg1, Arg2, Arg3))\r
+ }\r
+\r
+ Return (Buffer () {0})\r
+ }\r
+ }\r
+ }\r
+}\r