Skip to content

Commit b2d0ed2

Browse files
pierregondoismergify[bot]
authored andcommitted
DynamicTablesPkg: Definition for DynamicPlatRepoLib interface
The DynamicPlatRepoLib library allows to handle dynamically created CmObj. The dynamic platform repository can be in the following states: 1 - Non-initialised 2 - Transient: Possibility to add CmObj to the platform, but not to query them. 3 - Finalised: Possibility to query CmObj, but not to add new. A token is allocated to each CmObj added to the dynamic platform repository (except for reference tokens CmObj). This allows to retrieve dynamic CmObjs among all CmObj (static CmObj for instance). This patch defines the library interface of the DynamicPlatRepo. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
1 parent 9006967 commit b2d0ed2

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed

DynamicTablesPkg/DynamicTablesPkg.dec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
## @libraryclass Defines a set of APIs for Dynamic AML generation.
2525
AmlLib|Include/Library/AmlLib/AmlLib.h
2626

27+
## @libraryclass Defines a set of APIs to handle dynamically created CmObj.
28+
DynamicPlatRepoLib|Include/Library/DynamicPlatRepoLib.h
29+
2730
## @libraryclass Defines a set of APIs to a hardware information parser.
2831
HwInfoParserLib|Include/Library/HwInfoParserLib.h
2932

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/** @file
2+
Dynamic Platform Info Repository
3+
4+
Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
5+
6+
SPDX-License-Identifier: BSD-2-Clause-Patent
7+
8+
@par Glossary:
9+
- Cm or CM - Configuration Manager
10+
- Obj or OBJ - Object
11+
**/
12+
13+
#ifndef DYNAMIC_PLAT_REPO_H_
14+
#define DYNAMIC_PLAT_REPO_H_
15+
16+
#include <Protocol/ConfigurationManagerProtocol.h>
17+
18+
/** A structure describing the platform configuration
19+
manager repository information
20+
*/
21+
typedef VOID *DYNAMIC_PLATFORM_REPOSITORY_INFO;
22+
23+
/** Add an object to the dynamic platform repository.
24+
25+
@param [in] This This dynamic platform repository.
26+
@param [in] CmObjDesc CmObj to add. The data is copied.
27+
@param [out] Token If not NULL, token allocated to this CmObj.
28+
29+
@retval EFI_SUCCESS Success.
30+
@retval EFI_INVALID_PARAMETER A parameter is invalid.
31+
@retval EFI_OUT_OF_RESOURCES An allocation has failed.
32+
**/
33+
EFI_STATUS
34+
EFIAPI
35+
DynPlatRepoAddObject (
36+
IN DYNAMIC_PLATFORM_REPOSITORY_INFO *This,
37+
IN CONST CM_OBJ_DESCRIPTOR *CmObjDesc,
38+
OUT CM_OBJECT_TOKEN *Token OPTIONAL
39+
);
40+
41+
/** Finalise the dynamic repository.
42+
43+
Finalising means:
44+
- Preventing any further objects from being added.
45+
- Allowing to get objects from the dynamic repository
46+
(not possible before a call to this function).
47+
48+
@param [in] This This dynamic platform repository.
49+
50+
@retval EFI_SUCCESS Success.
51+
@retval EFI_ALREADY_STARTED Instance already initialised.
52+
@retval EFI_INVALID_PARAMETER A parameter is invalid.
53+
@retval EFI_BUFFER_TOO_SMALL Buffer too small.
54+
@retval EFI_OUT_OF_RESOURCES An allocation has failed.
55+
**/
56+
EFI_STATUS
57+
EFIAPI
58+
DynamicPlatRepoFinalise (
59+
IN DYNAMIC_PLATFORM_REPOSITORY_INFO *This
60+
);
61+
62+
/** Get a CmObj from the dynamic repository.
63+
64+
@param [in] This Pointer to the Dynamic Platform Repository.
65+
@param [in] CmObjectId The Configuration Manager Object ID.
66+
@param [in] Token An optional token identifying the object. If
67+
unused this must be CM_NULL_TOKEN.
68+
@param [in, out] CmObjDesc Pointer to the Configuration Manager Object
69+
descriptor describing the requested Object.
70+
71+
@retval EFI_SUCCESS Success.
72+
@retval EFI_INVALID_PARAMETER A parameter is invalid.
73+
@retval EFI_NOT_FOUND The required object information is not found.
74+
**/
75+
EFI_STATUS
76+
EFIAPI
77+
DynamicPlatRepoGetObject (
78+
IN DYNAMIC_PLATFORM_REPOSITORY_INFO *This,
79+
IN CM_OBJECT_ID CmObjectId,
80+
IN CM_OBJECT_TOKEN Token OPTIONAL,
81+
IN OUT CM_OBJ_DESCRIPTOR *CmObjDesc
82+
);
83+
84+
/** Initialize the dynamic platform repository.
85+
86+
@param [out] DynPlatRepo If success, contains the initialised dynamic
87+
platform repository.
88+
89+
@retval EFI_SUCCESS Success.
90+
@retval EFI_INVALID_PARAMETER A parameter is invalid.
91+
@retval EFI_OUT_OF_RESOURCES An allocation has failed.
92+
**/
93+
EFI_STATUS
94+
EFIAPI
95+
DynamicPlatRepoInit (
96+
OUT DYNAMIC_PLATFORM_REPOSITORY_INFO **DynPlatRepo
97+
);
98+
99+
/** Shutdown the dynamic platform repository.
100+
101+
Free all the memory allocated for the dynamic platform repository.
102+
103+
@param [in] DynPlatRepo The dynamic platform repository.
104+
105+
@retval EFI_INVALID_PARAMETER A parameter is invalid.
106+
@retval EFI_SUCCESS Success.
107+
**/
108+
EFI_STATUS
109+
EFIAPI
110+
DynamicPlatRepoShutdown (
111+
IN DYNAMIC_PLATFORM_REPOSITORY_INFO *DynPlatRepo
112+
);
113+
114+
#endif // DYNAMIC_PLAT_REPO_H_

0 commit comments

Comments
 (0)