2 * arch/cris/boot/compressed/head.S
4 * Copyright (C) 1999, 2001 Axis Communications AB
6 * Code that sets up the DRAM registers, calls the
7 * decompressor to unpack the piggybacked kernel, and jumps.
11 #include <linux/config.h>
12 #define ASSEMBLER_MACROS_ONLY
13 #include <asm/arch/sv_addr_ag.h>
15 #define RAM_INIT_MAGIC 0x56902387
16 #define COMMAND_LINE_MAGIC 0x87109563
28 ;; We need to initialze DRAM registers before we start using the DRAM
30 cmp.d RAM_INIT_MAGIC, r8 ; Already initialized?
31 beq dram_init_finished
34 #include "../../lib/dram_init.S"
38 ;; Initiate the PA and PB ports
40 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, r0
41 move.b r0, [R_PORT_PA_DATA]
43 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, r0
44 move.b r0, [R_PORT_PA_DIR]
46 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, r0
47 move.b r0, [R_PORT_PB_DATA]
49 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, r0
50 move.b r0, [R_PORT_PB_DIR]
52 ;; Setup the stack to a suitably high address.
53 ;; We assume 8 MB is the minimum DRAM in an eLinux
54 ;; product and put the sp at the top for now.
58 ;; Figure out where the compressed piggyback image is
59 ;; in the flash (since we wont try to copy it to DRAM
60 ;; before unpacking). It is at _edata, but in flash.
61 ;; Use (_edata - basse) as offset to the current PC.
64 and.d 0x7fffffff, r5 ; strip any non-cache bit
65 subq 2, r5 ; compensate for the move.d pc instr
66 move.d r5, r0 ; save for later - flash address of 'basse'
68 sub.d basse, r5 ; r5 = flash address of '_edata'
70 ;; Copy text+data to DRAM
72 move.d basse, r1 ; destination
73 move.d _edata, r2 ; end destination
80 move.d r5, [_input_data] ; for the decompressor
83 ;; Clear the decompressors BSS (between _edata and _end)
93 ;; Save command line magic and address.
94 move.d _cmd_line_magic, $r12
96 move.d _cmd_line_addr, $r12
99 ;; Do the decompression and save compressed size in _inptr
101 jsr _decompress_kernel
103 ;; Put start address of root partition in r9 so the kernel can use it
104 ;; when mounting from flash
106 move.d [_input_data], r9 ; flash address of compressed kernel
107 add.d [_inptr], r9 ; size of compressed kernel
109 ;; Restore command line magic and address.
110 move.d _cmd_line_magic, $r10
112 move.d _cmd_line_addr, $r11
115 ;; Enter the decompressed kernel
116 move.d RAM_INIT_MAGIC, r8 ; Tell kernel that DRAM is initialized
117 jump 0x40004000 ; kernel is linked to this address
122 .dword 0 ; used by the decompressor
127 #include "../../lib/hw_settings.S"