head64.S 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*
  2. * arch/s390/kernel/head64.S
  3. *
  4. * Copyright (C) IBM Corp. 1999,2006
  5. *
  6. * Author(s): Hartmut Penner <hp@de.ibm.com>
  7. * Martin Schwidefsky <schwidefsky@de.ibm.com>
  8. * Rob van der Heij <rvdhei@iae.nl>
  9. * Heiko Carstens <heiko.carstens@de.ibm.com>
  10. *
  11. */
  12. .org 0x11000
  13. startup_continue:
  14. basr %r13,0 # get base
  15. .LPG1: sll %r13,1 # remove high order bit
  16. srl %r13,1
  17. #ifdef CONFIG_ZFCPDUMP
  18. # check if we have been ipled using zfcp dump:
  19. tm 0xb9,0x01 # test if subchannel is enabled
  20. jno .nodump # subchannel disabled
  21. l %r1,0xb8
  22. la %r5,.Lipl_schib-.LPG1(%r13)
  23. stsch 0(%r5) # get schib of subchannel
  24. jne .nodump # schib not available
  25. tm 5(%r5),0x01 # devno valid?
  26. jno .nodump
  27. tm 4(%r5),0x80 # qdio capable device?
  28. jno .nodump
  29. l %r2,20(%r0) # address of ipl parameter block
  30. lhi %r3,0
  31. ic %r3,0x148(%r2) # get opt field
  32. chi %r3,0x20 # load with dump?
  33. jne .nodump
  34. # store all prefix registers in case of load with dump:
  35. la %r7,0 # base register for 0 page
  36. la %r8,0 # first cpu
  37. l %r11,.Lpref_arr_ptr-.LPG1(%r13) # address of prefix array
  38. ahi %r11,4 # skip boot cpu
  39. lr %r12,%r11
  40. ahi %r12,(CONFIG_NR_CPUS*4) # end of prefix array
  41. stap .Lcurrent_cpu+2-.LPG1(%r13) # store current cpu addr
  42. 1:
  43. cl %r8,.Lcurrent_cpu-.LPG1(%r13) # is ipl cpu ?
  44. je 4f # if yes get next cpu
  45. 2:
  46. lr %r9,%r7
  47. sigp %r9,%r8,0x9 # stop & store status of cpu
  48. brc 8,3f # accepted
  49. brc 4,4f # status stored: next cpu
  50. brc 2,2b # busy: try again
  51. brc 1,4f # not op: next cpu
  52. 3:
  53. mvc 0(4,%r11),264(%r7) # copy prefix register to prefix array
  54. ahi %r11,4 # next element in prefix array
  55. clr %r11,%r12
  56. je 5f # no more space in prefix array
  57. 4:
  58. ahi %r8,1 # next cpu (r8 += 1)
  59. cl %r8,.Llast_cpu-.LPG1(%r13) # is last possible cpu ?
  60. jl 1b # jump if not last cpu
  61. 5:
  62. lhi %r1,2 # mode 2 = esame (dump)
  63. j 6f
  64. .align 4
  65. .Lipl_schib:
  66. .rept 13
  67. .long 0
  68. .endr
  69. .nodump:
  70. lhi %r1,1 # mode 1 = esame (normal ipl)
  71. 6:
  72. #else
  73. lhi %r1,1 # mode 1 = esame (normal ipl)
  74. #endif /* CONFIG_ZFCPDUMP */
  75. mvi __LC_AR_MODE_ID,1 # set esame flag
  76. slr %r0,%r0 # set cpuid to zero
  77. sigp %r1,%r0,0x12 # switch to esame mode
  78. sam64 # switch to 64 bit mode
  79. lctlg %c0,%c15,.Lctl-.LPG1(%r13) # load control registers
  80. lg %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area
  81. # move IPL device to lowcore
  82. lghi %r0,__LC_PASTE
  83. stg %r0,__LC_VDSO_PER_CPU
  84. #
  85. # Setup stack
  86. #
  87. larl %r15,init_thread_union
  88. lg %r14,__TI_task(%r15) # cache current in lowcore
  89. stg %r14,__LC_CURRENT
  90. aghi %r15,1<<(PAGE_SHIFT+THREAD_ORDER) # init_task_union + THREAD_SIZE
  91. stg %r15,__LC_KERNEL_STACK # set end of kernel stack
  92. aghi %r15,-160
  93. #
  94. # Save ipl parameters, clear bss memory, initialize storage key for kernel pages,
  95. # and create a kernel NSS if the SAVESYS= parm is defined
  96. #
  97. brasl %r14,startup_init
  98. lpswe .Lentry-.LPG1(13) # jump to _stext in primary-space,
  99. # virtual and never return ...
  100. .align 16
  101. .Lentry:.quad 0x0000000180000000,_stext
  102. .Lctl: .quad 0x04350002 # cr0: various things
  103. .quad 0 # cr1: primary space segment table
  104. .quad .Lduct # cr2: dispatchable unit control table
  105. .quad 0 # cr3: instruction authorization
  106. .quad 0 # cr4: instruction authorization
  107. .quad .Lduct # cr5: primary-aste origin
  108. .quad 0 # cr6: I/O interrupts
  109. .quad 0 # cr7: secondary space segment table
  110. .quad 0 # cr8: access registers translation
  111. .quad 0 # cr9: tracing off
  112. .quad 0 # cr10: tracing off
  113. .quad 0 # cr11: tracing off
  114. .quad 0 # cr12: tracing off
  115. .quad 0 # cr13: home space segment table
  116. .quad 0xc0000000 # cr14: machine check handling off
  117. .quad 0 # cr15: linkage stack operations
  118. .Lpcmsk:.quad 0x0000000180000000
  119. .L4malign:.quad 0xffffffffffc00000
  120. .Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8
  121. .Lnop: .long 0x07000700
  122. #ifdef CONFIG_ZFCPDUMP
  123. .Lcurrent_cpu:
  124. .long 0x0
  125. .Llast_cpu:
  126. .long 0x0000ffff
  127. .Lpref_arr_ptr:
  128. .long zfcpdump_prefix_array
  129. #endif /* CONFIG_ZFCPDUMP */
  130. .Lparmaddr:
  131. .quad PARMAREA
  132. .align 64
  133. .Lduct: .long 0,0,0,0,.Lduald,0,0,0
  134. .long 0,0,0,0,0,0,0,0
  135. .align 128
  136. .Lduald:.rept 8
  137. .long 0x80000000,0,0,0 # invalid access-list entries
  138. .endr
  139. .org 0x12000
  140. .globl _ehead
  141. _ehead:
  142. #ifdef CONFIG_SHARED_KERNEL
  143. .org 0x100000
  144. #endif
  145. #
  146. # startup-code, running in absolute addressing mode
  147. #
  148. .globl _stext
  149. _stext: basr %r13,0 # get base
  150. .LPG3:
  151. # check control registers
  152. stctg %c0,%c15,0(%r15)
  153. oi 6(%r15),0x40 # enable sigp emergency signal
  154. oi 4(%r15),0x10 # switch on low address proctection
  155. lctlg %c0,%c15,0(%r15)
  156. lam 0,15,.Laregs-.LPG3(%r13) # load acrs needed by uaccess
  157. brasl %r14,start_kernel # go to C code
  158. #
  159. # We returned from start_kernel ?!? PANIK
  160. #
  161. basr %r13,0
  162. lpswe .Ldw-.(%r13) # load disabled wait psw
  163. .align 8
  164. .Ldw: .quad 0x0002000180000000,0x0000000000000000
  165. .Laregs:.long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0