From 8021296a71aa38b65c8568207d30127d635aba6b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 27 Sep 2020 18:46:13 -0600 Subject: log: Add missing category names Add some category names that were missed in recent changes. Update the comment as a reminder. Signed-off-by: Simon Glass --- common/log.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'common') diff --git a/common/log.c b/common/log.c index 1b10f6f180a..b7a6ebe2987 100644 --- a/common/log.c +++ b/common/log.c @@ -21,6 +21,11 @@ static const char *log_cat_name[LOGC_COUNT - LOGC_NONE] = { "driver-model", "device-tree", "efi", + "alloc", + "sandbox", + "bloblist", + "devres", + "acpi", }; static const char *log_level_name[LOGL_COUNT] = { -- cgit v1.2.3 From 4a08fae1963e18d4c7d030ceade3c6c966f873ad Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 27 Sep 2020 18:46:18 -0600 Subject: bloblist: Place on a 4KB boundary It is much easier to read the bloblist addresses if it starts on a 4KB boundary. Update it to align it accordingly. Signed-off-by: Simon Glass --- common/board_f.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/board_f.c b/common/board_f.c index 62473abf793..e99277d7e88 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -573,7 +573,9 @@ static int reserve_stacks(void) static int reserve_bloblist(void) { #ifdef CONFIG_BLOBLIST - gd->start_addr_sp = reserve_stack_aligned(CONFIG_BLOBLIST_SIZE); + /* Align to a 4KB boundary for easier reading of addresses */ + gd->start_addr_sp = ALIGN_DOWN(gd->start_addr_sp - CONFIG_BLOBLIST_SIZE, + 0x1000); gd->new_bloblist = map_sysmem(gd->start_addr_sp, CONFIG_BLOBLIST_SIZE); #endif -- cgit v1.2.3 From 5630d2fbc50f3035e3234315fb1ebed198d3292d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 27 Sep 2020 18:46:22 -0600 Subject: board: Show memory for frame buffers When debugging is enabled, show the memory allocated to video frame buffers. Signed-off-by: Simon Glass --- common/board_f.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'common') diff --git a/common/board_f.c b/common/board_f.c index e99277d7e88..9f441c44f17 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -392,6 +392,8 @@ static int reserve_video(void) ret = video_reserve(&addr); if (ret) return ret; + debug("Reserving %luk for video at: %08lx\n", + (unsigned long)gd->relocaddr - addr, addr); gd->relocaddr = addr; #elif defined(CONFIG_LCD) # ifdef CONFIG_FB_ADDR -- cgit v1.2.3 From 2dfdd0c4de48d261a72905a61704d4919587e45b Mon Sep 17 00:00:00 2001 From: Ovidiu Panait Date: Fri, 25 Sep 2020 21:12:56 +0300 Subject: Kconfig: Use hex values for CONFIG_{SPL,TPL}_SIZE_LIMIT CONFIG_{SPL,TPL}_SIZE_LIMIT are defined as hex (SPL_SIZE_LIMIT was converted in b51882d0 ("spl: Convert CONFIG_SPL_SIZE_LIMIT to hex"), but there are still places that reference integer values. Change those to hex as well. Also, update the Makefile to check for 0x0 instead of 0. This also fixes the following build error when CONFIG_SPL_SIZE_LIMIT is set by menuconfig to 0x0: ... spl/u-boot-spl.bin exceeds file size limit: limit: 0 bytes actual: 0x80f0 bytes excess: 0x80f0 bytes Signed-off-by: Ovidiu Panait Reviewed-by: Simon Glass --- common/spl/Kconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 620ea1e8b43..af47f5ce1c2 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -37,9 +37,9 @@ config SPL_FRAMEWORK_BOARD_INIT_F config SPL_SIZE_LIMIT hex "Maximum size of SPL image" depends on SPL - default 69632 if ARCH_MX6 && !MX6_OCRAM_256KB - default 200704 if ARCH_MX6 && MX6_OCRAM_256KB - default 0 + default 0x11000 if ARCH_MX6 && !MX6_OCRAM_256KB + default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB + default 0x0 help Specifies the maximum length of the U-Boot SPL image. If this value is zero, it is ignored. @@ -1335,7 +1335,7 @@ if TPL config TPL_SIZE_LIMIT hex "Maximum size of TPL image" depends on TPL - default 0 + default 0x0 help Specifies the maximum length of the U-Boot TPL image. If this value is zero, it is ignored. -- cgit v1.2.3 From 02d41b01bd78dc863614c2919375f366abdeff40 Mon Sep 17 00:00:00 2001 From: Naoki Hayama Date: Wed, 7 Oct 2020 11:21:25 +0900 Subject: image: Add a function to modify category information Add a generic function which can check whether a category has an entry ID. Signed-off-by: Naoki Hayama Reviewed-by: Simon Glass --- common/image.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'common') diff --git a/common/image.c b/common/image.c index 645bfef1690..4fc4a0f1c4c 100644 --- a/common/image.c +++ b/common/image.c @@ -858,6 +858,24 @@ const char *genimg_get_cat_desc(enum ih_category category) return table_info[category].desc; } +/** + * genimg_cat_has_id - check whether category has entry id + * @category: category to look up (enum ih_category) + * @id: entry id to be checked + * + * This will scan the translation table trying to find the entry that matches + * the given id. + * + * @return true if category has entry id; false if not + */ +bool genimg_cat_has_id(enum ih_category category, uint id) +{ + if (get_table_entry(table_info[category].table, id)) + return true; + + return false; +} + /** * get_table_entry_name - translate entry id to long name * @table: pointer to a translation table for entries of a specific type -- cgit v1.2.3 From 898a0849536381c6a1fb8d6d8ff7d46d9f6769eb Mon Sep 17 00:00:00 2001 From: Naoki Hayama Date: Wed, 7 Oct 2020 11:22:24 +0900 Subject: cosmetic: image: Fix comments and the order of definitions Fix some comments about functions. Move genimg_get_comp_name() above genimg_get_short_name() because genimg_get_comp_name() is related to get_table_entry_name(). Signed-off-by: Naoki Hayama Reviewed-by: Simon Glass --- common/image.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'common') diff --git a/common/image.c b/common/image.c index 4fc4a0f1c4c..451fc689a89 100644 --- a/common/image.c +++ b/common/image.c @@ -801,14 +801,14 @@ static const char *unknown_msg(enum ih_category category) } /** - * get_cat_table_entry_name - translate entry id to long name + * genimg_get_cat_name - translate entry id to long name * @category: category to look up (enum ih_category) * @id: entry id to be translated * * This will scan the translation table trying to find the entry that matches * the given id. * - * @retur long entry name if translation succeeds; error string on failure + * @return long entry name if translation succeeds; error string on failure */ const char *genimg_get_cat_name(enum ih_category category, uint id) { @@ -825,14 +825,14 @@ const char *genimg_get_cat_name(enum ih_category category, uint id) } /** - * get_cat_table_entry_short_name - translate entry id to short name + * genimg_get_cat_short_name - translate entry id to short name * @category: category to look up (enum ih_category) * @id: entry id to be translated * * This will scan the translation table trying to find the entry that matches * the given id. * - * @retur short entry name if translation succeeds; error string on failure + * @return short entry name if translation succeeds; error string on failure */ const char *genimg_get_cat_short_name(enum ih_category category, uint id) { @@ -918,6 +918,12 @@ const char *genimg_get_type_name(uint8_t type) return (get_table_entry_name(uimage_type, "Unknown Image", type)); } +const char *genimg_get_comp_name(uint8_t comp) +{ + return (get_table_entry_name(uimage_comp, "Unknown Compression", + comp)); +} + static const char *genimg_get_short_name(const table_entry_t *table, int val) { table = get_table_entry(table, val); @@ -935,12 +941,6 @@ const char *genimg_get_type_short_name(uint8_t type) return genimg_get_short_name(uimage_type, type); } -const char *genimg_get_comp_name(uint8_t comp) -{ - return (get_table_entry_name(uimage_comp, "Unknown Compression", - comp)); -} - const char *genimg_get_comp_short_name(uint8_t comp) { return genimg_get_short_name(uimage_comp, comp); -- cgit v1.2.3 From 6ebe6b387f63a17cecc91fa05284b577fe0d45f1 Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Wed, 7 Oct 2020 08:06:54 +0200 Subject: common, autoboot: sync functionality with Kconfig description add back again special case: -2 autoboot with no delay and no check for abort as described in Kconfig option, see common/Kconfig help text for option BOOTDELAY. Signed-off-by: Heiko Schocher Reviewed-by: Tom Rini Reviewed-by: Simon Glass --- common/autoboot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/autoboot.c b/common/autoboot.c index 6d78716a266..74f97a05137 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -363,7 +363,8 @@ void autoboot_command(const char *s) { debug("### main_loop: bootcmd=\"%s\"\n", s ? s : ""); - if (stored_bootdelay != -1 && s && !abortboot(stored_bootdelay)) { + if (s && (stored_bootdelay == -2 || + (stored_bootdelay != -1 && !abortboot(stored_bootdelay)))) { bool lock; int prev; -- cgit v1.2.3 From 8d5d97cb28bf2ac1e0d7e4b24620c56f3fe45e6f Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 7 Oct 2020 09:36:03 +0200 Subject: cli_hush.c: remove broken sanity check This code is intended do prevent one from setting a shell variable abc by doing abc=123 if an environment variable named abc already exists. However, the check is broken, since the env_get is done before the split on =, so we look up whether an environment variable "abc=123" exists, which is obviously never the case. One could move the code to below the split on =, but instead, just remove it, saving a little .text: The check has never worked as intended (it goes all the way back to the initial git commit), and it would anyway not guard against one first setting the shell variable, then doing 'env set abc xyz'. Signed-off-by: Rasmus Villemoes --- common/cli_hush.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'common') diff --git a/common/cli_hush.c b/common/cli_hush.c index 5b1f1190743..66995c255b5 100644 --- a/common/cli_hush.c +++ b/common/cli_hush.c @@ -2170,14 +2170,6 @@ int set_local_var(const char *s, int flg_export) name=strdup(s); -#ifdef __U_BOOT__ - if (env_get(name) != NULL) { - printf ("ERROR: " - "There is a global environment variable with the same name.\n"); - free(name); - return -1; - } -#endif /* Assume when we enter this function that we are already in * NAME=VALUE format. So the first order of business is to * split 's' on the '=' into 'name' and 'value' */ -- cgit v1.2.3 From c670aeee3df9186902dba07b76bd2de0776df390 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 7 Oct 2020 18:11:48 +0200 Subject: common: rename getc() to getchar() The sandbox is built with the SDL2 library with invokes the X11 library which in turn calls getc(). But getc() in glibc is defined as int getc(FILE *) This does not match our definition. int getc(void) The sandbox crashes when called with parameter -l. Rename our library symbol getc() to getchar(). Signed-off-by: Heinrich Schuchardt Reviewed-by: Tom Rini Reviewed-by: Simon Glass --- common/autoboot.c | 10 +++++----- common/cli_readline.c | 4 ++-- common/console.c | 12 ++++++------ common/spl/spl_ymodem.c | 2 +- common/xyzModem.c | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'common') diff --git a/common/autoboot.c b/common/autoboot.c index 74f97a05137..e628baffb89 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -117,7 +117,7 @@ static int passwd_abort_sha256(uint64_t etime) return 0; } - presskey[presskey_len++] = getc(); + presskey[presskey_len++] = getchar(); /* Calculate sha256 upon each new char */ hash_block(algo_name, (const void *)presskey, @@ -189,12 +189,12 @@ static int passwd_abort_key(uint64_t etime) do { if (tstc()) { if (presskey_len < presskey_max) { - presskey[presskey_len++] = getc(); + presskey[presskey_len++] = getchar(); } else { for (i = 0; i < presskey_max - 1; i++) presskey[i] = presskey[i + 1]; - presskey[i] = getc(); + presskey[i] = getchar(); } } @@ -257,7 +257,7 @@ static int abortboot_single_key(int bootdelay) * Check if key already pressed */ if (tstc()) { /* we got a key press */ - (void) getc(); /* consume input */ + getchar(); /* consume input */ puts("\b\b\b 0"); abort = 1; /* don't auto boot */ } @@ -272,7 +272,7 @@ static int abortboot_single_key(int bootdelay) abort = 1; /* don't auto boot */ bootdelay = 0; /* no more delay */ - key = getc(); /* consume input */ + key = getchar();/* consume input */ if (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY)) menukey = key; break; diff --git a/common/cli_readline.c b/common/cli_readline.c index 1f1e28c6d85..47b876285cc 100644 --- a/common/cli_readline.c +++ b/common/cli_readline.c @@ -68,7 +68,7 @@ static char *delete_char (char *buffer, char *p, int *colp, int *np, int plen) #define CREAD_HIST_CHAR ('!') #define getcmd_putch(ch) putc(ch) -#define getcmd_getch() getc() +#define getcmd_getch() getchar() #define getcmd_cbeep() getcmd_putch('\a') #define HIST_MAX 20 @@ -571,7 +571,7 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer, return -2; /* timed out */ WATCHDOG_RESET(); /* Trigger watchdog, if needed */ - c = getc(); + c = getchar(); /* * Special character handling diff --git a/common/console.c b/common/console.c index 8e50af1f9d2..3348436da6f 100644 --- a/common/console.c +++ b/common/console.c @@ -131,7 +131,7 @@ static int console_setfile(int file, struct stdio_dev * dev) */ switch (file) { case stdin: - gd->jt->getc = getc; + gd->jt->getc = getchar; gd->jt->tstc = tstc; break; case stdout: @@ -179,7 +179,7 @@ struct stdio_dev **console_devices[MAX_FILES]; int cd_count[MAX_FILES]; /* - * This depends on tstc() always being called before getc(). + * This depends on tstc() always being called before getchar(). * This is guaranteed to be true because this routine is called * only from fgetc() which assures it. * No attempt is made to demultiplex multiple input sources. @@ -404,7 +404,7 @@ int fprintf(int file, const char *fmt, ...) /** U-Boot INITIAL CONSOLE-COMPATIBLE FUNCTION *****************************/ -int getc(void) +int getchar(void) { #ifdef CONFIG_DISABLE_CONSOLE if (gd->flags & GD_FLG_DISABLE_CONSOLE) @@ -663,7 +663,7 @@ int ctrlc(void) { if (!ctrlc_disabled && gd->have_console) { if (tstc()) { - switch (getc()) { + switch (getchar()) { case 0x03: /* ^C - Control C */ ctrlc_was_pressed = 1; return 1; @@ -685,10 +685,10 @@ int confirm_yesno(void) /* Flush input */ while (tstc()) - getc(); + getchar(); i = 0; while (i < sizeof(str_input)) { - str_input[i] = getc(); + str_input[i] = getchar(); putc(str_input[i]); if (str_input[i] == '\r') break; diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c index 284512478f1..e979f780ad0 100644 --- a/common/spl/spl_ymodem.c +++ b/common/spl/spl_ymodem.c @@ -32,7 +32,7 @@ struct ymodem_fit_info { static int getcymodem(void) { if (tstc()) - return (getc()); + return (getchar()); return -1; } diff --git a/common/xyzModem.c b/common/xyzModem.c index 6bf2375671d..fc3459ebbaf 100644 --- a/common/xyzModem.c +++ b/common/xyzModem.c @@ -72,7 +72,7 @@ CYGACC_COMM_IF_GETC_TIMEOUT (char chan, char *c) } if (tstc ()) { - *c = getc (); + *c = getchar(); return 1; } return 0; -- cgit v1.2.3 From 87459da10219c284647a45bfffb620911168f911 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Mon, 12 Oct 2020 09:47:50 +0200 Subject: Remove default value of CONFIG_PREBOOT for CONFIG_USB_STORAGE Remove the default value "usb start" for CONFIG_USB_STORAGE as the USB storage boot initialization is correctly managed by distro boot command ('usb_boot' defined in include/config_distro_bootcmd.h already include the command 'usb start'). Fixes: 324d77998ed6 ("Define default CONFIG_PREBOOT with right config option") Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass --- common/Kconfig.boot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common') diff --git a/common/Kconfig.boot b/common/Kconfig.boot index 4191bfb34df..522f5f3d6a4 100644 --- a/common/Kconfig.boot +++ b/common/Kconfig.boot @@ -880,7 +880,7 @@ config USE_PREBOOT config PREBOOT string "preboot default value" depends on USE_PREBOOT && !USE_DEFAULT_ENV_FILE - default "usb start" if USB_KEYBOARD || USB_STORAGE + default "usb start" if USB_KEYBOARD default "" help This is the default of "preboot" environment variable. -- cgit v1.2.3