summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2017-08-27 00:51:09 +0200
committerAlexander Graf <agraf@suse.de>2017-10-05 14:46:57 +0200
commit3cc6e3fe9509d2b5eee6a698126acdde4746f0c6 (patch)
tree850446071e89992ce448ec40b172e14d66ceb3b7 /lib
parent842a8e434e48e3d4d7a862c4a1676a698aa0954d (diff)
efi_loader: allow creating new handles
In efi_install_protocol_interface support creating a new handle. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_boottime.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 9e741c3cf3..c8f39b5b10 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -266,6 +266,23 @@ static efi_status_t EFIAPI efi_free_pool_ext(void *buffer)
return EFI_EXIT(r);
}
+static efi_status_t efi_create_handle(void **handle)
+{
+ struct efi_object *obj;
+ efi_status_t r;
+
+ r = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES,
+ sizeof(struct efi_object),
+ (void **)&obj);
+ if (r != EFI_SUCCESS)
+ return r;
+ memset(obj, 0, sizeof(struct efi_object));
+ obj->handle = obj;
+ list_add_tail(&obj->link, &efi_obj_list);
+ *handle = obj;
+ return r;
+}
+
/*
* Our event capabilities are very limited. Only a small limited
* number of events is allowed to coexist.
@@ -520,8 +537,9 @@ static efi_status_t EFIAPI efi_install_protocol_interface(void **handle,
/* Create new handle if requested. */
if (!*handle) {
- r = EFI_OUT_OF_RESOURCES;
- goto out;
+ r = efi_create_handle(handle);
+ if (r != EFI_SUCCESS)
+ goto out;
}
/* Find object. */
list_for_each(lhandle, &efi_obj_list) {