Lines Matching +full:name +full:- +full:prefix

1 // SPDX-License-Identifier: GPL-2.0+
19 * Mapping between EFI variables and u-boot variables:
25 * efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported=
27 * efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_BootOrder=
33 * + ro - read-only
34 * + boot - boot-services access
35 * + run - runtime access
44 * + utf8 - raw utf8 string
45 * + blob - arbitrary length hex string
51 #define PREFIX_LEN (strlen("efi_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx_"))
54 * efi_to_native() - convert the UEFI variable name and vendor GUID to U-Boot
55 * variable name
57 * The U-Boot variable name is a concatenation of prefix 'efi', the hexstring
58 * encoded vendor GUID, and the UTF-8 encoded UEFI variable name separated by
59 * underscores, e.g. 'efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_BootOrder'.
61 * @native: pointer to pointer to U-Boot variable name
62 * @variable_name: UEFI variable name
85 * prefix() - skip over prefix
87 * Skip over a prefix string.
89 * @str: string with prefix
90 * @prefix: prefix string
91 * Return: string without prefix, or NULL if prefix not found
93 static const char *prefix(const char *str, const char *prefix) in prefix() argument
95 size_t n = strlen(prefix); in prefix()
96 if (!strncmp(prefix, str, n)) in prefix()
102 * parse_attr() - decode attributes part of variable value
107 * @str: value of U-Boot variable
109 * Return: pointer to remainder of U-Boot variable value
126 if ((s = prefix(str, "ro"))) { in parse_attr()
128 } else if ((s = prefix(str, "boot"))) { in parse_attr()
130 } else if ((s = prefix(str, "run"))) { in parse_attr()
149 * efi_efi_get_variable() - retrieve value of a UEFI variable
156 * @variable_name: name of the variable
194 if ((s = prefix(val, "(blob)"))) { in efi_get_variable()
215 } else if ((s = prefix(val, "(utf8)"))) { in efi_get_variable()
245 * parse_uboot_variable() - parse a u-boot variable and get uefi-related
247 * @variable: whole data of u-boot variable (ie. name=value)
249 * @variable_name: name of uefi variable in u16, null-terminated
253 * A uefi variable is encoded into a u-boot variable as described above.
254 * This function parses such a u-boot variable and retrieve uefi-related
256 * is the size of variable name including NULL.
260 otherwise non-zero status code
268 char *guid, *name, *end, c; in parse_uboot_variable() local
276 name = strchr(guid, '_'); in parse_uboot_variable()
277 if (!name) in parse_uboot_variable()
279 name++; in parse_uboot_variable()
280 end = strchr(name, '='); in parse_uboot_variable()
284 name_len = end - name; in parse_uboot_variable()
291 /* variable name */ in parse_uboot_variable()
293 utf8_utf16_strncpy(&p, name, name_len); in parse_uboot_variable()
298 c = *(name - 1); in parse_uboot_variable()
299 *(name - 1) = '\0'; /* guid need be null-terminated here */ in parse_uboot_variable()
301 *(name - 1) = c; in parse_uboot_variable()
310 * efi_get_next_variable_name() - enumerate the current variable names
312 * @variable_name: name of uefi variable's name in u16
341 /* check null-terminated string */ in efi_get_next_variable_name()
348 /* search for the last-returned variable */ in efi_get_next_variable_name()
382 snprintf(regex, 256, "efi_.*-.*-.*-.*-.*_.*"); in efi_get_next_variable_name()
400 * efi_efi_set_variable() - set value of a UEFI variable
407 * @variable_name: name of the variable
470 u32 attr = 1 << (ffs(attributes) - 1); in efi_set_variable()