From 24930b5609f7de283b7b8ec16c0de3d54aa211de Mon Sep 17 00:00:00 2001 From: Jeff Fan Date: Wed, 2 Dec 2015 00:42:09 +0000 Subject: [PATCH] UefiCpuPkg/CpuMpPei: Exchange whole CPU data in SortApicId() Current implementation only exchanges the APIC ID and BIST, this updating is to exchange all CPU data. Cc: Feng Tian Cc: Michael Kinney Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan Reviewed-by: Feng Tian git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19085 6f19259b-4bc3-4df7-8a09-765794883524 --- UefiCpuPkg/CpuMpPei/CpuMpPei.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.c b/UefiCpuPkg/CpuMpPei/CpuMpPei.c index c222522203..ae071ac1f8 100644 --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.c +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.c @@ -61,7 +61,7 @@ SortApicId ( UINTN Index2; UINTN Index3; UINT32 ApicId; - EFI_HEALTH_FLAGS Health; + PEI_CPU_DATA CpuData; UINT32 ApCount; ApCount = PeiCpuMpData->CpuCount - 1; @@ -80,11 +80,13 @@ SortApicId ( } } if (Index3 != Index1) { - PeiCpuMpData->CpuData[Index3].ApicId = PeiCpuMpData->CpuData[Index1].ApicId; - PeiCpuMpData->CpuData[Index1].ApicId = ApicId; - Health = PeiCpuMpData->CpuData[Index3].Health; - PeiCpuMpData->CpuData[Index3].Health = PeiCpuMpData->CpuData[Index1].Health; - PeiCpuMpData->CpuData[Index1].Health = Health; + CopyMem (&CpuData, &PeiCpuMpData->CpuData[Index3], sizeof (PEI_CPU_DATA)); + CopyMem ( + &PeiCpuMpData->CpuData[Index3], + &PeiCpuMpData->CpuData[Index1], + sizeof (PEI_CPU_DATA) + ); + CopyMem (&PeiCpuMpData->CpuData[Index1], &CpuData, sizeof (PEI_CPU_DATA)); } }