head.S 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. mflr r3 /* Save our actual starting address. */
  62. /* The following functions we call must not modify r3 or r4.....
  63. */
  64. #ifdef CONFIG_6xx
  65. /* On PReP we must look at the OpenFirmware pointer and sanity
  66. * test it. On other platforms, we disable the MMU right now
  67. * and other bits.
  68. */
  69. #ifdef CONFIG_PPC_PREP
  70. /*
  71. * Save the OF pointer to r25, but only if the entry point is in a sane
  72. * location; if not we store 0. If there is no entry point, or it is
  73. * invalid, we establish the default MSR value immediately. Otherwise,
  74. * we defer doing that, to allow OF functions to be called, until we
  75. * begin uncompressing the kernel.
  76. */
  77. lis r8,0x0fff /* r8 = 0x0fffffff */
  78. ori r8,r8,0xffff
  79. subc r8,r8,r5 /* r8 = (r5 <= r8) ? ~0 : 0 */
  80. subfe r8,r8,r8
  81. nand r8,r8,r8
  82. and. r5,r5,r8 /* r5 will be cleared if (r5 > r8) */
  83. bne+ haveOF
  84. li r8,MSR_IP|MSR_FP /* Not OF: set MSR immediately */
  85. mtmsr r8
  86. isync
  87. haveOF:
  88. mr r25,r5
  89. #else
  90. bl disable_6xx_mmu
  91. #endif
  92. bl disable_6xx_l1cache
  93. CLEAR_CACHES
  94. #endif
  95. #ifdef CONFIG_8xx
  96. mfmsr r8 /* Turn off interrupts */
  97. li r9,0
  98. ori r9,r9,MSR_EE
  99. andc r8,r8,r9
  100. mtmsr r8
  101. /* We do this because some boot roms don't initialize the
  102. * processor correctly. Don't do this if you want to debug
  103. * using a BDM device.
  104. */
  105. li r4,0 /* Zero DER to prevent FRZ */
  106. mtspr SPRN_DER,r4
  107. #endif
  108. #if defined(CONFIG_MBX) || defined(CONFIG_RPX8260) || defined(CONFIG_PPC_PREP)
  109. mr r4,r29 /* put the board info pointer where the relocate
  110. * routine will find it
  111. */
  112. #endif
  113. /* Get the load address.
  114. */
  115. subi r3, r3, 4 /* Get the actual IP, not NIP */
  116. b relocate