summaryrefslogtreecommitdiffstats
path: root/DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepoInternal.h
blob: eaee5d4ce9d99f8ab83e8ca8936ff43f8fa603e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/** @file
  Dynamic Platform Info Repository Internal

  Copyright (c) 2021, Arm Limited. All rights reserved.<BR>

  SPDX-License-Identifier: BSD-2-Clause-Patent

  @par Glossary:
    - Cm or CM   - Configuration Manager
    - Obj or OBJ - Object
**/

#ifndef DYNAMIC_PLAT_REPO_INTERNAL_H_
#define DYNAMIC_PLAT_REPO_INTERNAL_H_

#include "TokenMapper.h"

#pragma pack(1)

/** CmObj node.

  This is a node wrapper around the CM_OBJ_DESCRIPTOR structure.
  It also allows to bind a token to the CM_OBJ_DESCRIPTOR.
*/
typedef struct CmObjectNode {
  /// This must be the first field in this structure.
  LIST_ENTRY           Link;

  /// Token associated with the CmObjDesc.
  CM_OBJECT_TOKEN      Token;

  /// CmObjDesc wrapped.
  /// Note: the CM_OBJ_DESCRIPTOR.Data field is allocated and copied.
  CM_OBJ_DESCRIPTOR    CmObjDesc;
} CM_OBJ_NODE;

/** Dynamic repository states.

  The states must progress as:
  UnInitialised -> Transient -> Finalized
*/
typedef enum DynRepoState {
  DynRepoUnInitialised, ///< Un-Initialised state
  DynRepoTransient,     ///< Transient state - CmObjects can be added.
  DynRepoFinalized,     ///< Repo Locked - No further CmObjects can be added.
                        ///< Getting objects is now possible.
  DynRepoMax            ///< Max value.
} EDYNAMIC_REPO_STATE;

/** A structure describing the platform configuration
    manager repository information
*/
typedef struct DynamicPlatformRepositoryInfo {
  /// Repo state machine.
  EDYNAMIC_REPO_STATE    RepoState;

  /// Count of all the objects added to the Dynamic Platform Repo
  /// during the Transient state.
  UINTN                  ObjectCount;

  /// Link lists of CmObj from the ArmNameSpace
  /// that are added in the Transient state.
  LIST_ENTRY             ArmCmObjList[EArmObjMax];

  /// Structure Members used in Finalized state.
  /// An array of CmObj Descriptors from the ArmNameSpace
  /// This array is populated when the Repo is finalized.
  CM_OBJ_DESCRIPTOR      ArmCmObjArray[EArmObjMax];

  /// A token mapper for the objects in the ArmNamespaceObjectArray
  /// The Token mapper is populated when the Repo is finalized in
  /// a call to DynamicPlatRepoFinalise ().
  TOKEN_MAPPER           TokenMapper;
} DYNAMIC_PLATFORM_REPOSITORY_INFO;

#pragma pack()

#endif // DYNAMIC_PLAT_REPO_INTERNAL_H_