[Feature][T106_eSDK]update from T106-V2.01.01.02P56U09.AP.17.09_CAP.17.09.01 to T106-M42-PLXXXX-P56U11.AP.19.00_CAP.19.00.01 -- code
Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: I5eb7f586f78a987785b0f9885f1300c42bfd6819
diff --git a/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c b/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c
index f3e91e9..0b0f0dc 100755
--- a/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c
+++ b/upstream/linux-5.10/kernel/ramdump/ramdump_device_trans.c
@@ -51,6 +51,8 @@
extern unsigned int ramdump_compress_flag;
extern unsigned char *ramdump_log_buf;
extern unsigned int ramdump_export_mode;
+extern unsigned int ramdump_emmc_size;
+extern unsigned int ramdump_spinand_size;
/*******************************************************************************
* Macro definitions *
@@ -288,6 +290,8 @@
*******************************************************************************/
void ramdump_device_close(void)
{
+ g_ramdump_dev_fp->file_num = ramdump_device_file_cnt;
+
if(ramdump_export_mode == RAMDUMP_MODE_EMMC)
{
#ifdef CONFIG_RAMDUMP_EMMC
@@ -333,11 +337,16 @@
int ramdump_device_write_file(ramdump_trans_server_file_info_req *server_to_cap)
{
int ret = -1;
+ unsigned int file_size = 0;
+
+ /* Started by AICoder, pid:wcfb91c2aa35add146d90b5530cd112845133621 */
+ file_size = server_to_cap->file_size;
if(ramdump_export_mode == RAMDUMP_MODE_EMMC)
{
#ifdef CONFIG_RAMDUMP_EMMC
- if (ramdump_emmc_offset >= RAMDUMP_TRANS_EMMC_LEN)
+ if ((ramdump_emmc_offset >= RAMDUMP_TRANS_EMMC_LEN)
+ || ((ramdump_emmc_offset + file_size) > ramdump_emmc_size))
return -1;
ret = ramdump_fill_header(server_to_cap->file_name,
@@ -349,9 +358,11 @@
else if(ramdump_export_mode == RAMDUMP_MODE_SPINAND)
{
#ifdef CONFIG_MTD_SPI_NAND
- if (ramdump_spinand_offset >= RAMDUMP_SPINAND_LEN)
+ if ((ramdump_spinand_offset >= RAMDUMP_SPINAND_LEN)
+ || ((ramdump_spinand_offset + file_size) > ramdump_spinand_size))
return -1;
-
+ /* Ended by AICoder, pid:wcfb91c2aa35add146d90b5530cd112845133621 */
+
ret = ramdump_fill_header(server_to_cap->file_name,
server_to_cap->file_size,
&ramdump_spinand_fp,
@@ -557,9 +568,9 @@
int ramdump_device_write_data(ramdump_shmem_t *msg, unsigned int size, ssize_t *dstlen)
{
int ret = 0;
-
+
if(ramdump_export_mode == RAMDUMP_MODE_EMMC)
- {
+ {
#ifdef CONFIG_RAMDUMP_EMMC
ret = ramdump_emmc_write_data(msg, &ramdump_device_fp, size);
if(ret < 0)
@@ -637,8 +648,6 @@
ramdump_trans_server_interactive_req *server_to_cap_msg = (ramdump_trans_server_interactive_req *)req_buf;
/* data from server to cap */
ramdump_file_num = server_to_cap_msg->file_num;
- ramdump_device_fp.file_num += ramdump_file_num;
- ramdump_spinand_fp.file_num += ramdump_file_num;
/* data from cap to server */
cap_to_server_msg.cmd = RAMDUMP_PC_FILE_INFO_READ_REQ;
@@ -658,8 +667,12 @@
/*device memory file create*/
if(ramdump_device_write_file(server_to_cap_msg) == -1){
cap_to_server_msg.cmd = RAMDUMP_PC_FILE_TRANS_DONE_REQ;
- ramdump_device_write_file_head();//±£Ö¤³ö´íǰ¼¸¸öÎļþ¾ùд¶Ô¡£
- ramdump_printf("ramdump write emmc file error!\n");
+ /* Started by AICoder, pid:ddd3ag3c37x6798145ec08ac1067150b58735197 */
+ ramdump_oss_data_trans_write(
+ (unsigned char*)(&cap_to_server_msg),
+ sizeof(cap_to_server_msg));
+ break;
+ /* Ended by AICoder, pid:ddd3ag3c37x6798145ec08ac1067150b58735197 */
}
file_size = server_to_cap_msg->file_size;
file_offset = 0;
@@ -675,7 +688,8 @@
file_trans_size = cap_to_server_msg.length;
file_left_size = file_left_size - cap_to_server_msg.length;
file_offset = file_offset + cap_to_server_msg.length;
- printk("device memory trans file:%s !!!\n", server_to_cap_msg->file_name);
+
+ printk("device memory trans file:%-30s size %9d, offset %9d!!!\n", server_to_cap_msg->file_name, file_size, ramdump_emmc_offset);
/* interactive data trans */
ramdump_oss_data_trans_write(
(unsigned char*)(&cap_to_server_msg),
@@ -690,14 +704,24 @@
/* data from server to cap */
ramdump_shmem_t *server_to_cap_msg = (ramdump_shmem_t *)ramdump_shared_mem_base;
server_to_cap_msg->core_flag = 0;
+
/*data from cap to emmc*/
-
write_len = ramdump_device_write_data(server_to_cap_msg, file_left_size, &file_dstlen);
- if(write_len < 0)
+ if(write_len < 0 )
{
- ramdump_printf("ramdump write emmc data error!\n");
+ /* Started by AICoder, pid:u5befs8483y615f142ce0bda306d660bed685275 */
+ if(write_len == -RAMDUMP_NO_FREE_SPACE)
+ {
+ cap_to_server_msg.cmd = RAMDUMP_PC_FILE_TRANS_DONE_REQ;
+ ramdump_oss_data_trans_write(
+ (unsigned char*)(&cap_to_server_msg),
+ sizeof(cap_to_server_msg));
+ break;
+ }
+ else
+ ramdump_printf("ramdump write emmc data error!\n");
+ /* Ended by AICoder, pid:u5befs8483y615f142ce0bda306d660bed685275 */
}
-
/*ÅжÏÊ£Óà´óС*/
if (file_left_size == 0)
{