summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2013-09-27 11:32:49 -0400
committerPeter Jones <pjones@redhat.com>2013-10-01 14:03:16 -0400
commit09a37bbc69f6c5d6c1d081f4f938f34cff412c4f (patch)
treef2054578457ceabee0ce5ef805bafac02866dd54
parentf7b849be1c1930a59dab50cf95d315049a2f4267 (diff)
downloadefi-boot-shim-09a37bbc69f6c5d6c1d081f4f938f34cff412c4f.tar.gz
efi-boot-shim-09a37bbc69f6c5d6c1d081f4f938f34cff412c4f.zip
Make verbose stuff use console_notify
Signed-off-by: Peter Jones <pjones@redhat.com>
-rw-r--r--Makefile4
-rw-r--r--MokManager.c29
-rw-r--r--include/console_control.h (renamed from console_control.h)2
-rw-r--r--lib/Makefile2
-rw-r--r--lib/console_control.c32
-rw-r--r--shim.c16
6 files changed, 48 insertions, 37 deletions
diff --git a/Makefile b/Makefile
index 1752ef5b..40103eb3 100644
--- a/Makefile
+++ b/Makefile
@@ -38,9 +38,9 @@ VERSION = 0.4
TARGET = shim.efi MokManager.efi.signed fallback.efi.signed
OBJS = shim.o netboot.o cert.o replacements.o
KEYS = shim_cert.h ocsp.* ca.* shim.crt shim.csr shim.p12 shim.pem shim.key
-SOURCES = shim.c shim.h netboot.c include/PeImage.h include/wincert.h replacements.c replacements.h
+SOURCES = shim.c shim.h netboot.c include/PeImage.h include/wincert.h include/console.h replacements.c replacements.h include/console_control.h
MOK_OBJS = MokManager.o PasswordCrypt.o crypt_blowfish.o
-MOK_SOURCES = MokManager.c shim.h console_control.h PasswordCrypt.c PasswordCrypt.h crypt_blowfish.c crypt_blowfish.h
+MOK_SOURCES = MokManager.c shim.h include/console_control.h PasswordCrypt.c PasswordCrypt.h crypt_blowfish.c crypt_blowfish.h
FALLBACK_OBJS = fallback.o
FALLBACK_SRCS = fallback.c
diff --git a/MokManager.c b/MokManager.c
index 5e9321a5..5d86e330 100644
--- a/MokManager.c
+++ b/MokManager.c
@@ -6,7 +6,6 @@
#include "shim.h"
#include "PeImage.h"
#include "PasswordCrypt.h"
-#include "console_control.h"
#include "guid.h"
#include "console.h"
@@ -1749,34 +1748,6 @@ static EFI_STATUS check_mok_request(EFI_HANDLE image_handle)
return EFI_SUCCESS;
}
-static 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);
-}
-
static EFI_STATUS setup_rand (void)
{
EFI_TIME time;
diff --git a/console_control.h b/include/console_control.h
index 5fb8a4ae..aec6f41d 100644
--- a/console_control.h
+++ b/include/console_control.h
@@ -41,4 +41,6 @@ struct _EFI_CONSOLE_CONTROL_PROTOCOL {
EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN LockStdIn;
};
+extern VOID setup_console (int text);
+
#endif /* _SHIM_CONSOLE_CONTROL_H */
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 <efi.h>
+#include <efilib.h>
+
+#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);
+}
diff --git a/shim.c b/shim.c
index 8c4ef656..a72e0910 100644
--- a/shim.c
+++ b/shim.c
@@ -43,10 +43,12 @@
#include "replacements.h"
#include "ucs2.h"
+#include "console_control.h"
#include "guid.h"
#include "variables.h"
#include "efiauthenticated.h"
#include "security_policy.h"
+#include "console.h"
#define FALLBACK L"\\fallback.efi"
#define MOK_MANAGER L"\\MokManager.efi"
@@ -446,7 +448,7 @@ static BOOLEAN secure_mode (void)
/* FIXME - more paranoia here? */
if (status != EFI_SUCCESS || sb != 1) {
if (verbose)
- Print(L"Secure boot not enabled\n");
+ console_notify(L"Secure boot not enabled\n");
return FALSE;
}
@@ -456,7 +458,7 @@ static BOOLEAN secure_mode (void)
if (status == EFI_SUCCESS && setupmode == 1) {
if (verbose)
- Print(L"Platform is in setup mode\n");
+ console_notify(L"Platform is in setup mode\n");
return FALSE;
}
@@ -720,7 +722,7 @@ static EFI_STATUS verify_buffer (char *data, int datasize,
if (status == EFI_SUCCESS) {
if (verbose)
- Print(L"Binary is whitelisted\n");
+ console_notify(L"Binary is whitelisted\n");
return status;
}
@@ -733,7 +735,7 @@ static EFI_STATUS verify_buffer (char *data, int datasize,
SHA256_DIGEST_SIZE)) {
status = EFI_SUCCESS;
if (verbose)
- Print(L"Binary is verified by the vendor certificate\n");
+ console_notify(L"Binary is verified by the vendor certificate\n");
return status;
}
@@ -747,7 +749,7 @@ static EFI_STATUS verify_buffer (char *data, int datasize,
SHA256_DIGEST_SIZE)) {
status = EFI_SUCCESS;
if (verbose)
- Print(L"Binary is verified by the vendor certificate\n");
+ console_notify(L"Binary is verified by the vendor certificate\n");
return status;
}
@@ -1590,6 +1592,8 @@ EFI_STATUS efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *passed_systab)
*/
InitializeLib(image_handle, systab);
+ setup_console(1);
+
verbose_check_size = 1;
efi_status = get_variable(L"SHIM_VERBOSE", (void *)&verbose_check,
&verbose_check_size, global_var);
@@ -1665,5 +1669,7 @@ EFI_STATUS efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *passed_systab)
if (load_options_size > 0)
FreePool(second_stage);
+ setup_console(0);
+
return efi_status;
}