blob: d0afb21ebb8a128d74de8902ca69f5253beea976 [file] [log] [blame]
Wolfgang Denk6cb142f2006-03-12 02:12:27 +01001/*
Mike Frysinger9171fc82008-03-30 15:46:13 -04002 * U-boot - bootm.c - misc boot helper functions
Wolfgang Denk6cb142f2006-03-12 02:12:27 +01003 *
Mike Frysinger9171fc82008-03-30 15:46:13 -04004 * Copyright (c) 2005-2008 Analog Devices Inc.
Wolfgang Denk6cb142f2006-03-12 02:12:27 +01005 *
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 *
Mike Frysinger9171fc82008-03-30 15:46:13 -04009 * Licensed under the GPL-2 or later.
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010010 */
11
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010012#include <common.h>
13#include <command.h>
14#include <image.h>
Mike Frysinger9171fc82008-03-30 15:46:13 -040015#include <asm/blackfin.h>
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010016
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010017#ifdef SHARED_RESOURCES
Aubrey.Li3f0606a2007-03-09 13:38:44 +080018extern void swap_to(int device_id);
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010019#endif
20
Mike Frysinger9171fc82008-03-30 15:46:13 -040021static char *make_command_line(void)
22{
23 char *dest = (char *)CMD_LINE_ADDR;
24 char *bootargs = getenv("bootargs");
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010025
Mike Frysinger9171fc82008-03-30 15:46:13 -040026 if (bootargs == NULL)
27 return NULL;
28
29 strncpy(dest, bootargs, 0x1000);
30 dest[0xfff] = 0;
31 return dest;
32}
33
Kumar Gala40d7e992008-08-15 08:24:45 -050034int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010035{
Marian Balakowiczd5934ad2008-02-04 08:28:09 +010036 int (*appl) (char *cmdline);
37 char *cmdline;
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010038
39#ifdef SHARED_RESOURCES
40 swap_to(FLASH);
41#endif
42
Kumar Galac160a952008-08-15 08:24:36 -050043 appl = (int (*)(char *))images->ep;
Marian Balakowiczd5934ad2008-02-04 08:28:09 +010044
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010045 printf("Starting Kernel at = %x\n", appl);
46 cmdline = make_command_line();
Mike Frysinger9171fc82008-03-30 15:46:13 -040047 icache_disable();
48 dcache_disable();
Aubrey.Li3f0606a2007-03-09 13:38:44 +080049 (*appl) (cmdline);
Marian Balakowiczcd7c5962008-03-12 10:33:00 +010050 /* does not return */
Kumar Gala40d7e992008-08-15 08:24:45 -050051error:
52 return 1;
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010053}