Commit b64d7254 authored by Heiko Carstens's avatar Heiko Carstens Committed by Alexander Gordeev

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: default avatarPeter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
parent a4c41fe3
......@@ -132,6 +132,7 @@ void sclp_early_get_ipl_info(struct sclp_ipl_info *info);
void sclp_early_detect(void);
void sclp_early_printk(const char *s);
void __sclp_early_printk(const char *s, unsigned int len);
void sclp_emergency_printk(const char *s);
int sclp_early_get_memsize(unsigned long *mem);
int sclp_early_get_hsa_size(unsigned long *hsa_size);
......
......@@ -240,6 +240,30 @@ void sclp_early_printk(const char *str)
__sclp_early_printk(str, strlen(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:
......
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