mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-28 07:30:26 +09:00
console: Don't enable CONFIG-CONSOLE_MUX, etc. in SPL
CONFIG_CONSOLE_MUX and CONFIG_SYS_CONSOLE_IS_IN_ENV are not applicable for SPL. Update the console code to use CONFIG_IS_ENABLED(), so that these options will be inactive in SPL. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
7cbaddd4ad
commit
b026542946
@ -41,14 +41,14 @@ static int on_console(const char *name, const char *value, enum env_op op,
|
|||||||
case env_op_create:
|
case env_op_create:
|
||||||
case env_op_overwrite:
|
case env_op_overwrite:
|
||||||
|
|
||||||
#ifdef CONFIG_CONSOLE_MUX
|
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
||||||
if (iomux_doenv(console, value))
|
if (iomux_doenv(console, value))
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
/* Try assigning specified device */
|
/* Try assigning specified device */
|
||||||
if (console_assign(console, value) < 0)
|
if (console_assign(console, value) < 0)
|
||||||
return 1;
|
return 1;
|
||||||
#endif /* CONFIG_CONSOLE_MUX */
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case env_op_delete:
|
case env_op_delete:
|
||||||
@ -85,7 +85,7 @@ static int on_silent(const char *name, const char *value, enum env_op op,
|
|||||||
U_BOOT_ENV_CALLBACK(silent, on_silent);
|
U_BOOT_ENV_CALLBACK(silent, on_silent);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_CONSOLE_IS_IN_ENV
|
#if CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV)
|
||||||
/*
|
/*
|
||||||
* if overwrite_console returns 1, the stdin, stderr and stdout
|
* if overwrite_console returns 1, the stdin, stderr and stdout
|
||||||
* are switched to the serial port, else the settings in the
|
* are switched to the serial port, else the settings in the
|
||||||
@ -98,7 +98,7 @@ extern int overwrite_console(void);
|
|||||||
#define OVERWRITE_CONSOLE 0
|
#define OVERWRITE_CONSOLE 0
|
||||||
#endif /* CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE */
|
#endif /* CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE */
|
||||||
|
|
||||||
#endif /* CONFIG_SYS_CONSOLE_IS_IN_ENV */
|
#endif /* CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV) */
|
||||||
|
|
||||||
static int console_setfile(int file, struct stdio_dev * dev)
|
static int console_setfile(int file, struct stdio_dev * dev)
|
||||||
{
|
{
|
||||||
@ -145,7 +145,7 @@ static int console_setfile(int file, struct stdio_dev * dev)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_CONSOLE_MUX)
|
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
||||||
/** Console I/O multiplexing *******************************************/
|
/** Console I/O multiplexing *******************************************/
|
||||||
|
|
||||||
static struct stdio_dev *tstcdev;
|
static struct stdio_dev *tstcdev;
|
||||||
@ -265,7 +265,7 @@ static inline void console_doenv(int file, struct stdio_dev *dev)
|
|||||||
{
|
{
|
||||||
console_setfile(file, dev);
|
console_setfile(file, dev);
|
||||||
}
|
}
|
||||||
#endif /* defined(CONFIG_CONSOLE_MUX) */
|
#endif /* CONIFIG_IS_ENABLED(CONSOLE_MUX) */
|
||||||
|
|
||||||
/** U-Boot INITIAL CONSOLE-NOT COMPATIBLE FUNCTIONS *************************/
|
/** U-Boot INITIAL CONSOLE-NOT COMPATIBLE FUNCTIONS *************************/
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ int serial_printf(const char *fmt, ...)
|
|||||||
int fgetc(int file)
|
int fgetc(int file)
|
||||||
{
|
{
|
||||||
if (file < MAX_FILES) {
|
if (file < MAX_FILES) {
|
||||||
#if defined(CONFIG_CONSOLE_MUX)
|
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
||||||
/*
|
/*
|
||||||
* Effectively poll for input wherever it may be available.
|
* Effectively poll for input wherever it may be available.
|
||||||
*/
|
*/
|
||||||
@ -736,7 +736,7 @@ void stdio_print_current_devices(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_CONSOLE_IS_IN_ENV
|
#if CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV)
|
||||||
/* Called after the relocation - use desired console functions */
|
/* Called after the relocation - use desired console functions */
|
||||||
int console_init_r(void)
|
int console_init_r(void)
|
||||||
{
|
{
|
||||||
@ -745,7 +745,7 @@ int console_init_r(void)
|
|||||||
#ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
|
#ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
|
||||||
int i;
|
int i;
|
||||||
#endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
|
#endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
|
||||||
#ifdef CONFIG_CONSOLE_MUX
|
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
||||||
int iomux_err = 0;
|
int iomux_err = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -766,7 +766,7 @@ int console_init_r(void)
|
|||||||
inputdev = search_device(DEV_FLAGS_INPUT, stdinname);
|
inputdev = search_device(DEV_FLAGS_INPUT, stdinname);
|
||||||
outputdev = search_device(DEV_FLAGS_OUTPUT, stdoutname);
|
outputdev = search_device(DEV_FLAGS_OUTPUT, stdoutname);
|
||||||
errdev = search_device(DEV_FLAGS_OUTPUT, stderrname);
|
errdev = search_device(DEV_FLAGS_OUTPUT, stderrname);
|
||||||
#ifdef CONFIG_CONSOLE_MUX
|
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
||||||
iomux_err = iomux_doenv(stdin, stdinname);
|
iomux_err = iomux_doenv(stdin, stdinname);
|
||||||
iomux_err += iomux_doenv(stdout, stdoutname);
|
iomux_err += iomux_doenv(stdout, stdoutname);
|
||||||
iomux_err += iomux_doenv(stderr, stderrname);
|
iomux_err += iomux_doenv(stderr, stderrname);
|
||||||
@ -799,7 +799,7 @@ int console_init_r(void)
|
|||||||
console_doenv(stdin, inputdev);
|
console_doenv(stdin, inputdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_CONSOLE_MUX
|
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
||||||
done:
|
done:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -829,7 +829,7 @@ done:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* CONFIG_SYS_CONSOLE_IS_IN_ENV */
|
#else /* !CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV) */
|
||||||
|
|
||||||
/* Called after the relocation - use desired console functions */
|
/* Called after the relocation - use desired console functions */
|
||||||
int console_init_r(void)
|
int console_init_r(void)
|
||||||
@ -873,7 +873,7 @@ int console_init_r(void)
|
|||||||
if (outputdev != NULL) {
|
if (outputdev != NULL) {
|
||||||
console_setfile(stdout, outputdev);
|
console_setfile(stdout, outputdev);
|
||||||
console_setfile(stderr, outputdev);
|
console_setfile(stderr, outputdev);
|
||||||
#ifdef CONFIG_CONSOLE_MUX
|
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
||||||
console_devices[stdout][0] = outputdev;
|
console_devices[stdout][0] = outputdev;
|
||||||
console_devices[stderr][0] = outputdev;
|
console_devices[stderr][0] = outputdev;
|
||||||
#endif
|
#endif
|
||||||
@ -882,7 +882,7 @@ int console_init_r(void)
|
|||||||
/* Initializes input console */
|
/* Initializes input console */
|
||||||
if (inputdev != NULL) {
|
if (inputdev != NULL) {
|
||||||
console_setfile(stdin, inputdev);
|
console_setfile(stdin, inputdev);
|
||||||
#ifdef CONFIG_CONSOLE_MUX
|
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
||||||
console_devices[stdin][0] = inputdev;
|
console_devices[stdin][0] = inputdev;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -907,4 +907,4 @@ int console_init_r(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_SYS_CONSOLE_IS_IN_ENV */
|
#endif /* CONFIG_IS_ENABLED(SYS_CONSOLE_IS_IN_ENV) */
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <serial.h>
|
#include <serial.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
#ifdef CONFIG_CONSOLE_MUX
|
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
||||||
void iomux_printdevs(const int console)
|
void iomux_printdevs(const int console)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -145,4 +145,4 @@ int iomux_doenv(const int console, const char *arg)
|
|||||||
free(cons_set);
|
free(cons_set);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_CONSOLE_MUX */
|
#endif /* CONSOLE_MUX */
|
||||||
|
@ -516,7 +516,7 @@ static int probe_usb_keyboard(struct usb_device *dev)
|
|||||||
return error;
|
return error;
|
||||||
|
|
||||||
stdinname = getenv("stdin");
|
stdinname = getenv("stdin");
|
||||||
#ifdef CONFIG_CONSOLE_MUX
|
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
||||||
error = iomux_doenv(stdin, stdinname);
|
error = iomux_doenv(stdin, stdinname);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
@ -581,7 +581,7 @@ int usb_kbd_deregister(int force)
|
|||||||
data = usb_kbd_dev->privptr;
|
data = usb_kbd_dev->privptr;
|
||||||
if (stdio_deregister_dev(dev, force) != 0)
|
if (stdio_deregister_dev(dev, force) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
#ifdef CONFIG_CONSOLE_MUX
|
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
||||||
if (iomux_doenv(stdin, getenv("stdin")) != 0)
|
if (iomux_doenv(stdin, getenv("stdin")) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
@ -626,7 +626,7 @@ static int usb_kbd_remove(struct udevice *dev)
|
|||||||
ret = -EPERM;
|
ret = -EPERM;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_CONSOLE_MUX
|
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
|
||||||
if (iomux_doenv(stdin, getenv("stdin"))) {
|
if (iomux_doenv(stdin, getenv("stdin"))) {
|
||||||
ret = -ENOLINK;
|
ret = -ENOLINK;
|
||||||
goto err;
|
goto err;
|
||||||
|
Loading…
Reference in New Issue
Block a user