edk2/DynamicTablesPkg/Library/Common/MetadataObjLib/MetadataObj.h
Pierre Gondois 1b7d687dc6 DynamicTablesPkg: Add MetaDataObjLib library
The DynamicTablesPkg allows to generate firmware tables based on
information provided by a user or another source of information
(a device tree for instance).

Some information might be implicitly generated by generators.
For instance, for ACPI tables, AML names or Uids are created by
generators, but not provided by the user or another source of
information.

Some generators might need to cross-reference object/generated data
that was previous generated for an object by another generator.
For instance, there are three different generators creating serial
ports in the AML namespace. These 3 generators must ensure not to use
an Id which was not already created by another generator.
Another example would be a generator needing to reference the AML
path of a serial port. As the AML path is dynamically generated, this
is currently not possible to do.

Add a MetaDataObjLib library to keep track of the meta-data previously
generated for an object.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-06-11 12:24:35 +00:00

59 lines
1.3 KiB
C

/** @file
Metadata Object Library.
Copyright (c) 2025, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef METADATA_OBJ_H_
#define METADATA_OBJ_H_
#include <Library/MetadataObjLib.h>
/** Metadata Entry.
Store the generated Metadata along the associated CmObj/Token
in this structure.
**/
typedef struct MetadataEntry {
/// List entry
LIST_ENTRY List;
/// Metadata Type
METADATA_TYPE Type;
/// Token
CM_OBJECT_TOKEN Token;
/// Metadata. Must be interpreted per-METADATA_TYPE
VOID *Metadata;
} METADATA_ENTRY;
/** Metadata Object Type.
There is one entry for for each METADATA_TYPE.
**/
typedef struct MetadataList {
/// Per-METADATA_TYPE list of METADATA_ENTRY struct
LIST_ENTRY List;
} METADATA_LIST;
/** Metadata static information.
There is one entry for for each METADATA_TYPE.
**/
typedef struct MetadataStaticInfo {
/// Expected size for this METADATA_TYPE
UINT32 ExpectedSize;
} METADATA_STATIC_INFO;
/** Metadata Root.
All the METADATA_ENTRY are attached to a root.
**/
typedef struct MetadataRoot {
/// Array of METADATA_LIST. One entry for each MetadataType.
METADATA_LIST MetadataList[MetadataTypeMax];
} METADATA_ROOT;
#endif // METADATA_OBJ_H_