From: Alexander Graf <agraf@suse.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 04/14] efi_loader: Add boot time services
Date: Tue, 2 Feb 2016 01:02:34 +0100 [thread overview]
Message-ID: <56AFF21A.2000603@suse.de> (raw)
In-Reply-To: <CAPnjgZ3STecstF-d1DmmtfpvJ55F8REjzQmOMTtaqCD3ovFTew@mail.gmail.com>
On 02/02/2016 12:54 AM, Simon Glass wrote:
> Hi Alex,
>
> On 1 February 2016 at 16:45, Alexander Graf <agraf@suse.de> wrote:
>>
>>
>> On 01/31/2016 04:19 PM, Simon Glass wrote:
>>> Hi Alexander,
>>>
>>> On 14 January 2016 at 22:06, Alexander Graf <agraf@suse.de> wrote:
>>>> When an EFI application runs, it has access to a few descriptor and callback
>>>> tables to instruct the EFI compliant firmware to do things for it. The bulk
>>>> of those interfaces are "boot time services". They handle all object management,
>>>> and memory allocation.
>>>>
>>>> This patch adds support for the boot time services and also exposes a system
>>>> table, which is the point of entry descriptor table for EFI payloads.
>>>>
>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>>>
>>>> ---
>>>>
>>>> v1 -> v2:
>>>>
>>>> - Fix typo s/does now/does not/
>>>> - Add #ifdefs around header to allow inclusion when efi_loader is disabled
>>>> - Add stub efi_restore_gd() function when efi_loader is disabled
>>>> - Disable debug
>>>> - Mark runtime region as such
>>>> - Fix up memory map
>>>> - Allow efi_restore_gd to be called before first efi entry
>>>> - Add 32bit arm cache workaround
>>>> - Move memory map to separate patch
>>>> - Change BTS version to 2.5
>>>> - Fix return values for a few callbacks to more EFI compliant ones
>>>> - Change vendor to "Das U-Boot"
>>>> - Add warning when truncating timer trigger
>>>> - Move to GPLv2+
>>>> ---
>>>> include/efi_loader.h | 51 +++
>>>> lib/efi_loader/efi_boottime.c | 761 ++++++++++++++++++++++++++++++++++++++++++
>>>> 2 files changed, 812 insertions(+)
>>>> create mode 100644 lib/efi_loader/efi_boottime.c
>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>>
>>> But please see below.
>>>
>>> Also, how does the timer get disabled? For me it seems to be enabled
>>> on boot so it always calls the trigger function.
>>
>> I think I see what you're running into. The ARM code runs set_timer as one of its first actions. On x86 it probably doesn't, so that's why you see the timer firing off, since it's initialized to 0 and now >= 0 always.
>>
>> I'll change the initialization for timer_next to -1ULL. That way you should only get to see events when they're there.
> OK. Or maybe you need a bool to track when it is not active?
Setting the value to -1ULL is almost the same, as it would only ever
match if timer_get_us() returns exactly 0xffffffffffffffff.
>
>>
>>>> diff --git a/include/efi_loader.h b/include/efi_loader.h
>>>> index bf77573..391459e 100644
>>>> --- a/include/efi_loader.h
>>>> +++ b/include/efi_loader.h
>>>> @@ -6,18 +6,69 @@
>>>> * SPDX-License-Identifier: GPL-2.0+
>>>> */
>>>>
>>>> +#include <common.h>
>>>> #include <part_efi.h>
>>>> #include <efi_api.h>
>>>> +
>>>> +#ifdef CONFIG_EFI_LOADER
>>>> +
>>>> #include <linux/list.h>
>>>>
>>>> +/* #define DEBUG_EFI */
>>>> +
>>>> +#ifdef DEBUG_EFI
>>>> +#define EFI_ENTRY(format, ...) do { \
>>>> + efi_restore_gd(); \
>>>> + printf("EFI: Entry %s(" format ")\n", __func__, ##__VA_ARGS__); \
>>>> + } while(0)
>>>> +#else
>>>> +#define EFI_ENTRY(format, ...) do { \
>>>> + efi_restore_gd(); \
>>>> + } while(0)
>>>> +#endif
>>>> +
>>>> +#define EFI_EXIT(ret) efi_exit_func(ret);
>>>> +
>>>> +extern struct efi_system_table systab;
>>>> +
>>>> extern const efi_guid_t efi_guid_device_path;
>>>> extern const efi_guid_t efi_guid_loaded_image;
>>>>
>>>> +struct efi_class_map {
>>>> + const efi_guid_t *guid;
>>>> + const void *interface;
>>>> +};
>>>> +
>>>> +struct efi_handler {
>>>> + const efi_guid_t *guid;
>>>> + efi_status_t (EFIAPI *open)(void *handle,
>>>> + efi_guid_t *protocol, void **protocol_interface,
>>>> + void *agent_handle, void *controller_handle,
>>>> + uint32_t attributes);
>>> Can we add a name in here? It would be good to name each of these
>>> things so that we can print it out for debugging, etc.
>>>
>>> Same also for efi_object. The guids are an unfortunate but effective
>>> obfuscation for people trying to figure out what is going on. I think
>>> we should try to keep things human-friendly.
>>
>> While I agree, I'm not sure this is the correct layer to do this in. As soon as the open callback gets called, you should be able to see which function this is, no?
>>
>> Do you have any concrete case where the current debugging wasn't enough?
> In my case I was trying to work out whether the call was getting
> through, and where it was ending up. It was really hard to know
> whether something was just not getting through. Putting a name in the
> dispatching helped a lot with that. It's all very well to send a
> message when you have arrived, but it's more useful I think to send a
> message when you leave :-)
I can see why it would help for that specific case, but I'd really put
this into the "apply locally, debug, throw away" patch category. I'm
sure once we have the support going well on x86, there won't be any need
to dig out names from the dispatcher.
Alex
next prev parent reply other threads:[~2016-02-02 0:02 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-15 5:06 [U-Boot] [PATCH 00/14] EFI payload / application support v2 Alexander Graf
2016-01-15 5:06 ` [U-Boot] [PATCH 01/14] disk/part.c: Expose list of available block drivers Alexander Graf
2016-01-15 5:06 ` [U-Boot] [PATCH 02/14] include/efi_api.h: Add more detailed API definitions Alexander Graf
2016-01-31 15:17 ` Simon Glass
2016-02-01 22:46 ` Alexander Graf
2016-01-15 5:06 ` [U-Boot] [PATCH 03/14] efi_loader: Add PE image loader Alexander Graf
2016-01-31 15:18 ` Simon Glass
2016-02-01 22:58 ` Alexander Graf
2016-01-15 5:06 ` [U-Boot] [PATCH 04/14] efi_loader: Add boot time services Alexander Graf
2016-01-20 0:16 ` Leif Lindholm
2016-02-02 1:52 ` Alexander Graf
2016-01-31 15:19 ` Simon Glass
2016-02-01 23:45 ` Alexander Graf
2016-02-01 23:54 ` Simon Glass
2016-02-02 0:02 ` Alexander Graf [this message]
2016-01-15 5:06 ` [U-Boot] [PATCH 05/14] efi_loader: Add console interface Alexander Graf
2016-01-31 15:19 ` Simon Glass
2016-01-15 5:06 ` [U-Boot] [PATCH 06/14] efi_loader: Add runtime services Alexander Graf
2016-01-21 17:20 ` Leif Lindholm
2016-01-31 15:20 ` Simon Glass
2016-02-01 23:57 ` Alexander Graf
2016-01-15 5:06 ` [U-Boot] [PATCH 07/14] efi_loader: Add disk interfaces Alexander Graf
2016-01-31 15:23 ` Simon Glass
2016-02-02 0:32 ` Alexander Graf
2016-01-15 5:06 ` [U-Boot] [PATCH 08/14] efi_loader: Add "bootefi" command Alexander Graf
2016-01-31 15:23 ` Simon Glass
2016-01-15 5:06 ` [U-Boot] [PATCH 09/14] efi_loader: Implement memory allocation and map Alexander Graf
2016-01-31 15:23 ` Simon Glass
2016-02-02 0:59 ` Alexander Graf
2016-01-15 5:06 ` [U-Boot] [PATCH 10/14] arm64: Allow exceptions to return Alexander Graf
2016-01-15 5:06 ` [U-Boot] [PATCH 11/14] arm64: Allow EFI payload code to take exceptions Alexander Graf
2016-01-15 5:06 ` [U-Boot] [PATCH 12/14] efi_loader: Add DCACHE_OFF support for arm64 Alexander Graf
2016-01-15 5:06 ` [U-Boot] [PATCH 13/14] efi_loader: hook up in build environment Alexander Graf
2016-01-31 15:24 ` Simon Glass
2016-01-15 5:06 ` [U-Boot] [PATCH 14/14] efi_loader: Add distro boot script for removable media Alexander Graf
2016-01-31 15:24 ` Simon Glass
2016-02-02 1:05 ` Alexander Graf
2016-01-31 15:17 ` [U-Boot] [PATCH 00/14] EFI payload / application support v2 Simon Glass
2016-01-31 21:43 ` Alexander Graf
2016-02-01 2:52 ` Simon Glass
2016-02-01 3:25 ` Simon Glass
2016-02-01 21:38 ` Alexander Graf
2016-02-02 0:02 ` Simon Glass
2016-02-02 0:16 ` Alexander Graf
2016-02-02 0:28 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56AFF21A.2000603@suse.de \
--to=agraf@suse.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox