Pull request for UEFI sub-system for v2019.07-rc3 (2)

Minor patches to improve UEFI specification compliance are provided.
 
 To allow running the UEFI self compliance tests an outdated version of
 the Unicode collation protocol has been added as a configuration option
 (disabled by default).
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAlzg9fYACgkQxIHbvCwF
 GsRggg//XPDYQ4OGnYGrAqU46Ef7lD2frGFnTc4mBU54vdjfPgEbW9ZFkudNqsU4
 oqsbWc8EnXmSSxEKxR5OF3IhKpa3hrZef7z14LShlZ/zyGKbEiePkTN02LHL1IhC
 6CdU5zAhP08UfpQuofomDw7Uakw6BKi6Dn1ntH9uFYALOcGYeDCZ8pFgn5UiJ12K
 uXetp1rIlxbKkwLwCbtii/DpZLe5yWjNDS9l3/Thlbsf7MgvmpPFieX3I05wSGIP
 AIu28zJB9qXPCn1bYZMyVdNl49GPjk43OgvEA8FPtizcAMMlXCYACi/n4umee8sh
 MMGetJmVEHhKnKqpzzw7Em+p8xtdfEeZWPWf3dSGSqQBtzRZ0EBAZBZMGRlb8WDc
 qaSUwTt8B73KOf/TIZgAjkr/GD4yzW0Q5fsXNyYPNdZgaB9m1Xr5WFOqL4W8b7dd
 wpBK23W1qqanoNZ+Bji/HFlRoSoKizuxNFVMLK5fkzoQTXaMYwcwOQdC2jfe3ndM
 JarH1XUrVQelZooka23y79QgoVIXltDhUI1IkzzgNvDxQRHiFzktauO1SAU+Vje8
 kqxaoj9/qzKfZLyOv4cxCwj+YBBsYxJ/hJ86/IncoTKuTaxk0dekPQ7Xsk/UFST1
 39qp8bxahOykrbrX8m4QW+EMYh0cCUE1MGGD1VMeNUBmKEmxAV0=
 =OBPd
 -----END PGP SIGNATURE-----

Merge tag 'efi-2019-07-rc3-2' of git://git.denx.de/u-boot-efi

Pull request for UEFI sub-system for v2019.07-rc3 (2)

Minor patches to improve UEFI specification compliance are provided.

To allow running the UEFI self compliance tests an outdated version of
the Unicode collation protocol has been added as a configuration option
(disabled by default).
This commit is contained in:
Tom Rini 2019-05-19 16:46:24 -04:00
commit ab487c8568
12 changed files with 116 additions and 27 deletions

View File

@ -639,7 +639,7 @@ struct efi_simple_text_input_ex_protocol {
struct efi_event *wait_for_key_ex;
efi_status_t (EFIAPI *set_state) (
struct efi_simple_text_input_ex_protocol *this,
u8 key_toggle_state);
u8 *key_toggle_state);
efi_status_t (EFIAPI *register_key_notify) (
struct efi_simple_text_input_ex_protocol *this,
struct efi_key_data *key_data,
@ -1425,6 +1425,11 @@ struct efi_driver_binding_protocol {
efi_handle_t driver_binding_handle;
};
/* Deprecated version of the Unicode collation protocol */
#define EFI_UNICODE_COLLATION_PROTOCOL_GUID \
EFI_GUID(0x1d85cd7f, 0xf43d, 0x11d2, \
0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
/* Current version of the Unicode collation protocol */
#define EFI_UNICODE_COLLATION_PROTOCOL2_GUID \
EFI_GUID(0xa4c751fc, 0x23ae, 0x4c3e, \
0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49)

View File

@ -106,9 +106,12 @@ extern const struct efi_device_path_to_text_protocol efi_device_path_to_text;
/* implementation of the EFI_DEVICE_PATH_UTILITIES_PROTOCOL */
extern const struct efi_device_path_utilities_protocol
efi_device_path_utilities;
/* Implementation of the EFI_UNICODE_COLLATION_PROTOCOL */
/* deprecated version of the EFI_UNICODE_COLLATION_PROTOCOL */
extern const struct efi_unicode_collation_protocol
efi_unicode_collation_protocol;
/* current version of the EFI_UNICODE_COLLATION_PROTOCOL */
extern const struct efi_unicode_collation_protocol
efi_unicode_collation_protocol2;
extern const struct efi_hii_config_routing_protocol efi_hii_config_routing;
extern const struct efi_hii_config_access_protocol efi_hii_config_access;
extern const struct efi_hii_database_protocol efi_hii_database;
@ -145,8 +148,10 @@ extern const efi_guid_t efi_file_info_guid;
/* GUID for file system information */
extern const efi_guid_t efi_file_system_info_guid;
extern const efi_guid_t efi_guid_device_path_utilities_protocol;
/* GUID of the Unicode collation protocol */
/* GUID of the deprecated Unicode collation protocol */
extern const efi_guid_t efi_guid_unicode_collation_protocol;
/* GUID of the Unicode collation protocol */
extern const efi_guid_t efi_guid_unicode_collation_protocol2;
extern const efi_guid_t efi_guid_hii_config_routing_protocol;
extern const efi_guid_t efi_guid_hii_config_access_protocol;
extern const efi_guid_t efi_guid_hii_database_protocol;

View File

@ -36,14 +36,14 @@ config EFI_LOADER_HII
U-Boot implements enough of its features to be able to run the UEFI
Shell, but not more than that.
config EFI_UNICODE_COLLATION_PROTOCOL
config EFI_UNICODE_COLLATION_PROTOCOL2
bool "Unicode collation protocol"
default y
help
The Unicode collation protocol is used for lexical comparisons. It is
required to run the UEFI shell.
if EFI_UNICODE_COLLATION_PROTOCOL
if EFI_UNICODE_COLLATION_PROTOCOL2
config EFI_UNICODE_CAPITALIZATION
bool "Support Unicode capitalization"
@ -54,6 +54,17 @@ config EFI_UNICODE_CAPITALIZATION
set, only the the correct handling of the letters of the codepage
used by the FAT file system is ensured.
config EFI_UNICODE_COLLATION_PROTOCOL
bool "Deprecated version of the Unicode collation protocol"
default n
help
In EFI 1.10 a version of the Unicode collation protocol using ISO
639-2 language codes existed. This protocol is not part of the UEFI
specification any longer. Unfortunately it is required to run the
UEFI Self Certification Test (SCT) II, version 2.6, 2017.
Choose this option for testing only. It is bound to be removed.
endif
config EFI_LOADER_BOUNCE_BUFFER

View File

@ -30,7 +30,7 @@ obj-y += efi_memory.o
obj-y += efi_root_node.o
obj-y += efi_runtime.o
obj-y += efi_setup.o
obj-$(CONFIG_EFI_UNICODE_COLLATION_PROTOCOL) += efi_unicode_collation.o
obj-$(CONFIG_EFI_UNICODE_COLLATION_PROTOCOL2) += efi_unicode_collation.o
obj-y += efi_variable.o
obj-y += efi_watchdog.o
obj-$(CONFIG_LCD) += efi_gop.o

View File

@ -1916,10 +1916,17 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
static efi_status_t EFIAPI efi_get_next_monotonic_count(uint64_t *count)
{
static uint64_t mono;
efi_status_t ret;
EFI_ENTRY("%p", count);
if (!count) {
ret = EFI_INVALID_PARAMETER;
goto out;
}
*count = mono++;
return EFI_EXIT(EFI_SUCCESS);
ret = EFI_SUCCESS;
out:
return EFI_EXIT(ret);
}
/**
@ -2334,6 +2341,7 @@ efi_status_t EFIAPI efi_install_multiple_protocol_interfaces
efi_va_list argptr;
const efi_guid_t *protocol;
void *protocol_interface;
efi_handle_t old_handle;
efi_status_t r = EFI_SUCCESS;
int i = 0;
@ -2346,6 +2354,17 @@ efi_status_t EFIAPI efi_install_multiple_protocol_interfaces
if (!protocol)
break;
protocol_interface = efi_va_arg(argptr, void*);
/* Check that a device path has not been installed before */
if (!guidcmp(protocol, &efi_guid_device_path)) {
struct efi_device_path *dp = protocol_interface;
r = EFI_CALL(efi_locate_device_path(protocol, &dp,
&old_handle));
if (r == EFI_SUCCESS) {
r = EFI_ALREADY_STARTED;
break;
}
}
r = EFI_CALL(efi_install_protocol_interface(
handle, protocol,
EFI_NATIVE_INTERFACE,
@ -2453,9 +2472,16 @@ static efi_status_t EFIAPI efi_calculate_crc32(const void *data,
efi_uintn_t data_size,
u32 *crc32_p)
{
efi_status_t ret = EFI_SUCCESS;
EFI_ENTRY("%p, %zu", data, data_size);
if (!data || !data_size || !crc32_p) {
ret = EFI_INVALID_PARAMETER;
goto out;
}
*crc32_p = crc32(0, data, data_size);
return EFI_EXIT(EFI_SUCCESS);
out:
return EFI_EXIT(ret);
}
/**

View File

@ -136,6 +136,11 @@ static efi_status_t EFIAPI efi_cout_output_string(
EFI_ENTRY("%p, %p", this, string);
if (!this || !string) {
ret = EFI_INVALID_PARAMETER;
goto out;
}
buf = malloc(utf16_utf8_strlen(string) + 1);
if (!buf) {
ret = EFI_OUT_OF_RESOURCES;
@ -825,7 +830,7 @@ out:
* efi_cin_set_state() - set toggle key state
*
* @this: instance of the EFI_SIMPLE_TEXT_INPUT_PROTOCOL
* @key_toggle_state: key toggle state
* @key_toggle_state: pointer to key toggle state
* Return: status code
*
* This function implements the SetState service of the
@ -836,9 +841,9 @@ out:
*/
static efi_status_t EFIAPI efi_cin_set_state(
struct efi_simple_text_input_ex_protocol *this,
u8 key_toggle_state)
u8 *key_toggle_state)
{
EFI_ENTRY("%p, %u", this, key_toggle_state);
EFI_ENTRY("%p, %p", this, key_toggle_state);
/*
* U-Boot supports multiple console input sources like serial and
* net console for which a key toggle state cannot be set at all.

View File

@ -79,9 +79,8 @@ static char *dp_acpi(char *s, struct efi_device_path *dp)
struct efi_device_path_acpi_path *adp =
(struct efi_device_path_acpi_path *)dp;
s += sprintf(s, "Acpi(PNP%04X", EISA_PNP_NUM(adp->hid));
s += sprintf(s, ",%d", adp->uid);
s += sprintf(s, ")");
s += sprintf(s, "Acpi(PNP%04X,%d)", EISA_PNP_NUM(adp->hid),
adp->uid);
break;
}
default:

View File

@ -392,7 +392,7 @@ static efi_status_t EFIAPI efi_net_transmit
efi_timer_check();
/* Check parameters */
if (!this) {
if (!this || !buffer) {
ret = EFI_INVALID_PARAMETER;
goto out;
}
@ -408,7 +408,7 @@ static efi_status_t EFIAPI efi_net_transmit
* TODO: We would need to create the header
* if header_size != 0
*/
ret = EFI_INVALID_PARAMETER;
ret = EFI_UNSUPPORTED;
goto out;
}
@ -466,7 +466,7 @@ static efi_status_t EFIAPI efi_net_receive
efi_timer_check();
/* Check parameters */
if (!this) {
if (!this || !buffer || !buffer_size) {
ret = EFI_INVALID_PARAMETER;
goto out;
}

View File

@ -60,10 +60,15 @@ efi_status_t efi_root_node_register(void)
/* Device path utilities protocol */
&efi_guid_device_path_utilities_protocol,
(void *)&efi_device_path_utilities,
#if CONFIG_IS_ENABLED(EFI_UNICODE_COLLATION_PROTOCOL2)
#if CONFIG_IS_ENABLED(EFI_UNICODE_COLLATION_PROTOCOL)
/* Unicode collation protocol */
/* Deprecated Unicode collation protocol */
&efi_guid_unicode_collation_protocol,
(void *)&efi_unicode_collation_protocol,
#endif
/* Current Unicode collation protocol */
&efi_guid_unicode_collation_protocol2,
(void *)&efi_unicode_collation_protocol2,
#endif
#if CONFIG_IS_ENABLED(EFI_LOADER_HII)
/* HII string protocol */

View File

@ -26,8 +26,8 @@ static const u16 codepage[] = CP1250;
static const u16 codepage[] = CP437;
#endif
/* GUID of the EFI_UNICODE_COLLATION_PROTOCOL */
const efi_guid_t efi_guid_unicode_collation_protocol =
/* GUID of the EFI_UNICODE_COLLATION_PROTOCOL2 */
const efi_guid_t efi_guid_unicode_collation_protocol2 =
EFI_UNICODE_COLLATION_PROTOCOL2_GUID;
/**
@ -318,7 +318,7 @@ static bool EFIAPI efi_str_to_fat(struct efi_unicode_collation_protocol *this,
return ret;
}
const struct efi_unicode_collation_protocol efi_unicode_collation_protocol = {
const struct efi_unicode_collation_protocol efi_unicode_collation_protocol2 = {
.stri_coll = efi_stri_coll,
.metai_match = efi_metai_match,
.str_lwr = efi_str_lwr,
@ -327,3 +327,30 @@ const struct efi_unicode_collation_protocol efi_unicode_collation_protocol = {
.str_to_fat = efi_str_to_fat,
.supported_languages = "en",
};
/*
* In EFI 1.10 a version of the Unicode collation protocol using ISO 639-2
* language codes existed. This protocol is not part of the UEFI specification
* any longer. Unfortunately it is required to run the UEFI Self Certification
* Test (SCT) II, version 2.6, 2017. So we implement it here for the sole
* purpose of running the SCT. It can be removed when a compliant SCT is
* available.
*/
#if CONFIG_IS_ENABLED(EFI_UNICODE_COLLATION_PROTOCOL)
/* GUID of the EFI_UNICODE_COLLATION_PROTOCOL */
const efi_guid_t efi_guid_unicode_collation_protocol =
EFI_UNICODE_COLLATION_PROTOCOL_GUID;
const struct efi_unicode_collation_protocol efi_unicode_collation_protocol = {
.stri_coll = efi_stri_coll,
.metai_match = efi_metai_match,
.str_lwr = efi_str_lwr,
.str_upr = efi_str_upr,
.fat_to_str = efi_fat_to_str,
.str_to_fat = efi_str_to_fat,
/* ISO 639-2 language code */
.supported_languages = "eng",
};
#endif

View File

@ -202,8 +202,10 @@ efi_status_t EFIAPI efi_get_variable(u16 *variable_name,
len /= 2;
*data_size = len;
if (in_size < len)
return EFI_EXIT(EFI_BUFFER_TOO_SMALL);
if (in_size < len) {
ret = EFI_BUFFER_TOO_SMALL;
goto out;
}
if (!data)
return EFI_EXIT(EFI_INVALID_PARAMETER);
@ -217,8 +219,10 @@ efi_status_t EFIAPI efi_get_variable(u16 *variable_name,
*data_size = len;
if (in_size < len)
return EFI_EXIT(EFI_BUFFER_TOO_SMALL);
if (in_size < len) {
ret = EFI_BUFFER_TOO_SMALL;
goto out;
}
if (!data)
return EFI_EXIT(EFI_INVALID_PARAMETER);
@ -232,10 +236,11 @@ efi_status_t EFIAPI efi_get_variable(u16 *variable_name,
return EFI_EXIT(EFI_DEVICE_ERROR);
}
out:
if (attributes)
*attributes = attr & EFI_VARIABLE_MASK;
return EFI_EXIT(EFI_SUCCESS);
return EFI_EXIT(ret);
}
static char *efi_variables_list;

View File

@ -38,7 +38,8 @@ efi_selftest_variables.o \
efi_selftest_watchdog.o
obj-$(CONFIG_EFI_DEVICE_PATH_TO_TEXT) += efi_selftest_devicepath.o
obj-$(CONFIG_EFI_UNICODE_COLLATION_PROTOCOL) += efi_selftest_unicode_collation.o
obj-$(CONFIG_EFI_UNICODE_COLLATION_PROTOCOL2) += \
efi_selftest_unicode_collation.o
obj-$(CONFIG_CPU_V7) += efi_selftest_unaligned.o
obj-$(CONFIG_EFI_LOADER_HII) += efi_selftest_hii.o