blob: e0b8098325ea337c60dbbeb50fca5ab131fcb599 [file] [log] [blame]
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -05001#!/bin/bash
2
3function 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
18SCOM_ADDR=$1
19SCOM_ADDR=$(echo $SCOM_ADDR | sed 's/^0x//')
20CORE_ID=$2
21CORE_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
26perl -e '{printf("EQ[%2d]: 0x%x\n", ((('$CORE_ID' & 0x1c)) >> 2), 0x'$SCOM_ADDR' | ((('$CORE_ID' & 0x1c) + 0x40) << 22));}'
27perl -e '{printf("EX[%2d]: 0x%x\n", ((('$CORE_ID')) >> 1), (0x'$SCOM_ADDR' | (('$CORE_ID' & 2) << 9 )) | ((('$CORE_ID' & 0x1c) + 0x40) << 22));}'
28perl -e '{printf(" C[%2d]: 0x%x\n", '$CORE_ID', 0x'$SCOM_ADDR' | ((('$CORE_ID' & 0x1f) + 0x20) << 24));}'
29
30