summaryrefslogtreecommitdiff
path: root/arch/s390/boot/pgm_check_info.c
blob: 633f11600aab3a0d2a0ba2c54dffab2d55497ea8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// SPDX-License-Identifier: GPL-2.0
#include <linux/kernel.h>
#include <linux/stdarg.h>
#include <linux/string.h>
#include <linux/ctype.h>
#include <asm/stacktrace.h>
#include <asm/boot_data.h>
#include <asm/lowcore.h>
#include <asm/setup.h>
#include <asm/sclp.h>
#include <asm/uv.h>
#include "boot.h"

void print_stacktrace(unsigned long sp)
{
	struct stack_info boot_stack = { STACK_TYPE_TASK, (unsigned long)_stack_start,
					 (unsigned long)_stack_end };
	bool first = true;

	boot_emerg("Call Trace:\n");
	while (!(sp & 0x7) && on_stack(&boot_stack, sp, sizeof(struct stack_frame))) {
		struct stack_frame *sf = (struct stack_frame *)sp;

		if (first)
			boot_emerg("(sp:%016lx [<%016lx>] %pS)\n", sp, sf->gprs[8], (void *)sf->gprs[8]);
		else
			boot_emerg(" sp:%016lx [<%016lx>] %pS\n", sp, sf->gprs[8], (void *)sf->gprs[8]);
		if (sf->back_chain <= sp)
			break;
		sp = sf->back_chain;
		first = false;
	}
}

void print_pgm_check_info(void)
{
	unsigned long *gpregs = (unsigned long *)get_lowcore()->gpregs_save_area;
	struct psw_bits *psw = &psw_bits(get_lowcore()->psw_save_area);

	if (bootdebug)
		boot_rb_dump();
	boot_emerg("Linux version %s\n", kernel_version);
	if (!is_prot_virt_guest() && early_command_line[0])
		boot_emerg("Kernel command line: %s\n", early_command_line);
	boot_emerg("Kernel fault: interruption code %04x ilc:%d\n",
		   get_lowcore()->pgm_code, get_lowcore()->pgm_ilc >> 1);
	if (kaslr_enabled()) {
		boot_emerg("Kernel random base: %lx\n", __kaslr_offset);
		boot_emerg("Kernel random base phys: %lx\n", __kaslr_offset_phys);
	}
	boot_emerg("PSW : %016lx %016lx (%pS)\n",
		   get_lowcore()->psw_save_area.mask,
		   get_lowcore()->psw_save_area.addr,
		   (void *)get_lowcore()->psw_save_area.addr);
	boot_emerg("      R:%x T:%x IO:%x EX:%x Key:%x M:%x W:%x P:%x AS:%x CC:%x PM:%x RI:%x EA:%x\n",
		   psw->per, psw->dat, psw->io, psw->ext, psw->key, psw->mcheck,
		   psw->wait, psw->pstate, psw->as, psw->cc, psw->pm, psw->ri, psw->eaba);
	boot_emerg("GPRS: %016lx %016lx %016lx %016lx\n", gpregs[0], gpregs[1], gpregs[2], gpregs[3]);
	boot_emerg("      %016lx %016lx %016lx %016lx\n", gpregs[4], gpregs[5], gpregs[6], gpregs[7]);
	boot_emerg("      %016lx %016lx %016lx %016lx\n", gpregs[8], gpregs[9], gpregs[10], gpregs[11]);
	boot_emerg("      %016lx %016lx %016lx %016lx\n", gpregs[12], gpregs[13], gpregs[14], gpregs[15]);
	print_stacktrace(get_lowcore()->gpregs_save_area[15]);
	boot_emerg("Last Breaking-Event-Address:\n");
	boot_emerg(" [<%016lx>] %pS\n", (unsigned long)get_lowcore()->pgm_last_break,
		   (void *)get_lowcore()->pgm_last_break);
}