bootm.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (C) 2017-2020 Alibaba Group Holding Limited
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <command.h>
  8. #include <image.h>
  9. #include <u-boot/zlib.h>
  10. #include <asm/byteorder.h>
  11. #include <linux/libfdt.h>
  12. #include <mapmem.h>
  13. #include <fdt_support.h>
  14. #include <linux/compiler.h>
  15. #include <bootm.h>
  16. #include <vxworks.h>
  17. #include <asm/arch/interrupt.h>
  18. #include <irq_func.h>
  19. #include <cpu_func.h>
  20. DECLARE_GLOBAL_DATA_PTR;
  21. __weak int board_prep_linux(bootm_headers_t *images) { return 0; }
  22. /* Main Entry point for csky bootm implementation
  23. *
  24. * Modeled after the powerpc implementation
  25. * DIFFERENCE: Instead of calling prep and go at the end
  26. * they are called if subcommand is equal 0.
  27. */
  28. int do_bootm_linux(int flag, int argc, char * const argv[],
  29. bootm_headers_t *images)
  30. {
  31. void (*theKernel)(int magic, void * params);
  32. char *tmp;
  33. unsigned int dtb_load_addr = 0;
  34. if ((tmp = env_get("dtb_load_addr_virt")) != NULL) {
  35. dtb_load_addr = simple_strtoul(tmp, NULL, 16);
  36. printf("dtb_load_addr: 0x%X\n", dtb_load_addr);
  37. } else {
  38. printf("\nError! No dtb address found! Stop here...\n");
  39. while (1);
  40. }
  41. theKernel = (void (*)(int, void *))images->ep;
  42. printf("\nStarting kernel ... \n\n");
  43. disable_interrupts();
  44. flush_cache(0, 0);
  45. #ifdef CONFIG_ERAGON3
  46. /* Open the D cache */
  47. asm volatile(
  48. "mfcr r4, cr18\n"
  49. "bseti r4, 3 \n"
  50. "mtcr r4, cr18\n"
  51. :
  52. :
  53. : "r4"
  54. );
  55. #endif
  56. board_prep_linux(images);
  57. theKernel(0x20150401, (void *)dtb_load_addr);
  58. return 1;
  59. }