head.S 3.4 KB

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