fix(debug): decouple "get_el_str()" from backtrace

get_el_str() was implemented under ENABLE_BACKTRACE macro but being
used at generic places too, this causes multiple definition of this
function.
Remove duplicate definition of this function and move it out of
backtrace scope. Also, this patch fixes a small bug where in default
case S-EL1 is returned which ideally should be EL1, as there is no
notion of security state in EL string.

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: Ib186ea03b776e2478eff556065449ebd478c3538
diff --git a/common/backtrace/backtrace.c b/common/backtrace/backtrace.c
index 89380b3..f994ae5 100644
--- a/common/backtrace/backtrace.c
+++ b/common/backtrace/backtrace.c
@@ -54,17 +54,6 @@
 	return ret;
 }
 
-const char *get_el_str(unsigned int el)
-{
-	if (el == 3U) {
-		return "EL3";
-	} else if (el == 2U) {
-		return "EL2";
-	} else {
-		return "S-EL1";
-	}
-}
-
 /*
  * Returns true if the address points to a virtual address that can be read at
  * the current EL, false otherwise.
diff --git a/include/common/debug.h b/include/common/debug.h
index a7ca0d7..af47999 100644
--- a/include/common/debug.h
+++ b/include/common/debug.h
@@ -91,9 +91,10 @@
 # define VERBOSE(...)	no_tf_log(LOG_MARKER_VERBOSE __VA_ARGS__)
 #endif
 
+const char *get_el_str(unsigned int el);
+
 #if ENABLE_BACKTRACE
 void backtrace(const char *cookie);
-const char *get_el_str(unsigned int el);
 #else
 #define backtrace(x)
 #endif
diff --git a/plat/common/aarch64/plat_common.c b/plat/common/aarch64/plat_common.c
index 8f998af..851ed24 100644
--- a/plat/common/aarch64/plat_common.c
+++ b/plat/common/aarch64/plat_common.c
@@ -67,17 +67,15 @@
 }
 #endif
 
-#if !ENABLE_BACKTRACE
-static const char *get_el_str(unsigned int el)
+const char *get_el_str(unsigned int el)
 {
 	if (el == MODE_EL3) {
 		return "EL3";
 	} else if (el == MODE_EL2) {
 		return "EL2";
 	}
-	return "S-EL1";
+	return "EL1";
 }
-#endif /* !ENABLE_BACKTRACE */
 
 /* RAS functions common to AArch64 ARM platforms */
 void plat_default_ea_handler(unsigned int ea_reason, uint64_t syndrome, void *cookie,
diff --git a/plat/marvell/armada/a3k/common/a3700_ea.c b/plat/marvell/armada/a3k/common/a3700_ea.c
index bc12845..fd4e3b2 100644
--- a/plat/marvell/armada/a3k/common/a3700_ea.c
+++ b/plat/marvell/armada/a3k/common/a3700_ea.c
@@ -16,18 +16,6 @@
 
 #define A53_SERR_INT_AXI_SLVERR_ON_EXTERNAL_ACCESS 0xbf000002
 
-#if !ENABLE_BACKTRACE
-static const char *get_el_str(unsigned int el)
-{
-	if (el == MODE_EL3) {
-		return "EL3";
-	} else if (el == MODE_EL2) {
-		return "EL2";
-	}
-	return "S-EL1";
-}
-#endif /* !ENABLE_BACKTRACE */
-
 /*
  * This source file with custom plat_ea_handler function is compiled only when
  * building TF-A with compile option HANDLE_EA_EL3_FIRST=1