Project import generated by Copybara.
GitOrigin-RevId: 5942e8ce0253791daabb798d18c7e3690f79046f
diff --git a/common/console.c b/common/console.c
index 0b0dd76..8768b1c 100644
--- a/common/console.c
+++ b/common/console.c
@@ -1,23 +1,19 @@
-// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2000
* Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
+ *
+ * SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
-#include <console.h>
-#include <debug_uart.h>
-#include <dm.h>
#include <stdarg.h>
#include <iomux.h>
#include <malloc.h>
-#include <mapmem.h>
#include <os.h>
#include <serial.h>
#include <stdio_dev.h>
#include <exports.h>
#include <environment.h>
-#include <watchdog.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -42,14 +38,14 @@
case env_op_create:
case env_op_overwrite:
-#if CONFIG_IS_ENABLED(CONSOLE_MUX)
+#ifdef CONFIG_CONSOLE_MUX
if (iomux_doenv(console, value))
return 1;
#else
/* Try assigning specified device */
if (console_assign(console, value) < 0)
return 1;
-#endif
+#endif /* CONFIG_CONSOLE_MUX */
return 0;
case env_op_delete:
@@ -67,17 +63,20 @@
static int on_silent(const char *name, const char *value, enum env_op op,
int flags)
{
-#if !CONFIG_IS_ENABLED(SILENT_CONSOLE_UPDATE_ON_SET)
+#ifndef CONFIG_SILENT_CONSOLE_UPDATE_ON_SET
if (flags & H_INTERACTIVE)
return 0;
#endif
-#if !CONFIG_IS_ENABLED(SILENT_CONSOLE_UPDATE_ON_RELOC)
+#ifndef CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC
if ((flags & H_INTERACTIVE) == 0)
return 0;
#endif
if (value != NULL)
- gd->flags |= GD_FLG_SILENT;
+ if (!strcmp(value, "on"))
+ gd->flags |= GD_FLG_SILENT;
+ else
+ gd->flags &= ~GD_FLG_SILENT;
else
gd->flags &= ~GD_FLG_SILENT;
@@ -86,7 +85,7 @@
U_BOOT_ENV_CALLBACK(silent, on_silent);
#endif
-#if CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV)
+#ifdef CONFIG_SYS_CONSOLE_IS_IN_ENV
/*
* if overwrite_console returns 1, the stdin, stderr and stdout
* are switched to the serial port, else the settings in the
@@ -99,7 +98,7 @@
#define OVERWRITE_CONSOLE 0
#endif /* CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE */
-#endif /* CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV) */
+#endif /* CONFIG_SYS_CONSOLE_IS_IN_ENV */
static int console_setfile(int file, struct stdio_dev * dev)
{
@@ -129,13 +128,13 @@
*/
switch (file) {
case stdin:
- gd->jt->getc = getc;
- gd->jt->tstc = tstc;
+ gd->jt[XF_getc] = getc;
+ gd->jt[XF_tstc] = tstc;
break;
case stdout:
- gd->jt->putc = putc;
- gd->jt->puts = puts;
- gd->jt->printf = printf;
+ gd->jt[XF_putc] = putc;
+ gd->jt[XF_puts] = puts;
+ gd->jt[XF_printf] = printf;
break;
}
break;
@@ -146,30 +145,7 @@
return error;
}
-/**
- * console_dev_is_serial() - Check if a stdio device is a serial device
- *
- * @sdev: Device to check
- * @return true if this device is in the serial uclass (or for pre-driver-model,
- * whether it is called "serial".
- */
-static bool console_dev_is_serial(struct stdio_dev *sdev)
-{
- bool is_serial;
-
-#ifdef CONFIG_DM_SERIAL
- if (sdev->flags & DEV_FLAGS_DM) {
- struct udevice *dev = sdev->priv;
-
- is_serial = device_get_uclass_id(dev) == UCLASS_SERIAL;
- } else
-#endif
- is_serial = !strcmp(sdev->name, "serial");
-
- return is_serial;
-}
-
-#if CONFIG_IS_ENABLED(CONSOLE_MUX)
+#if defined(CONFIG_CONSOLE_MUX)
/** Console I/O multiplexing *******************************************/
static struct stdio_dev *tstcdev;
@@ -196,21 +172,20 @@
{
int i, ret;
struct stdio_dev *dev;
- int prev;
- prev = disable_ctrlc(1);
+ disable_ctrlc(1);
for (i = 0; i < cd_count[file]; i++) {
dev = console_devices[file][i];
if (dev->tstc != NULL) {
ret = dev->tstc(dev);
if (ret > 0) {
tstcdev = dev;
- disable_ctrlc(prev);
+ disable_ctrlc(0);
return ret;
}
}
}
- disable_ctrlc(prev);
+ disable_ctrlc(0);
return 0;
}
@@ -227,18 +202,6 @@
}
}
-static void console_puts_noserial(int file, const char *s)
-{
- int i;
- struct stdio_dev *dev;
-
- for (i = 0; i < cd_count[file]; i++) {
- dev = console_devices[file][i];
- if (dev->puts != NULL && !console_dev_is_serial(dev))
- dev->puts(dev, s);
- }
-}
-
static void console_puts(int file, const char *s)
{
int i;
@@ -251,6 +214,11 @@
}
}
+static inline void console_printdevs(int file)
+{
+ iomux_printdevs(file);
+}
+
static inline void console_doenv(int file, struct stdio_dev *dev)
{
iomux_doenv(file, dev->name);
@@ -271,22 +239,21 @@
stdio_devices[file]->putc(stdio_devices[file], c);
}
-static inline void console_puts_noserial(int file, const char *s)
-{
- if (!console_dev_is_serial(stdio_devices[file]))
- stdio_devices[file]->puts(stdio_devices[file], s);
-}
-
static inline void console_puts(int file, const char *s)
{
stdio_devices[file]->puts(stdio_devices[file], s);
}
+static inline void console_printdevs(int file)
+{
+ printf("%s\n", stdio_devices[file]->name);
+}
+
static inline void console_doenv(int file, struct stdio_dev *dev)
{
console_setfile(file, dev);
}
-#endif /* CONIFIG_IS_ENABLED(CONSOLE_MUX) */
+#endif /* defined(CONFIG_CONSOLE_MUX) */
/** U-Boot INITIAL CONSOLE-NOT COMPATIBLE FUNCTIONS *************************/
@@ -311,12 +278,11 @@
int fgetc(int file)
{
if (file < MAX_FILES) {
+#if defined(CONFIG_CONSOLE_MUX)
/*
* Effectively poll for input wherever it may be available.
*/
for (;;) {
- WATCHDOG_RESET();
-#if CONFIG_IS_ENABLED(CONSOLE_MUX)
/*
* Upper layer may have already called tstc() so
* check for that first.
@@ -324,10 +290,6 @@
if (tstcdev != NULL)
return console_getc(file);
console_tstc(file);
-#else
- if (console_tstc(file))
- return console_getc(file);
-#endif
#ifdef CONFIG_WATCHDOG
/*
* If the watchdog must be rate-limited then it should
@@ -336,6 +298,9 @@
udelay(1);
#endif
}
+#else
+ return console_getc(file);
+#endif
}
return -1;
@@ -392,15 +357,6 @@
if (!gd->have_console)
return 0;
-#ifdef CONFIG_CONSOLE_RECORD
- if (gd->console_in.start) {
- int ch;
-
- ch = membuff_getbyte(&gd->console_in);
- if (ch != -1)
- return 1;
- }
-#endif
if (gd->flags & GD_FLG_DEVINIT) {
/* Get from the standard input */
return fgetc(stdin);
@@ -419,12 +375,7 @@
if (!gd->have_console)
return 0;
-#ifdef CONFIG_CONSOLE_RECORD
- if (gd->console_in.start) {
- if (membuff_peekbyte(&gd->console_in) != -1)
- return 1;
- }
-#endif
+
if (gd->flags & GD_FLG_DEVINIT) {
/* Test the standard input */
return ftstc(stdin);
@@ -434,21 +385,14 @@
return serial_tstc();
}
-#define PRE_CONSOLE_FLUSHPOINT1_SERIAL 0
-#define PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL 1
-
-#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
+#ifdef CONFIG_PRE_CONSOLE_BUFFER
#define CIRC_BUF_IDX(idx) ((idx) % (unsigned long)CONFIG_PRE_CON_BUF_SZ)
static void pre_console_putc(const char c)
{
- char *buffer;
-
- buffer = map_sysmem(CONFIG_PRE_CON_BUF_ADDR, CONFIG_PRE_CON_BUF_SZ);
+ char *buffer = (char *)CONFIG_PRE_CON_BUF_ADDR;
buffer[CIRC_BUF_IDX(gd->precon_buf_idx++)] = c;
-
- unmap_sysmem(buffer);
}
static void pre_console_puts(const char *s)
@@ -457,63 +401,46 @@
pre_console_putc(*s++);
}
-static void print_pre_console_buffer(int flushpoint)
+static void print_pre_console_buffer(void)
{
- unsigned long in = 0, out = 0;
- char buf_out[CONFIG_PRE_CON_BUF_SZ + 1];
- char *buf_in;
+ unsigned long i = 0;
+ char *buffer = (char *)CONFIG_PRE_CON_BUF_ADDR;
- buf_in = map_sysmem(CONFIG_PRE_CON_BUF_ADDR, CONFIG_PRE_CON_BUF_SZ);
if (gd->precon_buf_idx > CONFIG_PRE_CON_BUF_SZ)
- in = gd->precon_buf_idx - CONFIG_PRE_CON_BUF_SZ;
+ i = gd->precon_buf_idx - CONFIG_PRE_CON_BUF_SZ;
- while (in < gd->precon_buf_idx)
- buf_out[out++] = buf_in[CIRC_BUF_IDX(in++)];
- unmap_sysmem(buf_in);
-
- buf_out[out] = 0;
-
- switch (flushpoint) {
- case PRE_CONSOLE_FLUSHPOINT1_SERIAL:
- puts(buf_out);
- break;
- case PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL:
- console_puts_noserial(stdout, buf_out);
- break;
- }
+ while (i < gd->precon_buf_idx)
+ putc(buffer[CIRC_BUF_IDX(i++)]);
}
#else
static inline void pre_console_putc(const char c) {}
static inline void pre_console_puts(const char *s) {}
-static inline void print_pre_console_buffer(int flushpoint) {}
+static inline void print_pre_console_buffer(void) {}
#endif
+
+#ifdef CONFIG_SILENT_CONSOLE
+static void print_to_buf(const char *s);
+#endif
+
+
void putc(const char c)
{
#ifdef CONFIG_SANDBOX
- /* sandbox can send characters to stdout before it has a console */
if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
os_putc(c);
return;
}
#endif
-#ifdef CONFIG_DEBUG_UART
- /* if we don't have a console yet, use the debug UART */
- if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
- printch(c);
+#ifdef CONFIG_SILENT_CONSOLE
+ char s[2];
+ s[0] = c;
+ s[1] = '\0';
+ if (gd->flags & GD_FLG_SILENT) {
+ print_to_buf(s);
return;
}
#endif
- if (!gd)
- return;
-#ifdef CONFIG_CONSOLE_RECORD
- if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start)
- membuff_putbyte(&gd->console_out, c);
-#endif
-#ifdef CONFIG_SILENT_CONSOLE
- if (gd->flags & GD_FLG_SILENT)
- return;
-#endif
#ifdef CONFIG_DISABLE_CONSOLE
if (gd->flags & GD_FLG_DISABLE_CONSOLE)
@@ -528,40 +455,110 @@
fputc(stdout, c);
} else {
/* Send directly to the handler */
- pre_console_putc(c);
serial_putc(c);
}
}
+#ifdef CONFIG_SILENT_CONSOLE
+#define PRT_BUF_SIZE 65536
+#define PRT_BUF_END (PRT_BUF_SIZE - 8)
+static int buf_p = 0;
+static char* print_buf = NULL;
+
+static void print_to_buf(const char *s)
+{
+ int len, end;
+ int i = 0;
+ if (!print_buf)
+ return;
+ if (buf_p < PRT_BUF_END) {
+ len = strlen(s);
+ end = buf_p + len;
+ if (end < PRT_BUF_END) {
+ while (buf_p < end)
+ print_buf[buf_p++] = s[i++];
+ } else {
+ end = PRT_BUF_END;
+ while (buf_p < end)
+ print_buf[buf_p++] = s[i++];
+ while (buf_p < PRT_BUF_END + 6)
+ print_buf[buf_p++] = '.';
+ print_buf[buf_p++] = '\n';
+ }
+ }
+ return;
+}
+
+void flush_print_buf(void)
+{
+ char tmp_buf[CONFIG_SYS_PBSIZE + 1];
+ int out_p = 0;
+ int left_size = buf_p;
+ if (print_buf) {
+ memset(tmp_buf, 0, CONFIG_SYS_PBSIZE + 1);
+ while (left_size > CONFIG_SYS_PBSIZE) {
+ memcpy(tmp_buf, print_buf + out_p, CONFIG_SYS_PBSIZE);
+ printf("%s", tmp_buf);
+ left_size -= CONFIG_SYS_PBSIZE;
+ out_p += CONFIG_SYS_PBSIZE;
+ memset(tmp_buf, 0, CONFIG_SYS_PBSIZE + 1);
+ }
+ if (left_size) {
+ memcpy(tmp_buf, print_buf + out_p, left_size);
+ printf("%s", tmp_buf);
+ }
+ memset(print_buf, 0, PRT_BUF_SIZE);
+ buf_p = 0;
+ }
+ return;
+}
+
+void destroy_print_buf(void)
+{
+ if (print_buf)
+ free(print_buf);
+ print_buf = NULL;
+ buf_p = 0;
+}
+
+static int do_silent(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ if (argc != 2)
+ return -1;
+ if (!strncmp(argv[1], "on", 6))
+ gd->flags |= GD_FLG_SILENT;
+ else if (!strncmp(argv[1], "off", 7))
+ gd->flags &= ~GD_FLG_SILENT;
+ else
+ return -1;
+ return 0;
+}
+
+U_BOOT_CMD(
+ silent, //command name
+ 2, //maxargs
+ 0, //repeatable
+ do_silent, //command function
+ "silent",
+ "make console silence on/off"
+);
+#endif /* CONFIG_MUTE_PRINT */
+
void puts(const char *s)
{
#ifdef CONFIG_SANDBOX
- /* sandbox can send characters to stdout before it has a console */
if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
os_puts(s);
return;
}
#endif
-#ifdef CONFIG_DEBUG_UART
- if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
- while (*s) {
- int ch = *s++;
- printch(ch);
- }
+#ifdef CONFIG_SILENT_CONSOLE
+ if (gd->flags & GD_FLG_SILENT) {
+ print_to_buf(s);
return;
}
#endif
- if (!gd)
- return;
-#ifdef CONFIG_CONSOLE_RECORD
- if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start)
- membuff_put(&gd->console_out, s, strlen(s));
-#endif
-#ifdef CONFIG_SILENT_CONSOLE
- if (gd->flags & GD_FLG_SILENT)
- return;
-#endif
#ifdef CONFIG_DISABLE_CONSOLE
if (gd->flags & GD_FLG_DISABLE_CONSOLE)
@@ -576,42 +573,60 @@
fputs(stdout, s);
} else {
/* Send directly to the handler */
- pre_console_puts(s);
serial_puts(s);
}
}
-#ifdef CONFIG_CONSOLE_RECORD
-int console_record_init(void)
+int printf(const char *fmt, ...)
{
- int ret;
+ va_list args;
+ uint i;
+ char printbuffer[CONFIG_SYS_PBSIZE];
- ret = membuff_new(&gd->console_out, CONFIG_CONSOLE_RECORD_OUT_SIZE);
- if (ret)
- return ret;
- ret = membuff_new(&gd->console_in, CONFIG_CONSOLE_RECORD_IN_SIZE);
-
- return ret;
-}
-
-void console_record_reset(void)
-{
- membuff_purge(&gd->console_out);
- membuff_purge(&gd->console_in);
-}
-
-void console_record_reset_enable(void)
-{
- console_record_reset();
- gd->flags |= GD_FLG_RECORD;
-}
+#if !defined(CONFIG_SANDBOX) && !defined(CONFIG_PRE_CONSOLE_BUFFER)
+ if (!gd->have_console)
+ return 0;
#endif
+ va_start(args, fmt);
+
+ /* For this to work, printbuffer must be larger than
+ * anything we ever want to print.
+ */
+ i = vscnprintf(printbuffer, sizeof(printbuffer), fmt, args);
+ va_end(args);
+
+ /* Print the string */
+ puts(printbuffer);
+ return i;
+}
+
+int vprintf(const char *fmt, va_list args)
+{
+ uint i;
+ char printbuffer[CONFIG_SYS_PBSIZE];
+
+#if defined(CONFIG_PRE_CONSOLE_BUFFER) && !defined(CONFIG_SANDBOX)
+ if (!gd->have_console)
+ return 0;
+#endif
+
+ /* For this to work, printbuffer must be larger than
+ * anything we ever want to print.
+ */
+ i = vscnprintf(printbuffer, sizeof(printbuffer), fmt, args);
+
+ /* Print the string */
+ puts(printbuffer);
+ return i;
+}
+
/* test if ctrl-c was pressed */
static int ctrlc_disabled = 0; /* see disable_ctrl() */
static int ctrlc_was_pressed = 0;
int ctrlc(void)
{
+#ifndef CONFIG_SANDBOX
if (!ctrlc_disabled && gd->have_console) {
if (tstc()) {
switch (getc()) {
@@ -623,6 +638,7 @@
}
}
}
+#endif
return 0;
}
@@ -674,6 +690,44 @@
ctrlc_was_pressed = 0;
}
+#ifdef CONFIG_MODEM_SUPPORT_DEBUG
+char screen[1024];
+char *cursor = screen;
+int once = 0;
+inline void dbg(const char *fmt, ...)
+{
+ va_list args;
+ uint i;
+ char printbuffer[CONFIG_SYS_PBSIZE];
+
+ if (!once) {
+ memset(screen, 0, sizeof(screen));
+ once++;
+ }
+
+ va_start(args, fmt);
+
+ /* For this to work, printbuffer must be larger than
+ * anything we ever want to print.
+ */
+ i = vsnprintf(printbuffer, sizeof(printbuffer), fmt, args);
+ va_end(args);
+
+ if ((screen + sizeof(screen) - 1 - cursor)
+ < strlen(printbuffer) + 1) {
+ memset(screen, 0, sizeof(screen));
+ cursor = screen;
+ }
+ sprintf(cursor, printbuffer);
+ cursor += strlen(printbuffer);
+
+}
+#else
+static inline void dbg(const char *fmt, ...)
+{
+}
+#endif
+
/** U-Boot INIT FUNCTIONS *************************************************/
struct stdio_dev *search_device(int flags, const char *name)
@@ -681,10 +735,6 @@
struct stdio_dev *dev;
dev = stdio_get_by_name(name);
-#ifdef CONFIG_VIDCONSOLE_AS_LCD
- if (!dev && !strcmp(name, "lcd"))
- dev = stdio_get_by_name("vidconsole");
-#endif
if (dev && (dev->flags & flags))
return dev;
@@ -720,38 +770,28 @@
return -1;
}
-static void console_update_silent(void)
-{
-#ifdef CONFIG_SILENT_CONSOLE
- if (env_get("silent") != NULL)
- gd->flags |= GD_FLG_SILENT;
- else
- gd->flags &= ~GD_FLG_SILENT;
-#endif
-}
-
-int console_announce_r(void)
-{
-#if !CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
- char buf[DISPLAY_OPTIONS_BANNER_LENGTH];
-
- display_options_get_banner(false, buf, sizeof(buf));
-
- console_puts_noserial(stdout, buf);
-#endif
-
- return 0;
-}
-
/* Called before relocation - use serial functions */
int console_init_f(void)
{
gd->have_console = 1;
- console_update_silent();
+ print_pre_console_buffer();
- print_pre_console_buffer(PRE_CONSOLE_FLUSHPOINT1_SERIAL);
+ return 0;
+}
+int console_init_m(void)
+{
+#ifdef CONFIG_SILENT_CONSOLE
+ print_buf = (char*)malloc(PRT_BUF_SIZE);
+ if (!print_buf) {
+ puts("no memory for print_buf\n");
+ } else {
+ memset(print_buf, 0, PRT_BUF_SIZE);
+ buf_p = 0;
+ //gd->flags |= GD_FLG_SILENT;
+ }
+#endif
return 0;
}
@@ -780,7 +820,7 @@
}
}
-#if CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV)
+#ifdef CONFIG_SYS_CONSOLE_IS_IN_ENV
/* Called after the relocation - use desired console functions */
int console_init_r(void)
{
@@ -789,28 +829,27 @@
#ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
int i;
#endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
-#if CONFIG_IS_ENABLED(CONSOLE_MUX)
+#ifdef CONFIG_CONSOLE_MUX
int iomux_err = 0;
#endif
-
/* set default handlers at first */
- gd->jt->getc = serial_getc;
- gd->jt->tstc = serial_tstc;
- gd->jt->putc = serial_putc;
- gd->jt->puts = serial_puts;
- gd->jt->printf = serial_printf;
+ gd->jt[XF_getc] = serial_getc;
+ gd->jt[XF_tstc] = serial_tstc;
+ gd->jt[XF_putc] = serial_putc;
+ gd->jt[XF_puts] = serial_puts;
+ gd->jt[XF_printf] = serial_printf;
/* stdin stdout and stderr are in environment */
/* scan for it */
- stdinname = env_get("stdin");
- stdoutname = env_get("stdout");
- stderrname = env_get("stderr");
+ stdinname = getenv("stdin");
+ stdoutname = getenv("stdout");
+ stderrname = getenv("stderr");
if (OVERWRITE_CONSOLE == 0) { /* if not overwritten by config switch */
inputdev = search_device(DEV_FLAGS_INPUT, stdinname);
outputdev = search_device(DEV_FLAGS_OUTPUT, stdoutname);
errdev = search_device(DEV_FLAGS_OUTPUT, stderrname);
-#if CONFIG_IS_ENABLED(CONSOLE_MUX)
+#ifdef CONFIG_CONSOLE_MUX
iomux_err = iomux_doenv(stdin, stdinname);
iomux_err += iomux_doenv(stdout, stdoutname);
iomux_err += iomux_doenv(stderr, stderrname);
@@ -843,22 +882,18 @@
console_doenv(stdin, inputdev);
}
-#if CONFIG_IS_ENABLED(CONSOLE_MUX)
+#ifdef CONFIG_CONSOLE_MUX
done:
#endif
#ifndef CONFIG_SYS_CONSOLE_INFO_QUIET
stdio_print_current_devices();
#endif /* CONFIG_SYS_CONSOLE_INFO_QUIET */
-#ifdef CONFIG_VIDCONSOLE_AS_LCD
- if (strstr(stdoutname, "lcd"))
- printf("Warning: Please change 'lcd' to 'vidconsole' in stdout/stderr environment vars\n");
-#endif
#ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
/* set the environment variables (will overwrite previous env settings) */
- for (i = 0; i < MAX_FILES; i++) {
- env_set(stdio_names[i], stdio_devices[i]->name);
+ for (i = 0; i < 3; i++) {
+ setenv(stdio_names[i], stdio_devices[i]->name);
}
#endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
@@ -869,11 +904,10 @@
if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL))
return 0;
#endif
- print_pre_console_buffer(PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL);
return 0;
}
-#else /* !CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV) */
+#else /* CONFIG_SYS_CONSOLE_IS_IN_ENV */
/* Called after the relocation - use desired console functions */
int console_init_r(void)
@@ -884,8 +918,6 @@
struct list_head *pos;
struct stdio_dev *dev;
- console_update_silent();
-
#ifdef CONFIG_SPLASH_SCREEN
/*
* suppress all output if splash screen is enabled and we have
@@ -893,7 +925,7 @@
* console to serial console in this case or suppress it if
* "silent" mode was requested.
*/
- if (env_get("splashimage") != NULL) {
+ if (getenv("splashimage") != NULL) {
if (!(gd->flags & GD_FLG_SILENT))
outputdev = search_device (DEV_FLAGS_OUTPUT, "serial");
}
@@ -917,7 +949,7 @@
if (outputdev != NULL) {
console_setfile(stdout, outputdev);
console_setfile(stderr, outputdev);
-#if CONFIG_IS_ENABLED(CONSOLE_MUX)
+#ifdef CONFIG_CONSOLE_MUX
console_devices[stdout][0] = outputdev;
console_devices[stderr][0] = outputdev;
#endif
@@ -926,7 +958,7 @@
/* Initializes input console */
if (inputdev != NULL) {
console_setfile(stdin, inputdev);
-#if CONFIG_IS_ENABLED(CONSOLE_MUX)
+#ifdef CONFIG_CONSOLE_MUX
console_devices[stdin][0] = inputdev;
#endif
}
@@ -936,8 +968,8 @@
#endif /* CONFIG_SYS_CONSOLE_INFO_QUIET */
/* Setting environment variables */
- for (i = 0; i < MAX_FILES; i++) {
- env_set(stdio_names[i], stdio_devices[i]->name);
+ for (i = 0; i < 3; i++) {
+ setenv(stdio_names[i], stdio_devices[i]->name);
}
gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */
@@ -947,8 +979,8 @@
if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL))
return 0;
#endif
- print_pre_console_buffer(PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL);
+
return 0;
}
-#endif /* CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV) */
+#endif /* CONFIG_SYS_CONSOLE_IS_IN_ENV */