blob: e0b8098325ea337c60dbbeb50fca5ab131fcb599 [file] [log] [blame]
#!/bin/bash
function usage()
{
echo
echo "usage: $0: <scom_addr> <core-id>"
echo
echo " <scom_addr>:"
echo " SCOM address that needs transaltion."
echo " <core-id>:"
echo " Core id as obtained from probe_cpu.sh."
echo " Should be between 0-23."
exit 1
}
[ $# -lt 2 ] && usage
SCOM_ADDR=$1
SCOM_ADDR=$(echo $SCOM_ADDR | sed 's/^0x//')
CORE_ID=$2
CORE_ID=$(echo $CORE_ID | sed 's/^0x//')
[ $CORE_ID -gt 23 ] && echo "<core-id> should be between 0-23" && exit
# per Chip level
perl -e '{printf("EQ[%2d]: 0x%x\n", ((('$CORE_ID' & 0x1c)) >> 2), 0x'$SCOM_ADDR' | ((('$CORE_ID' & 0x1c) + 0x40) << 22));}'
perl -e '{printf("EX[%2d]: 0x%x\n", ((('$CORE_ID')) >> 1), (0x'$SCOM_ADDR' | (('$CORE_ID' & 2) << 9 )) | ((('$CORE_ID' & 0x1c) + 0x40) << 22));}'
perl -e '{printf(" C[%2d]: 0x%x\n", '$CORE_ID', 0x'$SCOM_ADDR' | ((('$CORE_ID' & 0x1f) + 0x20) << 24));}'