summaryrefslogtreecommitdiffstats
path: root/drivers/serial/efi-stdio.h
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2019-10-21 11:23:41 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-10-23 09:00:23 +0200
commit438f80e986586ddb1288caac4b9e1b0e6498e0cc (patch)
tree746ea64b4e02d0c30cf4ba40125a372d63e998b4 /drivers/serial/efi-stdio.h
parenta3b0c7f17290d86e261bd35211e8f322ac97e749 (diff)
downloadbarebox-438f80e986586ddb1288caac4b9e1b0e6498e0cc.tar.gz
barebox-438f80e986586ddb1288caac4b9e1b0e6498e0cc.tar.xz
serial: efi-stdio: Add simple_text_input_ex_protocol backend
EFI implementations differ in how simple_text_input_protocol treats ctrl+alpha combinations. OVMF (used with QEMU) returns a Unicode control character, the UEFI on the Dell Latitude 7490 on the other hand ignores the ctrl completely and returns just the letter rendering utilities like barebox edit unusable. To fix this, the simple_text_input_ex_protocol can be leveraged as it additionally provides the state of modifier keys. Extend efi-stdio to use it where possible. Cc: Michael Olbrich <mol@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/serial/efi-stdio.h')
-rw-r--r--drivers/serial/efi-stdio.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/drivers/serial/efi-stdio.h b/drivers/serial/efi-stdio.h
new file mode 100644
index 0000000000..1fa417c706
--- /dev/null
+++ b/drivers/serial/efi-stdio.h
@@ -0,0 +1,58 @@
+#ifndef EFI_STDIO_H_
+#define EFI_STDIO_H_
+
+#include <efi.h>
+
+struct efi_simple_text_input_ex_protocol;
+
+typedef efi_status_t (EFIAPI *efi_input_reset_ex)(
+ struct efi_simple_text_input_ex_protocol *this,
+ efi_bool_t extended_verification
+);
+
+struct efi_key_state {
+ u32 shift_state;
+ u8 toggle_state;
+};
+
+struct efi_key_data {
+ struct efi_input_key key;
+ struct efi_key_state state;
+};
+
+typedef efi_status_t (EFIAPI *efi_input_read_key_ex)(
+ struct efi_simple_text_input_ex_protocol *this,
+ struct efi_key_data *keydata
+);
+
+typedef efi_status_t (EFIAPI *efi_set_state)(
+ struct efi_simple_text_input_ex_protocol *this,
+ u8 *key_toggle_state
+);
+
+typedef efi_status_t (EFIAPI *efi_key_notify_function)(
+ struct efi_key_data *keydata
+);
+
+typedef efi_status_t (EFIAPI *efi_register_keystroke_notify)(
+ struct efi_simple_text_input_ex_protocol *this,
+ struct efi_key_data keydata,
+ efi_key_notify_function key_notification_function,
+ void **notify_handle
+);
+
+typedef efi_status_t (EFIAPI *efi_unregister_keystroke_notify)(
+ struct efi_simple_text_input_ex_protocol *this,
+ void *notification_handle
+);
+
+struct efi_simple_text_input_ex_protocol {
+ efi_input_reset_ex reset;
+ efi_input_read_key_ex read_key_stroke_ex;
+ void *wait_for_key_ex;
+ efi_set_state set_state;
+ efi_register_keystroke_notify register_key_notify;
+ efi_unregister_keystroke_notify unregister_key_notify;
+};
+
+#endif