blob: 06e5b33b7af673c500ea79a795911f23bf1091e8 [file] [log] [blame]
Sheetal Tigadoliad0943e2019-12-18 19:44:43 +05301/*
2 * Copyright (c) 2015 - 2020, Broadcom
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <stdint.h>
8
9#include <common/debug.h>
10
11#include <platform_def.h>
12#include <sbl_util.h>
13#include <sotp.h>
14
15#pragma weak plat_sbl_status
16
17int plat_sbl_status(uint64_t sbl_status)
18{
19 return sbl_status ? 1:0;
20}
21
22int sbl_status(void)
23{
24 uint64_t sbl_sotp = 0;
25 int ret = SBL_DISABLED;
26
27 sbl_sotp = sotp_mem_read(SOTP_ATF_CFG_ROW_ID, SOTP_ROW_NO_ECC);
28
29 if (sbl_sotp != SOTP_ECC_ERR_DETECT) {
30
31 sbl_sotp &= SOTP_SBL_MASK;
32
33 if (plat_sbl_status(sbl_sotp))
34 ret = SBL_ENABLED;
35 }
36
37 VERBOSE("SBL status: %d\n", ret);
38
39 return ret;
40}