]> Git Repo - J-u-boot.git/blob - include/imx_container.h
lmb: Rename _lmb_alloc_addr() to lmb_alloc_addr_flags()
[J-u-boot.git] / include / imx_container.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright 2018-2019 NXP
4  */
5
6 #ifndef __CONTAINER_HEADER_H_
7 #define __CONTAINER_HEADER_H_
8
9 #include <linux/sizes.h>
10 #include <linux/types.h>
11
12 #define IV_MAX_LEN                      32
13 #define HASH_MAX_LEN                    64
14
15 #define CONTAINER_HDR_ALIGNMENT 0x400
16 #define CONTAINER_HDR_EMMC_OFFSET 0
17 #define CONTAINER_HDR_MMCSD_OFFSET SZ_32K
18 #define CONTAINER_HDR_QSPI_OFFSET SZ_4K
19 #define CONTAINER_HDR_NAND_OFFSET SZ_128M
20
21 #define CONTAINER_HDR_TAG 0x87
22 #define CONTAINER_HDR_VERSION 0
23
24 struct container_hdr {
25         u8 version;
26         u8 length_lsb;
27         u8 length_msb;
28         u8 tag;
29         u32 flags;
30         u16 sw_version;
31         u8 fuse_version;
32         u8 num_images;
33         u16 sig_blk_offset;
34         u16 reserved;
35 } __packed;
36
37 struct boot_img_t {
38         u32 offset;
39         u32 size;
40         u64 dst;
41         u64 entry;
42         u32 hab_flags;
43         u32 meta;
44         u8 hash[HASH_MAX_LEN];
45         u8 iv[IV_MAX_LEN];
46 } __packed;
47
48 struct signature_block_hdr {
49         u8 version;
50         u8 length_lsb;
51         u8 length_msb;
52         u8 tag;
53         u16 cert_offset;
54         u16 srk_table_offset;
55         u16 signature_offset;
56         u16 blob_offset;
57         u32 reserved;
58 } __packed;
59
60 struct generate_key_blob_hdr {
61         u8 version;
62         u8 length_lsb;
63         u8 length_msb;
64         u8 tag;
65         u8 flags;
66         u8 size;
67         u8 algorithm;
68         u8 mode;
69 } __packed;
70
71 int get_container_size(ulong addr, u16 *header_length);
72
73 static inline bool valid_container_hdr(struct container_hdr *container)
74 {
75         return container->tag == CONTAINER_HDR_TAG &&
76                container->version == CONTAINER_HDR_VERSION;
77 }
78 #endif
This page took 0.030031 seconds and 4 git commands to generate.