blob: fd4d6d0ce0e7403168a3d871d4ad382538059ece [file] [log] [blame]
Shad Ansari2f7f9be2017-06-07 13:34:53 -07001/*
2<:copyright-BRCM:2016:proprietary:standard
3
4 Broadcom Proprietary and Confidential.(c) 2016 Broadcom
5 All Rights Reserved
6
7This program is the proprietary software of Broadcom Corporation and/or its
8licensors, and may only be used, duplicated, modified or distributed pursuant
9to the terms and conditions of a separate, written license agreement executed
10between you and Broadcom (an "Authorized License"). Except as set forth in
11an Authorized License, Broadcom grants no license (express or implied), right
12to use, or waiver of any kind with respect to the Software, and Broadcom
13expressly reserves all rights in and to the Software and all intellectual
14property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU HAVE
15NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY NOTIFY
16BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE.
17
18Except as expressly set forth in the Authorized License,
19
201. This program, including its structure, sequence and organization,
21 constitutes the valuable trade secrets of Broadcom, and you shall use
22 all reasonable efforts to protect the confidentiality thereof, and to
23 use this information only in connection with your use of Broadcom
24 integrated circuit products.
25
262. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
27 AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
28 WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
29 RESPECT TO THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND
30 ALL IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT,
31 FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR
32 COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE
33 TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF USE OR
34 PERFORMANCE OF THE SOFTWARE.
35
363. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR
37 ITS LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL,
38 INDIRECT, OR EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY
39 WAY RELATING TO YOUR USE OF OR INABILITY TO USE THE SOFTWARE EVEN
40 IF BROADCOM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES;
41 OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT ACTUALLY PAID FOR THE
42 SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE LIMITATIONS
43 SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY
44 LIMITED REMEDY.
45:>
46*/
47#ifndef _BCMOLT_FIRMWARE_ENVELOPE_H_
48#define _BCMOLT_FIRMWARE_ENVELOPE_H_
49
50#include <bcmos_system.h>
51
52#define BCMOLT_FIRMWARE_ENVELOPE_DESC_MAX_SIZE 128
53#define BCMOLT_FIRMWARE_ENVELOPE_TIME_ZONE_SIZE 7
54#define BCMOLT_FIRMWARE_ENVELOPE_MD5_CHECKSUM_SIZE 16
55
56/* Normalized form of a firmware revision for comparison purposes. */
57#define DEVICE_MGMT_REVISION_RELEASE_MAJOR_ID_SHIFT 24
58#define DEVICE_MGMT_REVISION_RELEASE_MINOR_ID_SHIFT 16
59#define DEVICE_MGMT_REVISION_RELEASE_REVISION_ID_SHIFT 8
60#define DEVICE_MGMT_REVISION_MODEL_ID_SHIFT 0
61
62#define BCMOLT_FIRMWARE_ENVELOPE_NORMALIZE(rev_a) \
63 (((rev_a)->release_major_id << DEVICE_MGMT_REVISION_RELEASE_MAJOR_ID_SHIFT) | \
64 ((rev_a)->release_minor_id << DEVICE_MGMT_REVISION_RELEASE_MINOR_ID_SHIFT) | \
65 ((rev_a)->release_revision_id << DEVICE_MGMT_REVISION_RELEASE_REVISION_ID_SHIFT) | \
66 ((rev_a)->model_id << DEVICE_MGMT_REVISION_MODEL_ID_SHIFT))
67
68typedef struct __PACKED_ATTR_START__
69{
70 uint8_t release_major_id;
71 uint8_t release_minor_id;
72 uint8_t release_revision_id;
73 uint32_t model_id;
74} __PACKED_ATTR_END__ bcmolt_firmware_envelope_revision;
75
76typedef struct __PACKED_ATTR_START__
77{
78 uint8_t envelope_revision; /* The envelope itself can be changed over time, so this explains why we need an envelope revision field. */
79 bcmolt_firmware_envelope_revision revision; /* Revision information */
80 uint32_t block_issu_enforce; /* Every time a change in the code cannot be supported in ISSU and requires a regular upgrade (e.g.: SGB/SERDES firmware upgrade), this integer number will
81 * be incremented. If revision validation function detects a change in this integer between two revisions, then it will block ISSU. */
82 uint32_t p4_change_set; /* This is purely informative field that should have no impact on validation. */
83 uint32_t build_time; /* This is purely informative field that should have no impact on validation. It contains the date/time of the image itself, expressed as seconds since the EPOCH. */
84 char build_time_zone[BCMOLT_FIRMWARE_ENVELOPE_TIME_ZONE_SIZE]; /* This is purely informative field that should have no impact on validation. It goes along with build time option and
85 * provides time zone information, as the embedded side does not know anything about time zone (without that, the build
86 * time converted to a string will always yield GMT time, not local time). */
87 uint8_t desc[BCMOLT_FIRMWARE_ENVELOPE_DESC_MAX_SIZE]; /* This is purely informative field that should have no impact on validation. */
88 uint8_t md5_checksum[BCMOLT_FIRMWARE_ENVELOPE_MD5_CHECKSUM_SIZE]; /* The MD5 checksum should be applied on the image itself, not on the envelope. This may be redundant because we
89 * automatically do CRC inherently as part of image transfer mechanism. However, this may have some future use. */
90 uint32_t image_len; /* The size in bytes of the image itself, not with the envelope. 4 bytes should be big enough to accommodate image length up to 4GB, which is far beyond what we
91 * really need. */
92} __PACKED_ATTR_END__ bcmolt_firmware_envelope;
93
94#endif
95