SPM: Replace SP init flag by generic state enum

Instead of just knowing if the Secure Partition is being initialized or
not, this generic state enum can be used to tell if the Secure Partition
is busy and to add more states in the future if needed.

Also, the spinlock of the secure_partition_context_t structure now only
protects against concurrent accesses to the state of the secure
partition. Previously, it used to lock down the whole structure, thus
preventing one CPU to access any of its fields while another CPU was
executing the partition.

Change-Id: I51215328e2ca8ea2452f92e4a1cb237415958b22
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
diff --git a/services/std_svc/spm/spm_private.h b/services/std_svc/spm/spm_private.h
index 598762e..64d8cf8 100644
--- a/services/std_svc/spm/spm_private.h
+++ b/services/std_svc/spm/spm_private.h
@@ -35,12 +35,19 @@
 #include <stdint.h>
 #include <xlat_tables_v2.h>
 
+typedef enum secure_partition_state {
+	SP_STATE_RESET = 0,
+	SP_STATE_IDLE,
+	SP_STATE_BUSY
+} sp_state_t;
+
 typedef struct sp_context {
 	uint64_t c_rt_ctx;
 	cpu_context_t cpu_ctx;
 	xlat_ctx_t *xlat_ctx_handle;
-	unsigned int sp_init_in_progress;
-	spinlock_t lock;
+
+	sp_state_t state;
+	spinlock_t state_lock;
 } sp_context_t;
 
 /* Assembly helpers */