console: Expose vsnprintf

It's a standard function.

Change-Id: I039cce2dfc4e168804eb7d12b76a29af712ac7a1
Signed-off-by: David Hendricks <dhendricks@fb.com>
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/23616
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
David Hendricks 2018-01-28 18:01:10 -08:00 committed by Patrick Georgi
parent b90c0d90cf
commit 6053a9ce05
4 changed files with 8 additions and 25 deletions

View File

@ -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;

View File

@ -4,6 +4,10 @@
#include <stddef.h>
#include <stdlib.h>
#if !defined(__ROMCC__)
#include <console/vtxprintf.h>
#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

View File

@ -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 <console/vtxprintf.h>
#pragma pack (push, 1)

View File

@ -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 <console/vtxprintf.h>
#pragma pack (push, 1)