Skip to content

Commit 2e2db65

Browse files
pierregondoismergify[bot]
authored andcommitted
DynamicTablesPkg: DynamicPlatRepo: Add TokenGenerator
The DynamicPlatRepo 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 add the TokenGenerator files. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
1 parent b2d0ed2 commit 2e2db65

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/** @file
2+
Token Generator
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+
#include <Protocol/ConfigurationManagerProtocol.h>
14+
15+
/** Generate a token.
16+
17+
@return A token.
18+
**/
19+
CM_OBJECT_TOKEN
20+
EFIAPI
21+
GenerateToken (
22+
VOID
23+
)
24+
{
25+
// Start Tokens at 1 to avoid collisions with CM_NULL_TOKEN.
26+
STATIC UINTN CurrentToken = 1;
27+
28+
return (CM_OBJECT_TOKEN)(CurrentToken++);
29+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/** @file
2+
Token Generator
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 TOKEN_GENERATOR_H_
14+
#define TOKEN_GENERATOR_H_
15+
16+
/** Generate a token.
17+
18+
@return A token.
19+
**/
20+
CM_OBJECT_TOKEN
21+
EFIAPI
22+
GenerateToken (
23+
VOID
24+
);
25+
26+
#endif // TOKEN_GENERATOR_H_

0 commit comments

Comments
 (0)