From 6053a9ce05c1ca9c8919689fd766e14f4a8b4884 Mon Sep 17 00:00:00 2001 From: David Hendricks Date: Sun, 28 Jan 2018 18:01:10 -0800 Subject: console: Expose vsnprintf It's a standard function. Change-Id: I039cce2dfc4e168804eb7d12b76a29af712ac7a1 Signed-off-by: David Hendricks Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/23616 Reviewed-by: Patrick Georgi Tested-by: build bot (Jenkins) --- src/console/vsprintf.c | 2 +- src/include/string.h | 5 +++++ src/southbridge/amd/cimx/sb800/AmdSbLib.h | 13 +------------ src/southbridge/amd/cimx/sb900/AmdSbLib.h | 13 +------------ 4 files changed, 8 insertions(+), 25 deletions(-) diff --git a/src/console/vsprintf.c b/src/console/vsprintf.c index 4edb3ea6e6..7071611ef9 100644 --- a/src/console/vsprintf.c +++ b/src/console/vsprintf.c @@ -34,7 +34,7 @@ static void str_tx_byte(unsigned char byte, void *data) } } -static int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) +int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) { int i; struct vsnprintf_context ctx; diff --git a/src/include/string.h b/src/include/string.h index d2d7bb8781..fc96393c48 100644 --- a/src/include/string.h +++ b/src/include/string.h @@ -4,6 +4,10 @@ #include #include +#if !defined(__ROMCC__) +#include +#endif + /* Stringify a token */ #ifndef STRINGIFY #define _STRINGIFY(x) #x @@ -17,6 +21,7 @@ int memcmp(const void *s1, const void *s2, size_t n); void *memchr(const void *s, int c, size_t n); #if !defined(__ROMCC__) int snprintf(char *buf, size_t size, const char *fmt, ...); +int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); #endif // simple string functions diff --git a/src/southbridge/amd/cimx/sb800/AmdSbLib.h b/src/southbridge/amd/cimx/sb800/AmdSbLib.h index cc75353f3d..c13eda4e58 100644 --- a/src/southbridge/amd/cimx/sb800/AmdSbLib.h +++ b/src/southbridge/amd/cimx/sb800/AmdSbLib.h @@ -20,18 +20,7 @@ #ifndef _AMD_SB_LIB_H_ #define _AMD_SB_LIB_H_ -typedef signed char *va_list; -#ifndef _INTSIZEOF - #define _INTSIZEOF (n) ( (sizeof(n) + sizeof(UINTN) - 1) & ~(sizeof(UINTN) - 1) ) -#endif - -// Also support coding convention rules for var arg macros -#ifndef va_start - #define va_start(ap, v) ( ap = (va_list)&(v) + _INTSIZEOF (v) ) -#endif -#define va_arg(ap, t) ( *(t *) ((ap += _INTSIZEOF (t)) - _INTSIZEOF (t)) ) -#define va_end(ap) ( ap = (va_list)0 ) - +#include #pragma pack (push, 1) diff --git a/src/southbridge/amd/cimx/sb900/AmdSbLib.h b/src/southbridge/amd/cimx/sb900/AmdSbLib.h index cc75353f3d..c13eda4e58 100644 --- a/src/southbridge/amd/cimx/sb900/AmdSbLib.h +++ b/src/southbridge/amd/cimx/sb900/AmdSbLib.h @@ -20,18 +20,7 @@ #ifndef _AMD_SB_LIB_H_ #define _AMD_SB_LIB_H_ -typedef signed char *va_list; -#ifndef _INTSIZEOF - #define _INTSIZEOF (n) ( (sizeof(n) + sizeof(UINTN) - 1) & ~(sizeof(UINTN) - 1) ) -#endif - -// Also support coding convention rules for var arg macros -#ifndef va_start - #define va_start(ap, v) ( ap = (va_list)&(v) + _INTSIZEOF (v) ) -#endif -#define va_arg(ap, t) ( *(t *) ((ap += _INTSIZEOF (t)) - _INTSIZEOF (t)) ) -#define va_end(ap) ( ap = (va_list)0 ) - +#include #pragma pack (push, 1) -- cgit v1.2.3