+static char *efi_variables_list;
+static char *efi_cur_variable;
+
+/**
+ * parse_uboot_variable() - parse a u-boot variable and get uefi-related
+ * information
+ * @variable: whole data of u-boot variable (ie. name=value)
+ * @variable_name_size: size of variable_name buffer in byte
+ * @variable_name: name of uefi variable in u16, null-terminated
+ * @vendor: vendor's guid
+ * @attributes: attributes
+ *
+ * A uefi variable is encoded into a u-boot variable as described above.
+ * This function parses such a u-boot variable and retrieve uefi-related
+ * information into respective parameters. In return, variable_name_size
+ * is the size of variable name including NULL.
+ *
+ * Return: EFI_SUCCESS if parsing is OK, EFI_NOT_FOUND when
+ the entire variable list has been returned,
+ otherwise non-zero status code
+ */
+static efi_status_t parse_uboot_variable(char *variable,
+ efi_uintn_t *variable_name_size,
+ u16 *variable_name,
+ const efi_guid_t *vendor,
+ u32 *attributes)
+{
+ char *guid, *name, *end, c;
+ unsigned long name_len;
+ u16 *p;
+
+ guid = strchr(variable, '_');
+ if (!guid)
+ return EFI_INVALID_PARAMETER;
+ guid++;
+ name = strchr(guid, '_');
+ if (!name)
+ return EFI_INVALID_PARAMETER;
+ name++;
+ end = strchr(name, '=');
+ if (!end)
+ return EFI_INVALID_PARAMETER;
+
+ name_len = end - name;
+ if (*variable_name_size < (name_len + 1)) {
+ *variable_name_size = name_len + 1;
+ return EFI_BUFFER_TOO_SMALL;
+ }
+ end++; /* point to value */
+
+ /* variable name */
+ p = variable_name;
+ utf8_utf16_strncpy(&p, name, name_len);
+ variable_name[name_len] = 0;
+ *variable_name_size = name_len + 1;
+
+ /* guid */
+ c = *(name - 1);
+ *(name - 1) = '\0'; /* guid need be null-terminated here */
+ uuid_str_to_bin(guid, (unsigned char *)vendor, UUID_STR_FORMAT_GUID);
+ *(name - 1) = c;
+
+ /* attributes */
+ parse_attr(end, attributes);
+
+ return EFI_SUCCESS;
+}
+
+/**
+ * efi_get_next_variable_name() - enumerate the current variable names
+ * @variable_name_size: size of variable_name buffer in byte
+ * @variable_name: name of uefi variable's name in u16
+ * @vendor: vendor's guid
+ *
+ * This function implements the GetNextVariableName service.
+ *
+ * See the Unified Extensible Firmware Interface (UEFI) specification for
+ * details: http://wiki.phoenix.com/wiki/index.php/
+ * EFI_RUNTIME_SERVICES#GetNextVariableName.28.29
+ *
+ * Return: status code
+ */