From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1EB3C1A1E4D for ; Fri, 9 Sep 2016 01:00:11 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP; 09 Sep 2016 01:00:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,304,1470726000"; d="scan'208";a="6363221" Received: from jfan12-desk.ccr.corp.intel.com ([10.239.9.5]) by fmsmga006.fm.intel.com with ESMTP; 09 Sep 2016 01:00:09 -0700 From: Jeff Fan To: edk2-devel@lists.01.org Cc: Michael Kinney , Feng Tian , Giri P Mudusuru Date: Fri, 9 Sep 2016 15:59:27 +0800 Message-Id: <20160909075933.14320-2-jeff.fan@intel.com> X-Mailer: git-send-email 2.9.3.windows.2 In-Reply-To: <20160909075933.14320-1-jeff.fan@intel.com> References: <20160909075933.14320-1-jeff.fan@intel.com> Subject: [Patch 1/7] UefiCpuPkg/CpuDxe: Fix duplicated status code report X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2016 08:00:11 -0000 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 --- UefiCpuPkg/CpuDxe/CpuMp.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c index a619a2b..3e4f83f 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) + ); + } } } -- 2.9.3.windows.2