mirror of https://github.com/acidanthera/audk.git
1. Add two performance measurement points for SMM performance measurement;
2. Introduce SmmCorePlatformHookLib library class defining two platform hook points. Update PI Smm Core to call the hook points before and after invoking registered SMI handlers. A NULL instance of this library class is implemented. Note that after this check in, DSC files consuming the PiSmmCore.inf need to be updated to add a library instance for SmmCorePlatformHookLib library class. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12140 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
a430bdb132
commit
495797c557
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
SMM Core Main Entry Point
|
SMM Core Main Entry Point
|
||||||
|
|
||||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
|
@ -246,11 +246,18 @@ SmmEntryPoint (
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_SMM_COMMUNICATE_HEADER *CommunicateHeader;
|
EFI_SMM_COMMUNICATE_HEADER *CommunicateHeader;
|
||||||
|
|
||||||
|
PERF_START (NULL, "SMM", NULL, 0) ;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update SMST using the context
|
// Update SMST using the context
|
||||||
//
|
//
|
||||||
CopyMem (&gSmmCoreSmst.SmmStartupThisAp, SmmEntryContext, sizeof (EFI_SMM_ENTRY_CONTEXT));
|
CopyMem (&gSmmCoreSmst.SmmStartupThisAp, SmmEntryContext, sizeof (EFI_SMM_ENTRY_CONTEXT));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Call platform hook before Smm Dispatch
|
||||||
|
//
|
||||||
|
PlatformHookBeforeSmmDispatch ();
|
||||||
|
|
||||||
//
|
//
|
||||||
// If a legacy boot has occured, then make sure gSmmCorePrivate is not accessed
|
// If a legacy boot has occured, then make sure gSmmCorePrivate is not accessed
|
||||||
//
|
//
|
||||||
|
@ -298,10 +305,17 @@ SmmEntryPoint (
|
||||||
SmiManage (NULL, NULL, NULL, NULL);
|
SmiManage (NULL, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Call platform hook after Smm Dispatch
|
||||||
|
//
|
||||||
|
PlatformHookAfterSmmDispatch ();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Clear the InSmm flag as we are going to leave SMM
|
// Clear the InSmm flag as we are going to leave SMM
|
||||||
//
|
//
|
||||||
gSmmCorePrivate->InSmm = FALSE;
|
gSmmCorePrivate->InSmm = FALSE;
|
||||||
|
|
||||||
|
PERF_END (NULL, "SMM", NULL, 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
The internal header file includes the common header files, defines
|
The internal header file includes the common header files, defines
|
||||||
internal structure and functions used by SmmCore module.
|
internal structure and functions used by SmmCore module.
|
||||||
|
|
||||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials are licensed and made available
|
This program and the accompanying materials are licensed and made available
|
||||||
under the terms and conditions of the BSD License which accompanies this
|
under the terms and conditions of the BSD License which accompanies this
|
||||||
distribution. The full text of the license may be found at
|
distribution. The full text of the license may be found at
|
||||||
|
@ -43,6 +43,8 @@
|
||||||
#include <Library/UefiLib.h>
|
#include <Library/UefiLib.h>
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
#include <Library/SmmCorePlatformHookLib.h>
|
||||||
|
#include <Library/PerformanceLib.h>
|
||||||
|
|
||||||
#include "PiSmmCorePrivateData.h"
|
#include "PiSmmCorePrivateData.h"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
## @file
|
## @file
|
||||||
# This module provide an SMM CIS compliant implementation of SMM Core.
|
# This module provide an SMM CIS compliant implementation of SMM Core.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -54,6 +54,8 @@
|
||||||
UefiBootServicesTableLib
|
UefiBootServicesTableLib
|
||||||
MemoryAllocationLib
|
MemoryAllocationLib
|
||||||
PcdLib
|
PcdLib
|
||||||
|
SmmCorePlatformHookLib
|
||||||
|
PerformanceLib
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiDxeSmmReadyToLockProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiDxeSmmReadyToLockProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
/** @file
|
||||||
|
Smm Core Platform Hook Library. This library class defines a set of platform
|
||||||
|
hooks called by the SMM Core.
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
|
This program and the accompanying materials are licensed and made available under
|
||||||
|
the terms and conditions of the BSD License that 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 __SMM_CORE_PLATFORM_HOOK_LIB__
|
||||||
|
#define __SMM_CORE_PLATFORM_HOOK_LIB__
|
||||||
|
|
||||||
|
/**
|
||||||
|
Performs platform specific tasks before invoking registered SMI handlers.
|
||||||
|
|
||||||
|
This function performs platform specific tasks before invoking registered SMI handlers.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The platform hook completes successfully.
|
||||||
|
@retval Other values The paltform hook cannot complete due to some error.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
PlatformHookBeforeSmmDispatch (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Performs platform specific tasks after invoking registered SMI handlers.
|
||||||
|
|
||||||
|
This function performs platform specific tasks after invoking registered SMI handlers.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The platform hook completes successfully.
|
||||||
|
@retval Other values The paltform hook cannot complete due to some error.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
PlatformHookAfterSmmDispatch (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,52 @@
|
||||||
|
/** @file
|
||||||
|
Null instance of SmmCorePlatformHookLibNull.
|
||||||
|
|
||||||
|
Copyright (c) 2011, Intel Corporation. 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 <Library/SmmCorePlatformHookLib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
Performs platform specific tasks before invoking registered SMI handlers.
|
||||||
|
|
||||||
|
This function performs platform specific tasks before invoking registered SMI handlers.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The platform hook completes successfully.
|
||||||
|
@retval Other values The paltform hook cannot complete due to some error.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
PlatformHookBeforeSmmDispatch (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Performs platform specific tasks after invoking registered SMI handlers.
|
||||||
|
|
||||||
|
This function performs platform specific tasks after invoking registered SMI handlers.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The platform hook completes successfully.
|
||||||
|
@retval Other values The paltform hook cannot complete due to some error.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
PlatformHookAfterSmmDispatch (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
## @file
|
||||||
|
# SMM Core Platform Hook Null Library instance
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011, Intel Corporation. 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 = 0x00010005
|
||||||
|
BASE_NAME = SmmCorePlatformHookLibNull
|
||||||
|
FILE_GUID = FED6583D-2418-4760-AC96-B5E18F0A6326
|
||||||
|
MODULE_TYPE = SMM_CORE
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
PI_SPECIFICATION_VERSION = 0x0001000A
|
||||||
|
LIBRARY_CLASS = SmmCorePlatformHookLib|SMM_CORE
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64
|
||||||
|
#
|
||||||
|
|
||||||
|
[Sources]
|
||||||
|
SmmCorePlatformHookLibNull.c
|
||||||
|
|
||||||
|
[Packages]
|
||||||
|
MdePkg/MdePkg.dec
|
||||||
|
MdeModulePkg/MdeModulePkg.dec
|
|
@ -86,6 +86,10 @@
|
||||||
#
|
#
|
||||||
PlatformHookLib|Include/Library/PlatformHookLib.h
|
PlatformHookLib|Include/Library/PlatformHookLib.h
|
||||||
|
|
||||||
|
## @libraryclass Provide platform specific hooks for SMM core.
|
||||||
|
#
|
||||||
|
SmmCorePlatformHookLib|Include/Library/SmmCorePlatformHookLib.h
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
## MdeModule package token space guid
|
## MdeModule package token space guid
|
||||||
# Include/Guid/MdeModulePkgTokenSpace.h
|
# Include/Guid/MdeModulePkgTokenSpace.h
|
||||||
|
|
|
@ -120,6 +120,7 @@
|
||||||
[LibraryClasses.common.SMM_CORE]
|
[LibraryClasses.common.SMM_CORE]
|
||||||
MemoryAllocationLib|MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocationLib.inf
|
MemoryAllocationLib|MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocationLib.inf
|
||||||
SmmServicesTableLib|MdeModulePkg/Library/PiSmmCoreSmmServicesTableLib/PiSmmCoreSmmServicesTableLib.inf
|
SmmServicesTableLib|MdeModulePkg/Library/PiSmmCoreSmmServicesTableLib/PiSmmCoreSmmServicesTableLib.inf
|
||||||
|
SmmCorePlatformHookLib|MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.inf
|
||||||
|
|
||||||
[LibraryClasses.common.DXE_SMM_DRIVER]
|
[LibraryClasses.common.DXE_SMM_DRIVER]
|
||||||
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
|
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
|
||||||
|
@ -321,4 +322,5 @@
|
||||||
MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf
|
MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.inf
|
||||||
MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf
|
MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.inf
|
||||||
MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf
|
MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.inf
|
||||||
|
MdeModulePkg/Library/SmmCorePlatformHookLibNull/SmmCorePlatformHookLibNull.inf
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue