blob: c9b03b4a6049825563d60803f4cd25349567aa80 [file] [log] [blame]
Shad Ansari2f7f9be2017-06-07 13:34:53 -07001/*
2<:copyright-BRCM:2014:DUAL/GPL:standard
3
4 Copyright (c) 2014 Broadcom Corporation
5 All Rights Reserved
6
7Unless you and Broadcom execute a separate written software license
8agreement governing use of this software, this software is licensed
9to you under the terms of the GNU General Public License version 2
10(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
11with the following added to such license:
12
13 As a special exception, the copyright holders of this software give
14 you permission to link this software with independent modules, and
15 to copy and distribute the resulting executable under terms of your
16 choice, provided that you also meet, for each linked independent
17 module, the terms and conditions of the license of that module.
18 An independent module is a module which is not derived from this
19 software. The special exception does not apply to any modifications
20 of the software.
21
22Not withstanding the above, under no circumstances may you combine
23this software in any way with any other Broadcom software provided
24under a license other than the GPL, without Broadcom's express prior
25written consent.
26
27:>
28*/
29
30#include <bcmos_system.h>
31#include <bcmcli.h>
32#include <bcmolt_model_types.h>
33#include <bcmolt_msg.h>
34#include <bcmolt_api.h>
35#include <bcm_api_cli_helpers.h>
36#include "bcmolt_sw_upgrade_cli.h"
37
38static bcmos_errno bcmolt_user_appl_cli_sw_upgrade_activate(bcmcli_session *session, const bcmcli_cmd_parm parms[], uint16_t n_parms)
39{
40 bcmolt_device_key key = {};
41 bcmolt_device_sw_upgrade_activate oper_sw_upgrade_activate;
42 bcmolt_device_disconnect oper_disconnect;
43 bcmolt_device_connect oper_connect;
44 bcmos_errno err;
45
46 BCMOLT_OPER_INIT(&oper_sw_upgrade_activate, device, sw_upgrade_activate, key);
47 err = bcmolt_oper_submit(0, &oper_sw_upgrade_activate.hdr);
48 if (err)
49 return err;
50
51 BCMOLT_OPER_INIT(&oper_disconnect, device, disconnect, key);
52 err = bcmolt_oper_submit(0, &oper_disconnect.hdr);
53 if (err)
54 return err;
55
56 BCMOLT_OPER_INIT(&oper_connect, device, connect, key);
57 return bcmolt_oper_submit(0, &oper_connect.hdr);
58}
59
60bcmos_errno bcmolt_user_appl_cli_sw_upgrade_init(bcmcli_entry *top_dir)
61{
62 bcmcli_entry *dir = bcmcli_dir_add(top_dir, "sw_upgrade",
63 "Software upgrade user application", BCMCLI_ACCESS_ADMIN, NULL);
64 BCMOS_CHECK_RETURN_ERROR(!dir, BCM_ERR_NOMEM);
65
66 BCMCLI_MAKE_CMD_NOPARM(dir, "activate", "SW upgrade image activation", bcmolt_user_appl_cli_sw_upgrade_activate);
67
68 return BCM_ERR_OK;
69}
70