libc: Update includes

Reflect the changes in the structure of libc.

NB: the include of stdarg.h in nvm_results_helpers.c is not in alphabetical
order because it needs to be included before stdio.h. Fixing this would require
further changes.

Change-Id: I07f62a3450802833408ff3e1f950fd3b643e5e33
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
diff --git a/include/common/debug.h b/include/common/debug.h
index 53eebf7..9b2d842 100644
--- a/include/common/debug.h
+++ b/include/common/debug.h
@@ -65,6 +65,12 @@
 # define VERBOSE(...)
 #endif
 
+#if ENABLE_BACKTRACE
+void backtrace(const char *cookie);
+#else
+#define backtrace(x)
+#endif
+
 /*
  * For the moment this panic function is very basic: report an error and
  * spin. This can be expanded in the future to provide more information.
diff --git a/include/common/param_header.h b/include/common/param_header.h
index 32763dd..7834cbb 100644
--- a/include/common/param_header.h
+++ b/include/common/param_header.h
@@ -36,7 +36,7 @@
 
 #ifndef __ASSEMBLY__
 
-#include <types.h>
+#include <stdint.h>
 
 /***************************************************************************
  * This structure provides version information and the size of the
diff --git a/include/drivers/console.h b/include/drivers/console.h
index abbe356..72decb9 100644
--- a/include/drivers/console.h
+++ b/include/drivers/console.h
@@ -14,7 +14,7 @@
 
 #ifndef __ASSEMBLY__
 
-#include <types.h>
+#include <stdint.h>
 
 int console_init(uintptr_t base_addr,
 		unsigned int uart_clk, unsigned int baud_rate);
diff --git a/include/lib/irq.h b/include/lib/irq.h
index 1628221..6a37e05 100644
--- a/include/lib/irq.h
+++ b/include/lib/irq.h
@@ -7,6 +7,7 @@
 #ifndef __IRQ_H__
 #define  __IRQ_H__
 
+#include <cdefs.h>
 #include <platform_def.h> /* For CACHE_WRITEBACK_GRANULE */
 #include <stdint.h>
 
diff --git a/include/lib/power_management.h b/include/lib/power_management.h
index d2d6901..3d8e961 100644
--- a/include/lib/power_management.h
+++ b/include/lib/power_management.h
@@ -11,7 +11,6 @@
 #include <psci.h>
 #include <spinlock.h>
 #include <stdint.h>
-#include <types.h>
 
 /* Set of states of an affinity node as seen by the Test Framework */
 typedef enum {
diff --git a/include/lib/tftf_lib.h b/include/lib/tftf_lib.h
index 58112b4..3f60fec 100644
--- a/include/lib/tftf_lib.h
+++ b/include/lib/tftf_lib.h
@@ -13,7 +13,6 @@
 #include <arch_helpers.h>
 #include <stdbool.h>
 #include <stdint.h>
-#include <sys/types.h>
 
 /*
  * Possible error codes for signaling the result of a test
diff --git a/include/runtime_services/secure_el0_payloads/secure_partition.h b/include/runtime_services/secure_el0_payloads/secure_partition.h
index 712337e..0a41dde 100644
--- a/include/runtime_services/secure_el0_payloads/secure_partition.h
+++ b/include/runtime_services/secure_el0_payloads/secure_partition.h
@@ -8,7 +8,7 @@
 #define SECURE_PARTITION_H
 
 #include <param_header.h>
-#include <types.h>
+#include <stdint.h>
 #include <utils_def.h>
 
 /*
diff --git a/include/runtime_services/spci_helpers.h b/include/runtime_services/spci_helpers.h
index 3452452..a64591e 100644
--- a/include/runtime_services/spci_helpers.h
+++ b/include/runtime_services/spci_helpers.h
@@ -18,7 +18,6 @@
 #ifndef __ASSEMBLY__
 
 #include <stdint.h>
-#include <types.h>
 
 int spci_service_handle_open(uint16_t client_id, uint16_t *handle,
 			     uint32_t uuid1, uint32_t uuid2,
diff --git a/lib/compiler-rt/builtins/int_lib.h b/lib/compiler-rt/builtins/int_lib.h
index 724d5a4..2acc4bf 100644
--- a/lib/compiler-rt/builtins/int_lib.h
+++ b/lib/compiler-rt/builtins/int_lib.h
@@ -60,9 +60,8 @@
 #define UNUSED __attribute__((unused))
 #endif
 
-#include <sys/limits.h>
-#include <sys/stdint.h>
-#include <sys/types.h>
+#include <limits.h>
+#include <stdint.h>
 
 /* Include the commonly used internal type definitions. */
 #include "int_types.h"
diff --git a/lib/power_management/suspend/suspend_private.h b/lib/power_management/suspend/suspend_private.h
index dfc2e93..9949dc6 100644
--- a/lib/power_management/suspend/suspend_private.h
+++ b/lib/power_management/suspend/suspend_private.h
@@ -16,7 +16,6 @@
 #include <power_management.h>
 #include <stdint.h>
 #include <string.h>
-#include <types.h>
 
 #define NR_CTX_REGS 6
 
diff --git a/lib/utils/uuid.c b/lib/utils/uuid.c
index 21747a2..2c79dfb 100644
--- a/lib/utils/uuid.c
+++ b/lib/utils/uuid.c
@@ -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
  */
@@ -10,8 +10,8 @@
 #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 }";
+static const char *uuid_str_fmt = "{ 0x%08x, 0x%04x, 0x%04x, 0x%02x, 0x%02x, "
+	"0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x }";
 
 
 unsigned int is_uuid_null(const uuid_t *uuid)
diff --git a/spm/cactus/cactus.h b/spm/cactus/cactus.h
index 2f12f5c..0b06eb2 100644
--- a/spm/cactus/cactus.h
+++ b/spm/cactus/cactus.h
@@ -7,7 +7,7 @@
 #ifndef __CACTUS_H__
 #define __CACTUS_H__
 
-#include <types.h>
+#include <stdint.h>
 
 /* Linker symbols used to figure out the memory layout of Cactus. */
 extern uintptr_t __TEXT_START__, __TEXT_END__;
diff --git a/spm/cactus/cactus_tests_memory_attributes.c b/spm/cactus/cactus_tests_memory_attributes.c
index 3b56d60..bed6f0b 100644
--- a/spm/cactus/cactus_tests_memory_attributes.c
+++ b/spm/cactus/cactus_tests_memory_attributes.c
@@ -12,7 +12,7 @@
 #include <sp_helpers.h>
 #include <sprt_svc.h>
 #include <stdio.h>
-#include <types.h>
+#include <stdint.h>
 #include <xlat_tables_defs.h>
 
 #include "cactus.h"
diff --git a/spm/cactus/cactus_tests_misc.c b/spm/cactus/cactus_tests_misc.c
index 50b8e6a..39eb752 100644
--- a/spm/cactus/cactus_tests_misc.c
+++ b/spm/cactus/cactus_tests_misc.c
@@ -11,7 +11,7 @@
 #include <spm_svc.h>
 #include <sprt_client.h>
 #include <sprt_svc.h>
-#include <types.h>
+#include <stdint.h>
 
 #include "cactus.h"
 #include "cactus_tests.h"
diff --git a/spm/cactus/cactus_tests_system_setup.c b/spm/cactus/cactus_tests_system_setup.c
index 685d82d..cead8e3 100644
--- a/spm/cactus/cactus_tests_system_setup.c
+++ b/spm/cactus/cactus_tests_system_setup.c
@@ -7,7 +7,7 @@
 #include <arch_helpers.h>
 #include <debug.h>
 #include <sp_helpers.h>
-#include <types.h>
+#include <stdint.h>
 
 #include "cactus.h"
 
diff --git a/spm/common/sp_helpers.h b/spm/common/sp_helpers.h
index 1bd4425..d06fec3 100644
--- a/spm/common/sp_helpers.h
+++ b/spm/common/sp_helpers.h
@@ -8,7 +8,6 @@
 #define SP_HELPERS_H
 
 #include <stdint.h>
-#include <sys/types.h>
 
 typedef struct {
 	u_register_t fid;
diff --git a/spm/ivy/ivy.h b/spm/ivy/ivy.h
index b312540..c5cac2e 100644
--- a/spm/ivy/ivy.h
+++ b/spm/ivy/ivy.h
@@ -7,7 +7,7 @@
 #ifndef IVY_H
 #define IVY_H
 
-#include <types.h>
+#include <stdint.h>
 
 /* Linker symbols used to figure out the memory layout of Ivy. */
 extern uintptr_t __TEXT_START__, __TEXT_END__;
diff --git a/tftf/framework/main.c b/tftf/framework/main.c
index 7f987c0..67f565d 100644
--- a/tftf/framework/main.c
+++ b/tftf/framework/main.c
@@ -17,8 +17,8 @@
 #include <power_management.h>
 #include <psci.h>
 #include <sgi.h>
+#include <stdint.h>
 #include <string.h>
-#include <sys/types.h>
 #include <tftf.h>
 #include <tftf_lib.h>
 #include <timer.h>
diff --git a/tftf/framework/nvm_results_helpers.c b/tftf/framework/nvm_results_helpers.c
index 34ef19f..78df642 100644
--- a/tftf/framework/nvm_results_helpers.c
+++ b/tftf/framework/nvm_results_helpers.c
@@ -4,14 +4,18 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+/*
+ * The include of stdarg.h is not in alphabetical order because it needs to be
+ * included before stdio.h. Fixing this would require further changes.
+ */
 #include <arch_helpers.h>
+#include <stdarg.h>
 #include <assert.h>
 #include <debug.h>
 #include <nvm.h>
 #include <platform.h>
 #include <spinlock.h>
-#include <stdarg.h>
-#include <string.h>
+#include <stdio.h>
 
 /*
  * Temporary buffer to store 1 test output.
diff --git a/tftf/framework/timer/timer_framework.c b/tftf/framework/timer/timer_framework.c
index 38106cf..d856abe 100644
--- a/tftf/framework/timer/timer_framework.c
+++ b/tftf/framework/timer/timer_framework.c
@@ -17,7 +17,7 @@
 #include <sgi.h>
 #include <spinlock.h>
 #include <stddef.h>
-#include <sys/types.h>
+#include <stdint.h>
 #include <tftf.h>
 #include <timer.h>
 
diff --git a/tftf/tests/runtime_services/standard_service/pmf/api_tests/runtime_instr/test_pmf_rt_instr.c b/tftf/tests/runtime_services/standard_service/pmf/api_tests/runtime_instr/test_pmf_rt_instr.c
index 3a3701e..3c1fdaf 100644
--- a/tftf/tests/runtime_services/standard_service/pmf/api_tests/runtime_instr/test_pmf_rt_instr.c
+++ b/tftf/tests/runtime_services/standard_service/pmf/api_tests/runtime_instr/test_pmf_rt_instr.c
@@ -13,7 +13,7 @@
 #include <psci.h>
 #include <smccc.h>
 #include <string.h>
-#include <sys/errno.h>
+#include <errno.h>
 #include <tftf_lib.h>
 #include <timer.h>