Skip to content

Commit

Permalink
Support the platform specific event hooks which can be customized.
Browse files Browse the repository at this point in the history
Support the platform specific event hooks which can be customized.
  • Loading branch information
yhsu3 committed Apr 16, 2024
1 parent e4889cd commit eb5f430
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 0 deletions.
36 changes: 36 additions & 0 deletions MsCorePkg/Include/Library/BdsPlatformEventLib.h
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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 <Uefi.h>

/**
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;
}
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

//
Expand Down Expand Up @@ -267,6 +271,8 @@ PlatformBootManagerBeforeConsole (
// Dispatch the deferred 3rd party images.
//
EfiBootManagerDispatchDeferredImages ();

AfterDispatchDeferredImagesHook (); // MS_CHANGE
}

VOID
Expand Down
1 change: 1 addition & 0 deletions MsCorePkg/Library/PlatformBootManagerLib/BdsPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/DeviceBootManagerLib.h>
#include <Library/HobLib.h>
#include <Library/PerformanceLib.h>
#include <Library/BdsPlatformEventLib.h> // MS_CHANGE

#include <IndustryStandard/Pci30.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ CONSTRUCTOR = PlatformBootManagerEntry
UefiBootServicesTableLib
UefiLib
UefiRuntimeServicesTableLib
BdsPlatformEventLib # MS_CHANGE

[Protocols]
gEfiPciRootBridgeIoProtocolGuid ## CONSUMES
Expand Down
4 changes: 4 additions & 0 deletions MsCorePkg/MsCorePkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 2 additions & 0 deletions MsCorePkg/MsCorePkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eb5f430

Please sign in to comment.