Core: Add necessary includes in some header files.

Some header files in TF-M core don't include necessary header
files.
Therefore, source files including those header files have to
explicitly include some indirect header files. It may bring in some
confusions.
Add necessary includes in some header files as described in above.
Remove unnecessary includes in source files.

Change-Id: Iaa3887c42c04475378c234ba010d5b5b043de9b4
Signed-off-by: David Hu <david.hu@arm.com>
diff --git a/interface/include/psa_service.h b/interface/include/psa_service.h
index 6453aed..e72d0df 100644
--- a/interface/include/psa_service.h
+++ b/interface/include/psa_service.h
@@ -14,6 +14,8 @@
 
 #include <inttypes.h>
 
+#include "psa_client.h"
+
 /********************** PSA Secure Partition Macros and Types ****************/
 
 /* PSA wait timeouts */
diff --git a/secure_fw/core/ipc/include/tfm_internal_defines.h b/secure_fw/core/ipc/include/tfm_internal_defines.h
index a5382c5..e948e7e 100644
--- a/secure_fw/core/ipc/include/tfm_internal_defines.h
+++ b/secure_fw/core/ipc/include/tfm_internal_defines.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -7,6 +7,8 @@
 #ifndef __TFM_INTERNAL_DEFINES_H__
 #define __TFM_INTERNAL_DEFINES_H__
 
+#include <inttypes.h>
+
 /* IPC internal return status */
 #define IPC_SUCCESS                     0
 #define IPC_ERROR_BAD_PARAMETERS        (INT32_MIN)
diff --git a/secure_fw/core/ipc/include/tfm_message_queue.h b/secure_fw/core/ipc/include/tfm_message_queue.h
index 3edf3fb..692be93 100644
--- a/secure_fw/core/ipc/include/tfm_message_queue.h
+++ b/secure_fw/core/ipc/include/tfm_message_queue.h
@@ -7,6 +7,9 @@
 #ifndef __TFM_MESSAGE_QUEUE_H__
 #define __TFM_MESSAGE_QUEUE_H__
 
+#include "psa_service.h"
+#include "tfm_wait.h"
+
 #define TFM_MSG_QUEUE_MAX_MSG_NUM   16
 #define TFM_MSG_MAGIC               0x15154343
 /* Message struct to collect parameter from client */
diff --git a/secure_fw/core/ipc/include/tfm_spm.h b/secure_fw/core/ipc/include/tfm_spm.h
index 13e83d0..d8bde34 100644
--- a/secure_fw/core/ipc/include/tfm_spm.h
+++ b/secure_fw/core/ipc/include/tfm_spm.h
@@ -9,6 +9,7 @@
 
 #include <stdbool.h>
 #include "tfm_list.h"
+#include "tfm_message_queue.h"
 #include "tfm_secure_api.h"
 
 #define TFM_SPM_MAX_ROT_SERV_NUM        28
diff --git a/secure_fw/core/ipc/include/tfm_utils.h b/secure_fw/core/ipc/include/tfm_utils.h
index 17f94c0..18163a0 100644
--- a/secure_fw/core/ipc/include/tfm_utils.h
+++ b/secure_fw/core/ipc/include/tfm_utils.h
@@ -7,6 +7,8 @@
 #ifndef __TFM_UTILS_H__
 #define __TFM_UTILS_H__
 
+#include <stdio.h>
+
 /* CPU spin here */
 void tfm_panic(void);
 
diff --git a/secure_fw/core/ipc/include/tfm_wait.h b/secure_fw/core/ipc/include/tfm_wait.h
index 0bb6ea3..d116f2f 100644
--- a/secure_fw/core/ipc/include/tfm_wait.h
+++ b/secure_fw/core/ipc/include/tfm_wait.h
@@ -7,6 +7,8 @@
 #ifndef __TFM_WAIT_H__
 #define __TFM_WAIT_H__
 
+#include <stddef.h>
+
 #include "cmsis_compiler.h"
 
 /* The magic number has two purposes: corruption detection and debug */
diff --git a/secure_fw/core/ipc/tfm_message_queue.c b/secure_fw/core/ipc/tfm_message_queue.c
index 83ebf50..1a7790e 100644
--- a/secure_fw/core/ipc/tfm_message_queue.c
+++ b/secure_fw/core/ipc/tfm_message_queue.c
@@ -1,15 +1,9 @@
 /*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
  */
-#include <inttypes.h>
-#include <stdio.h>
-#include "tfm_thread.h"
-#include "tfm_wait.h"
-#include "psa_client.h"
-#include "psa_service.h"
 #include "tfm_internal_defines.h"
 #include "tfm_message_queue.h"
 
diff --git a/secure_fw/core/ipc/tfm_pools.c b/secure_fw/core/ipc/tfm_pools.c
index 83342b8..2adb70e 100644
--- a/secure_fw/core/ipc/tfm_pools.c
+++ b/secure_fw/core/ipc/tfm_pools.c
@@ -6,7 +6,6 @@
  */
 #include <inttypes.h>
 #include <stdbool.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include "tfm_thread.h"
 #include "tfm_wait.h"
diff --git a/secure_fw/core/ipc/tfm_spm.c b/secure_fw/core/ipc/tfm_spm.c
index d16b13a..0eee6f4 100644
--- a/secure_fw/core/ipc/tfm_spm.c
+++ b/secure_fw/core/ipc/tfm_spm.c
@@ -7,7 +7,6 @@
 #include <inttypes.h>
 #include <limits.h>
 #include <stdbool.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include "psa_client.h"
 #include "psa_service.h"
diff --git a/secure_fw/core/ipc/tfm_svcalls.c b/secure_fw/core/ipc/tfm_svcalls.c
index 4294b56..c02a5b8 100644
--- a/secure_fw/core/ipc/tfm_svcalls.c
+++ b/secure_fw/core/ipc/tfm_svcalls.c
@@ -6,7 +6,6 @@
  */
 #include <inttypes.h>
 #include <stdbool.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include "psa_client.h"
 #include "psa_service.h"
diff --git a/secure_fw/core/ipc/tfm_thread.c b/secure_fw/core/ipc/tfm_thread.c
index 21f2209..7322e6c 100644
--- a/secure_fw/core/ipc/tfm_thread.c
+++ b/secure_fw/core/ipc/tfm_thread.c
@@ -5,7 +5,6 @@
  *
  */
 #include <inttypes.h>
-#include <stdio.h>
 #include "tfm_arch_v8m.h"
 #include "tfm_thread.h"
 #include "tfm_utils.h"
diff --git a/secure_fw/core/ipc/tfm_utils.c b/secure_fw/core/ipc/tfm_utils.c
index 1586633..591e243 100644
--- a/secure_fw/core/ipc/tfm_utils.c
+++ b/secure_fw/core/ipc/tfm_utils.c
@@ -5,7 +5,6 @@
  *
  */
 #include <inttypes.h>
-#include <stdio.h>
 #include "tfm_utils.h"
 
 void tfm_panic(void)
diff --git a/secure_fw/core/ipc/tfm_wait.c b/secure_fw/core/ipc/tfm_wait.c
index 44c801c..8bbe64a 100644
--- a/secure_fw/core/ipc/tfm_wait.c
+++ b/secure_fw/core/ipc/tfm_wait.c
@@ -4,7 +4,6 @@
  * SPDX-License-Identifier: BSD-3-Clause
  *
  */
-#include <stdio.h>
 #include "tfm_thread.h"
 #include "tfm_utils.h"
 #include "tfm_wait.h"
diff --git a/secure_fw/core/tfm_nspm.c b/secure_fw/core/tfm_nspm.c
index 3db30c2..564e1f8 100644
--- a/secure_fw/core/tfm_nspm.c
+++ b/secure_fw/core/tfm_nspm.c
@@ -5,7 +5,6 @@
  *
  */
 
-#include <stdio.h>
 #include <stdbool.h>
 #include "secure_utilities.h"
 #include "tfm_api.h"