Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
07da0bf9
Unverified
Commit
07da0bf9
authored
Aug 15, 2018
by
Dimitris Papastamos
Committed by
GitHub
Aug 15, 2018
Browse files
Merge pull request #1516 from antonio-nino-diaz-arm/an/printf
Replace stdio.h functions by TF functions
parents
7e8a891f
6a23356c
Changes
7
Show whitespace changes
Inline
Side-by-side
common/tf_snprintf.c
View file @
07da0bf9
...
@@ -8,6 +8,17 @@
...
@@ -8,6 +8,17 @@
#include <platform.h>
#include <platform.h>
#include <stdarg.h>
#include <stdarg.h>
static
void
string_print
(
char
**
s
,
size_t
n
,
size_t
*
chars_printed
,
const
char
*
str
)
{
while
(
*
str
)
{
if
(
*
chars_printed
<
n
)
*
(
*
s
)
++
=
*
str
;
(
*
chars_printed
)
++
;
str
++
;
}
}
static
void
unsigned_dec_print
(
char
**
s
,
size_t
n
,
size_t
*
chars_printed
,
static
void
unsigned_dec_print
(
char
**
s
,
size_t
n
,
size_t
*
chars_printed
,
unsigned
int
unum
)
unsigned
int
unum
)
{
{
...
@@ -32,6 +43,7 @@ static void unsigned_dec_print(char **s, size_t n, size_t *chars_printed,
...
@@ -32,6 +43,7 @@ static void unsigned_dec_print(char **s, size_t n, size_t *chars_printed,
* The following type specifiers are supported:
* The following type specifiers are supported:
*
*
* %d or %i - signed decimal format
* %d or %i - signed decimal format
* %s - string format
* %u - unsigned decimal format
* %u - unsigned decimal format
*
*
* The function panics on all other formats specifiers.
* The function panics on all other formats specifiers.
...
@@ -45,6 +57,7 @@ int tf_snprintf(char *s, size_t n, const char *fmt, ...)
...
@@ -45,6 +57,7 @@ int tf_snprintf(char *s, size_t n, const char *fmt, ...)
va_list
args
;
va_list
args
;
int
num
;
int
num
;
unsigned
int
unum
;
unsigned
int
unum
;
char
*
str
;
size_t
chars_printed
=
0
;
size_t
chars_printed
=
0
;
if
(
n
==
1
)
{
if
(
n
==
1
)
{
...
@@ -79,6 +92,10 @@ int tf_snprintf(char *s, size_t n, const char *fmt, ...)
...
@@ -79,6 +92,10 @@ int tf_snprintf(char *s, size_t n, const char *fmt, ...)
unsigned_dec_print
(
&
s
,
n
,
&
chars_printed
,
unum
);
unsigned_dec_print
(
&
s
,
n
,
&
chars_printed
,
unum
);
break
;
break
;
case
's'
:
str
=
va_arg
(
args
,
char
*
);
string_print
(
&
s
,
n
,
&
chars_printed
,
str
);
break
;
case
'u'
:
case
'u'
:
unum
=
va_arg
(
args
,
unsigned
int
);
unum
=
va_arg
(
args
,
unsigned
int
);
unsigned_dec_print
(
&
s
,
n
,
&
chars_printed
,
unum
);
unsigned_dec_print
(
&
s
,
n
,
&
chars_printed
,
unum
);
...
...
drivers/marvell/comphy/phy-comphy-cp110.c
View file @
07da0bf9
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
/* #define DEBUG_COMPHY */
/* #define DEBUG_COMPHY */
#ifdef DEBUG_COMPHY
#ifdef DEBUG_COMPHY
#define debug(format...) printf(format)
#define debug(format...)
tf_
printf(format)
#else
#else
#define debug(format, arg...)
#define debug(format, arg...)
#endif
#endif
...
...
drivers/partition/partition.c
View file @
07da0bf9
/*
/*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2016
-2018
, ARM Limited and Contributors. All rights reserved.
*
*
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-License-Identifier: BSD-3-Clause
*/
*/
...
@@ -24,7 +24,7 @@ static void dump_entries(int num)
...
@@ -24,7 +24,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
=
snprintf
(
name
,
EFI_NAMELEN
,
"%s"
,
list
.
list
[
i
].
name
);
len
=
tf_
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
]
=
' '
;
}
}
...
...
drivers/st/clk/stm32mp1_clk.c
View file @
07da0bf9
...
@@ -1344,7 +1344,7 @@ int stm32mp1_clk_init(void)
...
@@ -1344,7 +1344,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
];
s
printf
(
name
,
"st,pll@%d"
,
i
);
tf_sn
printf
(
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
]))
{
...
...
plat/hisilicon/hikey/hisi_ipc.c
View file @
07da0bf9
/*
/*
* 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
*/
*/
#include <arch_helpers.h>
#include <arch_helpers.h>
#include <debug.h>
#include <hisi_ipc.h>
#include <hisi_ipc.h>
#include <hisi_sram_map.h>
#include <hisi_sram_map.h>
#include <mmio.h>
#include <mmio.h>
#include <platform_def.h>
#include <platform_def.h>
#include <stdarg.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
static
int
ipc_init
;
static
int
ipc_init
;
...
@@ -63,7 +63,7 @@ int hisi_cpus_powered_off_besides_curr(unsigned int cpu)
...
@@ -63,7 +63,7 @@ int hisi_cpus_powered_off_besides_curr(unsigned int cpu)
static
void
hisi_ipc_send
(
unsigned
int
ipc_num
)
static
void
hisi_ipc_send
(
unsigned
int
ipc_num
)
{
{
if
(
!
ipc_init
)
{
if
(
!
ipc_init
)
{
printf
(
"error ipc base is null!!!
\n
"
);
tf_
printf
(
"error ipc base is null!!!
\n
"
);
return
;
return
;
}
}
...
...
plat/marvell/a8k/common/mss/mss_bl2_setup.c
View file @
07da0bf9
...
@@ -85,7 +85,6 @@ int bl2_plat_handle_scp_bl2(image_info_t *scp_bl2_image_info)
...
@@ -85,7 +85,6 @@ int bl2_plat_handle_scp_bl2(image_info_t *scp_bl2_image_info)
int
ret
;
int
ret
;
INFO
(
"BL2: Initiating SCP_BL2 transfer to SCP
\n
"
);
INFO
(
"BL2: Initiating SCP_BL2 transfer to SCP
\n
"
);
printf
(
"BL2: Initiating SCP_BL2 transfer to SCP
\n
"
);
/* initialize time (for delay functionality) */
/* initialize time (for delay functionality) */
plat_delay_timer_init
();
plat_delay_timer_init
();
...
...
services/spd/trusty/generic-arm64-smcall.c
View file @
07da0bf9
/*
/*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2016
-2018
, ARM Limited and Contributors. All rights reserved.
*
*
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-License-Identifier: BSD-3-Clause
*/
*/
...
@@ -29,14 +29,14 @@ static void trusty_dputc(char ch, int secure)
...
@@ -29,14 +29,14 @@ static void trusty_dputc(char ch, int secure)
s
->
linebuf
[
s
->
l
++
]
=
ch
;
s
->
linebuf
[
s
->
l
++
]
=
ch
;
if
(
s
->
l
==
sizeof
(
s
->
linebuf
)
||
ch
==
'\n'
)
{
if
(
s
->
l
==
sizeof
(
s
->
linebuf
)
||
ch
==
'\n'
)
{
if
(
secure
)
if
(
secure
)
printf
(
"secure os: "
);
tf_
printf
(
"secure os: "
);
else
else
printf
(
"non-secure os: "
);
tf_
printf
(
"non-secure os: "
);
for
(
i
=
0
;
i
<
s
->
l
;
i
++
)
{
for
(
i
=
0
;
i
<
s
->
l
;
i
++
)
{
putchar
(
s
->
linebuf
[
i
]);
putchar
(
s
->
linebuf
[
i
]);
}
}
if
(
ch
!=
'\n'
)
{
if
(
ch
!=
'\n'
)
{
printf
(
" <...>
\n
"
);
tf_
printf
(
" <...>
\n
"
);
}
}
s
->
l
=
0
;
s
->
l
=
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment