head-uc-fr451.S 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /* head-uc-fr451.S: FR451 uc-linux specific bits of initialisation
  2. *
  3. * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/threads.h>
  13. #include <linux/linkage.h>
  14. #include <asm/ptrace.h>
  15. #include <asm/page.h>
  16. #include <asm/spr-regs.h>
  17. #include <asm/mb86943a.h>
  18. #include "head.inc"
  19. #define __400_DBR0 0xfe000e00
  20. #define __400_DBR1 0xfe000e08
  21. #define __400_DBR2 0xfe000e10
  22. #define __400_DBR3 0xfe000e18
  23. #define __400_DAM0 0xfe000f00
  24. #define __400_DAM1 0xfe000f08
  25. #define __400_DAM2 0xfe000f10
  26. #define __400_DAM3 0xfe000f18
  27. #define __400_LGCR 0xfe000010
  28. #define __400_LCR 0xfe000100
  29. #define __400_LSBR 0xfe000c00
  30. __INIT
  31. .balign 4
  32. ###############################################################################
  33. #
  34. # set the protection map with the I/DAMPR registers
  35. #
  36. # ENTRY: EXIT:
  37. # GR25 SDRAM size [saved]
  38. # GR26 &__head_reference [saved]
  39. # GR30 LED address [saved]
  40. #
  41. ###############################################################################
  42. .globl __head_fr451_set_protection
  43. __head_fr451_set_protection:
  44. movsg lr,gr27
  45. movgs gr0,dampr10
  46. movgs gr0,damlr10
  47. movgs gr0,dampr9
  48. movgs gr0,damlr9
  49. movgs gr0,dampr8
  50. movgs gr0,damlr8
  51. # set the I/O region protection registers for FR401/3/5
  52. sethi.p %hi(__region_IO),gr5
  53. setlo %lo(__region_IO),gr5
  54. sethi.p %hi(0x1fffffff),gr7
  55. setlo %lo(0x1fffffff),gr7
  56. ori gr5,#xAMPRx_SS_512Mb|xAMPRx_S_KERNEL|xAMPRx_C|xAMPRx_V,gr5
  57. movgs gr5,dampr11 ; General I/O tile
  58. movgs gr7,damlr11
  59. # need to tile the remaining IAMPR/DAMPR registers to cover as much of the RAM as possible
  60. # - start with the highest numbered registers
  61. sethi.p %hi(__kernel_image_end),gr8
  62. setlo %lo(__kernel_image_end),gr8
  63. sethi.p %hi(32768),gr4 ; allow for a maximal allocator bitmap
  64. setlo %lo(32768),gr4
  65. add gr8,gr4,gr8
  66. sethi.p %hi(1024*2048-1),gr4 ; round up to nearest 2MiB
  67. setlo %lo(1024*2048-1),gr4
  68. add.p gr8,gr4,gr8
  69. not gr4,gr4
  70. and gr8,gr4,gr8
  71. sethi.p %hi(__page_offset),gr9
  72. setlo %lo(__page_offset),gr9
  73. add gr9,gr25,gr9
  74. sethi.p %hi(0xffffc000),gr11
  75. setlo %lo(0xffffc000),gr11
  76. # GR8 = base of uncovered RAM
  77. # GR9 = top of uncovered RAM
  78. # GR11 = xAMLR mask
  79. LEDS 0x3317
  80. call __head_split_region
  81. movgs gr4,iampr7
  82. movgs gr6,iamlr7
  83. movgs gr5,dampr7
  84. movgs gr7,damlr7
  85. LEDS 0x3316
  86. call __head_split_region
  87. movgs gr4,iampr6
  88. movgs gr6,iamlr6
  89. movgs gr5,dampr6
  90. movgs gr7,damlr6
  91. LEDS 0x3315
  92. call __head_split_region
  93. movgs gr4,iampr5
  94. movgs gr6,iamlr5
  95. movgs gr5,dampr5
  96. movgs gr7,damlr5
  97. LEDS 0x3314
  98. call __head_split_region
  99. movgs gr4,iampr4
  100. movgs gr6,iamlr4
  101. movgs gr5,dampr4
  102. movgs gr7,damlr4
  103. LEDS 0x3313
  104. call __head_split_region
  105. movgs gr4,iampr3
  106. movgs gr6,iamlr3
  107. movgs gr5,dampr3
  108. movgs gr7,damlr3
  109. LEDS 0x3312
  110. call __head_split_region
  111. movgs gr4,iampr2
  112. movgs gr6,iamlr2
  113. movgs gr5,dampr2
  114. movgs gr7,damlr2
  115. LEDS 0x3311
  116. call __head_split_region
  117. movgs gr4,iampr1
  118. movgs gr6,iamlr1
  119. movgs gr5,dampr1
  120. movgs gr7,damlr1
  121. # cover kernel core image with kernel-only segment
  122. LEDS 0x3310
  123. sethi.p %hi(__page_offset),gr8
  124. setlo %lo(__page_offset),gr8
  125. call __head_split_region
  126. #ifdef CONFIG_PROTECT_KERNEL
  127. ori.p gr4,#xAMPRx_S_KERNEL,gr4
  128. ori gr5,#xAMPRx_S_KERNEL,gr5
  129. #endif
  130. movgs gr4,iampr0
  131. movgs gr6,iamlr0
  132. movgs gr5,dampr0
  133. movgs gr7,damlr0
  134. # start in TLB context 0 with no page tables
  135. movgs gr0,cxnr
  136. movgs gr0,ttbr
  137. # the FR451 also has an extra trap base register
  138. movsg tbr,gr4
  139. movgs gr4,btbr
  140. # turn on the timers as appropriate
  141. movgs gr0,timerh
  142. movgs gr0,timerl
  143. movgs gr0,timerd
  144. movsg hsr0,gr4
  145. sethi.p %hi(HSR0_ETMI),gr5
  146. setlo %lo(HSR0_ETMI),gr5
  147. or gr4,gr5,gr4
  148. movgs gr4,hsr0
  149. LEDS 0x3300
  150. jmpl @(gr27,gr0)