]>
git.proxmox.com Git - mirror_edk2.git/blob - DynamicTablesPkg/Include/ConfigurationManagerHelper.h
3 Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
8 - Cm or CM - Configuration Manager
12 #ifndef CONFIGURATION_MANAGER_HELPER_H_
13 #define CONFIGURATION_MANAGER_HELPER_H_
15 /** The GET_OBJECT_LIST macro expands to a function that is used to retrieve
16 an object or an object list from the Configuration Manager using the
17 Configuration Manager Protocol interface.
19 The macro expands to a function which has the following prototype:
25 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
26 IN CONST CM_OBJECT_TOKEN Token OPTIONAL,
28 OUT UINT32 * Count OPTIONAL
31 Generated function parameters:
32 @param [in] CfgMgrProtocol Pointer to the Configuration Manager protocol
34 @param [in] Token Reference token for the Object.
35 @param [out] List Pointer to the Object list.
36 @param [out] Count Count of the objects returned in the list.
39 @param [in] CmObjectNameSpace The Object Namespace
40 @param [in] CmObjectId Object Id.
41 @param [in] Type Structure used to describe the Object.
43 @retval EFI_SUCCESS Success.
44 @retval EFI_INVALID_PARAMETER A parameter is invalid.
45 @retval EFI_NOT_FOUND The required object information is not found.
46 @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
47 Manager is less than the Object size for the
50 #define GET_OBJECT_LIST(CmObjectNameSpace, CmObjectId, Type) \
55 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, \
56 IN CONST CM_OBJECT_TOKEN Token OPTIONAL, \
58 OUT UINT32 * CONST Count OPTIONAL \
62 CM_OBJ_DESCRIPTOR CmObjectDesc; \
63 UINT32 ObjCount = 0; \
65 Status = EFI_INVALID_PARAMETER; \
68 "ERROR: Get" #CmObjectId ": Invalid out parameter for" \
69 " object list. Status = %r\n", \
74 Status = CfgMgrProtocol->GetObject ( \
76 CREATE_CM_OBJECT_ID ( \
83 if (EFI_ERROR (Status)) { \
86 "INFO: Get" #CmObjectId ": Platform does not implement " \
87 #CmObjectId ". Status = %r\n", \
93 if (CmObjectDesc.ObjectId != \
94 CREATE_CM_OBJECT_ID (CmObjectNameSpace, CmObjectId)) { \
97 "ERROR: Get" #CmObjectId ": " #CmObjectId \
98 ": Invalid ObjectId = 0x%x\n, expected Id = 0x%x\n", \
99 CmObjectDesc.ObjectId, \
100 CREATE_CM_OBJECT_ID (CmObjectNameSpace, CmObjectId) \
103 Status = EFI_INVALID_PARAMETER; \
104 goto error_handler; \
106 if (CmObjectDesc.Size < (sizeof (Type) * CmObjectDesc.Count)) { \
109 "ERROR: Get" #CmObjectId ": " #CmObjectId \
110 ": Buffer too small, size = 0x%x\n", \
114 Status = EFI_BAD_BUFFER_SIZE; \
115 goto error_handler; \
117 ObjCount = CmObjectDesc.Count; \
118 *List = (Type*)CmObjectDesc.Data; \
120 if (Count != NULL) { \
126 #endif // CONFIGURATION_MANAGER_HELPER_H_