Unverified Commit 6d4f6aea authored by Dimitris Papastamos's avatar Dimitris Papastamos Committed by GitHub
Browse files

Merge pull request #1528 from antonio-nino-diaz-arm/an/libc

libc: Cleanup library
parents 11dfe0b4 8422a840
...@@ -202,8 +202,6 @@ include lib/libc/libc.mk ...@@ -202,8 +202,6 @@ include lib/libc/libc.mk
BL_COMMON_SOURCES += common/bl_common.c \ BL_COMMON_SOURCES += common/bl_common.c \
common/tf_log.c \ common/tf_log.c \
common/tf_printf.c \
common/tf_snprintf.c \
common/${ARCH}/debug.S \ common/${ARCH}/debug.S \
lib/${ARCH}/cache_helpers.S \ lib/${ARCH}/cache_helpers.S \
lib/${ARCH}/misc_helpers.S \ lib/${ARCH}/misc_helpers.S \
...@@ -213,6 +211,10 @@ BL_COMMON_SOURCES += common/bl_common.c \ ...@@ -213,6 +211,10 @@ BL_COMMON_SOURCES += common/bl_common.c \
plat/common/${ARCH}/platform_helpers.S \ plat/common/${ARCH}/platform_helpers.S \
${COMPILER_RT_SRCS} ${COMPILER_RT_SRCS}
ifeq ($(notdir $(CC)),armclang)
BL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S
endif
INCLUDES += -Iinclude \ INCLUDES += -Iinclude \
-Iinclude/bl1 \ -Iinclude/bl1 \
-Iinclude/bl2 \ -Iinclude/bl2 \
...@@ -241,7 +243,6 @@ INCLUDES += -Iinclude \ ...@@ -241,7 +243,6 @@ INCLUDES += -Iinclude \
${SPD_INCLUDES} \ ${SPD_INCLUDES} \
-Iinclude/tools_share -Iinclude/tools_share
################################################################################ ################################################################################
# Generic definitions # Generic definitions
################################################################################ ################################################################################
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#ifndef __BL1_PRIVATE_H__ #ifndef __BL1_PRIVATE_H__
#define __BL1_PRIVATE_H__ #define __BL1_PRIVATE_H__
#include <types.h> #include <stdint.h>
#include <utils_def.h> #include <utils_def.h>
/******************************************************************************* /*******************************************************************************
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <std_svc.h> #include <std_svc.h>
#include <stdint.h>
#include <string.h> #include <string.h>
#include <types.h>
#include <utils.h> #include <utils.h>
#include "sp_min_private.h" #include "sp_min_private.h"
......
/* /*
* Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -36,11 +36,11 @@ void tf_log(const char *fmt, ...) ...@@ -36,11 +36,11 @@ void tf_log(const char *fmt, ...)
prefix_str = plat_log_get_prefix(log_level); prefix_str = plat_log_get_prefix(log_level);
if (prefix_str != NULL) while (*prefix_str)
tf_string_print(prefix_str); putchar(*prefix_str++);
va_start(args, fmt); va_start(args, fmt);
tf_vprintf(fmt+1, args); vprintf(fmt + 1, args);
va_end(args); va_end(args);
} }
......
/*
* Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arch.h>
#include <arch_helpers.h>
#include <assert.h>
#include <debug.h>
#include <limits.h>
#include <stdarg.h>
#include <stdint.h>
/***********************************************************
* The tf_printf implementation for all BL stages
***********************************************************/
#define get_num_va_args(_args, _lcount) \
(((_lcount) > 1) ? va_arg(_args, long long int) : \
((_lcount) ? va_arg(_args, long int) : va_arg(_args, int)))
#define get_unum_va_args(_args, _lcount) \
(((_lcount) > 1) ? va_arg(_args, unsigned long long int) : \
((_lcount) ? va_arg(_args, unsigned long int) : va_arg(_args, unsigned int)))
void tf_string_print(const char *str)
{
assert(str);
while (*str)
putchar(*str++);
}
static void unsigned_num_print(unsigned long long int unum, unsigned int radix,
char padc, int padn)
{
/* Just need enough space to store 64 bit decimal integer */
unsigned char num_buf[20];
int i = 0, rem;
do {
rem = unum % radix;
if (rem < 0xa)
num_buf[i++] = '0' + rem;
else
num_buf[i++] = 'a' + (rem - 0xa);
} while (unum /= radix);
if (padn > 0) {
while (i < padn--) {
putchar(padc);
}
}
while (--i >= 0)
putchar(num_buf[i]);
}
/*******************************************************************
* Reduced format print for Trusted firmware.
* The following type specifiers are supported by this print
* %x - hexadecimal format
* %s - string format
* %d or %i - signed decimal format
* %u - unsigned decimal format
* %p - pointer format
*
* The following length specifiers are supported by this print
* %l - long int (64-bit on AArch64)
* %ll - long long int (64-bit on AArch64)
* %z - size_t sized integer formats (64 bit on AArch64)
*
* The following padding specifiers are supported by this print
* %0NN - Left-pad the number with 0s (NN is a decimal number)
*
* The print exits on all other formats specifiers other than valid
* combinations of the above specifiers.
*******************************************************************/
void tf_vprintf(const char *fmt, va_list args)
{
int l_count;
long long int num;
unsigned long long int unum;
char *str;
char padc = 0; /* Padding character */
int padn; /* Number of characters to pad */
while (*fmt) {
l_count = 0;
padn = 0;
if (*fmt == '%') {
fmt++;
/* Check the format specifier */
loop:
switch (*fmt) {
case 'i': /* Fall through to next one */
case 'd':
num = get_num_va_args(args, l_count);
if (num < 0) {
putchar('-');
unum = (unsigned long long int)-num;
padn--;
} else
unum = (unsigned long long int)num;
unsigned_num_print(unum, 10, padc, padn);
break;
case 's':
str = va_arg(args, char *);
tf_string_print(str);
break;
case 'p':
unum = (uintptr_t)va_arg(args, void *);
if (unum) {
tf_string_print("0x");
padn -= 2;
}
unsigned_num_print(unum, 16, padc, padn);
break;
case 'x':
unum = get_unum_va_args(args, l_count);
unsigned_num_print(unum, 16, padc, padn);
break;
case 'z':
if (sizeof(size_t) == 8)
l_count = 2;
fmt++;
goto loop;
case 'l':
l_count++;
fmt++;
goto loop;
case 'u':
unum = get_unum_va_args(args, l_count);
unsigned_num_print(unum, 10, padc, padn);
break;
case '0':
padc = '0';
padn = 0;
fmt++;
while (1) {
char ch = *fmt;
if (ch < '0' || ch > '9') {
goto loop;
}
padn = (padn * 10) + (ch - '0');
fmt++;
}
default:
/* Exit on any other format specifier */
return;
}
fmt++;
continue;
}
putchar(*fmt++);
}
}
void tf_printf(const char *fmt, ...)
{
va_list va;
va_start(va, fmt);
tf_vprintf(fmt, va);
va_end(va);
}
...@@ -2982,32 +2982,13 @@ contains those C library definitions required by the local implementation. If ...@@ -2982,32 +2982,13 @@ contains those C library definitions required by the local implementation. If
more functionality is required, the needed library functions will need to be more functionality is required, the needed library functions will need to be
added to the local implementation. added to the local implementation.
Versions of `FreeBSD`_ headers can be found in ``include/lib/stdlib``. Some of Some C headers have been obtained from `FreeBSD`_ and `SCC`_, while others have
these headers have been cut down in order to simplify the implementation. In been written specifically for TF-A. Fome implementation files have been obtained
order to minimize changes to the header files, the `FreeBSD`_ layout has been from `FreeBSD`_, others have been written specifically for TF-A as well. The
maintained. The generic C library definitions can be found in files can be found in ``include/lib/libc`` and ``lib/libc``.
``include/lib/stdlib`` with more system and machine specific declarations in
``include/lib/stdlib/sys`` and ``include/lib/stdlib/machine``.
The local C library implementations can be found in ``lib/stdlib``. In order to SCC can be found in `http://www.simple-cc.org/`_. A copy of the `FreeBSD`_
extend the C library these files may need to be modified. It is recommended to sources can be obtained from `http://github.com/freebsd/freebsd`_.
use a release version of `FreeBSD`_ as a starting point.
The C library header files in the `FreeBSD`_ source tree are located in the
``include`` and ``sys/sys`` directories. `FreeBSD`_ machine specific definitions
can be found in the ``sys/<machine-type>`` directories. These files define things
like 'the size of a pointer' and 'the range of an integer'. Since an AArch64
port for `FreeBSD`_ does not yet exist, the machine specific definitions are
based on existing machine types with similar properties (for example SPARC64).
Where possible, C library function implementations were taken from `FreeBSD`_
as found in the ``lib/libc`` directory.
A copy of the `FreeBSD`_ sources can be downloaded with ``git``.
::
git clone git://github.com/freebsd/freebsd.git -b origin/release/9.2.0
Storage abstraction layer Storage abstraction layer
------------------------- -------------------------
...@@ -3082,3 +3063,4 @@ amount of open resources per driver. ...@@ -3082,3 +3063,4 @@ amount of open resources per driver.
.. _Arm Generic Interrupt Controller version 2.0 (GICv2): http://infocenter.arm.com/help/topic/com.arm.doc.ihi0048b/index.html .. _Arm Generic Interrupt Controller version 2.0 (GICv2): http://infocenter.arm.com/help/topic/com.arm.doc.ihi0048b/index.html
.. _3.0 (GICv3): http://infocenter.arm.com/help/topic/com.arm.doc.ihi0069b/index.html .. _3.0 (GICv3): http://infocenter.arm.com/help/topic/com.arm.doc.ihi0069b/index.html
.. _FreeBSD: http://www.freebsd.org .. _FreeBSD: http://www.freebsd.org
.. _SCC: http://www.simple-cc.org/
...@@ -319,7 +319,7 @@ and some helper utilities for assert, print and memory operations as listed ...@@ -319,7 +319,7 @@ and some helper utilities for assert, print and memory operations as listed
below. The TF-A source tree provides implementations for all below. The TF-A source tree provides implementations for all
these functions but the EL3 Runtime Software may use its own implementation. these functions but the EL3 Runtime Software may use its own implementation.
**Functions : assert(), memcpy(), memset** **Functions : assert(), memcpy(), memset(), printf()**
These must be implemented as described in ISO C Standard. These must be implemented as described in ISO C Standard.
...@@ -353,14 +353,6 @@ This function invalidates (flushes) the data cache for memory at address ...@@ -353,14 +353,6 @@ This function invalidates (flushes) the data cache for memory at address
This function will be called by the PSCI library on encountering a critical This function will be called by the PSCI library on encountering a critical
failure that cannot be recovered from. This function **must not** return. failure that cannot be recovered from. This function **must not** return.
**Function : tf\_printf()**
This is printf-compatible function, but unlike printf, it does not return any
value. The TF-A source tree provides an implementation which
is optimized for stack usage and supports only a subset of format specifiers.
The details of the format specifiers supported can be found in the
``tf_printf.c`` file in the TF-A source tree.
CPU Context management API CPU Context management API
~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <debug.h> #include <debug.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
/* mbed TLS headers */ /* mbed TLS headers */
#include <mbedtls/memory_buffer_alloc.h> #include <mbedtls/memory_buffer_alloc.h>
...@@ -45,10 +46,8 @@ void mbedtls_init(void) ...@@ -45,10 +46,8 @@ void mbedtls_init(void)
mbedtls_memory_buffer_alloc_init(heap, MBEDTLS_HEAP_SIZE); mbedtls_memory_buffer_alloc_init(heap, MBEDTLS_HEAP_SIZE);
#ifdef MBEDTLS_PLATFORM_SNPRINTF_ALT #ifdef MBEDTLS_PLATFORM_SNPRINTF_ALT
/* Use reduced version of snprintf to save space. */ mbedtls_platform_set_snprintf(snprintf);
mbedtls_platform_set_snprintf(tf_snprintf);
#endif #endif
ready = 1; ready = 1;
} }
} }
...@@ -96,8 +96,8 @@ static void dump_amb_adec(void) ...@@ -96,8 +96,8 @@ static void dump_amb_adec(void)
uint32_t size, size_count; uint32_t size, size_count;
/* Dump all AMB windows */ /* Dump all AMB windows */
tf_printf("bank attribute base size\n"); printf("bank attribute base size\n");
tf_printf("--------------------------------------------\n"); printf("--------------------------------------------\n");
for (win_id = 0; win_id < AMB_MAX_WIN_ID; win_id++) { for (win_id = 0; win_id < AMB_MAX_WIN_ID; win_id++) {
ctrl = mmio_read_32(AMB_WIN_CR_OFFSET(win_id)); ctrl = mmio_read_32(AMB_WIN_CR_OFFSET(win_id));
if (ctrl & WIN_ENABLE_BIT) { if (ctrl & WIN_ENABLE_BIT) {
...@@ -105,7 +105,7 @@ static void dump_amb_adec(void) ...@@ -105,7 +105,7 @@ static void dump_amb_adec(void)
attr = (ctrl >> AMB_ATTR_OFFSET) & AMB_ATTR_MASK; attr = (ctrl >> AMB_ATTR_OFFSET) & AMB_ATTR_MASK;
size_count = (ctrl >> AMB_SIZE_OFFSET) & AMB_SIZE_MASK; size_count = (ctrl >> AMB_SIZE_OFFSET) & AMB_SIZE_MASK;
size = (size_count + 1) * AMB_WIN_ALIGNMENT_64K; size = (size_count + 1) * AMB_WIN_ALIGNMENT_64K;
tf_printf("amb 0x%04x 0x%08x 0x%08x\n", printf("amb 0x%04x 0x%08x 0x%08x\n",
attr, base, size); attr, base, size);
} }
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/* common defines */ /* common defines */
#define WIN_ENABLE_BIT (0x1) #define WIN_ENABLE_BIT (0x1)
/* Physical address of the base of the window = {AddrLow[19:0],20h0} */ /* Physical address of the base of the window = {AddrLow[19:0],20'h0} */
#define ADDRESS_SHIFT (20 - 4) #define ADDRESS_SHIFT (20 - 4)
#define ADDRESS_MASK (0xFFFFFFF0) #define ADDRESS_MASK (0xFFFFFFF0)
#define CCU_WIN_ALIGNMENT (0x100000) #define CCU_WIN_ALIGNMENT (0x100000)
...@@ -40,8 +40,8 @@ static void dump_ccu(int ap_index) ...@@ -40,8 +40,8 @@ static void dump_ccu(int ap_index)
uint64_t start, end; uint64_t start, end;
/* Dump all AP windows */ /* Dump all AP windows */
tf_printf("\tbank target start end\n"); printf("\tbank target start end\n");
tf_printf("\t----------------------------------------------------\n"); printf("\t----------------------------------------------------\n");
for (win_id = 0; win_id < MVEBU_CCU_MAX_WINS; win_id++) { for (win_id = 0; win_id < MVEBU_CCU_MAX_WINS; win_id++) {
win_cr = mmio_read_32(CCU_WIN_CR_OFFSET(ap_index, win_id)); win_cr = mmio_read_32(CCU_WIN_CR_OFFSET(ap_index, win_id));
if (win_cr & WIN_ENABLE_BIT) { if (win_cr & WIN_ENABLE_BIT) {
...@@ -53,13 +53,13 @@ static void dump_ccu(int ap_index) ...@@ -53,13 +53,13 @@ static void dump_ccu(int ap_index)
win_id)); win_id));
start = ((uint64_t)alr << ADDRESS_SHIFT); start = ((uint64_t)alr << ADDRESS_SHIFT);
end = (((uint64_t)ahr + 0x10) << ADDRESS_SHIFT); end = (((uint64_t)ahr + 0x10) << ADDRESS_SHIFT);
tf_printf("\tccu %02x 0x%016llx 0x%016llx\n", printf("\tccu %02x 0x%016llx 0x%016llx\n",
target_id, start, end); target_id, start, end);
} }
} }
win_cr = mmio_read_32(CCU_WIN_GCR_OFFSET(ap_index)); win_cr = mmio_read_32(CCU_WIN_GCR_OFFSET(ap_index));
target_id = (win_cr >> CCU_GCR_TARGET_OFFSET) & CCU_GCR_TARGET_MASK; target_id = (win_cr >> CCU_GCR_TARGET_OFFSET) & CCU_GCR_TARGET_MASK;
tf_printf("\tccu GCR %d - all other transactions\n", target_id); printf("\tccu GCR %d - all other transactions\n", target_id);
} }
#endif #endif
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
/* #define DEBUG_COMPHY */ /* #define DEBUG_COMPHY */
#ifdef DEBUG_COMPHY #ifdef DEBUG_COMPHY
#define debug(format...) tf_printf(format) #define debug(format...) printf(format)
#else #else
#define debug(format, arg...) #define debug(format, arg...)
#endif #endif
......
...@@ -153,8 +153,8 @@ static void dump_gwin(int ap_index) ...@@ -153,8 +153,8 @@ static void dump_gwin(int ap_index)
uint32_t win_num; uint32_t win_num;
/* Dump all GWIN windows */ /* Dump all GWIN windows */
tf_printf("\tbank target start end\n"); printf("\tbank target start end\n");
tf_printf("\t----------------------------------------------------\n"); printf("\t----------------------------------------------------\n");
for (win_num = 0; win_num < MVEBU_GWIN_MAX_WINS; win_num++) { for (win_num = 0; win_num < MVEBU_GWIN_MAX_WINS; win_num++) {
uint32_t cr; uint32_t cr;
uint64_t alr, ahr; uint64_t alr, ahr;
...@@ -166,7 +166,7 @@ static void dump_gwin(int ap_index) ...@@ -166,7 +166,7 @@ static void dump_gwin(int ap_index)
alr = (alr >> ADDRESS_LSHIFT) << ADDRESS_RSHIFT; alr = (alr >> ADDRESS_LSHIFT) << ADDRESS_RSHIFT;
ahr = mmio_read_32(GWIN_AHR_OFFSET(ap_index, win_num)); ahr = mmio_read_32(GWIN_AHR_OFFSET(ap_index, win_num));
ahr = (ahr >> ADDRESS_LSHIFT) << ADDRESS_RSHIFT; ahr = (ahr >> ADDRESS_LSHIFT) << ADDRESS_RSHIFT;
tf_printf("\tgwin %d 0x%016llx 0x%016llx\n", printf("\tgwin %d 0x%016llx 0x%016llx\n",
(cr >> 8) & 0xF, alr, ahr); (cr >> 8) & 0xF, alr, ahr);
} }
} }
......
...@@ -158,8 +158,8 @@ static void dump_io_win(int ap_index) ...@@ -158,8 +158,8 @@ static void dump_io_win(int ap_index)
uint64_t start, end; uint64_t start, end;
/* Dump all IO windows */ /* Dump all IO windows */
tf_printf("\tbank target start end\n"); printf("\tbank target start end\n");
tf_printf("\t----------------------------------------------------\n"); printf("\t----------------------------------------------------\n");
for (win_id = 0; win_id < MVEBU_IO_WIN_MAX_WINS; win_id++) { for (win_id = 0; win_id < MVEBU_IO_WIN_MAX_WINS; win_id++) {
alr = mmio_read_32(IO_WIN_ALR_OFFSET(ap_index, win_id)); alr = mmio_read_32(IO_WIN_ALR_OFFSET(ap_index, win_id));
if (alr & WIN_ENABLE_BIT) { if (alr & WIN_ENABLE_BIT) {
...@@ -169,11 +169,11 @@ static void dump_io_win(int ap_index) ...@@ -169,11 +169,11 @@ static void dump_io_win(int ap_index)
win_id)); win_id));
start = ((uint64_t)alr << ADDRESS_SHIFT); start = ((uint64_t)alr << ADDRESS_SHIFT);
end = (((uint64_t)ahr + 0x10) << ADDRESS_SHIFT); end = (((uint64_t)ahr + 0x10) << ADDRESS_SHIFT);
tf_printf("\tio-win %d 0x%016llx 0x%016llx\n", printf("\tio-win %d 0x%016llx 0x%016llx\n",
trgt_id, start, end); trgt_id, start, end);
} }
} }
tf_printf("\tio-win gcr is %x\n", printf("\tio-win gcr is %x\n",
mmio_read_32(MVEBU_IO_WIN_BASE(ap_index) + mmio_read_32(MVEBU_IO_WIN_BASE(ap_index) +
MVEBU_IO_WIN_GCR_OFFSET)); MVEBU_IO_WIN_GCR_OFFSET));
} }
......
...@@ -52,7 +52,7 @@ static void iob_win_check(struct addr_map_win *win, uint32_t win_num) ...@@ -52,7 +52,7 @@ static void iob_win_check(struct addr_map_win *win, uint32_t win_num)
win->base_addr = ALIGN_UP(win->base_addr, IOB_WIN_ALIGNMENT); win->base_addr = ALIGN_UP(win->base_addr, IOB_WIN_ALIGNMENT);
ERROR("Window %d: base address unaligned to 0x%x\n", ERROR("Window %d: base address unaligned to 0x%x\n",
win_num, IOB_WIN_ALIGNMENT); win_num, IOB_WIN_ALIGNMENT);
tf_printf("Align up the base address to 0x%llx\n", printf("Align up the base address to 0x%llx\n",
win->base_addr); win->base_addr);
} }
...@@ -61,7 +61,7 @@ static void iob_win_check(struct addr_map_win *win, uint32_t win_num) ...@@ -61,7 +61,7 @@ static void iob_win_check(struct addr_map_win *win, uint32_t win_num)
win->win_size = ALIGN_UP(win->win_size, IOB_WIN_ALIGNMENT); win->win_size = ALIGN_UP(win->win_size, IOB_WIN_ALIGNMENT);
ERROR("Window %d: window size unaligned to 0x%x\n", win_num, ERROR("Window %d: window size unaligned to 0x%x\n", win_num,
IOB_WIN_ALIGNMENT); IOB_WIN_ALIGNMENT);
tf_printf("Aligning size to 0x%llx\n", win->win_size); printf("Aligning size to 0x%llx\n", win->win_size);
} }
} }
...@@ -96,8 +96,8 @@ static void dump_iob(void) ...@@ -96,8 +96,8 @@ static void dump_iob(void)
"PEX0 ", "NAND ", "RUNIT", "MCI1 " }; "PEX0 ", "NAND ", "RUNIT", "MCI1 " };
/* Dump all IOB windows */ /* Dump all IOB windows */
tf_printf("bank id target start end\n"); printf("bank id target start end\n");
tf_printf("----------------------------------------------------\n"); printf("----------------------------------------------------\n");
for (win_id = 0; win_id < MVEBU_IOB_MAX_WINS; win_id++) { for (win_id = 0; win_id < MVEBU_IOB_MAX_WINS; win_id++) {
win_cr = mmio_read_32(IOB_WIN_CR_OFFSET(win_id)); win_cr = mmio_read_32(IOB_WIN_CR_OFFSET(win_id));
if (win_cr & WIN_ENABLE_BIT) { if (win_cr & WIN_ENABLE_BIT) {
...@@ -114,7 +114,7 @@ static void dump_iob(void) ...@@ -114,7 +114,7 @@ static void dump_iob(void)
*/ */
end = start + (16 << 20); end = start + (16 << 20);
} }
tf_printf("iob %02d %s 0x%016llx 0x%016llx\n", printf("iob %02d %s 0x%016llx 0x%016llx\n",
win_id, iob_target_name[target_id], win_id, iob_target_name[target_id],
start, end); start, end);
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <mbr.h> #include <mbr.h>
#include <partition.h> #include <partition.h>
#include <platform.h> #include <platform.h>
#include <stdio.h>
#include <string.h> #include <string.h>
static uint8_t mbr_sector[PARTITION_BLOCK_SIZE]; static uint8_t mbr_sector[PARTITION_BLOCK_SIZE];
...@@ -24,7 +25,7 @@ static void dump_entries(int num) ...@@ -24,7 +25,7 @@ static void dump_entries(int num)
VERBOSE("Partition table with %d entries:\n", num); VERBOSE("Partition table with %d entries:\n", num);
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
len = tf_snprintf(name, EFI_NAMELEN, "%s", list.list[i].name); len = snprintf(name, EFI_NAMELEN, "%s", list.list[i].name);
for (j = 0; j < EFI_NAMELEN - len - 1; j++) { for (j = 0; j < EFI_NAMELEN - len - 1; j++) {
name[len + j] = ' '; name[len + j] = ' ';
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <mmio.h> #include <mmio.h>
#include <platform.h> #include <platform.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h>
#include <stm32mp1_clk.h> #include <stm32mp1_clk.h>
#include <stm32mp1_clkfunc.h> #include <stm32mp1_clkfunc.h>
#include <stm32mp1_dt.h> #include <stm32mp1_dt.h>
...@@ -1344,7 +1345,7 @@ int stm32mp1_clk_init(void) ...@@ -1344,7 +1345,7 @@ int stm32mp1_clk_init(void)
for (i = (enum stm32mp1_pll_id)0; i < _PLL_NB; i++) { for (i = (enum stm32mp1_pll_id)0; i < _PLL_NB; i++) {
char name[12]; char name[12];
tf_snprintf(name, sizeof(name), "st,pll@%d", i); snprintf(name, sizeof(name), "st,pll@%d", i);
plloff[i] = fdt_rcc_subnode_offset(name); plloff[i] = fdt_rcc_subnode_offset(name);
if (!fdt_check_node(plloff[i])) { if (!fdt_check_node(plloff[i])) {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <cdefs.h>
#include <stdint.h> #include <stdint.h>
#include <utils_def.h> #include <utils_def.h>
......
...@@ -61,7 +61,6 @@ ...@@ -61,7 +61,6 @@
#include <cassert.h> #include <cassert.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <types.h>
#include <utils_def.h> /* To retain compatibility */ #include <utils_def.h> /* To retain compatibility */
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#ifndef __DEBUG_H__ #ifndef DEBUG_H
#define __DEBUG_H__ #define DEBUG_H
/* /*
* The log output macros print output to the console. These macros produce * The log output macros print output to the console. These macros produce
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#define LOG_LEVEL_VERBOSE 50 #define LOG_LEVEL_VERBOSE 50
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <cdefs.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
...@@ -89,11 +90,7 @@ void __dead2 do_panic(void); ...@@ -89,11 +90,7 @@ void __dead2 do_panic(void);
void __dead2 __stack_chk_fail(void); void __dead2 __stack_chk_fail(void);
void tf_log(const char *fmt, ...) __printflike(1, 2); void tf_log(const char *fmt, ...) __printflike(1, 2);
void tf_printf(const char *fmt, ...) __printflike(1, 2);
int tf_snprintf(char *s, size_t n, const char *fmt, ...) __printflike(3, 4);
void tf_vprintf(const char *fmt, va_list args);
void tf_string_print(const char *str);
void tf_log_set_max_level(unsigned int log_level); void tf_log_set_max_level(unsigned int log_level);
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __DEBUG_H__ */ #endif /* DEBUG_H */
/* /*
* Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <cassert.h> #include <cassert.h>
#include <types.h> #include <stdint.h>
typedef struct aapcs64_params { typedef struct aapcs64_params {
u_register_t arg0; u_register_t arg0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment