]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Tcg/TcgSmm/Tpm.asl
SecurityPkg Tcg: Use SW SMI IO port PCD in Tpm.asl
[mirror_edk2.git] / SecurityPkg / Tcg / TcgSmm / Tpm.asl
index 448ffecccfd862d32140ec2b81a584efca7591d4..9d5e6ddc110b5841dcac276600cc1a58790928e9 100644 (file)
@@ -1,15 +1,10 @@
 /** @file\r
-  The TPM definition block in ACPI table for physical presence  \r
+  The TPM definition block in ACPI table for physical presence\r
   and MemoryClear.\r
 \r
-Copyright (c) 2011 - 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
+Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) Microsoft Corporation.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -41,16 +36,16 @@ DefinitionBlock (
       // Return the resource consumed by TPM device\r
       //\r
       Name (_CRS, ResourceTemplate () {\r
-        Memory32Fixed (ReadOnly, 0xfed40000, 0x5000)\r
+        Memory32Fixed (ReadWrite, 0xfed40000, 0x5000)\r
       })\r
 \r
       //\r
       // Operational region for Smi port access\r
       //\r
-      OperationRegion (SMIP, SystemIO, 0xB2, 1)\r
+      OperationRegion (SMIP, SystemIO, FixedPcdGet16 (PcdSmiCommandIoPort), 1)\r
       Field (SMIP, ByteAcc, NoLock, Preserve)\r
-      { \r
-          IOB2, 8\r
+      {\r
+          IOPN, 8\r
       }\r
 \r
       //\r
@@ -70,42 +65,43 @@ DefinitionBlock (
       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
+        PPIP,   32, //   Used for save physical presence parameter\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
+        MCIP,   32, //   Used for save the Mor parameter\r
         MORD,   32, //   Memory Overwrite Request Data\r
-        MRET,   32  //   Memory Overwrite function return code\r
+        MRET,   32, //   Memory Overwrite function return code\r
+        UCRQ,   32  //   Physical Presence request operation to Get User Confirmation Status\r
       }\r
 \r
       Method (PTS, 1, Serialized)\r
-      {  \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
           //\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
+            // Trigger the SMI through ACPI _PTS method.\r
             //\r
             Store (0x02, MCIP)\r
-              \r
+\r
             //\r
-            // Triggle the SMI interrupt\r
+            // Trigger the SMI interrupt\r
             //\r
-            Store (MCIN, IOB2)\r
+            Store (MCIN, IOPN)\r
           }\r
         }\r
         Return (0)\r
-      }   \r
+      }\r
 \r
       Method (_STA, 0)\r
       {\r
@@ -119,12 +115,12 @@ DefinitionBlock (
       //\r
       // TCG Hardware Information\r
       //\r
-      Method (HINF, 3, Serialized, 0, {BuffObj, PkgObj}, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj\r
+      Method (HINF, 1, Serialized, 0, {BuffObj, PkgObj}, {UnknownObj}) // IntObj\r
       {\r
         //\r
         // Switch by function index\r
         //\r
-        Switch (ToInteger(Arg1))\r
+        Switch (ToInteger(Arg0))\r
         {\r
           Case (0)\r
           {\r
@@ -155,12 +151,12 @@ DefinitionBlock (
       }\r
 \r
       Name(TPM2, Package (0x02){\r
-        Zero, \r
+        Zero,\r
         Zero\r
       })\r
 \r
       Name(TPM3, Package (0x03){\r
-        Zero, \r
+        Zero,\r
         Zero,\r
         Zero\r
       })\r
@@ -168,12 +164,12 @@ DefinitionBlock (
       //\r
       // TCG Physical Presence Interface\r
       //\r
-      Method (TPPI, 3, Serialized, 0, {BuffObj, PkgObj, IntObj, StrObj}, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj\r
-      {        \r
+      Method (TPPI, 2, Serialized, 0, {BuffObj, PkgObj, IntObj, StrObj}, {UnknownObj, UnknownObj}) // IntObj, PkgObj\r
+      {\r
         //\r
         // Switch by function index\r
         //\r
-        Switch (ToInteger(Arg1))\r
+        Switch (ToInteger(Arg0))\r
         {\r
           Case (0)\r
           {\r
@@ -194,14 +190,14 @@ DefinitionBlock (
             //\r
             // b) Submit TPM Operation Request to Pre-OS Environment\r
             //\r
-                  \r
-            Store (DerefOf (Index (Arg2, 0x00)), PPRQ)\r
+\r
+            Store (DerefOf (Index (Arg1, 0x00)), PPRQ)\r
             Store (0x02, PPIP)\r
-              \r
+\r
             //\r
-            // Triggle the SMI interrupt\r
+            // Trigger the SMI interrupt\r
             //\r
-            Store (PPIN, IOB2)\r
+            Store (PPIN, IOPN)\r
             Return (FRET)\r
 \r
 \r
@@ -211,7 +207,7 @@ DefinitionBlock (
             //\r
             // c) Get Pending TPM Operation Requested By the OS\r
             //\r
-                  \r
+\r
             Store (PPRQ, Index (TPM2, 0x01))\r
             Return (TPM2)\r
           }\r
@@ -228,12 +224,12 @@ DefinitionBlock (
             // e) Return TPM Operation Response to OS Environment\r
             //\r
             Store (0x05, PPIP)\r
-                  \r
+\r
             //\r
-            // Triggle the SMI interrupt\r
+            // Trigger the SMI interrupt\r
             //\r
-            Store (PPIN, IOB2)\r
-                  \r
+            Store (PPIN, IOPN)\r
+\r
             Store (LPPR, Index (TPM3, 0x01))\r
             Store (PPRP, Index (TPM3, 0x02))\r
 \r
@@ -255,12 +251,12 @@ DefinitionBlock (
             // g) Submit TPM Operation Request to Pre-OS Environment 2\r
             //\r
             Store (7, PPIP)\r
-            Store (DerefOf (Index (Arg2, 0x00)), PPRQ)\r
-                \r
+            Store (DerefOf (Index (Arg1, 0x00)), PPRQ)\r
+\r
             //\r
-            // Triggle the SMI interrupt \r
+            // Trigger the SMI interrupt\r
             //\r
-            Store (PPIN, IOB2)  \r
+            Store (PPIN, IOPN)\r
             Return (FRET)\r
           }\r
           Case (8)\r
@@ -269,13 +265,13 @@ DefinitionBlock (
             // e) Get User Confirmation Status for Operation\r
             //\r
             Store (8, PPIP)\r
-            Store (DerefOf (Index (Arg2, 0x00)), PPRQ)\r
-                  \r
+            Store (DerefOf (Index (Arg1, 0x00)), UCRQ)\r
+\r
             //\r
-            // Triggle the SMI interrupt\r
+            // Trigger the SMI interrupt\r
             //\r
-            Store (PPIN, IOB2)\r
-                  \r
+            Store (PPIN, IOPN)\r
+\r
             Return (FRET)\r
           }\r
 \r
@@ -284,12 +280,12 @@ DefinitionBlock (
         Return (1)\r
       }\r
 \r
-      Method (TMCI, 3, Serialized, 0, IntObj, {UnknownObj, UnknownObj, UnknownObj}) // IntObj, IntObj, PkgObj\r
+      Method (TMCI, 2, Serialized, 0, IntObj, {UnknownObj, UnknownObj}) // IntObj, PkgObj\r
       {\r
         //\r
         // Switch by function index\r
         //\r
-        Switch (ToInteger (Arg1))\r
+        Switch (ToInteger (Arg0))\r
         {\r
           Case (0)\r
           {\r
@@ -303,22 +299,22 @@ DefinitionBlock (
             //\r
             // Save the Operation Value of the Request to MORD (reserved memory)\r
             //\r
-            Store (DerefOf (Index (Arg2, 0x00)), MORD)\r
-                  \r
+            Store (DerefOf (Index (Arg1, 0x00)), MORD)\r
+\r
             //\r
-            // Triggle the SMI through ACPI _DSM method.\r
+            // Trigger the SMI through ACPI _DSM method.\r
             //\r
             Store (0x01, MCIP)\r
-                  \r
+\r
             //\r
-            // Triggle the SMI interrupt\r
+            // Trigger the SMI interrupt\r
             //\r
-            Store (MCIN, IOB2)\r
+            Store (MCIN, IOPN)\r
             Return (MRET)\r
           }\r
           Default {BreakPoint}\r
         }\r
-        Return (1)        \r
+        Return (1)\r
       }\r
 \r
       Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj})\r
@@ -329,7 +325,7 @@ DefinitionBlock (
         //\r
         If(LEqual(Arg0, ToUUID ("cf8e16a5-c1e8-4e25-b712-4f54a96702c8")))\r
         {\r
-          Return (HINF (Arg1, Arg2, Arg3))\r
+          Return (HINF (Arg2))\r
         }\r
 \r
         //\r
@@ -337,7 +333,7 @@ DefinitionBlock (
         //\r
         If(LEqual(Arg0, ToUUID ("3dddfaa6-361b-4eb4-a424-8d10089d1653")))\r
         {\r
-          Return (TPPI (Arg1, Arg2, Arg3))\r
+          Return (TPPI (Arg2, Arg3))\r
         }\r
 \r
         //\r
@@ -345,7 +341,7 @@ DefinitionBlock (
         //\r
         If(LEqual(Arg0, ToUUID ("376054ed-cc13-4675-901c-4756d7f2d45d")))\r
         {\r
-          Return (TMCI (Arg1, Arg2, Arg3))\r
+          Return (TMCI (Arg2, Arg3))\r
         }\r
 \r
         Return (Buffer () {0})\r