boot_head.S 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 1998-2003 Hewlett-Packard Co
  4. * David Mosberger-Tang <davidm@hpl.hp.com>
  5. */
  6. #include <asm/asmmacro.h>
  7. #include <asm/pal.h>
  8. .bss
  9. .align 16
  10. stack_mem:
  11. .skip 16834
  12. .text
  13. /* This needs to be defined because lib/string.c:strlcat() calls it in case of error... */
  14. GLOBAL_ENTRY(printk)
  15. break 0
  16. END(printk)
  17. GLOBAL_ENTRY(_start)
  18. .prologue
  19. .save rp, r0
  20. .body
  21. movl gp = __gp
  22. movl sp = stack_mem+16384-16
  23. bsw.1
  24. br.call.sptk.many rp=start_bootloader
  25. 0: nop 0 /* dummy nop to make unwinding work */
  26. END(_start)
  27. /*
  28. * Set a break point on this function so that symbols are available to set breakpoints in
  29. * the kernel being debugged.
  30. */
  31. GLOBAL_ENTRY(debug_break)
  32. br.ret.sptk.many b0
  33. END(debug_break)
  34. GLOBAL_ENTRY(ssc)
  35. .regstk 5,0,0,0
  36. mov r15=in4
  37. break 0x80001
  38. br.ret.sptk.many b0
  39. END(ssc)
  40. GLOBAL_ENTRY(jmp_to_kernel)
  41. .regstk 2,0,0,0
  42. mov r28=in0
  43. mov b7=in1
  44. br.sptk.few b7
  45. END(jmp_to_kernel)
  46. /*
  47. * r28 contains the index of the PAL function
  48. * r29--31 the args
  49. * Return values in ret0--3 (r8--11)
  50. */
  51. GLOBAL_ENTRY(pal_emulator_static)
  52. mov r8=-1
  53. mov r9=256
  54. ;;
  55. cmp.gtu p6,p7=r9,r28 /* r28 <= 255? */
  56. (p6) br.cond.sptk.few static
  57. ;;
  58. mov r9=512
  59. ;;
  60. cmp.gtu p6,p7=r9,r28
  61. (p6) br.cond.sptk.few stacked
  62. ;;
  63. static: cmp.eq p6,p7=PAL_PTCE_INFO,r28
  64. (p7) br.cond.sptk.few 1f
  65. ;;
  66. mov r8=0 /* status = 0 */
  67. movl r9=0x100000000 /* tc.base */
  68. movl r10=0x0000000200000003 /* count[0], count[1] */
  69. movl r11=0x1000000000002000 /* stride[0], stride[1] */
  70. br.cond.sptk.few rp
  71. 1: cmp.eq p6,p7=PAL_FREQ_RATIOS,r28
  72. (p7) br.cond.sptk.few 1f
  73. mov r8=0 /* status = 0 */
  74. movl r9 =0x100000064 /* proc_ratio (1/100) */
  75. movl r10=0x100000100 /* bus_ratio<<32 (1/256) */
  76. movl r11=0x100000064 /* itc_ratio<<32 (1/100) */
  77. ;;
  78. 1: cmp.eq p6,p7=PAL_RSE_INFO,r28
  79. (p7) br.cond.sptk.few 1f
  80. mov r8=0 /* status = 0 */
  81. mov r9=96 /* num phys stacked */
  82. mov r10=0 /* hints */
  83. mov r11=0
  84. br.cond.sptk.few rp
  85. 1: cmp.eq p6,p7=PAL_CACHE_FLUSH,r28 /* PAL_CACHE_FLUSH */
  86. (p7) br.cond.sptk.few 1f
  87. mov r9=ar.lc
  88. movl r8=524288 /* flush 512k million cache lines (16MB) */
  89. ;;
  90. mov ar.lc=r8
  91. movl r8=0xe000000000000000
  92. ;;
  93. .loop: fc r8
  94. add r8=32,r8
  95. br.cloop.sptk.few .loop
  96. sync.i
  97. ;;
  98. srlz.i
  99. ;;
  100. mov ar.lc=r9
  101. mov r8=r0
  102. ;;
  103. 1: cmp.eq p6,p7=PAL_PERF_MON_INFO,r28
  104. (p7) br.cond.sptk.few 1f
  105. mov r8=0 /* status = 0 */
  106. movl r9 =0x08122f04 /* generic=4 width=47 retired=8 cycles=18 */
  107. mov r10=0 /* reserved */
  108. mov r11=0 /* reserved */
  109. mov r16=0xffff /* implemented PMC */
  110. mov r17=0x3ffff /* implemented PMD */
  111. add r18=8,r29 /* second index */
  112. ;;
  113. st8 [r29]=r16,16 /* store implemented PMC */
  114. st8 [r18]=r0,16 /* clear remaining bits */
  115. ;;
  116. st8 [r29]=r0,16 /* clear remaining bits */
  117. st8 [r18]=r0,16 /* clear remaining bits */
  118. ;;
  119. st8 [r29]=r17,16 /* store implemented PMD */
  120. st8 [r18]=r0,16 /* clear remaining bits */
  121. mov r16=0xf0 /* cycles count capable PMC */
  122. ;;
  123. st8 [r29]=r0,16 /* clear remaining bits */
  124. st8 [r18]=r0,16 /* clear remaining bits */
  125. mov r17=0xf0 /* retired bundles capable PMC */
  126. ;;
  127. st8 [r29]=r16,16 /* store cycles capable */
  128. st8 [r18]=r0,16 /* clear remaining bits */
  129. ;;
  130. st8 [r29]=r0,16 /* clear remaining bits */
  131. st8 [r18]=r0,16 /* clear remaining bits */
  132. ;;
  133. st8 [r29]=r17,16 /* store retired bundle capable */
  134. st8 [r18]=r0,16 /* clear remaining bits */
  135. ;;
  136. st8 [r29]=r0,16 /* clear remaining bits */
  137. st8 [r18]=r0,16 /* clear remaining bits */
  138. ;;
  139. 1: cmp.eq p6,p7=PAL_VM_SUMMARY,r28
  140. (p7) br.cond.sptk.few 1f
  141. mov r8=0 /* status = 0 */
  142. movl r9=0x2044040020F1865 /* num_tc_levels=2, num_unique_tcs=4 */
  143. /* max_itr_entry=64, max_dtr_entry=64 */
  144. /* hash_tag_id=2, max_pkr=15 */
  145. /* key_size=24, phys_add_size=50, vw=1 */
  146. movl r10=0x183C /* rid_size=24, impl_va_msb=60 */
  147. ;;
  148. 1: cmp.eq p6,p7=PAL_MEM_ATTRIB,r28
  149. (p7) br.cond.sptk.few 1f
  150. mov r8=0 /* status = 0 */
  151. mov r9=0x80|0x01 /* NatPage|WB */
  152. ;;
  153. 1: br.cond.sptk.few rp
  154. stacked:
  155. br.ret.sptk.few rp
  156. END(pal_emulator_static)