head.S 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. * Initial board bringup code for many different boards.
  3. *
  4. * Author: Tom Rini
  5. * trini@mvista.com
  6. * Derived from arch/ppc/boot/prep/head.S (Cort Dougan, many others).
  7. *
  8. * 2001-2004 (c) MontaVista, Software, Inc. This file is licensed under
  9. * the terms of the GNU General Public License version 2. This program
  10. * is licensed "as is" without any warranty of any kind, whether express
  11. * or implied.
  12. */
  13. #include <asm/reg.h>
  14. #include <asm/cache.h>
  15. #include <asm/ppc_asm.h>
  16. .text
  17. /*
  18. * Begin at some arbitrary location in RAM or Flash
  19. * Initialize core registers
  20. * Configure memory controller (Not executing from RAM)
  21. * Move the boot code to the link address (8M)
  22. * Setup C stack
  23. * Initialize UART
  24. * Decompress the kernel to 0x0
  25. * Jump to the kernel entry
  26. *
  27. */
  28. .globl start
  29. start:
  30. bl start_
  31. #ifdef CONFIG_IBM_OPENBIOS
  32. /* The IBM "Tree" bootrom knows that the address of the bootrom
  33. * read only structure is 4 bytes after _start.
  34. */
  35. .long 0x62726f6d # structure ID - "brom"
  36. .long 0x5f726f00 # - "_ro\0"
  37. .long 1 # structure version
  38. .long bootrom_cmdline # address of *bootrom_cmdline
  39. #endif
  40. start_:
  41. #ifdef CONFIG_FORCE
  42. /* We have some really bad firmware. We must disable the L1
  43. * icache/dcache now or the board won't boot.
  44. */
  45. li r4,0x0000
  46. isync
  47. mtspr SPRN_HID0,r4
  48. sync
  49. isync
  50. #endif
  51. #if defined(CONFIG_MBX) || defined(CONFIG_RPX8260) || defined(CONFIG_PPC_PREP)
  52. mr r29,r3 /* On the MBX860, r3 is the board info pointer.
  53. * On the RPXSUPER, r3 points to the NVRAM
  54. * configuration keys.
  55. * On PReP, r3 is the pointer to the residual data.
  56. */
  57. #endif
  58. #if defined(CONFIG_XILINX_VIRTEX_4_FX)
  59. /* PPC errata 213: only for Virtex-4 FX */
  60. mfccr0 0
  61. oris 0,0,0x50000000@h
  62. mtccr0 0
  63. #endif
  64. mflr r3 /* Save our actual starting address. */
  65. /* The following functions we call must not modify r3 or r4.....
  66. */
  67. #ifdef CONFIG_6xx
  68. /* On PReP we must look at the OpenFirmware pointer and sanity
  69. * test it. On other platforms, we disable the MMU right now
  70. * and other bits.
  71. */
  72. #ifdef CONFIG_PPC_PREP
  73. /*
  74. * Save the OF pointer to r25, but only if the entry point is in a sane
  75. * location; if not we store 0. If there is no entry point, or it is
  76. * invalid, we establish the default MSR value immediately. Otherwise,
  77. * we defer doing that, to allow OF functions to be called, until we
  78. * begin uncompressing the kernel.
  79. */
  80. lis r8,0x0fff /* r8 = 0x0fffffff */
  81. ori r8,r8,0xffff
  82. subc r8,r8,r5 /* r8 = (r5 <= r8) ? ~0 : 0 */
  83. subfe r8,r8,r8
  84. nand r8,r8,r8
  85. and. r5,r5,r8 /* r5 will be cleared if (r5 > r8) */
  86. bne+ haveOF
  87. li r8,MSR_IP|MSR_FP /* Not OF: set MSR immediately */
  88. mtmsr r8
  89. isync
  90. haveOF:
  91. mr r25,r5
  92. #else
  93. bl disable_6xx_mmu
  94. #endif
  95. bl disable_6xx_l1cache
  96. CLEAR_CACHES
  97. #endif
  98. #ifdef CONFIG_8xx
  99. mfmsr r8 /* Turn off interrupts */
  100. li r9,0
  101. ori r9,r9,MSR_EE
  102. andc r8,r8,r9
  103. mtmsr r8
  104. /* We do this because some boot roms don't initialize the
  105. * processor correctly. Don't do this if you want to debug
  106. * using a BDM device.
  107. */
  108. li r4,0 /* Zero DER to prevent FRZ */
  109. mtspr SPRN_DER,r4
  110. #endif
  111. #if defined(CONFIG_MBX) || defined(CONFIG_RPX8260) || defined(CONFIG_PPC_PREP)
  112. mr r4,r29 /* put the board info pointer where the relocate
  113. * routine will find it
  114. */
  115. #endif
  116. /* Get the load address.
  117. */
  118. subi r3, r3, 4 /* Get the actual IP, not NIP */
  119. b relocate