efi_loader: expose protocols via GUID
authorRob Clark <robdclark@gmail.com>
Mon, 24 Jul 2017 14:39:01 +0000 (10:39 -0400)
committerAlexander Graf <agraf@suse.de>
Tue, 25 Jul 2017 08:58:07 +0000 (10:58 +0200)
shim.efi (or rather gnu-efi's LibLocateProtocol() which shim.efi uses)
resolves protocols via efi_locate_handle() so the console protocols
need to be added to the efi object list.

Signed-off-by: Rob Clark <robdclark@gmail.com>
[agraf: whitespace fixes]
Signed-off-by: Alexander Graf <agraf@suse.de>
include/efi_api.h
lib/efi_loader/efi_console.c

index 8f881d2903bdaa18089e64a85b99eee13a86937f..ec1b321e8e70bc1158fe6503bfaf9f0afc94bcb0 100644 (file)
@@ -349,6 +349,11 @@ struct simple_text_output_mode {
        bool cursor_visible;
 };
 
+
+#define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \
+       EFI_GUID(0x387477c2, 0x69c7, 0x11d2, \
+                0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
+
 struct efi_simple_text_output_protocol {
        void *reset;
        efi_status_t (EFIAPI *output_string)(
@@ -383,6 +388,10 @@ struct efi_input_key {
        s16 unicode_char;
 };
 
+#define EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID \
+       EFI_GUID(0x387477c1, 0x69c7, 0x11d2, \
+                0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
+
 struct efi_simple_input_interface {
        efi_status_t(EFIAPI *reset)(struct efi_simple_input_interface *this,
                        bool ExtendedVerification);
index 95e632394fa5256c17c9f0e261c0702bc3e5737d..5ebce4b544daf4a20ec996bb240830ece3e1ed8d 100644 (file)
@@ -442,10 +442,24 @@ static void EFIAPI efi_console_timer_notify(struct efi_event *event,
        EFI_EXIT(EFI_SUCCESS);
 }
 
+
+static struct efi_object efi_console_control_obj =
+       EFI_PROTOCOL_OBJECT(efi_guid_console_control, &efi_console_control);
+static struct efi_object efi_console_output_obj =
+       EFI_PROTOCOL_OBJECT(EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID, &efi_con_out);
+static struct efi_object efi_console_input_obj =
+       EFI_PROTOCOL_OBJECT(EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID, &efi_con_in);
+
 /* This gets called from do_bootefi_exec(). */
 int efi_console_register(void)
 {
        efi_status_t r;
+
+       /* Hook up to the device list */
+       list_add_tail(&efi_console_control_obj.link, &efi_obj_list);
+       list_add_tail(&efi_console_output_obj.link, &efi_obj_list);
+       list_add_tail(&efi_console_input_obj.link, &efi_obj_list);
+
        r = efi_create_event(EVT_NOTIFY_WAIT, TPL_CALLBACK,
                             efi_key_notify, NULL, &efi_con_in.wait_for_key);
        if (r != EFI_SUCCESS) {