xref: /OK3568_Linux_fs/u-boot/arch/arm/include/asm/arch-rockchip/resource_img.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * (C) Copyright 2017 Rockchip Electronics Co., Ltd
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6 
7 #ifndef __RESC_IMG_H_
8 #define __RESC_IMG_H_
9 
10 #include <linux/list.h>
11 
12 #define MAX_FILE_NAME_LEN		220
13 #define MAX_HASH_LEN			32
14 #define DTB_SUFFIX			".dtb"
15 
16 struct resource_file {
17 	char		name[MAX_FILE_NAME_LEN];
18 	uint32_t	blk_start;
19 	uint32_t	blk_offset;
20 	char		hash[MAX_HASH_LEN];
21 	uint32_t	hash_size;
22 	uint32_t	size;		/* in byte */
23 	bool		in_ram;
24 	struct list_head link;
25 };
26 
27 extern struct list_head entry_head;
28 
29 /*
30  * resource_setup_ram_list() - setup resource file list by given resource image.
31  *
32  * @dev_desc: boot device
33  * @hdr: resource file hdr
34  *
35  * return 0 on success, otherwise fail.
36  */
37 int resource_setup_ram_list(struct blk_desc *dev_desc, void *hdr);
38 
39 /*
40  * rockchip_read_resource_file() - read file from resource.
41  *
42  * @buf: destination buf to store file data
43  * @name: file name
44  * @blk_offset: blocks offset in the file, 1 block = 512 bytes
45  * @len: the size(by bytes) of file to read
46  *
47  * return the length of read data.
48  */
49 int rockchip_read_resource_file(void *buf, const char *name, int blk_offset, int len);
50 
51 /*
52  * rockchip_read_resource_dtb() - read dtb file
53  *
54  * @fdt_addr: destination buf to store dtb file
55  * @hash: hash value buffer
56  * @hash_size: hash value length
57  */
58 int rockchip_read_resource_dtb(void *fdt_addr, char **hash, int *hash_size);
59 
60 #endif
61