From patchwork Fri Mar 27 05:27:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1262559 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.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=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=DSB/EdX/; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48pVln4fDLz9sR4 for ; Fri, 27 Mar 2020 16:29:25 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1D93A818AA; Fri, 27 Mar 2020 06:28:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="DSB/EdX/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 828C481869; Fri, 27 Mar 2020 06:28:34 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 526CA8185A for ; Fri, 27 Mar 2020 06:28:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1585286890; bh=CPCUqQVaRSV70jykFYIIIGtCsDVuNXpG3jkThGtAiXA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=DSB/EdX/BFQ00oKKnTUOOH1e/RQHFEN/f3x10mmK+1xITzv9l1YBFeEhvAxs8eFaP gSeNTy60tVda/3X/cbNrUy9wCxX78Go6Sjv0WptbdVpY4HmxBfcayOwPgNOlQBqdN3 xmQbpnSWUqCq8BZrItiogy1FyRrWK2lcaokIuYy0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.119.33.226]) by mail.gmx.com (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MGyxX-1j4pMg35c3-00E4r6; Fri, 27 Mar 2020 06:28:09 +0100 From: Heinrich Schuchardt To: Alexander Graf , AKASHI Takahiro Cc: Ilias Apalodimas , Sughosh Ganu , Alexey Brodkin , Paul Emge , Faiz Abbas , Eugeniu Rosca , Urja Rannikko , Kever Yang , Simon Glass , Alistair Strachan , Ruslan Trofymenko , Igor Opaniuk , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 00/16] efi_loader: non-volatile and runtime variables Date: Fri, 27 Mar 2020 06:27:44 +0100 Message-Id: <20200327052800.11022-1-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Provags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rD//okYPno/YpcVVfuWXSZ9x Sk3f42hk2dmP+MF1GwvuVG4u+MkOyFDa3hBrW/3LTuVqmTPEsce1pLEOHe9zvbGoQaTPNq3wK 7bIK7u2PqLPtAuf1BUrEjj5FgS5hJ7bNeqbf0Jr5jPsJoAgFqzNR8KyW787qPjdxLjL7DiVKr 3lcqmQ2viHPDh2kkqAl3TDCVnHxc/CyGjvGUQfFvGJV6CsFAuRfA+3Bo0K0WPYQSe+z5oiOBV RYtRCGVt+T53LfpyQT/aB2LVNOTNuxbb0hyHJLTK/XlYn9wCYcztr2MK4DJqGrlnheHYixG19 h9pN1Vz8SI8OdH8jYUHs5GXTpPvg366rJdXOiTfhOexMXvv9N9j+Bcq7bM7l/KyBgtDUPR10S ++fwd4m0V/Q2wLykHdb9jSKiQA3HyQQ1Q/Fp64w1RmLm/JKpMYCUQiA/IzF/hPxaCnDdSN78O tQB0Reoqqhg01qsi7 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean Up to UEFI variable where stored in U-Boot environment variables. Saving UEFI variables was not possible without saving the U-Boot environment variables. With this patch series file ubootefi.var in the EFI system partition is used for saving UEFI variables. Furthermore the UEFI variables are exposed at runtime and are writable at runtime. The missing piece is transferring the variable changed at runtime back to the firmware. I will evaluate the following options: * using a fixed memory address: we could read the memory area after a reboot * using a systemd service which is called before the system goes down Many of the CCs are due to the changes in disk/part_efi.c. Here the logic to detect the EFI system partition is introduced (patch 04/16). Heinrich Schuchardt (16): cmd: efidebug: fix int to pointer cast efi_loader: only reserve memory if fdt node enabled efi_loader: eliminate EFI_CALL() for variable access part: detect EFI system partition efi_loader: identify EFI system partition efi_loader: keep attributes in efi_set_variable_int() efi_loader: export initialization state efi_loader: change setup sequence efi_loader: imply FAT, FAT_WRITE efi_loader: UEFI variable persistence efi_loader: export efi_convert_pointer() efi_loader: optional pointer for ConvertPointer efi_loader: memory buffer for variables efi_loader: use memory based variable storage efi_loader: enable UEFI variables at runtime efi_selftest: adjust runtime test for variables cmd/bootefi.c | 3 +- cmd/efidebug.c | 71 +- cmd/nvedit_efi.c | 18 +- disk/part_dos.c | 10 +- disk/part_efi.c | 12 +- include/efi_api.h | 2 + include/efi_loader.h | 22 + include/efi_variable.h | 52 ++ include/part.h | 11 +- lib/efi_loader/Kconfig | 10 + lib/efi_loader/Makefile | 2 + lib/efi_loader/efi_bootmgr.c | 20 +- lib/efi_loader/efi_disk.c | 20 + lib/efi_loader/efi_runtime.c | 20 +- lib/efi_loader/efi_setup.c | 54 +- lib/efi_loader/efi_variable.c | 635 ++++++------------ lib/efi_loader/efi_variables_file.c | 235 +++++++ lib/efi_loader/efi_variables_mem.c | 324 +++++++++ .../efi_selftest_variables_runtime.c | 47 +- 19 files changed, 1037 insertions(+), 531 deletions(-) create mode 100644 include/efi_variable.h create mode 100644 lib/efi_loader/efi_variables_file.c create mode 100644 lib/efi_loader/efi_variables_mem.c --- 2.25.1