summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-host/0069-apphandler-Fix-for-get-system-info-command.patch
blob: 1d6410a6d1813d4bce7e5683b60774f0c3eb8bfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
From a5ae77282bdd60172f7ef1baca117069b8809bb5 Mon Sep 17 00:00:00 2001
From: Snehalatha V <SnehalathaX.V@intel.com>
Date: Sat, 2 May 2020 18:18:57 +0000
Subject: [PATCH] apphandler: Fix for get system info command

Issue: Get system info parameters command giving improper default
       results for parameters 1,3,4,5,6,7.

Fix: Provided fix to return proper default response

Tested:
Verified using ipmitool raw commands
Command : ipmitool raw 0x06 0x59 0x00 0x01 0x00 0x00
Response: Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0
          cmd=0x59 rsp=0xcb): Requested sensor, data, or record not
          found
Command : ipmitool raw 0x06 0x59 0x00 0x02 0x00 0x00
Response: 11 00 00 0a 69 6e 74 65 6c 2d 6f 62 6d 63 00 00
          00 00
Command : ipmitool raw 0x06 0x59 0x00 0x03 0x00 0x00
Response: Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0
          cmd=0x59 rsp=0xcb): Requested sensor, data, or record not
          found
Command : ipmitool raw 0x06 0x59 0x00 0x07 0x00 0x00
Response: Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0
          cmd=0x59 rsp=0xcb): Requested sensor, data, or record not
          found
Command : ipmitool raw 0x06 0x59 0x00 0x08 0x00 0x00
Response: Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0
          cmd=0x59 rsp=0xcc): Invalid data field in request
Command : ipmitool raw 0x06 0x59 0x00 0x3f 0x00 0x00
Response: Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0
          cmd=0x59 rsp=0xcc): Invalid data field in request

Signed-off-by: Snehalatha V <SnehalathaX.V@intel.com>
Change-Id: I2a98b91bad199dc4eeac68b68972c3355cb5ec2f
---
 apphandler.cpp | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/apphandler.cpp b/apphandler.cpp
index 4ba637f..90818a9 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -1289,10 +1289,15 @@ ipmi::RspType<uint8_t,                // Parameter revision
                          uint8_t paramSelector, uint8_t setSelector,
                          uint8_t BlockSelector)
 {
-    if (reserved)
+    if (reserved || (paramSelector >= invalidParamSelectorStart &&
+                     paramSelector <= invalidParamSelectorEnd))
     {
         return ipmi::responseInvalidFieldRequest();
     }
+    if ((paramSelector >= oemCmdStart) && (paramSelector <= oemCmdEnd))
+    {
+        return ipmi::responseParmNotSupported();
+    }
     if (getRevision)
     {
         return ipmi::responseSuccess(paramRevision, std::nullopt, std::nullopt);
@@ -1322,7 +1327,7 @@ ipmi::RspType<uint8_t,                // Parameter revision
     bool found = std::get<0>(ret);
     if (!found)
     {
-        return ipmi::responseParmNotSupported();
+        return ipmi::responseSensorInvalid();
     }
     std::string& paramString = std::get<1>(ret);
     std::vector<uint8_t> configData;
@@ -1334,7 +1339,14 @@ ipmi::RspType<uint8_t,                // Parameter revision
         count = std::min(paramString.length(), smallChunkSize);
         configData.resize(count + configDataOverhead);
         std::copy_n(paramString.begin(), count,
-                    configData.begin() + configDataOverhead); // 14 bytes thunk
+                    configData.begin() + configDataOverhead); // 14 bytes chunk
+
+        // Append zero's to remaining bytes
+        if (configData.size() < configParameterLength)
+        {
+            std::fill_n(std::back_inserter(configData),
+                        configParameterLength - configData.size(), 0x00);
+        }
     }
     else
     {
-- 
2.17.1