VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleContextBufferModule.c

Last change on this file was 99404, checked in by vboxsync, 2 years ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
1/** @file
2
3 This PRM Module demonstrates how to configure the module data resources in the firmware boot environment
4 and access those resources in a PRM handler at OS runtime.
5
6 Copyright (c) Microsoft Corporation
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9**/
10
11#include <PrmModule.h>
12
13#include <Library/BaseLib.h>
14#include <Library/PrintLib.h>
15#include <Library/UefiLib.h>
16
17#include <Samples/PrmSampleContextBufferModule/Include/StaticData.h>
18
19//
20// PRM Handler GUIDs
21//
22
23// {e1466081-7562-430f-896b-b0e523dc335a}
24#define CHECK_STATIC_DATA_BUFFER_PRM_HANDLER_GUID {0xe1466081, 0x7562, 0x430f, {0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a}}
25
26/**
27 A sample Platform Runtime Mechanism (PRM) handler.
28
29 This sample handler checks that a static data buffer can be accessed from a given context buffer.
30
31 @param[in] ParameterBuffer A pointer to the PRM handler parameter buffer
32 @param[in] ContextBUffer A pointer to the PRM handler context buffer
33
34 @retval EFI_STATUS The PRM handler executed successfully.
35 @retval Others An error occurred in the PRM handler.
36
37**/
38PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler) {
39 if (ContextBuffer == NULL) {
40 return EFI_INVALID_PARAMETER;
41 }
42
43 if (ContextBuffer->StaticDataBuffer == NULL) {
44 return EFI_INVALID_PARAMETER;
45 }
46
47 //
48 // Verify PRM data buffer signature is valid
49 //
50 if (
51 (ContextBuffer->Signature != PRM_CONTEXT_BUFFER_SIGNATURE) ||
52 (ContextBuffer->StaticDataBuffer->Header.Signature != PRM_DATA_BUFFER_HEADER_SIGNATURE))
53 {
54 return EFI_NOT_FOUND;
55 }
56
57 return EFI_SUCCESS;
58}
59
60//
61// Register the PRM export information for this PRM Module
62//
63PRM_MODULE_EXPORT (
64 PRM_HANDLER_EXPORT_ENTRY (CHECK_STATIC_DATA_BUFFER_PRM_HANDLER_GUID, CheckStaticDataBufferPrmHandler)
65 );
66
67/**
68 Module entry point.
69
70 @param[in] ImageHandle The image handle.
71 @param[in] SystemTable A pointer to the system table.
72
73 @retval EFI_SUCCESS This function always returns success.
74
75**/
76EFI_STATUS
77EFIAPI
78PrmSampleContextBufferModuleInit (
79 IN EFI_HANDLE ImageHandle,
80 IN EFI_SYSTEM_TABLE *SystemTable
81 )
82{
83 return EFI_SUCCESS;
84}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette