Skip to content

Commit

Permalink
MdeModulePkg: Add DxeGcdCorePlatformHookLib
Browse files Browse the repository at this point in the history
The library provides the function to perform the platform hooks after
Gcd core is initialized.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
  • Loading branch information
codomania committed Jun 5, 2017
1 parent 4f95545 commit 171f816
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MdeModulePkg/Core/Dxe/DxeMain.h
Expand Up @@ -93,7 +93,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/DxeServicesLib.h>
#include <Library/DebugAgentLib.h>
#include <Library/CpuExceptionHandlerLib.h>

#include <Library/DxeGcdCorePlatformHookLib.h>

//
// attributes for reserved memory before it is promoted to system memory
Expand Down
1 change: 1 addition & 0 deletions MdeModulePkg/Core/Dxe/DxeMain.inf
Expand Up @@ -100,6 +100,7 @@
DebugAgentLib
CpuExceptionHandlerLib
PcdLib
DxeGcdCorePlatformHookLib

[Guids]
gEfiEventMemoryMapChangeGuid ## PRODUCES ## Event
Expand Down
5 changes: 5 additions & 0 deletions MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c
Expand Up @@ -297,6 +297,11 @@ DxeMain (
Status = CoreInitializeGcdServices (&HobStart, MemoryBaseAddress, MemoryLength);
ASSERT_EFI_ERROR (Status);

//
// Call Platform hooks for Gcd
//
DxeGcdCorePlatformHookReady (&mDxeServices);

//
// Call constructor for all libraries
//
Expand Down
33 changes: 33 additions & 0 deletions MdeModulePkg/Include/Library/DxeGcdCorePlatformHookLib.h
@@ -0,0 +1,33 @@
/** @file
Library that provides platform hooks to perform post processing of Gcd memory map.
Copyright (c) 2017, AMD Inc. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/

#ifndef __DXE_GCD_CORE_PLATFORM_HOOK_LIB_H__
#define __DXE_GCD_CORE_PLATFORM_HOOK_LIB_H__


/**
This function is hook point called after the GCD memory map is initialized,
it allows the platform to perform post processing before the GCD maps are
made available to other drivers.
**/
VOID
EFIAPI
DxeGcdCorePlatformHookReady (
EFI_DXE_SERVICES *gDS
);


#endif

@@ -0,0 +1,30 @@
/** @file
DxeCore Gcd Platform Hook NULL library instance.
Copyright (c) 2017, AMD Inc. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/

#include <PiDxe.h>

#include <Library/DxeGcdCorePlatformHookLib.h>

/**
This function is hook point called after the GCD memory map is initialized,
it allows the platform to perform post processing before the GCD maps are
made available to other drivers.
**/
VOID
EFIAPI
DxeGcdCorePlatformHookReady (
EFI_DXE_SERVICES *gDS
)
{
}
@@ -0,0 +1,33 @@
## @file
# GCD core platform hook lib

# Copyright (c) 2017, AMD Inc. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
##

[Defines]
INF_VERSION = 1.25
BASE_NAME = DxeGcdCorePlatformHookLib
FILE_GUID = 7C1DC10D-D271-422a-AFF3-CBCF70344431
MODULE_TYPE = DXE_CORE
VERSION_STRING = 1.0

LIBRARY_CLASS = DxeGcdCorePlatformHookLib | DXE_CORE

[Sources]
DxeGcdCorePlatformHookLibNull.c

[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec

[LibraryClasses]
BaseLib
DebugLib
2 changes: 2 additions & 0 deletions MdeModulePkg/MdeModulePkg.dec
Expand Up @@ -167,6 +167,8 @@
##
NonDiscoverableDeviceRegistrationLib|Include/Library/NonDiscoverableDeviceRegistrationLib.h

DxeGcdCorePlatformHookLib|Include/Library/DxeGcdCorePlatformHookLib.h

[Guids]
## MdeModule package token space guid
# Include/Guid/MdeModulePkgTokenSpace.h
Expand Down
1 change: 1 addition & 0 deletions MdeModulePkg/MdeModulePkg.dsc
Expand Up @@ -124,6 +124,7 @@
HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
DxeGcdCorePlatformHookLib|MdeModulePkg/Library/DxeGcdCorePlatformHookLib/DxeGcdCorePlatformHookLibNull.inf

[LibraryClasses.common.DXE_DRIVER]
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
Expand Down
1 change: 1 addition & 0 deletions OvmfPkg/OvmfPkgIa32X64.dsc
Expand Up @@ -283,6 +283,7 @@
!endif
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
DxeGcdCorePlatformHookLib|MdeModulePkg/Library/DxeGcdCorePlatformHookLib/DxeGcdCorePlatformHookLibNull.inf

[LibraryClasses.common.DXE_RUNTIME_DRIVER]
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
Expand Down

0 comments on commit 171f816

Please sign in to comment.