Switch AARCH32/AARCH64 to __aarch64__

NOTE: AARCH32/AARCH64 macros are now deprecated in favor of __aarch64__.

All common C compilers pre-define the same macros to signal which
architecture the code is being compiled for: __arm__ for AArch32 (or
earlier versions) and __aarch64__ for AArch64. There's no need for TF-A
to define its own custom macros for this. In order to unify code with
the export headers (which use __aarch64__ to avoid another dependency),
let's deprecate the AARCH32 and AARCH64 macros and switch the code base
over to the pre-defined standard macro. (Since it is somewhat
unintuitive that __arm__ only means AArch32, let's standardize on only
using __aarch64__.)

NOTE: This change is based on below TFA commit
https://github.com/ARM-software/arm-trusted-firmware/commit/402b3cf8766fe2cb4ae462f7ee7761d08a1ba56c

Signed-off-by: Deepika Bhavnani <deepika.bhavnani@arm.com>
Change-Id: If2c3dbaeb01d4a9d8cfd95d906e5eaf4ae94417f
diff --git a/tftf/framework/main.c b/tftf/framework/main.c
index 2523a97..2350b96 100644
--- a/tftf/framework/main.c
+++ b/tftf/framework/main.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -517,7 +517,7 @@
 	NOTICE("%s\n", build_message);
 	NOTICE("%s\n\n", version_string);
 
-#ifndef AARCH32
+#ifdef __aarch64__
 	NOTICE("Running at NS-EL%u\n", IS_IN_EL(1) ? 1 : 2);
 #else
 	NOTICE("Running in AArch32 HYP mode\n");
diff --git a/tftf/tests/extensions/mte/test_mte.c b/tftf/tests/extensions/mte/test_mte.c
index 13da667..7dbb9ef 100644
--- a/tftf/tests/extensions/mte/test_mte.c
+++ b/tftf/tests/extensions/mte/test_mte.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -12,7 +12,7 @@
 test_result_t test_mte_instructions(void)
 {
 	SKIP_TEST_IF_AARCH32();
-#ifdef AARCH64
+#ifdef __aarch64__
 	SKIP_TEST_IF_MTE_SUPPORT_LESS_THAN(MTE_IMPLEMENTED_EL0);
 
 	/* irg */
@@ -24,13 +24,13 @@
 	__asm__ volatile (".inst 0xD1800129");
 
 	return TEST_RESULT_SUCCESS;
-#endif /* AARCH64 */
+#endif /* __aarch64__ */
 }
 
 test_result_t test_mte_leakage(void)
 {
 	SKIP_TEST_IF_AARCH32();
-#ifdef AARCH64
+#ifdef __aarch64__
 	smc_args tsp_svc_params;
 	int gcr_el1;
 
@@ -53,5 +53,5 @@
 	}
 
 	return TEST_RESULT_SUCCESS;
-#endif /* AARCH64 */
+#endif /* __aarch64__ */
 }
diff --git a/tftf/tests/extensions/sve/sve_operations.S b/tftf/tests/extensions/sve/sve_operations.S
index 9440b13..e528b2b 100644
--- a/tftf/tests/extensions/sve/sve_operations.S
+++ b/tftf/tests/extensions/sve/sve_operations.S
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -8,7 +8,7 @@
 
 #include "./test_sve.h"
 
-#ifdef AARCH64
+#ifdef __aarch64__
 #if __GNUC__ > 8 || (__GNUC__ == 8 && __GNUC_MINOR__ > 0)
 
 /*
@@ -36,4 +36,4 @@
 endfunc sve_subtract_arrays
 
 #endif /* __GNUC__ > 8 || (__GNUC__ == 8 && __GNUC_MINOR__ > 0) */
-#endif /* AARCH64 */
+#endif /* __aarch64__ */
diff --git a/tftf/tests/misc_tests/inject_serror.S b/tftf/tests/misc_tests/inject_serror.S
index 0d7dbf2..008503f 100644
--- a/tftf/tests/misc_tests/inject_serror.S
+++ b/tftf/tests/misc_tests/inject_serror.S
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -9,7 +9,7 @@
 #include <sdei.h>
 
 
-#ifdef AARCH64
+#ifdef __aarch64__
 	.globl	inject_serror
 	.globl	inject_uncontainable
 	.globl	serror_sdei_event_handler
diff --git a/tftf/tests/misc_tests/test_pmu_leakage.c b/tftf/tests/misc_tests/test_pmu_leakage.c
index da28999..36b3138 100644
--- a/tftf/tests/misc_tests/test_pmu_leakage.c
+++ b/tftf/tests/misc_tests/test_pmu_leakage.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -75,7 +75,7 @@
 	unsigned long long avg;
 };
 
-#ifdef AARCH64
+#ifdef __aarch64__
 #define V8_2_DEBUG_ARCH_SUPPORTED ID_AA64DFR0_V8_2_DEBUG_ARCH_SUPPORTED
 #else
 #define V8_2_DEBUG_ARCH_SUPPORTED DBGDIDR_V8_2_DEBUG_ARCH_SUPPORTED
diff --git a/tftf/tests/misc_tests/test_single_fault.c b/tftf/tests/misc_tests/test_single_fault.c
index e652211..f55d8de 100644
--- a/tftf/tests/misc_tests/test_single_fault.c
+++ b/tftf/tests/misc_tests/test_single_fault.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -9,7 +9,7 @@
 #include <sdei.h>
 #include <tftf_lib.h>
 
-#ifndef AARCH32
+#ifdef __aarch64__
 
 uint64_t serror_received;
 
diff --git a/tftf/tests/misc_tests/test_uncontainable.c b/tftf/tests/misc_tests/test_uncontainable.c
index 79c9031..231e5e8 100644
--- a/tftf/tests/misc_tests/test_uncontainable.c
+++ b/tftf/tests/misc_tests/test_uncontainable.c
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
 #include <tftf_lib.h>
 
-#ifndef AARCH32
+#ifdef __aarch64__
 
 extern void inject_uncontainable(void);
 
diff --git a/tftf/tests/runtime_services/arm_arch_svc/smccc_arch_workaround_1.c b/tftf/tests/runtime_services/arm_arch_svc/smccc_arch_workaround_1.c
index 90a43f3..e88f183 100644
--- a/tftf/tests/runtime_services/arm_arch_svc/smccc_arch_workaround_1.c
+++ b/tftf/tests/runtime_services/arm_arch_svc/smccc_arch_workaround_1.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -14,7 +14,7 @@
 #include <string.h>
 #include <tftf_lib.h>
 
-#ifdef AARCH64
+#ifdef __aarch64__
 #define CORTEX_A57_MIDR	0x410FD070
 #define CORTEX_A72_MIDR	0x410FD080
 #define CORTEX_A73_MIDR 0x410FD090
diff --git a/tftf/tests/runtime_services/arm_arch_svc/smccc_arch_workaround_2.c b/tftf/tests/runtime_services/arm_arch_svc/smccc_arch_workaround_2.c
index cf36e4f..1557e4f 100644
--- a/tftf/tests/runtime_services/arm_arch_svc/smccc_arch_workaround_2.c
+++ b/tftf/tests/runtime_services/arm_arch_svc/smccc_arch_workaround_2.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -14,7 +14,7 @@
 #include <string.h>
 #include <tftf_lib.h>
 
-#ifdef AARCH64
+#ifdef __aarch64__
 #define NOT_REQUIRED_DONOT_INVOKE	-2
 #define NOT_SUPPORTED			-1
 #define IS_REQUIRED			 0
@@ -159,4 +159,4 @@
 	INFO("%s skipped on AArch32\n", __func__);
 	return TEST_RESULT_SKIPPED;
 }
-#endif /* AARCH64 */
+#endif /* __aarch64__ */
diff --git a/tftf/tests/runtime_services/generic/generic_smc.c b/tftf/tests/runtime_services/generic/generic_smc.c
index dc0b102..6d057a6 100644
--- a/tftf/tests/runtime_services/generic/generic_smc.c
+++ b/tftf/tests/runtime_services/generic/generic_smc.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -236,7 +236,7 @@
 	return TEST_RESULT_SUCCESS;
 }
 
-#ifdef AARCH32
+#ifndef __aarch64__
 static test_result_t smc64_fast_caller32(void)
 {
 	/* Valid Fast SMC32 using all 4 return values. */
@@ -295,12 +295,12 @@
 
 	return TEST_RESULT_SUCCESS;
 }
-#endif /* AARCH32 */
+#endif /* !__aarch64__ */
 
 /* Exercise SMC64 calling convention with fast SMC calls. */
 test_result_t smc64_fast(void)
 {
-#ifdef AARCH32
+#ifndef __aarch64__
 	return smc64_fast_caller32();
 #else
 	return smc64_fast_caller64();
diff --git a/tftf/tests/runtime_services/sip_service/test_exec_state_switch.c b/tftf/tests/runtime_services/sip_service/test_exec_state_switch.c
index 713c819..9b272ba 100644
--- a/tftf/tests/runtime_services/sip_service/test_exec_state_switch.c
+++ b/tftf/tests/runtime_services/sip_service/test_exec_state_switch.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -65,7 +65,7 @@
  */
 test_result_t test_exec_state_switch_reset_before(void)
 {
-#ifdef AARCH64
+#ifdef __aarch64__
 	int version;
 	smc_args sip_version_smc = { ARM_SIP_SVC_VERSION };
 	smc_args reset = { SMC_PSCI_SYSTEM_RESET };
@@ -126,7 +126,7 @@
  */
 test_result_t test_exec_state_switch_invalid_pc(void)
 {
-#ifdef AARCH64
+#ifdef __aarch64__
 	int ret;
 
 	smc_args args = {
@@ -159,7 +159,7 @@
  */
 test_result_t test_exec_state_switch_invalid_ctx(void)
 {
-#ifdef AARCH64
+#ifdef __aarch64__
 	int ret;
 
 	smc_args args = {
@@ -191,7 +191,7 @@
  */
 test_result_t test_exec_state_switch_valid(void)
 {
-#ifdef AARCH64
+#ifdef __aarch64__
 	int ret;
 
 	smc_args args = {
@@ -233,7 +233,7 @@
  */
 static inline test_result_t cpu_ping(void)
 {
-#ifdef AARCH64
+#ifdef __aarch64__
 	/* Tell the lead CPU that the calling CPU has entered the test */
 	tftf_send_event(&secondary_booted);
 
@@ -254,7 +254,7 @@
  */
 test_result_t test_exec_state_switch_after_cpu_on(void)
 {
-#ifdef AARCH64
+#ifdef __aarch64__
 	u_register_t other_mpidr, my_mpidr;
 	int ret;
 
diff --git a/tftf/tests/runtime_services/sip_service/test_exec_state_switch_asm.S b/tftf/tests/runtime_services/sip_service/test_exec_state_switch_asm.S
index 577f89f..d865756 100644
--- a/tftf/tests/runtime_services/sip_service/test_exec_state_switch_asm.S
+++ b/tftf/tests/runtime_services/sip_service/test_exec_state_switch_asm.S
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -8,7 +8,7 @@
 
 #define COOKIE_SIZE			20
 
-#ifdef AARCH64
+#ifdef __aarch64__
 /* int do_state_switch(void *) */
 	.globl do_state_switch
 func do_state_switch
@@ -167,7 +167,7 @@
 	.word	0xe1600070	/* smc	#0x0 */
 	.word	0xeafffffe      /* b	. */
 
-#else /* !AARCH64 */
+#else /* !__aarch64__ */
 
 /* Not supported on AArch32 yet */
 func do_state_switch
@@ -175,4 +175,4 @@
 	bx	lr
 endfunc do_state_switch
 
-#endif /* AARCH64 */
+#endif /* __aarch64__ */
diff --git a/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c b/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c
index cc4ad19..708ea13 100644
--- a/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c
+++ b/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -293,7 +293,7 @@
  */
 test_result_t test_affinity_info_level3(void)
 {
-#ifndef AARCH32
+#ifdef __aarch64__
 	int expected_values[3];
 	uint64_t target_mpid;
 	int32_t aff_info;
diff --git a/tftf/tests/runtime_services/standard_service/sdei/system_tests/sdei_entrypoint.S b/tftf/tests/runtime_services/standard_service/sdei/system_tests/sdei_entrypoint.S
index 27ffa39..655bb24 100644
--- a/tftf/tests/runtime_services/standard_service/sdei/system_tests/sdei_entrypoint.S
+++ b/tftf/tests/runtime_services/standard_service/sdei/system_tests/sdei_entrypoint.S
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -16,7 +16,7 @@
 	.local	event_handled
 	.comm	event_handled, PLATFORM_CORE_COUNT * 4, 8
 
-#ifdef AARCH64
+#ifdef __aarch64__
 func sdei_entrypoint
 	stp	xzr, x30, [sp, #-16]!
 	bl	sdei_event_handler
diff --git a/tftf/tests/xlat_lib_v2/xlat_lib_v2_tests.c b/tftf/tests/xlat_lib_v2/xlat_lib_v2_tests.c
index a62bb91..519ff16 100644
--- a/tftf/tests/xlat_lib_v2/xlat_lib_v2_tests.c
+++ b/tftf/tests/xlat_lib_v2/xlat_lib_v2_tests.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -67,7 +67,7 @@
 	 * Performs stage 1 address translation for the current EL, with
 	 * read permissions.
 	 */
-#ifdef AARCH32
+#ifndef __aarch64__
 	if (IS_IN_HYP())
 		write_ats1hr(base_va);
 	else
@@ -497,7 +497,7 @@
 		return TEST_RESULT_FAIL;
 	}
 
-#if AARCH64
+#ifdef __aarch64__
 	unsigned long long memory_base_pa;
 
 	/*
@@ -644,7 +644,7 @@
 		return TEST_RESULT_FAIL;
 	}
 
-#if AARCH64
+#ifdef __aarch64__
 	/*
 	 * 3) Try to allocate at least 1 GB aligned. There is only room for this
 	 * in AArch64.