/** * efi_get_driver_handle_info() - get information of UEFI driver * * @handle: Handle of UEFI device * @driver_name: Driver name * @image_path: Pointer to text of device path * Return: 0 on success, -1 on failure * * Currently return no useful information as all UEFI drivers are * built-in.. */ static int efi_get_driver_handle_info(efi_handle_t handle, u16 **driver_name, u16 **image_path) { struct efi_handler *handler; struct efi_loaded_image *image; efi_status_t ret; /* * driver name * TODO: support EFI_COMPONENT_NAME2_PROTOCOL */ *driver_name = NULL; /* image name */ ret = efi_search_protocol(handle, &efi_guid_loaded_image, &handler); if (ret != EFI_SUCCESS) { *image_path = NULL; return 0; } image = handler->protocol_interface; *image_path = efi_dp_str(image->file_path); return 0; }
/** * efi_get_device_handle_info() - get information of UEFI device * * @handle: Handle of UEFI device * @dev_path_text: Pointer to text of device path * Return: 0 on success, -1 on failure * * Currently return a formatted text of device path. */ static int efi_get_device_handle_info(efi_handle_t handle, u16 **dev_path_text) { struct efi_device_path *dp; efi_status_t ret; ret = EFI_CALL(BS->open_protocol(handle, &efi_guid_device_path, (void **)&dp, NULL /* FIXME */, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL)); if (ret == EFI_SUCCESS) { *dev_path_text = efi_dp_str(dp); return 0; } else { return -1; } }
/** * show_efi_boot_opt_data() - dump UEFI load option * * @id: Load option number * @data: Value of UEFI load option variable * * Decode the value of UEFI load option variable and print information. */ static void show_efi_boot_opt_data(int id, void *data) { struct efi_load_option lo; char *label, *p; size_t label_len16, label_len; u16 *dp_str; efi_deserialize_load_option(&lo, data); label_len16 = u16_strlen(lo.label); label_len = utf16_utf8_strnlen(lo.label, label_len16); label = malloc(label_len + 1); if (!label) return; p = label; utf16_utf8_strncpy(&p, lo.label, label_len16); printf("Boot%04X:\n", id); printf("\tattributes: %c%c%c (0x%08x)\n", /* ACTIVE */ lo.attributes & LOAD_OPTION_ACTIVE ? 'A' : '-', /* FORCE RECONNECT */ lo.attributes & LOAD_OPTION_FORCE_RECONNECT ? 'R' : '-', /* HIDDEN */ lo.attributes & LOAD_OPTION_HIDDEN ? 'H' : '-', lo.attributes); printf("\tlabel: %s\n", label); dp_str = efi_dp_str(lo.file_path); printf("\tfile_path: %ls\n", dp_str); efi_free_pool(dp_str); printf("\tdata: %s\n", lo.optional_data); free(label); }
* @controller_handle: handle of the controller * @remaining_device_path: path specifying the child controller * Return: status code */ static efi_status_t EFIAPI efi_uc_supported( struct efi_driver_binding_protocol *this, efi_handle_t controller_handle, struct efi_device_path *remaining_device_path) { efi_status_t r, ret; void *interface; struct efi_driver_binding_extended_protocol *bp = (struct efi_driver_binding_extended_protocol *)this; EFI_ENTRY("%p, %p, %ls", this, controller_handle, efi_dp_str(remaining_device_path)); ret = EFI_CALL(systab.boottime->open_protocol( controller_handle, bp->ops->protocol, &interface, this->driver_binding_handle, controller_handle, EFI_OPEN_PROTOCOL_BY_DRIVER)); switch (ret) { case EFI_ACCESS_DENIED: case EFI_ALREADY_STARTED: goto out; case EFI_SUCCESS: break; default: ret = EFI_UNSUPPORTED; goto out; }