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