start_from_spl.S 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * 32-bit x86 Startup Code when running from SPL. This is the startup code in
  4. * U-Boot proper, when SPL is used.
  5. * Copyright 2018 Google, Inc
  6. * Written by Simon Glass <sjg@chromium.org>
  7. */
  8. #include <config.h>
  9. .section .text.start
  10. .code32
  11. .globl _start
  12. .type _start, @function
  13. _start:
  14. /* Set up memory using the existing stack */
  15. movl $(CONFIG_SYS_CAR_ADDR + CONFIG_SYS_CAR_SIZE - 4), %eax
  16. #ifdef CONFIG_DCACHE_RAM_MRC_VAR_SIZE
  17. subl $CONFIG_DCACHE_RAM_MRC_VAR_SIZE, %eax
  18. #endif
  19. /*
  20. * We don't subject CONFIG_DCACHE_RAM_MRC_VAR_SIZE since memory is
  21. * already set up. This has the happy side-effect of putting gd in a
  22. * new place separate from SPL, so the memset() in
  23. * board_init_f_init_reserve() does not cause any problems (otherwise
  24. * it would zero out the gd and crash)
  25. */
  26. call board_init_f_alloc_reserve
  27. mov %eax, %esp
  28. call board_init_f_init_reserve
  29. call x86_cpu_reinit_f
  30. xorl %eax, %eax
  31. call board_init_f
  32. call board_init_f_r
  33. /* Should not return here */
  34. jmp .
  35. .globl board_init_f_r_trampoline
  36. .type board_init_f_r_trampoline, @function
  37. board_init_f_r_trampoline:
  38. /*
  39. * SPL has been executed and SDRAM has been initialised, U-Boot code
  40. * has been copied into RAM, BSS has been cleared and relocation
  41. * adjustments have been made. It is now time to jump into the in-RAM
  42. * copy of U-Boot
  43. *
  44. * %eax = Address of top of new stack
  45. */
  46. /* Stack grows down from top of SDRAM */
  47. movl %eax, %esp
  48. /* Re-enter U-Boot by calling board_init_f_r() */
  49. call board_init_f_r
  50. die:
  51. hlt
  52. jmp die
  53. hlt
  54. .align 4
  55. _dt_ucode_base_size:
  56. /* These next two fields are filled in by binman */
  57. .globl ucode_base
  58. ucode_base: /* Declared in microcode.h */
  59. .long 0 /* microcode base */
  60. .globl ucode_size
  61. ucode_size: /* Declared in microcode.h */
  62. .long 0 /* microcode size */