diff mbox

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

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

Commit Message

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

Using uuid_guid_get_str would be quite clumsy for this purpose.
This would involve evaluating _DEBUG which probably should not be used
outside common.h.

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

Comments

Alexander Graf Aug. 11, 2017, 10:11 a.m. UTC | #1
On 05.08.17 21:32, Heinrich Schuchardt wrote:
> To understand what happens in OpenProtocol it is necessary to know
> the protocol interface GUID. Let's write a debug message.
> 
> Using uuid_guid_get_str would be quite clumsy for this purpose.
> This would involve evaluating _DEBUG which probably should not be used
> outside common.h.
> 
> Cc: Rob Clark <robdclark@gmail.com>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

I agree with Rob that a printf extension would be the nicest way to go 
here. We could then just use that instead of the %p in EFI_ENTRY() that 
we have today.


Alex
Heinrich Schuchardt Aug. 11, 2017, 4 p.m. UTC | #2
On 08/11/2017 12:11 PM, Alexander Graf wrote:
> 
> 
> On 05.08.17 21:32, Heinrich Schuchardt wrote:
>> To understand what happens in OpenProtocol it is necessary to know
>> the protocol interface GUID. Let's write a debug message.
>>
>> Using uuid_guid_get_str would be quite clumsy for this purpose.
>> This would involve evaluating _DEBUG which probably should not be used
>> outside common.h.
>>
>> Cc: Rob Clark <robdclark@gmail.com>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> 
> I agree with Rob that a printf extension would be the nicest way to go
> here. We could then just use that instead of the %p in EFI_ENTRY() that
> we have today.
> 
> 
> Alex
> 

Hello Alex,

I am aware of
[PATCH 4/5] vsprintf.c: add GUID printing,

I just wonder if you wnat to take this patch series as is and we modify
EFI_PRINT_GUID afterwards

or

we I shall remove GUID printing and resend the patch series without it.

Best regards

Heinrich
Alexander Graf Aug. 12, 2017, 1:35 p.m. UTC | #3
On 11.08.17 18:00, Heinrich Schuchardt wrote:
> On 08/11/2017 12:11 PM, Alexander Graf wrote:
>>
>>
>> On 05.08.17 21:32, Heinrich Schuchardt wrote:
>>> To understand what happens in OpenProtocol it is necessary to know
>>> the protocol interface GUID. Let's write a debug message.
>>>
>>> Using uuid_guid_get_str would be quite clumsy for this purpose.
>>> This would involve evaluating _DEBUG which probably should not be used
>>> outside common.h.
>>>
>>> Cc: Rob Clark <robdclark@gmail.com>
>>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>>
>> I agree with Rob that a printf extension would be the nicest way to go
>> here. We could then just use that instead of the %p in EFI_ENTRY() that
>> we have today.
>>
>>
>> Alex
>>
> 
> Hello Alex,
> 
> I am aware of
> [PATCH 4/5] vsprintf.c: add GUID printing,
> 
> I just wonder if you wnat to take this patch series as is and we modify
> EFI_PRINT_GUID afterwards
> 
> or
> 
> we I shall remove GUID printing and resend the patch series without it.

I think it's best to keep changes isolated to not stall anyone. Since 
this is really just a debug enhancement, I think we're best off to drop 
the GUID printing in this patch set.


Alex
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: