From 6b46d667eebed3a853c7e3c2fa743019e3f38781 Mon Sep 17 00:00:00 2001 From: luyf5 Date: Mon, 30 Aug 2021 14:13:19 +0800 Subject: [PATCH] Incomplete memory data for blue Draco https: //gitlab.icelab.lenovo.com/pygcon/pyghmi/commit/a2376085c3116d180fda44e49cf27b414d991535 fix bug 47636 Incomplete memory data for blue Draco Change-Id: I010c4526f0e6c4ff9b074d2b14425e8cbd0dab73 --- pyghmi/ipmi/private/spd.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyghmi/ipmi/private/spd.py b/pyghmi/ipmi/private/spd.py index c00de3f2..143bf003 100644 --- a/pyghmi/ipmi/private/spd.py +++ b/pyghmi/ipmi/private/spd.py @@ -25,6 +25,7 @@ with discontinuous values for a field that was until that point possible to derive in a formulaic way """ +import math import struct jedec_ids = [ @@ -721,7 +722,7 @@ class SPD(object): fineoffset = 0 - ((fineoffset ^ 0xff) + 1) fineoffset = (finetime * fineoffset) * 10 ** -3 mtb = spd[10] / float(spd[11]) - clock = 2 // ((mtb * spd[12] + fineoffset) * 10 ** -3) + clock = math.floor(2 / ((mtb * spd[12] + fineoffset) * 10 ** -3)) self.info['speed'] = speed_from_clock(clock) self.info['ecc'] = (spd[8] & 0b11000) != 0 self.info['module_type'] = module_types.get(spd[3] & 0xf, 'Unknown') @@ -744,7 +745,8 @@ class SPD(object): fineoffset = spd[125] if fineoffset & 0b10000000: fineoffset = 0 - ((fineoffset ^ 0xff) + 1) - clock = 2 // ((0.125 * spd[18] + fineoffset * 0.001) * 0.001) + clock = math.floor( + 2 / ((0.125 * spd[18] + fineoffset * 0.001) * 0.001)) self.info['speed'] = speed_from_clock(clock) else: self.info['speed'] = 'Unknown'