Michael Holzheu | 60a0c68 | 2011-10-30 15:16:40 +0100 | [diff] [blame] | 1 | /* |
| 2 | * S390 kdump lowlevel functions (new kernel) |
| 3 | * |
| 4 | * Copyright IBM Corp. 2011 |
| 5 | * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com> |
| 6 | */ |
| 7 | |
Heiko Carstens | eb54619 | 2012-06-04 15:05:43 +0200 | [diff] [blame] | 8 | #include <asm/sigp.h> |
| 9 | |
Michael Holzheu | 60a0c68 | 2011-10-30 15:16:40 +0100 | [diff] [blame] | 10 | #define DATAMOVER_ADDR 0x4000 |
| 11 | #define COPY_PAGE_ADDR 0x6000 |
| 12 | |
| 13 | #ifdef CONFIG_CRASH_DUMP |
| 14 | |
| 15 | # |
| 16 | # kdump entry (new kernel - not yet relocated) |
| 17 | # |
| 18 | # Note: This code has to be position independent |
| 19 | # |
| 20 | |
| 21 | .align 2 |
| 22 | .Lep_startup_kdump: |
| 23 | lhi %r1,2 # mode 2 = esame (dump) |
Heiko Carstens | eb54619 | 2012-06-04 15:05:43 +0200 | [diff] [blame] | 24 | sigp %r1,%r0,SIGP_SET_ARCHITECTURE # Switch to esame mode |
Michael Holzheu | 60a0c68 | 2011-10-30 15:16:40 +0100 | [diff] [blame] | 25 | sam64 # Switch to 64 bit addressing |
| 26 | basr %r13,0 |
| 27 | .Lbase: |
| 28 | larl %r2,.Lbase_addr # Check, if we have been |
| 29 | lg %r2,0(%r2) # already relocated: |
| 30 | clgr %r2,%r13 # |
| 31 | jne .Lrelocate # No : Start data mover |
| 32 | lghi %r2,0 # Yes: Start kdump kernel |
| 33 | brasl %r14,startup_kdump_relocated |
| 34 | |
| 35 | .Lrelocate: |
| 36 | larl %r4,startup |
| 37 | lg %r2,0x418(%r4) # Get kdump base |
| 38 | lg %r3,0x420(%r4) # Get kdump size |
| 39 | |
| 40 | larl %r10,.Lcopy_start # Source of data mover |
| 41 | lghi %r8,DATAMOVER_ADDR # Target of data mover |
| 42 | mvc 0(256,%r8),0(%r10) # Copy data mover code |
| 43 | |
| 44 | agr %r8,%r2 # Copy data mover to |
| 45 | mvc 0(256,%r8),0(%r10) # reserved mem |
| 46 | |
| 47 | lghi %r14,DATAMOVER_ADDR # Jump to copied data mover |
| 48 | basr %r14,%r14 |
| 49 | .Lbase_addr: |
| 50 | .quad .Lbase |
| 51 | |
| 52 | # |
| 53 | # kdump data mover code (runs at address DATAMOVER_ADDR) |
| 54 | # |
| 55 | # r2: kdump base address |
| 56 | # r3: kdump size |
| 57 | # |
| 58 | .Lcopy_start: |
| 59 | basr %r13,0 # Base |
| 60 | 0: |
| 61 | lgr %r11,%r2 # Save kdump base address |
| 62 | lgr %r12,%r2 |
| 63 | agr %r12,%r3 # Compute kdump end address |
| 64 | |
| 65 | lghi %r5,0 |
| 66 | lghi %r10,COPY_PAGE_ADDR # Load copy page address |
| 67 | 1: |
| 68 | mvc 0(256,%r10),0(%r5) # Copy old kernel to tmp |
| 69 | mvc 0(256,%r5),0(%r11) # Copy new kernel to old |
| 70 | mvc 0(256,%r11),0(%r10) # Copy tmp to new |
| 71 | aghi %r11,256 |
| 72 | aghi %r5,256 |
| 73 | clgr %r11,%r12 |
| 74 | jl 1b |
| 75 | |
| 76 | lg %r14,.Lstartup_kdump-0b(%r13) |
| 77 | basr %r14,%r14 # Start relocated kernel |
| 78 | .Lstartup_kdump: |
| 79 | .long 0x00000000,0x00000000 + startup_kdump_relocated |
| 80 | .Lcopy_end: |
| 81 | |
| 82 | # |
| 83 | # Startup of kdump (relocated new kernel) |
| 84 | # |
| 85 | .align 2 |
| 86 | startup_kdump_relocated: |
| 87 | basr %r13,0 |
Michael Holzheu | 9db8c05 | 2012-10-15 15:09:08 +0200 | [diff] [blame] | 88 | 0: lpswe .Lrestart_psw-0b(%r13) # Start new kernel... |
Michael Holzheu | 60a0c68 | 2011-10-30 15:16:40 +0100 | [diff] [blame] | 89 | .align 8 |
| 90 | .Lrestart_psw: |
Michael Holzheu | 9db8c05 | 2012-10-15 15:09:08 +0200 | [diff] [blame] | 91 | .quad 0x0000000080000000,0x0000000000000000 + startup |
Michael Holzheu | 60a0c68 | 2011-10-30 15:16:40 +0100 | [diff] [blame] | 92 | #else |
| 93 | .align 2 |
| 94 | .Lep_startup_kdump: |
| 95 | #ifdef CONFIG_64BIT |
| 96 | larl %r13,startup_kdump_crash |
| 97 | lpswe 0(%r13) |
| 98 | .align 8 |
| 99 | startup_kdump_crash: |
| 100 | .quad 0x0002000080000000,0x0000000000000000 + startup_kdump_crash |
| 101 | #else |
| 102 | basr %r13,0 |
| 103 | 0: lpsw startup_kdump_crash-0b(%r13) |
| 104 | .align 8 |
| 105 | startup_kdump_crash: |
| 106 | .long 0x000a0000,0x00000000 + startup_kdump_crash |
| 107 | #endif /* CONFIG_64BIT */ |
| 108 | #endif /* CONFIG_CRASH_DUMP */ |