blob: 71bcee97298cfcb688335468ca1ee44b962b8b6b [file] [log] [blame]
Shad Ansari2f7f9be2017-06-07 13:34:53 -07001/******************************************************************************
2 *
3 * <:copyright-BRCM:2016:DUAL/GPL:standard
4 *
5 * Copyright (c) 2016 Broadcom
6 * All Rights Reserved
7 *
8 * Unless you and Broadcom execute a separate written software license
9 * agreement governing use of this software, this software is licensed
10 * to you under the terms of the GNU General Public License version 2
11 * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
12 * with the following added to such license:
13 *
14 * As a special exception, the copyright holders of this software give
15 * you permission to link this software with independent modules, and
16 * to copy and distribute the resulting executable under terms of your
17 * choice, provided that you also meet, for each linked independent
18 * module, the terms and conditions of the license of that module.
19 * An independent module is a module which is not derived from this
20 * software. The special exception does not apply to any modifications
21 * of the software.
22 *
23 * Not withstanding the above, under no circumstances may you combine
24 * this software in any way with any other Broadcom software provided
25 * under a license other than the GPL, without Broadcom's express prior
26 * written consent.
27 *
28 * :>
29 *
30 *****************************************************************************/
31
32#include <bcm_topo.h>
33#include "rsc_mgr_common.h"
34
35#ifdef ENABLE_LOG
36dev_log_id rsc_mgr_log_id = DEV_LOG_INVALID_ID;
37#endif
38
39bcmos_errno rsc_mgr_init_validate(void)
40{
41 if (!rsc_mgr_context.is_initialized)
42 {
43#ifdef ENABLE_LOG
44 if (rsc_mgr_log_id == DEV_LOG_INVALID_ID)
45 {
46 rsc_mgr_log_id = bcm_dev_log_id_register("RSC_MGR", DEV_LOG_LEVEL_INFO, DEV_LOG_ID_TYPE_BOTH);
47 BUG_ON(rsc_mgr_log_id == DEV_LOG_INVALID_ID);
48 }
49#endif
50 return BCM_ERR_STATE;
51 }
52
53 if (!bcm_topo_is_initialized())
54 {
55 BCM_LOG(ERROR, rsc_mgr_log_id, "Resource manager cannot be called before topology is initialized\n");
56 return BCM_ERR_STATE;
57 }
58
59 return BCM_ERR_OK;
60}
61