2
0
mirror of https://opendev.org/x/pyghmi synced 2026-04-01 15:53:32 +00:00

Support SMMv2 variant of VPD

The SMMv2 changed the
get VPD command to
echo back the reply bytes.

For SMMv2, discard the first
two bytes of the reply.

Change-Id: I31a3c5442cfe15bf44201b5eae594485ac0a3a90
This commit is contained in:
Jarrod Johnson
2021-04-12 17:19:42 -04:00
parent 8d5213d243
commit b4fd80d530
2 changed files with 13 additions and 8 deletions

View File

@@ -155,7 +155,7 @@ class OEMHandler(generic.OEMHandler):
elif self.has_imm:
self.immhandler = imm.IMMClient(ipmicmd)
elif self.is_fpc:
self.smmhandler = nextscale.SMMClient(ipmicmd)
self.smmhandler = nextscale.SMMClient(ipmicmd, self.is_fpc)
elif self.has_tsma:
conn = wc.SecureHTTPConnection(
ipmicmd.bmc, 443,

View File

@@ -337,7 +337,8 @@ def get_sensor_reading(name, ipmicmd, sz):
class SMMClient(object):
def __init__(self, ipmicmd):
def __init__(self, ipmicmd, variant):
self.smm_variant = variant
self.ipmicmd = weakref.proxy(ipmicmd)
self.smm = ipmicmd.bmc
self.username = ipmicmd.ipmi_session.userid
@@ -589,13 +590,17 @@ class SMMClient(object):
return savefile
def process_fru(self, fru):
smmv1 = self.smm_variant & 0xf0 == 0
# TODO(jjohnson2): can also get EIOM, SMM, and riser data if warranted
fru['Serial Number'] = bytes(self.ipmicmd.xraw_command(
netfn=0x32, command=0xb0, data=(5, 1))['data'][:]).strip(
b' \x00\xff').replace(b'\xff', b'')
fru['Model'] = bytes(self.ipmicmd.xraw_command(
netfn=0x32, command=0xb0, data=(5, 0))['data'][:]).strip(
b' \x00\xff').replace(b'\xff', b'')
snum = bytes(self.ipmicmd.xraw_command(
netfn=0x32, command=0xb0, data=(5, 1))['data'][:])
mnum = bytes(self.ipmicmd.xraw_command(
netfn=0x32, command=0xb0, data=(5, 0))['data'][:])
if not smmv1:
snum = snum[2:]
mnum = mnum[2:]
fru['Serial Number'] = snum.strip(b' \x00\xff').replace(b'\xff', b'')
fru['Model'] = mnum.strip(b' \x00\xff').replace(b'\xff', b'')
return fru
def get_webclient(self):