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
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
//\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
// 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