From 417077f8de33214b2942f5a6d8ff6af217b4f5dd Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 1 Oct 2013 14:03:16 -0400 Subject: Merge console_control.h and console.h Since these are topically the same thing, they can live together. Signed-off-by: Peter Jones --- lib/console.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'lib/console.c') diff --git a/lib/console.c b/lib/console.c index af01f035..72d64271 100644 --- a/lib/console.c +++ b/lib/console.c @@ -1,5 +1,6 @@ /* * Copyright 2012 + * Copyright 2013 Red Hat Inc. * * see COPYING file */ @@ -400,3 +401,31 @@ console_reset(void) uefi_call_wrapper(co->SetMode, 2, co, 0); uefi_call_wrapper(co->ClearScreen, 1, co); } + +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