예제 #1
0
/*
************************************************************************************************************
*
*                                             function
*
*    name          :
*
*    parmeters     :
*
*    return        :
*
*    note          :
*
*
************************************************************************************************************
*/
int get_dram_para(void *boot_buf)
{
	boot0_file_head_t  *src_boot0;
	boot0_file_head_t  *dst_boot0;
	sbrom_toc0_config_t * secure_src_toc0;
	sbrom_toc0_config_t * secure_dst_toc0;
	char *buffer = NULL;

	buffer = (char *)kmalloc(32 * 1024, GFP_KERNEL);
	if (buffer == NULL) {
		debug("get_dram_para, kmalloc failed!\n");	
		return -1;
	}
	memset(buffer, 0, 32*1024);
	if ( NAND_ReadBoot0(32 * 1024, buffer) ) {
		debug("get_dram_para, NAND_ReadBoot0() error!\n");	
		goto error;
	}

	test_dram_para(buffer);
	if(!NAND_IS_Secure_sys())//secure
	{

		secure_src_toc0 = (sbrom_toc0_config_t *)(buffer+SBROM_TOC0_HEAD_SPACE);
		secure_dst_toc0 = (sbrom_toc0_config_t *)(boot_buf+SBROM_TOC0_HEAD_SPACE);
		memcpy(&secure_dst_toc0->dram_para[0], &secure_src_toc0->dram_para[0], 32 * 4);
	}
	else//nonsecure
	{
		src_boot0 = (boot0_file_head_t *)buffer;
		dst_boot0 = (boot0_file_head_t *)boot_buf;	
		memcpy(&dst_boot0->prvt_head, &src_boot0->prvt_head, 40 * 4);
	}
	//memcpy(dst_boot0->prvt_head.dram_para, src_boot0->prvt_head.dram_para, 32 * 4);
	test_dram_para(boot_buf);
	kfree(buffer);
	buffer = NULL;
	return 0;
	
error:
	kfree(buffer);
	buffer = NULL;
	return -1;
}
예제 #2
0
파일: boot0_op.c 프로젝트: laotie/tina
/*
************************************************************************************************************
*
*                                             function
*
*    name          :
*
*    parmeters     :
*
*    return        :
*
*    note          :
*
*
************************************************************************************************************
*/
int get_dram_para(void *boot_buf)
{
	boot0_file_head_t  *src_boot0;
	boot0_file_head_t  *dst_boot0;
	char *buffer;

	buffer = kmalloc(32 * 1024, GFP_KERNEL);
	memset(buffer, 0, 32*1024);
	NAND_ReadBoot0(24 * 1024, buffer);

	test_dram_para(buffer);
	src_boot0 = (boot0_file_head_t *)buffer;
	dst_boot0 = (boot0_file_head_t *)boot_buf;

	//memcpy(dst_boot0->prvt_head.dram_para, src_boot0->prvt_head.dram_para, 32 * 4);
	memcpy(&dst_boot0->prvt_head, &src_boot0->prvt_head, 40 * 4);
	test_dram_para(boot_buf);
	kfree(buffer);

	return 0;
}
예제 #3
0
int nand_upload_boot0(uint length, void *buf)
{
	return NAND_ReadBoot0(length, buf);
}