[Skiboot] [RFC PATCH 06/12] core/console: Kill con_in
Oliver O'Halloran
oohall at gmail.com
Tue May 19 15:46:27 AEST 2020
The con_in variable is used to keep track of where the write pointer of
the skiboot log buffer is. The memcons.out_pos field tracks the same
information so we can remove con_in and use the internal field instead.
Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
core/console.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/core/console.c b/core/console.c
index 8be7ee578b18..3ef360fe0c65 100644
--- a/core/console.c
+++ b/core/console.c
@@ -16,7 +16,6 @@
#include <cpu.h>
static char *con_buf = (char *)INMEM_CON_START;
-static size_t con_in;
/*
* Skiboot is both the producer and consumer of the memcons. On the consumer
@@ -110,7 +109,7 @@ static bool __flush_console(bool flush_to_drivers, bool need_unlock)
static bool in_flush, more_flush;
/* Is there anything to flush ? Bail out early if not */
- if (con_in == con_out || !con_driver)
+ if (memcons.out_pos == con_out || !con_driver)
return false;
/*
@@ -149,7 +148,7 @@ static bool __flush_console(bool flush_to_drivers, bool need_unlock)
* con_out.
*/
if (!flush_to_drivers) {
- con_out = con_in;
+ con_out = memcons.out_pos;
in_flush = false;
return false;
}
@@ -157,11 +156,11 @@ static bool __flush_console(bool flush_to_drivers, bool need_unlock)
do {
more_flush = false;
- if (con_out > con_in) {
+ if (con_out > memcons.out_pos) {
req = INMEM_CON_OUT_LEN - con_out;
more_flush = true;
} else
- req = con_in - con_out;
+ req = memcons.out_pos - con_out;
unlock(&con_lock);
len = con_driver->write(con_buf + con_out, req);
@@ -175,7 +174,7 @@ static bool __flush_console(bool flush_to_drivers, bool need_unlock)
} while(more_flush);
in_flush = false;
- return con_out != con_in;
+ return con_out != memcons.out_pos;
}
bool flush_console(void)
@@ -195,9 +194,9 @@ static void inmem_write(char c)
if (!c)
return;
- con_buf[con_in++] = c;
- if (con_in >= INMEM_CON_OUT_LEN) {
- con_in = 0;
+ memcons.obuf[memcons.out_pos++] = c;
+ if (memcons.out_pos >= INMEM_CON_OUT_LEN) {
+ memcons.out_pos = 0;
con_wrapped = true;
}
@@ -208,7 +207,7 @@ static void inmem_write(char c)
* 8 bytes containing out_pos and in_prod, thus corrupting
* out_pos
*/
- opos = con_in;
+ opos = memcons.out_pos;
if (con_wrapped)
opos |= MEMCONS_OUT_POS_WRAP;
lwsync();
--
2.26.2
More information about the Skiboot
mailing list