boot.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. #include <common.h>
  12. #include <command.h>
  13. #include <image.h>
  14. #include <asm/blackfin.h>
  15. #ifdef SHARED_RESOURCES
  16. extern void swap_to(int device_id);
  17. #endif
  18. static char *make_command_line(void)
  19. {
  20. char *dest = (char *)CONFIG_LINUX_CMDLINE_ADDR;
  21. char *bootargs = getenv("bootargs");
  22. if (bootargs == NULL)
  23. return NULL;
  24. strncpy(dest, bootargs, CONFIG_LINUX_CMDLINE_SIZE);
  25. dest[CONFIG_LINUX_CMDLINE_SIZE - 1] = 0;
  26. return dest;
  27. }
  28. extern ulong bfin_poweron_retx;
  29. int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
  30. {
  31. int (*appl) (char *cmdline);
  32. char *cmdline;
  33. if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
  34. return 1;
  35. #ifdef SHARED_RESOURCES
  36. swap_to(FLASH);
  37. #endif
  38. appl = (int (*)(char *))images->ep;
  39. printf("Starting Kernel at = %p\n", appl);
  40. cmdline = make_command_line();
  41. icache_disable();
  42. dcache_disable();
  43. asm __volatile__(
  44. "RETX = %[retx];"
  45. "CALL (%0);"
  46. :
  47. : "p"(appl), "q0"(cmdline), [retx] "d"(bfin_poweron_retx)
  48. );
  49. /* does not return */
  50. return 1;
  51. }