head-ram.S 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. #include <linux/config.h>
  2. .global __main
  3. .global __ram_start
  4. .global __ram_end
  5. .global __rom_start
  6. .global __rom_end
  7. .global _rambase
  8. .global _ramstart
  9. .global splash_bits
  10. .global _start
  11. .global _stext
  12. #define DEBUG
  13. #define ROM_OFFSET 0x10C00000
  14. #define STACK_GAURD 0x10
  15. .text
  16. _start:
  17. _stext:
  18. movew #0x2700, %sr /* Exceptions off! */
  19. #if 0
  20. /* Init chip registers. uCsimm specific */
  21. moveb #0x00, 0xfffffb0b /* Watchdog off */
  22. moveb #0x10, 0xfffff000 /* SCR */
  23. movew #0x2400, 0xfffff200 /* PLLCR */
  24. movew #0x0123, 0xfffff202 /* PLLFSR */
  25. moveb #0x00, 0xfffff40b /* enable chip select */
  26. moveb #0x00, 0xfffff423 /* enable /DWE */
  27. moveb #0x08, 0xfffffd0d /* disable hardmap */
  28. moveb #0x07, 0xfffffd0e /* level 7 interrupt clear */
  29. movew #0x8600, 0xfffff100 /* FLASH at 0x10c00000 */
  30. movew #0x018b, 0xfffff110 /* 2Meg, enable, 0ws */
  31. movew #0x8f00, 0xfffffc00 /* DRAM configuration */
  32. movew #0x9667, 0xfffffc02 /* DRAM control */
  33. movew #0x0000, 0xfffff106 /* DRAM at 0x00000000 */
  34. movew #0x068f, 0xfffff116 /* 8Meg, enable, 0ws */
  35. moveb #0x40, 0xfffff300 /* IVR */
  36. movel #0x007FFFFF, %d0 /* IMR */
  37. movel %d0, 0xfffff304
  38. moveb 0xfffff42b, %d0
  39. andb #0xe0, %d0
  40. moveb %d0, 0xfffff42b
  41. moveb #0x08, 0xfffff907 /* Ignore CTS */
  42. movew #0x010b, 0xfffff902 /* BAUD to 9600 */
  43. movew #0xe100, 0xfffff900 /* enable */
  44. #endif
  45. movew #16384, %d0 /* PLL settle wait loop */
  46. L0:
  47. subw #1, %d0
  48. bne L0
  49. #ifdef DEBUG
  50. moveq #70, %d7 /* 'F' */
  51. moveb %d7,0xfffff907 /* No absolute addresses */
  52. pclp1:
  53. movew 0xfffff906, %d7
  54. andw #0x2000, %d7
  55. beq pclp1
  56. #endif /* DEBUG */
  57. #ifdef CONFIG_RELOCATE
  58. /* Copy me to RAM */
  59. moveal #__rom_start, %a0
  60. moveal #__ram_start, %a1
  61. moveal #_edata, %a2
  62. /* Copy %a0 to %a1 until %a1 == %a2 */
  63. LD1:
  64. movel %a0@+, %d0
  65. movel %d0, %a1@+
  66. cmpal %a1, %a2
  67. bhi LD1
  68. #ifdef DEBUG
  69. moveq #74, %d7 /* 'J' */
  70. moveb %d7,0xfffff907 /* No absolute addresses */
  71. pclp2:
  72. movew 0xfffff906, %d7
  73. andw #0x2000, %d7
  74. beq pclp2
  75. #endif /* DEBUG */
  76. /* jump into the RAM copy */
  77. jmp ram_jump
  78. ram_jump:
  79. #endif /* CONFIG_RELOCATE */
  80. #ifdef DEBUG
  81. moveq #82, %d7 /* 'R' */
  82. moveb %d7,0xfffff907 /* No absolute addresses */
  83. pclp3:
  84. movew 0xfffff906, %d7
  85. andw #0x2000, %d7
  86. beq pclp3
  87. #endif /* DEBUG */
  88. moveal #0x007ffff0, %ssp
  89. moveal #_sbss, %a0
  90. moveal #_ebss, %a1
  91. /* Copy 0 to %a0 until %a0 >= %a1 */
  92. L1:
  93. movel #0, %a0@+
  94. cmpal %a0, %a1
  95. bhi L1
  96. #ifdef DEBUG
  97. moveq #67, %d7 /* 'C' */
  98. jsr putc
  99. #endif /* DEBUG */
  100. pea 0
  101. pea env
  102. pea %sp@(4)
  103. pea 0
  104. #ifdef DEBUG
  105. moveq #70, %d7 /* 'F' */
  106. jsr putc
  107. #endif /* DEBUG */
  108. lp:
  109. jsr start_kernel
  110. jmp lp
  111. _exit:
  112. jmp _exit
  113. __main:
  114. /* nothing */
  115. rts
  116. #ifdef DEBUG
  117. putc:
  118. moveb %d7,0xfffff907
  119. pclp:
  120. movew 0xfffff906, %d7
  121. andw #0x2000, %d7
  122. beq pclp
  123. rts
  124. #endif /* DEBUG */
  125. .data
  126. /*
  127. * Set up the usable of RAM stuff. Size of RAM is determined then
  128. * an initial stack set up at the end.
  129. */
  130. .align 4
  131. _ramvec:
  132. .long 0
  133. _rambase:
  134. .long 0
  135. _ramstart:
  136. .long 0
  137. _ramend:
  138. .long 0
  139. env:
  140. .long 0