]>
git.proxmox.com Git - mirror_edk2.git/blob - DynamicTablesPkg/Include/ConfigurationManagerHelper.h
3 Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 - Cm or CM - Configuration Manager
18 #ifndef CONFIGURATION_MANAGER_HELPER_H_
19 #define CONFIGURATION_MANAGER_HELPER_H_
21 /** The GET_OBJECT_LIST macro expands to a function that is used to retrieve
22 an object or an object list from the Configuration Manager using the
23 Configuration Manager Protocol interface.
25 The macro expands to a function which has the following prototype:
31 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol,
32 IN CONST CM_OBJECT_TOKEN Token OPTIONAL,
34 OUT UINT32 * Count OPTIONAL
37 Generated function parameters:
38 @param [in] CfgMgrProtocol Pointer to the Configuration Manager protocol
40 @param [in] Token Reference token for the Object.
41 @param [out] List Pointer to the Object list.
42 @param [out] Count Count of the objects returned in the list.
45 @param [in] CmObjectNameSpace The Object Namespace
46 @param [in] CmObjectId Object Id.
47 @param [in] Type Structure used to describe the Object.
49 @retval EFI_SUCCESS Success.
50 @retval EFI_INVALID_PARAMETER A parameter is invalid.
51 @retval EFI_NOT_FOUND The required object information is not found.
52 @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration
53 Manager is less than the Object size for the
56 #define GET_OBJECT_LIST(CmObjectNameSpace, CmObjectId, Type) \
61 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST CfgMgrProtocol, \
62 IN CONST CM_OBJECT_TOKEN Token OPTIONAL, \
64 OUT UINT32 * CONST Count OPTIONAL \
68 CM_OBJ_DESCRIPTOR CmObjectDesc; \
69 UINT32 ObjCount = 0; \
71 Status = EFI_INVALID_PARAMETER; \
74 "ERROR: Get" #CmObjectId ": Invalid out parameter for" \
75 " object list. Status = %r\n", \
80 Status = CfgMgrProtocol->GetObject ( \
82 CREATE_CM_OBJECT_ID ( \
89 if (EFI_ERROR (Status)) { \
92 "INFO: Get" #CmObjectId ": Platform does not implement " \
93 #CmObjectId ". Status = %r\n", \
99 if (CmObjectDesc.ObjectId != \
100 CREATE_CM_OBJECT_ID (CmObjectNameSpace, CmObjectId)) { \
103 "ERROR: Get" #CmObjectId ": " #CmObjectId \
104 ": Invalid ObjectId = 0x%x\n, expected Id = 0x%x\n", \
105 CmObjectDesc.ObjectId, \
106 CREATE_CM_OBJECT_ID (CmObjectNameSpace, CmObjectId) \
109 Status = EFI_INVALID_PARAMETER; \
110 goto error_handler; \
112 if (CmObjectDesc.Size < (sizeof (Type) * CmObjectDesc.Count)) { \
115 "ERROR: Get" #CmObjectId ": " #CmObjectId \
116 ": Buffer too small, size = 0x%x\n", \
120 Status = EFI_BAD_BUFFER_SIZE; \
121 goto error_handler; \
123 ObjCount = CmObjectDesc.Count; \
124 *List = (Type*)CmObjectDesc.Data; \
126 if (Count != NULL) { \
132 #endif // CONFIGURATION_MANAGER_HELPER_H_