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