blob: 73252251ab34a83b65bbe29e19599e18acc6a89f [file] [log] [blame]
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -05001#!/bin/bash
Sridevi Ramesh0e4d8872019-01-10 09:06:58 -06002# Refer to help text in the usage function for details.
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -05003
4function usage()
5{
Patrick Williams90dfee32022-12-08 06:52:46 -06006 echo
7 echo "This script runs on HOST OS and gives translated SCOM address."
8 echo "usage: $0: <scom_addr> <core_id>"
9 echo
10 echo " <scom_addr>:"
11 echo " SCOM address that needs translation (e.g. '10010800')."
12 echo " <core_id>:"
13 echo " Core id as obtained from probe_cpu.sh."
14 echo " Should be between 0-23 (e.g. '0')."
15 exit 1
Sridevi Ramesh0d88ab32017-09-21 11:07:28 -050016}
17
18[ $# -lt 2 ] && usage
19
20SCOM_ADDR=$1
21SCOM_ADDR=$(echo $SCOM_ADDR | sed 's/^0x//')
22CORE_ID=$2
23CORE_ID=$(echo $CORE_ID | sed 's/^0x//')
24
25[ $CORE_ID -gt 23 ] && echo "<core-id> should be between 0-23" && exit
26
27# per Chip level
28perl -e '{printf("EQ[%2d]: 0x%x\n", ((('$CORE_ID' & 0x1c)) >> 2), 0x'$SCOM_ADDR' | ((('$CORE_ID' & 0x1c) + 0x40) << 22));}'
29perl -e '{printf("EX[%2d]: 0x%x\n", ((('$CORE_ID')) >> 1), (0x'$SCOM_ADDR' | (('$CORE_ID' & 2) << 9 )) | ((('$CORE_ID' & 0x1c) + 0x40) << 22));}'
30perl -e '{printf(" C[%2d]: 0x%x\n", '$CORE_ID', 0x'$SCOM_ADDR' | ((('$CORE_ID' & 0x1f) + 0x20) << 24));}'
31
32