From 3a763d560a9c390fbe2c2d4463ecc4c980f7d854 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Wed, 3 Jan 2018 11:31:56 +0900 Subject: [PATCH] bootmode: remove build warnings Remove build warnings from bootmode. Change-Id: Ic52a8049c760fe0888b20315865a7eea9e9b1845 Signed-off-by: Seung-Woo Kim --- property/alarm_mode.c | 2 ++ property/android_boot.c | 1 - property/autodloader_mode.c | 3 -- property/backupnvitem.c | 20 ++++++------ property/calibration_detect.c | 27 ++++++++-------- property/calibration_mode.c | 2 +- property/cmd_cboot.c | 20 ++++++++++-- property/dev_tree.c | 1 + property/fastboot_mode.c | 2 +- property/fs_common_rw.c | 13 +++++--- property/modem_entry.c | 4 +-- property/normal_emc_mode.c | 56 ++++++++++++++++++++++------------ property/normal_mode.c | 71 +++++++++++++++++++++++++++++-------------- property/reboot_mode.c | 4 +++ property/recv_mode.c | 4 +++ 15 files changed, 149 insertions(+), 81 deletions(-) diff --git a/property/alarm_mode.c b/property/alarm_mode.c index 5686594..d321a5d 100644 --- a/property/alarm_mode.c +++ b/property/alarm_mode.c @@ -16,6 +16,8 @@ #define msleep(a) udelay(a * 1000) #define PROD_PART "prodnv" +extern int do_fs_file_read(char *mpart, char *filenm, void *buf, int len); +extern unsigned int get_alarm_lead_set(void); extern void sprd_rtc_init(void); extern void sprd_rtc_set_alarm_sec(unsigned long secs); extern unsigned long sprd_rtc_get_alarm_sec(void); diff --git a/property/android_boot.c b/property/android_boot.c index b456809..ac9bb16 100644 --- a/property/android_boot.c +++ b/property/android_boot.c @@ -5,7 +5,6 @@ void MMU_InvalideICACHEALL(void); void creat_atags(unsigned taddr, const char *cmdline,unsigned raddr, unsigned rsize) { unsigned n = 0; - unsigned pcount; unsigned *tags = (unsigned *)taddr; //ATAG_CORE diff --git a/property/autodloader_mode.c b/property/autodloader_mode.c index fccf28c..bba7f29 100644 --- a/property/autodloader_mode.c +++ b/property/autodloader_mode.c @@ -205,10 +205,7 @@ void autodlader_remap(void) #ifdef CONFIG_AUTODLOADER void autodloader_mode(void) { - int i = 0; printf("%s\n", __FUNCTION__); - //for(i = 0; i < 0xfffffff; i++) - //printf("hello world! \n"); //CARD_SDIO_PwrCtl(emmc_handle, FALSE); diff --git a/property/backupnvitem.c b/property/backupnvitem.c index b1ce770..e9600b4 100644 --- a/property/backupnvitem.c +++ b/property/backupnvitem.c @@ -1,4 +1,4 @@ - +#include #include #define NV_MULTI_LANG_ID (405) @@ -453,7 +453,7 @@ unsigned long XFindNVOffset(unsigned short wId, unsigned char *lpCode, unsigned if (wCurID == wId) { /* check length */ - printf("dwOffset = 0x%08x dwLength = 0x%08x bRet = %d\n", *dwOffset, *dwLength, bRet); + printf("dwOffset = 0x%08lx dwLength = 0x%08lx bRet = %lu\n", *dwOffset, *dwLength, bRet); if ((*dwOffset + *dwLength - bRet) <= dwCodeSize) return 1; else @@ -495,7 +495,7 @@ unsigned long XCheckCalibration(unsigned char *lpPhoBuf, unsigned long dwPhoSize } - printf("dwOffsetPho = 0x%08x dwLengthPho = 0x%08x\n", dwOffsetPho, dwLengthPho); + printf("dwOffsetPho = 0x%08lx dwLengthPho = 0x%08lx\n", dwOffsetPho, dwLengthPho); unsigned char *pCaliBuf = pSrcPho + dwOffsetPho; unsigned short wVerPho = *(unsigned short *)pCaliBuf; @@ -514,7 +514,7 @@ unsigned long XCheckCalibration(unsigned char *lpPhoBuf, unsigned long dwPhoSize dwPhoCaliFlag = paraPho.adc.reserved[7]; if (paraPho.adc.reserved[7] == 0) { - printf("GSM Calibration in phone is not calibrated, Reserved[7] : 0x%08X\n", dwPhoCaliFlag); + printf("GSM Calibration in phone is not calibrated, Reserved[7] : 0x%08lX\n", dwPhoCaliFlag); return 0; } @@ -748,7 +748,7 @@ unsigned long XTDCaliPreserve(unsigned char *lpCode, unsigned long dwCodeSize, /* Find calibration in file */ if (!XFindNVOffsetEx(XTD_CALI_ITEM_ID, pFileBuf, dwCodeSize, &dwOffsetFile, &dwLengthFile, 0, 1)) return ERR_NOT_FIND_PARAM_IN_FILE; - printf("dwOffsetFile = 0x%08x dwLengthFile = 0x%08x\n", dwOffsetFile, dwLengthFile); + printf("dwOffsetFile = 0x%08lx dwLengthFile = 0x%08lx\n", dwOffsetFile, dwLengthFile); unsigned short wVerFile = *(unsigned short *)(pFileBuf + dwOffsetFile); printf("wVerFile = 0x%08x\n", wVerFile); @@ -759,7 +759,7 @@ unsigned long XTDCaliPreserve(unsigned char *lpCode, unsigned long dwCodeSize, else return ERR_NOT_FIND_PARAM_IN_MODULE; } - printf("dwOffsetModu = 0x%08x dwLengthModu = 0x%08x\n", dwOffsetModu, dwLengthModu); + printf("dwOffsetModu = 0x%08lx dwLengthModu = 0x%08lx\n", dwOffsetModu, dwLengthModu); unsigned short wVerModu = *(unsigned short*)(pModuBuf + dwOffsetModu); printf("wVerModu = 0x%08x\n", wVerModu); @@ -771,7 +771,7 @@ unsigned long XTDCaliPreserve(unsigned char *lpCode, unsigned long dwCodeSize, if (XTD_CALI_VER_4 == wVerFile) { dwSizeAligned = sizeof(/*td_calibration_struct_v4::*/td_calibration_v4_T); dwSizeAligned = ((unsigned long)((dwSizeAligned + 3) / 4)) * 4; - printf("dwSizeAligned = 0x%08x dwLengthFile = 0x%08x\n", dwSizeAligned, dwLengthFile); + printf("dwSizeAligned = 0x%08lx dwLengthFile = 0x%08lx\n", dwSizeAligned, dwLengthFile); if (dwLengthFile != dwSizeAligned) return ERR_PARAM_LEN_NOT_MATCH_DEF; @@ -789,7 +789,7 @@ unsigned long XTDCaliPreserve(unsigned char *lpCode, unsigned long dwCodeSize, } else if (XTD_CALI_VER_3 == wVerFile) { dwSizeAligned = sizeof(/*td_calibration_struct_v3::*/td_calibration_v3_T); dwSizeAligned = ((unsigned long)((dwSizeAligned + 3) / 4)) * 4; - printf("dwSizeAligned = 0x%08x dwLengthFile = 0x%08x\n", dwSizeAligned, dwLengthFile); + printf("dwSizeAligned = 0x%08lx dwLengthFile = 0x%08lx\n", dwSizeAligned, dwLengthFile); if (dwLengthFile != dwSizeAligned) return ERR_PARAM_LEN_NOT_MATCH_DEF; @@ -886,12 +886,12 @@ unsigned long XPreserveNVItem(unsigned short wID, unsigned char *lpCode, unsigne return ERR_NOT_FIND_PARAM_IN_MODULE; } - printf("wID = 0x%08x dwOffsetModu = 0x%08x dwLengthModu = 0x%08x\n", wID, dwOffsetModu, dwLengthModu); + printf("wID = 0x%08x dwOffsetModu = 0x%08lx dwLengthModu = 0x%08lx\n", wID, dwOffsetModu, dwLengthModu); if (!XFindNVOffsetEx(wID, lpCode, dwCodeSize, &dwOffsetFile, &dwLengthFile, 0, 1)) return ERR_NOT_FIND_PARAM_IN_FILE; - printf("wID = 0x%08x dwOffsetFile = 0x%08x dwLengthFile = 0x%08x\n", wID, dwOffsetFile, dwLengthFile); + printf("wID = 0x%08x dwOffsetFile = 0x%08lx dwLengthFile = 0x%08lx\n", wID, dwOffsetFile, dwLengthFile); if (dwLengthModu != dwLengthFile) return ERR_PARAM_LEN_NOT_MATCH; diff --git a/property/calibration_detect.c b/property/calibration_detect.c index e5a5614..d9902b8 100644 --- a/property/calibration_detect.c +++ b/property/calibration_detect.c @@ -1,5 +1,6 @@ #include "calibration_detect.h" #include +#include static unsigned int nv_buffer[256]={0}; static int s_is_calibration_mode = 0; @@ -38,13 +39,15 @@ typedef struct tag_cali_command { unsigned char sub_cmd; } COMMAND_T; +extern int get_mode_from_gpio(void); +extern int do_fs_file_read(char *mpart, char *filenm, void *buf, int len); extern int serial_tstc(void); static unsigned long long start_time; static unsigned long long now_time; -static caliberate_device = CALIBERATE_DEVICE_NULL; +static int caliberate_device = CALIBERATE_DEVICE_NULL; static void send_caliberation_request(void) { @@ -123,14 +126,12 @@ unsigned int check_caliberate(uint8_t * buf, int len) int pctool_mode_detect_uart(void) { - int ret; int i ; unsigned int caliberate_mode; uint8_t buf[20]; int got = 0; printf("%s\n", "uart calibrate detecting"); - loff_t off = 0; send_caliberation_request(); #ifdef CONFIG_MODEM_CALIBERATE @@ -138,7 +139,7 @@ int pctool_mode_detect_uart(void) buf[i] = i + 'a'; start_time = get_timer_masked(); - printf("uart calibrate configuration start_time=%d\n", start_time); + printf("uart calibrate configuration start_time=%llu\n", start_time); while (1) { got = receive_caliberation_response(buf, sizeof(buf)); if (caliberate_device == CALIBERATE_DEVICE_UART) @@ -247,11 +248,12 @@ int check_pctool_cmd(uint8_t* buf, int len) return command; } -extern int power_button_pressed(void); static int count_ms; static unsigned long long start_time; static unsigned long long now_time; +#if 0 +extern int power_button_pressed(void); static int recheck_power_button(void) { int cnt = 0; @@ -270,6 +272,8 @@ static int recheck_power_button(void) } }while(1); } +#endif + int is_timeout(void) { @@ -307,7 +311,7 @@ void cali_usb_debug(uint8_t *buf) if(usb_trans_status) printf("func: %s line %d usb trans with error %d\n", __func__, __LINE__, usb_trans_status); ret = gs_read(buf, &count); - printf("func: %s readly read %d\n", __func__, count); + printf("func: %s readly read %d ret(%d)\n", __func__, count, ret); if(usb_trans_status) printf("func: %s line %d usb trans with error %d\n", __func__, __LINE__, usb_trans_status); for(i = 0; istatus = status; aprsp->length = CALIBERATE_CNF_LEN; - total_len = translate_packet((unsigned char*)pctool_cnf_buf,(unsigned char*)rsp_ptr,((MSG_HEAD_T*)rsp_ptr)->len); + total_len = translate_packet((char*)pctool_cnf_buf,(char*)rsp_ptr,((MSG_HEAD_T*)rsp_ptr)->len); free(rsp_ptr); return total_len; } @@ -483,8 +485,7 @@ int pctool_mode_detect(void) { int ret , command; - unsigned int caliberate_mode; - loff_t off = 0; + printf("%s\n", "uart cooperating with pc tool"); if(get_mode_from_gpio()) return pctool_mode_detect_uart(); diff --git a/property/calibration_mode.c b/property/calibration_mode.c index 0f548f0..d96d1d6 100644 --- a/property/calibration_mode.c +++ b/property/calibration_mode.c @@ -341,7 +341,7 @@ void calibration_mode(const uint8_t *pcmd, int length) //add by kenyliu in 2013 06 20 for bug 146310 if(0xE == get_adc_flag()) { - power_down_devices(); + power_down_devices(0); } //end kenyliu } diff --git a/property/cmd_cboot.c b/property/cmd_cboot.c index 663ad2d..5cff012 100644 --- a/property/cmd_cboot.c +++ b/property/cmd_cboot.c @@ -22,8 +22,20 @@ extern int power_button_pressed(void); extern int charger_connected(void); extern int alarm_triggered(void); extern int cali_file_check(void); -extern int get_mode_from_gpio(); -unsigned check_reboot_mode(void); +extern int get_mode_from_gpio(void); +extern unsigned check_reboot_mode(void); +extern int pctool_mode_detect(void); +extern unsigned int get_pwr_key_cnt(void); +#ifdef CONFIG_TIZEN +boot_mode_enum_type tizen_check_keypad(void); +#endif +#ifdef CONFIG_LCD_LOGO +extern void draw_image(int mode); +extern void lcd_display(void); +extern void MMU_DisableIDCM(void); +#endif +extern void cmd_mode_regist(CBOOT_MODE_ENTRY *array); +extern void power_down_devices(unsigned pd_cmd); //extern void CHG_LateInit(void); //extern void CHG_LowBatChg(void); @@ -163,6 +175,8 @@ boot_mode_enum_type get_mode_from_alarm_register(void){ }else{ return CMD_NONE; } + + return CMD_NONE; } // 4 get mode from charger @@ -334,7 +348,7 @@ int do_cboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) boot_mode_array[bootmode](); }else{ DBG("do_cboot: power down device\n"); - power_down_devices(); + power_down_devices(0); while(1); } diff --git a/property/dev_tree.c b/property/dev_tree.c index 059838b..a845bf3 100644 --- a/property/dev_tree.c +++ b/property/dev_tree.c @@ -26,6 +26,7 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include #include "dev_tree.h" diff --git a/property/fastboot_mode.c b/property/fastboot_mode.c index 7db647d..5932a4e 100644 --- a/property/fastboot_mode.c +++ b/property/fastboot_mode.c @@ -27,7 +27,7 @@ void fastboot_mode(void) extern void *lcd_base; extern int lcd_display_bitmap(ulong bmp_image, int x, int y); - extern lcd_display(void); + extern void lcd_display(void); extern void set_backlight(uint32_t value); extern void Dcache_CleanRegion(unsigned int addr, unsigned int length); diff --git a/property/fs_common_rw.c b/property/fs_common_rw.c index 5fb46ea..272eb22 100644 --- a/property/fs_common_rw.c +++ b/property/fs_common_rw.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -11,6 +12,10 @@ #include "../drivers/mmc/card_sdio.h" #endif +#ifdef CONFIG_FS_EXT4 +extern int ext4_read_content(int dev, wchar_t* partition_name, const char *filename, void *buf, int offset, int len); +#endif + int do_fs_file_read(char *mpart, char *filenm, void *buf, int len) { int ret=-1; @@ -107,7 +112,7 @@ int do_raw_data_read(char *part, u32 size, u32 off, char *buf) cursct = info.start + off/EMMC_SECTOR_SIZE; //read first unaligned data if(offp) { - if(!Emmc_Read(PARTITION_USER, cursct, 1, sctbuf)) + if(!Emmc_Read(PARTITION_USER, cursct, 1, (uint8 *)sctbuf)) goto end; cursct += 1; memcpy(bufwp,sctbuf+offp,len); @@ -115,14 +120,14 @@ int do_raw_data_read(char *part, u32 size, u32 off, char *buf) } //read sector aligned data if(nsct) { - if(!Emmc_Read(PARTITION_USER, cursct, nsct, bufwp)) + if(!Emmc_Read(PARTITION_USER, cursct, nsct, (uint8 *)bufwp)) goto end; cursct += nsct; bufwp += size-left; } //read last unaligned data if(left) { - if(!Emmc_Read(PARTITION_USER, cursct, 1, sctbuf)) + if(!Emmc_Read(PARTITION_USER, cursct, 1, (uint8 *)sctbuf)) goto end; memcpy(bufwp,sctbuf,left); bufwp += left; @@ -248,9 +253,9 @@ try_ubi: } ret = 0; ubi_close_volume(vol); -#endif end: +#endif if (ret) printf("do_raw_data_write error.\n"); return ret; diff --git a/property/modem_entry.c b/property/modem_entry.c index 99d69cd..69ccc0a 100644 --- a/property/modem_entry.c +++ b/property/modem_entry.c @@ -16,7 +16,7 @@ void cp_adr_remap(u32 cp_kernel_exec_addr, u32 cp_zero_map_addr) memcpy( cp_zero_map_addr, data, sizeof(data)); /* copy cp0 source code */ } -void modem_entry() +void modem_entry(void) { #ifdef CONFIG_PMIC_ARM7_BOOT //arm7 boot @@ -35,7 +35,7 @@ void modem_entry() #endif //end of TDLTE_DSDA } #else //shark,9620,tshark branch -void modem_entry() +void modem_entry(void) { #if modem_cp0_enable boot_cp0(); diff --git a/property/normal_emc_mode.c b/property/normal_emc_mode.c index 55b1fa1..f8694dc 100644 --- a/property/normal_emc_mode.c +++ b/property/normal_emc_mode.c @@ -21,6 +21,16 @@ 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(); diff --git a/property/normal_mode.c b/property/normal_mode.c index f1dbf0a..90f7a2e 100644 --- a/property/normal_mode.c +++ b/property/normal_mode.c @@ -22,10 +22,10 @@ DECLARE_GLOBAL_DATA_PTR; #define FACTORY_PART "prodnv" #define CMDLINE_BUF_SIZE (1024) -unsigned spl_data_buf[0x2000] __attribute__ ((align(4))) = { +unsigned spl_data_buf[0x2000] __attribute__ ((aligned(4))) = { 0}; -unsigned harsh_data_buf[8] __attribute__ ((align(4))) = { +unsigned harsh_data_buf[8] __attribute__ ((aligned(4))) = { 0}; void *spl_data = spl_data_buf; @@ -36,7 +36,38 @@ unsigned int g_charger_mode = 0; unsigned int g_recovery_mode = 0; char serial_number_to_transfer[SP09_MAX_SN_LEN]; +void sipc_addr_reset(void); extern int charger_connected(void); +extern void power_down_devices(unsigned pd_cmd); +#if (defined CONFIG_SC8810) || (defined CONFIG_SC8825) || (defined CONFIG_SC8830) || (defined CONFIG_SC9630) +extern void MMU_DisableIDCM(void); +#endif +extern uint32_t load_lcd_id_to_kernel(void); +extern int get_dram_cs_number(void); +extern int get_dram_cs0_size(void); +extern bool is_calibration_by_uart(void); +extern unsigned int get_fgu_vol(void); +extern unsigned int get_fgu_cur(void); +extern void modem_entry(void); +#ifdef CONFIG_EMMC_BOOT +extern void Emmc_DisSdClk(void); +#endif +extern int fdt_fixup_adc_calibration_data(void *fdt); +extern int fdt_fixup_boot_ram_log(void *fdt); +extern int fdt_fixup_chosen_bootargs_board_private(void *fdt, const char *boot_mode); +extern int do_fs_file_read(char *mpart, char *filenm, void *buf, int len); +extern int do_raw_data_read(char *part, u32 size, u32 off, char *buf); +#ifdef CONFIG_TIZEN +extern uint8_t *load_mtp_offset_to_kernel(void); +extern uint8_t load_elvss_offset_to_kernel(void); +extern uint8_t *load_hbm_offset_to_kernel(void); +extern void sprdchg_start_charge(void); +extern int thor_save_env(char *str); +extern void tizen_get_emmc_serial_number(unsigned int *uid); +extern int load_nvitem(void); +extern int load_modem_data(void); +extern int load_dsp_data(void); +#endif extern void *lcd_base; #ifdef CONFIG_OF_LIBFDT @@ -108,7 +139,7 @@ unsigned char _chkNVEcc(uint8_t * buf, uint32_t size, uint32_t checksum) uint16_t crc; crc = calc_checksum(buf, size); - debugf("_chkNVEcc calcout 0x%lx, org 0x%llx\n", crc, checksum); + debugf("_chkNVEcc calcout 0x%x, org 0x%x\n", crc, checksum); return (crc == (uint16_t) checksum); } @@ -168,10 +199,9 @@ int fdt_fixup_for_tizen(void *fdt) char *ptr = buf; char *s; unsigned int val; - struct mmc *mmc; /* Tizen default cmdline: mem */ - ptr += sprintf(ptr, CMDLINE_DEFAULT_TIZEN); + ptr += sprintf(ptr, CMDLINE_DEFAULT_TIZEN " "); #ifdef CONFIG_RAMDISK_BOOT if (g_recovery_mode) @@ -188,9 +218,9 @@ int fdt_fixup_for_tizen(void *fdt) ptr += sprintf(ptr, " lcd_id=ID%06x", load_lcd_id_to_kernel()); ptr += sprintf(ptr, " lcd_base=%x", CONFIG_FB_RAM_BASE); - ptr += sprintf(ptr, " mtp_offset=%s", load_mtp_offset_to_kernel()); + ptr += sprintf(ptr, " mtp_offset=%s", (char *)load_mtp_offset_to_kernel()); ptr += sprintf(ptr, " elvss_offset=0x%x", load_elvss_offset_to_kernel()); - ptr += sprintf(ptr, " hbm_offset=%s", load_hbm_offset_to_kernel()); + ptr += sprintf(ptr, " hbm_offset=%s", (char *)load_hbm_offset_to_kernel()); ptr += sprintf(ptr, " wfixnv=0x%x,0x%x", WFIXNV_ADR, FIXNV_SIZE); ptr += sprintf(ptr, " wruntimenv=0x%x,0x%x", WRUNTIMENV_ADR, RUNTIMENV_SIZE); @@ -255,7 +285,8 @@ int fdt_fixup_for_tizen(void *fdt) s = getenv("sec_log"); if (s && (*s == 'o')) { - if (s = getenv("sec_log_addr")) { + s = getenv("sec_log_addr"); + if (s) { val = (u32) simple_strtoul(s, NULL, 16); ptr += sprintf(ptr, " sec_log=0x%x@0x%x", SEC_LOG_LENGTH, val); } @@ -305,15 +336,12 @@ int fdt_fixup_for_tizen(void *fdt) /*FDT_ADD_SIZE used to describe the size of the new bootargs items*/ /*include lcd id, lcd base, etc*/ #define FDT_ADD_SIZE (1024) -static int start_linux() +static int start_linux(void) { void (*theKernel) (int zero, int arch, u32 params); - u32 exec_at = (u32) - 1; - u32 parm_at = (u32) - 1; u32 machine_type; u8 *fdt_blob; u32 fdt_size; - boot_img_hdr *hdr = raw_header; int err; machine_type = machine_arch_type; /* get machine type */ @@ -354,8 +382,6 @@ static int start_linux() while (1); #endif /* CONFIG_TIZEN */ -//#else -// fdt_initrd_norsvmem(fdt_blob, RAMDISK_ADR, RAMDISK_ADR + hdr->ramdisk_size, 1); fdt_fixup_lcdid(fdt_blob); fdt_fixup_lcdbase(fdt_blob); fdt_fixup_calibration_parameter(fdt_blob); @@ -420,7 +446,7 @@ void lcd_display_logo(int backlight_set, ulong bmp_img, size_t size) mdelay(50); set_backlight(255); } else { - memset((unsigned int)lcd_base, 0, size); + memset(lcd_base, 0, size); #if defined(CONFIG_SC8810) || defined(CONFIG_SC8825) || defined(CONFIG_SC8830) || defined(CONFIG_SC9630) Dcache_CleanRegion((unsigned int)(lcd_base), size << 1); //Size is to large. #endif @@ -429,7 +455,7 @@ void lcd_display_logo(int backlight_set, ulong bmp_img, size_t size) #endif } -int is_factorymode() +int is_factorymode(void) { char factorymode_falg[8] = { 0 }; int ret = 0; @@ -646,25 +672,25 @@ void cmdline_set_cp_cmdline(char *buf, int str_len) nv_info = (char *)(((volatile u32 *)CALIBRATION_FLAG)); sprintf(nv_info, buf); nv_info[str_len] = '\0'; - debugf("nv_info:[%08x]%s \n", nv_info, nv_info); + debugf("nv_info:[%08lx]%s \n", (unsigned long)nv_info, nv_info); #endif #ifdef CONFIG_SUPPORT_W nv_info = (char *)((volatile u32 *)CALIBRATION_FLAG_WCDMA); sprintf(nv_info, buf); nv_info[str_len] = '\0'; - debugf("nv_info:[%08x]%s \n", nv_info, nv_info); + debugf("nv_info:[%08lx]%s \n", (unsigned long)nv_info, nv_info); #endif #ifdef CONFIG_SC9630 #ifdef CONFIG_CP0_ARM0_BOOT nv_info = (char *)(((volatile u32 *)CALIBRATION_FLAG_CP0)); sprintf(nv_info, buf); nv_info[str_len] = '\0'; - debugf("nv_info:[%08x]%s \n", nv_info, nv_info); + debugf("nv_info:[%08lx]%s \n", (unsigned long)nv_info, nv_info); #endif nv_info = (char *)(((volatile u32 *)CALIBRATION_FLAG_CP1)); sprintf(nv_info, buf); nv_info[str_len] = '\0'; - debugf("nv_info:[%08x]%s \n", nv_info, nv_info); + debugf("nv_info:[%08lx]%s \n", (unsigned long)nv_info, nv_info); #endif } @@ -672,7 +698,6 @@ int creat_cmdline(char *cmdline, boot_img_hdr * hdr) { char *buf; int offset = 0; - int ret = 0; if (cmdline == NULL) { return -1; @@ -759,7 +784,7 @@ void vlx_entry() /*down the device if charger disconnect during calibration detect. */ if (g_charger_mode && !charger_connected()) { g_charger_mode = 0; - power_down_devices(); + power_down_devices(0); while (1) ; } #if !(defined CONFIG_SC8810 || defined CONFIG_TIGER || defined CONFIG_SC8830) || (defined CONFIG_SC9630) @@ -882,7 +907,7 @@ void panic_reboot_mode(void) #if BOOT_NATIVE_LINUX_MODEM -void sipc_addr_reset() +void sipc_addr_reset(void) { #ifdef CONFIG_SC8825 memset((void *)SIPC_APCP_START_ADDR, 0x0, SIPC_APCP_RESET_ADDR_SIZE); diff --git a/property/reboot_mode.c b/property/reboot_mode.c index bca9de5..504d3eb 100644 --- a/property/reboot_mode.c +++ b/property/reboot_mode.c @@ -9,6 +9,10 @@ #include #include +extern void CHIP_PHY_ResetHWFlag(uint32 val); +extern void CHIP_PHY_SetWDGHWFlag(WDG_HW_FLAG_T type, uint32 val); +extern void CHIP_ResetMCU(void); + static void ResetMCU(void) { /* set watchdog reset flag */ diff --git a/property/recv_mode.c b/property/recv_mode.c index 47457ae..18b66cd 100644 --- a/property/recv_mode.c +++ b/property/recv_mode.c @@ -19,6 +19,8 @@ #endif #define dprintf(fmt, args...) printf(fmt, ##args) +extern void reboot_devices(unsigned reboot_mode); + void nv_patch(char * addr, int size) { int i = 0; @@ -142,6 +144,8 @@ int do_recovery(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) puts("Tizen Recovery mode\n"); recovery_mode(); + + return 0; } U_BOOT_CMD(recovery, 1, 1, do_recovery, -- 2.7.4