efi_loader: write protocol GUID in OpenProtocol
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Fri, 18 Aug 2017 15:45:16 +0000 (17:45 +0200)
committerAlexander Graf <agraf@suse.de>
Mon, 18 Sep 2017 21:53:56 +0000 (23:53 +0200)
To understand what is happening in OpenProtocol or LocateProtocol
it is necessary to know the protocol interface GUID.
Let's write a debug message.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
include/efi_loader.h
lib/efi_loader/efi_boottime.c

index 1179234..46d684f 100644 (file)
@@ -17,6 +17,7 @@
 
 int __efi_entry_check(void);
 int __efi_exit_check(void);
+const char *__efi_nesting(void);
 const char *__efi_nesting_inc(void);
 const char *__efi_nesting_dec(void);
 
@@ -51,6 +52,13 @@ const char *__efi_nesting_dec(void);
        debug("%sEFI: Return From: %s\n", __efi_nesting_dec(), #exp); \
        } while(0)
 
+/*
+ * Write GUID
+ */
+#define EFI_PRINT_GUID(txt, guid) ({ \
+       debug("%sEFI: %s %pUl\n", __efi_nesting(), txt, guid); \
+       })
+
 extern struct efi_runtime_services efi_runtime_services;
 extern struct efi_system_table systab;
 
index ea953dc..99c5a6e 100644 (file)
@@ -109,6 +109,11 @@ static const char *indent_string(int level)
        return &indent[max - level];
 }
 
+const char *__efi_nesting(void)
+{
+       return indent_string(nesting_level);
+}
+
 const char *__efi_nesting_inc(void)
 {
        return indent_string(nesting_level++);
@@ -1021,6 +1026,8 @@ static efi_status_t EFIAPI efi_locate_protocol(efi_guid_t *protocol,
        if (!protocol || !protocol_interface)
                return EFI_EXIT(EFI_INVALID_PARAMETER);
 
+       EFI_PRINT_GUID("protocol", protocol);
+
        list_for_each(lhandle, &efi_obj_list) {
                struct efi_object *efiobj;
 
@@ -1134,6 +1141,8 @@ static efi_status_t EFIAPI efi_open_protocol(
                goto out;
        }
 
+       EFI_PRINT_GUID("protocol", protocol);
+
        switch (attributes) {
        case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL:
        case EFI_OPEN_PROTOCOL_GET_PROTOCOL: