From 1757bcaca7171f5bb9e9fda35e806db73cbb99d7 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 15 Mar 2023 08:58:45 -0400 Subject: [PATCH] Fix for newer SMMv2 firmware Power policy command has changed. Settings are now relegated to the last two bytes, with status for the first two. Change-Id: I6505d99fef357d7e2023b7393ad9ef8920b620c7 --- pyghmi/ipmi/oem/lenovo/handler.py | 2 +- pyghmi/ipmi/oem/lenovo/nextscale.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/handler.py b/pyghmi/ipmi/oem/lenovo/handler.py index 8b558f3b..803879aa 100755 --- a/pyghmi/ipmi/oem/lenovo/handler.py +++ b/pyghmi/ipmi/oem/lenovo/handler.py @@ -1202,7 +1202,7 @@ class OEMHandler(generic.OEMHandler): if self.has_xcc: return self.immhandler.get_bmc_configuration() if self.is_fpc: - return self.smmhandler.get_bmc_configuration() + return self.smmhandler.get_bmc_configuration(self._fpc_variant) if self.has_tsma: return self.tsmahandler.get_bmc_configuration() return super(OEMHandler, self).get_bmc_configuration() diff --git a/pyghmi/ipmi/oem/lenovo/nextscale.py b/pyghmi/ipmi/oem/lenovo/nextscale.py index 1c78a447..9bcfba52 100644 --- a/pyghmi/ipmi/oem/lenovo/nextscale.py +++ b/pyghmi/ipmi/oem/lenovo/nextscale.py @@ -415,7 +415,7 @@ class SMMClient(object): 5: 'Boosted', } - def get_bmc_configuration(self): + def get_bmc_configuration(self, variant): settings = {} wc = self.wc wc.request( @@ -453,7 +453,10 @@ class SMMClient(object): powercfg = self.ipmicmd.xraw_command(0x32, 0xa2) powercfg = bytearray(powercfg['data']) if len(powercfg) == 5: - powercfg = powercfg[1:] + if variant and variant >> 5: + powercfg = powercfg[-2:] + else: + powercfg = powercfg[1:] val = powercfg[0] if val == 2: val = 'N+N' @@ -700,6 +703,8 @@ class SMMClient(object): if None in powercfg: currcfg = self.ipmicmd.xraw_command(0x32, 0xa2) currcfg = bytearray(currcfg['data']) + if variant and variant >> 5 and len(currcfg) == 5: + currcfg = currcfg[-2:] if powercfg[0] is None: powercfg[0] = currcfg[0] if powercfg[1] is None: