aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <JBottomley@Parallels.com>2013-01-09 09:25:53 +0000
committerJames Bottomley <JBottomley@Parallels.com>2013-01-09 09:25:53 +0000
commit0ac83f86a46e6e92a6c32d610d48d93c169727c4 (patch)
tree88519f7697a1441e7bd0048ace9a1a10eab93b9f
parentad8b51aa834db1dc3c9903e0659245c2de8c8d3e (diff)
downloadefitools-0ac83f86a46e6e92a6c32d610d48d93c169727c4.tar.gz
console, PreLoader: add console reset
The console may be ill defined, add a reset to mode 0 (which is required to be present) to fix this. Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--PreLoader.c2
-rw-r--r--include/console.h2
-rw-r--r--lib/console.c11
3 files changed, 15 insertions, 0 deletions
diff --git a/PreLoader.c b/PreLoader.c
index 123d4b9..7813f48 100644
--- a/PreLoader.c
+++ b/PreLoader.c
@@ -25,6 +25,8 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
InitializeLib(image, systab);
+ console_reset();
+
status = security_policy_install();
if (status != EFI_SUCCESS) {
console_error(L"Failed to install override security policy",
diff --git a/include/console.h b/include/console.h
index ac05ee3..4f720d3 100644
--- a/include/console.h
+++ b/include/console.h
@@ -14,4 +14,6 @@ void
console_error(CHAR16 *err, EFI_STATUS);
void
console_alertbox(CHAR16 **title);
+int
+console_reset(void);
#define NOSEL 0x7fffffff
diff --git a/lib/console.c b/lib/console.c
index 93b22c0..a9bb32b 100644
--- a/lib/console.c
+++ b/lib/console.c
@@ -373,3 +373,14 @@ console_error(CHAR16 *err, EFI_STATUS status)
console_alertbox(err_arr);
}
+
+int
+console_reset(void)
+{
+ SIMPLE_TEXT_OUTPUT_INTERFACE *co = ST->ConOut;
+
+ uefi_call_wrapper(co->Reset, 2, co, TRUE);
+ /* set mode 0 - required to be 80x25 */
+ uefi_call_wrapper(co->SetMode, 2, co, 0);
+ uefi_call_wrapper(co->ClearScreen, 1, co);
+}