@@ -198,10 +198,6 @@ static void inmem_write(char c)
opos |= MEMCONS_OUT_POS_WRAP;
lwsync();
memcons.out_pos = cpu_to_be32(opos);
-
- /* If head reaches tail, push tail around & drop chars */
- if (con_in == con_out)
- con_out = (con_in + 1) % INMEM_CON_OUT_LEN;
}
static size_t inmem_read(char *buf, size_t req)
@@ -221,10 +217,11 @@ static size_t inmem_read(char *buf, size_t req)
static void write_char(char c)
{
-#ifdef MAMBO_DEBUG_CONSOLE
- mambo_console_write(&c, 1);
-#endif
inmem_write(c);
+
+ /* If head reaches tail, push tail around & drop chars */
+ if (con_out == memcons.out_pos)
+ con_out = (memcons.out_pos + 1) % memcons.obuf_size;
}
ssize_t console_write(bool flush_to_drivers, const void *buf, size_t count)
The con_out global tracks how much of the skiboot log buffer has been written out to the driver. We'd like to re-use inmem_write() so that we can have multiple memcons instances so move the con_out tracking into write_char() which is used to write a single character into the skiboot log buffer. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> --- core/console.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)