Path: blob/master/arch/powerpc/platforms/powernv/opal-kmsg.c
26481 views
// SPDX-License-Identifier: GPL-2.0-or-later1/*2* kmsg dumper that ensures the OPAL console fully flushes panic messages3*4* Author: Russell Currey <[email protected]>5*6* Copyright 2015 IBM Corporation.7*/89#include <linux/kmsg_dump.h>1011#include <asm/opal.h>12#include <asm/opal-api.h>1314/*15* Console output is controlled by OPAL firmware. The kernel regularly calls16* OPAL_POLL_EVENTS, which flushes some console output. In a panic state,17* however, the kernel no longer calls OPAL_POLL_EVENTS and the panic message18* may not be completely printed. This function does not actually dump the19* message, it just ensures that OPAL completely flushes the console buffer.20*/21static void kmsg_dump_opal_console_flush(struct kmsg_dumper *dumper,22struct kmsg_dump_detail *detail)23{24/*25* Outside of a panic context the pollers will continue to run,26* so we don't need to do any special flushing.27*/28if (detail->reason != KMSG_DUMP_PANIC)29return;3031opal_flush_console(0);32}3334static struct kmsg_dumper opal_kmsg_dumper = {35.dump = kmsg_dump_opal_console_flush36};3738void __init opal_kmsg_init(void)39{40int rc;4142/* Add our dumper to the list */43rc = kmsg_dump_register(&opal_kmsg_dumper);44if (rc != 0)45pr_err("opal: kmsg_dump_register failed; returned %d\n", rc);46}474849