hc
2023-11-06 9df731a176aab8e03b984b681b1bea01ccff6644
u-boot/arch/arm/mach-rockchip/rk_meta.c
....@@ -50,6 +50,7 @@
5050 ulong sector;
5151 char *data;
5252 u64 len;
53
+ int meta_iq_item_size = 0;
5354
5455 if (part_get_info_by_name(info->dev, part_name, &part_info) <= 0) {
5556 debug("%s: no partition\n", __func__);
....@@ -91,32 +92,31 @@
9192
9293 /* load compress data */
9394 data = (char *)COMPRESS_LOAD_ADDR;
95
+ meta_iq_item_size = meta_p->iq_item_size + meta.comp_size;
9496 if (meta_p->comp_type == META_COMPRESS_TYPE_GZ) {
9597 if (info->read(info, sector + (MAX_META_SEGMENT_SIZE / info->bl_len),
96
- DIV_ROUND_UP(meta.comp_size, info->bl_len), data)
97
- != DIV_ROUND_UP(meta.comp_size, info->bl_len)) {
98
- debug("%s: Failed to read compress data.\n", __func__);
98
+ DIV_ROUND_UP(meta_iq_item_size, info->bl_len), data)
99
+ != DIV_ROUND_UP(meta_iq_item_size, info->bl_len)) {
100
+ printf("%s: Failed to read compress data.\n", __func__);
99101 return -EIO;
100102 }
103
+
104
+ memcpy((void *)(meta_p->load + SENSOR_IQ_BIN_OFFSET), data, meta_p->iq_item_size);
101105
102106 if (rk_meta_iq_decom((meta_p->load + meta_p->comp_off),
103107 (unsigned long)(data + meta_p->comp_off -
104108 MAX_META_SEGMENT_SIZE),
105109 meta.comp_size, &len)) {
106
- debug("%s: Failed to decompress.\n", __func__);
110
+ printf("%s: Failed to decompress.\n", __func__);
107111 return -EIO;
108112 }
109
- /* update decompress gz's file size */
110
- unsigned int *p_len = (unsigned int *)
111
- (meta_p->load + MAX_META_SEGMENT_SIZE + MAX_HEAD_SIZE);
112
- *p_len = (u32)len;
113
- /* TODO: update decompress gz's file crc32 */
113
+
114114 } else {
115115 if (info->read(info, sector + (MAX_META_SEGMENT_SIZE / info->bl_len),
116
- DIV_ROUND_UP(meta.comp_size, info->bl_len),
116
+ DIV_ROUND_UP(meta_iq_item_size, info->bl_len),
117117 (void *)(meta_p->load + MAX_META_SEGMENT_SIZE))
118
- != DIV_ROUND_UP(meta.comp_size, info->bl_len)) {
119
- debug("%s: Failed to read\n", __func__);
118
+ != DIV_ROUND_UP(meta_iq_item_size, info->bl_len)) {
119
+ printf("%s: Failed to read\n", __func__);
120120 return -EIO;
121121 }
122122 }
....@@ -125,6 +125,7 @@
125125 flush_cache(meta_p->load, meta_p->size);
126126 rk_meta_process();
127127
128
+ printf("\nMeta: ok\n");
128129 return 0;
129130 }
130131