@@ -174,6 +174,9 @@ bool flush_console(void)
return ret;
}
+static size_t total_bytes = 0;
+static int total_cache_lines = 0;
+
static void inmem_write(char c)
{
uint32_t opos;
@@ -186,6 +189,16 @@ static void inmem_write(char c)
con_wrapped = true;
}
+ total_bytes++;
+ if (total_bytes > 127) {
+ asm volatile("dcbf %0,%1"
+ :
+ : "a" (INMEM_CON_START), "b" ((total_cache_lines % (INMEM_CON_LEN / 128)) * 128)
+ : "memory");
+ total_cache_lines++;
+ total_bytes = 0;
+ }
+
/*
* We must always re-generate memcons.out_pos because
* under some circumstances, the console script will
@@ -247,6 +260,10 @@ ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count)
if (need_unlock)
unlock(&con_lock);
+ asm volatile("dcbf %0,%1"
+ :
+ : "r" (0), "b" (&memcons)
+ : "memory");
return count;
}
Flush console buffer to memory every 128 bytes so utilties that read the DIMMs will be able to access the console. Also flush the memcons structure so we know when the console is updated. Signed-off-by: Ryan Grimm <grimm@linux.ibm.com> --- core/console.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)