Lines Matching +full:read +full:- +full:to +full:- +full:read

2  * EFI-related functions to set up and run test cases in EFI
7 * SPDX-License-Identifier: LGPL-2.0-or-later
74 * Pad map_size with additional descriptors so we don't need to in efi_get_memory_map()
78 *map->buff_size = map_size; in efi_get_memory_map()
92 *map->desc_ver = desc_ver; in efi_get_memory_map()
93 *map->desc_size = desc_size; in efi_get_memory_map()
94 *map->map_size = map_size; in efi_get_memory_map()
95 *map->key_ptr = key; in efi_get_memory_map()
97 *map->map = m; in efi_get_memory_map()
103 return efi_bs_call(exit_boot_services, handle, *map->key_ptr); in efi_exit_boot_services()
111 tables = (efi_config_table_t *)efi_system_table->tables; in efi_get_system_config_table()
112 for (i = 0; i < efi_system_table->nr_tables; i++) { in efi_get_system_config_table()
126 * Fallback to UEFI reset_system() service, in case testdev is in efi_exit()
132 /* Adapted from drivers/firmware/efi/libstub/efi-stub.c */
137 int options_chars = image->load_options_size; in efi_convert_cmdline()
138 const u16 *options = image->load_options; in efi_convert_cmdline()
139 int options_bytes = 0, safe_options_bytes = 0; /* UTF-8 bytes */ in efi_convert_cmdline()
146 while (options_bytes < COMMAND_LINE_SIZE && options_chars--) { in efi_convert_cmdline()
162 * Get the number of UTF-8 bytes corresponding to a in efi_convert_cmdline()
163 * UTF-16 character. in efi_convert_cmdline()
179 options_bytes -= 3; in efi_convert_cmdline()
182 options_chars--; in efi_convert_cmdline()
189 printf("Command line is too long: truncated to %d bytes\n", in efi_convert_cmdline()
200 snprintf((char *)cmdline_addr, options_bytes, "%.*ls", options_bytes - 1, options); in efi_convert_cmdline()
209 * Open the file and read it into a buffer.
223 status = efi_bs_call(handle_protocol, image->device_handle, &file_system_proto_guid, in efi_load_image()
228 status = io_if->open_volume(io_if, &root); in efi_load_image()
233 status = root->open(root, &file, path_name, EFI_FILE_MODE_READ, 0); in efi_load_image()
235 printf("Failed to open %ls - %lx\n", path_name, status); in efi_load_image()
239 /* Find the file size in order to allocate the buffer */ in efi_load_image()
244 status = file->get_info(file, &file_info_guid, &buffer_size, file_info); in efi_load_image()
249 status = file->get_info(file, &file_info_guid, &buffer_size, file_info); in efi_load_image()
253 buffer_size = file_info->file_size; in efi_load_image()
259 /* Perform the actual read */ in efi_load_image()
260 status = file->read(file, &buffer_size, *data); in efi_load_image()
264 status = file->read(file, &buffer_size, *data); in efi_load_image()
391 * UEFI appends initrd=initrd to the command line when an initrd is present. in efi_load_initrd()
392 * Remove it in order to avoid confusing unit tests. in efi_load_initrd()
394 if (!strcmp(__argv[__argc - 1], "initrd=initrd")) { in efi_load_initrd()
395 __argv[__argc - 1] = NULL; in efi_load_initrd()
396 __argc -= 1; in efi_load_initrd()
413 /* Helper variables needed to get the cmdline */ in efi_main()
420 * Get a handle to the loaded image protocol. This is used to get in efi_main()
426 printf("Failed to get loaded image protocol\n"); in efi_main()
452 printf("Failed to get boot haritd\n"); in efi_main()
461 printf("Failed to get memory map\n"); in efi_main()
465 * Exit EFI boot services, let kvm-unit-tests take full in efi_main()
474 printf("Failed to exit boot services\n"); in efi_main()
478 /* Set up arch-specific resources */ in efi_main()
481 printf("Failed to set up arch-specific resources\n"); in efi_main()