DynamicTablesPkg: Add GetMetadataRoot() cb to DynamicTableFactory protocol
The newly added MetadataObjLib allows to store information either: - generated by the DynamictTablesPkg framework - provided by a ConfigurationManager - parsed from another source of information This information might be subject to validation/verification. This step can only be done once the firmware tables generated by the DynamictTablesPkg have been generated. Add a new GetMetadataRoot() callback to the EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL. This callback allows to fetch the Metadata Root, allowing to access all the Metadata information generated. This Metadata is then validated by the DynamicTableManagerDxe. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This commit is contained in:
committed by
mergify[bot]
parent
d15e48853c
commit
771b452507
@@ -21,6 +21,7 @@
|
||||
#include <Protocol/ConfigurationManagerProtocol.h>
|
||||
#include <Protocol/DynamicTableFactoryProtocol.h>
|
||||
#include <SmbiosTableGenerator.h>
|
||||
#include <Library/MetadataHandlerLib.h>
|
||||
|
||||
#include "DynamicTableFactory.h"
|
||||
|
||||
@@ -29,6 +30,25 @@
|
||||
*/
|
||||
EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
|
||||
|
||||
STATIC METADATA_ROOT_HANDLE mMetadataRoot;
|
||||
|
||||
/** Get the Root handle of the MetadataObjLib.
|
||||
|
||||
During the firmware table generation, some Metadata information might be
|
||||
generated by different generators. This Metadata might be subject to
|
||||
additional validation.
|
||||
|
||||
@return The Metadata Root handle.
|
||||
**/
|
||||
METADATA_ROOT_HANDLE
|
||||
EFIAPI
|
||||
GetMetadataRoot (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return mMetadataRoot;
|
||||
}
|
||||
|
||||
/** A structure describing the Dynamic Table Factory protocol.
|
||||
*/
|
||||
STATIC
|
||||
@@ -44,6 +64,7 @@ EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL DynamicTableFactoryProtocol = {
|
||||
GetDtTableGenerator,
|
||||
RegisterDtTableGenerator,
|
||||
DeregisterDtTableGenerator,
|
||||
GetMetadataRoot,
|
||||
&TableFactoryInfo
|
||||
};
|
||||
|
||||
@@ -66,6 +87,12 @@ DynamicTableFactoryDxeInitialize (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = MetadataInitializeHandle (&mMetadataRoot);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&ImageHandle,
|
||||
&gEdkiiDynamicTableFactoryProtocolGuid,
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
MemoryAllocationLib
|
||||
MetadataHandlerLib
|
||||
PrintLib
|
||||
TableHelperLib
|
||||
UefiBootServicesTableLib
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <ConfigurationManagerHelper.h>
|
||||
#include <DeviceTreeTableGenerator.h>
|
||||
#include <Library/TableHelperLib.h>
|
||||
#include <Library/MetadataHandlerLib.h>
|
||||
#include <Protocol/ConfigurationManagerProtocol.h>
|
||||
#include <Protocol/DynamicTableFactoryProtocol.h>
|
||||
#include <SmbiosTableGenerator.h>
|
||||
@@ -691,6 +692,7 @@ DynamicTableManagerDxeInitialize (
|
||||
EDKII_CONFIGURATION_MANAGER_PROTOCOL *CfgMgrProtocol;
|
||||
CM_STD_OBJ_CONFIGURATION_MANAGER_INFO *CfgMfrInfo;
|
||||
EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *TableFactoryProtocol;
|
||||
METADATA_ROOT_HANDLE Root;
|
||||
|
||||
// Locate the Dynamic Table Factory
|
||||
Status = gBS->LocateProtocol (
|
||||
@@ -762,7 +764,19 @@ DynamicTableManagerDxeInitialize (
|
||||
"ERROR: ACPI Table processing failure. Status = %r\n",
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
Root = TableFactoryProtocol->GetMetadataRoot ();
|
||||
|
||||
// Validate the collected Metadata.
|
||||
Status = MetadataHandlerValidate (Root);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
MetadataFreeHandle (Root);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
DynamicTablesPkg/DynamicTablesPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
MetadataHandlerLib
|
||||
PrintLib
|
||||
TableHelperLib
|
||||
UefiBootServicesTableLib
|
||||
|
||||
27
DynamicTablesPkg/Include/MetadataHelpers.h
Normal file
27
DynamicTablesPkg/Include/MetadataHelpers.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/** @file
|
||||
Metadata Helpers
|
||||
|
||||
Copyright (c) 2025, Arm Limited. All rights reserved.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
|
||||
#ifndef METADATA_HELPER_H_
|
||||
#define METADATA_HELPER_H_
|
||||
|
||||
#include <Library/MetadataHandlerLib.h>
|
||||
|
||||
/** Get the Root handle of the MetadataObjLib.
|
||||
|
||||
During the firmware table generation, some Metadata information might be
|
||||
generated by different generators. This Metadata might be subject to
|
||||
additional validation.
|
||||
|
||||
@return The Metadata Root handle.
|
||||
**/
|
||||
METADATA_ROOT_HANDLE
|
||||
EFIAPI
|
||||
GetMetadataRoot (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif // METADATA_HELPER_H_
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <AcpiTableGenerator.h>
|
||||
#include <SmbiosTableGenerator.h>
|
||||
#include <DeviceTreeTableGenerator.h>
|
||||
#include <Library/MetadataObjLib.h>
|
||||
|
||||
/** This macro defines the Dynamic Table Factory Protocol GUID.
|
||||
|
||||
@@ -200,6 +201,20 @@ EFI_STATUS
|
||||
IN CONST DT_TABLE_GENERATOR *CONST Generator
|
||||
);
|
||||
|
||||
/** Get the Root handle of the MetadataObjLib.
|
||||
|
||||
During the firmware table generation, some Metadata information might be
|
||||
generated by different generators. This Metadata might be subject to
|
||||
additional validation.
|
||||
|
||||
@return The Metadata Root handle.
|
||||
**/
|
||||
typedef
|
||||
VOID *
|
||||
(EFIAPI *EDKII_DYNAMIC_TABLE_FACTORY_GET_METADATA_ROOT)(
|
||||
VOID
|
||||
);
|
||||
|
||||
/** A structure describing the Dynamic Table Factory Protocol interface.
|
||||
*/
|
||||
typedef struct DynamicTableFactoryProtocol {
|
||||
@@ -239,6 +254,10 @@ typedef struct DynamicTableFactoryProtocol {
|
||||
EDKII_DYNAMIC_TABLE_FACTORY_DEREGISTER_DT_TABLE_GENERATOR
|
||||
DeregisterDtTableGenerator;
|
||||
|
||||
/// Finalization step
|
||||
EDKII_DYNAMIC_TABLE_FACTORY_GET_METADATA_ROOT
|
||||
GetMetadataRoot;
|
||||
|
||||
/** Pointer to the data structure that holds the
|
||||
list of registered table generators
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user