Back to home page

LXR

 
 

    


0001 /*
0002  * S390 kdump lowlevel functions (new kernel)
0003  *
0004  * Copyright IBM Corp. 2011
0005  * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
0006  */
0007 
0008 #include <asm/sigp.h>
0009 
0010 #define DATAMOVER_ADDR  0x4000
0011 #define COPY_PAGE_ADDR  0x6000
0012 
0013 #ifdef CONFIG_CRASH_DUMP
0014 
0015 #
0016 # kdump entry (new kernel - not yet relocated)
0017 #
0018 # Note: This code has to be position independent
0019 #
0020 
0021 .align 2
0022 .Lep_startup_kdump:
0023     lhi %r1,2               # mode 2 = esame (dump)
0024     sigp    %r1,%r0,SIGP_SET_ARCHITECTURE   # Switch to esame mode
0025     sam64                   # Switch to 64 bit addressing
0026     basr    %r13,0
0027 .Lbase:
0028     larl    %r2,.Lbase_addr         # Check, if we have been
0029     lg  %r2,0(%r2)          # already relocated:
0030     clgr    %r2,%r13            #
0031     jne .Lrelocate          # No : Start data mover
0032     lghi    %r2,0               # Yes: Start kdump kernel
0033     brasl   %r14,startup_kdump_relocated
0034 
0035 .Lrelocate:
0036     larl    %r4,startup
0037     lg  %r2,0x418(%r4)          # Get kdump base
0038     lg  %r3,0x420(%r4)          # Get kdump size
0039 
0040     larl    %r10,.Lcopy_start       # Source of data mover
0041     lghi    %r8,DATAMOVER_ADDR      # Target of data mover
0042     mvc 0(256,%r8),0(%r10)      # Copy data mover code
0043 
0044     agr %r8,%r2             # Copy data mover to
0045     mvc 0(256,%r8),0(%r10)      # reserved mem
0046 
0047     lghi    %r14,DATAMOVER_ADDR     # Jump to copied data mover
0048     basr    %r14,%r14
0049 .Lbase_addr:
0050     .quad   .Lbase
0051 
0052 #
0053 # kdump data mover code (runs at address DATAMOVER_ADDR)
0054 #
0055 # r2: kdump base address
0056 # r3: kdump size
0057 #
0058 .Lcopy_start:
0059     basr    %r13,0              # Base
0060 0:
0061     lgr %r11,%r2            # Save kdump base address
0062     lgr %r12,%r2
0063     agr %r12,%r3            # Compute kdump end address
0064 
0065     lghi    %r5,0
0066     lghi    %r10,COPY_PAGE_ADDR     # Load copy page address
0067 1:
0068     mvc 0(256,%r10),0(%r5)      # Copy old kernel to tmp
0069     mvc 0(256,%r5),0(%r11)      # Copy new kernel to old
0070     mvc 0(256,%r11),0(%r10)     # Copy tmp to new
0071     aghi    %r11,256
0072     aghi    %r5,256
0073     clgr    %r11,%r12
0074     jl  1b
0075 
0076     lg  %r14,.Lstartup_kdump-0b(%r13)
0077     basr    %r14,%r14           # Start relocated kernel
0078 .Lstartup_kdump:
0079     .long   0x00000000,0x00000000 + startup_kdump_relocated
0080 .Lcopy_end:
0081 
0082 #
0083 # Startup of kdump (relocated new kernel)
0084 #
0085 .align 2
0086 startup_kdump_relocated:
0087     basr    %r13,0
0088 0:  lpswe   .Lrestart_psw-0b(%r13)      # Start new kernel...
0089 .align  8
0090 .Lrestart_psw:
0091     .quad   0x0000000080000000,0x0000000000000000 + startup
0092 #else
0093 .align 2
0094 .Lep_startup_kdump:
0095     larl    %r13,startup_kdump_crash
0096     lpswe   0(%r13)
0097 .align 8
0098 startup_kdump_crash:
0099     .quad   0x0002000080000000,0x0000000000000000 + startup_kdump_crash
0100 #endif /* CONFIG_CRASH_DUMP */