diff options
author | Tom Rini <trini@konsulko.com> | 2019-07-23 22:29:53 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-07-23 22:29:53 -0400 |
commit | fe4243870df152f839f88e5aa355f53cfba0a866 (patch) | |
tree | 6f748cbe5c48597a4075ebea87344c4763736686 /lib/efi_loader/efi_boottime.c | |
parent | ff8c23e784f57a7098e91a200ed7f5a48612b653 (diff) | |
parent | f62be16ddb76a32e6315bb9517b49e639726e1fa (diff) |
Merge tag 'efi-2019-10-rc1-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Pull request for UEFI sub-system for v2019.10-rc1 (2)
* Implement the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
* Address errors of type -Werror=address-of-packed-member when building
with GCC9.1
* Fix an error when adding memory add addres 0x00000000.
* Rework some code comments for Sphinx compliance.
Diffstat (limited to 'lib/efi_loader/efi_boottime.c')
-rw-r--r-- | lib/efi_loader/efi_boottime.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index c2f89805c7..4f6e8d1679 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -25,7 +25,7 @@ static efi_uintn_t efi_tpl = TPL_APPLICATION; LIST_HEAD(efi_obj_list); /* List of all events */ -LIST_HEAD(efi_events); +__efi_runtime_data LIST_HEAD(efi_events); /* List of queued events */ LIST_HEAD(efi_event_queue); @@ -596,7 +596,7 @@ efi_status_t efi_remove_all_protocols(const efi_handle_t handle) /** * efi_delete_handle() - delete handle * - * @obj: handle to delete + * @handle: handle to delete */ void efi_delete_handle(efi_handle_t handle) { @@ -628,6 +628,7 @@ static efi_status_t efi_is_event(const struct efi_event *event) /** * efi_create_event() - create an event + * * @type: type of the event to create * @notify_tpl: task priority level of the event * @notify_function: notification function of the event @@ -650,6 +651,8 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl, struct efi_event **event) { struct efi_event *evt; + efi_status_t ret; + int pool_type; if (event == NULL) return EFI_INVALID_PARAMETER; @@ -662,7 +665,10 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl, case EVT_NOTIFY_WAIT: case EVT_TIMER | EVT_NOTIFY_WAIT: case EVT_SIGNAL_EXIT_BOOT_SERVICES: + pool_type = EFI_BOOT_SERVICES_DATA; + break; case EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE: + pool_type = EFI_RUNTIME_SERVICES_DATA; break; default: return EFI_INVALID_PARAMETER; @@ -672,9 +678,11 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl, (!notify_function || is_valid_tpl(notify_tpl) != EFI_SUCCESS)) return EFI_INVALID_PARAMETER; - evt = calloc(1, sizeof(struct efi_event)); - if (!evt) - return EFI_OUT_OF_RESOURCES; + ret = efi_allocate_pool(pool_type, sizeof(struct efi_event), + (void **)&evt); + if (ret != EFI_SUCCESS) + return ret; + memset(evt, 0, sizeof(struct efi_event)); evt->type = type; evt->notify_tpl = notify_tpl; evt->notify_function = notify_function; @@ -982,7 +990,7 @@ static efi_status_t EFIAPI efi_close_event(struct efi_event *event) list_del(&event->queue_link); list_del(&event->link); - free(event); + efi_free_pool(event); return EFI_EXIT(EFI_SUCCESS); } @@ -1411,9 +1419,9 @@ out: /** * efi_search() - determine if an EFI handle implements a protocol + * * @search_type: selection criterion * @protocol: GUID of the protocol - * @search_key: registration key * @handle: handle * * See the documentation of the LocateHandle service in the UEFI specification. @@ -1675,7 +1683,7 @@ static efi_status_t EFIAPI efi_install_configuration_table_ext(efi_guid_t *guid, * Initialize a loaded_image_info and loaded_image_info object with correct * protocols, boot-device, etc. * - * In case of an error *handle_ptr and *info_ptr are set to NULL and an error + * In case of an error \*handle_ptr and \*info_ptr are set to NULL and an error * code is returned. * * @device_path: device path of the loaded image @@ -1932,7 +1940,7 @@ static void efi_exit_caches(void) static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, efi_uintn_t map_key) { - struct efi_event *evt; + struct efi_event *evt, *next_event; efi_status_t ret = EFI_SUCCESS; EFI_ENTRY("%p, %zx", image_handle, map_key); @@ -1971,6 +1979,12 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, /* Notify variable services */ efi_variables_boot_exit_notify(); + /* Remove all events except EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE */ + list_for_each_entry_safe(evt, next_event, &efi_events, link) { + if (evt->type != EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) + list_del(&evt->link); + } + board_quiesce_devices(); /* Patch out unsupported runtime function */ @@ -3034,9 +3048,9 @@ out: /** * efi_update_exit_data() - fill exit data parameters of StartImage() * - * @image_obj image handle - * @exit_data_size size of the exit data buffer - * @exit_data buffer with data returned by UEFI payload + * @image_obj: image handle + * @exit_data_size: size of the exit data buffer + * @exit_data: buffer with data returned by UEFI payload * Return: status code */ static efi_status_t efi_update_exit_data(struct efi_loaded_image_obj *image_obj, |