From patchwork Mon Jun 24 05:31:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1121080 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="c1jzsghG"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45XJ5T1nvyz9s5c for ; Mon, 24 Jun 2019 15:39:41 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id EDDDCC21F1B; Mon, 24 Jun 2019 05:38:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 6A52DC21F3A; Mon, 24 Jun 2019 05:38:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B5064C21F48; Mon, 24 Jun 2019 05:36:53 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lists.denx.de (Postfix) with ESMTPS id 5B0A2C21F2F for ; Mon, 24 Jun 2019 05:36:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1561354613; bh=STGbSBHEHW/G1iCc/bsoMJNErjHA9rohc6OPi5HfH3c=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=c1jzsghGkCEtRpolcITOigz6wqyrhtPfTwYTPwUPijWm+RK+ZDg7mEOFSpmge5ntD Ody5Kyy6RQ0+gIMUJ42a9owfoLlDErmRYbHFWlm5PHIbxUB1uSNHD9V7dQ/tMxYbpX 83reUgURfJQAalLvXHAYRHxSMZsWc0cv8Sqp8MSk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1ML9yc-1hxMh523He-00IEA6; Mon, 24 Jun 2019 07:31:41 +0200 From: Heinrich Schuchardt To: Alexander Graf Date: Mon, 24 Jun 2019 07:31:03 +0200 Message-Id: <20190624053116.18669-3-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190624053116.18669-1-xypron.glpk@gmx.de> References: <20190624053116.18669-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:5RM4pBQCAeKsdO71V5c7uavp9HOsCooiP84wfF7N3d40Ddsl5eC XfB7+zizyHkSZ3TTTF/bTwSJ8lulQCN4HvInDolypRB+B4nG0kvvdkfcfvrNnNk0wAoJZpz NIix8cfZpDlSY6zTefGg6pjgq/S6ETDKDsA37GT8QHGd1QN3mOM2q7r2IlTcIhCrgBrokkW eKxt8TuzYQJqd3oBG8k7w== X-UI-Out-Filterresults: notjunk:1; V03:K0:ddu1A12hg38=:er+U1YES3THi8RdZePeFe0 NwfN9BgcDiAYb4eVKJ+O4nVTDOS2SDpJ8qjKK74X8QpH9efHxc+b1ilBv9/h/stFWV3UC2UOJ 5IqNSdAbNxmsci/CBf/gIsWbomngkKFv4FdHaFvAi01oUJfWcztUZ60OyPJOuIk5lXPGVmDsH vOg1lTzpJGw8KANzvmyRWhzGcbD2xgd/q70jNP7QOnxCuth764BKpj9G+3hzFy0cXJlG4b7hQ isyG50BJstXAMofNNZyrHZuUfTO5QPpUzAct4VOw2PVOdFeVkRHF9oXS2uZXTTxTGdgAszrcp xpxik32H3mdaJaVJ/whhddkJk6m+9svMtnR9TC+j0iTrhZ6Pr7rYd1EwwhJbEi1vsYVOFxstO gdUbB02Cz4OAXaFcnDPF/llI6hUsLw6rlziZrl2CzSg4gXDEtXIglox8qHuadHwzS6EK5kTuk 6MR9TmX1bsTYjoW8FZ8rvOWUwWJTDfn5IeUPpvhz6GUdbir7nzkgGWQyu+uaSUt1Bj8mzHiPW PdGRZaG7g6WIwGwYi/XsPtlWFxG+SO/umv5xGysMu/EUDEVGgpRwKdnhTx/dIhQTBihmHFaD0 S9MTdlKESSVONFZiy+qjg0+EpcLkhoKesMtU3Wl5I8mZW6GPPuo1q0mJTc13/bTIzqux2Atyc LkzCfMcjgjbfxC8FBKsqpNhvey3gPbvStb+MaUDV+M7cUVLZMJN3kxcuTwJHrV+J6xqL7LsVV h+6hxE72sVpQpXaprY2sNYYFBhX78+5UFNPktltcsOvwQRqfNEW9k95GSzTn/E8UFYH8zFAz4 l8r5odBtpIuoEXLFR0qUk6pVhXtA476TvJeINnhS8vpa6aHOdGdgq7rHS8mtpf5PFRL+bvbHl 0JeBEcQzFZrGNFNL3lltcEk0p8tz3L+H4HebTuzl9jTiDKdM1Of83lEwWrse6H+6MbVQ/qXGA uMBufIhf+9AmH7XjefbS8zlUnUpJfOtM= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH 2/7] efi_debug: make variable support customizable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Provide a customization option to define how UEFI variables are implemented. This patch provides a dummy implementation without any variable support and provides the choice between this dummy and the legacy implementation. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/Kconfig | 18 ++++++ lib/efi_loader/Makefile | 3 +- lib/efi_loader/efi_setup.c | 10 +++- lib/efi_loader/efi_variable_null.c | 96 ++++++++++++++++++++++++++++++ lib/efi_selftest/Makefile | 5 +- 5 files changed, 128 insertions(+), 4 deletions(-) create mode 100644 lib/efi_loader/efi_variable_null.c -- 2.20.1 diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index cd5436c576..97c2ca9820 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -34,6 +34,24 @@ config EFI_SET_TIME Provide the SetTime() runtime service at boottime. This service can be used by an EFI application to adjust the real time clock. +choice + prompt "Variable storage" + default EFI_VARIABLES_UBOOT + help + Define where UEFI variables are stored. + +config EFI_VARIABLES_UBOOT + bool "U-Boot environment" + help + UEFI variables are stored in the U-Boot environment. + +config EFI_VARIABLES_NULL + bool "UEFI variables are not available" + help + UEFI variables are not supported. + +endchoice + config EFI_DEVICE_PATH_TO_TEXT bool "Device path to text protocol" default y diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 01769ea58b..e244aee2f5 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -31,7 +31,8 @@ obj-y += efi_root_node.o obj-y += efi_runtime.o obj-y += efi_setup.o obj-$(CONFIG_EFI_UNICODE_COLLATION_PROTOCOL2) += efi_unicode_collation.o -obj-y += efi_variable.o +obj-$(CONFIG_EFI_VARIABLES_UBOOT) += efi_variable.o +obj-$(CONFIG_EFI_VARIABLES_NULL) += efi_variable_null.o obj-y += efi_watchdog.o obj-$(CONFIG_LCD) += efi_gop.o obj-$(CONFIG_DM_VIDEO) += efi_gop.o diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c index bfb57836fa..a3f59506d8 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -22,6 +22,8 @@ void __weak allow_unaligned(void) { } +#ifndef CONFIG_EFI_VARIABLES_NULL + /** * efi_init_platform_lang() - define supported languages * @@ -82,6 +84,8 @@ out: return ret; } +#endif + /** * efi_init_obj_list() - Initialize and populate EFI object list * @@ -89,7 +93,9 @@ out: */ efi_status_t efi_init_obj_list(void) { +#ifndef CONFIG_EFI_VARIABLES_NULL u64 os_indications_supported = 0; /* None */ +#endif efi_status_t ret = EFI_SUCCESS; /* Initialize once only */ @@ -101,7 +107,7 @@ efi_status_t efi_init_obj_list(void) /* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */ switch_to_non_secure_mode(); - +#ifndef CONFIG_EFI_VARIABLES_NULL /* Define supported languages */ ret = efi_init_platform_lang(); if (ret != EFI_SUCCESS) @@ -121,7 +127,7 @@ efi_status_t efi_init_obj_list(void) ret = efi_init_runtime_supported(); if (ret != EFI_SUCCESS) goto out; - +#endif /* Initialize system table */ ret = efi_initialize_system_table(); if (ret != EFI_SUCCESS) diff --git a/lib/efi_loader/efi_variable_null.c b/lib/efi_loader/efi_variable_null.c new file mode 100644 index 0000000000..f4c96c90a3 --- /dev/null +++ b/lib/efi_loader/efi_variable_null.c @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Dummy driver for UEFI variables. None of the variable services is supported. + * + * Copyright (c) 2019 Heinrich Schuchardt + */ + +#include + +/** + * efi_get_variable() - retrieve value of a UEFI variable + * + * This function implements the GetVariable runtime service. + * + * See the Unified Extensible Firmware Interface (UEFI) specification for + * details. + * + * @variable_name: name of the variable + * @vendor: vendor GUID + * @attributes: attributes of the variable + * @data_size: size of the buffer to which the variable value is copied + * @data: buffer to which the variable value is copied + * Return: status code + */ +efi_status_t __efi_runtime EFIAPI +efi_get_variable(u16 *variable_name, const efi_guid_t *vendor, u32 *attributes, + efi_uintn_t *data_size, void *data) +{ + return EFI_UNSUPPORTED; +} + +/** + * 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 + */ +efi_status_t __efi_runtime EFIAPI +efi_get_next_variable_name(efi_uintn_t *variable_name_size, u16 *variable_name, + const efi_guid_t *vendor) +{ + return EFI_UNSUPPORTED; +} + +/** + * efi_set_variable() - set value of a UEFI variable + * + * This function implements the SetVariable runtime service. + * + * See the Unified Extensible Firmware Interface (UEFI) specification for + * details. + * + * @variable_name: name of the variable + * @vendor: vendor GUID + * @attributes: attributes of the variable + * @data_size: size of the buffer with the variable value + * @data: buffer with the variable value + * Return: status code + */ +efi_status_t __efi_runtime EFIAPI +efi_set_variable(u16 *variable_name, const efi_guid_t *vendor, u32 attributes, + efi_uintn_t data_size, const void *data) +{ + return EFI_UNSUPPORTED; +} + +/** + * efi_query_variable_info() - query information the variable store + * + * This function implements the QueryVariableInfo runtime service. + * + * See the Unified Extensible Firmware Interface (UEFI) specification for + * details. + * + * @attributes: type of variables for which info shall + * be provided + * @maximum_variable_storage_size: total available storage for variables + * @remaining_variable_storage_size: remaining available storage + * @maximum_variable_size: maximum size of a variable + * Return: status code + */ +efi_status_t __efi_runtime EFIAPI +efi_query_variable_info(u32 attributes, u64 *maximum_variable_storage_size, + u64 *remaining_variable_storage_size, + u64 *maximum_variable_size) +{ + return EFI_UNSUPPORTED; +} diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index 3bebd0f573..bb3ebd7fa7 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -34,7 +34,6 @@ efi_selftest_textinputex.o \ efi_selftest_textoutput.o \ efi_selftest_tpl.o \ efi_selftest_util.o \ -efi_selftest_variables.o \ efi_selftest_watchdog.o obj-$(CONFIG_EFI_DEVICE_PATH_TO_TEXT) += efi_selftest_devicepath.o @@ -45,6 +44,10 @@ obj-$(CONFIG_CPU_V7) += efi_selftest_unaligned.o obj-$(CONFIG_EFI_LOADER_HII) += efi_selftest_hii.o obj-$(CONFIG_EFI_GET_TIME) += efi_selftest_rtc.o +ifeq ($(CONFIG_EFI_VARIABLES_NULL),) +obj-y += efi_selftest_variables.o +endif + ifeq ($(CONFIG_GENERATE_ACPI_TABLE),) obj-y += efi_selftest_fdt.o endif