aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2018-12-21 09:48:17 +0000
committerTrustedFirmware Code Review <review@review.trustedfirmware.org>2018-12-21 09:48:17 +0000
commit485cee0e136763febc859b8eddd5c54520987725 (patch)
treec578ab7cb2a16dd3f7687c98d5ce62ad8732a9ae
parentba7695b39bb82d5ceba093b0c18dd38cc9af61c3 (diff)
parentdfa5ed9fc80f7aad9a0b284a1844aae3251fe75e (diff)
downloadtf-a-tests-485cee0e136763febc859b8eddd5c54520987725.tar.gz
Merge changes from topic "sb/terse-output"
* changes: Remove redundant error message in tftf_initialise_timer() Remove prints from VExpress NOR flash driver Remove prints in get_overall_test_result() Remove SHELL_COLOR build flag Do not print CPU MPID in mp_printf() Use vprintf() inside mp_printf() Add vprintf() in standard C library
-rw-r--r--Makefile2
-rw-r--r--defaults.mk3
-rw-r--r--docs/user-guide.rst5
-rw-r--r--drivers/io/vexpress_nor/io_vexpress_nor_hw.c3
-rw-r--r--include/common/debug.h23
-rw-r--r--include/lib/stdlib/stdio.h2
-rw-r--r--lib/stdlib/printf.c30
-rw-r--r--lib/utils/mp_printf.c58
-rw-r--r--spm/cactus/cactus.mk2
-rw-r--r--spm/ivy/ivy.mk2
-rw-r--r--tftf/framework/main.c4
-rw-r--r--tftf/framework/timer/timer_framework.c10
12 files changed, 34 insertions, 110 deletions
diff --git a/Makefile b/Makefile
index 9c4ae7eb..74568582 100644
--- a/Makefile
+++ b/Makefile
@@ -133,7 +133,6 @@ $(eval $(call assert_boolean,ENABLE_ASSERTIONS))
$(eval $(call assert_boolean,FIRMWARE_UPDATE))
$(eval $(call assert_boolean,FWU_BL_TEST))
$(eval $(call assert_boolean,NEW_TEST_SESSION))
-$(eval $(call assert_boolean,SHELL_COLOR))
$(eval $(call assert_boolean,USE_NVM))
################################################################################
@@ -148,7 +147,6 @@ $(eval $(call add_define,TFTF_DEFINES,ENABLE_ASSERTIONS))
$(eval $(call add_define,TFTF_DEFINES,LOG_LEVEL))
$(eval $(call add_define,TFTF_DEFINES,NEW_TEST_SESSION))
$(eval $(call add_define,TFTF_DEFINES,PLAT_${PLAT}))
-$(eval $(call add_define,TFTF_DEFINES,SHELL_COLOR))
$(eval $(call add_define,TFTF_DEFINES,USE_NVM))
ifeq (${ARCH},aarch32)
diff --git a/defaults.mk b/defaults.mk
index 63c1b2e1..0f746526 100644
--- a/defaults.mk
+++ b/defaults.mk
@@ -37,9 +37,6 @@ FWU_BL_TEST := 1
# framework should try to resume a previous one if it was interrupted
NEW_TEST_SESSION := 1
-# Use of shell colors
-SHELL_COLOR := 0
-
# Use non volatile memory for storing results
USE_NVM := 0
diff --git a/docs/user-guide.rst b/docs/user-guide.rst
index 397b4c2c..e11a6bfa 100644
--- a/docs/user-guide.rst
+++ b/docs/user-guide.rst
@@ -367,11 +367,6 @@ TFTF build options
session was interrupted and resume it. It can take either 1 (always
start new session) or 0 (resume session as appropriate). 1 is the default.
-- ``SHELL_COLOR``: Choose whether text messages should use shell's color escape
- sequences to ease identifying which CPU displays it. If enabled, this makes
- each CPU write part of the message in a different color. It can take either
- 0 (disabled) or 1 (enabled) as values. 0 is the default.
-
- ``TESTS``: Set of tests to run. Use the following command to list all
possible sets of tests:
diff --git a/drivers/io/vexpress_nor/io_vexpress_nor_hw.c b/drivers/io/vexpress_nor/io_vexpress_nor_hw.c
index de7b4cef..6e563c9f 100644
--- a/drivers/io/vexpress_nor/io_vexpress_nor_hw.c
+++ b/drivers/io/vexpress_nor/io_vexpress_nor_hw.c
@@ -159,7 +159,6 @@ static int flash_erase_block(const io_nor_flash_spec_t *device,
int err = IO_SUCCESS;
uint32_t status_register;
- VERBOSE("%s : 0x%x\n", __func__, block_offset);
/* Request a block erase and then confirm it */
nor_send_cmd(block_offset, NOR_CMD_BLOCK_ERASE);
nor_send_cmd(block_offset, NOR_CMD_BLOCK_ERASE_ACK);
@@ -359,7 +358,6 @@ int flash_block_write(file_state_t *fp, uint32_t offset,
/* address passed should be block aligned */
assert(!(offset % fp->block_spec->block_size));
- VERBOSE("%s : 0x%x\n", __func__, flash_pos);
/* Unlock block */
flash_unlock_block_if_necessary(fp->block_spec, block_offset);
@@ -398,7 +396,6 @@ int flash_block_write(file_state_t *fp, uint32_t offset,
*written = fp->block_spec->block_size;
lock_block:
- VERBOSE("%s : 0x%x\n", __func__, block_offset);
/* Lock the block once done */
flash_perform_lock_operation(fp->block_spec,
block_offset,
diff --git a/include/common/debug.h b/include/common/debug.h
index bfbff093..216c53d9 100644
--- a/include/common/debug.h
+++ b/include/common/debug.h
@@ -9,34 +9,15 @@
#include <stdio.h>
-/* TODO: Deal with per-image printf functions in a cleaner way. */
-
-#if defined(IMAGE_CACTUS) || defined(IMAGE_IVY)
-/*
- * The register MPIDR_EL1 can't be read from EL0, which means that mp_printf()
- * can't be used.
- */
-#define mp_printf printf
-#else
/*
* Print a formatted string on the UART.
*
* Does the same thing as the standard libc's printf() function but in a MP-safe
* manner, i.e. it can be called from several CPUs simultaneously without
* getting interleaved messages.
- *
- * The messages printed using mp_printf() won't be saved in the test results
- * (use tftf_testcase_output() instead for that). mp_printf() is meant to be
- * used for debug traces only. Unlike messages stored in the tests output which
- * appear only at the end of the test session in the test report, messages
- * printed using mp_printf() will be displayed straight away.
- *
- * Messaged will be prefixed by the CPU MPID issuing the call, like that:
- * [cpu 0x0002] Sending SGI #1 to cpu 0
*/
__attribute__((format(printf, 1, 2)))
void mp_printf(const char *fmt, ...);
-#endif
/*
* The log output macros print output to the console. These macros produce
@@ -44,8 +25,8 @@ void mp_printf(const char *fmt, ...);
* make command line) is greater or equal than the level required for that
* type of log output.
* The format expected is similar to printf(). For example:
- * INFO("Info %s.\n", "message") -> [cpu 0xxx] INFO: Info message.
- * WARN("Warning %s.\n", "message") -> [cpu 0xxx] WARNING: Warning message.
+ * INFO("Info %s.\n", "message") -> INFO: Info message.
+ * WARN("Warning %s.\n", "message") -> WARNING: Warning message.
*/
#define LOG_LEVEL_NONE 0
#define LOG_LEVEL_ERROR 10
diff --git a/include/lib/stdlib/stdio.h b/include/lib/stdlib/stdio.h
index 80110a8b..55d8fe2c 100644
--- a/include/lib/stdlib/stdio.h
+++ b/include/lib/stdlib/stdio.h
@@ -59,6 +59,8 @@ typedef __ssize_t ssize_t;
#define EOF (-1)
int printf(const char * __restrict, ...) __printflike(1, 2);
+int vprintf(const char * __restrict, __va_list);
+
int putchar(int);
int puts(const char *);
int sprintf(char * __restrict, const char * __restrict, ...)
diff --git a/lib/stdlib/printf.c b/lib/stdlib/printf.c
index 6329157d..8ae7c263 100644
--- a/lib/stdlib/printf.c
+++ b/lib/stdlib/printf.c
@@ -9,28 +9,34 @@
/* Choose max of 512 chars for now. */
#define PRINT_BUFFER_SIZE 512
-int printf(const char *fmt, ...)
+
+int vprintf(const char *fmt, va_list args)
{
- va_list args;
char buf[PRINT_BUFFER_SIZE];
int count;
- va_start(args, fmt);
vsnprintf(buf, sizeof(buf) - 1, fmt, args);
- va_end(args);
+ buf[PRINT_BUFFER_SIZE - 1] = '\0';
/* Use putchar directly as 'puts()' adds a newline. */
- buf[PRINT_BUFFER_SIZE - 1] = '\0';
count = 0;
- while (buf[count])
- {
- if (putchar(buf[count]) != EOF) {
- count++;
- } else {
- count = EOF;
- break;
+ while (buf[count] != 0) {
+ if (putchar(buf[count]) == EOF) {
+ return EOF;
}
+ count++;
}
return count;
}
+
+int printf(const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ int count = vprintf(fmt, args);
+ va_end(args);
+
+ return count;
+}
diff --git a/lib/utils/mp_printf.c b/lib/utils/mp_printf.c
index d1eb780e..777c736a 100644
--- a/lib/utils/mp_printf.c
+++ b/lib/utils/mp_printf.c
@@ -4,8 +4,6 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <platform.h>
#include <spinlock.h>
#include <stdarg.h>
#include <stdio.h>
@@ -13,60 +11,14 @@
/* Lock to avoid concurrent accesses to the serial console */
static spinlock_t printf_lock;
-/*
- * Print the MPID header, e.g.: [cpu 0x0100]
- *
- * If SHELL_COLOR == 1, this also prints shell's color escape sequences to ease
- * identifying which CPU displays the message. There are 8 standard colors so
- * if the platform has more than 8 CPUs, some colors will be reused.
- */
-#if SHELL_COLOR
-#define PRINT_MPID_HDR(_mpid) \
- do { \
- unsigned int linear_id = platform_get_core_pos(_mpid); \
- printf("\033[1;%u;40m", 30 + (linear_id & 0x7)); \
- printf("[cpu 0x%.4x] ", _mpid); \
- printf("\033[0m"); \
- } while (0)
-#else
-#define PRINT_MPID_HDR(_mpid) \
- printf("[cpu 0x%.4x] ", _mpid)
-#endif /* SHELL_COLOR */
-
void mp_printf(const char *fmt, ...)
{
- va_list ap;
- char str[256];
- /*
- * As part of testing Firmware Update feature on Cortex-A57 CPU, an
- * issue was discovered while printing in NS_BL1U stage. The issue
- * appears when the second call to `NOTICE()` is made in the
- * `ns_bl1u_main()`. As a result of this issue the CPU hangs and the
- * debugger is also not able to connect anymore.
- *
- * After further debugging and experiments it was found that if
- * `read_mpidr_el1()` is avoided or volatile qualifier is used for
- * reading the mpidr, this issue gets resolved.
- *
- * NOTE: The actual/real reason why this happens is still not known.
- * Moreover this problem is not encountered on Cortex-A53 CPU.
- */
- volatile unsigned int mpid = read_mpidr_el1() & 0xFFFF;
-
- /*
- * TODO: It would be simpler to use vprintf() instead of
- * vsnprintf() + printf(), we wouldn't need to declare a static buffer
- * for storing the product of vsnprintf(). Unfortunately our C library
- * doesn't provide vprintf() at the moment.
- * Import vprintf() code from FreeBSD C library to our local C library.
- */
- va_start(ap, fmt);
- vsnprintf(str, sizeof(str), fmt, ap);
- str[sizeof(str) - 1] = 0;
- va_end(ap);
+ va_list args;
+ va_start(args, fmt);
spin_lock(&printf_lock);
- PRINT_MPID_HDR(mpid);
- printf("%s", str);
+ vprintf(fmt, args);
spin_unlock(&printf_lock);
+
+ va_end(args);
}
diff --git a/spm/cactus/cactus.mk b/spm/cactus/cactus.mk
index 1ebc6927..03d809d1 100644
--- a/spm/cactus/cactus.mk
+++ b/spm/cactus/cactus.mk
@@ -58,6 +58,8 @@ CACTUS_SOURCES += \
CACTUS_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \
lib/${ARCH}/cache_helpers.S \
lib/${ARCH}/misc_helpers.S \
+ lib/locks/${ARCH}/spinlock.S \
+ lib/utils/mp_printf.c \
${STDLIB_SOURCES} \
${SPRT_LIB_SOURCES}
diff --git a/spm/ivy/ivy.mk b/spm/ivy/ivy.mk
index 89fd92d4..c7726f4f 100644
--- a/spm/ivy/ivy.mk
+++ b/spm/ivy/ivy.mk
@@ -55,6 +55,8 @@ IVY_SOURCES += \
IVY_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \
lib/${ARCH}/cache_helpers.S \
lib/${ARCH}/misc_helpers.S \
+ lib/locks/${ARCH}/spinlock.S \
+ lib/utils/mp_printf.c \
${STDLIB_SOURCES} \
${SPRT_LIB_SOURCES}
diff --git a/tftf/framework/main.c b/tftf/framework/main.c
index ea56f2eb..02b54386 100644
--- a/tftf/framework/main.c
+++ b/tftf/framework/main.c
@@ -182,7 +182,6 @@ static test_result_t get_overall_test_result(void)
switch (test_results[core_pos]) {
case TEST_RESULT_NA:
- VERBOSE("CPU%u not involved in the test\n", core_pos);
/* Ignoring */
break;
@@ -191,7 +190,6 @@ static test_result_t get_overall_test_result(void)
* If at least one CPU skipped the test, consider the
* whole test as skipped as well.
*/
- NOTICE("CPU%u skipped the test\n", core_pos);
return TEST_RESULT_SKIPPED;
case TEST_RESULT_SUCCESS:
@@ -199,7 +197,6 @@ static test_result_t get_overall_test_result(void)
break;
case TEST_RESULT_FAIL:
- ERROR("CPU%u failed the test\n", core_pos);
return TEST_RESULT_FAIL;
case TEST_RESULT_CRASHED:
@@ -211,7 +208,6 @@ static test_result_t get_overall_test_result(void)
* If at least one CPU crashed, consider the whole test
* as crashed as well.
*/
- ERROR("CPU%u never returned from the test!\n", core_pos);
return TEST_RESULT_CRASHED;
default:
diff --git a/tftf/framework/timer/timer_framework.c b/tftf/framework/timer/timer_framework.c
index e5e9a0f8..0b0a7a53 100644
--- a/tftf/framework/timer/timer_framework.c
+++ b/tftf/framework/timer/timer_framework.c
@@ -71,15 +71,11 @@ static inline unsigned long long get_current_prog_time(void)
int tftf_initialise_timer(void)
{
- int rc;
- unsigned int i;
-
/*
* Get platform specific timer information
*/
- rc = plat_initialise_timer_ops(&plat_timer_info);
- if (rc) {
- ERROR("%s %d: No timer data found\n", __func__, __LINE__);
+ int rc = plat_initialise_timer_ops(&plat_timer_info);
+ if (rc != 0) {
return rc;
}
@@ -87,7 +83,7 @@ int tftf_initialise_timer(void)
assert(TIMER_STEP_VALUE);
/* Initialise the array to max possible time */
- for (i = 0; i < PLATFORM_CORE_COUNT; i++)
+ for (unsigned int i = 0; i < PLATFORM_CORE_COUNT; i++)
interrupt_req_time[i] = INVALID_TIME;
tftf_irq_register_handler(TIMER_IRQ, tftf_timer_framework_handler);