| #
42417bc8 |
| 09-Oct-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
efi_loader: Track size of pool allocations to allow freeing
We need a functional free_pool implementation, as otherwise each allocate_pool causes growth of the memory descriptor table.
Different to
efi_loader: Track size of pool allocations to allow freeing
We need a functional free_pool implementation, as otherwise each allocate_pool causes growth of the memory descriptor table.
Different to free_pages, free_pool does not provide the size for the to be freed allocation, thus we have to track the size ourselves.
As the only EFI requirement for pool allocation is an alignment of 8 bytes, we can keep allocating a range using the page allocator, reserve the first 8 bytes for our bookkeeping and hand out the remainder to the caller. This saves us from having to use any independent data structures for tracking.
To simplify the conversion between pool allocations and the corresponding page allocation, we create an auxiliary struct efi_pool_allocation.
Given the allocation size free_pool size can handoff freeing the page range, which was indirectly allocated by a call to allocate_pool, to free_pages.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
| #
ead1274b |
| 09-Oct-2016 |
Stefan Brüns <stefan.bruens@rwth-aachen.de> |
efi_loader: Move efi_allocate_pool implementation to efi_memory.c
We currently handle efi_allocate_pool() in our boot time service file. In the following patch, pool allocation will receive addition
efi_loader: Move efi_allocate_pool implementation to efi_memory.c
We currently handle efi_allocate_pool() in our boot time service file. In the following patch, pool allocation will receive additional internal semantics that we should preserve inside efi_memory.c instead.
As foundation for those changes, split the function into an externally facing efi_allocate_pool_ext() for use by payloads and an internal helper efi_allocate_pool() in efi_memory.c that handles the actual allocation.
While at it, change the magic 0xfff / 12 constants to the more obvious EFI_PAGE_MASK/SHIFT defines.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
| #
991d62fa |
| 13-Sep-2016 |
Robin Randhawa <robin.randhawa@arm.com> |
efi_loader: Fix crash on 32-bit systems
A type mismatch in the efi_allocate_pool boot service flow causes hazardous memory scribbling on 32-bit systems.
This is efi_allocate_pool's prototype:
stat
efi_loader: Fix crash on 32-bit systems
A type mismatch in the efi_allocate_pool boot service flow causes hazardous memory scribbling on 32-bit systems.
This is efi_allocate_pool's prototype:
static efi_status_t EFIAPI efi_allocate_pool(int pool_type, unsigned long size, void **buffer);
Internally, it invokes efi_allocate_pages as follows:
efi_allocate_pages(0, pool_type, (size + 0xfff) >> 12, (void*)buffer);
This is efi_allocate_pages' prototype:
efi_status_t efi_allocate_pages(int type, int memory_type, unsigned long pages, uint64_t *memory);
The problem: efi_allocate_pages does this internally:
*memory = addr;
This fix in efi_allocate_pool uses a transitional uintptr_t cast to ensure the correct outcome, irrespective of the system's native word size.
This was observed when bootefi'ing the EFI instance of FreeBSD's first stage bootstrap (boot1.efi) on a 32-bit ARM platform (Qemu VExpress + Cortex-a9).
Signed-off-by: Robin Randhawa <robin.randhawa@arm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
| #
692fcdd8 |
| 27-Sep-2016 |
Alexander Graf <agraf@suse.de> |
arm: Add return value argument to longjmp
The normal longjmp command allows for a caller to pass the return value of the setjmp() invocation. This patch adds that semantic to the arm implementation
arm: Add return value argument to longjmp
The normal longjmp command allows for a caller to pass the return value of the setjmp() invocation. This patch adds that semantic to the arm implementation of it and adjusts the efi_loader call respectively.
Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org>
show more ...
|
| #
dc557e9a |
| 18-Jun-2016 |
Stefano Babic <sbabic@denx.de> |
Merge branch 'master' of git://git.denx.de/u-boot
Signed-off-by: Stefano Babic <sbabic@denx.de>
|
| #
edcef3ba |
| 02-Jun-2016 |
Alexander Graf <agraf@suse.de> |
efi_loader: Move to normal debug infrastructure
We introduced special "DEBUG_EFI" defines when the efi loader support was new. After giving it a bit of thought, turns out we really didn't have to -
efi_loader: Move to normal debug infrastructure
We introduced special "DEBUG_EFI" defines when the efi loader support was new. After giving it a bit of thought, turns out we really didn't have to - the normal #define DEBUG infrastructure works well enough for efi loader as well.
So this patch switches to the common debug() and #define DEBUG way of printing debug information.
Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
| #
a86aeaf2 |
| 20-May-2016 |
Alexander Graf <agraf@suse.de> |
efi_loader: Add exit support
Some times you may want to exit an EFI payload again, for example to default boot into a PXE installation and decide that you would rather want to boot from the local di
efi_loader: Add exit support
Some times you may want to exit an EFI payload again, for example to default boot into a PXE installation and decide that you would rather want to boot from the local disk instead.
This patch adds exit functionality to the EFI implementation, allowing EFI payloads to exit.
Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
| #
1cd29f0a |
| 24-Mar-2016 |
Alexander Graf <agraf@suse.de> |
efi_loader: Fix some entry/exit points
When switching between EFI context and U-Boot context we need to swap the register that "gd" resides in.
Some functions slipped through here, with efi_allocat
efi_loader: Fix some entry/exit points
When switching between EFI context and U-Boot context we need to swap the register that "gd" resides in.
Some functions slipped through here, with efi_allocate_pool / efi_free_pool not doing the switch correctly and efi_return_handle switching too often.
Fix them all up to make sure we always have consistent register state.
Signed-off-by: Alexander Graf <agraf@suse.de>
show more ...
|
| #
50149ea3 |
| 04-Mar-2016 |
Alexander Graf <agraf@suse.de> |
efi_loader: Add runtime services
After booting has finished, EFI allows firmware to still interact with the OS using the "runtime services". These callbacks live in a separate address space, since t
efi_loader: Add runtime services
After booting has finished, EFI allows firmware to still interact with the OS using the "runtime services". These callbacks live in a separate address space, since they are available long after U-Boot has been overwritten by the OS.
This patch adds enough framework for arbitrary code inside of U-Boot to become a runtime service with the right section attributes set. For now, we don't make use of it yet though.
We could maybe in the future map U-boot environment variables to EFI variables here.
Signed-off-by: Alexander Graf <agraf@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
show more ...
|
| #
bee91169 |
| 04-Mar-2016 |
Alexander Graf <agraf@suse.de> |
efi_loader: Add boot time services
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 i
efi_loader: Add boot time services
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> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
show more ...
|