From c4dc5d3275ea085c1a084765f1fefc39caf419d1 Mon Sep 17 00:00:00 2001 From: XP Chen Date: Tue, 27 Jul 2021 11:33:13 -0500 Subject: meta-fii/meta-kudo: Modify kudo-fw.sh to check if utilities exist Modify kudo-fw.sh for better flash failure detection Signed-off-by: XP Chen Change-Id: Id9418a8fc162e1fa1dc8f8eb0714337785526972 --- .../kudo-fw-utility/kudo-fw/kudo-fw.sh | 55 +++++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) (limited to 'meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-fw.sh') diff --git a/meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-fw.sh b/meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-fw.sh index 58a2826e0..a63c3e61c 100644 --- a/meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-fw.sh +++ b/meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-fw.sh @@ -28,6 +28,10 @@ function fwbios() { fi echo "Flashing BIOS @/dev/$BIOS_MTD" flashcp -v $1 /dev/$BIOS_MTD + if [ $? -ne 0 ]; then + echo "Flashing the bios failed " >&2 + exit 1 + fi wait # switch the SPI mux from BMC to Host @@ -36,23 +40,38 @@ function fwbios() { fi i2cset -y -f -a 13 0x76 0x10 0x00 + # Disable LPI mode NV_SI_CPU_LPI_FREQ_DISABLE. + # Moved to before SCP as fwscp function returns 0 on success + nvparm -s 0x1 -o 0x114090 + # TODO: Disabled toggling of SMPro heartbeat (require CPLD v 1.12.0.0+) + # nvparm -s 0x1 -o 0x5F0638 + if [ $? -ne 0 ]; then + echo "Setting default nvparms failed " >&2 + exit 1 + fi + if [[ $(find ${1} -type f -size +17156k 2>/dev/null) ]]; then echo "Extracting the SCP from the image" dd if=$1 bs=1024 skip=17156 count=256 of=/run/initramfs/myscp.img fwscp /run/initramfs/myscp.img fi - # Disable LPI mode NV_SI_CPU_LPI_FREQ_DISABLE. - nvparm -s 0x1 -o 0x114090 + rm -f $1 + exit 0 } function fwbmccpld() { # BMC_JTAG_MUX_1 #218 0:BMC 1:MB set_gpio_ctrl 218 out 0 loadsvf -d /dev/jtag0 -s $1 -m 0 + if [ $? -ne 0 ]; then + echo "BMC CPLD update failed" >&2 + exit 1 + fi wait set_gpio_ctrl 218 out 1 rm -f $1 + exit 0 } function fwmbcpld() { @@ -61,8 +80,13 @@ function fwmbcpld() { set_gpio_ctrl 218 out 1 set_gpio_ctrl 164 out 1 loadsvf -d /dev/jtag0 -s $1 -m 0 + if [ $? -ne 0 ]; then + echo "Mobo CPLD update failed" >&2 + exit 1 + fi wait rm -f $1 + exit 0 } function fwscp() { @@ -72,10 +96,15 @@ function fwscp() { set_gpio_ctrl 85 out 0 I2C_BUS_DEV=$(ls -l $devpath/"13-0077/" | grep channel-0 | awk '{ print $11}' | cut -c 8-) ampere_eeprom_prog -b $I2C_BUS_DEV -s 0x50 -p -f $1 + if [ $? -ne 0 ]; then + echo "SCP eeprom update failed" >&2 + exit 1 + fi wait set_gpio_ctrl 85 out 1 set_gpio_ctrl 168 out 1 rm -f $1 + exit 0 } function fwscpback() { @@ -85,10 +114,15 @@ function fwscpback() { set_gpio_ctrl 85 out 0 I2C_BUS_DEV=$(ls -l $devpath/"13-0077/" | grep channel-0 | awk '{ print $11}' | cut -c 8-) ampere_eeprom_prog -b $I2C_BUS_DEV -s 0x50 -p -f $1 + if [ $? -ne 0 ]; then + echo "SCP BACKUP eeprom update failed" >&2 + exit 1 + fi wait set_gpio_ctrl 85 out 1 set_gpio_ctrl 168 out 1 rm -f $1 + exit 0 } function fwmb_pwr_seq(){ @@ -116,6 +150,23 @@ function fwmb_pwr_seq(){ exit 0 } +if [[ ! $(which flashcp) ]]; then + echo "flashcp utility not installed" + exit 1 +fi +if [[ ! $(which ampere_eeprom_prog) ]]; then + echo "ampere_eeprom_prog utility not installed" + exit 1 +fi +if [[ ! $(which loadsvf) ]]; then + echo "loadsvf utility not installed" + exit 1 +fi +if [[ ! -e /dev/jtag0 ]]; then + echo "Jtag device driver not functional" + exit 1 +fi + case $1 in bios) fwbios $2 -- cgit v1.2.3