New upstream version 18.08
[deb_dpdk.git] / drivers / net / sfc / base / ef10_signed_image_layout.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright (c) 2016-2018 Solarflare Communications Inc.
4  * All rights reserved.
5  */
6
7 /* These structures define the layouts for the signed firmware image binary
8  * saved in NVRAM. The original image is in the Cryptographic message
9  * syntax (CMS) format which contains the bootable firmware binary plus the
10  * signatures. The entire image is written into NVRAM to enable the firmware
11  * to validate the signatures. However, the bootrom still requires the
12  * bootable-image to start at offset 0 of the NVRAM partition. Hence the image
13  * is parsed upfront by host utilities (sfupdate) and written into nvram as
14  * 'signed_image_chunks' described by a header.
15  *
16  * This file is used by the MC as well as host-utilities (sfupdate).
17  */
18
19
20 #ifndef CI_MGMT_SIGNED_IMAGE_LAYOUT_H
21 #define CI_MGMT_SIGNED_IMAGE_LAYOUT_H
22
23 /* Signed image chunk type identifiers */
24 enum {
25   SIGNED_IMAGE_CHUNK_CMS_HEADER,        /* CMS header describing the signed data */
26   SIGNED_IMAGE_CHUNK_REFLASH_HEADER,    /* Reflash header */
27   SIGNED_IMAGE_CHUNK_IMAGE,             /* Bootable binary image */
28   SIGNED_IMAGE_CHUNK_REFLASH_TRAILER,   /* Reflash trailer */
29   SIGNED_IMAGE_CHUNK_SIGNATURE,         /* Remaining contents of the signed image,
30                                          * including the certifiates and signature */
31   NUM_SIGNED_IMAGE_CHUNKS,
32 };
33
34 /* Magic */
35 #define SIGNED_IMAGE_CHUNK_HDR_MAGIC 0xEF105161 /* EF10 SIGned Image */
36
37 /* Initial version definition - version 1 */
38 #define SIGNED_IMAGE_CHUNK_HDR_VERSION 0x1
39
40 /* Header length is 32 bytes */
41 #define SIGNED_IMAGE_CHUNK_HDR_LEN   32
42 /* Structure describing the header of each chunk of signed image
43  * as stored in nvram
44  */
45 typedef struct signed_image_chunk_hdr_e {
46   /* Magic field to recognise a valid entry
47    * should match SIGNED_IMAGE_CHUNK_HDR_MAGIC
48    */
49   uint32_t magic;
50   /* Version number of this header */
51   uint32_t version;
52   /* Chunk type identifier */
53   uint32_t id;
54   /* Chunk offset */
55   uint32_t offset;
56   /* Chunk length */
57   uint32_t len;
58   /* Reserved for future expansion of this structure - always set to zeros */
59   uint32_t reserved[3];
60 } signed_image_chunk_hdr_t;
61
62 #endif /* CI_MGMT_SIGNED_IMAGE_LAYOUT_H */