summaryrefslogtreecommitdiff
path: root/src/console/vtxprintf.c
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2014-02-04 14:28:17 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2014-04-09 13:25:14 +0200
commitb04e0fff7da5547e2152dc8f6f23af247e9048ec (patch)
treefeee0da3d558f1428086c16a9d7aaa51a5ffbcde /src/console/vtxprintf.c
parent657e0be46495bb54ddf5a0fbad786fe352c2847f (diff)
console: Simplify vtxprintf
We do not need ROMCC support here and using wrappers for console_tx_byte we can simplify this code. Change-Id: I7f3b5acdfd0bde1d832b16418339dd5e232627e7 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/5334 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Diffstat (limited to 'src/console/vtxprintf.c')
-rw-r--r--src/console/vtxprintf.c42
1 files changed, 8 insertions, 34 deletions
diff --git a/src/console/vtxprintf.c b/src/console/vtxprintf.c
index 502d53e818..d4d70b67e3 100644
--- a/src/console/vtxprintf.c
+++ b/src/console/vtxprintf.c
@@ -8,15 +8,7 @@
#include <console/console.h>
#include <console/vtxprintf.h>
-#if !defined (__ROMCC__) && !defined(__SMM__)
-#define DATA_ARG , data
-#define DATA_ARG_DECL , void *data
-#else
-#define DATA_ARG
-#define DATA_ARG_DECL
-#endif
-
-#define call_tx(x) tx_byte(x DATA_ARG)
+#define call_tx(x) tx_byte(x, data)
/* haha, don't need ctype.c */
#define isdigit(c) ((c) >= '0' && (c) <= '9')
@@ -40,9 +32,9 @@ static int skip_atoi(const char **s)
#define SPECIAL 32 /* 0x */
#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
-static int number(void (*tx_byte)(unsigned char byte DATA_ARG_DECL),
- unsigned long long num, int base, int size, int precision, int type
- DATA_ARG_DECL)
+static int number(void (*tx_byte)(unsigned char byte, void *data),
+ unsigned long long num, int base, int size, int precision, int type,
+ void *data)
{
char c,sign,tmp[66];
const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
@@ -112,12 +104,8 @@ static int number(void (*tx_byte)(unsigned char byte DATA_ARG_DECL),
}
-#if !defined (__ROMCC__) && !defined(__SMM__)
-int vtxdprintf(void (*tx_byte)(unsigned char byte, void *data),
+int vtxprintf(void (*tx_byte)(unsigned char byte, void *data),
const char *fmt, va_list args, void *data)
-#else
-int vtxprintf(void (*tx_byte)(unsigned char byte), const char *fmt, va_list args)
-#endif
{
int len;
unsigned long long num;
@@ -135,7 +123,7 @@ int vtxprintf(void (*tx_byte)(unsigned char byte), const char *fmt, va_list args
#if defined(__SMM__) && CONFIG_SMM_TSEG
/* Fix pointer in TSEG */
- tx_byte = console_tx_byte;
+ tx_byte = wrap_putchar;
#endif
for (count=0; *fmt ; ++fmt) {
@@ -236,7 +224,7 @@ repeat:
}
count += number(tx_byte,
(unsigned long) va_arg(args, void *), 16,
- field_width, precision, flags DATA_ARG);
+ field_width, precision, flags, data);
continue;
case 'n':
@@ -300,21 +288,7 @@ repeat:
} else {
num = va_arg(args, unsigned int);
}
- count += number(tx_byte, num, base, field_width, precision, flags DATA_ARG);
+ count += number(tx_byte, num, base, field_width, precision, flags, data);
}
return count;
}
-
-
-#if !defined (__ROMCC__) && !defined(__SMM__)
-static void wrap_tx_byte (unsigned char byte, void *data)
-{
- void (*tx_byte)(unsigned char byte) = data;
- tx_byte (byte);
-}
-
-int vtxprintf(void (*tx_byte)(unsigned char byte), const char *fmt, va_list args)
-{
- return vtxdprintf(wrap_tx_byte, fmt, args, tx_byte);
-}
-#endif