sbl_util.c 628 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2015 - 2020, Broadcom
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <stdint.h>
  7. #include <common/debug.h>
  8. #include <platform_def.h>
  9. #include <sbl_util.h>
  10. #include <sotp.h>
  11. #pragma weak plat_sbl_status
  12. int plat_sbl_status(uint64_t sbl_status)
  13. {
  14. return sbl_status ? 1:0;
  15. }
  16. int sbl_status(void)
  17. {
  18. uint64_t sbl_sotp = 0;
  19. int ret = SBL_DISABLED;
  20. sbl_sotp = sotp_mem_read(SOTP_ATF_CFG_ROW_ID, SOTP_ROW_NO_ECC);
  21. if (sbl_sotp != SOTP_ECC_ERR_DETECT) {
  22. sbl_sotp &= SOTP_SBL_MASK;
  23. if (plat_sbl_status(sbl_sotp))
  24. ret = SBL_ENABLED;
  25. }
  26. VERBOSE("SBL status: %d\n", ret);
  27. return ret;
  28. }