Add support to run SMM handler in TSEG instead of ASEG
[coreboot.git] / src / console / vtxprintf.c
index 944fd5b96f348f9cf14d2065ff8730da04dae1ed..a370e5f21ddd591cef4c08fbc74e7117b47675b4 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <string.h>
 #include <div64.h>
+#include <console/console.h>
 #include <console/vtxprintf.h>
 
 /* haha, don't need ctype.c */
@@ -115,6 +116,11 @@ int vtxprintf(void (*tx_byte)(unsigned char byte), const char *fmt, va_list args
 
        int count;
 
+#if defined(__SMM__) && CONFIG_SMM_TSEG
+       /* Fix pointer in TSEG */
+       tx_byte = console_tx_byte;
+#endif
+
        for (count=0; *fmt ; ++fmt) {
                if (*fmt != '%') {
                        tx_byte(*fmt), count++;
@@ -123,7 +129,7 @@ int vtxprintf(void (*tx_byte)(unsigned char byte), const char *fmt, va_list args
 
                /* process flags */
                flags = 0;
-               repeat:
+repeat:
                        ++fmt;          /* this also skips first '%' */
                        switch (*fmt) {
                                case '-': flags |= LEFT; goto repeat;