MdeModulePkg: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
@@ -5,14 +5,14 @@
|
||||
if a driver can be scheduled for execution. The criteria for
|
||||
schedulability is that the dependency expression is satisfied.
|
||||
|
||||
Copyright (c) 2009 - 2010, 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
|
||||
Copyright (c) 2009 - 2018, 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.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -194,10 +194,10 @@ SmmIsSchedulable (
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_DISPATCH, "Evaluate SMM DEPEX for FFS(%g)\n", &DriverEntry->FileName));
|
||||
|
||||
|
||||
if (DriverEntry->Depex == NULL) {
|
||||
//
|
||||
// A NULL Depex means that the SMM driver is not built correctly.
|
||||
// A NULL Depex means that the SMM driver is not built correctly.
|
||||
// All SMM drivers must have a valid depex expressiion.
|
||||
//
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Depex is empty)\n"));
|
||||
|
@@ -28,14 +28,14 @@
|
||||
Depex - Dependency Expresion.
|
||||
|
||||
Copyright (c) 2014, Hewlett-Packard Development Company, L.P.
|
||||
Copyright (c) 2009 - 2017, 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
|
||||
Copyright (c) 2009 - 2018, 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.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -127,18 +127,18 @@ EFI_SECURITY2_ARCH_PROTOCOL *mSecurity2 = NULL;
|
||||
//
|
||||
// The global variable is defined for Loading modules at fixed address feature to track the SMM code
|
||||
// memory range usage. It is a bit mapped array in which every bit indicates the corresponding
|
||||
// memory page available or not.
|
||||
// memory page available or not.
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 *mSmmCodeMemoryRangeUsageBitMap=NULL;
|
||||
|
||||
/**
|
||||
To check memory usage bit map array to figure out if the memory range in which the image will be loaded is available or not. If
|
||||
memory range is available, the function will mark the corresponding bits to 1 which indicates the memory range is used.
|
||||
The function is only invoked when load modules at fixed address feature is enabled.
|
||||
|
||||
The function is only invoked when load modules at fixed address feature is enabled.
|
||||
|
||||
@param ImageBase The base address the image will be loaded at.
|
||||
@param ImageSize The size of the image
|
||||
|
||||
|
||||
@retval EFI_SUCCESS The memory range the image will be loaded in is available
|
||||
@retval EFI_NOT_FOUND The memory range the image will be loaded in is not available
|
||||
**/
|
||||
@@ -149,7 +149,7 @@ CheckAndMarkFixLoadingMemoryUsageBitMap (
|
||||
)
|
||||
{
|
||||
UINT32 SmmCodePageNumber;
|
||||
UINT64 SmmCodeSize;
|
||||
UINT64 SmmCodeSize;
|
||||
EFI_PHYSICAL_ADDRESS SmmCodeBase;
|
||||
UINTN BaseOffsetPageNumber;
|
||||
UINTN TopOffsetPageNumber;
|
||||
@@ -160,11 +160,11 @@ CheckAndMarkFixLoadingMemoryUsageBitMap (
|
||||
SmmCodePageNumber = PcdGet32(PcdLoadFixAddressSmmCodePageNumber);
|
||||
SmmCodeSize = EFI_PAGES_TO_SIZE (SmmCodePageNumber);
|
||||
SmmCodeBase = gLoadModuleAtFixAddressSmramBase;
|
||||
|
||||
|
||||
//
|
||||
// If the memory usage bit map is not initialized, do it. Every bit in the array
|
||||
// If the memory usage bit map is not initialized, do it. Every bit in the array
|
||||
// indicate the status of the corresponding memory page, available or not
|
||||
//
|
||||
//
|
||||
if (mSmmCodeMemoryRangeUsageBitMap == NULL) {
|
||||
mSmmCodeMemoryRangeUsageBitMap = AllocateZeroPool(((SmmCodePageNumber / 64) + 1)*sizeof(UINT64));
|
||||
}
|
||||
@@ -178,11 +178,11 @@ CheckAndMarkFixLoadingMemoryUsageBitMap (
|
||||
// see if the memory range for loading the image is in the SMM code range.
|
||||
//
|
||||
if (SmmCodeBase + SmmCodeSize < ImageBase + ImageSize || SmmCodeBase > ImageBase) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
//
|
||||
// Test if the memory is avalaible or not.
|
||||
//
|
||||
//
|
||||
BaseOffsetPageNumber = EFI_SIZE_TO_PAGES((UINT32)(ImageBase - SmmCodeBase));
|
||||
TopOffsetPageNumber = EFI_SIZE_TO_PAGES((UINT32)(ImageBase + ImageSize - SmmCodeBase));
|
||||
for (Index = BaseOffsetPageNumber; Index < TopOffsetPageNumber; Index ++) {
|
||||
@@ -190,22 +190,22 @@ CheckAndMarkFixLoadingMemoryUsageBitMap (
|
||||
//
|
||||
// This page is already used.
|
||||
//
|
||||
return EFI_NOT_FOUND;
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Being here means the memory range is available. So mark the bits for the memory range
|
||||
//
|
||||
//
|
||||
for (Index = BaseOffsetPageNumber; Index < TopOffsetPageNumber; Index ++) {
|
||||
mSmmCodeMemoryRangeUsageBitMap[Index / 64] |= LShiftU64(1, (Index % 64));
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
/**
|
||||
Get the fixed loading address from image header assigned by build tool. This function only be called
|
||||
when Loading module at Fixed address feature enabled.
|
||||
|
||||
|
||||
@param ImageContext Pointer to the image context structure that describes the PE/COFF
|
||||
image that needs to be examined by this function.
|
||||
@retval EFI_SUCCESS An fixed loading address is assigned to this image by build tools .
|
||||
@@ -398,7 +398,7 @@ SmmLoadImage (
|
||||
&AuthenticationStatus
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Buffer != NULL) {
|
||||
gBS->FreePool (Buffer);
|
||||
@@ -422,7 +422,7 @@ SmmLoadImage (
|
||||
//
|
||||
// Verify the Authentication Status through the Security Architectural Protocol
|
||||
// Only on images that have been read using Firmware Volume protocol.
|
||||
// All SMM images are from FV protocol.
|
||||
// All SMM images are from FV protocol.
|
||||
//
|
||||
if (!EFI_ERROR (SecurityStatus) && (mSecurity != NULL)) {
|
||||
SecurityStatus = mSecurity->FileAuthenticationState (
|
||||
@@ -436,7 +436,7 @@ SmmLoadImage (
|
||||
Status = SecurityStatus;
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Initialize ImageContext
|
||||
//
|
||||
@@ -468,7 +468,7 @@ SmmLoadImage (
|
||||
// following statements is to bypass SmmFreePages
|
||||
//
|
||||
PageCount = 0;
|
||||
DstBuffer = (UINTN)gLoadModuleAtFixAddressSmramBase;
|
||||
DstBuffer = (UINTN)gLoadModuleAtFixAddressSmramBase;
|
||||
} else {
|
||||
DEBUG ((EFI_D_INFO|EFI_D_LOAD, "LOADING MODULE FIXED ERROR: Failed to load module at fixed address. \n"));
|
||||
//
|
||||
@@ -476,7 +476,7 @@ SmmLoadImage (
|
||||
//
|
||||
PageCount = (UINTN)EFI_SIZE_TO_PAGES((UINTN)ImageContext.ImageSize + ImageContext.SectionAlignment);
|
||||
DstBuffer = (UINTN)(-1);
|
||||
|
||||
|
||||
Status = SmmAllocatePages (
|
||||
AllocateMaxAddress,
|
||||
EfiRuntimeServicesCode,
|
||||
@@ -486,15 +486,15 @@ SmmLoadImage (
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Buffer != NULL) {
|
||||
gBS->FreePool (Buffer);
|
||||
}
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)DstBuffer;
|
||||
}
|
||||
} else {
|
||||
PageCount = (UINTN)EFI_SIZE_TO_PAGES((UINTN)ImageContext.ImageSize + ImageContext.SectionAlignment);
|
||||
DstBuffer = (UINTN)(-1);
|
||||
|
||||
|
||||
Status = SmmAllocatePages (
|
||||
AllocateMaxAddress,
|
||||
EfiRuntimeServicesCode,
|
||||
@@ -507,7 +507,7 @@ SmmLoadImage (
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS)DstBuffer;
|
||||
}
|
||||
//
|
||||
@@ -549,7 +549,7 @@ SmmLoadImage (
|
||||
// Save Image EntryPoint in DriverEntry
|
||||
//
|
||||
DriverEntry->ImageEntryPoint = ImageContext.EntryPoint;
|
||||
DriverEntry->ImageBuffer = DstBuffer;
|
||||
DriverEntry->ImageBuffer = DstBuffer;
|
||||
DriverEntry->NumberOfPage = PageCount;
|
||||
|
||||
//
|
||||
@@ -698,20 +698,20 @@ SmmLoadImage (
|
||||
//
|
||||
// Free buffer allocated by Fv->ReadSection.
|
||||
//
|
||||
// The UEFI Boot Services FreePool() function must be used because Fv->ReadSection
|
||||
// The UEFI Boot Services FreePool() function must be used because Fv->ReadSection
|
||||
// used the UEFI Boot Services AllocatePool() function
|
||||
//
|
||||
Status = gBS->FreePool(Buffer);
|
||||
if (!EFI_ERROR (Status) && EFI_ERROR (SecurityStatus)) {
|
||||
Status = SecurityStatus;
|
||||
}
|
||||
return Status;
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Preprocess dependency expression and update DriverEntry to reflect the
|
||||
state of Before and After dependencies. If DriverEntry->Before
|
||||
or DriverEntry->After is set it will never be cleared.
|
||||
or DriverEntry->After is set it will never be cleared.
|
||||
|
||||
@param DriverEntry DriverEntry element to update .
|
||||
|
||||
@@ -810,7 +810,7 @@ SmmGetDepexSectionAndPreProccess (
|
||||
drivers to run. Drain the mScheduledQueue and load and start a PE
|
||||
image for each driver. Search the mDiscoveredList to see if any driver can
|
||||
be placed on the mScheduledQueue. If no drivers are placed on the
|
||||
mScheduledQueue exit the function.
|
||||
mScheduledQueue exit the function.
|
||||
|
||||
@retval EFI_SUCCESS All of the SMM Drivers that could be dispatched
|
||||
have been run and the SMM Entry Point has been
|
||||
@@ -945,11 +945,11 @@ SmmDispatcher (
|
||||
|
||||
if (!PreviousSmmEntryPointRegistered && gSmmCorePrivate->SmmEntryPointRegistered) {
|
||||
//
|
||||
// Return immediately if the SMM Entry Point was registered by the SMM
|
||||
// Return immediately if the SMM Entry Point was registered by the SMM
|
||||
// Driver that was just dispatched. The SMM IPL will reinvoke the SMM
|
||||
// Core Dispatcher. This is required so SMM Mode may be enabled as soon
|
||||
// as all the dependent SMM Drivers for SMM Mode have been dispatched.
|
||||
// Once the SMM Entry Point has been registered, then SMM Mode will be
|
||||
// Core Dispatcher. This is required so SMM Mode may be enabled as soon
|
||||
// as all the dependent SMM Drivers for SMM Mode have been dispatched.
|
||||
// Once the SMM Entry Point has been registered, then SMM Mode will be
|
||||
// used.
|
||||
//
|
||||
gRequestDispatch = TRUE;
|
||||
@@ -1437,14 +1437,14 @@ SmmDriverDispatchHandler (
|
||||
//
|
||||
// Free data allocated by Fv->ReadSection ()
|
||||
//
|
||||
// The UEFI Boot Services FreePool() function must be used because Fv->ReadSection
|
||||
// The UEFI Boot Services FreePool() function must be used because Fv->ReadSection
|
||||
// used the UEFI Boot Services AllocatePool() function
|
||||
//
|
||||
gBS->FreePool (AprioriFile);
|
||||
}
|
||||
|
||||
//
|
||||
// Execute the SMM Dispatcher on any newly discovered FVs and previously
|
||||
// Execute the SMM Dispatcher on any newly discovered FVs and previously
|
||||
// discovered SMM drivers that have been discovered but not dispatched.
|
||||
//
|
||||
Status = SmmDispatcher ();
|
||||
@@ -1456,7 +1456,7 @@ SmmDriverDispatchHandler (
|
||||
if (*CommBufferSize > 0) {
|
||||
if (Status == EFI_NOT_READY) {
|
||||
//
|
||||
// If a the SMM Core Entry Point was just registered, then set flag to
|
||||
// If a the SMM Core Entry Point was just registered, then set flag to
|
||||
// request the SMM Dispatcher to be restarted.
|
||||
//
|
||||
*(UINT8 *)CommBuffer = COMM_BUFFER_SMM_DISPATCH_RESTART;
|
||||
|
@@ -1,14 +1,14 @@
|
||||
/** @file
|
||||
SMM handle & protocol handling.
|
||||
|
||||
Copyright (c) 2009 - 2017, 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
|
||||
Copyright (c) 2009 - 2018, 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.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -1,14 +1,14 @@
|
||||
/** @file
|
||||
System Management System Table Services SmmInstallConfigurationTable service
|
||||
|
||||
Copyright (c) 2009 - 2017, 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
|
||||
Copyright (c) 2009 - 2018, 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.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -1,14 +1,14 @@
|
||||
/** @file
|
||||
Locate handle functions
|
||||
|
||||
Copyright (c) 2009 - 2017, 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
|
||||
Copyright (c) 2009 - 2018, 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.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
|
@@ -1,14 +1,14 @@
|
||||
/** @file
|
||||
Support functions for UEFI protocol notification infrastructure.
|
||||
|
||||
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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2009 - 2018, 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.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -116,7 +116,7 @@ SmmRegisterProtocolNotify (
|
||||
}
|
||||
|
||||
if (Function == NULL) {
|
||||
//
|
||||
//
|
||||
// Get the protocol entry per Protocol
|
||||
//
|
||||
ProtEntry = SmmFindProtocolEntry ((EFI_GUID *) Protocol, FALSE);
|
||||
@@ -126,7 +126,7 @@ SmmRegisterProtocolNotify (
|
||||
Link != &ProtEntry->Notify;
|
||||
Link = Link->ForwardLink) {
|
||||
//
|
||||
// Compare the notification record
|
||||
// Compare the notification record
|
||||
//
|
||||
if (ProtNotify == (CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE))){
|
||||
//
|
||||
@@ -143,7 +143,7 @@ SmmRegisterProtocolNotify (
|
||||
// If the registration is not found
|
||||
//
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
ProtNotify = NULL;
|
||||
|
||||
|
@@ -2,13 +2,13 @@
|
||||
SMM Core Main Entry Point
|
||||
|
||||
Copyright (c) 2009 - 2018, 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
|
||||
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.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -65,7 +65,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
|
||||
// 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
|
||||
// does not touch of the code/data associated with the SMM IPL if this flag is TRUE.
|
||||
//
|
||||
@@ -82,7 +82,7 @@ BOOLEAN mDuringS3Resume = FALSE;
|
||||
//
|
||||
SMM_CORE_SMI_HANDLERS mSmmCoreSmiHandlers[] = {
|
||||
{ SmmDriverDispatchHandler, &gEfiEventDxeDispatchGuid, NULL, TRUE },
|
||||
{ SmmReadyToLockHandler, &gEfiDxeSmmReadyToLockProtocolGuid, NULL, TRUE },
|
||||
{ SmmReadyToLockHandler, &gEfiDxeSmmReadyToLockProtocolGuid, NULL, TRUE },
|
||||
{ SmmLegacyBootHandler, &gEfiEventLegacyBootGuid, NULL, FALSE },
|
||||
{ SmmExitBootServicesHandler, &gEfiEventExitBootServicesGuid, NULL, FALSE },
|
||||
{ SmmReadyToBootHandler, &gEfiEventReadyToBootGuid, NULL, FALSE },
|
||||
@@ -132,7 +132,7 @@ SmmEfiNotAvailableYetArg5 (
|
||||
|
||||
/**
|
||||
Software SMI handler that is called when a Legacy Boot event is signalled. The SMM
|
||||
Core uses this signal to know that a Legacy Boot has been performed and that
|
||||
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. Then the SMM Core also install SMM Legacy Boot protocol to notify SMM
|
||||
@@ -316,9 +316,9 @@ SmmReadyToBootHandler (
|
||||
|
||||
/**
|
||||
Software SMI handler that is called when the DxeSmmReadyToLock protocol is added
|
||||
or if gEfiEventReadyToBootGuid is signalled. This function unregisters the
|
||||
Software SMIs that are nor required after SMRAM is locked and installs the
|
||||
SMM Ready To Lock Protocol so SMM Drivers are informed that SMRAM is about
|
||||
or if gEfiEventReadyToBootGuid is signalled. This function unregisters the
|
||||
Software SMIs that are nor required after SMRAM is locked and installs the
|
||||
SMM Ready To Lock Protocol so SMM Drivers are informed that SMRAM is about
|
||||
to be locked. It also verifies the SMM CPU I/O 2 Protocol has been installed
|
||||
and NULLs gBS and gST because they can not longer be used after SMRAM is locked.
|
||||
|
||||
@@ -676,7 +676,7 @@ SmmEntryPoint (
|
||||
gSmmCorePrivate->InSmm = TRUE;
|
||||
|
||||
//
|
||||
// Check to see if this is a Synchronous SMI sent through the SMM Communication
|
||||
// Check to see if this is a Synchronous SMI sent through the SMM Communication
|
||||
// Protocol or an Asynchronous SMI
|
||||
//
|
||||
CommunicationBuffer = gSmmCorePrivate->CommunicationBuffer;
|
||||
@@ -703,9 +703,9 @@ SmmEntryPoint (
|
||||
CommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *)CommunicationBuffer;
|
||||
BufferSize -= OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);
|
||||
Status = SmiManage (
|
||||
&CommunicateHeader->HeaderGuid,
|
||||
NULL,
|
||||
CommunicateHeader->Data,
|
||||
&CommunicateHeader->HeaderGuid,
|
||||
NULL,
|
||||
CommunicateHeader->Data,
|
||||
&BufferSize
|
||||
);
|
||||
//
|
||||
@@ -723,7 +723,7 @@ SmmEntryPoint (
|
||||
// Process Asynchronous SMI sources
|
||||
//
|
||||
SmiManage (NULL, NULL, NULL, NULL);
|
||||
|
||||
|
||||
//
|
||||
// Call platform hook after Smm Dispatch
|
||||
//
|
||||
@@ -826,7 +826,7 @@ SmmCoreInstallLoadedImage (
|
||||
/**
|
||||
The Entry Point for SMM Core
|
||||
|
||||
Install DXE Protocols and reload SMM Core into SMRAM and register SMM Core
|
||||
Install DXE Protocols and reload SMM Core into SMRAM and register SMM Core
|
||||
EntryPoint on the SMI vector.
|
||||
|
||||
Note: This function is called for both DXE invocation and SMRAM invocation.
|
||||
|
@@ -3,13 +3,13 @@
|
||||
internal structure and functions used by SmmCore module.
|
||||
|
||||
Copyright (c) 2009 - 2018, 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
|
||||
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.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
#include <Protocol/CpuIo2.h>
|
||||
#include <Protocol/SmmCommunication.h>
|
||||
#include <Protocol/SmmAccess2.h>
|
||||
#include <Protocol/FirmwareVolume2.h>
|
||||
#include <Protocol/LoadedImage.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/Security.h>
|
||||
#include <Protocol/FirmwareVolume2.h>
|
||||
#include <Protocol/LoadedImage.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/Security.h>
|
||||
#include <Protocol/Security2.h>
|
||||
#include <Protocol/SmmExitBootServices.h>
|
||||
#include <Protocol/SmmLegacyBoot.h>
|
||||
@@ -52,8 +52,8 @@
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/SmmCorePlatformHookLib.h>
|
||||
@@ -136,7 +136,7 @@ typedef struct {
|
||||
//
|
||||
PHYSICAL_ADDRESS ImageEntryPoint;
|
||||
//
|
||||
// Image Buffer in SMRAM
|
||||
// Image Buffer in SMRAM
|
||||
//
|
||||
PHYSICAL_ADDRESS ImageBuffer;
|
||||
//
|
||||
|
@@ -46,19 +46,19 @@
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
UefiDriverEntryPoint
|
||||
BaseLib
|
||||
BaseMemoryLib
|
||||
PeCoffLib
|
||||
PeCoffGetEntryPointLib
|
||||
CacheMaintenanceLib
|
||||
CacheMaintenanceLib
|
||||
DebugLib
|
||||
ReportStatusCodeLib
|
||||
DevicePathLib
|
||||
UefiLib
|
||||
UefiBootServicesTableLib
|
||||
DevicePathLib
|
||||
UefiLib
|
||||
UefiBootServicesTableLib
|
||||
MemoryAllocationLib
|
||||
PcdLib
|
||||
SmmCorePlatformHookLib
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// /** @file
|
||||
// PiSmmCore Localized Strings and Content
|
||||
//
|
||||
// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
// Copyright (c) 2013 - 2018, 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
|
||||
@@ -12,8 +12,8 @@
|
||||
//
|
||||
// **/
|
||||
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
"Core SMM Services Driver"
|
||||
|
||||
|
||||
|
@@ -2,14 +2,14 @@
|
||||
The internal header file that declared a data structure that is shared
|
||||
between the SMM IPL and the SMM Core.
|
||||
|
||||
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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2009 - 2018, 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.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
|
||||
///
|
||||
/// Define values for the communications buffer used when gEfiEventDxeDispatchGuid is
|
||||
/// event signaled. This event is signaled by the DXE Core each time the DXE Core
|
||||
/// event signaled. This event is signaled by the DXE Core each time the DXE Core
|
||||
/// dispatcher has completed its work. When this event is signaled, the SMM Core
|
||||
/// if notified, so the SMM Core can dispatch SMM drivers. If COMM_BUFFER_SMM_DISPATCH_ERROR
|
||||
/// is returned in the communication buffer, then an error occurred dispatching SMM
|
||||
/// Drivers. If COMM_BUFFER_SMM_DISPATCH_SUCCESS is returned, then the SMM Core
|
||||
/// dispatched all the drivers it could. If COMM_BUFFER_SMM_DISPATCH_RESTART is
|
||||
/// Drivers. If COMM_BUFFER_SMM_DISPATCH_SUCCESS is returned, then the SMM Core
|
||||
/// dispatched all the drivers it could. If COMM_BUFFER_SMM_DISPATCH_RESTART is
|
||||
/// returned, then the SMM Core just dispatched the SMM Driver that registered
|
||||
/// the SMM Entry Point enabling the use of SMM Mode. In this case, the SMM Core
|
||||
/// should be notified again to dispatch more SMM Drivers using SMM Mode.
|
||||
@@ -38,13 +38,13 @@
|
||||
#define SMM_CORE_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('s', 'm', 'm', 'c')
|
||||
|
||||
///
|
||||
/// Private structure that is used to share information between the SMM IPL and
|
||||
/// Private structure that is used to share information between the SMM IPL and
|
||||
/// the SMM Core. This structure is allocated from memory of type EfiRuntimeServicesData.
|
||||
/// Since runtime memory types are converted to available memory when a legacy boot
|
||||
/// is performed, the SMM Core must not access any fields of this structure if a legacy
|
||||
/// boot is performed. As a result, the SMM IPL must create an event notification
|
||||
/// for the Legacy Boot event and notify the SMM Core that a legacy boot is being
|
||||
/// performed. The SMM Core can then use this information to filter accesses to
|
||||
/// Since runtime memory types are converted to available memory when a legacy boot
|
||||
/// is performed, the SMM Core must not access any fields of this structure if a legacy
|
||||
/// boot is performed. As a result, the SMM IPL must create an event notification
|
||||
/// for the Legacy Boot event and notify the SMM Core that a legacy boot is being
|
||||
/// performed. The SMM Core can then use this information to filter accesses to
|
||||
/// thos structure.
|
||||
///
|
||||
typedef struct {
|
||||
@@ -70,43 +70,43 @@ typedef struct {
|
||||
EFI_SMRAM_DESCRIPTOR *SmramRanges;
|
||||
|
||||
///
|
||||
/// The SMM Foundation Entry Point. The SMM Core fills in this field when the
|
||||
/// SMM Core is initialized. The SMM IPL is responsbile for registering this entry
|
||||
/// point with the SMM Configuration Protocol. The SMM Configuration Protocol may
|
||||
/// The SMM Foundation Entry Point. The SMM Core fills in this field when the
|
||||
/// SMM Core is initialized. The SMM IPL is responsbile for registering this entry
|
||||
/// point with the SMM Configuration Protocol. The SMM Configuration Protocol may
|
||||
/// not be available at the time the SMM IPL and SMM Core are started, so the SMM IPL
|
||||
/// sets up a protocol notification on the SMM Configuration Protocol and registers
|
||||
/// the SMM Foundation Entry Point as soon as the SMM Configuration Protocol is
|
||||
/// sets up a protocol notification on the SMM Configuration Protocol and registers
|
||||
/// the SMM Foundation Entry Point as soon as the SMM Configuration Protocol is
|
||||
/// available.
|
||||
///
|
||||
EFI_SMM_ENTRY_POINT SmmEntryPoint;
|
||||
|
||||
|
||||
///
|
||||
/// Boolean flag set to TRUE while an SMI is being processed by the SMM Core.
|
||||
///
|
||||
///
|
||||
BOOLEAN SmmEntryPointRegistered;
|
||||
|
||||
///
|
||||
/// Boolean flag set to TRUE while an SMI is being processed by the SMM Core.
|
||||
///
|
||||
///
|
||||
BOOLEAN InSmm;
|
||||
|
||||
///
|
||||
/// This field is set by the SMM Core then the SMM Core is initialized. This field is
|
||||
/// used by the SMM Base 2 Protocol and SMM Communication Protocol implementations in
|
||||
/// the SMM IPL.
|
||||
/// the SMM IPL.
|
||||
///
|
||||
EFI_SMM_SYSTEM_TABLE2 *Smst;
|
||||
|
||||
///
|
||||
/// This field is used by the SMM Communicatioon Protocol to pass a buffer into
|
||||
/// This field is used by the SMM Communicatioon Protocol to pass a buffer into
|
||||
/// a software SMI handler and for the software SMI handler to pass a buffer back to
|
||||
/// the caller of the SMM Communication Protocol.
|
||||
/// the caller of the SMM Communication Protocol.
|
||||
///
|
||||
VOID *CommunicationBuffer;
|
||||
|
||||
///
|
||||
/// This field is used by the SMM Communicatioon Protocol to pass the size of a buffer,
|
||||
/// in bytes, into a software SMI handler and for the software SMI handler to pass the
|
||||
/// in bytes, into a software SMI handler and for the software SMI handler to pass the
|
||||
/// size, in bytes, of a buffer back to the caller of the SMM Communication Protocol.
|
||||
///
|
||||
UINTN BufferSize;
|
||||
|
@@ -1,14 +1,14 @@
|
||||
/** @file
|
||||
SMM IPL that produces SMM related runtime protocols and load the SMM Core into SMRAM
|
||||
|
||||
Copyright (c) 2009 - 2017, 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
|
||||
Copyright (c) 2009 - 2018, 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.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -92,10 +92,10 @@ SmmBase2GetSmstLocation (
|
||||
|
||||
/**
|
||||
Communicates with a registered handler.
|
||||
|
||||
This function provides a service to send and receive messages from a registered
|
||||
UEFI service. This function is part of the SMM Communication Protocol that may
|
||||
be called in physical mode prior to SetVirtualAddressMap() and in virtual mode
|
||||
|
||||
This function provides a service to send and receive messages from a registered
|
||||
UEFI service. This function is part of the SMM Communication Protocol that may
|
||||
be called in physical mode prior to SetVirtualAddressMap() and in virtual mode
|
||||
after SetVirtualAddressMap().
|
||||
|
||||
@param[in] This The EFI_SMM_COMMUNICATION_PROTOCOL instance.
|
||||
@@ -213,7 +213,7 @@ SmmIplSetVirtualAddressNotify (
|
||||
);
|
||||
|
||||
//
|
||||
// Data structure used to declare a table of protocol notifications and event
|
||||
// Data structure used to declare a table of protocol notifications and event
|
||||
// notifications required by the SMM IPL
|
||||
//
|
||||
typedef struct {
|
||||
@@ -289,19 +289,19 @@ EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE *mLMFAConfigurationTable = NULL;
|
||||
SMM_IPL_EVENT_NOTIFICATION mSmmIplEvents[] = {
|
||||
//
|
||||
// Declare protocol notification on the SMM Configuration protocol. When this notification is established,
|
||||
// the associated event is immediately signalled, so the notification function will be executed and the
|
||||
// the associated event is immediately signalled, so the notification function will be executed and the
|
||||
// SMM Configuration Protocol will be found if it is already in the handle database.
|
||||
//
|
||||
{ TRUE, FALSE, &gEfiSmmConfigurationProtocolGuid, SmmIplSmmConfigurationEventNotify, &gEfiSmmConfigurationProtocolGuid, TPL_NOTIFY, NULL },
|
||||
//
|
||||
// Declare protocol notification on DxeSmmReadyToLock protocols. When this notification is established,
|
||||
// the associated event is immediately signalled, so the notification function will be executed and the
|
||||
// Declare protocol notification on DxeSmmReadyToLock protocols. When this notification is established,
|
||||
// the associated event is immediately signalled, so the notification function will be executed and the
|
||||
// DXE SMM Ready To Lock Protocol will be found if it is already in the handle database.
|
||||
//
|
||||
{ TRUE, TRUE, &gEfiDxeSmmReadyToLockProtocolGuid, SmmIplReadyToLockEventNotify, &gEfiDxeSmmReadyToLockProtocolGuid, TPL_CALLBACK, NULL },
|
||||
//
|
||||
// Declare event notification on EndOfDxe event. When this notification is established,
|
||||
// the associated event is immediately signalled, so the notification function will be executed and the
|
||||
// the associated event is immediately signalled, so the notification function will be executed and the
|
||||
// SMM End Of Dxe Protocol will be found if it is already in the handle database.
|
||||
//
|
||||
{ FALSE, TRUE, &gEfiEndOfDxeEventGroupGuid, SmmIplGuidedEventNotify, &gEfiEndOfDxeEventGroupGuid, TPL_CALLBACK, NULL },
|
||||
@@ -321,8 +321,8 @@ SMM_IPL_EVENT_NOTIFICATION mSmmIplEvents[] = {
|
||||
//
|
||||
{ FALSE, TRUE, &gEfiEventReadyToBootGuid, SmmIplReadyToLockEventNotify, &gEfiEventReadyToBootGuid, TPL_CALLBACK, NULL },
|
||||
//
|
||||
// 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
|
||||
// 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.
|
||||
//
|
||||
@@ -338,7 +338,7 @@ SMM_IPL_EVENT_NOTIFICATION mSmmIplEvents[] = {
|
||||
//
|
||||
{ FALSE, FALSE, &gEfiEventReadyToBootGuid, SmmIplGuidedEventNotify, &gEfiEventReadyToBootGuid, TPL_CALLBACK, NULL },
|
||||
//
|
||||
// Declare event notification on SetVirtualAddressMap() Event Group. This is used to convert gSmmCorePrivate
|
||||
// Declare event notification on SetVirtualAddressMap() Event Group. This is used to convert gSmmCorePrivate
|
||||
// and mSmmControl2 from physical addresses to virtual addresses.
|
||||
//
|
||||
{ FALSE, FALSE, &gEfiEventVirtualAddressChangeGuid, SmmIplSetVirtualAddressNotify, NULL, TPL_CALLBACK, NULL },
|
||||
@@ -350,7 +350,7 @@ SMM_IPL_EVENT_NOTIFICATION mSmmIplEvents[] = {
|
||||
|
||||
/**
|
||||
Find the maximum SMRAM cache range that covers the range specified by SmramRange.
|
||||
|
||||
|
||||
This function searches and joins all adjacent ranges of SmramRange into a range to be cached.
|
||||
|
||||
@param SmramRange The SMRAM range to search from.
|
||||
@@ -388,7 +388,7 @@ GetSmramCacheRange (
|
||||
}
|
||||
}
|
||||
} while (FoundAjacentRange);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -439,11 +439,11 @@ SmmBase2GetSmstLocation (
|
||||
if ((This == NULL) ||(Smst == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
if (!gSmmCorePrivate->InSmm) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
*Smst = gSmmCorePrivate->Smst;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@@ -451,10 +451,10 @@ SmmBase2GetSmstLocation (
|
||||
|
||||
/**
|
||||
Communicates with a registered handler.
|
||||
|
||||
This function provides a service to send and receive messages from a registered
|
||||
UEFI service. This function is part of the SMM Communication Protocol that may
|
||||
be called in physical mode prior to SetVirtualAddressMap() and in virtual mode
|
||||
|
||||
This function provides a service to send and receive messages from a registered
|
||||
UEFI service. This function is part of the SMM Communication Protocol that may
|
||||
be called in physical mode prior to SetVirtualAddressMap() and in virtual mode
|
||||
after SetVirtualAddressMap().
|
||||
|
||||
@param[in] This The EFI_SMM_COMMUNICATION_PROTOCOL instance.
|
||||
@@ -528,7 +528,7 @@ SmmCommunicationCommunicate (
|
||||
}
|
||||
|
||||
//
|
||||
// Return status from software SMI
|
||||
// Return status from software SMI
|
||||
//
|
||||
if (CommSize != NULL) {
|
||||
*CommSize = gSmmCorePrivate->BufferSize;
|
||||
@@ -552,7 +552,7 @@ SmmCommunicationCommunicate (
|
||||
if ((!gSmmCorePrivate->InSmm) && (!mSmmAccess->OpenState || mSmmAccess->LockState)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Save current InSmm state and set InSmm state to TRUE
|
||||
//
|
||||
@@ -564,9 +564,9 @@ SmmCommunicationCommunicate (
|
||||
//
|
||||
TempCommSize -= OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);
|
||||
Status = gSmmCorePrivate->Smst->SmiManage (
|
||||
&CommunicateHeader->HeaderGuid,
|
||||
NULL,
|
||||
CommunicateHeader->Data,
|
||||
&CommunicateHeader->HeaderGuid,
|
||||
NULL,
|
||||
CommunicateHeader->Data,
|
||||
&TempCommSize
|
||||
);
|
||||
TempCommSize += OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data);
|
||||
@@ -599,7 +599,7 @@ SmmIplGuidedEventNotify (
|
||||
UINTN Size;
|
||||
|
||||
//
|
||||
// Use Guid to initialize EFI_SMM_COMMUNICATE_HEADER structure
|
||||
// Use Guid to initialize EFI_SMM_COMMUNICATE_HEADER structure
|
||||
//
|
||||
CopyGuid (&mCommunicateHeader.HeaderGuid, (EFI_GUID *)Context);
|
||||
mCommunicateHeader.MessageLength = 1;
|
||||
@@ -664,26 +664,26 @@ SmmIplDxeDispatchEventNotify (
|
||||
//
|
||||
Size = sizeof (mCommunicateHeader);
|
||||
SmmCommunicationCommunicate (&mSmmCommunication, &mCommunicateHeader, &Size);
|
||||
|
||||
|
||||
//
|
||||
// Return if there is no request to restart the SMM Core Dispatcher
|
||||
//
|
||||
if (mCommunicateHeader.Data[0] != COMM_BUFFER_SMM_DISPATCH_RESTART) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Attempt to reset SMRAM cacheability to UC
|
||||
// Assume CPU AP is available at this time
|
||||
//
|
||||
Status = gDS->SetMemorySpaceAttributes(
|
||||
mSmramCacheBase,
|
||||
mSmramCacheBase,
|
||||
mSmramCacheSize,
|
||||
EFI_MEMORY_UC
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_WARN, "SMM IPL failed to reset SMRAM window to EFI_MEMORY_UC\n"));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Close all SMRAM ranges to protect SMRAM
|
||||
@@ -730,7 +730,7 @@ SmmIplSmmConfigurationEventNotify (
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Set flag to indicate that the SMM Entry Point has been registered which
|
||||
// Set flag to indicate that the SMM Entry Point has been registered which
|
||||
// means that SMIs are now fully operational.
|
||||
//
|
||||
gSmmCorePrivate->SmmEntryPointRegistered = TRUE;
|
||||
@@ -766,7 +766,7 @@ SmmIplReadyToLockEventNotify (
|
||||
if (mSmmLocked) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Make sure this notification is for this handler
|
||||
//
|
||||
@@ -777,7 +777,7 @@ SmmIplReadyToLockEventNotify (
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// If SMM is not locked yet and we got here from gEfiEventReadyToBootGuid being
|
||||
// If SMM is not locked yet and we got here from gEfiEventReadyToBootGuid being
|
||||
// signaled, then gEfiDxeSmmReadyToLockProtocolGuid was not installed as expected.
|
||||
// Print a warning on debug builds.
|
||||
//
|
||||
@@ -797,10 +797,10 @@ SmmIplReadyToLockEventNotify (
|
||||
// Lock the SMRAM (Note: Locking SMRAM may not be supported on all platforms)
|
||||
//
|
||||
mSmmAccess->Lock (mSmmAccess);
|
||||
|
||||
|
||||
//
|
||||
// Close protocol and event notification events that do not apply after the
|
||||
// DXE SMM Ready To Lock Protocol has been installed or the Ready To Boot
|
||||
// Close protocol and event notification events that do not apply after the
|
||||
// DXE SMM Ready To Lock Protocol has been installed or the Ready To Boot
|
||||
// event has been signalled.
|
||||
//
|
||||
for (Index = 0; mSmmIplEvents[Index].NotifyFunction != NULL; Index++) {
|
||||
@@ -818,7 +818,7 @@ SmmIplReadyToLockEventNotify (
|
||||
// Print debug message that the SMRAM window is now locked.
|
||||
//
|
||||
DEBUG ((DEBUG_INFO, "SMM IPL locked SMRAM window\n"));
|
||||
|
||||
|
||||
//
|
||||
// Set flag so this operation will not be performed again
|
||||
//
|
||||
@@ -874,7 +874,7 @@ GetPeCoffImageFixLoadingAssignedAddress(
|
||||
// Build tool will calculate the smm code size and then patch the PcdLoadFixAddressSmmCodePageNumber
|
||||
//
|
||||
SmmCodeSize = EFI_PAGES_TO_SIZE (PcdGet32(PcdLoadFixAddressSmmCodePageNumber));
|
||||
|
||||
|
||||
FixLoadingAddress = 0;
|
||||
Status = EFI_NOT_FOUND;
|
||||
SmramBase = mLMFAConfigurationTable->SmramBase;
|
||||
@@ -905,9 +905,9 @@ GetPeCoffImageFixLoadingAssignedAddress(
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
Status = EFI_NOT_FOUND;
|
||||
|
||||
|
||||
if ((SectionHeader.Characteristics & EFI_IMAGE_SCN_CNT_CODE) == 0) {
|
||||
//
|
||||
// Build tool saves the offset to SMRAM base as image base in PointerToRelocations & PointerToLineNumbers fields in the
|
||||
@@ -941,7 +941,7 @@ GetPeCoffImageFixLoadingAssignedAddress(
|
||||
/**
|
||||
Load the SMM Core image into SMRAM and executes the SMM Core from SMRAM.
|
||||
|
||||
@param[in, out] SmramRange Descriptor for the range of SMRAM to reload the
|
||||
@param[in, out] SmramRange Descriptor for the range of SMRAM to reload the
|
||||
currently executing image, the rang of SMRAM to
|
||||
hold SMM Core will be excluded.
|
||||
@param[in, out] SmramRangeSmmCore Descriptor for the range of SMRAM to hold SMM Core.
|
||||
@@ -967,19 +967,19 @@ ExecuteSmmCoreFromSmram (
|
||||
|
||||
//
|
||||
// Search all Firmware Volumes for a PE/COFF image in a file of type SMM_CORE
|
||||
//
|
||||
//
|
||||
Status = GetSectionFromAnyFvByFileType (
|
||||
EFI_FV_FILETYPE_SMM_CORE,
|
||||
EFI_FV_FILETYPE_SMM_CORE,
|
||||
0,
|
||||
EFI_SECTION_PE32,
|
||||
EFI_SECTION_PE32,
|
||||
0,
|
||||
&SourceBuffer,
|
||||
&SourceBuffer,
|
||||
&SourceSize
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Initilize ImageContext
|
||||
//
|
||||
@@ -994,7 +994,7 @@ ExecuteSmmCoreFromSmram (
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// if Loading module at Fixed Address feature is enabled, the SMM core driver will be loaded to
|
||||
// if Loading module at Fixed Address feature is enabled, the SMM core driver will be loaded to
|
||||
// the address assigned by build tool.
|
||||
//
|
||||
if (PcdGet64(PcdLoadModuleAtFixAddressEnable) != 0) {
|
||||
@@ -1014,7 +1014,7 @@ ExecuteSmmCoreFromSmram (
|
||||
} else {
|
||||
DEBUG ((EFI_D_INFO, "LOADING MODULE FIXED ERROR: Loading module at fixed address at address failed\n"));
|
||||
//
|
||||
// Allocate memory for the image being loaded from the EFI_SRAM_DESCRIPTOR
|
||||
// Allocate memory for the image being loaded from the EFI_SRAM_DESCRIPTOR
|
||||
// specified by SmramRange
|
||||
//
|
||||
PageCount = (UINTN)EFI_SIZE_TO_PAGES((UINTN)ImageContext.ImageSize + ImageContext.SectionAlignment);
|
||||
@@ -1035,7 +1035,7 @@ ExecuteSmmCoreFromSmram (
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// Allocate memory for the image being loaded from the EFI_SRAM_DESCRIPTOR
|
||||
// Allocate memory for the image being loaded from the EFI_SRAM_DESCRIPTOR
|
||||
// specified by SmramRange
|
||||
//
|
||||
PageCount = (UINTN)EFI_SIZE_TO_PAGES((UINTN)ImageContext.ImageSize + ImageContext.SectionAlignment);
|
||||
@@ -1054,7 +1054,7 @@ ExecuteSmmCoreFromSmram (
|
||||
//
|
||||
ImageContext.ImageAddress = SmramRangeSmmCore->CpuStart;
|
||||
}
|
||||
|
||||
|
||||
ImageContext.ImageAddress += ImageContext.SectionAlignment - 1;
|
||||
ImageContext.ImageAddress &= ~((EFI_PHYSICAL_ADDRESS)ImageContext.SectionAlignment - 1);
|
||||
|
||||
@@ -1532,10 +1532,10 @@ GetFullSmramRanges (
|
||||
/**
|
||||
The Entry Point for SMM IPL
|
||||
|
||||
Load SMM Core into SMRAM, register SMM Core entry point for SMIs, install
|
||||
SMM Base 2 Protocol and SMM Communication Protocol, and register for the
|
||||
Load SMM Core into SMRAM, register SMM Core entry point for SMIs, install
|
||||
SMM Base 2 Protocol and SMM Communication Protocol, and register for the
|
||||
critical events required to coordinate between DXE and SMM environments.
|
||||
|
||||
|
||||
@param ImageHandle The firmware allocated handle for the EFI image.
|
||||
@param SystemTable A pointer to the EFI System Table.
|
||||
|
||||
@@ -1561,8 +1561,8 @@ SmmIplEntry (
|
||||
EFI_GCD_MEMORY_SPACE_DESCRIPTOR MemDesc;
|
||||
|
||||
//
|
||||
// Fill in the image handle of the SMM IPL so the SMM Core can use this as the
|
||||
// ParentImageHandle field of the Load Image Protocol for all SMM Drivers loaded
|
||||
// Fill in the image handle of the SMM IPL so the SMM Core can use this as the
|
||||
// ParentImageHandle field of the Load Image Protocol for all SMM Drivers loaded
|
||||
// by the SMM Core
|
||||
//
|
||||
mSmmCorePrivateData.SmmIplImageHandle = ImageHandle;
|
||||
@@ -1591,7 +1591,7 @@ SmmIplEntry (
|
||||
// Print debug message that the SMRAM window is now open.
|
||||
//
|
||||
DEBUG ((DEBUG_INFO, "SMM IPL opened SMRAM window\n"));
|
||||
|
||||
|
||||
//
|
||||
// Find the largest SMRAM range between 1MB and 4GB that is at least 256KB - 4K in size
|
||||
//
|
||||
@@ -1618,8 +1618,8 @@ SmmIplEntry (
|
||||
//
|
||||
// Print debug message showing SMRAM window that will be used by SMM IPL and SMM Core
|
||||
//
|
||||
DEBUG ((DEBUG_INFO, "SMM IPL found SMRAM window %p - %p\n",
|
||||
(VOID *)(UINTN)mCurrentSmramRange->CpuStart,
|
||||
DEBUG ((DEBUG_INFO, "SMM IPL found SMRAM window %p - %p\n",
|
||||
(VOID *)(UINTN)mCurrentSmramRange->CpuStart,
|
||||
(VOID *)(UINTN)(mCurrentSmramRange->CpuStart + mCurrentSmramRange->PhysicalSize - 1)
|
||||
));
|
||||
|
||||
@@ -1728,13 +1728,13 @@ SmmIplEntry (
|
||||
//
|
||||
if (CpuArch != NULL) {
|
||||
SetAttrStatus = gDS->SetMemorySpaceAttributes(
|
||||
mSmramCacheBase,
|
||||
mSmramCacheBase,
|
||||
mSmramCacheSize,
|
||||
EFI_MEMORY_UC
|
||||
);
|
||||
if (EFI_ERROR (SetAttrStatus)) {
|
||||
DEBUG ((DEBUG_WARN, "SMM IPL failed to reset SMRAM window to EFI_MEMORY_UC\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1745,7 +1745,7 @@ SmmIplEntry (
|
||||
}
|
||||
|
||||
//
|
||||
// If the SMM Core could not be loaded then close SMRAM window, free allocated
|
||||
// If the SMM Core could not be loaded then close SMRAM window, free allocated
|
||||
// resources, and return an error so SMM IPL will be unloaded.
|
||||
//
|
||||
if (mCurrentSmramRange == NULL || EFI_ERROR (Status)) {
|
||||
@@ -1767,7 +1767,7 @@ SmmIplEntry (
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Install SMM Base2 Protocol and SMM Communication Protocol
|
||||
//
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# This module provide an SMM CIS compliant implementation of SMM IPL.
|
||||
#
|
||||
# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2009 - 2018, 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
|
||||
@@ -35,13 +35,13 @@
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
|
||||
[LibraryClasses]
|
||||
UefiDriverEntryPoint
|
||||
BaseLib
|
||||
BaseMemoryLib
|
||||
PeCoffLib
|
||||
CacheMaintenanceLib
|
||||
CacheMaintenanceLib
|
||||
MemoryAllocationLib
|
||||
DebugLib
|
||||
UefiBootServicesTableLib
|
||||
@@ -51,7 +51,7 @@
|
||||
DxeServicesLib
|
||||
PcdLib
|
||||
ReportStatusCodeLib
|
||||
|
||||
|
||||
[Protocols]
|
||||
gEfiSmmBase2ProtocolGuid ## PRODUCES
|
||||
gEfiSmmCommunicationProtocolGuid ## PRODUCES
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// /** @file
|
||||
// PiSmmIpl Localized Strings and Content
|
||||
//
|
||||
// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
// Copyright (c) 2013 - 2018, 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
|
||||
@@ -12,8 +12,8 @@
|
||||
//
|
||||
// **/
|
||||
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
"Core SMM Services Initial Program Loader"
|
||||
|
||||
|
||||
|
@@ -1,14 +1,14 @@
|
||||
/** @file
|
||||
SMM Memory pool management functions.
|
||||
|
||||
Copyright (c) 2009 - 2017, 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
|
||||
Copyright (c) 2009 - 2018, 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.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
LIST_ENTRY mSmmPoolLists[SmmPoolTypeMax][MAX_POOL_INDEX];
|
||||
//
|
||||
// To cache the SMRAM base since when Loading modules At fixed address feature is enabled,
|
||||
// To cache the SMRAM base since when Loading modules At fixed address feature is enabled,
|
||||
// all module is assigned an offset relative the SMRAM base in build time.
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_PHYSICAL_ADDRESS gLoadModuleAtFixAddressSmramBase = 0;
|
||||
|
@@ -2,13 +2,13 @@
|
||||
SMI management.
|
||||
|
||||
Copyright (c) 2009 - 2018, 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
|
||||
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.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@@ -113,7 +113,7 @@ SmiManage (
|
||||
SMI_HANDLER *SmiHandler;
|
||||
BOOLEAN SuccessReturn;
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
||||
Status = EFI_NOT_FOUND;
|
||||
SuccessReturn = FALSE;
|
||||
if (HandlerType == NULL) {
|
||||
@@ -171,7 +171,7 @@ SmiManage (
|
||||
case EFI_WARN_INTERRUPT_SOURCE_QUIESCED:
|
||||
//
|
||||
// If at least one of the handlers returns EFI_WARN_INTERRUPT_SOURCE_QUIESCED
|
||||
// then the function will return EFI_SUCCESS.
|
||||
// then the function will return EFI_SUCCESS.
|
||||
//
|
||||
SuccessReturn = TRUE;
|
||||
break;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Support routines for SMRAM profile.
|
||||
|
||||
Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2014 - 2018, 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
|
||||
@@ -99,10 +99,10 @@ DumpSmramInfo (
|
||||
@param[in, out] ProfileSize On entry, points to the size in bytes of the ProfileBuffer.
|
||||
On return, points to the size of the data returned in ProfileBuffer.
|
||||
@param[out] ProfileBuffer Profile buffer.
|
||||
|
||||
|
||||
@return EFI_SUCCESS Get the memory profile data successfully.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported.
|
||||
@return EFI_BUFFER_TO_SMALL The ProfileSize is too small for the resulting data.
|
||||
@return EFI_BUFFER_TO_SMALL The ProfileSize is too small for the resulting data.
|
||||
ProfileSize is updated with the size required.
|
||||
|
||||
**/
|
||||
@@ -594,7 +594,7 @@ NeedRecordThisDriver (
|
||||
//
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Record FilePath without end node.
|
||||
//
|
||||
@@ -1913,10 +1913,10 @@ Done:
|
||||
@param[in, out] ProfileSize On entry, points to the size in bytes of the ProfileBuffer.
|
||||
On return, points to the size of the data returned in ProfileBuffer.
|
||||
@param[out] ProfileBuffer Profile buffer.
|
||||
|
||||
|
||||
@return EFI_SUCCESS Get the memory profile data successfully.
|
||||
@return EFI_UNSUPPORTED Memory profile is unsupported.
|
||||
@return EFI_BUFFER_TO_SMALL The ProfileSize is too small for the resulting data.
|
||||
@return EFI_BUFFER_TO_SMALL The ProfileSize is too small for the resulting data.
|
||||
ProfileSize is updated with the size required.
|
||||
|
||||
**/
|
||||
@@ -1986,7 +1986,7 @@ SmramProfileProtocolRegisterImage (
|
||||
EFI_SMM_DRIVER_ENTRY DriverEntry;
|
||||
VOID *EntryPointInImage;
|
||||
EFI_GUID *Name;
|
||||
|
||||
|
||||
ZeroMem (&DriverEntry, sizeof (DriverEntry));
|
||||
Name = GetFileNameFromFilePath (FilePath);
|
||||
if (Name != NULL) {
|
||||
|
Reference in New Issue
Block a user