wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2003 Josef Baumgartner <josef.baumgartner@telex.de> |
| 3 | * Based on code from Bernhard Kuhn <bkuhn@metrowerks.com> |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
Wolfgang Denk | 0191e47 | 2010-10-26 14:34:52 +0200 | [diff] [blame^] | 24 | #include <asm-offsets.h> |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 25 | #include <config.h> |
Peter Tyser | 6294850 | 2008-11-03 09:30:59 -0600 | [diff] [blame] | 26 | #include <timestamp.h> |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 27 | #include "version.h" |
TsiChung Liew | 0ee47d4 | 2010-03-11 22:12:53 -0600 | [diff] [blame] | 28 | #include <asm/cache.h> |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 29 | |
| 30 | #ifndef CONFIG_IDENT_STRING |
| 31 | #define CONFIG_IDENT_STRING "" |
| 32 | #endif |
| 33 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 34 | #define _START _start |
| 35 | #define _FAULT _fault |
| 36 | |
| 37 | |
| 38 | #define SAVE_ALL \ |
| 39 | move.w #0x2700,%sr; /* disable intrs */ \ |
| 40 | subl #60,%sp; /* space for 15 regs */ \ |
| 41 | moveml %d0-%d7/%a0-%a6,%sp@; \ |
| 42 | |
| 43 | #define RESTORE_ALL \ |
| 44 | moveml %sp@,%d0-%d7/%a0-%a6; \ |
| 45 | addl #60,%sp; /* space for 15 regs */ \ |
| 46 | rte |
| 47 | |
| 48 | /* If we come from a pre-loader we don't need an initial exception |
| 49 | * table. |
| 50 | */ |
| 51 | #if !defined(CONFIG_MONITOR_IS_IN_RAM) |
| 52 | |
| 53 | .text |
| 54 | /* |
| 55 | * Vector table. This is used for initial platform startup. |
| 56 | * These vectors are to catch any un-intended traps. |
| 57 | */ |
| 58 | _vectors: |
| 59 | |
Wolfgang Denk | b4b1c46 | 2006-06-10 19:27:47 +0200 | [diff] [blame] | 60 | .long 0x00000000 /* Flash offset is 0 until we setup CS0 */ |
Wolfgang Denk | 0708bc6 | 2010-10-07 21:51:12 +0200 | [diff] [blame] | 61 | #if defined(CONFIG_M5282) && (CONFIG_SYS_TEXT_BASE == CONFIG_SYS_INT_FLASH_BASE) |
| 62 | .long _start - CONFIG_SYS_TEXT_BASE |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 63 | #else |
Wolfgang Denk | b4b1c46 | 2006-06-10 19:27:47 +0200 | [diff] [blame] | 64 | .long _START |
Zachary P. Landau | 0bba862 | 2006-01-26 17:35:56 -0500 | [diff] [blame] | 65 | #endif |
Wolfgang Denk | b4b1c46 | 2006-06-10 19:27:47 +0200 | [diff] [blame] | 66 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 67 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 68 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 69 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 70 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 71 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 72 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 73 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 74 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 75 | |
| 76 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 77 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 78 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 79 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 80 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 81 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 82 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 83 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 84 | |
| 85 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 86 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 87 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 88 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 89 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 90 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 91 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 92 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 93 | |
| 94 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 95 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 96 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 97 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 98 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 99 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 100 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 101 | .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT |
| 102 | |
| 103 | #endif |
| 104 | |
| 105 | .text |
| 106 | |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 107 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 108 | #if defined(CONFIG_SYS_INT_FLASH_BASE) && \ |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 109 | (defined(CONFIG_M5282) || defined(CONFIG_M5281)) |
Wolfgang Denk | 0708bc6 | 2010-10-07 21:51:12 +0200 | [diff] [blame] | 110 | #if (CONFIG_SYS_TEXT_BASE == CONFIG_SYS_INT_FLASH_BASE) |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 111 | .long 0x55AA55AA,0xAA55AA55 /* CFM Backdoorkey */ |
| 112 | .long 0xFFFFFFFF /* all sectors protected */ |
| 113 | .long 0x00000000 /* supervisor/User restriction */ |
| 114 | .long 0x00000000 /* programm/data space restriction */ |
| 115 | .long 0x00000000 /* Flash security */ |
| 116 | #endif |
| 117 | #endif |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 118 | .globl _start |
| 119 | _start: |
| 120 | nop |
| 121 | nop |
| 122 | move.w #0x2700,%sr |
| 123 | |
TsiChung Liew | b354aef | 2009-06-12 11:29:00 +0000 | [diff] [blame] | 124 | #if defined(CONFIG_M5208) |
| 125 | /* Initialize RAMBAR: locate SRAM and validate it */ |
| 126 | move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0 |
| 127 | movec %d0, %RAMBAR1 |
| 128 | #endif |
| 129 | |
TsiChungLiew | 3467469 | 2007-08-16 13:20:50 -0500 | [diff] [blame] | 130 | #if defined(CONFIG_M5272) || defined(CONFIG_M5249) || defined(CONFIG_M5253) |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 131 | move.l #(CONFIG_SYS_MBAR + 1), %d0 /* set MBAR address + valid flag */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 132 | move.c %d0, %MBAR |
| 133 | |
stroese | 53395a2 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 134 | /*** The 5249 has MBAR2 as well ***/ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 135 | #ifdef CONFIG_SYS_MBAR2 |
| 136 | move.l #(CONFIG_SYS_MBAR2 + 1), %d0 /* Get MBAR2 address */ |
stroese | 53395a2 | 2004-12-16 18:09:49 +0000 | [diff] [blame] | 137 | movec %d0, #0xc0e /* Set MBAR2 */ |
| 138 | #endif |
| 139 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 140 | move.l #(CONFIG_SYS_INIT_RAM_ADDR + 1), %d0 |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 141 | movec %d0, %RAMBAR0 |
TsiChungLiew | 3467469 | 2007-08-16 13:20:50 -0500 | [diff] [blame] | 142 | #endif /* CONFIG_M5272 || CONFIG_M5249 || CONFIG_M5253 */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 143 | |
Wolfgang Denk | b4b1c46 | 2006-06-10 19:27:47 +0200 | [diff] [blame] | 144 | #if defined(CONFIG_M5282) || defined(CONFIG_M5271) |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 145 | /* Initialize IPSBAR */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 146 | move.l #(CONFIG_SYS_MBAR + 1), %d0 /* set IPSBAR address + valid flag */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 147 | move.l %d0, 0x40000000 |
| 148 | |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 149 | /* Initialize RAMBAR1: locate SRAM and validate it */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 150 | move.l #(CONFIG_SYS_INIT_RAM_ADDR + 0x21), %d0 |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 151 | movec %d0, %RAMBAR1 |
| 152 | |
Bartlomiej Sieka | 8ff81c6 | 2006-12-20 00:27:32 +0100 | [diff] [blame] | 153 | #if defined(CONFIG_M5282) |
Wolfgang Denk | 0708bc6 | 2010-10-07 21:51:12 +0200 | [diff] [blame] | 154 | #if (CONFIG_SYS_TEXT_BASE == CONFIG_SYS_INT_FLASH_BASE) |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 155 | /* Setup code in SRAM to initialize FLASHBAR, if start from internal Flash */ |
| 156 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 157 | move.l #(_flashbar_setup-CONFIG_SYS_INT_FLASH_BASE), %a0 |
| 158 | move.l #(_flashbar_setup_end-CONFIG_SYS_INT_FLASH_BASE), %a1 |
| 159 | move.l #(CONFIG_SYS_INIT_RAM_ADDR), %a2 |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 160 | _copy_flash: |
| 161 | move.l (%a0)+, (%a2)+ |
| 162 | cmp.l %a0, %a1 |
| 163 | bgt.s _copy_flash |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 164 | jmp CONFIG_SYS_INIT_RAM_ADDR |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 165 | |
| 166 | _flashbar_setup: |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 167 | /* Initialize FLASHBAR: locate internal Flash and validate it */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 168 | move.l #(CONFIG_SYS_INT_FLASH_BASE + CONFIG_SYS_INT_FLASH_ENABLE), %d0 |
TsiChung Liew | 7e5ae27 | 2008-03-13 14:26:32 -0500 | [diff] [blame] | 169 | movec %d0, %FLASHBAR |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 170 | jmp _after_flashbar_copy.L /* Force jump to absolute address */ |
| 171 | _flashbar_setup_end: |
| 172 | nop |
| 173 | _after_flashbar_copy: |
| 174 | #else |
| 175 | /* Setup code to initialize FLASHBAR, if start from external Memory */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 176 | move.l #(CONFIG_SYS_INT_FLASH_BASE + CONFIG_SYS_INT_FLASH_ENABLE), %d0 |
TsiChung Liew | fcd4aac | 2008-08-11 15:54:25 +0000 | [diff] [blame] | 177 | movec %d0, %FLASHBAR |
Wolfgang Denk | 0708bc6 | 2010-10-07 21:51:12 +0200 | [diff] [blame] | 178 | #endif /* (CONFIG_SYS_TEXT_BASE == CONFIG_SYS_INT_FLASH_BASE) */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 179 | |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 180 | #endif |
Wolfgang Denk | 5b1657d | 2006-09-04 01:03:57 +0200 | [diff] [blame] | 181 | #endif |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 182 | /* if we come from a pre-loader we have no exception table and |
| 183 | * therefore no VBR to set |
| 184 | */ |
| 185 | #if !defined(CONFIG_MONITOR_IS_IN_RAM) |
Wolfgang Denk | 0708bc6 | 2010-10-07 21:51:12 +0200 | [diff] [blame] | 186 | #if defined(CONFIG_M5282) && (CONFIG_SYS_TEXT_BASE == CONFIG_SYS_INT_FLASH_BASE) |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 187 | move.l #CONFIG_SYS_INT_FLASH_BASE, %d0 |
TsiChungLiew | 5bffcad | 2007-10-25 17:09:17 -0500 | [diff] [blame] | 188 | #else |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 189 | move.l #CONFIG_SYS_FLASH_BASE, %d0 |
TsiChungLiew | 5bffcad | 2007-10-25 17:09:17 -0500 | [diff] [blame] | 190 | #endif |
Heiko Schocher | ac1956e | 2006-04-20 08:42:42 +0200 | [diff] [blame] | 191 | movec %d0, %VBR |
Marian Balakowicz | c20d87d | 2006-05-09 11:51:51 +0200 | [diff] [blame] | 192 | #endif |
| 193 | |
Matthew Fettke | 761e2e9 | 2008-02-04 15:38:20 -0600 | [diff] [blame] | 194 | #ifdef CONFIG_M5275 |
| 195 | /* Initialize IPSBAR */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 196 | move.l #(CONFIG_SYS_MBAR + 1), %d0 /* set IPSBAR address + valid flag */ |
Matthew Fettke | 761e2e9 | 2008-02-04 15:38:20 -0600 | [diff] [blame] | 197 | move.l %d0, 0x40000000 |
| 198 | /* movec %d0, %MBAR */ |
| 199 | |
| 200 | /* Initialize RAMBAR: locate SRAM and validate it */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 201 | move.l #(CONFIG_SYS_INIT_RAM_ADDR + 0x21), %d0 |
Matthew Fettke | 761e2e9 | 2008-02-04 15:38:20 -0600 | [diff] [blame] | 202 | movec %d0, %RAMBAR1 |
| 203 | #endif |
| 204 | |
TsiChung Liew | 0ee47d4 | 2010-03-11 22:12:53 -0600 | [diff] [blame] | 205 | /* initialize general use internal ram */ |
| 206 | move.l #0, %d0 |
| 207 | move.l #(ICACHE_STATUS), %a1 /* icache */ |
| 208 | move.l #(DCACHE_STATUS), %a2 /* icache */ |
| 209 | move.l %d0, (%a1) |
| 210 | move.l %d0, (%a2) |
| 211 | |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 212 | /* set stackpointer to end of internal ram to get some stackspace for the first c-code */ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 213 | move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 214 | clr.l %sp@- |
| 215 | |
| 216 | move.l #__got_start, %a5 /* put relocation table address to a5 */ |
| 217 | |
| 218 | bsr cpu_init_f /* run low-level CPU init code (from flash) */ |
| 219 | bsr board_init_f /* run low-level board init code (from flash) */ |
| 220 | |
Marian Balakowicz | c20d87d | 2006-05-09 11:51:51 +0200 | [diff] [blame] | 221 | /* board_init_f() does not return */ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 222 | |
| 223 | /*------------------------------------------------------------------------------*/ |
| 224 | |
| 225 | /* |
| 226 | * void relocate_code (addr_sp, gd, addr_moni) |
| 227 | * |
| 228 | * This "function" does not return, instead it continues in RAM |
| 229 | * after relocating the monitor code. |
| 230 | * |
| 231 | * r3 = dest |
| 232 | * r4 = src |
| 233 | * r5 = length in bytes |
| 234 | * r6 = cachelinesize |
| 235 | */ |
| 236 | .globl relocate_code |
| 237 | relocate_code: |
| 238 | link.w %a6,#0 |
| 239 | move.l 8(%a6), %sp /* set new stack pointer */ |
| 240 | |
| 241 | move.l 12(%a6), %d0 /* Save copy of Global Data pointer */ |
| 242 | move.l 16(%a6), %a0 /* Save copy of Destination Address */ |
| 243 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 244 | move.l #CONFIG_SYS_MONITOR_BASE, %a1 |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 245 | move.l #__init_end, %a2 |
| 246 | move.l %a0, %a3 |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 247 | /* copy the code to RAM */ |
| 248 | 1: |
| 249 | move.l (%a1)+, (%a3)+ |
| 250 | cmp.l %a1,%a2 |
| 251 | bgt.s 1b |
| 252 | |
| 253 | /* |
| 254 | * We are done. Do not return, instead branch to second part of board |
| 255 | * initialization, now running from RAM. |
| 256 | */ |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 257 | move.l %a0, %a1 |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 258 | add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1 |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 259 | jmp (%a1) |
| 260 | |
| 261 | in_ram: |
| 262 | |
| 263 | clear_bss: |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 264 | /* |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 265 | * Now clear BSS segment |
| 266 | */ |
| 267 | move.l %a0, %a1 |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 268 | add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1 |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 269 | move.l %a0, %d1 |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 270 | add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1 |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 271 | 6: |
| 272 | clr.l (%a1)+ |
| 273 | cmp.l %a1,%d1 |
| 274 | bgt.s 6b |
| 275 | |
| 276 | /* |
| 277 | * fix got table in RAM |
| 278 | */ |
| 279 | move.l %a0, %a1 |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 280 | add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1 |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 281 | move.l %a1,%a5 /* * fix got pointer register a5 */ |
| 282 | |
| 283 | move.l %a0, %a2 |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 284 | add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2 |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 285 | |
| 286 | 7: |
| 287 | move.l (%a1),%d1 |
| 288 | sub.l #_start,%d1 |
| 289 | add.l %a0,%d1 |
| 290 | move.l %d1,(%a1)+ |
| 291 | cmp.l %a2, %a1 |
| 292 | bne 7b |
| 293 | |
| 294 | /* calculate relative jump to board_init_r in ram */ |
| 295 | move.l %a0, %a1 |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 296 | add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1 |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 297 | |
| 298 | /* set parameters for board_init_r */ |
| 299 | move.l %a0,-(%sp) /* dest_addr */ |
| 300 | move.l %d0,-(%sp) /* gd */ |
Wolfgang Denk | 0708bc6 | 2010-10-07 21:51:12 +0200 | [diff] [blame] | 301 | #if defined(DEBUG) && (CONFIG_SYS_TEXT_BASE != CONFIG_SYS_INT_FLASH_BASE) && \ |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 302 | defined(CONFIG_SYS_HALT_BEFOR_RAM_JUMP) |
TsiChungLiew | 8cd73be | 2007-08-15 19:21:21 -0500 | [diff] [blame] | 303 | halt |
| 304 | #endif |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 305 | jsr (%a1) |
| 306 | |
| 307 | /*------------------------------------------------------------------------------*/ |
| 308 | /* exception code */ |
| 309 | .globl _fault |
| 310 | _fault: |
| 311 | jmp _fault |
| 312 | |
| 313 | .globl _exc_handler |
| 314 | _exc_handler: |
| 315 | SAVE_ALL |
| 316 | movel %sp,%sp@- |
| 317 | bsr exc_handler |
| 318 | addql #4,%sp |
| 319 | RESTORE_ALL |
| 320 | |
| 321 | .globl _int_handler |
| 322 | _int_handler: |
| 323 | SAVE_ALL |
| 324 | movel %sp,%sp@- |
| 325 | bsr int_handler |
| 326 | addql #4,%sp |
| 327 | RESTORE_ALL |
| 328 | |
| 329 | /*------------------------------------------------------------------------------*/ |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 330 | |
| 331 | .globl version_string |
| 332 | version_string: |
| 333 | .ascii U_BOOT_VERSION |
Peter Tyser | 6294850 | 2008-11-03 09:30:59 -0600 | [diff] [blame] | 334 | .ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")" |
wdenk | e65527f | 2004-02-12 00:47:09 +0000 | [diff] [blame] | 335 | .ascii CONFIG_IDENT_STRING, "\0" |
TsiChung Liew | 9d636e9 | 2008-03-28 08:47:45 -0500 | [diff] [blame] | 336 | .align 4 |