mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-30 00:21:06 +00:00
Pull request for efi-2023-01-rc1-3
UEFI: * replace EFI_CALL() by internal functions * delete loadfile2 handle by uninstalling all protocols Other: * Provide spi_set_speed() needed for implementation of EFI SPI I/O protocol -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmNL9iwACgkQxIHbvCwF GsTwZRAAgQRKXfuT1oLzXEL72+6DcOezUUK0rAsYyWR0xZ0ye8nBMKFQiMhY8/K0 Y6m3GsQxWRTz+CzGw4C++I1GsVdxfdSa2DBZKHu5UwPzzM5NFYycCQtjAgZPFi0g 6GWsTOcBDGt4vEffMLNHtqHLnXbhvliEakLQtRLSHfQ71d++p/JEuI0fQd1455sW KnqJkpVkHsi5ZrLI77kTPHASVTm8wiTaRThSDF7oiCV+9ZuxIoagTpy92ZVdK452 B2aXttIRc5geQ4tAOIzn1/ftty8lNB1cjisLLNPJqB1Guv84wCRd+7D8t764gm3J bqJ4xWZEMvz0htKSwm1fFOr8sOztyrto9TSIMm5mlXnlpsHir6dMwiyhYgSdkcAq GaQroB/rB67dNhQkuyYULKA+UpqNsTKfKg/o09RDBOpOE2ROql22S1wWTceLr8qF 6v2HM4d4bELIXC2ECE0rsBsvLK6zumyPhe/nP7T+KZtt88nzswPoX8AYiEfL0mnf tFzleTc4JknILeS8qaZdnLPjWaDsbmO9xmoBgz1Vjb7gsELJw1qI6nFxtaZ0I5Wb zers6nRyOPyLLqugXh+0oqJUkRQt8MTn0QiN2mUzXWqGhVMquN5ERxixCtWX5RRL BVN8hx0CEKAleI0MGhWFDqGoRceNuEULotBOSTqCvTt7VeN1A3E= =nSoz -----END PGP SIGNATURE----- Merge tag 'efi-2023-01-rc1-3' of https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2023-01-rc1-3 UEFI: * replace EFI_CALL() by internal functions * delete loadfile2 handle by uninstalling all protocols Other: * Provide spi_set_speed() needed for implementation of EFI SPI I/O protocol
This commit is contained in:
commit
e2ff1d0fa7
7 changed files with 78 additions and 47 deletions
|
@ -394,8 +394,10 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
|
|||
out:
|
||||
free(load_options);
|
||||
|
||||
if (IS_ENABLED(CONFIG_EFI_LOAD_FILE2_INITRD))
|
||||
efi_initrd_deregister();
|
||||
if (IS_ENABLED(CONFIG_EFI_LOAD_FILE2_INITRD)) {
|
||||
if (efi_initrd_deregister() != EFI_SUCCESS)
|
||||
log_err("Failed to remove loadfile2 for initrd\n");
|
||||
}
|
||||
|
||||
/* Control is returned to U-Boot, disable EFI watchdog */
|
||||
efi_set_watchdog(0);
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <linux/err.h>
|
||||
|
||||
#define BS systab.boottime
|
||||
#define RT systab.runtime
|
||||
|
||||
#ifdef CONFIG_EFI_HAVE_CAPSULE_SUPPORT
|
||||
/**
|
||||
|
@ -76,7 +75,7 @@ static int do_efi_capsule_update(struct cmd_tbl *cmdtp, int flag,
|
|||
capsule->capsule_image_size);
|
||||
}
|
||||
|
||||
ret = EFI_CALL(RT->update_capsule(&capsule, 1, 0));
|
||||
ret = EFI_CALL(efi_update_capsule(&capsule, 1, 0));
|
||||
if (ret) {
|
||||
printf("Cannot handle a capsule at %p\n", capsule);
|
||||
return CMD_RET_FAILURE;
|
||||
|
@ -995,17 +994,16 @@ static void show_efi_boot_opt(u16 *varname16)
|
|||
efi_status_t ret;
|
||||
|
||||
size = 0;
|
||||
ret = EFI_CALL(efi_get_variable(varname16, &efi_global_variable_guid,
|
||||
NULL, &size, NULL));
|
||||
ret = efi_get_variable_int(varname16, &efi_global_variable_guid,
|
||||
NULL, &size, NULL, NULL);
|
||||
if (ret == EFI_BUFFER_TOO_SMALL) {
|
||||
data = malloc(size);
|
||||
if (!data) {
|
||||
printf("ERROR: Out of memory\n");
|
||||
return;
|
||||
}
|
||||
ret = EFI_CALL(efi_get_variable(varname16,
|
||||
&efi_global_variable_guid,
|
||||
NULL, &size, data));
|
||||
ret = efi_get_variable_int(varname16, &efi_global_variable_guid,
|
||||
NULL, &size, data, NULL);
|
||||
if (ret == EFI_SUCCESS)
|
||||
show_efi_boot_opt_data(varname16, data, &size);
|
||||
free(data);
|
||||
|
@ -1057,8 +1055,7 @@ static int do_efi_boot_dump(struct cmd_tbl *cmdtp, int flag,
|
|||
var_name16[0] = 0;
|
||||
for (;;) {
|
||||
size = buf_size;
|
||||
ret = EFI_CALL(efi_get_next_variable_name(&size, var_name16,
|
||||
&guid));
|
||||
ret = efi_get_next_variable_name_int(&size, var_name16, &guid);
|
||||
if (ret == EFI_NOT_FOUND)
|
||||
break;
|
||||
if (ret == EFI_BUFFER_TOO_SMALL) {
|
||||
|
@ -1069,9 +1066,8 @@ static int do_efi_boot_dump(struct cmd_tbl *cmdtp, int flag,
|
|||
return CMD_RET_FAILURE;
|
||||
}
|
||||
var_name16 = p;
|
||||
ret = EFI_CALL(efi_get_next_variable_name(&size,
|
||||
var_name16,
|
||||
&guid));
|
||||
ret = efi_get_next_variable_name_int(&size, var_name16,
|
||||
&guid);
|
||||
}
|
||||
if (ret != EFI_SUCCESS) {
|
||||
free(var_name16);
|
||||
|
@ -1114,8 +1110,8 @@ static int show_efi_boot_order(void)
|
|||
efi_status_t ret;
|
||||
|
||||
size = 0;
|
||||
ret = EFI_CALL(efi_get_variable(u"BootOrder", &efi_global_variable_guid,
|
||||
NULL, &size, NULL));
|
||||
ret = efi_get_variable_int(u"BootOrder", &efi_global_variable_guid,
|
||||
NULL, &size, NULL, NULL);
|
||||
if (ret != EFI_BUFFER_TOO_SMALL) {
|
||||
if (ret == EFI_NOT_FOUND) {
|
||||
printf("BootOrder not defined\n");
|
||||
|
@ -1129,8 +1125,8 @@ static int show_efi_boot_order(void)
|
|||
printf("ERROR: Out of memory\n");
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
ret = EFI_CALL(efi_get_variable(u"BootOrder", &efi_global_variable_guid,
|
||||
NULL, &size, bootorder));
|
||||
ret = efi_get_variable_int(u"BootOrder", &efi_global_variable_guid,
|
||||
NULL, &size, bootorder, NULL);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
ret = CMD_RET_FAILURE;
|
||||
goto out;
|
||||
|
@ -1142,9 +1138,9 @@ static int show_efi_boot_order(void)
|
|||
"Boot", bootorder[i]);
|
||||
|
||||
size = 0;
|
||||
ret = EFI_CALL(efi_get_variable(var_name16,
|
||||
&efi_global_variable_guid, NULL,
|
||||
&size, NULL));
|
||||
ret = efi_get_variable_int(var_name16,
|
||||
&efi_global_variable_guid, NULL,
|
||||
&size, NULL, NULL);
|
||||
if (ret != EFI_BUFFER_TOO_SMALL) {
|
||||
printf("%2d: %ls: (not defined)\n", i + 1, var_name16);
|
||||
continue;
|
||||
|
@ -1155,9 +1151,9 @@ static int show_efi_boot_order(void)
|
|||
ret = CMD_RET_FAILURE;
|
||||
goto out;
|
||||
}
|
||||
ret = EFI_CALL(efi_get_variable(var_name16,
|
||||
&efi_global_variable_guid, NULL,
|
||||
&size, data));
|
||||
ret = efi_get_variable_int(var_name16,
|
||||
&efi_global_variable_guid, NULL,
|
||||
&size, data, NULL);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
free(data);
|
||||
ret = CMD_RET_FAILURE;
|
||||
|
@ -1444,10 +1440,9 @@ static int do_efi_query_info(struct cmd_tbl *cmdtp, int flag,
|
|||
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS;
|
||||
}
|
||||
|
||||
ret = EFI_CALL(efi_query_variable_info(attr,
|
||||
&max_variable_storage_size,
|
||||
&remain_variable_storage_size,
|
||||
&max_variable_size));
|
||||
ret = efi_query_variable_info_int(attr, &max_variable_storage_size,
|
||||
&remain_variable_storage_size,
|
||||
&max_variable_size);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
printf("Error: Cannot query UEFI variables, r = %lu\n",
|
||||
ret & ~EFI_ERROR_MASK);
|
||||
|
|
|
@ -130,6 +130,21 @@ void spi_release_bus(struct spi_slave *slave)
|
|||
dm_spi_release_bus(slave->dev);
|
||||
}
|
||||
|
||||
int spi_set_speed(struct spi_slave *slave, uint hz)
|
||||
{
|
||||
struct dm_spi_ops *ops;
|
||||
int ret;
|
||||
|
||||
ops = spi_get_ops(slave->dev->parent);
|
||||
if (ops->set_speed)
|
||||
ret = ops->set_speed(slave->dev->parent, hz);
|
||||
else
|
||||
ret = -EINVAL;
|
||||
if (ret)
|
||||
dev_err(slave->dev, "Cannot set speed (err=%d)\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
|
||||
const void *dout, void *din, unsigned long flags)
|
||||
{
|
||||
|
|
|
@ -570,7 +570,7 @@ efi_status_t efi_net_register(void);
|
|||
/* Called by bootefi to make the watchdog available */
|
||||
efi_status_t efi_watchdog_register(void);
|
||||
efi_status_t efi_initrd_register(void);
|
||||
void efi_initrd_deregister(void);
|
||||
efi_status_t efi_initrd_deregister(void);
|
||||
/* Called by bootefi to make SMBIOS tables available */
|
||||
/**
|
||||
* efi_acpi_register() - write out ACPI tables
|
||||
|
|
|
@ -352,8 +352,10 @@ void spi_cs_deactivate(struct spi_slave *slave);
|
|||
* This sets a new speed to be applied for next spi_xfer().
|
||||
* @slave: The SPI slave
|
||||
* @hz: The transfer speed
|
||||
*
|
||||
* Returns: 0 on success, or a negative value on error.
|
||||
*/
|
||||
void spi_set_speed(struct spi_slave *slave, uint hz);
|
||||
int spi_set_speed(struct spi_slave *slave, uint hz);
|
||||
|
||||
/**
|
||||
* Write 8 bits, then read 8 bits.
|
||||
|
|
|
@ -460,6 +460,20 @@ static efi_status_t EFIAPI efi_cout_set_attribute(
|
|||
return EFI_EXIT(EFI_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_cout_clear_screen() - clear screen
|
||||
*/
|
||||
static void efi_clear_screen(void)
|
||||
{
|
||||
/*
|
||||
* The Linux console wants both a clear and a home command. The video
|
||||
* uclass does not support <ESC>[H without coordinates, yet.
|
||||
*/
|
||||
printf(ESC "[2J" ESC "[1;1H");
|
||||
efi_con_mode.cursor_column = 0;
|
||||
efi_con_mode.cursor_row = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_cout_clear_screen() - clear screen
|
||||
*
|
||||
|
@ -475,13 +489,7 @@ static efi_status_t EFIAPI efi_cout_clear_screen(
|
|||
{
|
||||
EFI_ENTRY("%p", this);
|
||||
|
||||
/*
|
||||
* The Linux console wants both a clear and a home command. The video
|
||||
* uclass does not support <ESC>[H without coordinates, yet.
|
||||
*/
|
||||
printf(ESC "[2J" ESC "[1;1H");
|
||||
efi_con_mode.cursor_column = 0;
|
||||
efi_con_mode.cursor_row = 0;
|
||||
efi_clear_screen();
|
||||
|
||||
return EFI_EXIT(EFI_SUCCESS);
|
||||
}
|
||||
|
@ -510,7 +518,7 @@ static efi_status_t EFIAPI efi_cout_set_mode(
|
|||
return EFI_EXIT(EFI_UNSUPPORTED);
|
||||
|
||||
efi_con_mode.mode = mode_number;
|
||||
EFI_CALL(efi_cout_clear_screen(this));
|
||||
efi_clear_screen();
|
||||
|
||||
return EFI_EXIT(EFI_SUCCESS);
|
||||
}
|
||||
|
@ -536,7 +544,7 @@ static efi_status_t EFIAPI efi_cout_reset(
|
|||
efi_con_mode.attribute = 0x07;
|
||||
printf(ESC "[0;37;40m");
|
||||
/* Clear screen */
|
||||
EFI_CALL(efi_cout_clear_screen(this));
|
||||
efi_clear_screen();
|
||||
|
||||
return EFI_EXIT(EFI_SUCCESS);
|
||||
}
|
||||
|
@ -1351,9 +1359,7 @@ efi_status_t efi_console_get_u16_string(struct efi_simple_text_input_protocol *c
|
|||
ANSI_CLEAR_LINE_TO_END
|
||||
ANSI_CURSOR_SHOW, row, col);
|
||||
|
||||
ret = EFI_CALL(cin->reset(cin, false));
|
||||
if (ret != EFI_SUCCESS)
|
||||
return ret;
|
||||
efi_cin_empty_buffer();
|
||||
|
||||
for (;;) {
|
||||
do {
|
||||
|
|
|
@ -213,7 +213,7 @@ efi_status_t efi_initrd_register(void)
|
|||
&efi_guid_device_path, &dp_lf2_handle,
|
||||
/* LOAD_FILE2 */
|
||||
&efi_guid_load_file2_protocol,
|
||||
(void *)&efi_lf2_protocol,
|
||||
&efi_lf2_protocol,
|
||||
NULL);
|
||||
|
||||
return ret;
|
||||
|
@ -227,11 +227,22 @@ efi_status_t efi_initrd_register(void)
|
|||
*
|
||||
* Return: status code
|
||||
*/
|
||||
void efi_initrd_deregister(void)
|
||||
efi_status_t efi_initrd_deregister(void)
|
||||
{
|
||||
if (!efi_initrd_handle)
|
||||
return;
|
||||
efi_status_t ret;
|
||||
|
||||
efi_delete_handle(efi_initrd_handle);
|
||||
if (!efi_initrd_handle)
|
||||
return EFI_SUCCESS;
|
||||
|
||||
ret = efi_uninstall_multiple_protocol_interfaces(efi_initrd_handle,
|
||||
/* initramfs */
|
||||
&efi_guid_device_path,
|
||||
&dp_lf2_handle,
|
||||
/* LOAD_FILE2 */
|
||||
&efi_guid_load_file2_protocol,
|
||||
&efi_lf2_protocol,
|
||||
NULL);
|
||||
efi_initrd_handle = NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue