2 * BK Id: SCCS/s.head.S 1.13 08/07/01 17:57:15 trini
5 #include <asm/ppc_asm.h>
6 #include <asm/processor.h>
12 * Boot loader philosophy:
13 * ROM loads us to some arbitrary location
14 * Move the boot code to the link address (8M)
15 * Call decompress_kernel()
16 * Relocate the initrd, zimage and residual data to 8M
17 * Decompress the kernel to 0
18 * Jump to the kernel entry
26 /* Enable, invalidate, Disable L1 icache/dcache */
28 ori r8, r8, (HID0_ICE|HID0_DCE|HID0_ICFI|HID0_DCI)
40 mr r11,r3 /* Save pointer to residual/board data */
42 /* Establish default MSR value */
46 /* compute the size of the whole image in words. */
51 addi r5,r5,3 /* round up */
52 sub r5,r5,r4 /* end - start */
54 mr r7,r5 /* Save for later use. */
56 /* check if we need to relocate ourselves to the link addr or were
57 * we loaded there to begin with -- Cort */
59 subi r3,r3,4 /* we get the nip, not the ip of the branch */
62 beq start_ldr /* If 0, we don't need to relocate */
64 * no matter where we're loaded, move ourselves to -Ttext address
67 mflr r3 /* Compute code bias */
72 mr r5,r7 /* Get the # of longwords again */
73 mtctr r5 /* Setup for loop */
83 mtlr r3 /* Easiest way to do an absolute jump */
87 /* Some boards don't boot up with the I-cache enabled. Do that
88 * now because the decompress runs much faster that way.
89 * As a side effect, we have to ensure the data cache is not enabled
90 * so we can access the serial I/O without trouble.
92 bl flush_instruction_cache
94 /* Clear all of BSS */
105 90: mr r9,r1 /* Save old stack pointer (in case it matters) */
110 li r2,0x000F /* Mask pointer to 16-byte boundary */
114 mr r3,r8 /* Load point */
115 mr r4,r7 /* Program length */
116 mr r5,r6 /* Checksum */
117 mr r6,r11 /* Residual data */
121 * We have to do this after decompress_kernel, just to make
122 * sure we don't wipe out things mapped in BATs which we need.
129 cmpi 0,r9,1 /* 601 ? */
154 /* Set segment registers */
155 li r6,16 /* load up segment register values */
156 mtctr r6 /* for context 0 */
157 lis r6,0x2000 /* Ku = 1, VSID = 0 */
160 addi r6,r6,0x111 /* increment VSID */
161 addis r10,r10,0x1000 /* address of next segment */
164 /* tell kernel we're prep, by putting 0xdeadc0de at KERNELLOAD,
165 * and tell the kernel to start on the 4th instruction since we
166 * overwrite the first 3 sometimes (which are 'nop').
171 ori r10,r10,0xdeadc0de@l
176 .comm .stack,4096*2,4