Commit Graph

31 Commits

Author SHA1 Message Date
Peter Jones
d230d02f99 console: Fix a typo in the EFI warning list in gnu-efi
Some versions of gnu-efi have a typo, in which "EFI_WARN_UNKNOWN_GLYPH"
is accidentally "EFI_WARN_UNKOWN_GLYPH".  Work around that, so that we
can use the not-silly one in console.c's list of error and warning
messages.

This is a backport from devel for:

  commit 5f62b22ccd636d326b3229a2b196118701c6f3f7
  Author: Peter Jones <pjones@redhat.com>
  Date:   Mon Aug 26 16:12:05 2019 -0400

Signed-off-by: Peter Jones <pjones@redhat.com>
2021-02-16 09:12:48 +01:00
Gary Lin
19a147061c lib: move print_crypto_errors() out of console.c
print_crypto_errors() will pull in the whole openssl library which
bloats the size of fallback.efi. Move the function to an independent
file (lib/print_crypto.c) to reduce the file size of fallback.efi from
1.3MB to 93KB.

Signed-off-by: Gary Lin <glin@suse.com>
2021-02-16 09:12:48 +01:00
Peter Jones
9c64b6278c Make sure MIN() and MAX() are always defined.
Signed-off-by: Peter Jones <pjones@redhat.com>
2021-02-16 09:12:48 +01:00
Peter Jones
dd4e3ac5fd SPDX: Clarify the attribution for James's lib/ code
At the time, this was explicitly contributed under the Tiano license,
even though the original code[0] is LGPLv2.1.

[0]: git://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git

Signed-off-by: Peter Jones <pjones@redhat.com>
2021-02-16 09:12:48 +01:00
Ivan Hu
55163bc82c MokManager: console mode modification for hi-dpi screen devices
There are lots of hi-dpi laptops nowadays, as doing mok enrollment, the font
is too small to see.
https://bugs.launchpad.net/ubuntu/+source/shim/+bug/1822043

This patch checks if the resolution is larger than Full HD (1920x1080) and
current console output columns and rows is in a good mode. Then swith the
console output to a better mode.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
Upstream-commit-id: cf05af6d899
2020-07-23 20:53:24 -04:00
Peter Jones
36cf41a616 Fix get_variable() usage in setup_verbosity()
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-04-05 14:49:17 -04:00
Peter Jones
41be168919 Make setup_console(-1) do GetMode() and call it from setup_verbosity()
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-04-05 14:49:17 -04:00
Hans de Goede
7faf9e86c3 console: Fix indentation
The manual merge of the "console: Do not set EFI console to textmode until
something is printed" patch has lead to a bunch of tabs being replaced
with 7 spaces. This commit fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2018-03-13 15:40:35 -04:00
Hans de Goede
1ff4a36a23 console: Do not set EFI console to textmode until something is printed
Remove the setup_console(1) calls from shim and instead make lib/console.c
make that call when necessary. This avoids shim forcing the EFI console to
switch to text-mode if nothing is printed.

This commit also modifies MokManager to work the same way for consistency,
even though MokManager will always print something.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2018-03-12 18:00:41 -04:00
Hans de Goede
42b1d8832f console: Move setup_console() definition to higher in the file
This is a preparation patch for making setup_console() private.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2018-03-12 18:00:41 -04:00
Hans de Goede
1fe31ee1b4 console: Add console_print and console_print_at helpers
This is a preparation commit for removing the setup_console(1) calls from
MokManager and shim so that we don't force the EFI console to switch to
text-mode.

This commit replaces all direct calls to Print / PrintAt with calls to
the new helpers (no functional changes) so that we can delay calling
setup_console(1) till the first Print call in a follow-up patch.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2018-03-12 18:00:41 -04:00
Peter Jones
9fdca5bbe1 Don't use uefi_call_wrapper(), ever.
I'm pretty done with typing uefi_call_wrapper() and counting arguments
every time.  Instead, just make the compiler error if we don't have
ms_abi.  Also, make it so nothing can use uefi_call_wrapper() directly.

Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
a55b4d6688 lib: Use EFI_ERROR() instead of comparing to EFI_SUCCESS everywhere.
Also consistently name our status variable "efi_status" unless there's a
good reason not to, such as already having another one of those.

Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
54f8f1f9ed Get rid of all the places we cast to (CHAR16 *[])
Lindent gets confused by these, and they're hard to read anyway.

Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
9facc22ebe Fix some "if (x < 0)" tests where x is UINTN.
Obviously, these are not correct.  Most of them are just useless; one
can be changed to a more useful test.

Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
b953468e91 Don't have tons of local guid definitions for no reason at all.
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
dc62a3c4dc Move includes around to clean the source tree up a bit.
Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12 16:21:43 -04:00
Peter Jones
97a3f6cf94 "in_protocol" is used in more than shim.o; make it not static.
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-12-19 16:52:01 -05:00
Peter Jones
96b347c200 Add a mechanism to print openssl errors
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-08-31 15:13:45 -04:00
Peter Jones
78f6b007e7 Make msleep() be a thing
Signed-off-by: Peter Jones <pjones@redhat.com>
2017-08-31 15:13:34 -04:00
Peter Jones
abe6ed8b57 More incorrect unsigned vs signed fixups from yours truly.
Woops.

Signed-off-by: Peter Jones <pjones@redhat.com>
2015-06-29 14:41:21 -04:00
Peter Jones
7bb0d6f71d Fix console_print_box*() parameters.
When we made lib build with the correct CFLAGS, it inherited
-Werror=sign-compare, and I fixed up some parameters on
console_print_box() and console_print_box_at() to avoid sign comparison
errors.

The fixups were *completely wrong*, as some behavior relies on negative
values.  So this fixes them in a completely different way, by casting
appropriately to signed types where we're doing comparisons.

Signed-off-by: Peter Jones <pjones@redhat.com>
2015-06-16 11:41:32 -04:00
Peter Jones
7fdbd9d48a Make lib/ build right with the cflags it should be using...
... but isn't.

Signed-off-by: Peter Jones <pjones@redhat.com>
2015-04-13 19:55:25 -04:00
Gary Ching-Pang Lin
361716dd4a Add nostdinc to the CFLAGS for lib
We don't need the headers from the standard include path.

Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
2014-12-11 09:48:50 -05:00
Gary Ching-Pang Lin
8bd7bad4b7 Remove the duplicate calls in lib/console.c
Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
2014-06-25 10:15:31 -04:00
Gary Ching-Pang Lin
22254e2633 MokManager: handle the error status from ReadKeyStroke
On some machines, even though the key event was signaled, ReadKeyStroke
still got EFI_NOT_READY. This commit handles the error status to avoid
console_get_keystroke from returning unexpected keys.

Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>

Conflicts:
	MokManager.c
2014-06-25 10:02:18 -04:00
Peter Jones
3c0ee51ad8 Put SHIM_VERBOSE under shim's guid, not global.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-04 13:54:35 -04:00
Peter Jones
880f9de412 Try to actually make debug printing look reasonable.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-10-04 11:51:09 -04:00
Peter Jones
fc986307fb Add ident-like blobs to shim.efi for version checking.
I feel dirty.
2013-10-03 11:11:09 -04:00
Peter Jones
4537217422 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>
2013-10-01 14:03:16 -04:00
Matthew Garrett
d359712e1b Port MokManager to Linux Foundation loader UI code
This is the first stage of porting the MokManager UI to the UI code used
by the Linux Foundation UEFI loader.
2013-09-26 11:57:59 -04:00