head_kdump.S 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. #include <asm/sigp.h>
  8. #define DATAMOVER_ADDR 0x4000
  9. #define COPY_PAGE_ADDR 0x6000
  10. #ifdef CONFIG_CRASH_DUMP
  11. #
  12. # kdump entry (new kernel - not yet relocated)
  13. #
  14. # Note: This code has to be position independent
  15. #
  16. .align 2
  17. .Lep_startup_kdump:
  18. lhi %r1,2 # mode 2 = esame (dump)
  19. sigp %r1,%r0,SIGP_SET_ARCHITECTURE # Switch to esame mode
  20. sam64 # Switch to 64 bit addressing
  21. basr %r13,0
  22. .Lbase:
  23. larl %r2,.Lbase_addr # Check, if we have been
  24. lg %r2,0(%r2) # already relocated:
  25. clgr %r2,%r13 #
  26. jne .Lrelocate # No : Start data mover
  27. lghi %r2,0 # Yes: Start kdump kernel
  28. brasl %r14,startup_kdump_relocated
  29. .Lrelocate:
  30. larl %r4,startup
  31. lg %r2,0x418(%r4) # Get kdump base
  32. lg %r3,0x420(%r4) # Get kdump size
  33. larl %r10,.Lcopy_start # Source of data mover
  34. lghi %r8,DATAMOVER_ADDR # Target of data mover
  35. mvc 0(256,%r8),0(%r10) # Copy data mover code
  36. agr %r8,%r2 # Copy data mover to
  37. mvc 0(256,%r8),0(%r10) # reserved mem
  38. lghi %r14,DATAMOVER_ADDR # Jump to copied data mover
  39. basr %r14,%r14
  40. .Lbase_addr:
  41. .quad .Lbase
  42. #
  43. # kdump data mover code (runs at address DATAMOVER_ADDR)
  44. #
  45. # r2: kdump base address
  46. # r3: kdump size
  47. #
  48. .Lcopy_start:
  49. basr %r13,0 # Base
  50. 0:
  51. lgr %r11,%r2 # Save kdump base address
  52. lgr %r12,%r2
  53. agr %r12,%r3 # Compute kdump end address
  54. lghi %r5,0
  55. lghi %r10,COPY_PAGE_ADDR # Load copy page address
  56. 1:
  57. mvc 0(256,%r10),0(%r5) # Copy old kernel to tmp
  58. mvc 0(256,%r5),0(%r11) # Copy new kernel to old
  59. mvc 0(256,%r11),0(%r10) # Copy tmp to new
  60. aghi %r11,256
  61. aghi %r5,256
  62. clgr %r11,%r12
  63. jl 1b
  64. lg %r14,.Lstartup_kdump-0b(%r13)
  65. basr %r14,%r14 # Start relocated kernel
  66. .Lstartup_kdump:
  67. .long 0x00000000,0x00000000 + startup_kdump_relocated
  68. .Lcopy_end:
  69. #
  70. # Startup of kdump (relocated new kernel)
  71. #
  72. .align 2
  73. startup_kdump_relocated:
  74. basr %r13,0
  75. 0: lpswe .Lrestart_psw-0b(%r13) # Start new kernel...
  76. .align 8
  77. .Lrestart_psw:
  78. .quad 0x0000000080000000,0x0000000000000000 + startup
  79. #else
  80. .align 2
  81. .Lep_startup_kdump:
  82. larl %r13,startup_kdump_crash
  83. lpswe 0(%r13)
  84. .align 8
  85. startup_kdump_crash:
  86. .quad 0x0002000080000000,0x0000000000000000 + startup_kdump_crash
  87. #endif /* CONFIG_CRASH_DUMP */