Lines Matching +full:pd +full:- +full:node
1 // SPDX-License-Identifier: GPL-2.0+
14 #include <u-boot/crc.h>
30 * If we're running on nasty systems (32bit ARM booting into non-EFI Linux)
33 * direct Linux EFI booting along the way - oh well).
40 * fixed when compiling U-Boot. However, the payload does not know about that
47 /* 1 if inside U-Boot code, 0 if inside EFI payload code */
92 int ret = --entry_count == 0; in __efi_exit_check()
108 * Special case handler for error/abort that just forces things back to u-boot
123 * indent_string() - returns a string for indenting with two spaces per level
138 return &indent[max - level]; in indent_string()
153 return indent_string(--nesting_level); in __efi_nesting_dec()
157 * efi_queue_event() - queue an EFI event
172 if (event->notify_function) { in efi_queue_event()
173 event->is_queued = true; in efi_queue_event()
175 if (check_tpl && efi_tpl >= event->notify_tpl) in efi_queue_event()
177 EFI_CALL_VOID(event->notify_function(event, in efi_queue_event()
178 event->notify_context)); in efi_queue_event()
180 event->is_queued = false; in efi_queue_event()
184 * is_valid_tpl() - check if the task priority level is valid
203 * efi_signal_event() - signal an EFI event
215 if (event->group) { in efi_signal_event()
223 if (!evt->group || guidcmp(evt->group, event->group)) in efi_signal_event()
225 if (evt->is_signaled) in efi_signal_event()
227 evt->is_signaled = true; in efi_signal_event()
228 if (evt->type & EVT_NOTIFY_SIGNAL && in efi_signal_event()
229 evt->notify_function) in efi_signal_event()
230 evt->is_queued = true; in efi_signal_event()
233 if (!evt->group || guidcmp(evt->group, event->group)) in efi_signal_event()
235 if (evt->is_queued) in efi_signal_event()
238 } else if (!event->is_signaled) { in efi_signal_event()
239 event->is_signaled = true; in efi_signal_event()
240 if (event->type & EVT_NOTIFY_SIGNAL) in efi_signal_event()
246 * efi_raise_tpl() - raise the task priority level
273 * efi_restore_tpl() - lower the task priority level
300 * efi_allocate_pages_ext() - allocate memory pages
325 * efi_free_pages_ext() - Free memory pages.
347 * efi_get_memory_map_ext() - get map describing memory usage
379 * efi_allocate_pool_ext() - allocate memory from pool
403 * efi_free_pool_ext() - free memory from pool
423 * efi_add_handle() - add a new object to the object list
432 INIT_LIST_HEAD(&handle->protocols); in efi_add_handle()
433 list_add_tail(&handle->link, &efi_obj_list); in efi_add_handle()
437 * efi_create_handle() - create handle
457 * efi_search_protocol() - find a protocol on a handle.
476 list_for_each(lhandle, &efiobj->protocols) { in efi_search_protocol()
480 if (!guidcmp(protocol->guid, protocol_guid)) { in efi_search_protocol()
490 * efi_remove_protocol() - delete protocol from a handle
507 if (guidcmp(handler->guid, protocol)) in efi_remove_protocol()
509 if (handler->protocol_interface != protocol_interface) in efi_remove_protocol()
511 list_del(&handler->link); in efi_remove_protocol()
517 * efi_remove_all_protocols() - delete all protocols from a handle
531 list_for_each_entry_safe(protocol, pos, &efiobj->protocols, link) { in efi_remove_all_protocols()
534 ret = efi_remove_protocol(handle, protocol->guid, in efi_remove_all_protocols()
535 protocol->protocol_interface); in efi_remove_all_protocols()
543 * efi_delete_handle() - delete handle
552 list_del(&handle->link); in efi_delete_handle()
557 * efi_is_event() - check if a pointer is a valid event
576 * efi_create_event() - create an event
584 * This function is used inside U-Boot code to create an event.
624 evt->type = type; in efi_create_event()
625 evt->notify_tpl = notify_tpl; in efi_create_event()
626 evt->notify_function = notify_function; in efi_create_event()
627 evt->notify_context = notify_context; in efi_create_event()
628 evt->group = group; in efi_create_event()
630 evt->trigger_next = -1ULL; in efi_create_event()
631 evt->is_queued = false; in efi_create_event()
632 evt->is_signaled = false; in efi_create_event()
633 list_add_tail(&evt->link, &efi_events); in efi_create_event()
639 * efi_create_event_ex() - create an event in a group
669 * efi_create_event_ext() - create an event
697 * efi_timer_check() - check if a timer event has occurred
711 if (evt->is_queued) in efi_timer_check()
713 if (!(evt->type & EVT_TIMER) || now < evt->trigger_next) in efi_timer_check()
715 switch (evt->trigger_type) { in efi_timer_check()
717 evt->trigger_type = EFI_TIMER_STOP; in efi_timer_check()
720 evt->trigger_next += evt->trigger_time; in efi_timer_check()
725 evt->is_signaled = false; in efi_timer_check()
732 * efi_set_timer() - set the trigger time for a timer event or stop the event
737 * This is the function for internal usage in U-Boot. For the API function
746 if (efi_is_event(event) != EFI_SUCCESS || !(event->type & EVT_TIMER)) in efi_set_timer()
757 event->trigger_next = -1ULL; in efi_set_timer()
761 event->trigger_next = timer_get_us() + trigger_time; in efi_set_timer()
766 event->trigger_type = type; in efi_set_timer()
767 event->trigger_time = trigger_time; in efi_set_timer()
768 event->is_signaled = false; in efi_set_timer()
773 * efi_set_timer_ext() - Set the trigger time for a timer event or stop the
796 * efi_wait_for_event() - wait for events to be signaled
825 if (!event[i]->type || event[i]->type & EVT_NOTIFY_SIGNAL) in efi_wait_for_event()
827 if (!event[i]->is_signaled) in efi_wait_for_event()
834 if (event[i]->is_signaled) in efi_wait_for_event()
846 event[i]->is_signaled = false; in efi_wait_for_event()
854 * efi_signal_event_ext() - signal an EFI event
877 * efi_close_event() - close an EFI event
892 list_del(&event->link); in efi_close_event()
898 * efi_check_event() - check if an event is signaled
916 event->type & EVT_NOTIFY_SIGNAL) in efi_check_event()
918 if (!event->is_signaled) in efi_check_event()
920 if (event->is_signaled) { in efi_check_event()
921 event->is_signaled = false; in efi_check_event()
928 * efi_search_obj() - find the internal EFI object for a handle
946 * efi_open_protocol_info_entry() - create open protocol info entry and add it
961 list_add_tail(&item->link, &handler->open_infos); in efi_create_open_info()
963 return &item->info; in efi_create_open_info()
967 * efi_delete_open_info() - remove an open protocol info entry from a protocol
975 list_del(&item->link); in efi_delete_open_info()
981 * efi_add_protocol() - install new protocol on a handle
1005 handler->guid = protocol; in efi_add_protocol()
1006 handler->protocol_interface = protocol_interface; in efi_add_protocol()
1007 INIT_LIST_HEAD(&handler->open_infos); in efi_add_protocol()
1008 list_add_tail(&handler->link, &efiobj->protocols); in efi_add_protocol()
1010 EFI_PRINT("installed device path '%pD'\n", protocol_interface); in efi_add_protocol()
1015 * efi_install_protocol_interface() - install protocol interface
1062 * efi_get_drivers() - get all drivers associated to a controller
1083 list_for_each_entry(handler, &handle->protocols, link) { in efi_get_drivers()
1084 if (protocol && guidcmp(handler->guid, protocol)) in efi_get_drivers()
1086 list_for_each_entry(item, &handler->open_infos, link) { in efi_get_drivers()
1087 if (item->info.attributes & in efi_get_drivers()
1101 list_for_each_entry(handler, &handle->protocols, link) { in efi_get_drivers()
1102 if (protocol && guidcmp(handler->guid, protocol)) in efi_get_drivers()
1104 list_for_each_entry(item, &handler->open_infos, link) { in efi_get_drivers()
1105 if (item->info.attributes & in efi_get_drivers()
1111 item->info.agent_handle) in efi_get_drivers()
1118 item->info.agent_handle; in efi_get_drivers()
1127 * efi_disconnect_all_drivers() - disconnect all drivers from a controller
1157 driver_handle_buffer[--number_of_drivers], in efi_disconnect_all_drivers()
1167 * efi_uninstall_protocol() - uninstall protocol interface
1199 if (!list_empty(&handler->open_infos)) { in efi_uninstall_protocol()
1204 list_for_each_entry_safe(item, pos, &handler->open_infos, link) { in efi_uninstall_protocol()
1205 if (item->info.attributes == in efi_uninstall_protocol()
1207 item->info.attributes == EFI_OPEN_PROTOCOL_GET_PROTOCOL || in efi_uninstall_protocol()
1208 item->info.attributes == EFI_OPEN_PROTOCOL_TEST_PROTOCOL) in efi_uninstall_protocol()
1209 list_del(&item->link); in efi_uninstall_protocol()
1211 if (!list_empty(&handler->open_infos)) { in efi_uninstall_protocol()
1221 * efi_uninstall_protocol_interface() - uninstall protocol interface
1246 if (list_empty(&handle->protocols)) { in efi_uninstall_protocol_interface()
1247 list_del(&handle->link); in efi_uninstall_protocol_interface()
1255 * efi_register_protocol_notify() - register an event for notification when a
1277 * efi_search() - determine if an EFI handle implements a protocol
1298 return -1; in efi_search()
1304 return -1; in efi_search()
1309 * efi_locate_handle() - locate handles implementing a protocol
1316 * This function is meant for U-Boot internal calls. For the API implementation
1379 * efi_locate_handle_ext() - locate handles implementing a protocol.
1406 * efi_remove_configuration_table() - collapses configuration table entries,
1417 memmove(this, next, (ulong)end - (ulong)next); in efi_remove_configuration_table()
1418 systab.nr_tables--; in efi_remove_configuration_table()
1422 * efi_install_configuration_table() - adds, updates, or removes a
1470 if (evt->group && !guidcmp(evt->group, guid)) { in efi_install_configuration_table()
1480 * efi_install_configuration_table_ex() - Adds, updates, or removes a
1500 * efi_setup_loaded_image() - initialize a loaded image
1503 * protocols, boot-device, etc.
1537 efi_add_handle(&obj->header); in efi_setup_loaded_image()
1539 info->revision = EFI_LOADED_IMAGE_PROTOCOL_REVISION; in efi_setup_loaded_image()
1540 info->file_path = file_path; in efi_setup_loaded_image()
1541 info->system_table = &systab; in efi_setup_loaded_image()
1544 info->device_handle = efi_dp_find_obj(device_path, NULL); in efi_setup_loaded_image()
1549 ret = efi_add_protocol(&obj->header, in efi_setup_loaded_image()
1559 ret = efi_add_protocol(&obj->header, in efi_setup_loaded_image()
1565 ret = efi_add_protocol(&obj->header, in efi_setup_loaded_image()
1571 ret = efi_add_protocol(&obj->header, in efi_setup_loaded_image()
1577 ret = efi_add_protocol(&obj->header, in efi_setup_loaded_image()
1590 efi_delete_handle(&obj->header); in efi_setup_loaded_image()
1596 * efi_load_image_from_path() - load an image using a file path
1626 EFI_CALL(ret = f->getinfo(f, (efi_guid_t *)&efi_file_info_guid, in efi_load_image_from_path()
1634 EFI_CALL(ret = f->getinfo(f, (efi_guid_t *)&efi_file_info_guid, &bs, in efi_load_image_from_path()
1645 bs = info->file_size; in efi_load_image_from_path()
1655 EFI_CALL(ret = f->read(f, &bs, (void *)(uintptr_t)addr)); in efi_load_image_from_path()
1661 EFI_CALL(f->close(f)); in efi_load_image_from_path()
1667 * efi_load_image() - load an EFI image into memory
1695 EFI_ENTRY("%d, %p, %pD, %p, %zd, %p", boot_policy, parent_image, in efi_load_image()
1746 info->image_code_type, false); in efi_load_image()
1747 info->system_table = &systab; in efi_load_image()
1748 info->parent_handle = parent_image; in efi_load_image()
1762 * efi_start_image() - call the entry point of an image
1787 if (setjmp(&image_obj->exit_jmp)) { in efi_start_image()
1810 (unsigned long)((uintptr_t)image_obj->exit_status & in efi_start_image()
1812 return EFI_EXIT(image_obj->exit_status); in efi_start_image()
1815 ret = EFI_CALL(image_obj->entry(image_handle, &systab)); in efi_start_image()
1823 return EFI_CALL(systab.boottime->exit(image_handle, ret, 0, NULL)); in efi_start_image()
1827 * efi_exit() - leave an EFI application or driver
1855 /* Make sure entry/exit counts for EFI world cross-overs match */ in efi_exit()
1859 * But longjmp out with the U-Boot gd, not the application's, as in efi_exit()
1864 image_obj->exit_status = exit_status; in efi_exit()
1865 longjmp(&image_obj->exit_jmp, 1); in efi_exit()
1871 * efi_unload_image() - unload an EFI image
1888 list_del(&efiobj->link); in efi_unload_image()
1894 * efi_exit_caches() - fix up caches for EFI payloads if necessary
1909 * efi_exit_boot_services() - stop all boot services
1944 if (evt->type == EVT_SIGNAL_EXIT_BOOT_SERVICES) in efi_exit_boot_services()
1945 evt->group = &efi_guid_event_group_exit_boot_services; in efi_exit_boot_services()
1949 if (evt->group && in efi_exit_boot_services()
1950 !guidcmp(evt->group, in efi_exit_boot_services()
1987 * efi_get_next_monotonic_count() - get next value of the counter
2007 * efi_stall() - sleep
2025 * efi_set_watchdog_timer() - reset the watchdog timer
2049 * efi_close_protocol() - close a protocol
2084 list_for_each_entry_safe(item, pos, &handler->open_infos, link) { in efi_close_protocol()
2085 if (item->info.agent_handle == agent_handle && in efi_close_protocol()
2086 item->info.controller_handle == controller_handle) { in efi_close_protocol()
2097 * efi_open_protocol_information() - provide information about then open status
2136 list_for_each_entry(item, &handler->open_infos, link) { in efi_open_protocol_information()
2137 if (item->info.open_count) in efi_open_protocol_information()
2153 list_for_each_entry_reverse(item, &handler->open_infos, link) { in efi_open_protocol_information()
2154 if (item->info.open_count) in efi_open_protocol_information()
2155 (*entry_buffer)[--count] = item->info; in efi_open_protocol_information()
2162 * efi_protocols_per_handle() - get protocols installed on a handle
2197 list_for_each(protocol_handle, &efiobj->protocols) { in efi_protocols_per_handle()
2210 list_for_each(protocol_handle, &efiobj->protocols) { in efi_protocols_per_handle()
2215 (*protocol_buffer)[j] = (void *)protocol->guid; in efi_protocols_per_handle()
2224 * efi_locate_handle_buffer() - locate handles implementing a protocol
2272 * efi_locate_protocol() - find an interface implementing a protocol
2304 *protocol_interface = handler->protocol_interface; in efi_locate_protocol()
2314 * efi_locate_device_path() - Get the device path and handle of an device
2364 dp = (struct efi_device_path *)handler->protocol_interface; in efi_locate_device_path()
2392 * efi_install_multiple_protocol_interfaces() - Install multiple protocol
2439 for (; i; --i) { in efi_install_multiple_protocol_interfaces()
2451 * efi_uninstall_multiple_protocol_interfaces() - uninstall multiple protocol
2493 if (list_empty(&handle->protocols)) { in efi_uninstall_multiple_protocol_interfaces()
2494 list_del(&handle->link); in efi_uninstall_multiple_protocol_interfaces()
2502 for (; i; --i) { in efi_uninstall_multiple_protocol_interfaces()
2516 * efi_calculate_crc32() - calculate cyclic redundancy code
2538 * efi_copy_mem() - copy memory
2557 * efi_set_mem() - Fill memory with a byte value.
2575 * efi_protocol_open() - open protocol interface on a handle
2606 list_for_each_entry(item, &handler->open_infos, link) { in efi_protocol_open()
2607 if (item->info.agent_handle == agent_handle) { in efi_protocol_open()
2609 (item->info.attributes == attributes)) in efi_protocol_open()
2612 if (item->info.attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE) in efi_protocol_open()
2624 list_for_each_entry(item, &handler->open_infos, link) { in efi_protocol_open()
2625 if (item->info.attributes == in efi_protocol_open()
2628 item->info.controller_handle, in efi_protocol_open()
2629 item->info.agent_handle, in efi_protocol_open()
2634 list_for_each_entry(item, &handler->open_infos, link) { in efi_protocol_open()
2635 if (item->info.attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) in efi_protocol_open()
2644 list_for_each_entry(item, &handler->open_infos, link) { in efi_protocol_open()
2645 if (item->info.agent_handle == agent_handle && in efi_protocol_open()
2646 item->info.controller_handle == controller_handle) in efi_protocol_open()
2647 match = &item->info; in efi_protocol_open()
2656 match->agent_handle = agent_handle; in efi_protocol_open()
2657 match->controller_handle = controller_handle; in efi_protocol_open()
2658 match->attributes = attributes; in efi_protocol_open()
2659 match->open_count++; in efi_protocol_open()
2664 *protocol_interface = handler->protocol_interface; in efi_protocol_open()
2670 * efi_open_protocol() - open protocol interface on a handle
2711 /* fall-through */ in efi_open_protocol()
2717 /* fall-through */ in efi_open_protocol()
2738 * efi_handle_protocol() - get interface of a protocol on a handle
2759 * efi_bind_controller() - bind a single driver to a controller
2781 r = EFI_CALL(binding_protocol->supported(binding_protocol, in efi_bind_controller()
2785 r = EFI_CALL(binding_protocol->start(binding_protocol, in efi_bind_controller()
2795 * efi_connect_single_controller() - connect a single driver to a controller
2844 * - Platform Driver Override in efi_connect_single_controller()
2845 * - Driver Family Override Search in efi_connect_single_controller()
2846 * - Bus Specific Driver Override in efi_connect_single_controller()
2867 * efi_connect_controller() - connect a controller to a driver
2894 EFI_ENTRY("%p, %p, %pD, %d", controller_handle, driver_image_handle, in efi_connect_controller()
2912 list_for_each_entry(handler, &efiobj->protocols, link) { in efi_connect_controller()
2913 list_for_each_entry(item, &handler->open_infos, link) { in efi_connect_controller()
2914 if (item->info.attributes & in efi_connect_controller()
2917 item->info.controller_handle, in efi_connect_controller()
2927 /* Check for child controller specified by end node */ in efi_connect_controller()
2929 remain_device_path->type == DEVICE_PATH_TYPE_END) in efi_connect_controller()
2936 * efi_reinstall_protocol_interface() - reinstall protocol interface
2985 * efi_get_child_controllers() - get all child controllers associated to a driver
3007 list_for_each_entry(handler, &efiobj->protocols, link) { in efi_get_child_controllers()
3008 list_for_each_entry(item, &handler->open_infos, link) { in efi_get_child_controllers()
3009 if (item->info.agent_handle == driver_handle && in efi_get_child_controllers()
3010 item->info.attributes & in efi_get_child_controllers()
3024 list_for_each_entry(handler, &efiobj->protocols, link) { in efi_get_child_controllers()
3025 list_for_each_entry(item, &handler->open_infos, link) { in efi_get_child_controllers()
3026 if (item->info.agent_handle == driver_handle && in efi_get_child_controllers()
3027 item->info.attributes & in efi_get_child_controllers()
3033 item->info.controller_handle) in efi_get_child_controllers()
3040 item->info.controller_handle; in efi_get_child_controllers()
3049 * efi_disconnect_controller() - disconnect a controller from a driver
3114 r = EFI_CALL(binding_protocol->stop(binding_protocol, in efi_disconnect_controller()
3123 r = EFI_CALL(binding_protocol->stop(binding_protocol, in efi_disconnect_controller()
3196 static u16 __efi_runtime_data firmware_vendor[] = L"Das U-Boot";
3216 * efi_initialize_system_table() - Initialize system table