Revert "DellEMC: Z9332f - Component API Fixes (#10187)"

This reverts commit 8a38da94d5.
This commit is contained in:
Guohan Lu 2022-04-02 14:08:28 -07:00
parent f7596844b7
commit 8c2e04690e
4 changed files with 10 additions and 40 deletions

View File

@ -90,10 +90,7 @@ class IpmiSensor(object):
R_exp = get_twos_complement((factors[6] & 0xF0) >> 4, 4)
B_exp = get_twos_complement(factors[6] & 0x0F, 4)
if R_exp < 0:
converted_reading = ((M * raw_value) + (B * 10**B_exp)) / 10**(-R_exp)
else:
converted_reading = ((M * raw_value) + (B * 10**B_exp)) * 10**R_exp
converted_reading = ((M * raw_value) + (B * 10**B_exp)) * 10**R_exp
return True, converted_reading

View File

@ -45,7 +45,7 @@ function show_help_and_exit()
echo " "
echo " Available options:"
echo " -h, -? : getting this help"
echo " -a [fwpkg] : stages the firmware update package"
echo " -o [fwpkg] : stages the firmware update package"
exit 0
}

View File

@ -39,10 +39,7 @@ def pci_set_value(resource, val, offset):
# Read I2C device
def i2c_get(bus, i2caddr, ofs):
try:
return int(subprocess.check_output(['/usr/sbin/i2cget', '-y', str(bus), str(i2caddr), str(ofs)]), 16)
except (FileNotFoundError, subprocess.CalledProcessError):
return -1
return int(subprocess.check_output(['/usr/sbin/i2cget', '-y', str(bus), str(i2caddr), str(ofs)]), 16)
def io_reg_read(io_resource, offset):
fd = os.open(io_resource, os.O_RDONLY)

View File

@ -23,36 +23,20 @@ except ImportError as e:
def get_bios_version():
try:
return subprocess.check_output(['dmidecode', '-s', 'bios-version'],
text=True).strip()
except (FileNotFoundError, subprocess.CalledProcessError):
return 'NA'
return subprocess.check_output(
['dmidecode', '-s', 'bios-version']).decode('utf-8').strip()
def get_fpga_version():
val = hwaccess.pci_get_value('/sys/bus/pci/devices/0000:09:00.0/resource0', 0)
return '{}.{}'.format((val >> 16) & 0xffff, val & 0xffff)
def get_bmc_version():
val = 'NA'
try:
bmc_ver = subprocess.check_output(['ipmitool', 'mc', 'info'],
stderr=subprocess.STDOUT, text=True)
except (FileNotFoundError, subprocess.CalledProcessError):
pass
else:
version = re.search(r'Firmware Revision\s*:\s(.*)', bmc_ver)
if version:
val = version.group(1).strip()
return val
return subprocess.check_output(
['cat', '/sys/class/ipmi/ipmi0/device/bmc/firmware_revision']
).decode('utf-8').strip()
def get_cpld_version(bus, i2caddr):
val = hwaccess.i2c_get(bus, i2caddr, 0)
if val != -1:
return '{:x}.{:x}'.format((val >> 4) & 0xf, val & 0xf)
else:
return 'NA'
return '{}'.format(hwaccess.i2c_get(bus, i2caddr, 0))
def get_cpld0_version():
return get_cpld_version(5, 0x0d)
@ -83,7 +67,7 @@ def get_pciephy_version():
except Exception:
return val
else:
version = re.search(r'PCIe FW version:\s(.*)', pcie_ver)
version = re.search(r'PCIe FW loader version:\s(.*)', pcie_ver)
if version:
val = version.group(1).strip()
@ -172,14 +156,6 @@ class Component(ComponentBase):
ver_info = ver_info.get("x86_64-dellemc_z9332f_d1508-r0")
if ver_info:
components = list(ver_info.keys())
for component in components:
if "CPLD" in component and ver_info[component].get('version'):
val = ver_info.pop(component)
ver = int(val['version'], 16)
val['version'] = "{:x}.{:x}".format((ver >> 4) & 0xf, ver & 0xf)
ver_info[component.replace("-", " ")] = val
return True, ver_info
else:
return False, "ERROR: Version info not available"