SMC fuzzing module integration.

This includes one test with one seed as
the initial implementation.  A future upgrade will include an enhanced
seeding strategy.  The patch includes an example device tree file with
the actual test (sdei.dts) leveraging the SDEI functions that can be called
without reference to system state.  Platform CI will have a single
TFTF config to be used in all future testing.  Once both branches
of TFA tests and platform CI are checked in a user can invoke the
testing with:

workspace=<workspace location> test_groups=fvp-aarch64-sdei,fvp-smcfuzzing:fvp-tftf-fip.tftf-aemv8a test_run=1 bin_mode=debug retain_paths=1 ./platform-ci/script/run_local_ci.sh

Signed-off-by: Mark Dykes <mark.dykes@arm.com>
Change-Id: Ic290e7255bcfd845c0d22037e0b670a6691541df
diff --git a/smc_fuzz/include/fifo3d.h b/smc_fuzz/include/fifo3d.h
new file mode 100644
index 0000000..c04567c
--- /dev/null
+++ b/smc_fuzz/include/fifo3d.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+
+#ifndef FIFO3D_H
+#define FIFO3D_H
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "smcmalloc.h"
+
+struct fifo3d {
+	char ***nnfifo;
+	char ***fnamefifo;
+	int **biasfifo;
+	int col;
+	int curr_col;
+	int *row;
+};
+
+/*
+ * Push function name string into raw data structure
+ */
+void push_3dfifo_fname(struct fifo3d *f3d, char *fname);
+
+/*
+ * Push bias value into raw data structure
+ */
+void push_3dfifo_bias(struct fifo3d *f3d, int bias);
+
+/*
+ * Create new column and/or row for raw data structure for newly
+ * found node from device tree
+ */
+void push_3dfifo_col(struct fifo3d *f3d, char *entry, struct memmod *mmod);
+
+#endif /* FIFO3D_H */
diff --git a/smc_fuzz/include/smcmalloc.h b/smc_fuzz/include/smcmalloc.h
new file mode 100644
index 0000000..129e07c
--- /dev/null
+++ b/smc_fuzz/include/smcmalloc.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef SMCMALLOC_H
+#define SMCMALLOC_H
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "fifo3d.h"
+
+#define TOTALMEMORYSIZE (0x10000)
+#define BLKSPACEDIV (4)
+#define TOPBITSIZE (20)
+#define MAX_NAME_CHARS 50
+
+struct memblk {
+	unsigned int address;
+	unsigned int size;
+	int valid;
+};
+
+struct memmod {
+	char memory[TOTALMEMORYSIZE];
+	unsigned int nmemblk;
+	unsigned int maxmemblk;
+	unsigned int checkadd;
+	struct memblk *memptr;
+	struct memblk *memptrend;
+	unsigned int mallocdeladd[((TOTALMEMORYSIZE/BLKSPACEDIV)/sizeof(struct memblk))];
+	struct memblk *precblock[((TOTALMEMORYSIZE/BLKSPACEDIV)/sizeof(struct memblk))];
+	struct memblk *trailblock[((TOTALMEMORYSIZE/BLKSPACEDIV)/sizeof(struct memblk))];
+	struct memblk *memblkqueue[((TOTALMEMORYSIZE/BLKSPACEDIV)/sizeof(struct memblk))];
+	unsigned int memallocsize[((TOTALMEMORYSIZE/BLKSPACEDIV)/sizeof(struct memblk))];
+	unsigned int mallocdeladd_valid[((TOTALMEMORYSIZE/BLKSPACEDIV)/sizeof(struct memblk))];
+	unsigned int mallocdeladd_queue[((TOTALMEMORYSIZE/BLKSPACEDIV)/sizeof(struct memblk))];
+	unsigned int checksa[4*((TOTALMEMORYSIZE/BLKSPACEDIV)/sizeof(struct memblk))];
+	unsigned int checkea[4*((TOTALMEMORYSIZE/BLKSPACEDIV)/sizeof(struct memblk))];
+	unsigned int cntdeladd;
+	unsigned int ptrmemblkqueue;
+	unsigned int mallocdeladd_queue_cnt;
+	unsigned int checknumentries;
+	unsigned int memerror;
+};
+
+struct peret {
+	unsigned int tbit;
+	unsigned int pow2;
+};
+
+void initmem(void);
+struct peret priorityencoder(unsigned int);
+void *smcmalloc(unsigned int, struct memmod*);
+int smcfree(void*, struct memmod *);
+#ifdef DEBUG_SMC_MALLOC
+void displayblocks(struct memmod *);
+void displaymalloctable(struct memmod *);
+#endif
+
+#endif /* SMCMALLOC_H */