1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_S390_BOOT_DATA_H
3 
4 #include <linux/string.h>
5 #include <asm/setup.h>
6 #include <asm/ipl.h>
7 
8 extern char early_command_line[COMMAND_LINE_SIZE];
9 extern struct ipl_parameter_block ipl_block;
10 extern int ipl_block_valid;
11 extern int ipl_secure_flag;
12 
13 extern unsigned long ipl_cert_list_addr;
14 extern unsigned long ipl_cert_list_size;
15 
16 extern unsigned long early_ipl_comp_list_addr;
17 extern unsigned long early_ipl_comp_list_size;
18 
19 extern char boot_rb[PAGE_SIZE * 2];
20 extern bool boot_earlyprintk;
21 extern size_t boot_rb_off;
22 extern char bootdebug_filter[128];
23 extern bool bootdebug;
24 
25 #define boot_rb_foreach(cb)							\
26 	do {									\
27 		size_t off = boot_rb_off + strlen(boot_rb + boot_rb_off) + 1;	\
28 		size_t len;							\
29 		for (; off < sizeof(boot_rb) && (len = strlen(boot_rb + off)); off += len + 1) \
30 			cb(boot_rb + off);					\
31 		for (off = 0; off < boot_rb_off && (len = strlen(boot_rb + off)); off += len + 1) \
32 			cb(boot_rb + off);					\
33 	} while (0)
34 
35 /*
36  * bootdebug_filter is a comma separated list of strings,
37  * where each string can be a prefix of the message.
38  */
bootdebug_filter_match(const char * buf)39 static inline bool bootdebug_filter_match(const char *buf)
40 {
41 	char *p = bootdebug_filter, *s;
42 	char *end;
43 
44 	if (!*p)
45 		return true;
46 
47 	end = p + strlen(p);
48 	while (p < end) {
49 		p = skip_spaces(p);
50 		s = memscan(p, ',', end - p);
51 		if (!strncmp(p, buf, s - p))
52 			return true;
53 		p = s + 1;
54 	}
55 	return false;
56 }
57 
skip_timestamp(const char * buf)58 static inline const char *skip_timestamp(const char *buf)
59 {
60 #ifdef CONFIG_PRINTK_TIME
61 	const char *p = memchr(buf, ']', strlen(buf));
62 
63 	if (p && p[1] == ' ')
64 		return p + 2;
65 #endif
66 	return buf;
67 }
68 
69 #endif /* _ASM_S390_BOOT_DATA_H */
70