From 43d5fc5177e3e4c09da51ec1fc6742cc6296623e Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 1 Oct 2020 09:35:07 -0400 Subject: [PATCH] Support SMMv2 variation SMMv2 is coming and it tweaks some commands to an extent. Recognize and adapt to the SMM2 variations on the SMM. Change-Id: I27932158e13fdc1eef302b73f1a931394575eb5a --- pyghmi/ipmi/oem/lenovo/handler.py | 8 +++++- pyghmi/ipmi/oem/lenovo/nextscale.py | 40 ++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/handler.py b/pyghmi/ipmi/oem/lenovo/handler.py index eebe0950..8589238b 100755 --- a/pyghmi/ipmi/oem/lenovo/handler.py +++ b/pyghmi/ipmi/oem/lenovo/handler.py @@ -351,12 +351,18 @@ class OEMHandler(generic.OEMHandler): return self._fpc_variant fpc_ids = ((19046, 32, 1063), (20301, 32, 462)) smm_id = (19046, 32, 1180) + smmv2_2u = (19046, 32, 1360) + smmv2_6u = (19046, 32, 1387) currid = (self.oemid['manufacturer_id'], self.oemid['device_id'], self.oemid['product_id']) if currid in fpc_ids: self._fpc_variant = 6 elif currid == smm_id: self._fpc_variant = 2 + elif currid == smmv2_2u: + self._fpc_variant = 0x22 + elif currid == smmv2_6u: + self._fpc_variant = 0x26 return self._fpc_variant @property @@ -577,7 +583,7 @@ class OEMHandler(generic.OEMHandler): if self.has_xcc and name and name.startswith('PSU '): self.immhandler.augment_psu_info(fru, name) return fru - elif self.is_fpc == 2: # SMM variant + elif self.is_fpc != 6: # SMM variant fru['oem_parser'] = 'lenovo' return self.smmhandler.process_fru(fru) else: diff --git a/pyghmi/ipmi/oem/lenovo/nextscale.py b/pyghmi/ipmi/oem/lenovo/nextscale.py index ba221eaf..3160998d 100644 --- a/pyghmi/ipmi/oem/lenovo/nextscale.py +++ b/pyghmi/ipmi/oem/lenovo/nextscale.py @@ -76,8 +76,11 @@ def fpc_read_fan_power(ipmicmd): def fpc_read_psu_fan(ipmicmd, number, sz): rsp = ipmicmd.xraw_command(netfn=0x32, command=0xa5, data=(number,)) - rsp = rsp['data'] - return struct.unpack_from(' 5: + return struct.unpack_from('> 5: + name = 'SMM2' + else: + name = 'SMM' buildid = '{0}{1}{2}{3}{4}{5}{6}'.format( *[chr(x) for x in builddata[-7:]]) elif len(builddata) == 8: @@ -233,7 +250,12 @@ def get_fpc_firmware(bmcver, ipmicmd, fpcorsmm): bmcmajor, bmcminor = [int(x) for x in bmcver.split('.')] bmcver = '{0}.{1:02d}'.format(bmcmajor, bmcminor) yield (name, {'version': bmcver, 'build': buildid}) - yield ('PSOC', {'version': '{0}.{1}'.format(builddata[2], builddata[3])}) + if fpcorsmm == 6: + yield ('PSOC', {'version': '{0}.{1}'.format(builddata[2], + builddata[3])}) + else: + yield ('PSOC', {'version': '{0}.{1}'.format(builddata[3], + builddata[4])}) def get_sensor_reading(name, ipmicmd, sz):