Trusted Firmware-A Tests, version 2.0

This is the first public version of the tests for the Trusted
Firmware-A project. Please see the documentation provided in the
source tree for more details.

Change-Id: I6f3452046a1351ac94a71b3525c30a4ca8db7867
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Co-authored-by: amobal01 <amol.balasokamble@arm.com>
Co-authored-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Co-authored-by: Asha R <asha.r@arm.com>
Co-authored-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
Co-authored-by: David Cunado <david.cunado@arm.com>
Co-authored-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
Co-authored-by: Douglas Raillard <douglas.raillard@arm.com>
Co-authored-by: dp-arm <dimitris.papastamos@arm.com>
Co-authored-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Co-authored-by: Jonathan Wright <jonathan.wright@arm.com>
Co-authored-by: Kévin Petit <kevin.petit@arm.com>
Co-authored-by: Roberto Vargas <roberto.vargas@arm.com>
Co-authored-by: Sathees Balya <sathees.balya@arm.com>
Co-authored-by: Shawon Roy <Shawon.Roy@arm.com>
Co-authored-by: Soby Mathew <soby.mathew@arm.com>
Co-authored-by: Thomas Abraham <thomas.abraham@arm.com>
Co-authored-by: Vikram Kanigiri <vikram.kanigiri@arm.com>
Co-authored-by: Yatharth Kochar <yatharth.kochar@arm.com>
diff --git a/lib/utils/uuid.c b/lib/utils/uuid.c
new file mode 100644
index 0000000..21747a2
--- /dev/null
+++ b/lib/utils/uuid.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+#include <uuid_utils.h>
+
+/* Format string to print a UUID */
+static const char *uuid_str_fmt = "{ 0x%.8x, 0x%.4x, 0x%.4x, 0x%.2x, 0x%.2x, "
+	"0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }";
+
+
+unsigned int is_uuid_null(const uuid_t *uuid)
+{
+	const uuid_t uuid_null = {0};
+
+	return memcmp(uuid, &uuid_null, sizeof(uuid_t)) == 0;
+}
+
+char *uuid_to_str(const uuid_t *uuid, char *str)
+{
+	assert(uuid != NULL);
+	assert(str != NULL);
+
+	snprintf(str, UUID_STR_SIZE, uuid_str_fmt,
+		 uuid->time_low, uuid->time_mid, uuid->time_hi_and_version,
+		 uuid->clock_seq_hi_and_reserved, uuid->clock_seq_low,
+		 uuid->node[0], uuid->node[1], uuid->node[2], uuid->node[3],
+		 uuid->node[4], uuid->node[5]);
+
+	return str;
+}
+
+unsigned int uuid_equal(const uuid_t *uuid1, const uuid_t *uuid2)
+{
+	return memcmp(uuid1, uuid2, sizeof(uuid_t)) == 0;
+}
+
+uuid_t *make_uuid_from_4words(uuid_t *uuid,
+			      uint32_t w0,
+			      uint32_t w1,
+			      uint32_t w2,
+			      uint32_t w3)
+{
+	uint32_t *uuid32;
+
+	assert(uuid != NULL);
+
+	uuid32 = (uint32_t *) uuid;
+	uuid32[0] = w0;
+	uuid32[1] = w1;
+	uuid32[2] = w2;
+	uuid32[3] = w3;
+
+	return uuid;
+}