summaryrefslogtreecommitdiffstats
path: root/src/interface
diff options
context:
space:
mode:
authorMichael Brown2012-03-26 18:25:08 +0200
committerMichael Brown2012-03-26 18:40:01 +0200
commite024cd39a877ea1b37b9004dbd8f33448418cb36 (patch)
tree8bc44239bc5920d06b8381edef5aa37a4784aaf3 /src/interface
parent[console] Remove unused "btext" console (diff)
downloadipxe-e024cd39a877ea1b37b9004dbd8f33448418cb36.tar.gz
ipxe-e024cd39a877ea1b37b9004dbd8f33448418cb36.tar.xz
ipxe-e024cd39a877ea1b37b9004dbd8f33448418cb36.zip
[console] Allow usage to be defined independently for each console
Add the concept of a "console usage", such as "standard output" or "debug messages". Allow usages to be associated with each console independently. For example, to send debugging output via the serial port, while preventing it from appearing on the local console: #define CONSOLE_SERIAL CONSOLE_USAGE_ALL #define CONSOLE_PCBIOS ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_DEBUG ) If no usages are explicitly specified, then a default set of usages will be applied. For example: #define CONSOLE_SERIAL will have the same affect as #define CONSOLE_SERIAL CONSOLE_USAGE_ALL Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/efi/efi_console.c8
-rw-r--r--src/interface/linux/linux_console.c9
2 files changed, 17 insertions, 0 deletions
diff --git a/src/interface/efi/efi_console.c b/src/interface/efi/efi_console.c
index 1303a4278..54b0c0804 100644
--- a/src/interface/efi/efi_console.c
+++ b/src/interface/efi/efi_console.c
@@ -23,6 +23,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/efi/efi.h>
#include <ipxe/ansiesc.h>
#include <ipxe/console.h>
+#include <config/console.h>
#define ATTR_BOLD 0x08
@@ -48,6 +49,12 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define ATTR_DEFAULT ATTR_FCOL_WHITE
+/* Set default console usage if applicable */
+#if ! ( defined ( CONSOLE_EFI ) && CONSOLE_EXPLICIT ( CONSOLE_EFI ) )
+#undef CONSOLE_EFI
+#define CONSOLE_EFI CONSOLE_USAGE_ALL
+#endif
+
/** Current character attribute */
static unsigned int efi_attr = ATTR_DEFAULT;
@@ -273,4 +280,5 @@ struct console_driver efi_console __console_driver = {
.putchar = efi_putchar,
.getchar = efi_getchar,
.iskey = efi_iskey,
+ .usage = CONSOLE_EFI,
};
diff --git a/src/interface/linux/linux_console.c b/src/interface/linux/linux_console.c
index aeb7c6618..c79e52631 100644
--- a/src/interface/linux/linux_console.c
+++ b/src/interface/linux/linux_console.c
@@ -33,6 +33,14 @@ FILE_LICENCE(GPL2_OR_LATER);
#include <linux/termios.h>
#include <asm/errno.h>
+#include <config/console.h>
+
+/* Set default console usage if applicable */
+#if ! ( defined ( CONSOLE_LINUX ) && CONSOLE_EXPLICIT ( CONSOLE_LINUX ) )
+#undef CONSOLE_LINUX
+#define CONSOLE_LINUX CONSOLE_USAGE_ALL
+#endif
+
static void linux_console_putchar(int c)
{
/* write to stdout */
@@ -79,6 +87,7 @@ struct console_driver linux_console __console_driver = {
.putchar = linux_console_putchar,
.getchar = linux_console_getchar,
.iskey = linux_console_iskey,
+ .usage = CONSOLE_LINUX,
};
static int linux_tcgetattr(int fd, struct termios *termios_p)