diff mbox

[U-Boot,v2,1/3] efi_loader: write protocol GUID in OpenProtocol

Message ID 20170805165851.23461-2-xypron.glpk@gmx.de
State Superseded
Delegated to: Alexander Graf
Headers show

Commit Message

Heinrich Schuchardt Aug. 5, 2017, 4:58 p.m. UTC
To understand what happens in OpenProtocol it is necessary to know
the protocol interface GUID. Let's write a debug message.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
v2:
	fix typo in commit message
---
 include/efi_loader.h          | 14 ++++++++++++++
 lib/efi_loader/efi_boottime.c |  2 ++
 2 files changed, 16 insertions(+)

Comments

Rob Clark Aug. 5, 2017, 5:28 p.m. UTC | #1
On Sat, Aug 5, 2017 at 12:58 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> To understand what happens in OpenProtocol it is necessary to know
> the protocol interface GUID. Let's write a debug message.

btw, my "efi_loader: add guidstr helper" patch could make this a bit
simpler I suppose.. either way it would be nice to have a macro like
this.. I had been using something similar for debug locally

Reviewed-by: Rob Clark <robdclark@gmail.com>

BR,
-R

> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> v2:
>         fix typo in commit message
> ---
>  include/efi_loader.h          | 14 ++++++++++++++
>  lib/efi_loader/efi_boottime.c |  2 ++
>  2 files changed, 16 insertions(+)
>
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index 037cc7c543..553c615f11 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -51,6 +51,20 @@ 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("EFI: %s %02x%02x%02x%02x-%02x%02x-%02x%02x-" \
> +             "%02x%02x%02x%02x%02x%02x%02x%02x\n", \
> +             txt, ((u8 *)guid)[3], \
> +             ((u8 *)guid)[2], ((u8 *)guid)[1], ((u8 *)guid)[0], \
> +             ((u8 *)guid)[5], ((u8 *)guid)[4], ((u8 *)guid)[7], \
> +             ((u8 *)guid)[6], ((u8 *)guid)[8], ((u8 *)guid)[9], \
> +             ((u8 *)guid)[10], ((u8 *)guid)[11], ((u8 *)guid)[12], \
> +             ((u8 *)guid)[13], ((u8 *)guid)[14], ((u8 *)guid)[15]); \
> +       })
> +
>  extern struct efi_runtime_services efi_runtime_services;
>  extern struct efi_system_table systab;
>
> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
> index fb05c9e093..ebb557abb2 100644
> --- a/lib/efi_loader/efi_boottime.c
> +++ b/lib/efi_loader/efi_boottime.c
> @@ -1138,6 +1138,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:
> --
> 2.11.0
>
Rob Clark Aug. 5, 2017, 6:04 p.m. UTC | #2
On Sat, Aug 5, 2017 at 1:28 PM, Rob Clark <robdclark@gmail.com> wrote:
> On Sat, Aug 5, 2017 at 12:58 PM, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>> To understand what happens in OpenProtocol it is necessary to know
>> the protocol interface GUID. Let's write a debug message.
>
> btw, my "efi_loader: add guidstr helper" patch could make this a bit
> simpler I suppose.. either way it would be nice to have a macro like
> this.. I had been using something similar for debug locally

on second thought.. linux kernel's printk has a format modifier for
printing guid ptrs..  maybe this is a better idea than both
EFI_PRINT_GUID() and my 'add guidstr helper' patch, since it would
work with both printf and sprintf.

(I think the conclusion was anything that actually needed tiny-printf
didn't need EFI_LOADER.)

BR,
-R

> Reviewed-by: Rob Clark <robdclark@gmail.com>
>
> BR,
> -R
>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>> ---
>> v2:
>>         fix typo in commit message
>> ---
>>  include/efi_loader.h          | 14 ++++++++++++++
>>  lib/efi_loader/efi_boottime.c |  2 ++
>>  2 files changed, 16 insertions(+)
>>
>> diff --git a/include/efi_loader.h b/include/efi_loader.h
>> index 037cc7c543..553c615f11 100644
>> --- a/include/efi_loader.h
>> +++ b/include/efi_loader.h
>> @@ -51,6 +51,20 @@ 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("EFI: %s %02x%02x%02x%02x-%02x%02x-%02x%02x-" \
>> +             "%02x%02x%02x%02x%02x%02x%02x%02x\n", \
>> +             txt, ((u8 *)guid)[3], \
>> +             ((u8 *)guid)[2], ((u8 *)guid)[1], ((u8 *)guid)[0], \
>> +             ((u8 *)guid)[5], ((u8 *)guid)[4], ((u8 *)guid)[7], \
>> +             ((u8 *)guid)[6], ((u8 *)guid)[8], ((u8 *)guid)[9], \
>> +             ((u8 *)guid)[10], ((u8 *)guid)[11], ((u8 *)guid)[12], \
>> +             ((u8 *)guid)[13], ((u8 *)guid)[14], ((u8 *)guid)[15]); \
>> +       })
>> +
>>  extern struct efi_runtime_services efi_runtime_services;
>>  extern struct efi_system_table systab;
>>
>> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
>> index fb05c9e093..ebb557abb2 100644
>> --- a/lib/efi_loader/efi_boottime.c
>> +++ b/lib/efi_loader/efi_boottime.c
>> @@ -1138,6 +1138,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:
>> --
>> 2.11.0
>>
diff mbox

Patch

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 037cc7c543..553c615f11 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -51,6 +51,20 @@  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("EFI: %s %02x%02x%02x%02x-%02x%02x-%02x%02x-" \
+	      "%02x%02x%02x%02x%02x%02x%02x%02x\n", \
+	      txt, ((u8 *)guid)[3], \
+	      ((u8 *)guid)[2], ((u8 *)guid)[1], ((u8 *)guid)[0], \
+	      ((u8 *)guid)[5], ((u8 *)guid)[4], ((u8 *)guid)[7], \
+	      ((u8 *)guid)[6], ((u8 *)guid)[8], ((u8 *)guid)[9], \
+	      ((u8 *)guid)[10], ((u8 *)guid)[11], ((u8 *)guid)[12], \
+	      ((u8 *)guid)[13], ((u8 *)guid)[14], ((u8 *)guid)[15]); \
+	})
+
 extern struct efi_runtime_services efi_runtime_services;
 extern struct efi_system_table systab;
 
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index fb05c9e093..ebb557abb2 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1138,6 +1138,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: