/** @file\r
Support routines for SMRAM profile.\r
\r
- Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
MEMORY_PROFILE_ALLOC_INFO_DATA *AllocInfoData;\r
EFI_MEMORY_TYPE ProfileMemoryIndex;\r
\r
+ AllocInfoData = NULL;\r
+\r
ContextData = GetSmramProfileContext ();\r
if (ContextData == NULL) {\r
return FALSE;\r
\r
////////////////////\r
\r
-/**\r
- This function check if the address is in SMRAM.\r
-\r
- @param Buffer the buffer address to be checked.\r
- @param Length the buffer length to be checked.\r
-\r
- @retval TRUE this address is in SMRAM.\r
- @retval FALSE this address is NOT in SMRAM.\r
-\r
-**/\r
-BOOLEAN\r
-InternalIsAddressInSmram (\r
- IN PHYSICAL_ADDRESS Buffer,\r
- IN UINT64 Length\r
- )\r
-{\r
- UINTN Index;\r
-\r
- for (Index = 0; Index < mFullSmramRangeCount; Index ++) {\r
- if (((Buffer >= mFullSmramRanges[Index].CpuStart) && (Buffer < mFullSmramRanges[Index].CpuStart + mFullSmramRanges[Index].PhysicalSize)) ||\r
- ((mFullSmramRanges[Index].CpuStart >= Buffer) && (mFullSmramRanges[Index].CpuStart < Buffer + Length))) {\r
- return TRUE;\r
- }\r
- }\r
-\r
- return FALSE;\r
-}\r
-\r
-/**\r
- This function check if the address refered by Buffer and Length is valid.\r
-\r
- @param Buffer the buffer address to be checked.\r
- @param Length the buffer length to be checked.\r
-\r
- @retval TRUE this address is valid.\r
- @retval FALSE this address is NOT valid.\r
-**/\r
-BOOLEAN\r
-InternalIsAddressValid (\r
- IN UINTN Buffer,\r
- IN UINTN Length\r
- )\r
-{\r
- if (Buffer > (MAX_ADDRESS - Length)) {\r
- //\r
- // Overflow happen\r
- //\r
- return FALSE;\r
- }\r
- if (InternalIsAddressInSmram ((PHYSICAL_ADDRESS) Buffer, (UINT64)Length)) {\r
- return FALSE;\r
- }\r
- return TRUE;\r
-}\r
-\r
/**\r
Get SMRAM profile data size.\r
\r
//\r
// Sanity check\r
//\r
- if (!InternalIsAddressValid ((UINTN) SmramProfileGetData.ProfileBuffer, (UINTN) ProfileSize)) {\r
+ if (!SmmIsBufferOutsideSmmValid ((UINTN) SmramProfileGetData.ProfileBuffer, (UINTN) ProfileSize)) {\r
DEBUG ((EFI_D_ERROR, "SmramProfileHandlerGetData: SMM ProfileBuffer in SMRAM or overflow!\n"));\r
SmramProfileParameterGetData->ProfileSize = ProfileSize;\r
SmramProfileParameterGetData->Header.ReturnStatus = (UINT64) (INT64) (INTN) EFI_ACCESS_DENIED;\r
return EFI_SUCCESS;\r
}\r
\r
- if (mSmramReadyToLock && !InternalIsAddressValid ((UINTN)CommBuffer, TempCommBufferSize)) {\r
+ if (mSmramReadyToLock && !SmmIsBufferOutsideSmmValid ((UINTN)CommBuffer, TempCommBufferSize)) {\r
DEBUG ((EFI_D_ERROR, "SmramProfileHandler: SMM communication buffer in SMRAM or overflow!\n"));\r
return EFI_SUCCESS;\r
}\r
L"EfiMemoryMappedIO",\r
L"EfiMemoryMappedIOPortSpace",\r
L"EfiPalCode",\r
+ L"EfiPersistentMemory",\r
L"EfiOSReserved",\r
};\r
\r