diff options
author | Tom Rini <trini@konsulko.com> | 2024-09-18 13:07:19 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-09-18 13:07:19 -0600 |
commit | c17805e19b9335e1fb5295c81b59eddf88d1b9ec (patch) | |
tree | 0e4cbc44f392b9f2e53d1e38e107ec630c0267c9 /common/console.c | |
parent | 650883a568653f37ee4ff43beda56152b594a49c (diff) | |
parent | 017b441b2e3c879b20bcac496369f1213c4bdbcd (diff) |
Merge patch series "Fix various bugs"
Simon Glass <sjg@chromium.org> says:
This series includes the patches needed to make make the EFI 'boot' test
work. That test has now been split off into a separate series along with
the EFI patches.
This series fixes these problems:
- sandbox memory-mapping conflict with PCI
- the fix for that causes the mbr test to crash as it sets up pointers
instead of addresses for its 'mmc' commands
- the mmc and read commands which cast addresses to pointers
- a tricky bug to do with USB keyboard and stdio
- a few other minor things
Diffstat (limited to 'common/console.c')
-rw-r--r-- | common/console.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/common/console.c b/common/console.c index 52d6df8150f..c9e206aec41 100644 --- a/common/console.c +++ b/common/console.c @@ -4,6 +4,8 @@ * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it */ +#define LOG_CATEGORY LOGC_CONSOLE + #include <console.h> #include <debug_uart.h> #include <display_options.h> @@ -1242,3 +1244,37 @@ int console_init_r(void) } #endif /* CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV) */ + +int console_remove_by_name(const char *name) +{ + int err = 0; + +#if CONFIG_IS_ENABLED(CONSOLE_MUX) + int fnum; + + log_debug("removing console device %s\n", name); + for (fnum = 0; fnum < MAX_FILES; fnum++) { + struct stdio_dev **src, **dest; + int i; + + log_debug("file %d: %d devices: ", fnum, cd_count[fnum]); + src = console_devices[fnum]; + dest = src; + for (i = 0; i < cd_count[fnum]; i++, src++) { + struct stdio_dev *sdev = *src; + int ret = 0; + + if (!strcmp(sdev->name, name)) + ret = stdio_deregister_dev(sdev, true); + else + *dest++ = *src; + if (ret && !err) + err = ret; + } + cd_count[fnum] = dest - console_devices[fnum]; + log_debug("now %d\n", cd_count[fnum]); + } +#endif /* CONSOLE_MUX */ + + return err; +} |