2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-29 12:27:37 +00:00

Fix compatibility with FPC for PSU cfg

PSU configuration was SMM specific, change
to use FPC v. SMM format as needed for this
difference between the two platforms.

Change-Id: Id8f7e2597ca5e867bd0e63dccff35f1cea99a30f
This commit is contained in:
Jarrod Johnson 2020-07-27 17:38:14 -04:00
parent 997e7da2fc
commit 34a1158732

View File

@ -320,6 +320,8 @@ class SMMClient(object):
'possible': [self.fanmodes[x] for x in self.fanmodes]}
powercfg = self.ipmicmd.xraw_command(0x32, 0xa2)
powercfg = bytearray(powercfg['data'])
if len(powercfg) == 5:
powercfg = powercfg[1:]
val = powercfg[0]
if val == 2:
val = 'N+N'
@ -382,7 +384,7 @@ class SMMClient(object):
pass
return settings
def set_bmc_configuration(self, changeset):
def set_bmc_configuration(self, changeset, variant):
rules = []
powercfg = [None, None]
sendhost = None
@ -435,14 +437,20 @@ class SMMClient(object):
self.wc.request('POST', '/data', rules)
self.wc.getresponse().read()
if powercfg != [None, None]:
if None in powercfg:
currcfg = self.ipmicmd.xraw_command(0x32, 0xa2)
currcfg = bytearray(currcfg['data'])
if powercfg[0] is None:
powercfg[0] = currcfg[0]
if powercfg[1] is None:
powercfg[1] = currcfg[1]
self.ipmicmd.xraw_command(0x32, 0xa3, data=powercfg)
if variant == 2:
if None in powercfg:
currcfg = self.ipmicmd.xraw_command(0x32, 0xa2)
currcfg = bytearray(currcfg['data'])
if powercfg[0] is None:
powercfg[0] = currcfg[0]
if powercfg[1] is None:
powercfg[1] = currcfg[1]
self.ipmicmd.xraw_command(0x32, 0xa3, data=powercfg)
elif variant == 6:
if powercfg[0] is not None:
self.ipmicmd.xraw_command(0x32, 0xa3, data=powercfg[:1])
if powercfg[1] is not None:
self.ipmicmd.xraw_command(0x32, 0x9c, data=powercfg[1:])
if sendhost is not None:
sendhost = 1 if sendhost else 0
self.ipmicmd.xraw_command(0xc, 1, data=[1, 0xc5, sendhost])