diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Makefile | 1 | ||||
-rw-r--r-- | common/autoboot.c | 4 | ||||
-rw-r--r-- | common/board_f.c | 3 | ||||
-rw-r--r-- | common/board_r.c | 2 | ||||
-rw-r--r-- | common/cli_hush.c | 31 | ||||
-rw-r--r-- | common/dlmalloc.c | 2 | ||||
-rw-r--r-- | common/env_flags.c | 14 | ||||
-rw-r--r-- | common/image-fdt.c | 2 | ||||
-rw-r--r-- | common/image.c | 23 | ||||
-rw-r--r-- | common/kgdb_stubs.c | 2 | ||||
-rw-r--r-- | common/main.c | 14 | ||||
-rw-r--r-- | common/modem.c | 100 |
12 files changed, 53 insertions, 145 deletions
diff --git a/common/Makefile b/common/Makefile index 59984111e1..117178ad9b 100644 --- a/common/Makefile +++ b/common/Makefile @@ -82,7 +82,6 @@ obj-$(CONFIG_LCD_ROTATION) += lcd_console_rotation.o obj-$(CONFIG_LCD_DT_SIMPLEFB) += lcd_simplefb.o obj-$(CONFIG_LYNXKDI) += lynxkdi.o obj-$(CONFIG_MENU) += menu.o -obj-$(CONFIG_MODEM_SUPPORT) += modem.o obj-$(CONFIG_UPDATE_TFTP) += update.o obj-$(CONFIG_DFU_TFTP) += update.o obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o diff --git a/common/autoboot.c b/common/autoboot.c index c11fb31236..223e062740 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -287,7 +287,7 @@ static int abortboot(int bootdelay) static void process_fdt_options(const void *blob) { -#if defined(CONFIG_OF_CONTROL) +#if defined(CONFIG_OF_CONTROL) && defined(CONFIG_SYS_TEXT_BASE) ulong addr; /* Add an env variable to point to a kernel payload, if available */ @@ -299,7 +299,7 @@ static void process_fdt_options(const void *blob) addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0); if (addr) setenv_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr)); -#endif /* CONFIG_OF_CONTROL */ +#endif /* CONFIG_OF_CONTROL && CONFIG_SYS_TEXT_BASE */ } const char *bootdelay_process(void) diff --git a/common/board_f.c b/common/board_f.c index c470b5921a..a960144b02 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -162,9 +162,6 @@ static int display_text_info(void) text_base, bss_start, bss_end); #endif -#ifdef CONFIG_MODEM_SUPPORT - debug("Modem Support enabled\n"); -#endif #ifdef CONFIG_USE_IRQ debug("IRQ Stack: %08lx\n", IRQ_STACK_START); debug("FIQ Stack: %08lx\n", FIQ_STACK_START); diff --git a/common/board_r.c b/common/board_r.c index 75ee43e2d7..6c23865279 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -456,7 +456,7 @@ static int initr_dataflash(void) /* * Tell if it's OK to load the environment early in boot. * - * If CONFIG_OF_CONFIG is defined, we'll check with the FDT to see + * If CONFIG_OF_CONTROL is defined, we'll check with the FDT to see * if this is OK (defaulting to saying it's OK). * * NOTE: Loading the environment early can be a bad idea if security is diff --git a/common/cli_hush.c b/common/cli_hush.c index 2fbfdbe89a..00861e2d9e 100644 --- a/common/cli_hush.c +++ b/common/cli_hush.c @@ -974,6 +974,30 @@ static inline void setup_prompt_string(int promptmode, char **prompt_str) } #endif +#ifdef __U_BOOT__ +static int uboot_cli_readline(struct in_str *i) +{ + char *prompt; + char __maybe_unused *ps_prompt = NULL; + + if (i->promptmode == 1) + prompt = CONFIG_SYS_PROMPT; + else + prompt = CONFIG_SYS_PROMPT_HUSH_PS2; + +#ifdef CONFIG_CMDLINE_PS_SUPPORT + if (i->promptmode == 1) + ps_prompt = getenv("PS1"); + else + ps_prompt = getenv("PS2"); + if (ps_prompt) + prompt = ps_prompt; +#endif + + return cli_readline(prompt); +} +#endif + static void get_user_input(struct in_str *i) { #ifndef __U_BOOT__ @@ -1003,11 +1027,8 @@ static void get_user_input(struct in_str *i) bootretry_reset_cmd_timeout(); i->__promptme = 1; - if (i->promptmode == 1) { - n = cli_readline(CONFIG_SYS_PROMPT); - } else { - n = cli_readline(CONFIG_SYS_PROMPT_HUSH_PS2); - } + n = uboot_cli_readline(i); + #ifdef CONFIG_BOOT_RETRY_TIME if (n == -2) { puts("\nTimeout waiting for command\n"); diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 2b964d16b1..5ea37dfb6e 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -2848,7 +2848,7 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; return m; /* Otherwise, fail */ fREe(m); - return NULL; + m = NULL; } if (m == NULL) return NULL; /* propagate failure */ diff --git a/common/env_flags.c b/common/env_flags.c index 9c3aed1527..735bba5f8b 100644 --- a/common/env_flags.c +++ b/common/env_flags.c @@ -373,21 +373,21 @@ int env_flags_validate_varaccess(const char *name, int check_mask) /* * Validate the parameters to "env set" directly */ -int env_flags_validate_env_set_params(int argc, char * const argv[]) +int env_flags_validate_env_set_params(char *name, char * const val[], int count) { - if ((argc >= 3) && argv[2] != NULL) { - enum env_flags_vartype type = env_flags_get_type(argv[1]); + if ((count >= 1) && val[0] != NULL) { + enum env_flags_vartype type = env_flags_get_type(name); /* * we don't currently check types that need more than * one argument */ - if (type != env_flags_vartype_string && argc > 3) { - printf("## Error: too many parameters for setting " - "\"%s\"\n", argv[1]); + if (type != env_flags_vartype_string && count > 1) { + printf("## Error: too many parameters for setting \"%s\"\n", + name); return -1; } - return env_flags_validate_type(argv[1], argv[2]); + return env_flags_validate_type(name, val[0]); } /* ok */ return 0; diff --git a/common/image-fdt.c b/common/image-fdt.c index 5e4e5bd914..79fa65563f 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -450,7 +450,7 @@ error: * addresses of some of the devices in the device tree are compared with the * actual addresses at which U-Boot has placed them. * - * Returns 1 on success, 0 on failure. If 0 is returned, U-boot will halt the + * Returns 1 on success, 0 on failure. If 0 is returned, U-Boot will halt the * boot process. */ __weak int ft_verify_fdt(void *fdt) diff --git a/common/image.c b/common/image.c index f4a1dc8e25..1d7543dd18 100644 --- a/common/image.c +++ b/common/image.c @@ -458,24 +458,29 @@ ulong getenv_bootm_low(void) phys_size_t getenv_bootm_size(void) { - phys_size_t tmp; + phys_size_t tmp, size; + phys_addr_t start; char *s = getenv("bootm_size"); if (s) { tmp = (phys_size_t)simple_strtoull(s, NULL, 16); return tmp; } + +#if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS) + start = gd->bd->bi_dram[0].start; + size = gd->bd->bi_dram[0].size; +#else + start = gd->bd->bi_memstart; + size = gd->bd->bi_memsize; +#endif + s = getenv("bootm_low"); if (s) tmp = (phys_size_t)simple_strtoull(s, NULL, 16); else - tmp = 0; - + tmp = start; -#if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS) - return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start); -#else - return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart); -#endif + return size - (tmp - start); } phys_size_t getenv_bootm_mapsize(void) @@ -1265,7 +1270,7 @@ int boot_get_loadable(int argc, char * const argv[], bootm_headers_t *images, * @cmd_end: pointer to a ulong variable, will hold cmdline end * * boot_get_cmdline() allocates space for kernel command line below - * BOOTMAPSZ + getenv_bootm_low() address. If "bootargs" U-boot environemnt + * BOOTMAPSZ + getenv_bootm_low() address. If "bootargs" U-Boot environemnt * variable is present its contents is copied to allocated kernel * command line. * diff --git a/common/kgdb_stubs.c b/common/kgdb_stubs.c index 19b0c1824d..5278209909 100644 --- a/common/kgdb_stubs.c +++ b/common/kgdb_stubs.c @@ -1,5 +1,5 @@ /* - * U-boot - stub functions for common kgdb code, + * U-Boot - stub functions for common kgdb code, * can be overridden in board specific files * * Copyright 2009 Analog Devices Inc. diff --git a/common/main.c b/common/main.c index 5a0318123b..1a2ef39cca 100644 --- a/common/main.c +++ b/common/main.c @@ -20,19 +20,6 @@ DECLARE_GLOBAL_DATA_PTR; */ __weak void show_boot_progress(int val) {} -static void modem_init(void) -{ -#ifdef CONFIG_MODEM_SUPPORT - debug("DEBUG: main_loop: gd->do_mdm_init=%lu\n", gd->do_mdm_init); - if (gd->do_mdm_init) { - char *str = getenv("mdm_cmd"); - - setenv("preboot", str); /* set or delete definition */ - mdm_init(); /* wait for modem connection */ - } -#endif /* CONFIG_MODEM_SUPPORT */ -} - static void run_preboot_environment_command(void) { #ifdef CONFIG_PREBOOT @@ -66,7 +53,6 @@ void main_loop(void) puts("upgraded by the late 2014 may break or be removed.\n"); #endif - modem_init(); #ifdef CONFIG_VERSION_VARIABLE setenv("ver", version_string); /* set version variable */ #endif /* CONFIG_VERSION_VARIABLE */ diff --git a/common/modem.c b/common/modem.c deleted file mode 100644 index 96b10648d8..0000000000 --- a/common/modem.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * (C) Copyright 2002-2009 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> - -/* 'inline' - We have to do it fast */ -static inline void mdm_readline(char *buf, int bufsiz) -{ - char c; - char *p; - int n; - - n = 0; - p = buf; - for(;;) { - c = serial_getc(); - - debug("(%c)", c); - - switch(c) { - case '\r': - break; - case '\n': - *p = '\0'; - return; - - default: - if(n++ > bufsiz) { - *p = '\0'; - return; /* sanity check */ - } - *p = c; - p++; - break; - } - } -} - -int mdm_init (void) -{ - char env_str[16]; - char *init_str; - int i; - extern void enable_putc(void); - extern int hwflow_onoff(int); - - enable_putc(); /* enable serial_putc() */ - -#ifdef CONFIG_HWFLOW - init_str = getenv("mdm_flow_control"); - if (init_str && (strcmp(init_str, "rts/cts") == 0)) - hwflow_onoff (1); - else - hwflow_onoff(-1); -#endif - - for (i = 1;;i++) { - sprintf(env_str, "mdm_init%d", i); - if ((init_str = getenv(env_str)) != NULL) { - serial_puts(init_str); - serial_puts("\n"); - for(;;) { - mdm_readline(console_buffer, CONFIG_SYS_CBSIZE); - debug("ini%d: [%s]", i, console_buffer); - - if ((strcmp(console_buffer, "OK") == 0) || - (strcmp(console_buffer, "ERROR") == 0)) { - debug("ini%d: cmd done", i); - break; - } else /* in case we are originating call ... */ - if (strncmp(console_buffer, "CONNECT", 7) == 0) { - debug("ini%d: connect", i); - return 0; - } - } - } else - break; /* no init string - stop modem init */ - - udelay(100000); - } - - udelay(100000); - - /* final stage - wait for connect */ - for(;i > 1;) { /* if 'i' > 1 - wait for connection - message from modem */ - mdm_readline(console_buffer, CONFIG_SYS_CBSIZE); - debug("ini_f: [%s]", console_buffer); - if (strncmp(console_buffer, "CONNECT", 7) == 0) { - debug("ini_f: connected"); - return 0; - } - } - - return 0; -} |