mirror of https://github.com/acidanthera/audk.git
MdeModulePkg PiSmmCore: Introduce SMM Exit Boot Services and Legacy Boot.
And also SMM Ready To Boot. The SMM Exit Boot Service protocol is to be published by the SMM Foundation code to associate with EFI_EVENT_GROUP_EXIT_BOOT_SERVICES to notify SMM driver that system enter exit boot services. The SMM Legacy Boot protocol is to be published by the SMM Foundation code to associate with EFI_EVENT_LEGACY_BOOT_GUID to notify SMM driver that system enter legacy boot. The SMM Ready To Boot protocol is to be published by the SMM Foundation code to associate with EFI_EVENT_GROUP_READY_TO_BOOT to notify SMM driver that system enter ready to boot. After them, any SMM drivers can get protocol notify on what happened in DXE phase, then there is no need to let each individual SMM driver to register SMM Communication Handler for that. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17657 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
93e8630a8d
commit
53ec4d7f98
|
@ -0,0 +1,29 @@
|
|||
/** @file
|
||||
EDKII SMM Exit Boot Services protocol.
|
||||
|
||||
This SMM protocol is to be published by the SMM Foundation code to associate
|
||||
with EFI_EVENT_GROUP_EXIT_BOOT_SERVICES to notify SMM driver that system enter
|
||||
exit boot services.
|
||||
|
||||
Copyright (c) 2015, 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.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _SMM_EXIT_BOOT_SERVICES_H_
|
||||
#define _SMM_EXIT_BOOT_SERVICES_H_
|
||||
|
||||
#define EDKII_SMM_EXIT_BOOT_SERVICES_PROTOCOL_GUID \
|
||||
{ \
|
||||
0x296eb418, 0xc4c8, 0x4e05, { 0xab, 0x59, 0x39, 0xe8, 0xaf, 0x56, 0xf0, 0xa } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEdkiiSmmExitBootServicesProtocolGuid;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,28 @@
|
|||
/** @file
|
||||
EDKII SMM Legacy Boot protocol.
|
||||
|
||||
This SMM protocol is to be published by the SMM Foundation code to associate
|
||||
with EFI_EVENT_LEGACY_BOOT_GUID to notify SMM driver that system enter legacy boot.
|
||||
|
||||
Copyright (c) 2015 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.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _SMM_LEGACY_BOOT_H_
|
||||
#define _SMM_LEGACY_BOOT_H_
|
||||
|
||||
#define EDKII_SMM_LEGACY_BOOT_PROTOCOL_GUID \
|
||||
{ \
|
||||
0x85a8ab57, 0x644, 0x4110, { 0x85, 0xf, 0x98, 0x13, 0x22, 0x4, 0x70, 0x70 } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEdkiiSmmLegacyBootProtocolGuid;
|
||||
|
||||
#endif
|
|
@ -0,0 +1,29 @@
|
|||
/** @file
|
||||
EDKII SMM Ready To Boot protocol.
|
||||
|
||||
This SMM protocol is to be published by the SMM Foundation code to associate
|
||||
with EFI_EVENT_GROUP_READY_TO_BOOT to notify SMM driver that system enter
|
||||
ready to boot.
|
||||
|
||||
Copyright (c) 2015, 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.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _SMM_READY_TO_BOOT_H_
|
||||
#define _SMM_READY_TO_BOOT_H_
|
||||
|
||||
#define EDKII_SMM_READY_TO_BOOT_PROTOCOL_GUID \
|
||||
{ \
|
||||
0x6e057ecf, 0xfa99, 0x4f39, { 0x95, 0xbc, 0x59, 0xf9, 0x92, 0x1d, 0x17, 0xe4 } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gEdkiiSmmReadyToBootProtocolGuid;
|
||||
|
||||
#endif
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
SMM Core Main Entry Point
|
||||
|
||||
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2015, 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
|
||||
|
@ -66,7 +66,7 @@ EFI_SMM_SYSTEM_TABLE2 gSmmCoreSmst = {
|
|||
//
|
||||
// Flag to determine if the platform has performed a legacy boot.
|
||||
// If this flag is TRUE, then the runtime code and runtime data associated with the
|
||||
// SMM IPL are converted to free memory, so the SMM COre must guarantee that is
|
||||
// SMM IPL are converted to free memory, so the SMM Core must guarantee that is
|
||||
// does not touch of the code/data associated with the SMM IPL if this flag is TRUE.
|
||||
//
|
||||
BOOLEAN mInLegacyBoot = FALSE;
|
||||
|
@ -75,11 +75,13 @@ BOOLEAN mInLegacyBoot = FALSE;
|
|||
// Table of SMI Handlers that are registered by the SMM Core when it is initialized
|
||||
//
|
||||
SMM_CORE_SMI_HANDLERS mSmmCoreSmiHandlers[] = {
|
||||
{ SmmDriverDispatchHandler, &gEfiEventDxeDispatchGuid, NULL, TRUE },
|
||||
{ SmmReadyToLockHandler, &gEfiDxeSmmReadyToLockProtocolGuid, NULL, TRUE },
|
||||
{ SmmLegacyBootHandler, &gEfiEventLegacyBootGuid, NULL, FALSE },
|
||||
{ SmmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, NULL, FALSE },
|
||||
{ NULL, NULL, NULL, FALSE }
|
||||
{ SmmDriverDispatchHandler, &gEfiEventDxeDispatchGuid, NULL, TRUE },
|
||||
{ SmmReadyToLockHandler, &gEfiDxeSmmReadyToLockProtocolGuid, NULL, TRUE },
|
||||
{ SmmLegacyBootHandler, &gEfiEventLegacyBootGuid, NULL, FALSE },
|
||||
{ SmmExitBootServicesHandler, &gEfiEventExitBootServicesGuid, NULL, FALSE },
|
||||
{ SmmReadyToBootHandler, &gEfiEventReadyToBootGuid, NULL, FALSE },
|
||||
{ SmmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, NULL, FALSE },
|
||||
{ NULL, NULL, NULL, FALSE }
|
||||
};
|
||||
|
||||
UINTN mFullSmramRangeCount;
|
||||
|
@ -121,7 +123,8 @@ SmmEfiNotAvailableYetArg5 (
|
|||
Core uses this signal to know that a Legacy Boot has been performed and that
|
||||
gSmmCorePrivate that is shared between the UEFI and SMM execution environments can
|
||||
not be accessed from SMM anymore since that structure is considered free memory by
|
||||
a legacy OS.
|
||||
a legacy OS. Then the SMM Core also install SMM Legacy Boot protocol to notify SMM
|
||||
driver that system enter legacy boot.
|
||||
|
||||
@param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
|
||||
@param Context Points to an optional handler context which was specified when the handler was registered.
|
||||
|
@ -141,8 +144,109 @@ SmmLegacyBootHandler (
|
|||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE SmmHandle;
|
||||
|
||||
//
|
||||
// Install SMM Legacy Boot protocol.
|
||||
//
|
||||
SmmHandle = NULL;
|
||||
Status = SmmInstallProtocolInterface (
|
||||
&SmmHandle,
|
||||
&gEdkiiSmmLegacyBootProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
NULL
|
||||
);
|
||||
|
||||
mInLegacyBoot = TRUE;
|
||||
return EFI_SUCCESS;
|
||||
|
||||
SmiHandlerUnRegister (DispatchHandle);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Software SMI handler that is called when an Exit Boot Services event is signalled.
|
||||
Then the SMM Core also install SMM Exit Boot Services protocol to notify SMM driver
|
||||
that system enter exit boot services.
|
||||
|
||||
@param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
|
||||
@param Context Points to an optional handler context which was specified when the handler was registered.
|
||||
@param CommBuffer A pointer to a collection of data in memory that will
|
||||
be conveyed from a non-SMM environment into an SMM environment.
|
||||
@param CommBufferSize The size of the CommBuffer.
|
||||
|
||||
@return Status Code
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SmmExitBootServicesHandler (
|
||||
IN EFI_HANDLE DispatchHandle,
|
||||
IN CONST VOID *Context, OPTIONAL
|
||||
IN OUT VOID *CommBuffer, OPTIONAL
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE SmmHandle;
|
||||
|
||||
//
|
||||
// Install SMM Exit Boot Services protocol.
|
||||
//
|
||||
SmmHandle = NULL;
|
||||
Status = SmmInstallProtocolInterface (
|
||||
&SmmHandle,
|
||||
&gEdkiiSmmExitBootServicesProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
NULL
|
||||
);
|
||||
|
||||
SmiHandlerUnRegister (DispatchHandle);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Software SMI handler that is called when an Ready To Boot event is signalled.
|
||||
Then the SMM Core also install SMM Ready To Boot protocol to notify SMM driver
|
||||
that system enter ready to boot.
|
||||
|
||||
@param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
|
||||
@param Context Points to an optional handler context which was specified when the handler was registered.
|
||||
@param CommBuffer A pointer to a collection of data in memory that will
|
||||
be conveyed from a non-SMM environment into an SMM environment.
|
||||
@param CommBufferSize The size of the CommBuffer.
|
||||
|
||||
@return Status Code
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SmmReadyToBootHandler (
|
||||
IN EFI_HANDLE DispatchHandle,
|
||||
IN CONST VOID *Context, OPTIONAL
|
||||
IN OUT VOID *CommBuffer, OPTIONAL
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE SmmHandle;
|
||||
|
||||
//
|
||||
// Install SMM Ready To Boot protocol.
|
||||
//
|
||||
SmmHandle = NULL;
|
||||
Status = SmmInstallProtocolInterface (
|
||||
&SmmHandle,
|
||||
&gEdkiiSmmReadyToBootProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
NULL
|
||||
);
|
||||
|
||||
SmiHandlerUnRegister (DispatchHandle);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/Security.h>
|
||||
#include <Protocol/Security2.h>
|
||||
#include <Protocol/SmmExitBootServices.h>
|
||||
#include <Protocol/SmmLegacyBoot.h>
|
||||
#include <Protocol/SmmReadyToBoot.h>
|
||||
|
||||
#include <Guid/Apriori.h>
|
||||
#include <Guid/EventGroup.h>
|
||||
|
@ -692,6 +695,50 @@ SmmEndOfDxeHandler (
|
|||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
This function is the main entry point for an SMM handler dispatch
|
||||
or communicate-based callback.
|
||||
|
||||
@param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
|
||||
@param Context Points to an optional handler context which was specified when the handler was registered.
|
||||
@param CommBuffer A pointer to a collection of data in memory that will
|
||||
be conveyed from a non-SMM environment into an SMM environment.
|
||||
@param CommBufferSize The size of the CommBuffer.
|
||||
|
||||
@return Status Code
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SmmExitBootServicesHandler (
|
||||
IN EFI_HANDLE DispatchHandle,
|
||||
IN CONST VOID *Context, OPTIONAL
|
||||
IN OUT VOID *CommBuffer, OPTIONAL
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
This function is the main entry point for an SMM handler dispatch
|
||||
or communicate-based callback.
|
||||
|
||||
@param DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
|
||||
@param Context Points to an optional handler context which was specified when the handler was registered.
|
||||
@param CommBuffer A pointer to a collection of data in memory that will
|
||||
be conveyed from a non-SMM environment into an SMM environment.
|
||||
@param CommBufferSize The size of the CommBuffer.
|
||||
|
||||
@return Status Code
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SmmReadyToBootHandler (
|
||||
IN EFI_HANDLE DispatchHandle,
|
||||
IN CONST VOID *Context, OPTIONAL
|
||||
IN OUT VOID *CommBuffer, OPTIONAL
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Place holder function until all the SMM System Table Service are available.
|
||||
|
||||
|
|
|
@ -72,6 +72,9 @@
|
|||
gEfiSecurity2ArchProtocolGuid ## SOMETIMES_CONSUMES
|
||||
gEfiLoadedImageProtocolGuid ## PRODUCES
|
||||
gEfiDevicePathProtocolGuid ## CONSUMES
|
||||
gEdkiiSmmExitBootServicesProtocolGuid ## SOMETIMES_PRODUCES
|
||||
gEdkiiSmmLegacyBootProtocolGuid ## SOMETIMES_PRODUCES
|
||||
gEdkiiSmmReadyToBootProtocolGuid ## PRODUCES
|
||||
|
||||
[Pcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdLoadFixAddressSmmCodePageNumber ## SOMETIMES_CONSUMES
|
||||
|
@ -83,6 +86,8 @@
|
|||
gAprioriGuid ## SOMETIMES_CONSUMES ## File
|
||||
gEfiEventDxeDispatchGuid ## PRODUCES ## GUID # SmiHandlerRegister
|
||||
gEfiEventLegacyBootGuid ## PRODUCES ## GUID # SmiHandlerRegister
|
||||
gEfiEventExitBootServicesGuid ## PRODUCES ## GUID # SmiHandlerRegister
|
||||
gEfiEventReadyToBootGuid ## PRODUCES ## GUID # SmiHandlerRegister
|
||||
gEfiEndOfDxeEventGroupGuid ## PRODUCES ## GUID # SmiHandlerRegister
|
||||
## SOMETIMES_CONSUMES ## GUID # Locate protocol
|
||||
## SOMETIMES_PRODUCES ## GUID # SmiHandlerRegister
|
||||
|
|
|
@ -283,9 +283,20 @@ SMM_IPL_EVENT_NOTIFICATION mSmmIplEvents[] = {
|
|||
// Declare event notification on Legacy Boot Event Group. This is used to inform the SMM Core that the platform
|
||||
// is performing a legacy boot operation, and that the UEFI environment is no longer available and the SMM Core
|
||||
// must guarantee that it does not access any UEFI related structures outside of SMRAM.
|
||||
// It is also to inform the SMM Core to notify SMM driver that system enter legacy boot.
|
||||
//
|
||||
{ FALSE, FALSE, &gEfiEventLegacyBootGuid, SmmIplGuidedEventNotify, &gEfiEventLegacyBootGuid, TPL_CALLBACK, NULL },
|
||||
//
|
||||
// Declare event notification on Exit Boot Services Event Group. This is used to inform the SMM Core
|
||||
// to notify SMM driver that system enter exit boot services.
|
||||
//
|
||||
{ FALSE, FALSE, &gEfiEventExitBootServicesGuid, SmmIplGuidedEventNotify, &gEfiEventExitBootServicesGuid, TPL_CALLBACK, NULL },
|
||||
//
|
||||
// Declare event notification on Ready To Boot Event Group. This is used to inform the SMM Core
|
||||
// to notify SMM driver that system enter ready to boot.
|
||||
//
|
||||
{ FALSE, FALSE, &gEfiEventReadyToBootGuid, SmmIplGuidedEventNotify, &gEfiEventReadyToBootGuid, TPL_CALLBACK, NULL },
|
||||
//
|
||||
// Declare event notification on SetVirtualAddressMap() Event Group. This is used to convert gSmmCorePrivate
|
||||
// and mSmmControl2 from physical addresses to virtual addresses.
|
||||
//
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## @file
|
||||
# This module provide an SMM CIS compliant implementation of SMM IPL.
|
||||
#
|
||||
# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2009 - 2015, 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
|
||||
|
@ -73,6 +73,12 @@
|
|||
## SOMETIMES_CONSUMES ## Event
|
||||
## SOMETIMES_PRODUCES ## UNDEFINED # Used to do smm communcation
|
||||
gEfiEventLegacyBootGuid
|
||||
## SOMETIMES_CONSUMES ## Event
|
||||
## SOMETIMES_PRODUCES ## UNDEFINED # Used to do smm communcation
|
||||
gEfiEventExitBootServicesGuid
|
||||
## SOMETIMES_CONSUMES ## Event
|
||||
## SOMETIMES_PRODUCES ## UNDEFINED # Used to do smm communcation
|
||||
gEfiEventReadyToBootGuid
|
||||
gEfiEventVirtualAddressChangeGuid ## CONSUMES ## Event
|
||||
gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event
|
||||
gLoadFixedAddressConfigurationTableGuid ## SOMETIMES_CONSUMES ## SystemTable
|
||||
|
|
|
@ -413,6 +413,15 @@
|
|||
## Include/Protocol/EsrtManagement.h
|
||||
gEsrtManagementProtocolGuid = { 0xa340c064, 0x723c, 0x4a9c, { 0xa4, 0xdd, 0xd5, 0xb4, 0x7a, 0x26, 0xfb, 0xb0 }}
|
||||
|
||||
## Include/Protocol/SmmExitBootServices.h
|
||||
gEdkiiSmmExitBootServicesProtocolGuid = { 0x296eb418, 0xc4c8, 0x4e05, { 0xab, 0x59, 0x39, 0xe8, 0xaf, 0x56, 0xf0, 0xa } }
|
||||
|
||||
## Include/Protocol/SmmLegacyBoot.h
|
||||
gEdkiiSmmLegacyBootProtocolGuid = { 0x85a8ab57, 0x644, 0x4110, { 0x85, 0xf, 0x98, 0x13, 0x22, 0x4, 0x70, 0x70 } }
|
||||
|
||||
## Include/Protocol/SmmReadyToBoot.h
|
||||
gEdkiiSmmReadyToBootProtocolGuid = { 0x6e057ecf, 0xfa99, 0x4f39, { 0x95, 0xbc, 0x59, 0xf9, 0x92, 0x1d, 0x17, 0xe4 } }
|
||||
|
||||
#
|
||||
# [Error.gEfiMdeModulePkgTokenSpaceGuid]
|
||||
# 0x80000001 | Invalid value provided.
|
||||
|
|
Loading…
Reference in New Issue