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:
Liming Gao
2018-06-27 21:08:52 +08:00
parent ca79bab7af
commit d1102dba72
1010 changed files with 13588 additions and 13588 deletions

View File

@@ -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
//