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 #define ASSEMBLER_MACROS_ONLY
12 #include <asm/arch/sv_addr_ag.h>
14 #define RAM_INIT_MAGIC 0x56902387
15 #define COMMAND_LINE_MAGIC 0x87109563
27 ;; We need to initialze DRAM registers before we start using the DRAM
29 cmp.d RAM_INIT_MAGIC, r8 ; Already initialized?
30 beq dram_init_finished
33 #include "../../lib/dram_init.S"
37 ;; Initiate the PA and PB ports
39 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, r0
40 move.b r0, [R_PORT_PA_DATA]
42 move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, r0
43 move.b r0, [R_PORT_PA_DIR]
45 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, r0
46 move.b r0, [R_PORT_PB_DATA]
48 move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, r0
49 move.b r0, [R_PORT_PB_DIR]
51 ;; Setup the stack to a suitably high address.
52 ;; We assume 8 MB is the minimum DRAM in an eLinux
53 ;; product and put the sp at the top for now.
57 ;; Figure out where the compressed piggyback image is
58 ;; in the flash (since we wont try to copy it to DRAM
59 ;; before unpacking). It is at _edata, but in flash.
60 ;; Use (_edata - basse) as offset to the current PC.
63 and.d 0x7fffffff, r5 ; strip any non-cache bit
64 subq 2, r5 ; compensate for the move.d pc instr
65 move.d r5, r0 ; save for later - flash address of 'basse'
67 sub.d basse, r5 ; r5 = flash address of '_edata'
69 ;; Copy text+data to DRAM
71 move.d basse, r1 ; destination
72 move.d _edata, r2 ; end destination
79 move.d r5, [_input_data] ; for the decompressor
82 ;; Clear the decompressors BSS (between _edata and _end)
92 ;; Save command line magic and address.
93 move.d _cmd_line_magic, $r12
95 move.d _cmd_line_addr, $r12
98 ;; Do the decompression and save compressed size in _inptr
100 jsr _decompress_kernel
102 ;; Put start address of root partition in r9 so the kernel can use it
103 ;; when mounting from flash
105 move.d [_input_data], r9 ; flash address of compressed kernel
106 add.d [_inptr], r9 ; size of compressed kernel
108 ;; Restore command line magic and address.
109 move.d _cmd_line_magic, $r10
111 move.d _cmd_line_addr, $r11
114 ;; Enter the decompressed kernel
115 move.d RAM_INIT_MAGIC, r8 ; Tell kernel that DRAM is initialized
116 jump 0x40004000 ; kernel is linked to this address
121 .dword 0 ; used by the decompressor
126 #include "../../lib/hw_settings.S"