Skip to content

Commit

Permalink
Update occtoolp9 to handle parsing WOF Reset reason in opal-prd
Browse files Browse the repository at this point in the history
Change-Id: I0eb77ae38408d767e13b21dd6b02c3047d818058
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/61904
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christopher J. Cain <cjcain@us.ibm.com>
Reviewed-by: Martha Broyles <mbroyles@us.ibm.com>
Reviewed-by: Andres A. Lugo-Reyes <aalugore@us.ibm.com>
  • Loading branch information
aalugore committed Jul 13, 2018
1 parent b8a8037 commit 7f75f89
Showing 1 changed file with 55 additions and 1 deletion.
56 changes: 55 additions & 1 deletion src/tools/occtoolp9
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# OpenPOWER OnChipController Project
#
# Contributors Listed Below - COPYRIGHT 2017
# Contributors Listed Below - COPYRIGHT 2017,2018
# [+] International Business Machines Corp.
#
#
Expand Down Expand Up @@ -144,6 +144,7 @@ function usage
echo " -I = HTMGT info"
echo " -IF <newValue> = Read/Set HTMGT internalFlags"
echo " -ES = Attempt to Exit Safe mode"
echo " -W = Get WOF reset reasons for ALL OCCs"
echo ""
echo " CRONUS Only Commands:"
echo " -P = Send POLL command to the OCC and collect/purge any elog, if found"
Expand Down Expand Up @@ -294,6 +295,10 @@ while [ -n "$(echo $1 | grep '-')" ]; do
action="TMGTInfo"
;;

-W )
action="WOFRR"
;;

-IF )
action="TMGTFlags"
if [ -n "$2" ]; then
Expand Down Expand Up @@ -1436,6 +1441,48 @@ function tmgt_info
} # end tmgt_info()



function wof_reset_reasons
{
### Dump WOF reset reasons and OCC instance ID
echo "==> opal-prd --expert-mode htmgt-passthru 0x0A"
$sudo opal-prd --expert-mode htmgt-passthru 0x0A | sed 's/\s//g' > /tmp/wofrr.bin
# get status of first cmd in piped cmdline
let rc=${PIPESTATUS[0]}
if [ $rc -eq 0 ]; then
while read line; do
if [ ${#line} -gt 0 ]; then
#First read the output data into one variable
alldata=$alldata$line
fi
done < /tmp/wofrr.bin
else
echo "ERROR: opal-prd occ passthru command failed with rc=$rc"
fi

# Data length should be multiple of 10. Each OCC has a 2 digit ID followed
# by the 8 digit WOF Reset reason vector
if [ $((${#alldata}%10)) -ne 0 ]; then
echo "ERROR: Data is unexpected length. Aborting..."
else
numOccs=$((${#alldata}/10))
current_index=0
for (( i=0; i<$numOccs; i++ ))
do
#Move to the next 10 digit block
current_line=${alldata:${current_index}:10}
#Extract OCC Instance
let occId=0x${current_line:0:2}
#Extract wof_disabled bit vector
let wofRR=0x${current_line:2:8}
printf "OCC%X WOF Reset Reasons: 0x%08X\n" $occId $wofRR
#Increment index
current_index=$current_index+10
done
fi
} # end wof_reset_reasons


function tmgt_flags
{
### Dump HTMGT Internal Flags
Expand Down Expand Up @@ -1695,6 +1742,13 @@ if [ -n "$action" ]; then
else
echo -e "${red}ERROR: Command only supported with opal-prd${normal} (not $interface)"
fi
elif [ "$action" == "WOFRR" ]; then

if [ "$interface" == "opal" ]; then
wof_reset_reasons
else
echo -e "${red}ERROR: Command only supported with opal-prd${normal} (not $interface)"
fi
elif [ "$action" == "TMGTFlags" ]; then

if [ "$interface" == "opal" ]; then
Expand Down

0 comments on commit 7f75f89

Please sign in to comment.