diff options
| author | Peter Jones <pjones@redhat.com> | 2013-10-01 13:43:25 -0400 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2013-10-01 14:03:16 -0400 |
| commit | 4537217422a4e1bf145e135d89284cf7887ad826 (patch) | |
| tree | 0ca634a9091129b2839c1a45cc3870dfd9a61d8f /lib/console.c | |
| parent | 09a37bbc69f6c5d6c1d081f4f938f34cff412c4f (diff) | |
| download | efi-boot-shim-4537217422a4e1bf145e135d89284cf7887ad826.tar.gz efi-boot-shim-4537217422a4e1bf145e135d89284cf7887ad826.zip | |
Merge console_control.h and console.h
Since these are topically the same thing, they can live together.
Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'lib/console.c')
| -rw-r--r-- | lib/console.c | 29 |
1 files changed, 29 insertions, 0 deletions
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 <James.Bottomley@HansenPartnership.com> + * Copyright 2013 Red Hat Inc. <pjones@redhat.com> * * 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); +} |
