reipl64.S 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * Copyright IBM Corp 2000,2011
  3. * Author(s): Holger Smolinski <Holger.Smolinski@de.ibm.com>,
  4. * Denis Joseph Barrow,
  5. */
  6. #include <linux/linkage.h>
  7. #include <asm/asm-offsets.h>
  8. #
  9. # store_status
  10. #
  11. # Prerequisites to run this function:
  12. # - Prefix register is set to zero
  13. # - Original prefix register is stored in "dump_prefix_page"
  14. # - Lowcore protection is off
  15. #
  16. ENTRY(store_status)
  17. /* Save register one and load save area base */
  18. stg %r1,__LC_SAVE_AREA_RESTART
  19. lghi %r1,SAVE_AREA_BASE
  20. /* General purpose registers */
  21. stmg %r0,%r15,__LC_GPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  22. lg %r2,__LC_SAVE_AREA_RESTART
  23. stg %r2,__LC_GPREGS_SAVE_AREA-SAVE_AREA_BASE+8(%r1)
  24. /* Control registers */
  25. stctg %c0,%c15,__LC_CREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  26. /* Access registers */
  27. stam %a0,%a15,__LC_AREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  28. /* Floating point registers */
  29. std %f0, 0x00 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  30. std %f1, 0x08 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  31. std %f2, 0x10 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  32. std %f3, 0x18 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  33. std %f4, 0x20 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  34. std %f5, 0x28 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  35. std %f6, 0x30 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  36. std %f7, 0x38 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  37. std %f8, 0x40 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  38. std %f9, 0x48 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  39. std %f10,0x50 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  40. std %f11,0x58 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  41. std %f12,0x60 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  42. std %f13,0x68 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  43. std %f14,0x70 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  44. std %f15,0x78 + __LC_FPREGS_SAVE_AREA-SAVE_AREA_BASE(%r1)
  45. /* Floating point control register */
  46. stfpc __LC_FP_CREG_SAVE_AREA-SAVE_AREA_BASE(%r1)
  47. /* CPU timer */
  48. stpt __LC_CPU_TIMER_SAVE_AREA-SAVE_AREA_BASE(%r1)
  49. /* Saved prefix register */
  50. larl %r2,dump_prefix_page
  51. mvc __LC_PREFIX_SAVE_AREA-SAVE_AREA_BASE(4,%r1),0(%r2)
  52. /* Clock comparator - seven bytes */
  53. larl %r2,.Lclkcmp
  54. stckc 0(%r2)
  55. mvc __LC_CLOCK_COMP_SAVE_AREA-SAVE_AREA_BASE + 1(7,%r1),1(%r2)
  56. /* Program status word */
  57. epsw %r2,%r3
  58. st %r2,__LC_PSW_SAVE_AREA-SAVE_AREA_BASE + 0(%r1)
  59. st %r3,__LC_PSW_SAVE_AREA-SAVE_AREA_BASE + 4(%r1)
  60. larl %r2,store_status
  61. stg %r2,__LC_PSW_SAVE_AREA-SAVE_AREA_BASE + 8(%r1)
  62. br %r14
  63. .section .bss
  64. .align 8
  65. .Lclkcmp: .quad 0x0000000000000000
  66. .previous
  67. #
  68. # do_reipl_asm
  69. # Parameter: r2 = schid of reipl device
  70. #
  71. ENTRY(do_reipl_asm)
  72. basr %r13,0
  73. .Lpg0: lpswe .Lnewpsw-.Lpg0(%r13)
  74. .Lpg1: brasl %r14,store_status
  75. lctlg %c6,%c6,.Lall-.Lpg0(%r13)
  76. lgr %r1,%r2
  77. mvc __LC_PGM_NEW_PSW(16),.Lpcnew-.Lpg0(%r13)
  78. stsch .Lschib-.Lpg0(%r13)
  79. oi .Lschib+5-.Lpg0(%r13),0x84
  80. .Lecs: xi .Lschib+27-.Lpg0(%r13),0x01
  81. msch .Lschib-.Lpg0(%r13)
  82. lghi %r0,5
  83. .Lssch: ssch .Liplorb-.Lpg0(%r13)
  84. jz .L001
  85. brct %r0,.Lssch
  86. bas %r14,.Ldisab-.Lpg0(%r13)
  87. .L001: mvc __LC_IO_NEW_PSW(16),.Lionew-.Lpg0(%r13)
  88. .Ltpi: lpswe .Lwaitpsw-.Lpg0(%r13)
  89. .Lcont: c %r1,__LC_SUBCHANNEL_ID
  90. jnz .Ltpi
  91. clc __LC_IO_INT_PARM(4),.Liplorb-.Lpg0(%r13)
  92. jnz .Ltpi
  93. tsch .Liplirb-.Lpg0(%r13)
  94. tm .Liplirb+9-.Lpg0(%r13),0xbf
  95. jz .L002
  96. bas %r14,.Ldisab-.Lpg0(%r13)
  97. .L002: tm .Liplirb+8-.Lpg0(%r13),0xf3
  98. jz .L003
  99. bas %r14,.Ldisab-.Lpg0(%r13)
  100. .L003: st %r1,__LC_SUBCHANNEL_ID
  101. lhi %r1,0 # mode 0 = esa
  102. slr %r0,%r0 # set cpuid to zero
  103. sigp %r1,%r0,0x12 # switch to esa mode
  104. lpsw 0
  105. .Ldisab: sll %r14,1
  106. srl %r14,1 # need to kill hi bit to avoid specification exceptions.
  107. st %r14,.Ldispsw+12-.Lpg0(%r13)
  108. lpswe .Ldispsw-.Lpg0(%r13)
  109. .align 8
  110. .Lall: .quad 0x00000000ff000000
  111. .align 16
  112. /*
  113. * These addresses have to be 31 bit otherwise
  114. * the sigp will throw a specifcation exception
  115. * when switching to ESA mode as bit 31 be set
  116. * in the ESA psw.
  117. * Bit 31 of the addresses has to be 0 for the
  118. * 31bit lpswe instruction a fact they appear to have
  119. * omitted from the pop.
  120. */
  121. .Lnewpsw: .quad 0x0000000080000000
  122. .quad .Lpg1
  123. .Lpcnew: .quad 0x0000000080000000
  124. .quad .Lecs
  125. .Lionew: .quad 0x0000000080000000
  126. .quad .Lcont
  127. .Lwaitpsw: .quad 0x0202000080000000
  128. .quad .Ltpi
  129. .Ldispsw: .quad 0x0002000080000000
  130. .quad 0x0000000000000000
  131. .Liplccws: .long 0x02000000,0x60000018
  132. .long 0x08000008,0x20000001
  133. .Liplorb: .long 0x0049504c,0x0040ff80
  134. .long 0x00000000+.Liplccws
  135. .Lschib: .long 0x00000000,0x00000000
  136. .long 0x00000000,0x00000000
  137. .long 0x00000000,0x00000000
  138. .long 0x00000000,0x00000000
  139. .long 0x00000000,0x00000000
  140. .long 0x00000000,0x00000000
  141. .Liplirb: .long 0x00000000,0x00000000
  142. .long 0x00000000,0x00000000
  143. .long 0x00000000,0x00000000
  144. .long 0x00000000,0x00000000
  145. .long 0x00000000,0x00000000
  146. .long 0x00000000,0x00000000
  147. .long 0x00000000,0x00000000
  148. .long 0x00000000,0x00000000