public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Mike Maslenkin" <mike.maslenkin@gmail.com>
To: devel@edk2.groups.io
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>,
	Isaac Oram <isaac.w.oram@intel.com>,
	Nate DeSimone <nathaniel.l.desimone@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>
Subject: [PATCH edk2-platforms 1/3] IpmiFeaturePkg: fix IPMI GetSelfTest command response parsing
Date: Tue, 28 Feb 2023 02:27:55 +0300	[thread overview]
Message-ID: <20230227232757.9312-2-mike.maslenkin@gmail.com> (raw)
In-Reply-To: <20230227232757.9312-1-mike.maslenkin@gmail.com>

Byte 0 of a response contains completion code for the command.
So, the examined data starts from byte 1. It's easy to make a mistake
here since specification counts response data from 1.

For the "Get Self Test Results" command Intelligent Platform Management
Interface Specification v2.0 rev 1.1 paragraph 20.4 defines response as:
+-----+---------------------------------------------------------------+
|byte | data field                                                    |
+-----+---------------------------------------------------------------+
| 1   | Completion Code                                               |
|     |                                                               |
| 2   | 55h =  No error. All Self Tests Passed.                       |
|     | 56h = Self Test function not implemented in this controller.  |
|     | 57h = Corrupted or inaccessible data or devices               |
|     | 58h = Fatal hardware error                                    |
|     |                                                               |
| 3   | For byte 2 = 55h, 56h, FFh: 00h                               |
|     | For byte 2 = 58h, all other: Device-specific                  |
|     | For byte 2 = 57h: self-test error bitfield.                   |
+-----+---------------------------------------------------------------+

Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 .../IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c               | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c
index d788b4886723..aeaefaad642e 100644
--- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c
+++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/GenericIpmi/Dxe/IpmiInit.c
@@ -161,7 +161,7 @@ Returns:
     // Check the IPMI defined self test results.
     // Additional Cases are device specific test results.
     //
-    switch (IpmiInstance->TempData[0]) {
+    switch (IpmiInstance->TempData[1]) {
       case IPMI_APP_SELFTEST_NO_ERROR:
       case IPMI_APP_SELFTEST_NOT_IMPLEMENTED:
         IpmiInstance->BmcStatus = BMC_OK;
@@ -173,7 +173,7 @@ Returns:
         // BootBlock Firmware corruption, and Operational Firmware Corruption.  All
         // other errors are BMC soft failures.
         //
-        if ((IpmiInstance->TempData[1] & (IPMI_APP_SELFTEST_FRU_CORRUPT | IPMI_APP_SELFTEST_FW_BOOTBLOCK_CORRUPT | IPMI_APP_SELFTEST_FW_CORRUPT)) != 0) {
+        if ((IpmiInstance->TempData[2] & (IPMI_APP_SELFTEST_FRU_CORRUPT | IPMI_APP_SELFTEST_FW_BOOTBLOCK_CORRUPT | IPMI_APP_SELFTEST_FW_CORRUPT)) != 0) {
           IpmiInstance->BmcStatus = BMC_HARDFAIL;
         } else {
           IpmiInstance->BmcStatus = BMC_SOFTFAIL;
@@ -181,7 +181,7 @@ Returns:
         //
         // Check if SDR repository is empty and report it if it is.
         //
-        if ((IpmiInstance->TempData[1] & IPMI_APP_SELFTEST_SDR_REPOSITORY_EMPTY) != 0) {
+        if ((IpmiInstance->TempData[2] & IPMI_APP_SELFTEST_SDR_REPOSITORY_EMPTY) != 0) {
           if (*ErrorCount < MAX_SOFT_COUNT) {
             StatusCodeValue[*ErrorCount] = EFI_COMPUTING_UNIT_FIRMWARE_PROCESSOR | CU_FP_EC_SDR_EMPTY;
             (*ErrorCount)++;
-- 
2.35.3


  reply	other threads:[~2023-02-27 23:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27 23:27 [PATCH edk2-platforms 0/3] IpmiFeaturePkg: fix IPMI GetSelfTest command response Mike Maslenkin
2023-02-27 23:27 ` Mike Maslenkin [this message]
2023-03-07 22:09   ` [PATCH edk2-platforms 1/3] IpmiFeaturePkg: fix IPMI GetSelfTest command response parsing Isaac Oram
2023-02-27 23:27 ` [PATCH edk2-platforms 2/3] IpmiFeaturePkg: remove buffer temporary buffer from BMC instance structure Mike Maslenkin
2023-03-07 22:45   ` Isaac Oram
2023-02-27 23:27 ` [PATCH edk2-platforms 3/3] IpmiFeaturePkg: refine GetSelfTest function Mike Maslenkin
2023-03-07 23:07   ` [edk2-devel] " Isaac Oram

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=20230227232757.9312-2-mike.maslenkin@gmail.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