Newer
Older
/*
* EFI application boot time services
*
* Copyright (c) 2016 Alexander Graf
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <malloc.h>
#include <asm/global_data.h>
#include <libfdt_env.h>
#include <u-boot/crc.h>
#include <bootm.h>
#include <inttypes.h>
#include <watchdog.h>
DECLARE_GLOBAL_DATA_PTR;
/* Task priority level */
static efi_uintn_t efi_tpl = TPL_APPLICATION;
/* This list contains all the EFI objects our payload has access to */
LIST_HEAD(efi_obj_list);
/*
* If we're running on nasty systems (32bit ARM booting into non-EFI Linux)
* we need to do trickery with caches. Since we don't want to break the EFI
* aware boot path, only apply hacks when loading exiting directly (breaking
* direct Linux EFI booting along the way - oh well).
*/
static bool efi_is_direct_boot = true;
/*
* EFI can pass arbitrary additional "tables" containing vendor specific
* information to the payload. One such table is the FDT table which contains
* a pointer to a flattened device tree blob.
*
* In most cases we want to pass an FDT to the payload, so reserve one slot of
* config table space for it. The pointer gets populated by do_bootefi_exec().
*/
static struct efi_configuration_table __efi_runtime_data efi_conf_table[2];
/*
* The "gd" pointer lives in a register on ARM and AArch64 that we declare
* fixed when compiling U-Boot. However, the payload does not know about that
* restriction so we need to manually swap its and our view of that register on
* EFI callback entry/exit.
*/
static volatile void *efi_gd, *app_gd;
static int entry_count;
static int nesting_level;
/* Called on every callback entry */
int __efi_entry_check(void)
{
int ret = entry_count++ == 0;
#ifdef CONFIG_ARM
assert(efi_gd);
app_gd = gd;
gd = efi_gd;
#endif
return ret;
}
/* Called on every callback exit */
int __efi_exit_check(void)
{
int ret = --entry_count == 0;
#ifdef CONFIG_ARM
gd = app_gd;
#endif
return ret;
}
/* Called from do_bootefi_exec() */
void efi_save_gd(void)
{
/*
* Special case handler for error/abort that just forces things back
* to u-boot world so we can dump out an abort msg, without any care
* about returning back to UEFI world.
*/
/* Only restore if we're already in EFI context */
if (!efi_gd)
return;
gd = efi_gd;
/*
* Two spaces per indent level, maxing out at 10.. which ought to be
* enough for anyone ;-)
*/
static const char *indent_string(int level)
{
const char *indent = " ";
const int max = strlen(indent);
level = min(max, level * 2);
return &indent[max - level];
}
const char *__efi_nesting(void)
{
return indent_string(nesting_level);
}
const char *__efi_nesting_inc(void)
{
return indent_string(nesting_level++);
}
const char *__efi_nesting_dec(void)
{
return indent_string(--nesting_level);
}
/*
* Queue an EFI event.
*
* This function queues the notification function of the event for future
* execution.
*
* The notification function is called if the task priority level of the
* event is higher than the current task priority level.
*
* For the SignalEvent service see efi_signal_event_ext.
*
* @event event to signal
*/
void efi_signal_event(struct efi_event *event)
if (event->notify_function) {
event->is_queued = true;
/* Check TPL */
if (efi_tpl >= event->notify_tpl)
return;
EFI_CALL_VOID(event->notify_function(event,
event->notify_context));
event->is_queued = false;
/*
* Raise the task priority level.
*
* This function implements the RaiseTpl service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* @new_tpl new value of the task priority level
* @return old value of the task priority level
*/
static unsigned long EFIAPI efi_raise_tpl(efi_uintn_t new_tpl)
efi_uintn_t old_tpl = efi_tpl;
EFI_ENTRY("0x%zx", new_tpl);
if (new_tpl < efi_tpl)
debug("WARNING: new_tpl < current_tpl in %s\n", __func__);
efi_tpl = new_tpl;
if (efi_tpl > TPL_HIGH_LEVEL)
efi_tpl = TPL_HIGH_LEVEL;
EFI_EXIT(EFI_SUCCESS);
return old_tpl;
/*
* Lower the task priority level.
*
* This function implements the RestoreTpl service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* @old_tpl value of the task priority level to be restored
*/
static void EFIAPI efi_restore_tpl(efi_uintn_t old_tpl)
EFI_ENTRY("0x%zx", old_tpl);
if (old_tpl > efi_tpl)
debug("WARNING: old_tpl > current_tpl in %s\n", __func__);
efi_tpl = old_tpl;
if (efi_tpl > TPL_HIGH_LEVEL)
efi_tpl = TPL_HIGH_LEVEL;
EFI_EXIT(EFI_SUCCESS);
/*
* Allocate memory pages.
*
* This function implements the AllocatePages service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* @type type of allocation to be performed
* @memory_type usage type of the allocated memory
* @pages number of pages to be allocated
* @memory allocated memory
* @return status code
*/
static efi_status_t EFIAPI efi_allocate_pages_ext(int type, int memory_type,
efi_uintn_t pages,
EFI_ENTRY("%d, %d, 0x%zx, %p", type, memory_type, pages, memory);
r = efi_allocate_pages(type, memory_type, pages, memory);
return EFI_EXIT(r);
}
/*
* Free memory pages.
*
* This function implements the FreePages service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* @memory start of the memory area to be freed
* @pages number of pages to be freed
* @return status code
*/
static efi_status_t EFIAPI efi_free_pages_ext(uint64_t memory,
efi_uintn_t pages)
EFI_ENTRY("%"PRIx64", 0x%zx", memory, pages);
r = efi_free_pages(memory, pages);
return EFI_EXIT(r);
}
/*
* Get map describing memory usage.
*
* This function implements the GetMemoryMap service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* @memory_map_size on entry the size, in bytes, of the memory map buffer,
* on exit the size of the copied memory map
* @memory_map buffer to which the memory map is written
* @map_key key for the memory map
* @descriptor_size size of an individual memory descriptor
* @descriptor_version version number of the memory descriptor structure
* @return status code
*/
static efi_status_t EFIAPI efi_get_memory_map_ext(
efi_uintn_t *memory_map_size,
struct efi_mem_desc *memory_map,
efi_uintn_t *map_key,
efi_uintn_t *descriptor_size,
uint32_t *descriptor_version)
{
efi_status_t r;
EFI_ENTRY("%p, %p, %p, %p, %p", memory_map_size, memory_map,
map_key, descriptor_size, descriptor_version);
r = efi_get_memory_map(memory_map_size, memory_map, map_key,
descriptor_size, descriptor_version);
return EFI_EXIT(r);
}
/*
* Allocate memory from pool.
*
* This function implements the AllocatePool service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* @pool_type type of the pool from which memory is to be allocated
* @size number of bytes to be allocated
* @buffer allocated memory
* @return status code
*/
static efi_status_t EFIAPI efi_allocate_pool_ext(int pool_type,
efi_uintn_t size,
void **buffer)
EFI_ENTRY("%d, %zd, %p", pool_type, size, buffer);
r = efi_allocate_pool(pool_type, size, buffer);
/*
* Free memory from pool.
*
* This function implements the FreePool service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* @buffer start of memory to be freed
* @return status code
*/
static efi_status_t EFIAPI efi_free_pool_ext(void *buffer)
efi_status_t r;
EFI_ENTRY("%p", buffer);
r = efi_free_pool(buffer);
/*
* Add a new object to the object list.
*
* The protocols list is initialized.
* The object handle is set.
*
* @obj object to be added
*/
void efi_add_handle(struct efi_object *obj)
{
if (!obj)
return;
INIT_LIST_HEAD(&obj->protocols);
obj->handle = obj;
list_add_tail(&obj->link, &efi_obj_list);
}
/*
* Create handle.
*
* @handle new handle
* @return status code
*/
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;
efi_add_handle(obj);
*handle = obj->handle;
* Our event capabilities are very limited. Only a small limited
* number of events is allowed to coexist.
static struct efi_event efi_events[16];
/*
* Create an event.
*
* This function is used inside U-Boot code to create an event.
*
* For the API function implementing the CreateEvent service see
* efi_create_event_ext.
*
* @type type of the event to create
* @notify_tpl task priority level of the event
* @notify_function notification function of the event
* @notify_context pointer passed to the notification function
* @event created event
* @return status code
*/
efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl,
void (EFIAPI *notify_function) (
struct efi_event *event,
void *context),
void *notify_context, struct efi_event **event)
return EFI_INVALID_PARAMETER;
if ((type & EVT_NOTIFY_SIGNAL) && (type & EVT_NOTIFY_WAIT))
return EFI_INVALID_PARAMETER;
if ((type & (EVT_NOTIFY_SIGNAL|EVT_NOTIFY_WAIT)) &&
notify_function == NULL)
return EFI_INVALID_PARAMETER;
for (i = 0; i < ARRAY_SIZE(efi_events); ++i) {
if (efi_events[i].type)
continue;
efi_events[i].type = type;
efi_events[i].notify_tpl = notify_tpl;
efi_events[i].notify_function = notify_function;
efi_events[i].notify_context = notify_context;
/* Disable timers on bootup */
efi_events[i].trigger_next = -1ULL;
efi_events[i].is_queued = false;
efi_events[i].is_signaled = false;
*event = &efi_events[i];
/*
* Create an event.
*
* This function implements the CreateEvent service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* @type type of the event to create
* @notify_tpl task priority level of the event
* @notify_function notification function of the event
* @notify_context pointer passed to the notification function
* @event created event
* @return status code
*/
static efi_status_t EFIAPI efi_create_event_ext(
uint32_t type, efi_uintn_t notify_tpl,
void (EFIAPI *notify_function) (
struct efi_event *event,
void *context),
void *notify_context, struct efi_event **event)
{
EFI_ENTRY("%d, 0x%zx, %p, %p", type, notify_tpl, notify_function,
notify_context);
return EFI_EXIT(efi_create_event(type, notify_tpl, notify_function,
notify_context, event));
}
* Check if a timer event has occurred or a queued notification function should
* be called.
*
* Our timers have to work without interrupts, so we check whenever keyboard
* input or disk accesses happen if enough time elapsed for them to fire.
*/
void efi_timer_check(void)
{
for (i = 0; i < ARRAY_SIZE(efi_events); ++i) {
if (!efi_events[i].type)
continue;
if (efi_events[i].is_queued)
efi_signal_event(&efi_events[i]);
if (!(efi_events[i].type & EVT_TIMER) ||
now < efi_events[i].trigger_next)
continue;
switch (efi_events[i].trigger_type) {
case EFI_TIMER_RELATIVE:
efi_events[i].trigger_type = EFI_TIMER_STOP;
break;
case EFI_TIMER_PERIODIC:
efi_events[i].trigger_next +=
efi_events[i].trigger_time;
break;
default:
continue;
efi_events[i].is_signaled = true;
efi_signal_event(&efi_events[i]);
/*
* Set the trigger time for a timer event or stop the event.
*
* This is the function for internal usage in U-Boot. For the API function
* implementing the SetTimer service see efi_set_timer_ext.
*
* @event event for which the timer is set
* @type type of the timer
* @trigger_time trigger period in multiples of 100ns
* @return status code
*/
efi_status_t efi_set_timer(struct efi_event *event, enum efi_timer_delay type,
/*
* The parameter defines a multiple of 100ns.
* We use multiples of 1000ns. So divide by 10.
*/
for (i = 0; i < ARRAY_SIZE(efi_events); ++i) {
if (event != &efi_events[i])
continue;
if (!(event->type & EVT_TIMER))
break;
switch (type) {
case EFI_TIMER_STOP:
event->trigger_next = -1ULL;
break;
case EFI_TIMER_PERIODIC:
case EFI_TIMER_RELATIVE:
event->trigger_next =
timer_get_us() + trigger_time;
}
event->trigger_type = type;
event->trigger_time = trigger_time;
event->is_signaled = false;
return EFI_INVALID_PARAMETER;
}
/*
* Set the trigger time for a timer event or stop the event.
*
* This function implements the SetTimer service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* @event event for which the timer is set
* @type type of the timer
* @trigger_time trigger period in multiples of 100ns
* @return status code
*/
static efi_status_t EFIAPI efi_set_timer_ext(struct efi_event *event,
enum efi_timer_delay type,
uint64_t trigger_time)
{
EFI_ENTRY("%p, %d, %"PRIx64, event, type, trigger_time);
return EFI_EXIT(efi_set_timer(event, type, trigger_time));
/*
* Wait for events to be signaled.
*
* This function implements the WaitForEvent service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* @num_events number of events to be waited for
* @events events to be waited for
* @index index of the event that was signaled
* @return status code
*/
static efi_status_t EFIAPI efi_wait_for_event(efi_uintn_t num_events,
struct efi_event **event,
efi_uintn_t *index)
EFI_ENTRY("%zd, %p, %p", num_events, event, index);
/* Check parameters */
if (!num_events || !event)
return EFI_EXIT(EFI_INVALID_PARAMETER);
/* Check TPL */
if (efi_tpl != TPL_APPLICATION)
return EFI_EXIT(EFI_UNSUPPORTED);
for (i = 0; i < num_events; ++i) {
for (j = 0; j < ARRAY_SIZE(efi_events); ++j) {
if (event[i] == &efi_events[j])
goto known_event;
}
return EFI_EXIT(EFI_INVALID_PARAMETER);
known_event:
if (!event[i]->type || event[i]->type & EVT_NOTIFY_SIGNAL)
return EFI_EXIT(EFI_INVALID_PARAMETER);
if (!event[i]->is_signaled)
efi_signal_event(event[i]);
}
/* Wait for signal */
for (;;) {
for (i = 0; i < num_events; ++i) {
if (event[i]->is_signaled)
goto out;
}
/* Allow events to occur. */
efi_timer_check();
}
out:
/*
* Reset the signal which is passed to the caller to allow periodic
* events to occur.
*/
event[i]->is_signaled = false;
if (index)
*index = i;
return EFI_EXIT(EFI_SUCCESS);
}
/*
* Signal an EFI event.
*
* This function implements the SignalEvent service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* This functions sets the signaled state of the event and queues the
* notification function for execution.
*
* @event event to signal
* @return status code
static efi_status_t EFIAPI efi_signal_event_ext(struct efi_event *event)
for (i = 0; i < ARRAY_SIZE(efi_events); ++i) {
if (event != &efi_events[i])
continue;
if (event->is_signaled)
break;
event->is_signaled = true;
if (event->type & EVT_NOTIFY_SIGNAL)
efi_signal_event(event);
return EFI_EXIT(EFI_SUCCESS);
}
/*
* Close an EFI event.
*
* This function implements the CloseEvent service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* @event event to close
* @return status code
*/
static efi_status_t EFIAPI efi_close_event(struct efi_event *event)
for (i = 0; i < ARRAY_SIZE(efi_events); ++i) {
if (event == &efi_events[i]) {
event->type = 0;
event->trigger_next = -1ULL;
event->is_queued = false;
event->is_signaled = false;
return EFI_EXIT(EFI_SUCCESS);
}
}
return EFI_EXIT(EFI_INVALID_PARAMETER);
/*
* Check if an event is signaled.
*
* This function implements the CheckEvent service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* If an event is not signaled yet the notification function is queued.
*
* @event event to check
* @return status code
*/
static efi_status_t EFIAPI efi_check_event(struct efi_event *event)
efi_timer_check();
for (i = 0; i < ARRAY_SIZE(efi_events); ++i) {
if (event != &efi_events[i])
continue;
if (!event->type || event->type & EVT_NOTIFY_SIGNAL)
break;
if (!event->is_signaled)
efi_signal_event(event);
if (event->is_signaled)
return EFI_EXIT(EFI_SUCCESS);
return EFI_EXIT(EFI_NOT_READY);
}
return EFI_EXIT(EFI_INVALID_PARAMETER);
/*
* Find the internal EFI object for a handle.
*
* @handle handle to find
* @return EFI object
*/
struct efi_object *efi_search_obj(const void *handle)
list_for_each_entry(efiobj, &efi_obj_list, link) {
if (efiobj->handle == handle)
return efiobj;
}
return NULL;
}
/*
* Find a protocol on a handle.
*
* @handle handle
* @protocol_guid GUID of the protocol
* @handler reference to the protocol
* @return status code
*/
efi_status_t efi_search_protocol(const void *handle,
const efi_guid_t *protocol_guid,
struct efi_handler **handler)
{
struct efi_object *efiobj;
struct list_head *lhandle;
if (!handle || !protocol_guid)
return EFI_INVALID_PARAMETER;
efiobj = efi_search_obj(handle);
if (!efiobj)
return EFI_INVALID_PARAMETER;
list_for_each(lhandle, &efiobj->protocols) {
struct efi_handler *protocol;
protocol = list_entry(lhandle, struct efi_handler, link);
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
if (!guidcmp(protocol->guid, protocol_guid)) {
if (handler)
*handler = protocol;
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
/*
* Install new protocol on a handle.
*
* @handle handle on which the protocol shall be installed
* @protocol GUID of the protocol to be installed
* @protocol_interface interface of the protocol implementation
* @return status code
*/
efi_status_t efi_add_protocol(const void *handle, const efi_guid_t *protocol,
void *protocol_interface)
{
struct efi_object *efiobj;
struct efi_handler *handler;
efi_status_t ret;
efiobj = efi_search_obj(handle);
if (!efiobj)
return EFI_INVALID_PARAMETER;
ret = efi_search_protocol(handle, protocol, NULL);
if (ret != EFI_NOT_FOUND)
return EFI_INVALID_PARAMETER;
handler = calloc(1, sizeof(struct efi_handler));
if (!handler)
return EFI_OUT_OF_RESOURCES;
handler->guid = protocol;
handler->protocol_interface = protocol_interface;
list_add_tail(&handler->link, &efiobj->protocols);
return EFI_SUCCESS;
}
/*
* Delete protocol from a handle.
*
* @handle handle from which the protocol shall be deleted
* @protocol GUID of the protocol to be deleted
* @protocol_interface interface of the protocol implementation
* @return status code
*/
efi_status_t efi_remove_protocol(const void *handle, const efi_guid_t *protocol,
void *protocol_interface)
{
struct efi_handler *handler;
efi_status_t ret;
ret = efi_search_protocol(handle, protocol, &handler);
if (ret != EFI_SUCCESS)
return ret;
if (guidcmp(handler->guid, protocol))
return EFI_INVALID_PARAMETER;
list_del(&handler->link);
free(handler);
return EFI_SUCCESS;
}
/*
* Delete all protocols from a handle.
*
* @handle handle from which the protocols shall be deleted
* @return status code
*/
efi_status_t efi_remove_all_protocols(const void *handle)
{
struct efi_object *efiobj;
struct list_head *lhandle;
struct list_head *pos;
efiobj = efi_search_obj(handle);
if (!efiobj)
return EFI_INVALID_PARAMETER;
list_for_each_safe(lhandle, pos, &efiobj->protocols) {
struct efi_handler *protocol;
efi_status_t ret;
protocol = list_entry(lhandle, struct efi_handler, link);
ret = efi_remove_protocol(handle, protocol->guid,
protocol->protocol_interface);
if (ret != EFI_SUCCESS)
return ret;
}
return EFI_SUCCESS;
}
/*
* Install protocol interface.
*
* This function implements the InstallProtocolInterface service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* @handle handle on which the protocol shall be installed
* @protocol GUID of the protocol to be installed
* @protocol_interface_type type of the interface to be installed,
* always EFI_NATIVE_INTERFACE
* @protocol_interface interface of the protocol implementation
* @return status code
*/
static efi_status_t EFIAPI efi_install_protocol_interface(
void **handle, const efi_guid_t *protocol,
int protocol_interface_type, void *protocol_interface)
EFI_ENTRY("%p, %pUl, %d, %p", handle, protocol, protocol_interface_type,
protocol_interface);
if (!handle || !protocol ||
protocol_interface_type != EFI_NATIVE_INTERFACE) {
r = EFI_INVALID_PARAMETER;
goto out;
}
/* Create new handle if requested. */
if (!*handle) {
r = efi_create_handle(handle);
if (r != EFI_SUCCESS)
goto out;
debug("%sEFI: new handle %p\n", indent_string(nesting_level),
*handle);
} else {
debug("%sEFI: handle %p\n", indent_string(nesting_level),
*handle);
/* Add new protocol */
r = efi_add_protocol(*handle, protocol, protocol_interface);
return EFI_EXIT(r);
/*
* Reinstall protocol interface.
*
* This function implements the ReinstallProtocolInterface service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* @handle handle on which the protocol shall be
* reinstalled
* @protocol GUID of the protocol to be installed
* @old_interface interface to be removed
* @new_interface interface to be installed
* @return status code
*/
static efi_status_t EFIAPI efi_reinstall_protocol_interface(void *handle,
const efi_guid_t *protocol, void *old_interface,
EFI_ENTRY("%p, %pUl, %p, %p", handle, protocol, old_interface,
new_interface);
return EFI_EXIT(EFI_ACCESS_DENIED);
}
/*
* Uninstall protocol interface.
*
* This function implements the UninstallProtocolInterface service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* @handle handle from which the protocol shall be removed
* @protocol GUID of the protocol to be removed
* @protocol_interface interface to be removed
* @return status code
*/
static efi_status_t EFIAPI efi_uninstall_protocol_interface(
void *handle, const efi_guid_t *protocol,
void *protocol_interface)
struct efi_handler *handler;
efi_status_t r;
EFI_ENTRY("%p, %pUl, %p", handle, protocol, protocol_interface);
if (!handle || !protocol) {
r = EFI_INVALID_PARAMETER;
goto out;
}
/* Find the protocol on the handle */
r = efi_search_protocol(handle, protocol, &handler);
if (r != EFI_SUCCESS)
goto out;
if (handler->protocol_interface) {
/* TODO disconnect controllers */
r = EFI_ACCESS_DENIED;
} else {
r = efi_remove_protocol(handle, protocol, protocol_interface);
return EFI_EXIT(r);
/*
* Register an event for notification when a protocol is installed.
*
* This function implements the RegisterProtocolNotify service.
* See the Unified Extensible Firmware Interface (UEFI) specification
* for details.
*
* @protocol GUID of the protocol whose installation shall be
* notified
* @event event to be signaled upon installation of the protocol
* @registration key for retrieving the registration information
* @return status code
*/
static efi_status_t EFIAPI efi_register_protocol_notify(
const efi_guid_t *protocol,
struct efi_event *event,
void **registration)
EFI_ENTRY("%pUl, %p, %p", protocol, event, registration);
return EFI_EXIT(EFI_OUT_OF_RESOURCES);
}
/*
* Determine if an EFI handle implements a protocol.
*
* See the documentation of the LocateHandle service in the UEFI specification.
*
* @search_type selection criterion
* @protocol GUID of the protocol
* @search_key registration key
* @efiobj handle
* @return 0 if the handle implements the protocol
*/
static int efi_search(enum efi_locate_search_type search_type,
const efi_guid_t *protocol, void *search_key,
case ALL_HANDLES:
case BY_REGISTER_NOTIFY:
/* TODO: RegisterProtocolNotify is not implemented yet */
case BY_PROTOCOL:
ret = efi_search_protocol(efiobj->handle, protocol, NULL);
return (ret != EFI_SUCCESS);
default:
/* Invalid search type */
/*
* Locate handles implementing a protocol.