init_helpers.c 739 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * (C) Copyright 2011
  3. * Graeme Russ, <graeme.russ@gmail.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <asm/errno.h>
  9. #include <asm/mtrr.h>
  10. DECLARE_GLOBAL_DATA_PTR;
  11. /* Get the top of usable RAM */
  12. __weak ulong board_get_usable_ram_top(ulong total_size)
  13. {
  14. return gd->ram_size;
  15. }
  16. int init_cache_f_r(void)
  17. {
  18. #if defined(CONFIG_X86_RESET_VECTOR) & !defined(CONFIG_HAVE_FSP)
  19. int ret;
  20. ret = mtrr_commit(false);
  21. /* If MTRR MSR is not implemented by the processor, just ignore it */
  22. if (ret && ret != -ENOSYS)
  23. return ret;
  24. #endif
  25. /* Initialise the CPU cache(s) */
  26. return init_cache();
  27. }
  28. bd_t bd_data;
  29. int init_bd_struct_r(void)
  30. {
  31. gd->bd = &bd_data;
  32. memset(gd->bd, 0, sizeof(bd_t));
  33. return 0;
  34. }