diff --git a/MsCorePkg/Include/Library/BdsPlatformEventLib.h b/MsCorePkg/Include/Library/BdsPlatformEventLib.h new file mode 100644 index 0000000000..9aa0328812 --- /dev/null +++ b/MsCorePkg/Include/Library/BdsPlatformEventLib.h @@ -0,0 +1,36 @@ +/** + This file include the platform specific event hooks which can be customized by IBV/OEM. + + Copyright (C) Microsoft Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _BDS_PLATFORM_EVENT_LIB_H_ +#define _BDS_PLATFORM_EVENT_LIB_H_ + +/** + The Hook Before End Of Dxe Event. it used for customized porting. +**/ +VOID +BeforeEndOfDxeEventHook ( + VOID + ); + +/** + The Hook After End Of Dxe Event. it used for customized porting. +**/ +VOID +AfterEndOfDxeEventHook ( + VOID + ); + +/** + The Hook Dispatch the deferred 3rd party images Event. it used for customized porting. +**/ +VOID +AfterDispatchDeferredImagesHook ( + VOID + ); + +#endif diff --git a/MsCorePkg/Library/BdsPlatformEventLibNull/BdsPlatformEventLibNull.c b/MsCorePkg/Library/BdsPlatformEventLibNull/BdsPlatformEventLibNull.c new file mode 100644 index 0000000000..a6c065b9d4 --- /dev/null +++ b/MsCorePkg/Library/BdsPlatformEventLibNull/BdsPlatformEventLibNull.c @@ -0,0 +1,42 @@ +/** @file + This file include the platform specific event hooks which can be customized by IBV/OEM. + + Copyright (C) Microsoft Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +/** + The Hook Before End Of Dxe Event. it used for customized porting. +**/ +VOID +BeforeEndOfDxeEventHook ( + VOID + ) +{ + return; +} + +/** + The Hook After End Of Dxe Event. it used for customized porting. +**/ +VOID +AfterEndOfDxeEventHook ( + VOID + ) +{ + return; +} + +/** + The Hook Dispatch the deferred 3rd party images Event. it used for customized porting. +**/ +VOID +AfterDispatchDeferredImagesHook ( + VOID + ) +{ + return; +} diff --git a/MsCorePkg/Library/BdsPlatformEventLibNull/BdsPlatformEventLibNull.inf b/MsCorePkg/Library/BdsPlatformEventLibNull/BdsPlatformEventLibNull.inf new file mode 100644 index 0000000000..e4b90949c3 --- /dev/null +++ b/MsCorePkg/Library/BdsPlatformEventLibNull/BdsPlatformEventLibNull.inf @@ -0,0 +1,34 @@ +/** @file + *This file include the platform specific event hooks which can be customized by IBV/OEM. + + Copyright (C) Microsoft Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +[Defines] +INF_VERSION = 0x00010018 +BASE_NAME = BdsPlatformEventLibNull +FILE_GUID = 55000994-06FB-43AB-A648-CD9CB2A7B273 +VERSION_STRING = 1.0 +MODULE_TYPE = DXE_DRIVER +UEFI_SPECIFICATION_VERSION = 2.7 +LIBRARY_CLASS = BdsPlatformEventLib|DXE_DRIVER + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 EBC +# + +[Sources] + BdsPlatformEventLibNull.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + MsCorePkg/MsCorePkg.dec + +[LibraryClasses] + BaseLib diff --git a/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.c b/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.c index e4735d5d26..919c2dfbf2 100644 --- a/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -41,11 +41,15 @@ ExitPmAuth ( DEBUG ((DEBUG_INFO, "ExitPmAuth ()- Start\n")); + BeforeEndOfDxeEventHook (); + // // Since PI1.2.1, we need signal EndOfDxe as ExitPmAuth // EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid); + AfterEndOfDxeEventHook (); + DEBUG ((DEBUG_INFO, "All EndOfDxe callbacks have returned successfully\n")); // @@ -267,6 +271,8 @@ PlatformBootManagerBeforeConsole ( // Dispatch the deferred 3rd party images. // EfiBootManagerDispatchDeferredImages (); + + AfterDispatchDeferredImagesHook (); } VOID diff --git a/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.h b/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.h index b9f2442f0a..a68bece6d5 100644 --- a/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.h +++ b/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.h @@ -43,6 +43,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include diff --git a/MsCorePkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/MsCorePkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index e8b4faf8d6..12bc09b7e5 100644 --- a/MsCorePkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/MsCorePkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -51,6 +51,7 @@ CONSTRUCTOR = PlatformBootManagerEntry UefiBootServicesTableLib UefiLib UefiRuntimeServicesTableLib + BdsPlatformEventLib # MS_CHANGE [Protocols] gEfiPciRootBridgeIoProtocolGuid ## CONSUMES diff --git a/MsCorePkg/MsCorePkg.dec b/MsCorePkg/MsCorePkg.dec index 074be6d792..d04b0d2c4f 100644 --- a/MsCorePkg/MsCorePkg.dec +++ b/MsCorePkg/MsCorePkg.dec @@ -70,6 +70,10 @@ # MacAddressEmulationPlatformLib|Include/Library/MacAddressEmulationPlatformLib.h + ## @libraryclass Supports the platform specific event hooks. + # + BdsPlatformEventLib|Include/Library/BdsPlatformEventLib.h + [Guids] # {a2966407-1f6b-4c86-b21e-fcc474c6f28e} gMsCorePkgTokenSpaceGuid = { 0xa2966407, 0x1f6b, 0x4c86, { 0xb2, 0x1e, 0xfc, 0xc4, 0x74, 0xc6, 0xf2, 0x8e }} diff --git a/MsCorePkg/MsCorePkg.dsc b/MsCorePkg/MsCorePkg.dsc index a62223fee3..6296140bba 100644 --- a/MsCorePkg/MsCorePkg.dsc +++ b/MsCorePkg/MsCorePkg.dsc @@ -90,6 +90,8 @@ MacAddressEmulationPlatformLib|MsCorePkg/Library/MacAddressEmulationPlatformLibNull/MacAddressEmulationPlatformLibNull.inf + BdsPlatformEventLib|MsCorePkg/Library/BdsPlatformEventLibNull/BdsPlatformEventLibNull.inf + [LibraryClasses.common.UEFI_APPLICATION] UnitTestPersistenceLib|UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/UnitTestPersistenceLibSimpleFileSystem.inf UnitTestResultReportLib|XmlSupportPkg/Library/UnitTestResultReportJUnitFormatLib/UnitTestResultReportLib.inf @@ -206,6 +208,7 @@ } MsCorePkg/MacAddressEmulationDxe/MacAddressEmulationDxe.inf MsCorePkg/Library/MacAddressEmulationPlatformLibNull/MacAddressEmulationPlatformLibNull.inf + MsCorePkg/Library/BdsPlatformEventLibNull/BdsPlatformEventLibNull.inf [Components.AARCH64, Components.AARCH64] MsCorePkg/Library/MemoryProtectionExceptionHandlerLib/MemoryProtectionExceptionHandlerLib.inf