mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/PeiMpLib: Fix a system hang-in-pei issue.
GetWakeupBuffer() tries to find a below-1M free memory, it checks whether the memory is allocated already in CheckOverlapWithAllocatedBuffer(). When there is a memory allocation hob (base = 0xff_00000000, size = 0x10000000), CheckOverlapWithAllocateBuffer() truncates the base to 0 which causes it always returns TRUE so GetWakeupBuffer() fails to find a below-1MB memory. The patch fixes this issue by using UINT64 type. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Eric Dong <eric.dong@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
This commit is contained in:
parent
c8e36b75b5
commit
5986cf382e
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
MP initialize support functions for PEI phase.
|
MP initialize support functions for PEI phase.
|
||||||
|
|
||||||
Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -75,15 +75,15 @@ SaveCpuMpData (
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
CheckOverlapWithAllocatedBuffer (
|
CheckOverlapWithAllocatedBuffer (
|
||||||
IN UINTN WakeupBufferStart,
|
IN UINT64 WakeupBufferStart,
|
||||||
IN UINTN WakeupBufferEnd
|
IN UINT64 WakeupBufferEnd
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_PEI_HOB_POINTERS Hob;
|
EFI_PEI_HOB_POINTERS Hob;
|
||||||
EFI_HOB_MEMORY_ALLOCATION *MemoryHob;
|
EFI_HOB_MEMORY_ALLOCATION *MemoryHob;
|
||||||
BOOLEAN Overlapped;
|
BOOLEAN Overlapped;
|
||||||
UINTN MemoryStart;
|
UINT64 MemoryStart;
|
||||||
UINTN MemoryEnd;
|
UINT64 MemoryEnd;
|
||||||
|
|
||||||
Overlapped = FALSE;
|
Overlapped = FALSE;
|
||||||
//
|
//
|
||||||
|
@ -96,9 +96,8 @@ CheckOverlapWithAllocatedBuffer (
|
||||||
while (!END_OF_HOB_LIST (Hob)) {
|
while (!END_OF_HOB_LIST (Hob)) {
|
||||||
if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION) {
|
if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION) {
|
||||||
MemoryHob = Hob.MemoryAllocation;
|
MemoryHob = Hob.MemoryAllocation;
|
||||||
MemoryStart = (UINTN) MemoryHob->AllocDescriptor.MemoryBaseAddress;
|
MemoryStart = MemoryHob->AllocDescriptor.MemoryBaseAddress;
|
||||||
MemoryEnd = (UINTN) (MemoryHob->AllocDescriptor.MemoryBaseAddress +
|
MemoryEnd = MemoryHob->AllocDescriptor.MemoryBaseAddress + MemoryHob->AllocDescriptor.MemoryLength;
|
||||||
MemoryHob->AllocDescriptor.MemoryLength);
|
|
||||||
if (!((WakeupBufferStart >= MemoryEnd) || (WakeupBufferEnd <= MemoryStart))) {
|
if (!((WakeupBufferStart >= MemoryEnd) || (WakeupBufferEnd <= MemoryStart))) {
|
||||||
Overlapped = TRUE;
|
Overlapped = TRUE;
|
||||||
break;
|
break;
|
||||||
|
@ -123,8 +122,8 @@ GetWakeupBuffer (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_PEI_HOB_POINTERS Hob;
|
EFI_PEI_HOB_POINTERS Hob;
|
||||||
UINTN WakeupBufferStart;
|
UINT64 WakeupBufferStart;
|
||||||
UINTN WakeupBufferEnd;
|
UINT64 WakeupBufferEnd;
|
||||||
|
|
||||||
WakeupBufferSize = (WakeupBufferSize + SIZE_4KB - 1) & ~(SIZE_4KB - 1);
|
WakeupBufferSize = (WakeupBufferSize + SIZE_4KB - 1) & ~(SIZE_4KB - 1);
|
||||||
|
|
||||||
|
@ -149,7 +148,7 @@ GetWakeupBuffer (
|
||||||
//
|
//
|
||||||
// Need memory under 1MB to be collected here
|
// Need memory under 1MB to be collected here
|
||||||
//
|
//
|
||||||
WakeupBufferEnd = (UINTN) (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength);
|
WakeupBufferEnd = Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength;
|
||||||
if (WakeupBufferEnd > BASE_1MB) {
|
if (WakeupBufferEnd > BASE_1MB) {
|
||||||
//
|
//
|
||||||
// Wakeup buffer should be under 1MB
|
// Wakeup buffer should be under 1MB
|
||||||
|
@ -174,7 +173,7 @@ GetWakeupBuffer (
|
||||||
}
|
}
|
||||||
DEBUG ((DEBUG_INFO, "WakeupBufferStart = %x, WakeupBufferSize = %x\n",
|
DEBUG ((DEBUG_INFO, "WakeupBufferStart = %x, WakeupBufferSize = %x\n",
|
||||||
WakeupBufferStart, WakeupBufferSize));
|
WakeupBufferStart, WakeupBufferSize));
|
||||||
return WakeupBufferStart;
|
return (UINTN)WakeupBufferStart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue