Skip to content

Commit

Permalink
Merge pull request #78 from SW-CSA/cel_develop
Browse files Browse the repository at this point in the history
1. add cpld_refresh to support two refresh files.
  • Loading branch information
MickeyZhan authored May 24, 2019
2 parents a914fcb + 48a6fe1 commit ed6e2f1
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,16 @@ bmc_reboot() {
devmem_set_bit 0x1e78502c 7
logger -p user.warning "Set BMC booting flash to master"
fi
if [ -f /var/log/boot_slave ]; then
rm /var/log/boot_slave
fi
return 0
elif [ "$1" == "slave" ]; then
if [ $slave -eq 0 ]; then ##current is master booting
devmem_set_bit 0x1e78502c 7
logger -p user.warning "Set BMC booting flash to slave"
fi
echo 1 > /var/log/boot_slave
return 0
elif [ "$1" == "reboot" ]; then
((val=$(devmem 0x1e78502c)))
Expand Down Expand Up @@ -564,11 +568,23 @@ cpld_refresh() {
if [ $# -ge 2 ]; then
logger -p user.warning "cpld_refresh: start $1 CPLD refreshing"
gpio_set L2 1
ispvm -f 1000 dll /usr/lib/libcpldupdate_dll_gpio.so $2 --tdo 212 --tdi 213 --tms 214 --tck 215
#ispvm -f 1000 dll /usr/lib/libcpldupdate_dll_gpio.so $2 --tdo 212 --tdi 213 --tms 214 --tck 215
ispvm dll /usr/lib/libcpldupdate_dll_gpio.so $2 --tdo 212 --tdi 213 --tms 214 --tck 215
ret=$?
gpio_set L2 0
logger -p user.warning "cpld_refresh: done, result=$ret"
fi
sleep 5
if [ $# -ge 4 ]; then
logger -p user.warning "cpld_refresh: start $3 CPLD refreshing"
gpio_set L2 1
#ispvm -f 1000 dll /usr/lib/libcpldupdate_dll_gpio.so $4 --tdo 212 --tdi 213 --tms 214 --tck 215
ispvm dll /usr/lib/libcpldupdate_dll_gpio.so $4 --tdo 212 --tdi 213 --tms 214 --tck 215
ret=$?
gpio_set L2 0
logger -p user.warning "cpld_refresh: done, result=$ret"
fi
sleep 5
logger -p user.warning "cpld_refresh: power cycle CPU"
/usr/local/bin/wedge_power.sh cycle
logger -p user.warning "cpld_refresh: BMC rebooting"
Expand All @@ -578,45 +594,32 @@ cpld_refresh() {
logger -p user.warning "cpld_refresh: power off CPU"
/usr/local/bin/wedge_power.sh off
sleep 1
if [ "$1" = "fan" -o "$1" = "switch" -o "$1" = "cpu" -o "$1" = "base" -o "$1" = "combo" ]; then #loop1
logger -p user.warning "cpld_refresh: start $1 CPLD refreshing"
if [ $# -ge 2 ]; then
gpio_set L2 1
gpio_set P0 0
ispvm -f 1000 dll /usr/lib/libcpldupdate_dll_gpio.so $2 --tdo 212 --tdi 213 --tms 214 --tck 215
ret=$?
gpio_set L2 0
gpio_set P0 0
gpio_set O0 0
fi
logger -p user.warning "cpld_refresh: done, result=$ret"
elif [ "$1" = "top_lc" ]; then #loop2
if [ $# -ge 2 ]; then
logger -p user.warning "cpld_refresh: start $1 CPLD refreshing"
if [ $# -ge 2 ]; then
gpio_set L2 1
gpio_set P0 1
gpio_set O0 0
ispvm -f 1000 dll /usr/lib/libcpldupdate_dll_gpio.so $2 --tdo 212 --tdi 213 --tms 214 --tck 215
ret=$?
gpio_set L2 0
gpio_set P0 0
gpio_set O0 0
fi
gpio_set L2 1
gpio_set P0 0
#ispvm -f 1000 dll /usr/lib/libcpldupdate_dll_gpio.so $2 --tdo 212 --tdi 213 --tms 214 --tck 215
ispvm dll /usr/lib/libcpldupdate_dll_gpio.so $2 --tdo 212 --tdi 213 --tms 214 --tck 215
ret=$?
gpio_set L2 0
gpio_set P0 0
gpio_set O0 0
logger -p user.warning "cpld_refresh: done, result=$ret"
elif [ "$1" = "bottom_lc" ]; then #loop3
logger -p user.warning "cpld_refresh: start $1 CPLD refreshing"
if [ $# -ge 2 ]; then
gpio_set L2 1
gpio_set P0 1
gpio_set O0 1
ispvm -f 1000 dll /usr/lib/libcpldupdate_dll_gpio.so $2 --tdo 212 --tdi 213 --tms 214 --tck 215
ret=$?
gpio_set L2 0
gpio_set P0 0
gpio_set O0 0
fi
fi
sleep 5
if [ $# -ge 4 ]; then
logger -p user.warning "cpld_refresh: start $3 CPLD refreshing"
gpio_set L2 1
gpio_set P0 0
#ispvm -f 1000 dll /usr/lib/libcpldupdate_dll_gpio.so $4 --tdo 212 --tdi 213 --tms 214 --tck 215
ispvm dll /usr/lib/libcpldupdate_dll_gpio.so $4 --tdo 212 --tdi 213 --tms 214 --tck 215
ret=$?
gpio_set L2 0
gpio_set P0 0
gpio_set O0 0
logger -p user.warning "cpld_refresh: done, result=$ret"
fi
sleep 5
logger -p user.warning "cpld_refresh: power cycle CPU"
/usr/local/bin/wedge_power.sh cycle
logger -p user.warning "cpld_refresh: BMC rebooting"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,36 @@

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

slave=0
if /usr/local/bin/boot_info.sh |grep "Slave Flash" ; then
echo "BMC boot from Slave flash"
logger "BMC boot from Slave flash"
sys_led yellow on #sysled light yellow
slave=1
else
echo "BMC boot from Master flash"
logger "BMC boot from Master flash"
sys_led green on #sysled light green
slave=0
fi

if [ $slave -eq 0 ]; then #master
if [ -f /var/log/boot_slave ]; then
((val=$(cat /var/log/boot_slave)))
if [ $val -eq 1 ]; then
echo 0 > /var/log/boot_slave
echo "Previous BMC booting from slave, switch to BMC slave flash booting"
logger -p user.warning "Previous BMC booting from slave, switch to BMC slave flash booting"
boot_from slave
else
echo "BMC switch to slave flash booting fail"
logger -p user.warning "BMC switch to slave flash booting fail"
fi
fi
else #slave
if [ -f /var/log/boot_slave ]; then
echo 1 > /var/log/boot_slave
fi
fi

if /usr/local/bin/wedge_power.sh status |grep "on"; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ psu_register=(
"i2c_device_delete 24 0x58;i2c_device_delete 24 0x50;i2c_device_add 24 0x58 dps1100;i2c_device_add 24 0x50 24c32"
)

PHALANX_PSU_NUM=4
phalanx_psu_status=(0 0 0 0)
phalanx_psu_register=(
"i2c_device_delete 27 0x58;i2c_device_delete 27 0x50;i2c_device_add 27 0x58 dps1100;i2c_device_add 27 0x50 24c32"
"i2c_device_delete 26 0x58;i2c_device_delete 26 0x50;i2c_device_add 26 0x58 dps1100;i2c_device_add 26 0x50 24c32"
"i2c_device_delete 25 0x58;i2c_device_delete 25 0x50;i2c_device_add 25 0x58 dps1100;i2c_device_add 25 0x50 24c32"
"i2c_device_delete 24 0x58;i2c_device_delete 24 0x50;i2c_device_add 24 0x58 dps1100;i2c_device_add 24 0x50 24c32"
)

board_type=$(board_type)

psu_status_init() {
Expand Down Expand Up @@ -93,6 +102,58 @@ psu_status_check() {
fi
}


phalanx_psu_present() {
((psu_num=$PHALANX_PSU_NUM - $1 + 1))
((val=$(read_info 0 0d psu_${psu_num}_present)))
if [ $val -eq 0 ]; then
return 1
else
return 0
fi
}

phalanx_psu_power() {
((psu_num=$PHALANX_PSU_NUM - $1 + 1))
((val=$(read_info 0 0d psu_${psu_num}_status)))
if [ $val -eq 0 ]; then
return 0
else
return 1
fi
}

phalanx_psu_status_init() {
for((i = 0; i < $PHALANX_PSU_NUM; i++))
do
phalanx_psu_present $(($i + 1))
if [ $? -eq 1 ]; then
phalanx_psu_power $(($i + 1))
power_ok=$?
if [ $power_ok -eq 1 ]; then
phalanx_psu_status[$i]=1
fi
fi
done
}
phalanx_psu_status_check() {
if [ $# -le 0 ]; then
return 1
fi

phalanx_psu_present $(($1 + 1))
if [ $? -eq 1 ]; then
phalanx_psu_power $(($1 + 1))
power_ok=$?
if [ ${phalanx_psu_status[$1]} -eq 0 ] && [ $power_ok -eq 1 ]; then
logger "us_monitor: Register PSU $(($i + 1))"
eval "${phalanx_psu_register[$1]}"
phalanx_psu_status[$1]=1
return 0
fi
fi
}

get_fan_pwm() {
for i in $FANS ; do
pwm_node="${FANCPLD_SYSFS_DIR}/fan${i}_pwm"
Expand Down Expand Up @@ -397,7 +458,11 @@ cpld_refresh_monitor() {
fi
}

psu_status_init
if [ "$board_type" = "Fishbone48" -o "$board_type" = "Fishbone32" ]; then
psu_status_init
else
phalanx_psu_status_init
fi
come_rest_status 2
come_rst_st=$?
revise_temp=0
Expand Down Expand Up @@ -426,6 +491,11 @@ while true; do
do
psu_status_check $i
done
else
for((i = 0; i < $PHALANX_PSU_NUM; i++))
do
phalanx_psu_status_check $i
done
fi

come_rest_status 1
Expand Down

0 comments on commit ed6e2f1

Please sign in to comment.