From eb5f4309ba54f50fdbbf0c7041f823f1d5c04a77 Mon Sep 17 00:00:00 2001 From: yhsu3 Date: Tue, 16 Apr 2024 19:08:46 +0800 Subject: [PATCH 1/4] Support the platform specific event hooks which can be customized. Support the platform specific event hooks which can be customized. --- .../Include/Library/BdsPlatformEventLib.h | 36 ++++++++++++++++ .../BdsPlatformEventLibNull.c | 42 +++++++++++++++++++ .../BdsPlatformEventLibNull.inf | 34 +++++++++++++++ .../PlatformBootManagerLib/BdsPlatform.c | 6 +++ .../PlatformBootManagerLib/BdsPlatform.h | 1 + .../PlatformBootManagerLib.inf | 1 + MsCorePkg/MsCorePkg.dec | 4 ++ MsCorePkg/MsCorePkg.dsc | 2 + 8 files changed, 126 insertions(+) create mode 100644 MsCorePkg/Include/Library/BdsPlatformEventLib.h create mode 100644 MsCorePkg/Library/BdsPlatformEventLibNull/BdsPlatformEventLibNull.c create mode 100644 MsCorePkg/Library/BdsPlatformEventLibNull/BdsPlatformEventLibNull.inf diff --git a/MsCorePkg/Include/Library/BdsPlatformEventLib.h b/MsCorePkg/Include/Library/BdsPlatformEventLib.h new file mode 100644 index 0000000000..b17f789767 --- /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 \ No newline at end of file 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..dc0f0157fe --- /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 \ No newline at end of file diff --git a/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.c b/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.c index e4735d5d26..c95c22acc1 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 (); // MS_CHANGE + // // Since PI1.2.1, we need signal EndOfDxe as ExitPmAuth // EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid); + AfterEndOfDxeEventHook (); // MS_CHANGE + DEBUG ((DEBUG_INFO, "All EndOfDxe callbacks have returned successfully\n")); // @@ -267,6 +271,8 @@ PlatformBootManagerBeforeConsole ( // Dispatch the deferred 3rd party images. // EfiBootManagerDispatchDeferredImages (); + + AfterDispatchDeferredImagesHook (); // MS_CHANGE } VOID diff --git a/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.h b/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.h index b9f2442f0a..ca0da24132 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 // MS_CHANGE #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..0fca277c5c 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 From 9616cd857aa3c0f41bccb712020646e36f0caff3 Mon Sep 17 00:00:00 2001 From: yhsu3 Date: Wed, 17 Apr 2024 19:54:10 +0800 Subject: [PATCH 2/4] Fixed ci build issue. Fixed ci build issue. --- MsCorePkg/Include/Library/BdsPlatformEventLib.h | 2 +- .../Library/BdsPlatformEventLibNull/BdsPlatformEventLibNull.inf | 2 +- MsCorePkg/MsCorePkg.dsc | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/MsCorePkg/Include/Library/BdsPlatformEventLib.h b/MsCorePkg/Include/Library/BdsPlatformEventLib.h index b17f789767..9aa0328812 100644 --- a/MsCorePkg/Include/Library/BdsPlatformEventLib.h +++ b/MsCorePkg/Include/Library/BdsPlatformEventLib.h @@ -33,4 +33,4 @@ AfterDispatchDeferredImagesHook ( VOID ); -#endif \ No newline at end of file +#endif diff --git a/MsCorePkg/Library/BdsPlatformEventLibNull/BdsPlatformEventLibNull.inf b/MsCorePkg/Library/BdsPlatformEventLibNull/BdsPlatformEventLibNull.inf index dc0f0157fe..e4b90949c3 100644 --- a/MsCorePkg/Library/BdsPlatformEventLibNull/BdsPlatformEventLibNull.inf +++ b/MsCorePkg/Library/BdsPlatformEventLibNull/BdsPlatformEventLibNull.inf @@ -31,4 +31,4 @@ LIBRARY_CLASS = BdsPlatformEventLib|DXE_DRIVER MsCorePkg/MsCorePkg.dec [LibraryClasses] - BaseLib \ No newline at end of file + BaseLib diff --git a/MsCorePkg/MsCorePkg.dsc b/MsCorePkg/MsCorePkg.dsc index 0fca277c5c..6296140bba 100644 --- a/MsCorePkg/MsCorePkg.dsc +++ b/MsCorePkg/MsCorePkg.dsc @@ -208,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 From 6b44a2555e12dd8124f69b04109d02f331982915 Mon Sep 17 00:00:00 2001 From: yhsu3 Date: Thu, 18 Apr 2024 22:16:49 +0800 Subject: [PATCH 3/4] Removed the code change tags. Removed the code change tags. --- MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.c b/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.c index c95c22acc1..919c2dfbf2 100644 --- a/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -41,14 +41,14 @@ ExitPmAuth ( DEBUG ((DEBUG_INFO, "ExitPmAuth ()- Start\n")); - BeforeEndOfDxeEventHook (); // MS_CHANGE + BeforeEndOfDxeEventHook (); // // Since PI1.2.1, we need signal EndOfDxe as ExitPmAuth // EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid); - AfterEndOfDxeEventHook (); // MS_CHANGE + AfterEndOfDxeEventHook (); DEBUG ((DEBUG_INFO, "All EndOfDxe callbacks have returned successfully\n")); @@ -272,7 +272,7 @@ PlatformBootManagerBeforeConsole ( // EfiBootManagerDispatchDeferredImages (); - AfterDispatchDeferredImagesHook (); // MS_CHANGE + AfterDispatchDeferredImagesHook (); } VOID From ddab20113eb883d9ffd00eb49c0b4d9f713e2789 Mon Sep 17 00:00:00 2001 From: yhsu3 Date: Thu, 18 Apr 2024 22:20:34 +0800 Subject: [PATCH 4/4] Removed the code chagne tag. Removed the code chagne tag. --- MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.h b/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.h index ca0da24132..a68bece6d5 100644 --- a/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.h +++ b/MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.h @@ -43,7 +43,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include -#include // MS_CHANGE +#include #include