diff options
author | Heiko Carstens <hca@linux.ibm.com> | 2022-11-28 16:16:06 +0300 |
---|---|---|
committer | Alexander Gordeev <agordeev@linux.ibm.com> | 2022-12-06 18:18:24 +0300 |
commit | b64d7254ffe8b11010150fa97a4b235ec36e7a90 (patch) | |
tree | 1e4f621e54677d19f5253d8ec91476497abe5ce4 /drivers/s390 | |
parent | a4c41fe3985d4c1c31d84833b30fd9ac48fe6f84 (diff) | |
download | linux-b64d7254ffe8b11010150fa97a4b235ec36e7a90.tar.xz |
s390/sclp: introduce sclp_emergency_printk()
Introduce sclp_emergency_printk() which can be used to emit a message
in emergency cases. sclp_emergency_printk() is only supposed to be
used in cases where it can be assumed that regular console device
drivers may not work anymore.
For example this may be the case for unrecoverable machine checks.
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/char/sclp_early_core.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/s390/char/sclp_early_core.c b/drivers/s390/char/sclp_early_core.c index baf1cd2b0854..ac1d00980fa6 100644 --- a/drivers/s390/char/sclp_early_core.c +++ b/drivers/s390/char/sclp_early_core.c @@ -241,6 +241,30 @@ void sclp_early_printk(const char *str) } /* + * Use sclp_emergency_printk() to print a string when the system is in a + * state where regular console drivers cannot be assumed to work anymore. + * + * Callers must make sure that no concurrent SCLP requests are outstanding + * and all other CPUs are stopped, or at least disabled for external + * interrupts. + */ +void sclp_emergency_printk(const char *str) +{ + int have_linemode, have_vt220; + unsigned int len; + + len = strlen(str); + /* + * Don't care about return values; if requests fail, just ignore and + * continue to have a rather high chance that anything is printed. + */ + sclp_early_setup(0, &have_linemode, &have_vt220); + sclp_early_print_lm(str, len); + sclp_early_print_vt220(str, len); + sclp_early_setup(1, &have_linemode, &have_vt220); +} + +/* * We can't pass sclp_info_sccb to sclp_early_cmd() here directly, * because it might not fulfil the requiremets for a SCLP communication buffer: * - lie below 2G in memory |