init_helpers.c 673 B

1234567891011121314151617181920212223242526272829303132333435
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2011
  4. * Graeme Russ, <graeme.russ@gmail.com>
  5. */
  6. #include <common.h>
  7. #include <init.h>
  8. #include <linux/errno.h>
  9. #include <asm/mtrr.h>
  10. DECLARE_GLOBAL_DATA_PTR;
  11. int init_cache_f_r(void)
  12. {
  13. bool do_mtrr = CONFIG_IS_ENABLED(X86_32BIT_INIT) ||
  14. IS_ENABLED(CONFIG_FSP_VERSION2);
  15. int ret;
  16. do_mtrr &= !IS_ENABLED(CONFIG_FSP_VERSION1) &&
  17. !IS_ENABLED(CONFIG_SYS_SLIMBOOTLOADER);
  18. if (do_mtrr) {
  19. ret = mtrr_commit(false);
  20. /*
  21. * If MTRR MSR is not implemented by the processor, just ignore
  22. * it
  23. */
  24. if (ret && ret != -ENOSYS)
  25. return ret;
  26. }
  27. /* Initialise the CPU cache(s) */
  28. return init_cache();
  29. }