void pmt_init(void) { #ifdef MTK_EMMC_SUPPORT int ret = 0; int i = 0; memset(&new_part, 0, PART_MAX_COUNT * sizeof (pt_resident)); memset(&lastest_part, 0, PART_MAX_COUNT * sizeof (pt_resident)); ret = load_pt_from_fixed_addr((u8 *)&lastest_part); if (ret == ERR_NO_EXIST) { //first run preloader before dowload //and valid mirror last download or first download get_part_tab_from_complier(); //get from complier } else { print("find pt\n"); for (i = 0; i < PART_MAX_COUNT; i++) { if (lastest_part[i].size == 0) break; print("part %s size %llx %llx\n", lastest_part[i].name, lastest_part[i].offset, lastest_part[i].size); } } #else int ret = 0; int i = 0; memset(&new_part,0, PART_MAX_COUNT * sizeof(pt_resident)); memset(&lastest_part,0, PART_MAX_COUNT * sizeof(pt_resident)); ret = load_exist_part_tab((u8 *)&lastest_part); if (ret == ERR_NO_EXIST) { //first run preloader before dowload //and valid mirror last download or first download get_part_tab_from_complier(); //get from complier } else { print("find pt\n"); for (i = 0; i < PART_MAX_COUNT; i++) { if(lastest_part[i].size == 0) break; print("part %s size %x %x\n", lastest_part[i].name, lastest_part[i].offset, lastest_part[i].size); } } init_pmt_done = TRUE; #endif }
void part_init_pmt(struct mtd_info *mtd, u8 * buf) { struct mtd_partition *part; unsigned long lastblk; int retval = 0; int i = 0; int err = 0; printk(KERN_INFO "part_init_pmt %s\n", __TIME__); page_buf = kzalloc(mtd->writesize + mtd->oobsize, GFP_KERNEL); page_readbuf = kzalloc(mtd->writesize, GFP_KERNEL); part = &g_pasStatic_Partition[0]; lastblk = part->offset + part->size; printk(KERN_INFO "offset %llx part->size %llx %s\n", part->offset, part->size, part->name); while (1) { part++; part->offset = lastblk; lastblk = part->offset + part->size; printk(KERN_INFO "mt_part_init_pmt %llx\n", part->offset); if (part->size == 0) ////the last partition sizefull ==0 { break; } } memset(&pi, 0xFF, sizeof(pi)); memset(&lastest_part, 0, PART_MAX_COUNT * sizeof(pt_resident)); retval = load_exist_part_tab(buf); if (retval == ERR_NO_EXIST) //first run preloader before dowload { //and valid mirror last download or first download printk(KERN_INFO "%s no pt \n", __func__); get_part_tab_from_complier(); //get from complier } else { printk(KERN_INFO "Find pt or mpt \n"); memcpy(&g_exist_Partition, &g_pasStatic_Partition, sizeof(struct mtd_partition) * part_num); for (i = 0; i < part_num; i++) { printk(KERN_INFO "partition %s size %lx %lx \n", lastest_part[i].name, lastest_part[i].offset, lastest_part[i].size); //still use the name in g_pasSatic_partition g_exist_Partition[i].size = (u_int32_t) lastest_part[i].size; g_exist_Partition[i].offset = (u_int32_t) lastest_part[i].offset; //still use the mask flag in g_pasSatic_partition if (i == (part_num - 1)) { g_exist_Partition[i].size = MTDPART_SIZ_FULL; } printk(KERN_INFO "partition %s size %llx\n", lastest_part[i].name, g_exist_Partition[i].offset); } } printk(KERN_INFO ": register NAND PMT device ...\n"); #ifndef MTK_EMMC_SUPPORT err = misc_register(&pmt_dev); if (unlikely(err)) { printk(KERN_INFO "PMT failed to register device!\n"); //return err; } #endif }
void part_init_pmt(unsigned long totalblks,part_dev_t *dev) { #ifdef MTK_EMMC_SUPPORT part_t *part = &mt6575_parts[0]; unsigned long lastblk; int retval=0; int i=0; printf ("mt6575_part_init_pmt \n"); if (!totalblks) return; /* updater the number of blks of first part. */ if (totalblks <= part->blknum) part->blknum = totalblks; totalblks -= part->blknum; lastblk = part->startblk + part->blknum; while(totalblks) { part++; if (!part->name) break; if (part->flags & PART_FLAG_LEFT || totalblks <= part->blknum) part->blknum = totalblks; part->startblk = lastblk; totalblks -= part->blknum; lastblk = part->startblk + part->blknum; } memset(&pi,0xFF,sizeof(pi)); memset(&lastest_part,0,PART_MAX_COUNT*sizeof(pt_resident)); retval=load_exist_part_tab((u8 *)&lastest_part,dev); if (retval==ERR_NO_EXIST) //first run preloader before dowload { //and valid mirror last download or first download printf ("no pt \n"); get_part_tab_from_complier(); //get from complier } else { printf ("Find pt \n"); for(i=0;i<PART_MAX_COUNT;i++) { if(lastest_part[i].size == 0) break; printf ("partition %s size %016llx %016llx \n",lastest_part[i].name,lastest_part[i].offset,lastest_part[i].size); } } #else part_t *part = &mt6575_parts[0]; unsigned long lastblk; int retval=0; int i=0; printf ("mt6575_part_init_pmt \n"); if (!totalblks) return; /* updater the number of blks of first part. */ if (totalblks <= part->blknum) part->blknum = totalblks; totalblks -= part->blknum; lastblk = part->startblk + part->blknum; while(totalblks) { part++; if (!part->name) break; if (part->flags & PART_FLAG_LEFT || totalblks <= part->blknum) part->blknum = totalblks; part->startblk = lastblk; totalblks -= part->blknum; lastblk = part->startblk + part->blknum; } memset(&pi,0xFF,sizeof(pi)); memset(&lastest_part,0,PART_MAX_COUNT*sizeof(pt_resident)); retval=load_exist_part_tab((u8 *)&lastest_part,dev); if (retval==ERR_NO_EXIST) //first run preloader before dowload { //and valid mirror last download or first download printf ("no pt \n"); get_part_tab_from_complier(); //get from complier } else { printf ("Find pt \n"); for(i=0;i<PART_MAX_COUNT;i++) { if(lastest_part[i].size == 0) break; printf ("partition %s size %lx %lx \n",lastest_part[i].name,lastest_part[i].offset,lastest_part[i].size); } } #endif }
void part_init_pmt(struct mtd_info *mtd, u8 *buf) { int retval = 0; int i = 0; int err = 0; pr_debug("part_init_pmt %s\n", __TIME__); page_buf = kzalloc(mtd->writesize + mtd->oobsize, GFP_KERNEL); page_readbuf = kzalloc(mtd->writesize, GFP_KERNEL); #if 0 part = &g_pasStatic_Partition[0]; lastblk = part->offset + part->size; pr_debug("offset %llx part->size %llx %s\n", part->offset, part->size, part->name); while (1) { part++; if (part->offset == MTDPART_OFS_APPEND) part->offset = lastblk; lastblk = part->offset + part->size; pr_debug("mt_part_init_pmt %llx\n", part->offset); if (part->size == 0) break; } #endif init_pmt_done = FALSE; memset(&pi, 0xFF, sizeof(pi)); memset(&lastest_part, 0, PART_MAX_COUNT * sizeof(pt_resident)); retval = load_exist_part_tab(buf); if (retval == ERR_NO_EXIST) { /* and valid mirror last download or first download */ pr_debug("%s no pt\n", __func__); get_part_tab_from_complier(); /* get from complier */ if (MLC_DEVICE == TRUE) mtd->numeraseregions = 0; for (i = 0; i < part_num; i++) { #if 1 if (MLC_DEVICE == TRUE) { mtd->eraseregions[i].offset = lastest_part[i].offset; mtd->eraseregions[i].erasesize = mtd->erasesize; if (partition_type_array[i] == TYPE_RAW) mtd->eraseregions[i].erasesize = mtd->erasesize / 2; mtd->numeraseregions++; } #endif } } else { pr_debug("Find pt or mpt\n"); if (MLC_DEVICE == TRUE) mtd->numeraseregions = 0; construct_mtd_partition(mtd); } init_pmt_done = TRUE; pr_debug(": register NAND PMT device ...\n"); #ifndef MTK_EMMC_SUPPORT err = misc_register(&pmt_dev); if (unlikely(err)) { pr_debug("PMT failed to register device!\n"); /* return err; */ } #endif }
void part_init_pmt(unsigned long totalblks,part_dev_t *dev) { #ifdef MTK_EMMC_SUPPORT part_t *part = &partition_layout[0]; unsigned long lastblk; int retval=0; int i=0; printf ("mt6577_part_init_pmt \n"); if (!totalblks) return; /* updater the number of blks of first part. */ if (totalblks <= part->blknum) part->blknum = totalblks; totalblks -= part->blknum; lastblk = part->startblk + part->blknum; while (totalblks) { part++; if (!part->name) break; if (part->flags & PART_FLAG_LEFT || totalblks <= part->blknum) part->blknum = totalblks; part->startblk = lastblk; totalblks -= part->blknum; lastblk = part->startblk + part->blknum; } memset(&pi,0xFF,sizeof(pi)); memset(&lastest_part, 0, PART_MAX_COUNT * sizeof(pt_resident)); retval = load_pt_from_fixed_addr((u8 *)&lastest_part, dev); if (retval == ERR_NO_EXIST) { //first run preloader before dowload //and valid mirror last download or first download printf("no pt \n"); get_part_tab_from_complier(); //get from complier } else { printf("Find pt \n"); for (i = 0; i < PART_MAX_COUNT; i++) { if (lastest_part[i].size == 0) { lastest_part[i].size = target_get_max_flash_size() - lastest_part[i].offset - partition_reserve_size(); printf("partition %s size %016llx %016llx \n",lastest_part[i].name,lastest_part[i].offset,lastest_part[i].size); break; } if (!strcmp((char *)lastest_part[i].name, PMT_END_NAME)) { lastest_part[i].size = target_get_max_flash_size() - lastest_part[i].offset - partition_reserve_size(); printf("partition %s size %016llx %016llx \n",lastest_part[i].name,lastest_part[i].offset,lastest_part[i].size); break; } printf ("partition %s size %016llx %016llx \n",lastest_part[i].name,lastest_part[i].offset,lastest_part[i].size); } } #else part_t *part = &partition_layout[0]; unsigned long lastblk; int retval=0; int i=0; printf ("mt6577_part_init_pmt \n"); if (!totalblks) return; /* updater the number of blks of first part. */ if (totalblks <= part->blknum) part->blknum = totalblks; totalblks -= part->blknum; if(part->type == TYPE_LOW) lastblk = part->startblk + part->blknum*2; else lastblk = part->startblk + part->blknum; while(totalblks) { part++; if (!part->name) break; if (part->flags & PART_FLAG_LEFT || totalblks <= part->blknum) part->blknum = totalblks; part->startblk = lastblk; totalblks -= part->blknum; if(part->type == TYPE_LOW) lastblk = part->startblk + part->blknum*2; else lastblk = part->startblk + part->blknum; } memset(&pi,0xFF,sizeof(pi)); memset(&lastest_part,0,PART_MAX_COUNT*sizeof(pt_resident)); retval=load_exist_part_tab((u8 *)&lastest_part,dev); if (retval==ERR_NO_EXIST) //first run preloader before dowload { //and valid mirror last download or first download printf ("no pt \n"); get_part_tab_from_complier(); //get from complier } else { printf ("Find pt \n"); for(i=0;i<PART_MAX_COUNT;i++) { //printf("%s, %x\n",lastest_part[i].name,lastest_part[i].size); if(lastest_part[i].size == 0){ lastest_part[i].size = total_size - lastest_part[i].offset; printf ("partition %s size %lx %lx \n",lastest_part[i].name,lastest_part[i].offset,lastest_part[i].size); break; } printf ("partition @ %x %s size %lx %lx \n",&lastest_part[i],lastest_part[i].name,lastest_part[i].offset,lastest_part[i].size); } } init_pmt_done = TRUE; #endif }