1#!/bin/bash 2 3# Disable check for splitting 4# shellcheck disable=SC2207 5# Provide source directive to shellcheck. 6# shellcheck source=meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-fw/mori-lib.sh 7source /usr/libexec/mori-fw/mori-lib.sh 8 9BMC_CPLD_VER_FILE="/run/cpld0.version" 10MB_CPLD_VER_FILE="/run/cpld1.version" 11ver='' 12 13function fw_rev() { 14 case $1 in 15 cpldb) 16 rsp=($(i2cget -y -f -a "${I2C_BMC_CPLD[0]}" 0x"${I2C_BMC_CPLD[1]}" 0x00 i 5)) 17 ver=$(printf '%d.%d.%d.%d' "${rsp[4]}" "${rsp[3]}" "${rsp[2]}" "${rsp[1]}") 18 ;; 19 cpldm) 20 rsp=($(i2cget -y -f -a "${I2C_MB_CPLD[0]}" 0x"${I2C_MB_CPLD[1]}" 0x00 i 5)) 21 ver=$(printf '%d.%d.%d.%d' "${rsp[4]}" "${rsp[3]}" "${rsp[2]}" "${rsp[1]}") 22 ;; 23 *) 24 ;; 25 esac 26} 27 28fw_rev cpldb 29echo "BMC CPLD version : ${ver}" 30echo "${ver}" > "${BMC_CPLD_VER_FILE}" 31fw_rev cpldm 32echo "MB CPLD version : ${ver}" 33echo "${ver}" > "${MB_CPLD_VER_FILE}" 34