From 7d17ab47d1d81c8012d8095c1e17412168c1cfc9 Mon Sep 17 00:00:00 2001 From: Jeff Fan Date: Fri, 9 Sep 2016 13:39:50 +0800 Subject: UefiCpuPkg/CpuDxe: Fix duplicated status code report If CPU Bist data is not zero, we will report Status code. But there is one bug that will report each processor's status code duplicated with NumberOfData times. This fix is to exchange the loop order on NumberOfData and mNumberOfProcessors. It could make sure the report status code only once for each processor. Cc: Michael Kinney Cc: Feng Tian Cc: Giri P Mudusuru Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan Reviewed-by: Feng Tian --- UefiCpuPkg/CpuDxe/CpuMp.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'UefiCpuPkg') diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c index a619a2b0e3..3e4f83fac2 100644 --- a/UefiCpuPkg/CpuDxe/CpuMp.c +++ b/UefiCpuPkg/CpuDxe/CpuMp.c @@ -539,6 +539,7 @@ CollectBistDataFromHob ( UINTN ProcessorNumber; EFI_PROCESSOR_INFORMATION ProcessorInfo; EFI_HEALTH_FLAGS BistData; + UINTN CpuInstanceNumber; SecPlatformInformation2 = NULL; SecPlatformInformation = NULL; @@ -578,25 +579,25 @@ CollectBistDataFromHob ( } } - while ((NumberOfData--) > 0) { - for (ProcessorNumber = 0; ProcessorNumber < mNumberOfProcessors; ProcessorNumber++) { - MpInitLibGetProcessorInfo (ProcessorNumber, &ProcessorInfo, &BistData); - if (ProcessorInfo.ProcessorId == CpuInstance[NumberOfData].CpuLocation) { + for (ProcessorNumber = 0; ProcessorNumber < mNumberOfProcessors; ProcessorNumber++) { + MpInitLibGetProcessorInfo (ProcessorNumber, &ProcessorInfo, &BistData); + for (CpuInstanceNumber = 0; CpuInstanceNumber < NumberOfData; CpuInstanceNumber++) { + if (ProcessorInfo.ProcessorId == CpuInstance[CpuInstanceNumber].CpuLocation) { // // Update CPU health status for MP Services Protocol according to BIST data. // - BistData = CpuInstance[NumberOfData].InfoRecord.IA32HealthFlags; - } - if (BistData.Uint32 != 0) { - // - // Report Status Code that self test is failed - // - REPORT_STATUS_CODE ( - EFI_ERROR_CODE | EFI_ERROR_MAJOR, - (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST) - ); + BistData = CpuInstance[CpuInstanceNumber].InfoRecord.IA32HealthFlags; } } + if (BistData.Uint32 != 0) { + // + // Report Status Code that self test is failed + // + REPORT_STATUS_CODE ( + EFI_ERROR_CODE | EFI_ERROR_MAJOR, + (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST) + ); + } } } -- cgit v1.2.3