.. | .. |
---|
11 | 11 | |
---|
12 | 12 | #define MAX_FILE_NAME_LEN 220 |
---|
13 | 13 | #define MAX_HASH_LEN 32 |
---|
14 | | -#define ROOT_COMPAT_PROP_OFFSET 0x4c /* Property: "/compatible" */ |
---|
15 | 14 | #define DTB_SUFFIX ".dtb" |
---|
16 | 15 | |
---|
17 | 16 | struct resource_file { |
---|
18 | 17 | char name[MAX_FILE_NAME_LEN]; |
---|
| 18 | + uint32_t blk_start; |
---|
| 19 | + uint32_t blk_offset; |
---|
19 | 20 | char hash[MAX_HASH_LEN]; |
---|
20 | 21 | uint32_t hash_size; |
---|
21 | | - uint32_t f_offset; /* Sector offset */ |
---|
22 | | - uint32_t f_size; /* Bytes */ |
---|
| 22 | + uint32_t size; /* in byte */ |
---|
| 23 | + bool in_ram; |
---|
23 | 24 | struct list_head link; |
---|
24 | | - struct list_head dtbs; |
---|
25 | | - /* Sector base of resource when ram=false, byte base when ram=true */ |
---|
26 | | - uint32_t rsce_base; |
---|
27 | | - bool ram; |
---|
28 | 25 | }; |
---|
29 | 26 | |
---|
30 | | -extern struct list_head entrys_head; |
---|
31 | | -extern struct list_head entrys_dtbs_head; |
---|
| 27 | +extern struct list_head entry_head; |
---|
32 | 28 | |
---|
33 | 29 | /* |
---|
34 | | - * resource_image_check_header - check resource image header |
---|
| 30 | + * resource_setup_ram_list() - setup resource file list by given resource image. |
---|
35 | 31 | * |
---|
36 | | - * @rsce_hdr: resource file hdr |
---|
| 32 | + * @dev_desc: boot device |
---|
| 33 | + * @hdr: resource file hdr |
---|
37 | 34 | * |
---|
38 | | - * return 0 on header okay, otherwise failed |
---|
| 35 | + * return 0 on success, otherwise fail. |
---|
39 | 36 | */ |
---|
40 | | -int resource_image_check_header(void *rsce_hdr); |
---|
| 37 | +int resource_setup_ram_list(struct blk_desc *dev_desc, void *hdr); |
---|
41 | 38 | |
---|
42 | 39 | /* |
---|
43 | | - * resource_create_ram_list - create resource file list by data from memory |
---|
44 | | - * |
---|
45 | | - * @dev_desc: blk dev descritpion |
---|
46 | | - * @rsce_hdr: resource file hdr |
---|
47 | | - * |
---|
48 | | - * return 0 on header okay, otherwise failed |
---|
49 | | - */ |
---|
50 | | -int resource_create_ram_list(struct blk_desc *dev_desc, void *rsce_hdr); |
---|
51 | | - |
---|
52 | | -/* |
---|
53 | | - * rockchip_read_resource_file - read file from resource partition |
---|
| 40 | + * rockchip_read_resource_file() - read file from resource. |
---|
54 | 41 | * |
---|
55 | 42 | * @buf: destination buf to store file data |
---|
56 | 43 | * @name: file name |
---|
57 | | - * @offset: blocks offset in the file, 1 block = 512 bytes |
---|
58 | | - * @len: the size(by bytes) of file to read. |
---|
| 44 | + * @blk_offset: blocks offset in the file, 1 block = 512 bytes |
---|
| 45 | + * @len: the size(by bytes) of file to read |
---|
59 | 46 | * |
---|
60 | | - * return negative num on failed, otherwise the file size |
---|
| 47 | + * return the length of read data. |
---|
61 | 48 | */ |
---|
62 | | -int rockchip_read_resource_file(void *buf, const char *name, int offset, int len); |
---|
| 49 | +int rockchip_read_resource_file(void *buf, const char *name, int blk_offset, int len); |
---|
63 | 50 | |
---|
64 | 51 | /* |
---|
65 | 52 | * rockchip_read_resource_dtb() - read dtb file |
---|
.. | .. |
---|
69 | 56 | * @hash_size: hash value length |
---|
70 | 57 | */ |
---|
71 | 58 | int rockchip_read_resource_dtb(void *fdt_addr, char **hash, int *hash_size); |
---|
72 | | - |
---|
73 | | -/* |
---|
74 | | - * resource_init_list - init resource list of android image from storage |
---|
75 | | - */ |
---|
76 | | -int resource_init_list(void); |
---|
77 | | - |
---|
78 | | -/* |
---|
79 | | - * resource_replace_entry - replace resource entry, override if find exist one |
---|
80 | | - */ |
---|
81 | | -int resource_replace_entry(const char *f_name, uint32_t base, |
---|
82 | | - uint32_t f_offset, uint32_t f_size); |
---|
83 | | - |
---|
84 | | -/* |
---|
85 | | - * resource_read_logo_bmps() - read logo bmp from "logo" partition |
---|
86 | | - */ |
---|
87 | | -int resource_read_logo_bmps(void); |
---|
88 | | - |
---|
89 | | -/* |
---|
90 | | - * resource_read_hwid_dtb() - read hwid dtb |
---|
91 | | - */ |
---|
92 | | -struct resource_file *resource_read_hwid_dtb(void); |
---|
93 | | - |
---|
94 | | -/* |
---|
95 | | - * resource_is_empty() - return if resource is empty |
---|
96 | | - */ |
---|
97 | | -int resource_is_empty(void); |
---|
98 | | - |
---|
99 | | -/* |
---|
100 | | - * resource_traverse_init_list() - traverse all image(android/fit/uimage) |
---|
101 | | - */ |
---|
102 | | -int resource_traverse_init_list(void); |
---|
103 | | - |
---|
104 | | -/* |
---|
105 | | - * board_resource_dtb_accepted() - check if this dtb is accepted |
---|
106 | | - * |
---|
107 | | - * return 0 if not accepted, otherwise accepted. |
---|
108 | | - */ |
---|
109 | | -int board_resource_dtb_accepted(char *dtb_name); |
---|
110 | 59 | |
---|
111 | 60 | #endif |
---|