]> git.proxmox.com Git - mirror_edk2.git/commitdiff
PrmPkg/PrmSampleContextBufferModule: Remove OS debug print requirement
authorMichael Kubacki <michael.kubacki@microsoft.com>
Tue, 9 Jun 2020 16:44:25 +0000 (09:44 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 5 Apr 2022 00:42:38 +0000 (00:42 +0000)
Removes the expectation that the parameter buffer contain an OS
debug print service at the beginning of the buffer. All supporting
code related to printing is also removed.

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: Michael Kubacki <michael.kubacki@microsoft.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/Samples/PrmSampleContextBufferModule/Library/DxeContextBufferModuleConfigLib/DxeContextBufferModuleConfigLib.c
PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleContextBufferModule.c

index c222c961f23bd3d1e5ec7c98967883d754057f79..4c0c3348459caae9175beb4bf27265a87d6c783b 100644 (file)
@@ -24,7 +24,7 @@ STATIC EFI_HANDLE  mPrmConfigProtocolHandle;
 STATIC CONST EFI_GUID mPrmModuleGuid = {0x5a6cf42b, 0x8bb4, 0x472c, {0xa2, 0x33, 0x5c, 0x4d, 0xc4, 0x03, 0x3d, 0xc7}};\r
 \r
 // {e1466081-7562-430f-896b-b0e523dc335a}\r
-STATIC CONST EFI_GUID mDumpStaticDataBufferPrmHandlerGuid = {0xe1466081, 0x7562, 0x430f, {0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a}};\r
+STATIC CONST EFI_GUID mCheckStaticDataBufferPrmHandlerGuid = {0xe1466081, 0x7562, 0x430f, {0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a}};\r
 \r
 /**\r
   Populates the static data buffer for this PRM module.\r
@@ -166,7 +166,7 @@ ContextBufferModuleConfigLibConstructor (
     Status = EFI_OUT_OF_RESOURCES;\r
     goto Done;\r
   }\r
-  CopyGuid (&PrmContextBuffer->HandlerGuid, &mDumpStaticDataBufferPrmHandlerGuid);\r
+  CopyGuid (&PrmContextBuffer->HandlerGuid, &mCheckStaticDataBufferPrmHandlerGuid);\r
   PrmContextBuffer->Signature = PRM_CONTEXT_BUFFER_SIGNATURE;\r
   PrmContextBuffer->Version = PRM_CONTEXT_BUFFER_INTERFACE_VERSION;\r
   PrmContextBuffer->StaticDataBuffer = StaticDataBuffer;\r
index 074552d0c07e898f13eeaf2d9838ae345078a8e8..5c4e5c7a10ebf363eab16e77e6d7e7a8c25363be 100644 (file)
 //\r
 \r
 // {e1466081-7562-430f-896b-b0e523dc335a}\r
-#define DUMP_STATIC_DATA_BUFFER_PRM_HANDLER_GUID {0xe1466081, 0x7562, 0x430f, {0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a}}\r
-\r
-/**\r
-  Dumps the contents of a given buffer.\r
-\r
-  @param[in]  OsServiceDebugPrint   A pointer to the debug print OS service.\r
-  @param[in]  Buffer                A pointer to the buffer that should be dumped.\r
-  @param[in]  BufferSize            The size of Buffer in bytes.\r
-\r
-**/\r
-STATIC\r
-VOID\r
-DumpBuffer (\r
-  IN PRM_OS_SERVICE_DEBUG_PRINT OsServiceDebugPrint,\r
-  IN CONST VOID                 *Buffer,\r
-  IN UINTN                      BufferSize\r
-  )\r
-{\r
-  UINTN Count;\r
-  CONST UINT8 *Char = Buffer;\r
-  CHAR8 DebugMessage[16];\r
-\r
-  if (OsServiceDebugPrint == NULL || Buffer == NULL) {\r
-    return;\r
-  }\r
-\r
-  OsServiceDebugPrint ("    ");\r
-  for (Count = 0; Count < BufferSize; Count++)\r
-  {\r
-    if (Count && !(Count % 16)) {\r
-      OsServiceDebugPrint ("\n    ");\r
-    }\r
-    AsciiSPrint (\r
-      &DebugMessage[0],\r
-      ARRAY_SIZE (DebugMessage),\r
-      "%02X ",\r
-      Char[Count]\r
-      );\r
-    OsServiceDebugPrint (&DebugMessage[0]);\r
-  }\r
-  OsServiceDebugPrint ("\n\n");\r
-}\r
-\r
-/**\r
-  Prints the contents of this PRM module's static data buffer.\r
-\r
-  @param[in]  OsServiceDebugPrint   A pointer to the debug print OS service.\r
-  @param[in]  StaticDataBuffer      A pointer to the static buffer.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-PrintStaticDataBuffer (\r
-  IN PRM_OS_SERVICE_DEBUG_PRINT                       OsServiceDebugPrint,\r
-  IN CONST STATIC_DATA_SAMPLE_CONTEXT_BUFFER_MODULE   *StaticDataBuffer\r
-  )\r
-{\r
-  CHAR8 DebugMessage[256];\r
-\r
-  if (OsServiceDebugPrint == NULL || StaticDataBuffer == NULL) {\r
-    return;\r
-  }\r
-\r
-  AsciiSPrint (\r
-    &DebugMessage[0],\r
-    ARRAY_SIZE (DebugMessage),\r
-    "  Policy1Enabled = 0x%x.\n",\r
-    StaticDataBuffer->Policy1Enabled\r
-    );\r
-  OsServiceDebugPrint (&DebugMessage[0]);\r
-\r
-  AsciiSPrint (\r
-    &DebugMessage[0],\r
-    ARRAY_SIZE (DebugMessage),\r
-    "  Policy2Enabled = 0x%x.\n",\r
-    StaticDataBuffer->Policy2Enabled\r
-    );\r
-  OsServiceDebugPrint (&DebugMessage[0]);\r
-\r
-  OsServiceDebugPrint ("  Dumping SomeValueArray:\n");\r
-  DumpBuffer (\r
-    OsServiceDebugPrint,\r
-    (CONST VOID *) &StaticDataBuffer->SomeValueArray[0],\r
-    ARRAY_SIZE (StaticDataBuffer->SomeValueArray)\r
-    );\r
-}\r
+#define CHECK_STATIC_DATA_BUFFER_PRM_HANDLER_GUID {0xe1466081, 0x7562, 0x430f, {0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a}}\r
 \r
 /**\r
   A sample Platform Runtime Mechanism (PRM) handler.\r
 \r
-  This sample handler attempts to read the contents of the static data buffer that were configured\r
-  during the firmware boot environment and print those contents at OS runtime.\r
+  This sample handler checks that a static data buffer can be accessed from a given context buffer.\r
 \r
-  @param[in]  OsServices          An array of pointers to OS provided services for PRM handlers\r
-  @param[in]  Context             Handler context info\r
+  @param[in]  ParameterBuffer     A pointer to the PRM handler parameter buffer\r
+  @param[in]  ContextBUffer       A pointer to the PRM handler context buffer\r
 \r
   @retval EFI_STATUS              The PRM handler executed successfully.\r
   @retval Others                  An error occurred in the PRM handler.\r
 \r
 **/\r
-PRM_HANDLER_EXPORT (DumpStaticDataBufferPrmHandler)\r
+PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler)\r
 {\r
-  PRM_OS_SERVICE_DEBUG_PRINT      OsServiceDebugPrint;\r
-\r
   if (ContextBuffer == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  // In the POC, the OS debug print service is assumed to be at the beginning of ParameterBuffer\r
-  OsServiceDebugPrint = *((PRM_OS_SERVICE_DEBUG_PRINT *) ParameterBuffer);\r
-  if (OsServiceDebugPrint == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  OsServiceDebugPrint ("Context Buffer DumpStaticDataBufferPrmHandler entry.\n");\r
-\r
   if (ContextBuffer->StaticDataBuffer == NULL) {\r
-    OsServiceDebugPrint ("The static buffer is not allocated!\n");\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  OsServiceDebugPrint ("  Printing the contents of the static data buffer:\n");\r
-\r
   //\r
   // Verify PRM data buffer signature is valid\r
   //\r
   if (\r
     ContextBuffer->Signature != PRM_CONTEXT_BUFFER_SIGNATURE ||\r
     ContextBuffer->StaticDataBuffer->Header.Signature != PRM_DATA_BUFFER_HEADER_SIGNATURE) {\r
-    OsServiceDebugPrint ("  A buffer signature is invalid!\n");\r
     return EFI_NOT_FOUND;\r
   }\r
 \r
-  PrintStaticDataBuffer (\r
-    OsServiceDebugPrint,\r
-    (CONST STATIC_DATA_SAMPLE_CONTEXT_BUFFER_MODULE *) &(ContextBuffer->StaticDataBuffer->Data[0])\r
-    );\r
-\r
-  OsServiceDebugPrint ("Context Buffer DumpStaticDataBufferPrmHandler exit.\n");\r
-\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -168,9 +61,18 @@ PRM_HANDLER_EXPORT (DumpStaticDataBufferPrmHandler)
 // Register the PRM export information for this PRM Module\r
 //\r
 PRM_MODULE_EXPORT (\r
-  PRM_HANDLER_EXPORT_ENTRY (DUMP_STATIC_DATA_BUFFER_PRM_HANDLER_GUID, DumpStaticDataBufferPrmHandler)\r
+  PRM_HANDLER_EXPORT_ENTRY (CHECK_STATIC_DATA_BUFFER_PRM_HANDLER_GUID, CheckStaticDataBufferPrmHandler)\r
   );\r
 \r
+/**\r
+  Module entry point.\r
+\r
+  @param[in]   ImageHandle     The image handle.\r
+  @param[in]   SystemTable     A pointer to the system table.\r
+\r
+  @retval  EFI_SUCCESS         This function always returns success.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 PrmSampleContextBufferModuleInit (\r