1/* 2 * U-boot - boot.c - misc boot helper functions 3 * 4 * Copyright (c) 2005-2008 Analog Devices Inc. 5 * 6 * (C) Copyright 2000-2004 7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 8 * 9 * Licensed under the GPL-2 or later. 10 */ 11 12#include <common.h> 13#include <command.h> 14#include <image.h> 15#include <asm/blackfin.h> 16 17#ifdef SHARED_RESOURCES 18extern void swap_to(int device_id); 19#endif 20 21#ifdef CONFIG_VIDEO 22extern void video_stop(void); 23#endif 24 25static char *make_command_line(void) 26{ 27 char *dest = (char *)CONFIG_LINUX_CMDLINE_ADDR; 28 char *bootargs = getenv("bootargs"); 29 30 if (bootargs == NULL) 31 return NULL; 32 33 strncpy(dest, bootargs, CONFIG_LINUX_CMDLINE_SIZE); 34 dest[CONFIG_LINUX_CMDLINE_SIZE - 1] = 0; 35 return dest; 36} 37 38extern ulong bfin_poweron_retx; 39 40int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images) 41{ 42 int (*appl) (char *cmdline); 43 char *cmdline; 44 45 if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) 46 return 1; 47 48#ifdef SHARED_RESOURCES 49 swap_to(FLASH); 50#endif 51 52#ifdef CONFIG_VIDEO 53 /* maybe this should be standardized and moved to bootm ... */ 54 video_stop(); 55#endif 56 57 appl = (int (*)(char *))images->ep; 58 59 printf("Starting Kernel at = %p\n", appl); 60 cmdline = make_command_line(); 61 icache_disable(); 62 dcache_disable(); 63 asm __volatile__( 64 "RETX = %[retx];" 65 "CALL (%0);" 66 : 67 : "p"(appl), "q0"(cmdline), [retx] "d"(bfin_poweron_retx) 68 ); 69 /* does not return */ 70 71 return 1; 72} 73