public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] efi_loader: EFI file paths should be DOS style
@ 2017-07-24 11:59 Rob Clark
  2017-07-24 11:59 ` [U-Boot] [PATCH] efi_loader: log EFI return values too Rob Clark
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Rob Clark @ 2017-07-24 11:59 UTC (permalink / raw)
  To: u-boot

shim.efi, for example, actually tries to parse this, but is expecting
backslashes.

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 cmd/bootefi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index b6d5047301..689eb09942 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -379,7 +379,7 @@ static int parse_partnum(const char *devnr)
 void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
 {
 	char devname[32] = { 0 }; /* dp->str is u16[32] long */
-	char *colon;
+	char *colon, *s;
 
 #if defined(CONFIG_BLK) || CONFIG_IS_ENABLED(ISO_PARTITION)
 	desc = blk_get_dev(dev, simple_strtol(devnr, NULL, 10));
@@ -431,6 +431,10 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
 	} else {
 		snprintf(devname, sizeof(devname), "%s", path);
 	}
+	/* DOS style file path: */
+	s = devname;
+	while ((s = strchr(s, '/')))
+		*s++ = '\\';
 	ascii2unicode(bootefi_image_path[0].str, devname);
 
 	loaded_image_info.device_handle = real_bootefi_device_path;
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] efi_loader: log EFI return values too
  2017-07-24 11:59 [U-Boot] [PATCH] efi_loader: EFI file paths should be DOS style Rob Clark
@ 2017-07-24 11:59 ` Rob Clark
  2017-07-24 12:36   ` Alexander Graf
  2017-07-24 11:59 ` [U-Boot] [PATCH] efi_loader: move guidcmp to header Rob Clark
  2017-07-28 22:28 ` [U-Boot] efi_loader: EFI file paths should be DOS style Alexander Graf
  2 siblings, 1 reply; 8+ messages in thread
From: Rob Clark @ 2017-07-24 11:59 UTC (permalink / raw)
  To: u-boot

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) ({ \
+	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;
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] efi_loader: move guidcmp to header
  2017-07-24 11:59 [U-Boot] [PATCH] efi_loader: EFI file paths should be DOS style Rob Clark
  2017-07-24 11:59 ` [U-Boot] [PATCH] efi_loader: log EFI return values too Rob Clark
@ 2017-07-24 11:59 ` Rob Clark
  2017-07-28 22:25   ` [U-Boot] " Alexander Graf
  2017-07-28 22:28 ` [U-Boot] efi_loader: EFI file paths should be DOS style Alexander Graf
  2 siblings, 1 reply; 8+ messages in thread
From: Rob Clark @ 2017-07-24 11:59 UTC (permalink / raw)
  To: u-boot

Want to re-use this for file protocol, which I'm working on.

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 include/efi_loader.h          | 5 +++++
 lib/efi_loader/efi_boottime.c | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 739404142a..b6bdf99a38 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -171,6 +171,11 @@ static inline void ascii2unicoden(u16 *unicode, const char *ascii, unsigned n)
 	}
 }
 
+static inline int guidcmp(const efi_guid_t *g1, const efi_guid_t *g2)
+{
+	return memcmp(g1, g2, sizeof(efi_guid_t));
+}
+
 /*
  * Use these to indicate that your code / data should go into the EFI runtime
  * section and thus still be available when the OS is running
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index a45de39919..bcec080edc 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -87,11 +87,6 @@ static efi_status_t efi_unsupported(const char *funcname)
 	return EFI_EXIT(EFI_UNSUPPORTED);
 }
 
-static int guidcmp(const efi_guid_t *g1, const efi_guid_t *g2)
-{
-	return memcmp(g1, g2, sizeof(efi_guid_t));
-}
-
 static unsigned long EFIAPI efi_raise_tpl(unsigned long new_tpl)
 {
 	EFI_ENTRY("0x%lx", new_tpl);
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] efi_loader: log EFI return values too
  2017-07-24 11:59 ` [U-Boot] [PATCH] efi_loader: log EFI return values too Rob Clark
@ 2017-07-24 12:36   ` Alexander Graf
  2017-07-24 12:53     ` Rob Clark
  0 siblings, 1 reply; 8+ messages in thread
From: Alexander Graf @ 2017-07-24 12:36 UTC (permalink / raw)
  To: u-boot



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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] efi_loader: log EFI return values too
  2017-07-24 12:36   ` Alexander Graf
@ 2017-07-24 12:53     ` Rob Clark
  2017-07-24 13:05       ` Alexander Graf
  0 siblings, 1 reply; 8+ messages in thread
From: Rob Clark @ 2017-07-24 12:53 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] efi_loader: log EFI return values too
  2017-07-24 12:53     ` Rob Clark
@ 2017-07-24 13:05       ` Alexander Graf
  0 siblings, 0 replies; 8+ messages in thread
From: Alexander Graf @ 2017-07-24 13:05 UTC (permalink / raw)
  To: u-boot



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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] efi_loader: move guidcmp to header
  2017-07-24 11:59 ` [U-Boot] [PATCH] efi_loader: move guidcmp to header Rob Clark
@ 2017-07-28 22:25   ` Alexander Graf
  0 siblings, 0 replies; 8+ messages in thread
From: Alexander Graf @ 2017-07-28 22:25 UTC (permalink / raw)
  To: u-boot

> Want to re-use this for file protocol, which I'm working on.
> 
> Signed-off-by: Rob Clark <robdclark@gmail.com>

Thanks, applied to efi-next

Alex

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] efi_loader: EFI file paths should be DOS style
  2017-07-24 11:59 [U-Boot] [PATCH] efi_loader: EFI file paths should be DOS style Rob Clark
  2017-07-24 11:59 ` [U-Boot] [PATCH] efi_loader: log EFI return values too Rob Clark
  2017-07-24 11:59 ` [U-Boot] [PATCH] efi_loader: move guidcmp to header Rob Clark
@ 2017-07-28 22:28 ` Alexander Graf
  2 siblings, 0 replies; 8+ messages in thread
From: Alexander Graf @ 2017-07-28 22:28 UTC (permalink / raw)
  To: u-boot

> shim.efi, for example, actually tries to parse this, but is expecting
> backslashes.
> 
> Signed-off-by: Rob Clark <robdclark@gmail.com>

Thanks, applied to efi-next

Alex

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-07-28 22:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-24 11:59 [U-Boot] [PATCH] efi_loader: EFI file paths should be DOS style Rob Clark
2017-07-24 11:59 ` [U-Boot] [PATCH] efi_loader: log EFI return values too Rob Clark
2017-07-24 12:36   ` Alexander Graf
2017-07-24 12:53     ` Rob Clark
2017-07-24 13:05       ` Alexander Graf
2017-07-24 11:59 ` [U-Boot] [PATCH] efi_loader: move guidcmp to header Rob Clark
2017-07-28 22:25   ` [U-Boot] " Alexander Graf
2017-07-28 22:28 ` [U-Boot] efi_loader: EFI file paths should be DOS style Alexander Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox