Sridevi Ramesh | 0d88ab3 | 2017-09-21 11:07:28 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | function usage() |
| 4 | { |
| 5 | echo |
| 6 | echo "usage: $0: <scom_addr> <core-id>" |
| 7 | echo |
| 8 | echo " <scom_addr>:" |
| 9 | echo " SCOM address that needs transaltion." |
| 10 | echo " <core-id>:" |
| 11 | echo " Core id as obtained from probe_cpu.sh." |
| 12 | echo " Should be between 0-23." |
| 13 | exit 1 |
| 14 | } |
| 15 | |
| 16 | [ $# -lt 2 ] && usage |
| 17 | |
| 18 | SCOM_ADDR=$1 |
| 19 | SCOM_ADDR=$(echo $SCOM_ADDR | sed 's/^0x//') |
| 20 | CORE_ID=$2 |
| 21 | CORE_ID=$(echo $CORE_ID | sed 's/^0x//') |
| 22 | |
| 23 | [ $CORE_ID -gt 23 ] && echo "<core-id> should be between 0-23" && exit |
| 24 | |
| 25 | # per Chip level |
| 26 | perl -e '{printf("EQ[%2d]: 0x%x\n", ((('$CORE_ID' & 0x1c)) >> 2), 0x'$SCOM_ADDR' | ((('$CORE_ID' & 0x1c) + 0x40) << 22));}' |
| 27 | perl -e '{printf("EX[%2d]: 0x%x\n", ((('$CORE_ID')) >> 1), (0x'$SCOM_ADDR' | (('$CORE_ID' & 2) << 9 )) | ((('$CORE_ID' & 0x1c) + 0x40) << 22));}' |
| 28 | perl -e '{printf(" C[%2d]: 0x%x\n", '$CORE_ID', 0x'$SCOM_ADDR' | ((('$CORE_ID' & 0x1f) + 0x20) << 24));}' |
| 29 | |
| 30 | |