mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-27 04:22:58 +00:00
s390/boot: Add support for boot messages loglevels
Add message severity levels for boot messages, similar to the main kernel. Support command-line options that control console output verbosity, including "loglevel," "ignore_loglevel," "debug," and "quiet". Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Acked-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
This commit is contained in:
committed by
Alexander Gordeev
parent
92b712fa7d
commit
d538fdc49a
@@ -8,6 +8,7 @@
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/printk.h>
|
||||
#include <asm/physmem_info.h>
|
||||
|
||||
struct machine_info {
|
||||
@@ -76,7 +77,18 @@ void print_stacktrace(unsigned long sp);
|
||||
void error(char *m);
|
||||
int get_random(unsigned long limit, unsigned long *value);
|
||||
|
||||
#define boot_emerg(fmt, ...) boot_printk(KERN_EMERG fmt, ##__VA_ARGS__)
|
||||
#define boot_alert(fmt, ...) boot_printk(KERN_ALERT fmt, ##__VA_ARGS__)
|
||||
#define boot_crit(fmt, ...) boot_printk(KERN_CRIT fmt, ##__VA_ARGS__)
|
||||
#define boot_err(fmt, ...) boot_printk(KERN_ERR fmt, ##__VA_ARGS__)
|
||||
#define boot_warn(fmt, ...) boot_printk(KERN_WARNING fmt, ##__VA_ARGS__)
|
||||
#define boot_notice(fmt, ...) boot_printk(KERN_NOTICE fmt, ##__VA_ARGS__)
|
||||
#define boot_info(fmt, ...) boot_printk(KERN_INFO fmt, ##__VA_ARGS__)
|
||||
#define boot_debug(fmt, ...) boot_printk(KERN_DEBUG fmt, ##__VA_ARGS__)
|
||||
|
||||
extern struct machine_info machine;
|
||||
extern int boot_console_loglevel;
|
||||
extern bool boot_ignore_loglevel;
|
||||
|
||||
/* Symbols defined by linker scripts */
|
||||
extern const char kernel_version[];
|
||||
|
||||
@@ -313,5 +313,16 @@ void parse_boot_command_line(void)
|
||||
#endif
|
||||
if (!strcmp(param, "relocate_lowcore") && test_facility(193))
|
||||
relocate_lowcore = 1;
|
||||
if (!strcmp(param, "debug"))
|
||||
boot_console_loglevel = CONSOLE_LOGLEVEL_DEBUG;
|
||||
if (!strcmp(param, "quiet"))
|
||||
boot_console_loglevel = CONSOLE_LOGLEVEL_QUIET;
|
||||
if (!strcmp(param, "ignore_loglevel"))
|
||||
boot_ignore_loglevel = true;
|
||||
if (!strcmp(param, "loglevel")) {
|
||||
boot_console_loglevel = simple_strtoull(val, NULL, 10);
|
||||
if (boot_console_loglevel < CONSOLE_LOGLEVEL_MIN)
|
||||
boot_console_loglevel = CONSOLE_LOGLEVEL_MIN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
#include <asm/uv.h>
|
||||
#include "boot.h"
|
||||
|
||||
int boot_console_loglevel = CONFIG_CONSOLE_LOGLEVEL_DEFAULT;
|
||||
bool boot_ignore_loglevel;
|
||||
|
||||
const char hex_asc[] = "0123456789abcdef";
|
||||
|
||||
static char *as_hex(char *dst, unsigned long val, int pad)
|
||||
@@ -131,6 +134,25 @@ static noinline char *strsym(char *buf, void *ip)
|
||||
return buf;
|
||||
}
|
||||
|
||||
static inline int printk_loglevel(const char *buf)
|
||||
{
|
||||
if (buf[0] == KERN_SOH_ASCII && buf[1]) {
|
||||
switch (buf[1]) {
|
||||
case '0' ... '7':
|
||||
return buf[1] - '0';
|
||||
}
|
||||
}
|
||||
return MESSAGE_LOGLEVEL_DEFAULT;
|
||||
}
|
||||
|
||||
static void boot_console_earlyprintk(const char *buf)
|
||||
{
|
||||
int level = printk_loglevel(buf);
|
||||
|
||||
if (boot_ignore_loglevel || level < boot_console_loglevel)
|
||||
sclp_early_printk(printk_skip_level(buf));
|
||||
}
|
||||
|
||||
#define va_arg_len_type(args, lenmod, typemod) \
|
||||
((lenmod == 'l') ? va_arg(args, typemod long) : \
|
||||
(lenmod == 'h') ? (typemod short)va_arg(args, typemod int) : \
|
||||
@@ -150,6 +172,11 @@ void boot_printk(const char *fmt, ...)
|
||||
ssize_t len;
|
||||
int pad;
|
||||
|
||||
if (!printk_get_level(fmt)) {
|
||||
*p++ = KERN_SOH_ASCII;
|
||||
*p++ = '0' + MESSAGE_LOGLEVEL_DEFAULT;
|
||||
}
|
||||
|
||||
va_start(args, fmt);
|
||||
for (; p < end && *fmt; fmt++) {
|
||||
if (*fmt != '%') {
|
||||
@@ -202,5 +229,5 @@ void boot_printk(const char *fmt, ...)
|
||||
}
|
||||
out:
|
||||
va_end(args);
|
||||
sclp_early_printk(buf);
|
||||
boot_console_earlyprintk(buf);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user