2 * S390 kdump lowlevel functions (new kernel)
4 * Copyright IBM Corp. 2011
5 * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
8 #define DATAMOVER_ADDR 0x4000
9 #define COPY_PAGE_ADDR 0x6000
11 #ifdef CONFIG_CRASH_DUMP
14 # kdump entry (new kernel - not yet relocated)
16 # Note: This code has to be position independent
21 lhi %r1,2 # mode 2 = esame (dump)
22 sigp %r1,%r0,0x12 # Switch to esame mode
23 sam64 # Switch to 64 bit addressing
26 larl %r2,.Lbase_addr # Check, if we have been
27 lg %r2,0(%r2) # already relocated:
29 jne .Lrelocate # No : Start data mover
30 lghi %r2,0 # Yes: Start kdump kernel
31 brasl %r14,startup_kdump_relocated
35 lg %r2,0x418(%r4) # Get kdump base
36 lg %r3,0x420(%r4) # Get kdump size
38 larl %r10,.Lcopy_start # Source of data mover
39 lghi %r8,DATAMOVER_ADDR # Target of data mover
40 mvc 0(256,%r8),0(%r10) # Copy data mover code
42 agr %r8,%r2 # Copy data mover to
43 mvc 0(256,%r8),0(%r10) # reserved mem
45 lghi %r14,DATAMOVER_ADDR # Jump to copied data mover
51 # kdump data mover code (runs at address DATAMOVER_ADDR)
53 # r2: kdump base address
59 lgr %r11,%r2 # Save kdump base address
61 agr %r12,%r3 # Compute kdump end address
64 lghi %r10,COPY_PAGE_ADDR # Load copy page address
66 mvc 0(256,%r10),0(%r5) # Copy old kernel to tmp
67 mvc 0(256,%r5),0(%r11) # Copy new kernel to old
68 mvc 0(256,%r11),0(%r10) # Copy tmp to new
74 lg %r14,.Lstartup_kdump-0b(%r13)
75 basr %r14,%r14 # Start relocated kernel
77 .long 0x00000000,0x00000000 + startup_kdump_relocated
81 # Startup of kdump (relocated new kernel)
84 startup_kdump_relocated:
87 mvc 0(8,%r0),.Lrestart_psw-0b(%r13) # Setup restart PSW
88 mvc 464(16,%r0),.Lpgm_psw-0b(%r13) # Setup pgm check PSW
89 lhi %r1,1 # Start new kernel
90 diag %r1,%r1,0x308 # with diag 308
92 .Lno_diag308: # No diag 308
93 sam31 # Switch to 31 bit addr mode
94 sr %r1,%r1 # Erase register r1
95 sr %r2,%r2 # Erase register r2
96 sigp %r1,%r2,0x12 # Switch to 31 bit arch mode
97 lpsw 0 # Start new kernel...
100 .long 0x00080000,0x80000000 + startup
102 .quad 0x0000000180000000,0x0000000000000000 + .Lno_diag308
107 larl %r13,startup_kdump_crash
111 .quad 0x0002000080000000,0x0000000000000000 + startup_kdump_crash
114 0: lpsw startup_kdump_crash-0b(%r13)
117 .long 0x000a0000,0x00000000 + startup_kdump_crash
118 #endif /* CONFIG_64BIT */
119 #endif /* CONFIG_CRASH_DUMP */