boot.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 & BOOTM_STATE_OS_PREP)
  37. return 0;
  38. if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
  39. return 1;
  40. #ifdef SHARED_RESOURCES
  41. swap_to(FLASH);
  42. #endif
  43. #ifdef CONFIG_VIDEO
  44. /* maybe this should be standardized and moved to bootm ... */
  45. video_stop();
  46. #endif
  47. appl = (int (*)(char *))images->ep;
  48. printf("Starting Kernel at = %p\n", appl);
  49. cmdline = make_command_line();
  50. icache_disable();
  51. dcache_disable();
  52. asm __volatile__(
  53. "RETX = %[retx];"
  54. "CALL (%0);"
  55. :
  56. : "p"(appl), "q0"(cmdline), [retx] "d"(bfin_poweron_retx)
  57. );
  58. /* does not return */
  59. return 1;
  60. }