Commit 3a80bfc7 authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman

powerpc/powernv: opal-kmsg standardise OPAL_BUSY handling

OPAL_CONSOLE_FLUSH is documented as being able to return OPAL_BUSY,
so implement the standard OPAL_BUSY handling for it.
Reviewed-by: default avatarRussell Currey <ruscur@russell.cc>
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 36d2dabc
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
*/ */
#include <linux/kmsg_dump.h> #include <linux/kmsg_dump.h>
#include <linux/delay.h>
#include <asm/opal.h> #include <asm/opal.h>
#include <asm/opal-api.h> #include <asm/opal-api.h>
...@@ -26,8 +27,7 @@ ...@@ -26,8 +27,7 @@
static void force_opal_console_flush(struct kmsg_dumper *dumper, static void force_opal_console_flush(struct kmsg_dumper *dumper,
enum kmsg_dump_reason reason) enum kmsg_dump_reason reason)
{ {
int i; s64 rc;
int64_t ret;
/* /*
* Outside of a panic context the pollers will continue to run, * Outside of a panic context the pollers will continue to run,
...@@ -37,14 +37,22 @@ static void force_opal_console_flush(struct kmsg_dumper *dumper, ...@@ -37,14 +37,22 @@ static void force_opal_console_flush(struct kmsg_dumper *dumper,
return; return;
if (opal_check_token(OPAL_CONSOLE_FLUSH)) { if (opal_check_token(OPAL_CONSOLE_FLUSH)) {
ret = opal_console_flush(0); do {
rc = OPAL_BUSY;
if (ret == OPAL_UNSUPPORTED || ret == OPAL_PARAMETER) while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
return; rc = opal_console_flush(0);
if (rc == OPAL_BUSY_EVENT) {
mdelay(OPAL_BUSY_DELAY_MS);
opal_poll_events(NULL);
} else if (rc == OPAL_BUSY) {
mdelay(OPAL_BUSY_DELAY_MS);
}
}
} while (rc == OPAL_PARTIAL); /* More to flush */
/* Incrementally flush until there's nothing left */
while (opal_console_flush(0) != OPAL_SUCCESS);
} else { } else {
int i;
/* /*
* If OPAL_CONSOLE_FLUSH is not implemented in the firmware, * If OPAL_CONSOLE_FLUSH is not implemented in the firmware,
* the console can still be flushed by calling the polling * the console can still be flushed by calling the polling
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment