]> git.proxmox.com Git - mirror_edk2.git/commitdiff
PrmPkg: Update PRM OpRegion
authorLiu Yun Y <yun.y.liu@intel.com>
Tue, 8 Sep 2020 06:57:18 +0000 (14:57 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 5 Apr 2022 00:42:38 +0000 (00:42 +0000)
1. Enable new PRM OpRegion structure
2. Add PRM Handler Update Lock/Unlock support

Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Liu Yun <yun.y.liu@intel.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
PrmPkg/PrmSsdtInstallDxe/Prm.asl

index 0457d09e695470bd07ceee7b4e070f6cec03cb69..20a6fef9be7be132c56b73e50c51bb4263b88e3a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The definition block in ACPI table for PRM Operation Region\r
 \r
-  Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2020-2021, Intel Corporation. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 **/\r
 \r
@@ -16,60 +16,105 @@ DefinitionBlock (
 {\r
     Scope (\_SB)\r
     {\r
-        //\r
-        // PRM Bridge Device\r
-        //\r
-\r
-        Device (PRMB)\r
-        {\r
-            Name (_HID, "80860222")\r
-            Name (_CID, "80860222")\r
-            Name (_DDN, "PRM Bridge Device")\r
-            Name (_STA, 0xF)\r
-            OperationRegion (OPR1, 0x80, 0, 16)\r
-            Field (OPR1, DWordAcc, NoLock, Preserve) //Make it ByteAcc for parameter validation\r
-            {\r
-                Var0, 128\r
-            }\r
-            Method (SETV, 1, Serialized)\r
-            {\r
-                CopyObject (Arg0, \_SB.PRMB.Var0)\r
-            }\r
-        }\r
-\r
         //\r
         // PRM Test Device\r
         //\r
-\r
         Device (PRMT)\r
         {\r
             Name (_HID, "80860223")\r
             Name (_CID, "80860223")\r
             Name (_DDN, "PRM Test Device")\r
-            Name (_STA, 0xF)\r
-            Name (BUF1, Buffer(16)\r
-            {\r
-                0x5F, 0xAD, 0xF2, 0xD5, 0x47, 0xA3, 0x3E, 0x4D, //Guid_0\r
-                0x87, 0xBC, 0xC2, 0xCE, 0x63, 0x02, 0x9C, 0xC8, //Guid_1\r
-            })\r
-            Name (BUF2, Buffer(16)\r
+\r
+            // PrmSamplePrintModule handler GUIDs\r
+            Name (BUF1, ToUUID("d5f2ad5f-a347-4d3e-87bc-c2ce63029cc8"))\r
+            Name (BUF2, ToUUID("a9e7adc3-8cd0-429a-8915-10946ebde318"))\r
+            Name (BUFN, ToUUID("b688c214-4081-4eeb-8d26-1eb5a3bcf11a"))\r
+\r
+            //PRM operation region format\r
+            OperationRegion (PRMR, PlatformRtMechanism, 0, 1)\r
+            Field (PRMR, BufferAcc, NoLock, Preserve) //Make it ByteAcc for parameter validation\r
             {\r
-                0xC3, 0xAD, 0xE7, 0xA9, 0xD0, 0x8C, 0x9A, 0x42, //Guid_0\r
-                0x89, 0x15, 0x10, 0x94, 0x6E, 0xBD, 0xE3, 0x18, //Guid_1\r
-            })\r
-            Name (BUF3, Buffer(16)\r
+                PRMF, 8\r
+            }\r
+\r
+            /*\r
+            * Control method to invoke PRM OperationRegion handler\r
+            * Arg0 contains a buffer representing a _DSM GUID\r
+            */\r
+            Method (RUNS, 1)\r
             {\r
-                0x14, 0xC2, 0x88, 0xB6, 0x81, 0x40, 0xEB, 0x4E, //Guid_0\r
-                0x8D, 0x26, 0x1E, 0xB5, 0xA3, 0xBC, 0xF1, 0x1A, //Guid_1\r
-            })\r
-            Method (NTST)\r
+                /* Local0 is the PRM data buffer */\r
+                Local0 = buffer (26){}\r
+\r
+                /* Create byte fields over the buffer */\r
+                CreateByteField (Local0, 0x0, PSTA)\r
+                CreateQWordField (Local0, 0x1, USTA)\r
+                CreateByteField (Local0, 0x9, CMD)\r
+                CreateField (Local0, 0x50, 0x80, GUID)\r
+\r
+                /* Fill in the command and data fields of the data buffer */\r
+                CMD = 0 // run command\r
+                GUID = Arg0\r
+\r
+                /* Invoke PRM OperationRegion Handler and store the result into Local0 */\r
+                Local0 = (PRMF = Local0)\r
+\r
+                /* Return status */\r
+                Return (PSTA)\r
+            }\r
+\r
+            /*\r
+            * Control method to lock a PRM transaction\r
+            * Arg0 contains a buffer representing a _DSM GUID\r
+            */\r
+            Method (LCKH, 1)\r
             {\r
-                \_SB.PRMB.SETV (BUF1)\r
+                /* Local0 is the PRM data buffer */\r
+                Local0 = buffer (26){}\r
+\r
+                /* Create byte fields over the buffer */\r
+                CreateByteField (Local0, 0x0, STAT)\r
+                CreateByteField (Local0, 0x9, CMD)\r
+                CreateField (Local0, 0x50, 0x80, GUID)\r
+                CMD = 1 // Lock command\r
+                GUID = Arg0\r
+                Local0 = (PRMF = Local0)\r
+\r
+                /* Note STAT contains the return status */\r
+                Return (STAT)\r
             }\r
-        }\r
-    }\r
 \r
-} // End of Definition Block\r
+            /*\r
+            * Control method to unlock a PRM transaction\r
+            * Arg0 contains a buffer representing a _DSM GUID\r
+            */\r
+            Method (ULCK, 1)\r
+            {\r
+                /* Local0 is the PRM data buffer */\r
+                Local0 = buffer (26){}\r
 \r
+                /* Create byte fields over the buffer */\r
+                CreateByteField (Local0, 0x0, STAT)\r
+                CreateByteField (Local0, 0x9, CMD)\r
+                CreateField (Local0, 0x50, 0x80, GUID)\r
+                CMD = 2 // Unlock command\r
+                GUID = Arg0\r
+                Local0 = (PRMF = Local0)\r
 \r
+               /* Note STAT contains the return status */\r
+                Return (STAT)\r
+            }\r
 \r
+            /*\r
+            *Bit [0] Set if the device is present.\r
+            *Bit [1] Set if the device is enabled and decoding its resources.\r
+            *Bit [2] Set if the device should be shown in the UI.\r
+            *Bit [3] Set if the device is functioning properly (cleared if device failed its diagnostics).\r
+            */\r
+            Method (_STA, 0, NotSerialized)\r
+            {\r
+                Return (0x0B) // Device present, but not shown\r
+            }\r
+        }\r
+    }\r
+}\r