aboutsummaryrefslogtreecommitdiff
path: root/slof/ppc64.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2017-06-01 14:38:57 +0200
committerAlexey Kardashevskiy <aik@ozlabs.ru>2017-06-06 16:08:45 +1000
commitd258260ee4fd48948bb0c61d22ee96b97c934c5e (patch)
tree38977e258892c565503e76e3598a8406997bcfc1 /slof/ppc64.c
parent11ff4ba277ca9a9dc51136bab64772c9ac1541f6 (diff)
downloadSLOF-d258260ee4fd48948bb0c61d22ee96b97c934c5e.zip
SLOF-d258260ee4fd48948bb0c61d22ee96b97c934c5e.tar.gz
SLOF-d258260ee4fd48948bb0c61d22ee96b97c934c5e.tar.bz2
Use TYPE for the standard output instead of io_putchar()
All stdout text from the C code of the paflof binary (e.g. all output from printf() and friends) is currently only written via io_putchar() to the hvterm console. If the user decided to use a VGA display instead, the text is currently not shown there. This is especially affecting the output of the TFTP boot functions which are using printf() to provide valuable information like IP addresses and progress indication to the user. Let's fix this nuisance by routing the stdout text through the TYPE Forth word instead, so that it now shows up on both, the hvterm console and the VGA console. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'slof/ppc64.c')
-rw-r--r--slof/ppc64.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/slof/ppc64.c b/slof/ppc64.c
index a3e84ae..83a8e82 100644
--- a/slof/ppc64.c
+++ b/slof/ppc64.c
@@ -71,19 +71,36 @@ static long writeLogByte_wrapper(long x, long y)
*/
ssize_t write(int fd, const void *buf, size_t count)
{
- int i;
char *ptr = (char *)buf;
+ int len;
if (fd != 1 && fd != 2)
return 0;
- for (i = 0; i < count; i++) {
- if (*ptr == '\n')
- io_putchar('\r');
- io_putchar(*ptr++);
+ if (!init_engine || fd == 2) {
+ len = count;
+ while (len-- > 0) {
+ if (*ptr == '\n')
+ io_putchar('\r');
+ io_putchar(*ptr++);
+ }
+ return count;
+ }
+
+ while ((ptr = strchr(buf, '\n')) != NULL) {
+ forth_push((long)buf);
+ forth_push((long)ptr - (long)buf);
+ forth_eval("type cr");
+ buf = ptr + 1;
+ }
+ len = strlen(buf);
+ if (len) {
+ forth_push((long)buf);
+ forth_push(len);
+ forth_eval("type");
}
- return i;
+ return count;
}
/* This should probably be temporary until a better solution is found */