bootmode: remove build warnings
[profile/mobile/platform/kernel/u-boot-tm1.git] / property / normal_emc_mode.c
index 55b1fa1..f8694dc 100644 (file)
 
 long long load_image_time = 0;
 
+#if BOOT_NATIVE_LINUX_MODEM
+extern void sipc_addr_reset(void);
+#endif
+extern unsigned char _chkNVEcc(uint8_t * buf, uint32_t size, uint32_t checksum);
+#ifdef CONFIG_TIZEN
+#ifdef CONFIG_RAMDISK_BOOT
+extern int load_ramdisk(char *name, unsigned int base_addr, unsigned int size);
+#endif
+#endif
+
 #ifdef CONFIG_SUPPORT_TDLTE
 static boot_image_required_t const s_boot_image_tl_table[] = {
        {L"tl_fixnv1", L"tl_fixnv2", LTE_FIXNV_SIZE, LTE_FIXNV_ADDR},
@@ -76,6 +86,7 @@ static boot_image_required_t const s_boot_image_gsm_table[] = {
 };
 #endif
 
+#ifndef CONFIG_TIZEN
 #ifdef CONFIG_SUPPORT_W
 static boot_image_required_t const s_boot_image_W_table[] = {
        {L"wfixnv1", L"wfixnv2", FIXNV_SIZE, WFIXNV_ADR},
@@ -94,6 +105,7 @@ static boot_image_required_t const s_boot_image_WIFI_table[] = {
        {NULL, NULL, 0, 0}
 };
 #endif
+#endif
 
 static boot_image_required_t const s_boot_image_COMMON_table[] = {
 #if !BOOT_NATIVE_LINUX
@@ -109,7 +121,7 @@ static boot_image_required_t const s_boot_image_COMMON_table[] = {
 
 };
 
-static boot_image_required_t *const s_boot_image_table[] = {
+static boot_image_required_t const *s_boot_image_table[] = {
 #ifdef CONFIG_SUPPORT_TDLTE
        s_boot_image_tl_table,
 #endif
@@ -160,7 +172,7 @@ int read_logoimg(char *bmp_img, size_t size)
                return -1;
        }
        if (!get_partition_info_by_name(p_block_dev, L"logo", &info)) {
-               if (TRUE != Emmc_Read(PARTITION_USER, info.start, size / EMMC_SECTOR_SIZE, bmp_img)) {
+               if (TRUE != Emmc_Read(PARTITION_USER, info.start, size / EMMC_SECTOR_SIZE, (uint8 *)bmp_img)) {
                        debugf("function: %s nand read error\n", __FUNCTION__);
                        return -1;
                }
@@ -224,7 +236,7 @@ LOCAL __inline char *w2c(wchar_t * wchar)
 {
        static char buf[72] = { 0 };
        unsigned int i = 0;
-       while ((NULL != wchar[i]) && (i < 72)) {
+       while ((!wchar[i]) && (i < 72)) {
                buf[i] = wchar[i] & 0xFF;
                i++;
        }
@@ -233,6 +245,7 @@ LOCAL __inline char *w2c(wchar_t * wchar)
        return buf;
 }
 
+#if 0
 LOCAL void _boot_secure_check(void)
 {
 #ifdef CONFIG_SECURE_BOOT
@@ -267,6 +280,7 @@ LOCAL void _boot_secure_check(void)
 #endif
        return;
 }
+#endif
 
 /**
        Function for reading user partition.
@@ -291,13 +305,13 @@ PUBLIC int _boot_partition_read(block_dev_desc_t * dev, wchar_t * partition_name
                goto end;
        }
 
-       if (TRUE != Emmc_Read(PARTITION_USER, info.start + offsetsector, nsct, buf))
+       if (TRUE != Emmc_Read(PARTITION_USER, info.start + offsetsector, nsct, (uint8 *)buf))
                goto end;
 
        if (left) {
                sctbuf = malloc(EMMC_SECTOR_SIZE);
                if (NULL != sctbuf) {
-                       if (TRUE == Emmc_Read(PARTITION_USER, info.start + offsetsector + nsct, 1, sctbuf)) {
+                       if (TRUE == Emmc_Read(PARTITION_USER, info.start + offsetsector + nsct, 1, (uint8 *)sctbuf)) {
                                memcpy(buf + (nsct * EMMC_SECTOR_SIZE), sctbuf, left);
                                ret = 1;
                        }
@@ -327,7 +341,7 @@ PUBLIC int blk_data_read(u32 offset, u32 size, u8 *buf)
        nsct = size / EMMC_SECTOR_SIZE;
        left = size % EMMC_SECTOR_SIZE;
 
-       if (nsct && !Emmc_Read(PARTITION_USER, start_sec, nsct, buf)) {
+       if (nsct && !Emmc_Read(PARTITION_USER, start_sec, nsct, (uint8 *)buf)) {
                debugf("Failed to read mmc\n");
                goto end;
        }
@@ -335,7 +349,7 @@ PUBLIC int blk_data_read(u32 offset, u32 size, u8 *buf)
        if (left) {
                sctbuf = malloc(EMMC_SECTOR_SIZE);
                if (sctbuf) {
-                       if (!Emmc_Read(PARTITION_USER, start_sec + nsct, 1, sctbuf)) {
+                       if (!Emmc_Read(PARTITION_USER, start_sec + nsct, 1, (uint8 *)sctbuf)) {
                                debugf("Failed to read mmc\n");
                                goto end;
                        }
@@ -418,7 +432,7 @@ LOCAL __inline int _boot_read_partition_with_backup(block_dev_desc_t * dev, boot
        nv_header_t *header_p = NULL;
        uint32 bufsize = info.size + EMMC_SECTOR_SIZE;
 
-       header_p = header;
+       header_p = (void *)header;
        bakbuf = malloc(bufsize);
        if (NULL == bakbuf)
                return 0;
@@ -434,9 +448,9 @@ LOCAL __inline int _boot_read_partition_with_backup(block_dev_desc_t * dev, boot
                memset(header, 0, EMMC_SECTOR_SIZE);
                memcpy(header, oribuf, EMMC_SECTOR_SIZE);
                checksum = header_p->checksum;
-               debugf("_boot_read_partition_with_backup origin checksum 0x%x\n", checksum);
+               debugf("_boot_read_partition_with_backup origin checksum 0x%lx\n", checksum);
                if (_chkNVEcc(oribuf + EMMC_SECTOR_SIZE, info.size, checksum)) {
-                       memcpy(info.mem_addr, oribuf + EMMC_SECTOR_SIZE, info.size);
+                       memcpy((void *)info.mem_addr, oribuf + EMMC_SECTOR_SIZE, info.size);
                        status += 1;
                }
        }
@@ -444,7 +458,7 @@ LOCAL __inline int _boot_read_partition_with_backup(block_dev_desc_t * dev, boot
                memset(header, 0, EMMC_SECTOR_SIZE);
                memcpy(header, bakbuf, EMMC_SECTOR_SIZE);
                checksum = header_p->checksum;
-               debugf("_boot_read_partition_with_backup backup checksum 0x%x\n", checksum);
+               debugf("_boot_read_partition_with_backup backup checksum 0x%lx\n", checksum);
                if (_chkNVEcc(bakbuf + EMMC_SECTOR_SIZE, info.size, checksum))
                        status += 1 << 1;
        }
@@ -452,7 +466,7 @@ LOCAL __inline int _boot_read_partition_with_backup(block_dev_desc_t * dev, boot
        switch (status) {
        case 0:
                debugf("%s:(%s)both org and bak partition are damaged!\n", __FUNCTION__, w2c(info.partition));
-       memset(info.mem_addr, 0, info.size);
+               memset((void *)info.mem_addr, 0, info.size);
                free(bakbuf);
                free(oribuf);
                return 0;
@@ -462,7 +476,7 @@ LOCAL __inline int _boot_read_partition_with_backup(block_dev_desc_t * dev, boot
                break;
        case 2:
                debugf("%s:(%s)org partition is damaged!\n!", __FUNCTION__, w2c(info.partition));
-               memcpy(info.mem_addr, bakbuf + EMMC_SECTOR_SIZE, info.size);
+               memcpy((void *)info.mem_addr, bakbuf + EMMC_SECTOR_SIZE, info.size);
                _boot_partition_write(dev, info.partition, info.size + EMMC_SECTOR_SIZE, bakbuf);
                break;
        case 3:
@@ -485,9 +499,11 @@ LOCAL __inline int _boot_read_partition_with_backup(block_dev_desc_t * dev, boot
 //LOCAL __inline
 int _boot_load_required_image(block_dev_desc_t * dev, boot_image_required_t img_info)
 {
+#ifdef CONFIG_SECURE_BOOT
        uint32 secure_boot_offset = 0;
+#endif
 
-       debugf("%s: load %s to addr 0x%08x\n", __FUNCTION__, w2c(img_info.partition), img_info.mem_addr);
+       debugf("%s: load %s to addr 0x%08lx\n", __FUNCTION__, w2c(img_info.partition), img_info.mem_addr);
 
        if (NULL != img_info.bak_partition) {
                _boot_read_partition_with_backup(dev, img_info);
@@ -518,7 +534,6 @@ LOCAL int _boot_load_kernel_ramdisk_image(block_dev_desc_t * dev, char *bootmode
        wchar_t *partition = NULL;
        uint32 size, offset;
        uint32 dt_img_adr;
-       uint32 secure_boot_offset = 0;
        disk_partition_t info;
 
        if (0 == memcmp(bootmode, RECOVERY_PART, strlen(RECOVERY_PART))) {
@@ -537,7 +552,7 @@ LOCAL int _boot_load_kernel_ramdisk_image(block_dev_desc_t * dev, char *bootmode
 
        offset = info.start * info.blksz;
 
-       if (!blk_data_read(offset, sizeof(*hdr), hdr)) {
+       if (!blk_data_read(offset, sizeof(*hdr), (u8 *)hdr)) {
                debugf("%s:%s read error!\n", __FUNCTION__, w2c(partition));
                return 0;
        }
@@ -554,17 +569,16 @@ LOCAL int _boot_load_kernel_ramdisk_image(block_dev_desc_t * dev, char *bootmode
                roundup(hdr->kernel_size, ALIGN_SIZE) +
                roundup(hdr->dt_size, ALIGN_SIZE);
 
-       debugf("bzImage size: %x\n", size);
+       debugf("bzImage size: %lx\n", size);
 
-       if (!blk_data_read(offset, size, KERNEL_ADR - roundup(sizeof(*hdr), ALIGN_SIZE))) {
+       if (!blk_data_read(offset, size, (u8 *)(KERNEL_ADR - roundup(sizeof(*hdr), ALIGN_SIZE)))) {
                debugf("%s:%s kernel read error!\n", __FUNCTION__, w2c(partition));
                return 0;
        }
 
        //read dt image
        dt_img_adr = KERNEL_ADR + roundup(hdr->kernel_size, ALIGN_SIZE);
-       debugf("dt_img_adr: %u\n", dt_img_adr);
-       debugf("dt_img_adr: %x\n", dt_img_adr);
+       debugf("dt_img_adr: %lx\n", dt_img_adr);
        if (load_dtb((int)DT_ADR, (void *)dt_img_adr)) {
                debugf("%s:dt load error!\n", __FUNCTION__);
                return 0;
@@ -625,7 +639,9 @@ void vlx_nand_boot(char *kernel_pname, char *cmdline, int backlight_set)
 {
        boot_img_hdr *hdr = (void *)raw_header;
        block_dev_desc_t *dev = NULL;
+#ifdef CONFIG_SECURE_BOOT
        wchar_t *partition = NULL;
+#endif
        int i, j;
        long long start = get_ticks();