oemcommand: Issue with set fan control config cmd
Issue: Set fan control configuration command (89h) did not have last few
optional bytes i.e. DIMM Group Id (CPU Num) and DIMM presence bit-map
so it was giving error "Request data lenght invalid //0xC7"
while passing these parameters
Fix: Added these bytes as optional and added checks for CPU Presence.
Tested:
ipmitool raw 0x30 0x89 0x07 0xc0 0x00 0x00 0x00 0x00 0x00 //Success
ipmitool raw 0x30 0x89 0x07 0xc0 //Success
ipmitool raw 0x30 0x89 0x07 0xc0 0x01 ////0xCC - CPU_2 is not present
Unable to send RAW command (channel=0x0 netfn=0x30 lun=0x0 cmd=0x8a
rsp=0xcc): Invalid data field in request
Signed-off-by: Joshi-Mansi <mansi.joshi@linux.intel.com>
Change-Id: I0b8d27e4ad5ba2c54a1074054ca1da8587f0295e
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index e531a8c..f7d1c6d 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -1474,12 +1474,27 @@
uint2_t reserved1, bool performanceMode,
uint3_t reserved2, bool setPerformanceMode,
- bool setFanProfile)
+ bool setFanProfile,
+ std::optional<uint8_t> dimmGroupId,
+ std::optional<uint32_t> dimmPresenceBitmap)
{
if (reserved1 || reserved2)
{
return ipmi::responseInvalidFieldRequest();
}
+
+ if (dimmGroupId)
+ {
+ if (*dimmGroupId >= maxCPUNum)
+ {
+ return ipmi::responseInvalidFieldRequest();
+ }
+ if (!cpuPresent("CPU_" + std::to_string(*dimmGroupId + 1)))
+ {
+ return ipmi::responseInvalidFieldRequest();
+ }
+ }
+
// todo: tell bios to only send first 2 bytes
boost::container::flat_map<
std::string, std::variant<std::vector<std::string>, std::string>>