mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 19:11:53 +00:00
efi_loader: define UpdateCapsule api
In this commit, skeleton functions for capsule-related API's are added under CONFIG_EFI_UPDATE_CAPSULE configuration. Detailed implementation for a specific capsule type will be added in the succeeding patches. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
This commit is contained in:
parent
96ec4b1a18
commit
2bc27ca8a0
7 changed files with 316 additions and 54 deletions
|
@ -100,9 +100,9 @@ static efi_status_t efi_init_secure_boot(void)
|
|||
|
||||
ret = efi_set_variable_int(L"SignatureSupport",
|
||||
&efi_global_variable_guid,
|
||||
EFI_VARIABLE_READ_ONLY |
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
||||
EFI_VARIABLE_RUNTIME_ACCESS |
|
||||
EFI_VARIABLE_READ_ONLY,
|
||||
EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
sizeof(signature_types),
|
||||
&signature_types, false);
|
||||
if (ret != EFI_SUCCESS)
|
||||
|
@ -117,6 +117,53 @@ static efi_status_t efi_init_secure_boot(void)
|
|||
}
|
||||
#endif /* CONFIG_EFI_SECURE_BOOT */
|
||||
|
||||
/**
|
||||
* efi_init_capsule - initialize capsule update state
|
||||
*
|
||||
* Return: status code
|
||||
*/
|
||||
static efi_status_t efi_init_capsule(void)
|
||||
{
|
||||
efi_status_t ret = EFI_SUCCESS;
|
||||
|
||||
if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_UPDATE)) {
|
||||
ret = efi_set_variable_int(L"CapsuleMax",
|
||||
&efi_guid_capsule_report,
|
||||
EFI_VARIABLE_READ_ONLY |
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
||||
EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
22, L"CapsuleFFFF", false);
|
||||
if (ret != EFI_SUCCESS)
|
||||
printf("EFI: cannot initialize CapsuleMax variable\n");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_init_os_indications() - indicate supported features for OS requests
|
||||
*
|
||||
* Set the OsIndicationsSupported variable.
|
||||
*
|
||||
* Return: status code
|
||||
*/
|
||||
static efi_status_t efi_init_os_indications(void)
|
||||
{
|
||||
u64 os_indications_supported = 0;
|
||||
|
||||
if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT))
|
||||
os_indications_supported |=
|
||||
EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED;
|
||||
|
||||
return efi_set_variable_int(L"OsIndicationsSupported",
|
||||
&efi_global_variable_guid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
||||
EFI_VARIABLE_RUNTIME_ACCESS |
|
||||
EFI_VARIABLE_READ_ONLY,
|
||||
sizeof(os_indications_supported),
|
||||
&os_indications_supported, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_init_obj_list() - Initialize and populate EFI object list
|
||||
*
|
||||
|
@ -124,7 +171,6 @@ static efi_status_t efi_init_secure_boot(void)
|
|||
*/
|
||||
efi_status_t efi_init_obj_list(void)
|
||||
{
|
||||
u64 os_indications_supported = 0; /* None */
|
||||
efi_status_t ret = EFI_SUCCESS;
|
||||
|
||||
/* Initialize once only */
|
||||
|
@ -168,13 +214,7 @@ efi_status_t efi_init_obj_list(void)
|
|||
goto out;
|
||||
|
||||
/* Indicate supported features */
|
||||
ret = efi_set_variable_int(L"OsIndicationsSupported",
|
||||
&efi_global_variable_guid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
||||
EFI_VARIABLE_RUNTIME_ACCESS |
|
||||
EFI_VARIABLE_READ_ONLY,
|
||||
sizeof(os_indications_supported),
|
||||
&os_indications_supported, false);
|
||||
ret = efi_init_os_indications();
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto out;
|
||||
|
||||
|
@ -233,6 +273,10 @@ efi_status_t efi_init_obj_list(void)
|
|||
if (ret != EFI_SUCCESS)
|
||||
goto out;
|
||||
|
||||
ret = efi_init_capsule();
|
||||
if (ret != EFI_SUCCESS)
|
||||
goto out;
|
||||
|
||||
/* Initialize EFI runtime services */
|
||||
ret = efi_reset_system_init();
|
||||
if (ret != EFI_SUCCESS)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue