diff mbox

[U-Boot] efi_loader: log EFI return values too

Message ID 20170724115911.17907-2-robdclark@gmail.com
State Deferred
Delegated to: Alexander Graf
Headers show

Commit Message

Rob Clark July 24, 2017, 11:59 a.m. UTC
Turns out this is rather useful to tracking down where things fail.

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
I've been carrying this around locally for a while.. but I find it
useful and I expect others would too.

 include/efi_loader.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Alexander Graf July 24, 2017, 12:36 p.m. UTC | #1
On 24.07.17 13:59, Rob Clark wrote:
> Turns out this is rather useful to tracking down where things fail.
> 
> Signed-off-by: Rob Clark <robdclark@gmail.com>
> ---
> I've been carrying this around locally for a while.. but I find it
> useful and I expect others would too.
> 
>   include/efi_loader.h | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index 043b29edd3..98d69a6dab 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -20,7 +20,10 @@
>   	debug("EFI: Entry %s(" format ")\n", __func__, ##__VA_ARGS__); \
>   	} while(0)
>   
> -#define EFI_EXIT(ret) efi_exit_func(ret);
> +#define EFI_EXIT(ret) ({ \

For consistency, please follow the same construct as in EFI_ENTRY().

> +	debug("EFI: Exit: %s: %u\n", __func__, (u32)((ret) & 0xffff)); \

I guess you just want to mask out EFI_ERROR_MASK?


Alex
Rob Clark July 24, 2017, 12:53 p.m. UTC | #2
On Mon, Jul 24, 2017 at 8:36 AM, Alexander Graf <agraf@suse.de> wrote:
>
>
> On 24.07.17 13:59, Rob Clark wrote:
>>
>> Turns out this is rather useful to tracking down where things fail.
>>
>> Signed-off-by: Rob Clark <robdclark@gmail.com>
>> ---
>> I've been carrying this around locally for a while.. but I find it
>> useful and I expect others would too.
>>
>>   include/efi_loader.h | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/efi_loader.h b/include/efi_loader.h
>> index 043b29edd3..98d69a6dab 100644
>> --- a/include/efi_loader.h
>> +++ b/include/efi_loader.h
>> @@ -20,7 +20,10 @@
>>         debug("EFI: Entry %s(" format ")\n", __func__, ##__VA_ARGS__); \
>>         } while(0)
>>   -#define EFI_EXIT(ret) efi_exit_func(ret);
>> +#define EFI_EXIT(ret) ({ \
>
>
> For consistency, please follow the same construct as in EFI_ENTRY().

You mean the do { ... } while (0)?  That won't work since EFI_EXIT()
has to evaluate to ret.  Or did I misunderstand you.

>> +       debug("EFI: Exit: %s: %u\n", __func__, (u32)((ret) & 0xffff)); \
>
>
> I guess you just want to mask out EFI_ERROR_MASK?
>

Yup.. is there a better way?

BR,
-R
Alexander Graf July 24, 2017, 1:05 p.m. UTC | #3
On 24.07.17 14:53, Rob Clark wrote:
> On Mon, Jul 24, 2017 at 8:36 AM, Alexander Graf <agraf@suse.de> wrote:
>>
>>
>> On 24.07.17 13:59, Rob Clark wrote:
>>>
>>> Turns out this is rather useful to tracking down where things fail.
>>>
>>> Signed-off-by: Rob Clark <robdclark@gmail.com>
>>> ---
>>> I've been carrying this around locally for a while.. but I find it
>>> useful and I expect others would too.
>>>
>>>    include/efi_loader.h | 5 ++++-
>>>    1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/include/efi_loader.h b/include/efi_loader.h
>>> index 043b29edd3..98d69a6dab 100644
>>> --- a/include/efi_loader.h
>>> +++ b/include/efi_loader.h
>>> @@ -20,7 +20,10 @@
>>>          debug("EFI: Entry %s(" format ")\n", __func__, ##__VA_ARGS__); \
>>>          } while(0)
>>>    -#define EFI_EXIT(ret) efi_exit_func(ret);
>>> +#define EFI_EXIT(ret) ({ \
>>
>>
>> For consistency, please follow the same construct as in EFI_ENTRY().
> 
> You mean the do { ... } while (0)?  That won't work since EFI_EXIT()
> has to evaluate to ret.  Or did I misunderstand you.

Ah, right. No, I just misunderstood the reason for the change :).

> 
>>> +       debug("EFI: Exit: %s: %u\n", __func__, (u32)((ret) & 0xffff)); \
>>
>>
>> I guess you just want to mask out EFI_ERROR_MASK?
>>
> 
> Yup.. is there a better way?

Yeah, & ~EFI_ERROR_MASK :).


Alex
diff mbox

Patch

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 043b29edd3..98d69a6dab 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -20,7 +20,10 @@ 
 	debug("EFI: Entry %s(" format ")\n", __func__, ##__VA_ARGS__); \
 	} while(0)
 
-#define EFI_EXIT(ret) efi_exit_func(ret);
+#define EFI_EXIT(ret) ({ \
+	debug("EFI: Exit: %s: %u\n", __func__, (u32)((ret) & 0xffff)); \
+	efi_exit_func(ret); \
+	})
 
 extern struct efi_runtime_services efi_runtime_services;
 extern struct efi_system_table systab;