public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jeff Fan <jeff.fan@intel.com>
To: edk2-devel@lists.01.org
Cc: Michael Kinney <michael.d.kinney@intel.com>,
	Feng Tian <feng.tian@intel.com>,
	Giri P Mudusuru <giri.p.mudusuru@intel.com>
Subject: [Patch 1/7] UefiCpuPkg/CpuDxe: Fix duplicated status code report
Date: Fri,  9 Sep 2016 15:59:27 +0800	[thread overview]
Message-ID: <20160909075933.14320-2-jeff.fan@intel.com> (raw)
In-Reply-To: <20160909075933.14320-1-jeff.fan@intel.com>

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 <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
---
 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



  reply	other threads:[~2016-09-09  8:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09  7:59 [Patch 0/7] Re-install SEC Platform Information PPI Jeff Fan
2016-09-09  7:59 ` Jeff Fan [this message]
2016-09-09  7:59 ` [Patch 2/7] UefiCpuPkg/CpuMpPei: Add parameter BistInformationSize Jeff Fan
2016-09-09  7:59 ` [Patch 3/7] UefiCpuPkg/CpuMpPei: Fix BistData ouput error Jeff Fan
2016-09-09  7:59 ` [Patch 4/7] UefiCpuPkg/CpuMpPei: Build GUIDed-HOB to store all CPU BIST Data Jeff Fan
2016-09-09  7:59 ` [Patch 5/7] UefiCpuPkg/SecCore: Add SecBist.c Jeff Fan
2016-09-09  7:59 ` [Patch 6/7] UefiCpuPkg/SecCore: Abstract worker function GetBistFromHob() Jeff Fan
2016-09-09  7:59 ` [Patch 7/7] UefiCpuPkg/SecCore: Re-install SEC platform information(2) PPI Jeff Fan
2016-09-13  7:41 ` [Patch 0/7] Re-install SEC Platform Information PPI Tian, Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160909075933.14320-2-jeff.fan@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox