boot_head.S 3.9 KB

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