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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
/** @file
Dynamic Table Factory Dxe
Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Protocol/AcpiTable.h>
// Module specific include files.
#include <AcpiTableGenerator.h>
#include <ConfigurationManagerObject.h>
#include <ConfigurationManagerHelper.h>
#include <DeviceTreeTableGenerator.h>
#include <Library/TableHelperLib.h>
#include <Protocol/ConfigurationManagerProtocol.h>
#include <Protocol/DynamicTableFactoryProtocol.h>
#include <SmbiosTableGenerator.h>
#include <Library/MetadataHandlerLib.h>
#include "DynamicTableFactory.h"
/** The Dynamic Table Factory protocol structure that holds the
list of registered ACPI and SMBIOS table generators.
*/
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
CONST
EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL DynamicTableFactoryProtocol = {
CREATE_REVISION (1, 0),
GetAcpiTableGenerator,
RegisterAcpiTableGenerator,
DeregisterAcpiTableGenerator,
GetSmbiosTableGenerator,
RegisterSmbiosTableGenerator,
DeregisterSmbiosTableGenerator,
GetDtTableGenerator,
RegisterDtTableGenerator,
DeregisterDtTableGenerator,
GetMetadataRoot,
AddSmbiosHandle,
FindSmbiosHandle,
FindSmbiosHandleEx,
&TableFactoryInfo
};
/** Entrypoint for Dynamic Table Factory Dxe.
@param ImageHandle
@param SystemTable
@retval EFI_SUCCESS Success.
@retval EFI_OUT_OF_RESOURCES Memory allocation failed.
@retval EFI_NOT_FOUND Required interface/object was not found.
@retval EFI_INVALID_PARAMETER Some parameter is incorrect/invalid.
**/
EFI_STATUS
EFIAPI
DynamicTableFactoryDxeInitialize (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
UINTN Idx;
for (Idx = 0; Idx < FixedPcdGet16 (PcdMaxSmbiosHandleMapEntries); Idx++) {
TableFactoryInfo.SmbiosHandleMap[Idx].SmbiosTblHandle = SMBIOS_HANDLE_PI_RESERVED;
TableFactoryInfo.SmbiosHandleMap[Idx].SmbiosCmToken = 0;
}
Status = MetadataInitializeHandle (&mMetadataRoot);
if (EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (Status);
return Status;
}
Status = gBS->InstallProtocolInterface (
&ImageHandle,
&gEdkiiDynamicTableFactoryProtocolGuid,
EFI_NATIVE_INTERFACE,
(VOID *)&DynamicTableFactoryProtocol
);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
"ERROR: Failed to install the Dynamic Table Factory Protocol." \
" Status = %r\n",
Status
));
}
return Status;
}
|