Skip to content

Commit aace3ee

Browse files
sarah-walker-armmergify[bot]
authored andcommitted
DynamicTablesPkg: Use abstract tokens in token generator
Using abstract tokens ensures no collisions with non-generated tokens. Signed-off-by: Sarah Walker <[email protected]>
1 parent f09ea5f commit aace3ee

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

DynamicTablesPkg/Include/StandardNameSpaceObjects.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ typedef enum AbstractTokenID {
5555
ETokenNameSpaceUnknown = 0,
5656
ETokenNameSpaceSmbios,
5757
ETokenNameSpaceFdtHwInfo,
58+
ETokenNameSpaceGenerated,
5859

5960
ETokenNameSpaceMax
6061
} EABSTRACT_TOKEN_ID;

DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/TokenGenerator.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ GenerateToken (
2323
)
2424
{
2525
// Start Tokens at 1 to avoid collisions with CM_NULL_TOKEN.
26-
STATIC UINTN CurrentToken = 1;
26+
STATIC UINTN CurrentToken = 0;
2727

28-
return (CM_OBJECT_TOKEN)(CurrentToken++);
28+
CurrentToken++;
29+
30+
return (CM_OBJECT_TOKEN)CM_ABSTRACT_TOKEN_MAKE (ETokenNameSpaceGenerated, 0, CurrentToken);
2931
}

0 commit comments

Comments
 (0)