From 09a37bbc69f6c5d6c1d081f4f938f34cff412c4f Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 27 Sep 2013 11:32:49 -0400 Subject: Make verbose stuff use console_notify Signed-off-by: Peter Jones --- lib/Makefile | 2 +- lib/console_control.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 lib/console_control.c (limited to 'lib') diff --git a/lib/Makefile b/lib/Makefile index c1b9ab34..f2b9091d 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,6 +1,6 @@ TARGET = lib.a -LIBFILES = simple_file.o guid.o console.o execute.o configtable.o shell.o variables.o security_policy.o +LIBFILES = simple_file.o guid.o console.o execute.o configtable.o shell.o variables.o security_policy.o console_control.o ARCH = $(shell uname -m | sed s,i[3456789]86,ia32,) diff --git a/lib/console_control.c b/lib/console_control.c new file mode 100644 index 00000000..604a60f5 --- /dev/null +++ b/lib/console_control.c @@ -0,0 +1,32 @@ +#include +#include + +#include "console_control.h" + +VOID setup_console (int text) +{ + EFI_STATUS status; + EFI_GUID console_control_guid = EFI_CONSOLE_CONTROL_PROTOCOL_GUID; + EFI_CONSOLE_CONTROL_PROTOCOL *concon; + static EFI_CONSOLE_CONTROL_SCREEN_MODE mode = + EfiConsoleControlScreenGraphics; + EFI_CONSOLE_CONTROL_SCREEN_MODE new_mode; + + status = LibLocateProtocol(&console_control_guid, (VOID **)&concon); + if (status != EFI_SUCCESS) + return; + + if (text) { + new_mode = EfiConsoleControlScreenText; + + status = uefi_call_wrapper(concon->GetMode, 4, concon, &mode, + 0, 0); + /* If that didn't work, assume it's graphics */ + if (status != EFI_SUCCESS) + mode = EfiConsoleControlScreenGraphics; + } else { + new_mode = mode; + } + + uefi_call_wrapper(concon->SetMode, 2, concon, new_mode); +} -- cgit v1.2.3