summaryrefslogtreecommitdiff
path: root/meta-fii
diff options
context:
space:
mode:
authorJonico Eustaquio <jonico.eustaquio@fii-na.com>2023-04-04 21:45:39 +0300
committerVivekanand Veeracholan <vveerach@google.com>2023-07-01 01:34:35 +0300
commitd90eb4d4e7017da89696d4ca4e58e33deacf729e (patch)
tree0517103d9b01eb84719f766c5d0fdc4dd7ed72c8 /meta-fii
parent3ec1793b18ca4c51634e7e0ffdd46e8b9490b23d (diff)
downloadopenbmc-d90eb4d4e7017da89696d4ca4e58e33deacf729e.tar.xz
meta-fii: meta-mori: flock during flashing process
Added flock during flashing process of BIOS, CPLDs, and power sequencer instead of using flock over the whole init_once script. Removed mori.sh rst hotswap to be replaced. Change-Id: I29bd364b307178abed19b542ce4737e4ef14d06d Signed-off-by: Jonico Eustaquio <jonico.eustaquio@fii-na.com>
Diffstat (limited to 'meta-fii')
-rw-r--r--meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-fw/mori-fw.sh43
-rw-r--r--meta-fii/meta-mori/recipes-mori/mori-sys-utility/mori-cmd/mori.sh6
2 files changed, 30 insertions, 19 deletions
diff --git a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-fw/mori-fw.sh b/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-fw/mori-fw.sh
index 4b0ab09377..4802a433e7 100644
--- a/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-fw/mori-fw.sh
+++ b/meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-fw/mori-fw.sh
@@ -17,12 +17,14 @@ function fwbios() {
# write to the mtd device
BIOS_MTD=$(grep "hnor" /proc/mtd | sed -n 's/^\(.*\):.*/\1/p')
-
+ {
+ flock -x 200
echo "Flashing BIOS @/dev/${BIOS_MTD}"
if ! flashcp -v $1 /dev/${BIOS_MTD} ; then
echo "Flashing the bios failed " >&2
ret=1
fi
+ } 200>$RST_LOCK_FILE
cleanup_bios_access
@@ -30,6 +32,7 @@ function fwbios() {
}
function fwbmccpld() {
+ ret=0
if [ ! -s "$1" ]; then
echo "Image file" "$1" "is empty or nonexistent, BMC CPLD update failed"
return 1
@@ -40,18 +43,24 @@ function fwbmccpld() {
set_gpio_ctrl MB_JTAG_MUX_SEL 0
set_gpio_ctrl BMC_JTAG_MUX_SEL 1
+ {
+ flock -x 200
# 1st condition checks if the svf file is valid
# 2nd condition checks flashing logs for flash errors
if ! mesg=$(loadsvf -d /dev/jtag0 -s $1 -m 0 2>&1) \
|| echo "$mesg" | grep -i -e error -e fail ; then
+ echo "$mesg" | grep -i -e error -e fail
echo "BMC CPLD update failed"
- return 1
+ ret=1
+ else
+ echo "BMC CPLD update successful"
fi
- echo "BMC CPLD update successful"
- return 0
+ } 200>$RST_LOCK_FILE
+ return $ret
}
function fwmbcpld() {
+ ret=0
if [ ! -s "$1" ]; then
echo "Image file" "$1" "is empty or nonexistent, MB CPLD update failed"
return 1
@@ -62,17 +71,22 @@ function fwmbcpld() {
set_gpio_ctrl MB_JTAG_MUX_SEL 1
set_gpio_ctrl BMC_JTAG_MUX_SEL 0
+ {
+ flock -x 200
# 1st condition checks if the svf file is valid
# 2nd condition checks flashing logs for flash errors
if ! mesg=$(loadsvf -d /dev/jtag0 -s $1 -m 0 2>&1) \
|| echo "$mesg" | grep -i -e error -e fail ; then
echo "MB CPLD update failed"
- return 1
+ ret=1
+ else
+ echo "MB CPLD update successful"
fi
+ } 200>$RST_LOCK_FILE
set_gpio_ctrl MB_JTAG_MUX_SEL 0
echo "MB CPLD update successful"
- return 0
+ return $ret
}
function fwbootstrap() {
@@ -100,24 +114,27 @@ function fwbootstrap() {
function fwmb_pwr_seq(){
#$1 PS seq config file
+ ret=0
if [[ ! -e "$1" ]]; then
echo "The file $1 does not exist"
return 1
fi
- echo "${I2C_MB_PWRSEQ[0]}"-00"${I2C_MB_PWRSEQ[1]}" > \
- /sys/bus/i2c/drivers/adm1266/unbind
- #Parameters passed to mb_power_sequencer_flash to be used to flash PS
+ echo "${I2C_MB_PWRSEQ[0]}"-00"${I2C_MB_PWRSEQ[1]}" > /sys/bus/i2c/drivers/adm1266/unbind
+ {
+ flock -x 200
+ #Parameters passed to adm1266_fw_fx to be used to flash PS
#1st I2C bus number of PS's
#2nd PS seq config file
if [ "$(mb_power_sequencer_flash ${I2C_MB_PWRSEQ[0]} $1)" -ne 0 ]; then
echo "The power seq flash failed" >&2
- return 1
+ ret=1
+ else
+ echo "${I2C_MB_PWRSEQ[0]}"-00"${I2C_MB_PWRSEQ[1]}" > /sys/bus/i2c/drivers/adm1266/bind
fi
- echo "${I2C_MB_PWRSEQ[0]}"-00"${I2C_MB_PWRSEQ[1]}" > \
- /sys/bus/i2c/drivers/adm1266/bind
+ } 200>$RST_LOCK_FILE
- return 0
+ return $ret
}
if [[ ! $(which flashcp) ]]; then
diff --git a/meta-fii/meta-mori/recipes-mori/mori-sys-utility/mori-cmd/mori.sh b/meta-fii/meta-mori/recipes-mori/mori-sys-utility/mori-cmd/mori.sh
index 963dc3b27e..8b07a12a7e 100644
--- a/meta-fii/meta-mori/recipes-mori/mori-sys-utility/mori-cmd/mori.sh
+++ b/meta-fii/meta-mori/recipes-mori/mori-sys-utility/mori-cmd/mori.sh
@@ -7,7 +7,6 @@ source /usr/libexec/mori-fw/mori-lib.sh
function usage_rst() {
echo " mori rst [parameter]"
- echo " hotswap --> reset the whole mori node"
echo " system --> reset the host"
echo " btn --> trigger a power button event"
echo " shutdown --> send out shutdown signal to CPU"
@@ -59,11 +58,6 @@ function usage() {
function reset() {
case $1 in
- hotswap)
- # Virtual AC reset
- echo "mori.sh rst hotswap occurred"
- set_gpio_ctrl HOTSWAP 1
- ;;
system)
# S0 system reset
echo "System has been reset, host will start booting in a few minutes"