Skip to contentSkip to conversation

efi_loader: set OsIndicationsSupported at init

PATCH New Heinrich Schuchardt 2 participants 2 messages Apr 24, 2019 – Apr 25, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 efi_loader: set OsIndicationsSupported at init

From: AKASHI Takahiro <[email protected]>

UEFI variables should be installed using well-defined API. Currently we don't support much, but the value of OsIndicationsSupported will be updated once some features are added in the future.

Add comments. Rename a variable.

---
Applied to efi-2019-07 branch.

---
 cmd/bootefi.c              |  4 ----
 lib/efi_loader/efi_setup.c | 11 +++++++++++
 2 files changed, 11 insertions(+), 4 deletions(-)
cmd/bootefi.c +0 -4
index efaa548be4..b93d8c6a32 100644
@@ -303,10 +303,6 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle)
 	if (ret != EFI_SUCCESS)
 		return ret;
 
-	/* we don't support much: */
-	env_set("efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported",
-		"{ro,boot}(blob)0000000000000000");
-
 	/* Call our payload! */
 	ret = EFI_CALL(efi_start_image(handle, NULL, NULL));
 
lib/efi_loader/efi_setup.c +11 -0
index b32a7b3f93..87db51cbb7 100644
@@ -79,6 +79,7 @@ out:
  */
 efi_status_t efi_init_obj_list(void)
 {
+	u64 os_indications_supported = 0; /* None */
 	efi_status_t ret = EFI_SUCCESS;
 
 	/* Initialize once only */
@@ -90,6 +91,16 @@ efi_status_t efi_init_obj_list(void)
 	if (ret != EFI_SUCCESS)
 		goto out;
 
+	/* Indicate supported features */
+	ret = EFI_CALL(efi_set_variable(L"OsIndicationsSupported",
+					&efi_global_variable_guid,
+					EFI_VARIABLE_BOOTSERVICE_ACCESS |
+					EFI_VARIABLE_RUNTIME_ACCESS,
+					sizeof(os_indications_supported),
+					&os_indications_supported));
+	if (ret != EFI_SUCCESS)
+		goto out;
+
 	/* Initialize system table */
 	ret = efi_initialize_system_table();
 	if (ret != EFI_SUCCESS)

--
2.20.1

#1 lore raw

PATCH v2 1/1 efi_loader: set OsIndicationsSupported at init

Quoted 49 lines · Heinrich Schuchardt

From: AKASHI Takahiro <[email protected]>

UEFI variables should be installed using well-defined API. Currently we don't support much, but the value of OsIndicationsSupported will be updated once some features are added in the future.

Add comments. Rename a variable.

---
Applied to efi-2019-07 branch.

---
 cmd/bootefi.c              |  4 ----
 lib/efi_loader/efi_setup.c | 11 +++++++++++
 2 files changed, 11 insertions(+), 4 deletions(-)
cmd/bootefi.c +0 -4
index efaa548be4..b93d8c6a32 100644
@@ -303,10 +303,6 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle)
 	if (ret != EFI_SUCCESS)
 		return ret;
 
-	/* we don't support much: */
-	env_set("efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported",
-		"{ro,boot}(blob)0000000000000000");
-
 	/* Call our payload! */
 	ret = EFI_CALL(efi_start_image(handle, NULL, NULL));
 
lib/efi_loader/efi_setup.c +1 -0
index b32a7b3f93..87db51cbb7 100644
@@ -79,6 +79,7 @@ out:
  */
 efi_status_t efi_init_obj_list(void)
 {
+	u64 os_indications_supported = 0; /* None */
 	efi_status_t ret = EFI_SUCCESS;
 
 	/* Initialize once only */
@@ -90,6 +91,16 @@ efi_status_t efi_init_obj_list(void)
 	if (ret != EFI_SUCCESS)
 		goto out;
 

lib/efi_loader/efi_setup.c efi_status_t efi_init_obj_list(void) · line 103

Quoted 10 lines
lib/efi_loader/efi_setup.c +10 -0
+	/* Indicate supported features */
+	ret = EFI_CALL(efi_set_variable(L"OsIndicationsSupported",
+					&efi_global_variable_guid,
+					EFI_VARIABLE_BOOTSERVICE_ACCESS |
+					EFI_VARIABLE_RUNTIME_ACCESS,
+					sizeof(os_indications_supported),
+					&os_indications_supported));
+	if (ret != EFI_SUCCESS)
+		goto out;
+

Or should we rename efi_init_platform_lang() to, say, efi_init_vars() and put OsIndcationsSupported in it?

-Takahiro Akashi

Quoted 6 lines
lib/efi_loader/efi_setup.c +0 -1
 	/* Initialize system table */
 	ret = efi_initialize_system_table();
 	if (ret != EFI_SUCCESS)
--

2.20.1