feat(amd): add test for trustzone version API

Adds a test to verify the get_trustzone_version() API, which retrieves
the current TrustZone version from the firmware.

Change-Id: I92876df6ccf970b5474eb86f48f97af9168704bb
Signed-off-by: Madhav Bhatt <madhav.bhatt@amd.com>
diff --git a/tftf/tests/plat/amd/common/common_files/eemi_api.c b/tftf/tests/plat/amd/common/common_files/eemi_api.c
index 7555248..3f0a407 100644
--- a/tftf/tests/plat/amd/common/common_files/eemi_api.c
+++ b/tftf/tests/plat/amd/common/common_files/eemi_api.c
@@ -402,3 +402,15 @@
 
 	return eemi_call(PM_INIT_FINALIZE, 0, 0, 0, 0, 0, 0, 0, ret_payload);
 }
+
+int get_trustzone_version(uint32_t *tz_version)
+{
+	uint32_t ret_payload[PAYLOAD_ARG_CNT];
+	int ret;
+
+	ret = eemi_call(PM_GET_TRUSTZONE_VERSION, 0, 0, 0, 0, 0, 0, 0, ret_payload);
+	if (ret == PM_RET_SUCCESS)
+		*tz_version = ret_payload[1];
+
+	return ret;
+}
diff --git a/tftf/tests/plat/amd/common/common_files/eemi_api.h b/tftf/tests/plat/amd/common/common_files/eemi_api.h
index abd0e1b..d51b496 100644
--- a/tftf/tests/plat/amd/common/common_files/eemi_api.h
+++ b/tftf/tests/plat/amd/common/common_files/eemi_api.h
@@ -64,5 +64,6 @@
 int xpm_pinctrl_set_parameter(const uint32_t pin_id, const uint32_t param_id,
 			      const uint32_t param_val);
 int xpm_init_finalize(void);
+int get_trustzone_version(uint32_t *tz_version);
 
 #endif /* __EEMI_API_H__ */
diff --git a/tftf/tests/plat/amd/common/common_files/xpm_defs.h b/tftf/tests/plat/amd/common/common_files/xpm_defs.h
index 8235c89..2551110 100644
--- a/tftf/tests/plat/amd/common/common_files/xpm_defs.h
+++ b/tftf/tests/plat/amd/common/common_files/xpm_defs.h
@@ -29,8 +29,9 @@
 #define PM_ERR_VERSION		2014L
 
 /* TF-A only commands */
-#define PM_GET_CALLBACK_DATA	0xa01U
-#define TF_A_PM_REGISTER_SGI	0xa04U
+#define PM_GET_CALLBACK_DATA		0xa01U
+#define PM_GET_TRUSTZONE_VERSION	0xa03U
+#define TF_A_PM_REGISTER_SGI		0xa04U
 
 /* RPU operation mode */
 #define XPM_RPU_MODE_LOCKSTEP   0U
diff --git a/tftf/tests/plat/amd/common/get_trustzone_version/get_trustzone_version.c b/tftf/tests/plat/amd/common/get_trustzone_version/get_trustzone_version.c
new file mode 100644
index 0000000..16cfa31
--- /dev/null
+++ b/tftf/tests/plat/amd/common/get_trustzone_version/get_trustzone_version.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2025, Advanced Micro Devices, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "eemi_api.h"
+#include "xpm_defs.h"
+
+/*
+ * This function tests the behavior of the get_trustzone_version() function,
+ * which retrieves the trustzone version.
+ */
+test_result_t test_trustzone_version(void)
+{
+	uint32_t tz_version = 0U;
+	uint32_t major, minor;
+	int32_t status;
+
+	status = get_trustzone_version(&tz_version);
+	if (status != PM_RET_SUCCESS) {
+		tftf_testcase_printf("%s ERROR reading trustzone version, "
+				     "Status: 0x%x\n", __func__, status);
+		return TEST_RESULT_FAIL;
+	}
+
+	major = VERSION_MAJOR(tz_version);
+	minor = VERSION_MINOR(tz_version);
+	tftf_testcase_printf("%s Trustzone version: %d.%d\n", __func__, major, minor);
+
+	return TEST_RESULT_SUCCESS;
+}
diff --git a/tftf/tests/tests-versal.xml b/tftf/tests/tests-versal.xml
index 9b68a66..8dbf3d0 100644
--- a/tftf/tests/tests-versal.xml
+++ b/tftf/tests/tests-versal.xml
@@ -29,6 +29,7 @@
       <testcase name="Set pin function without requesting pin" function="test_set_pin_function_of_unrequested_pin" />
       <testcase name="Set pin parameter without requesting pin" function="test_set_pin_parameter_of_unrequested_pin" />
       <testcase name="PM Init Finalize" function="test_init_finalize" />
+      <testcase name="Trustzone version" function="test_trustzone_version" />
     </testsuite>
 
   </testsuites>