efi: Use 16-bit unicode strings

At present we use wide characters for unicode but this is not necessary.
Change the code to use the 'u' literal instead. This helps to fix build
warnings for sandbox on rpi.

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
Simon Glass 2022-01-23 12:55:12 -07:00 committed by Tom Rini
parent 587254ebcf
commit 156ccbc3c4
34 changed files with 267 additions and 267 deletions

View file

@ -34,7 +34,7 @@ static struct efi_simple_text_output_protocol *con_out;
*/
static void print_uefi_revision(void)
{
u16 rev[] = L"0.0.0";
u16 rev[] = u"0.0.0";
rev[0] = (systable->hdr.revision >> 16) + '0';
rev[4] = systable->hdr.revision & 0xffff;
@ -48,9 +48,9 @@ static void print_uefi_revision(void)
else
rev[3] = 0;
con_out->output_string(con_out, L"Running on UEFI ");
con_out->output_string(con_out, u"Running on UEFI ");
con_out->output_string(con_out, rev);
con_out->output_string(con_out, L"\r\n");
con_out->output_string(con_out, u"\r\n");
}
/**
@ -65,15 +65,15 @@ static void print_config_tables(void)
if (!memcmp(&systable->tables[i].guid, &fdt_guid,
sizeof(efi_guid_t)))
con_out->output_string
(con_out, L"Have device tree\r\n");
(con_out, u"Have device tree\r\n");
if (!memcmp(&systable->tables[i].guid, &acpi_guid,
sizeof(efi_guid_t)))
con_out->output_string
(con_out, L"Have ACPI 2.0 table\r\n");
(con_out, u"Have ACPI 2.0 table\r\n");
if (!memcmp(&systable->tables[i].guid, &smbios_guid,
sizeof(efi_guid_t)))
con_out->output_string
(con_out, L"Have SMBIOS table\r\n");
(con_out, u"Have SMBIOS table\r\n");
}
}
@ -86,13 +86,13 @@ static void print_config_tables(void)
void print_load_options(struct efi_loaded_image *loaded_image)
{
/* Output the load options */
con_out->output_string(con_out, L"Load options: ");
con_out->output_string(con_out, u"Load options: ");
if (loaded_image->load_options_size && loaded_image->load_options)
con_out->output_string(con_out,
(u16 *)loaded_image->load_options);
else
con_out->output_string(con_out, L"<none>");
con_out->output_string(con_out, L"\r\n");
con_out->output_string(con_out, u"<none>");
con_out->output_string(con_out, u"\r\n");
}
/**
@ -108,21 +108,21 @@ efi_status_t print_device_path(struct efi_device_path *device_path,
efi_status_t ret;
if (!device_path) {
con_out->output_string(con_out, L"<none>\r\n");
con_out->output_string(con_out, u"<none>\r\n");
return EFI_SUCCESS;
}
string = dp2txt->convert_device_path_to_text(device_path, true, false);
if (!string) {
con_out->output_string
(con_out, L"Cannot convert device path to text\r\n");
(con_out, u"Cannot convert device path to text\r\n");
return EFI_OUT_OF_RESOURCES;
}
con_out->output_string(con_out, string);
con_out->output_string(con_out, L"\r\n");
con_out->output_string(con_out, u"\r\n");
ret = boottime->free_pool(string);
if (ret != EFI_SUCCESS) {
con_out->output_string(con_out, L"Cannot free pool memory\r\n");
con_out->output_string(con_out, u"Cannot free pool memory\r\n");
return ret;
}
return EFI_SUCCESS;
@ -148,7 +148,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
con_out = systable->con_out;
/* UEFI requires CR LF */
con_out->output_string(con_out, L"Hello, world!\r\n");
con_out->output_string(con_out, u"Hello, world!\r\n");
print_uefi_revision();
print_config_tables();
@ -158,7 +158,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
(void **)&loaded_image);
if (ret != EFI_SUCCESS) {
con_out->output_string
(con_out, L"Cannot open loaded image protocol\r\n");
(con_out, u"Cannot open loaded image protocol\r\n");
goto out;
}
print_load_options(loaded_image);
@ -168,12 +168,12 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
NULL, (void **)&device_path_to_text);
if (ret != EFI_SUCCESS) {
con_out->output_string
(con_out, L"Cannot open device path to text protocol\r\n");
(con_out, u"Cannot open device path to text protocol\r\n");
goto out;
}
if (!loaded_image->device_handle) {
con_out->output_string
(con_out, L"Missing device handle\r\n");
(con_out, u"Missing device handle\r\n");
goto out;
}
ret = boottime->handle_protocol(loaded_image->device_handle,
@ -181,14 +181,14 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle,
(void **)&device_path);
if (ret != EFI_SUCCESS) {
con_out->output_string
(con_out, L"Missing device path for device handle\r\n");
(con_out, u"Missing device path for device handle\r\n");
goto out;
}
con_out->output_string(con_out, L"Boot device: ");
con_out->output_string(con_out, u"Boot device: ");
ret = print_device_path(device_path, device_path_to_text);
if (ret != EFI_SUCCESS)
goto out;
con_out->output_string(con_out, L"File path: ");
con_out->output_string(con_out, u"File path: ");
ret = print_device_path(loaded_image->file_path, device_path_to_text);
if (ret != EFI_SUCCESS)
goto out;