X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FSmmMemLib%2FSmmMemLib.c;h=8c78a0b426f2fd5a0effa7cb6d26002945a583d1;hp=db55a1a6c15063cdd42c0290e50d95f3f3ac9828;hb=9095d37b8fe5bfc3d02adad6ba7fd7359ebc0107;hpb=d1102dba7210b95e41d06c2338a22ba6af248645 diff --git a/MdePkg/Library/SmmMemLib/SmmMemLib.c b/MdePkg/Library/SmmMemLib/SmmMemLib.c index db55a1a6c1..8c78a0b426 100644 --- a/MdePkg/Library/SmmMemLib/SmmMemLib.c +++ b/MdePkg/Library/SmmMemLib/SmmMemLib.c @@ -6,7 +6,7 @@ all SMRAM range via SMM_ACCESS2_PROTOCOL, including the range for firmware (like SMM Core and SMM driver) and/or specific dedicated hardware. - Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
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 @@ -86,9 +86,9 @@ SmmMemLibInternalCalculateMaximumSupportAddress ( if (PhysicalAddressBits > 48) { PhysicalAddressBits = 48; } - + // - // Save the maximum support address in one global variable + // Save the maximum support address in one global variable // mSmmMemLibInternalMaximumSupportAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)(LShiftU64 (1, PhysicalAddressBits) - 1); DEBUG ((EFI_D_INFO, "mSmmMemLibInternalMaximumSupportAddress = 0x%lx\n", mSmmMemLibInternalMaximumSupportAddress)); @@ -111,7 +111,7 @@ SmmIsBufferOutsideSmmValid ( ) { UINTN Index; - + // // Check override. // NOTE: (B:0->L:4G) is invalid for IA32, but (B:1->L:4G-1)/(B:4G-1->L:1) is valid. @@ -131,7 +131,7 @@ SmmIsBufferOutsideSmmValid ( )); return FALSE; } - + for (Index = 0; Index < mSmmMemLibInternalSmramCount; Index ++) { if (((Buffer >= mSmmMemLibInternalSmramRanges[Index].CpuStart) && (Buffer < mSmmMemLibInternalSmramRanges[Index].CpuStart + mSmmMemLibInternalSmramRanges[Index].PhysicalSize)) || ((mSmmMemLibInternalSmramRanges[Index].CpuStart >= Buffer) && (mSmmMemLibInternalSmramRanges[Index].CpuStart < Buffer + Length))) { @@ -157,7 +157,7 @@ SmmIsBufferOutsideSmmValid ( if (mSmmReadyToLock) { EFI_MEMORY_DESCRIPTOR *MemoryMap; BOOLEAN InValidCommunicationRegion; - + InValidCommunicationRegion = FALSE; MemoryMap = mMemoryMap; for (Index = 0; Index < mMemoryMapEntryCount; Index++) { @@ -222,7 +222,7 @@ SmmCopyMemToSmram ( If the check passes, it copies memory and returns EFI_SUCCESS. If the check fails, it returns EFI_SECURITY_VIOLATION. The implementation must be reentrant. - + @param DestinationBuffer The pointer to the destination buffer of the memory copy. @param SourceBuffer The pointer to the source buffer of the memory copy. @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. @@ -255,7 +255,7 @@ SmmCopyMemFromSmram ( If the check passes, it copies memory and returns EFI_SUCCESS. If the check fails, it returns EFI_SECURITY_VIOLATION. The implementation must be reentrant, and it must handle the case where source buffer overlaps destination buffer. - + @param DestinationBuffer The pointer to the destination buffer of the memory copy. @param SourceBuffer The pointer to the source buffer of the memory copy. @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer. @@ -292,11 +292,11 @@ SmmCopyMem ( It checks if target buffer is valid per processor architecture and not overlap with SMRAM. If the check passes, it fills memory and returns EFI_SUCCESS. If the check fails, it returns EFI_SECURITY_VIOLATION. - + @param Buffer The memory to set. @param Length The number of bytes to set. @param Value The value with which to fill Length bytes of Buffer. - + @retval EFI_SECURITY_VIOLATION The Buffer is invalid per processor architecture or overlap with SMRAM. @retval EFI_SUCCESS Memory is set. @@ -359,7 +359,7 @@ SmmLibInternalEndOfDxeNotify ( do { Status = gBS->AllocatePool (EfiBootServicesData, MemoryMapSize, (VOID **)&MemoryMap); ASSERT (MemoryMap != NULL); - + Status = gBS->GetMemoryMap ( &MemoryMapSize, MemoryMap, @@ -391,7 +391,7 @@ SmmLibInternalEndOfDxeNotify ( MemoryMap = NEXT_MEMORY_DESCRIPTOR(MemoryMap, DescriptorSize); } MemoryMap = MemoryMapStart; - + // // Get Data // @@ -412,7 +412,7 @@ SmmLibInternalEndOfDxeNotify ( } mMemoryMap = SmmMemoryMapStart; MemoryMap = MemoryMapStart; - + gBS->FreePool (MemoryMap); return EFI_SUCCESS; @@ -458,7 +458,7 @@ SmmMemLibConstructor ( EFI_STATUS Status; EFI_SMM_ACCESS2_PROTOCOL *SmmAccess; UINTN Size; - + // // Get SMRAM information //