]> git.proxmox.com Git - mirror_edk2.git/blob - PrmPkg/Include/PrmExportDescriptor.h
PrmPkg: Add package and include headers
[mirror_edk2.git] / PrmPkg / Include / PrmExportDescriptor.h
1 /** @file
2
3 Definitions for the Platform Runtime Mechanism (PRM) export descriptor structures.
4
5 Copyright (c) Microsoft Corporation
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef PRM_EXPORT_DESCRIPTOR_H_
11 #define PRM_EXPORT_DESCRIPTOR_H_
12
13 #include <Prm.h>
14
15 #define PRM_MODULE_EXPORT_DESCRIPTOR_NAME PrmModuleExportDescriptor
16 #define PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE SIGNATURE_64 ('P', 'R', 'M', '_', 'M', 'E', 'D', 'T')
17 #define PRM_MODULE_EXPORT_REVISION 0x0
18
19 //
20 // Platform Runtime Mechanism (PRM) Export Descriptor Structures
21 //
22 #pragma pack(push, 1)
23
24 typedef struct {
25 GUID PrmHandlerGuid;
26 CHAR8 PrmHandlerName[PRM_HANDLER_NAME_MAXIMUM_LENGTH];
27 } PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT;
28
29 typedef struct {
30 UINT64 Signature;
31 UINT16 Revision;
32 UINT16 NumberPrmHandlers;
33 GUID ModuleGuid;
34 PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT PrmHandlerExportDescriptors[3];
35 } PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT;
36
37 #pragma pack(pop)
38
39 /**
40 A macro that declares a PRM Handler Export Descriptor for a PRM Handler.
41
42 This macro is intended to be used once per PRM Handler to describe the handler when the
43 module description is defined. It should be provided as an argument to PRM_MODULE_EXPORT.
44
45 @param Guid The GUID of the PRM Handler being exported.
46
47 @param Name The name of the PRM Handler being exported. This string should exactly
48 match the function name.
49
50 **/
51 #define PRM_HANDLER_EXPORT_ENTRY(Guid, Name) \
52 { \
53 Guid, \
54 PRM_STRING_(Name) \
55 } \
56
57 /**
58 A macro that returns the count of the number of variable-length arguments given.
59
60 @param VariableArgumentList A variable argument list of elements that will be included
61 in the return value of the list count.
62 **/
63 #define VA_ARG_COUNT(...) (sizeof((PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT[]){__VA_ARGS__})/sizeof(PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT))
64
65 /**
66 A macro that declares the PRM Module Export Descriptor for a PRM Module.
67
68 This macro is intended to be used once in a PRM Module after all of the PRM Handler definitions
69 to describe the PRM Handlers being exported in the module.
70
71 @param PrmHandlerExportEntries A variable argument list of PRM_HANDLER_EXPORT_ENTRY values.
72 This list should include all PRM Handlers being exported by
73 this module.
74
75 **/
76 #define PRM_MODULE_EXPORT(...) \
77 PRM_EXPORT_API PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT PRM_MODULE_EXPORT_DESCRIPTOR_NAME = { \
78 { \
79 PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE, \
80 PRM_MODULE_EXPORT_REVISION, \
81 VA_ARG_COUNT(__VA_ARGS__), \
82 EFI_CALLER_ID_GUID \
83 }, \
84 { __VA_ARGS__ } \
85 } \
86
87 #endif