boot.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #ifdef CONFIG_VIDEO
  19. extern void video_stop(void);
  20. #endif
  21. static char *make_command_line(void)
  22. {
  23. char *dest = (char *)CONFIG_LINUX_CMDLINE_ADDR;
  24. char *bootargs = getenv("bootargs");
  25. if (bootargs == NULL)
  26. return NULL;
  27. strncpy(dest, bootargs, CONFIG_LINUX_CMDLINE_SIZE);
  28. dest[CONFIG_LINUX_CMDLINE_SIZE - 1] = 0;
  29. return dest;
  30. }
  31. extern ulong bfin_poweron_retx;
  32. int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
  33. {
  34. int (*appl) (char *cmdline);
  35. char *cmdline;
  36. if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
  37. return 1;
  38. #ifdef SHARED_RESOURCES
  39. swap_to(FLASH);
  40. #endif
  41. #ifdef CONFIG_VIDEO
  42. /* maybe this should be standardized and moved to bootm ... */
  43. video_stop();
  44. #endif
  45. appl = (int (*)(char *))images->ep;
  46. printf("Starting Kernel at = %p\n", appl);
  47. cmdline = make_command_line();
  48. icache_disable();
  49. dcache_disable();
  50. asm __volatile__(
  51. "RETX = %[retx];"
  52. "CALL (%0);"
  53. :
  54. : "p"(appl), "q0"(cmdline), [retx] "d"(bfin_poweron_retx)
  55. );
  56. /* does not return */
  57. return 1;
  58. }