mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 18:14:24 +00:00

Enforce full include path for includes. Deprecate old paths. The following folders inside include/lib have been left unchanged: - include/lib/cpus/${ARCH} - include/lib/el3_runtime/${ARCH} The reason for this change is that having a global namespace for includes isn't a good idea. It defeats one of the advantages of having folders and it introduces problems that are sometimes subtle (because you may not know the header you are actually including if there are two of them). For example, this patch had to be created because two headers were called the same way:e0ea0928d5
("Fix gpio includes of mt8173 platform to avoid collision."). More recently, this patch has had similar problems:46f9b2c3a2
("drivers: add tzc380 support"). This problem was introduced in commit4ecca33988
("Move include and source files to logical locations"). At that time, there weren't too many headers so it wasn't a real issue. However, time has shown that this creates problems. Platforms that want to preserve the way they include headers may add the removed paths to PLAT_INCLUDES, but this is discouraged. Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8f Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
104 lines
2.2 KiB
C
104 lines
2.2 KiB
C
/*
|
|
* Copyright (c) 2015-2017, Renesas Electronics Corporation. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <stdarg.h>
|
|
#include <stdint.h>
|
|
|
|
#include <platform_def.h>
|
|
|
|
#include <arch_helpers.h>
|
|
#include <common/debug.h>
|
|
#include <lib/bakery_lock.h>
|
|
|
|
#include "rcar_def.h"
|
|
#include "rcar_private.h"
|
|
#include "rcar_printf.h"
|
|
|
|
#define INDEX_TIMER_COUNT (4U)
|
|
|
|
extern RCAR_INSTANTIATE_LOCK typedef struct log_head {
|
|
uint8_t head[4];
|
|
uint32_t index;
|
|
uint32_t size;
|
|
uint8_t res[4];
|
|
} loghead_t;
|
|
|
|
typedef struct log_map {
|
|
loghead_t header;
|
|
uint8_t log_data[RCAR_BL31_LOG_MAX];
|
|
uint8_t res_data[RCAR_LOG_RES_SIZE];
|
|
} logmap_t;
|
|
|
|
int32_t rcar_set_log_data(int32_t c)
|
|
{
|
|
logmap_t *t_log;
|
|
|
|
t_log = (logmap_t *) RCAR_BL31_LOG_BASE;
|
|
|
|
rcar_lock_get();
|
|
|
|
/*
|
|
* If index is broken, then index and size initialize
|
|
*/
|
|
if (t_log->header.index >= (uint32_t) RCAR_BL31_LOG_MAX) {
|
|
t_log->header.index = 0U;
|
|
t_log->header.size = 0U;
|
|
}
|
|
/*
|
|
* data store to log area then index and size renewal
|
|
*/
|
|
t_log->log_data[t_log->header.index] = (uint8_t) c;
|
|
t_log->header.index++;
|
|
if (t_log->header.size < t_log->header.index) {
|
|
t_log->header.size = t_log->header.index;
|
|
}
|
|
if (t_log->header.index >= (uint32_t) RCAR_BL31_LOG_MAX) {
|
|
t_log->header.index = 0U;
|
|
}
|
|
|
|
rcar_lock_release();
|
|
|
|
return 1;
|
|
}
|
|
|
|
int32_t rcar_log_init(void)
|
|
{
|
|
|
|
static const uint8_t const_header[] = "TLOG";
|
|
logmap_t *t_log;
|
|
int16_t init_flag = 0;
|
|
|
|
t_log = (logmap_t *) RCAR_BL31_LOG_BASE;
|
|
if (memcmp
|
|
((const void *)t_log->header.head, (const void *)const_header,
|
|
sizeof(t_log->header.head)) != 0) {
|
|
/*
|
|
* Log header is not "TLOG", then log area initialize
|
|
*/
|
|
init_flag = 1;
|
|
}
|
|
if (t_log->header.index >= (uint32_t) RCAR_BL31_LOG_MAX) {
|
|
/*
|
|
* index is broken, then log area initialize
|
|
*/
|
|
init_flag = 1;
|
|
}
|
|
if (init_flag == 1) {
|
|
(void)memset((void *)t_log->log_data, 0,
|
|
(size_t) RCAR_BL31_LOG_MAX);
|
|
(void)memcpy((void *)t_log->header.head,
|
|
(const void *)const_header,
|
|
sizeof(t_log->header.head));
|
|
t_log->header.index = 0U;
|
|
t_log->header.size = 0U;
|
|
#ifndef IMAGE_BL2
|
|
rcar_stack_generic_timer[INDEX_TIMER_COUNT] = 0U;
|
|
#endif
|
|
}
|
|
rcar_lock_init();
|
|
|
|
return 1;
|
|
}
|