Browse Source

Merge tag 'efi-2021-07-rc5-2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2021-07-rc5-2

Documentation:

* man-page for askenv

bug fixes

* correct display of BootOrder in efidebug command
* do not allow TPL_HIGH_LEVEL for CreateEvent(Ex)
* correct handling of unknown properties in SMBIOS tables
Tom Rini 2 years ago
parent
commit
605cbcb0a4

+ 1 - 1
cmd/efidebug.c

@@ -1340,7 +1340,7 @@ static int show_efi_boot_order(void)
 	num = size / sizeof(u16);
 	for (i = 0; i < num; i++) {
 		efi_create_indexed_name(var_name16, sizeof(var_name16),
-					"Boot", i);
+					"Boot", bootorder[i]);
 
 		size = 0;
 		ret = EFI_CALL(efi_get_variable(var_name16,

+ 87 - 0
doc/usage/askenv.rst

@@ -0,0 +1,87 @@
+.. SPDX-License-Identifier: GPL-2.0+:
+
+askenv command
+===============
+
+Synopsis
+--------
+
+::
+
+    askenv name [message] [size]
+
+Description
+-----------
+
+Display message and get environment variable name of max size characters
+from stdin.
+
+name
+    name of the environment variable
+
+message
+    message is displayed while the command waits for the  value to be
+    entered from stdin.if no message is specified,a default message
+    "Please enter name:" will be displayed.
+
+size
+    maximum number of characters that will be stored in environment
+    variable name.this is in decimal number format (unlike in
+    other commands where size values are in hexa-decimal). Default
+    value of size is 1023 (CONFIG_SYS_CBSIZE - 1).
+
+Example
+-------
+
+Value of a environment variable env1 without message and size parameters:
+
+::
+
+    => askenv env1;echo $?
+    Please enter 'env1': val1
+    0
+    => printenv env1
+    env1=val1
+
+Value of a environment variable env2 with message and size parameters:
+
+::
+
+    => askenv env2 Please type-in a value for env2: 10;echo $?
+    Please type-in a value for env2: 1234567890123
+    0
+    => printenv env2
+    env2=1234567890
+
+Value of a environment variable env3 with size parameter only:
+
+::
+
+    => askenv env3 10;echo $?
+    Please enter 'env3': val3
+    0
+    => printenv env3
+    env3=val3
+
+Return Value of askenv command, when used without any other arguments:
+
+::
+
+    => askenv;echo $?
+    askenv - get environment variables from stdin
+
+    Usage:
+    askenv name [message] [size]
+        - display 'message' and get environment variable 'name' from stdin (max 'size' chars)
+    1
+
+Configuration
+-------------
+
+The askenv command is only available if CMD_ASKENV=y
+
+Return value
+------------
+
+The return value $? is set to 0 (true).
+If no other arguments are specified (along with askenv), it is set to 1 (false).

+ 1 - 0
doc/usage/index.rst

@@ -17,6 +17,7 @@ Shell commands
    :maxdepth: 1
 
    addrmap
+   askenv
    base
    bootefi
    booti

+ 1 - 1
include/smbios.h

@@ -60,7 +60,7 @@ struct __packed smbios_entry {
 #define BIOS_CHARACTERISTICS_SELECTABLE_BOOT	(1 << 16)
 
 #define BIOS_CHARACTERISTICS_EXT1_ACPI		(1 << 0)
-#define BIOS_CHARACTERISTICS_EXT1_UEFI		(1 << 3)
+#define BIOS_CHARACTERISTICS_EXT2_UEFI		(1 << 3)
 #define BIOS_CHARACTERISTICS_EXT2_TARGET	(1 << 2)
 
 struct __packed smbios_type0 {

+ 0 - 1
lib/efi_loader/efi_boottime.c

@@ -264,7 +264,6 @@ efi_status_t is_valid_tpl(efi_uintn_t tpl)
 	case TPL_APPLICATION:
 	case TPL_CALLBACK:
 	case TPL_NOTIFY:
-	case TPL_HIGH_LEVEL:
 		return EFI_SUCCESS;
 	default:
 		return EFI_INVALID_PARAMETER;

+ 1 - 1
lib/efi_selftest/efi_selftest_tpl.c

@@ -55,7 +55,7 @@ static int setup(const efi_handle_t handle,
 		return EFI_ST_FAILURE;
 	}
 	ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_WAIT,
-				     TPL_HIGH_LEVEL, notify, NULL, &event_wait);
+				     TPL_NOTIFY, notify, NULL, &event_wait);
 	if (ret != EFI_SUCCESS) {
 		efi_st_error("could not create event\n");
 		return EFI_ST_FAILURE;

+ 17 - 7
lib/smbios.c

@@ -47,7 +47,7 @@ struct smbios_ctx {
  * @addr:	start address to write the structure
  * @handle:	the structure's handle, a unique 16-bit number
  * @ctx:	context for writing the tables
- * @return:	size of the structure
+ * Return:	size of the structure
  */
 typedef int (*smbios_write_type)(ulong *addr, int handle,
 				 struct smbios_ctx *ctx);
@@ -72,7 +72,7 @@ struct smbios_write_method {
  *
  * @ctx:	SMBIOS context
  * @str:	string to add
- * @return:	string number in the string area (1 or more)
+ * Return:	string number in the string area (1 or more)
  */
 static int smbios_add_string(struct smbios_ctx *ctx, const char *str)
 {
@@ -111,7 +111,7 @@ static int smbios_add_string(struct smbios_ctx *ctx, const char *str)
  *
  * @ctx:	context for writing the tables
  * @prop:	property to write
- * @return 0 if not found, else SMBIOS string number (1 or more)
+ * Return:	0 if not found, else SMBIOS string number (1 or more)
  */
 static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop,
 			      int sysinfo_id)
@@ -139,7 +139,7 @@ static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop,
  * smbios_add_prop() - Add a property from the devicetree
  *
  * @prop:	property to write
- * @return 0 if not found, else SMBIOS string number (1 or more)
+ * Return:	0 if not found, else SMBIOS string number (1 or more)
  */
 static int smbios_add_prop(struct smbios_ctx *ctx, const char *prop)
 {
@@ -187,7 +187,7 @@ int smbios_update_version(const char *version)
  * This computes the size of the string area including the string terminator.
  *
  * @ctx:	SMBIOS context
- * @return:	string area size
+ * Return:	string area size
  */
 static int smbios_string_table_len(const struct smbios_ctx *ctx)
 {
@@ -229,9 +229,9 @@ static int smbios_write_type0(ulong *current, int handle,
 	t->bios_characteristics_ext1 = BIOS_CHARACTERISTICS_EXT1_ACPI;
 #endif
 #ifdef CONFIG_EFI_LOADER
-	t->bios_characteristics_ext1 |= BIOS_CHARACTERISTICS_EXT1_UEFI;
+	t->bios_characteristics_ext2 |= BIOS_CHARACTERISTICS_EXT2_UEFI;
 #endif
-	t->bios_characteristics_ext2 = BIOS_CHARACTERISTICS_EXT2_TARGET;
+	t->bios_characteristics_ext2 |= BIOS_CHARACTERISTICS_EXT2_TARGET;
 
 	/* bios_major_release has only one byte, so drop century */
 	t->bios_major_release = U_BOOT_VERSION_NUM % 100;
@@ -258,7 +258,11 @@ static int smbios_write_type1(ulong *current, int handle,
 	fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle);
 	smbios_set_eos(ctx, t->eos);
 	t->manufacturer = smbios_add_prop(ctx, "manufacturer");
+	if (!t->manufacturer)
+		t->manufacturer = smbios_add_string(ctx, "Unknown");
 	t->product_name = smbios_add_prop(ctx, "product");
+	if (!t->product_name)
+		t->product_name = smbios_add_string(ctx, "Unknown Product");
 	t->version = smbios_add_prop_si(ctx, "version",
 					SYSINFO_ID_SMBIOS_SYSTEM_VERSION);
 	if (serial_str) {
@@ -288,7 +292,11 @@ static int smbios_write_type2(ulong *current, int handle,
 	fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle);
 	smbios_set_eos(ctx, t->eos);
 	t->manufacturer = smbios_add_prop(ctx, "manufacturer");
+	if (!t->manufacturer)
+		t->manufacturer = smbios_add_string(ctx, "Unknown");
 	t->product_name = smbios_add_prop(ctx, "product");
+	if (!t->product_name)
+		t->product_name = smbios_add_string(ctx, "Unknown Product");
 	t->version = smbios_add_prop_si(ctx, "version",
 					SYSINFO_ID_SMBIOS_BASEBOARD_VERSION);
 	t->asset_tag_number = smbios_add_prop(ctx, "asset-tag");
@@ -313,6 +321,8 @@ static int smbios_write_type3(ulong *current, int handle,
 	fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle);
 	smbios_set_eos(ctx, t->eos);
 	t->manufacturer = smbios_add_prop(ctx, "manufacturer");
+	if (!t->manufacturer)
+		t->manufacturer = smbios_add_string(ctx, "Unknown");
 	t->chassis_type = SMBIOS_ENCLOSURE_DESKTOP;
 	t->bootup_state = SMBIOS_STATE_SAFE;
 	t->power_supply_state = SMBIOS_STATE_SAFE;