reipl.S 4.1 KB

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