Skip to content

Commit

Permalink
Revert "DellEMC: Z9332f - Component API Fixes (#10187)"
Browse files Browse the repository at this point in the history
This reverts commit 8a38da9.
  • Loading branch information
lguohan committed Apr 2, 2022
1 parent f759684 commit 8c2e046
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ def get_twos_complement(val, bits):
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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,20 @@


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)
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -172,14 +156,6 @@ def _get_available_firmware_version(image_path):

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"
Expand Down

0 comments on commit 8c2e046

Please sign in to comment.