From patchwork Sat Jul 6 19:46:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1128519 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="fAKMoN2v"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45h2M44qxSz9sN4 for ; Sun, 7 Jul 2019 05:48:16 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 3B392C21C57; Sat, 6 Jul 2019 19:47:38 +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 DF999C21D83; Sat, 6 Jul 2019 19:47:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 457F7C21BE5; Sat, 6 Jul 2019 19:47:05 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by lists.denx.de (Postfix) with ESMTPS id 8B347C21C2C for ; Sat, 6 Jul 2019 19:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562442422; bh=vrEfla7SvTTh0/gMg1/ImZj6Tj6jCWgPQQOe5pVisGQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=fAKMoN2vyHCEXB3ncBmRI8KpsCKD2sdmWej7J7kENvlZXx+edR4gKooKu0g0iBFwp XZfiOe0SqFDEe3QXQJa75etp+hoZXtLlkUrmwZQQX7h5TE2Rjjq6hboYsoNmFS1rVD +KYVD5exe2H5L17i/7ueccaDtil362C0tma7/SBM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0M20Jj-1idSAv0DRD-00u0Dq; Sat, 06 Jul 2019 21:47:02 +0200 From: Heinrich Schuchardt To: Alexander Graf , AKASHI Takahiro Date: Sat, 6 Jul 2019 21:46:22 +0200 Message-Id: <20190706194634.3349-2-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190706194634.3349-1-xypron.glpk@gmx.de> References: <20190706194634.3349-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Bu2PN+tOnB53/yjJfGAiSEXA8zoVC6dRZNMf4dVzTij9YoOYsXE 5qB3uYsa1AyxPEL2fpxrcFns25bQwMoxJMhNwzJIadCjVZBt7d+bzHbU8anoBLUFtP3FY0G bORVqiUubo45jwfQKaCsj4Gt5mYhQhArvtl6PCSYiES+RXbyOH44qvpYF5Srpf4IBWiA36o /RuwgrZnwlMM9AdAoBOTw== X-UI-Out-Filterresults: notjunk:1; V03:K0:9ms0mUL+0eQ=:+oWecnzqPcDC4+Ur4Yz/Mm Nj/h4gXEypz/z/cV6mUnSf8npfSA4eNggXzjNRbiw8BSES/zJ49P9JUQZF2aZXwtRcEbeLdfq 4/UU9YGsbA6HANz5iJ5oH/wcINTp5Lb42pEpl8Y3Jf4G8czS4xez0gnXZcL9QROrc47bWX8pq ODI8jYf/WuKbsAwX41ldEItA4OaZSyTr8HT3/vsWMnTCOS/23t1myl+8gD/hGQkFIrj45/Dm0 R7UaHEDtSzfZiigdP60gJHIPFsnc8QdgvHwcoHtPTcq1vsun3b9X9agMNamsA/KdT9yasI09V CGDpwW+TsYitGgEE2JhdwEsSCcdJ21CYgcQziLUVibkxo/eOX3m6YOD2hWR1nzzQi0yo+8VQg wXt0F1cbOxRP5vLW+Ivixt7JuSHgrU3JBSF4YdDAoxU+4bnfBSghD6YoV8WPVBK4C//LJ524P jQdv43FD4isdUk2DnGJA+ui/FmkvSlUCK5G3ENjOuuAHmSoEduY6znMbDGymTkCIu+CIBqJ0E YjTJ17rE3HNhr2VJzlM+2B1xvFl+bNTDMlZQ7qdQX+BiM7bU2x+L4Y8o9f/Q1lpdnK4gcpYaY 4YeD461dCQEeDA7l8MhRee1V7n6DsdSA/ejKcUCf4pRxfPQxcFi1dalQBgtKFGTPx8Ftl/u1F k7zsaAVPkHy3bdUQ3wIyFqC8JuxmCxCo3KMzQ9Uw2GSxnXADnia3tIF2TP8CaxiDDxpLhYZXB GrfMLlx1XL1rIYoqrUCGr1vEfCYShUAzQN0e5cdg5deVnLIZjFEcbD84UbtX66y5Snm7SOpH5 whIlQi5sf0HKW3u2tBP8JIJA58IKWq4F+SJTT/QRdahIOWXEN0QPnUTbeV948EbvmIgzBvoTC tLsmTzbG4EdbDxxPyY5fpwbp5TP/TYEMZSGf2IVOkjHeAcpOiuUcZf/6Vv2g6LBUZ5+KUcuS2 OITv0lDj2EEGxyxaJZx+wh7wPLE/fMS0nVaUOBTdqdZBxdH4Hoo3z/Wbf2E4xuefEmhN60w9c iqh1JpNg4quwarUuGqZuKOgIM+dbwMpXvWkVPcZ30zg2pfJRPIb/4RAR1zyOdNtfhKWtCkbiD MwHo3s5ycczI70= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 01/13] efi_loader: move efi_query_variable_info() 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" Let's keep similar things together. Move efi_query_variable_info() to lib/efi_loader/efi_variable.c Signed-off-by: Heinrich Schuchardt --- v3 no change v2 no change --- include/efi_loader.h | 5 +++++ lib/efi_loader/efi_runtime.c | 27 --------------------------- lib/efi_loader/efi_variable.c | 27 +++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 27 deletions(-) -- 2.20.1 diff --git a/include/efi_loader.h b/include/efi_loader.h index b07155cecb..de1e67fd40 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -618,6 +618,11 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name, const efi_guid_t *vendor, u32 attributes, efi_uintn_t data_size, const void *data); +efi_status_t EFIAPI efi_query_variable_info( + u32 attributes, u64 *maximum_variable_storage_size, + u64 *remaining_variable_storage_size, + u64 *maximum_variable_size); + /* * See section 3.1.3 in the v2.7 UEFI spec for more details on * the layout of EFI_LOAD_OPTION. In short it is: diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 40fdc0ea92..dd91880ad6 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -782,33 +782,6 @@ efi_status_t __efi_runtime EFIAPI efi_query_capsule_caps( return EFI_UNSUPPORTED; } -/** - * efi_query_variable_info() - get information about EFI variables - * - * This function implements the QueryVariableInfo() runtime service. - * - * See the Unified Extensible Firmware Interface (UEFI) specification for - * details. - * - * @attributes: bitmask to select variables to be - * queried - * @maximum_variable_storage_size: maximum size of storage area for the - * selected variable types - * @remaining_variable_storage_size: remaining size of storage are for the - * selected variable types - * @maximum_variable_size: maximum size of a variable of the - * selected type - * Returns: 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; -} - struct efi_runtime_services __efi_runtime_data efi_runtime_services = { .hdr = { .signature = EFI_RUNTIME_SERVICES_SIGNATURE, diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index d6b75ca02e..f71dc29ee9 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -520,3 +520,30 @@ out: return EFI_EXIT(ret); } + +/** + * efi_query_variable_info() - get information about EFI variables + * + * This function implements the QueryVariableInfo() runtime service. + * + * See the Unified Extensible Firmware Interface (UEFI) specification for + * details. + * + * @attributes: bitmask to select variables to be + * queried + * @maximum_variable_storage_size: maximum size of storage area for the + * selected variable types + * @remaining_variable_storage_size: remaining size of storage are for the + * selected variable types + * @maximum_variable_size: maximum size of a variable of the + * selected type + * Returns: 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; +} From patchwork Sat Jul 6 19:46:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1128521 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="ZG1xcFHp"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45h2Mz07Pfz9sN4 for ; Sun, 7 Jul 2019 05:49:02 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 60FA7C21C3F; Sat, 6 Jul 2019 19:48:29 +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 5EA3EC21E0D; Sat, 6 Jul 2019 19:47:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 96469C21BE5; Sat, 6 Jul 2019 19:47:05 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by lists.denx.de (Postfix) with ESMTPS id 89393C21BE5 for ; Sat, 6 Jul 2019 19:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562442422; bh=yIQJRUhs0dtcmtonl4Qqz4loC3C1s+yueq3cEOCpqqo=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ZG1xcFHpII4riE/6tQo2CvyaFaRHoPbZ9vq34dEc4TJp+2+ZTk9+ZEaiVCfoviAXw 83041U4FMDUwl7WeHd3r9V14hk77eJVPw9BNznPKz9heGXzTDYlP6igedeNXb/uLe7 cobeAx8fBCl40hQxQ0xNydCKMAwVHRpI5ggZJTHU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0LvQkh-1iSQbt1BJb-010Yjq; Sat, 06 Jul 2019 21:47:02 +0200 From: Heinrich Schuchardt To: Alexander Graf , AKASHI Takahiro Date: Sat, 6 Jul 2019 21:46:23 +0200 Message-Id: <20190706194634.3349-3-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190706194634.3349-1-xypron.glpk@gmx.de> References: <20190706194634.3349-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:CE/IdwNDrfIY1yHAoNq9wTILNUNB9p9Qm+YDdwPlaupDaw1VHeA W5zxumlPCCNELkZu7Q2iPItjZC4nfmd81qGEXhTu0HZQpeXFgDidPxv0ZhatZ4/5duYSnTY SUMJLQbBrCNFZjJ5mPM60ekXoEIwso6zHuMye/ucMeKg7JsmoraYX3TdL4MNO2vo4r0ihMF 2KwSOx2z3C0PKtEBy0puA== X-UI-Out-Filterresults: notjunk:1; V03:K0:diUjFJl9Nts=:rSc8SH3Q31B6U4BDZbxtlB pKNVdp+M1XPQhQx+/2EiQo7vEuzep55rFQWmpmxtaG55dg2VlMtIjPxio9EwboCx6Lg20gG2H NeYnecbVbiJYMT131PDVTA1XI80Eo6y2ctI1c61Rc4J7cl51nvnHhKz9CgDIg2ZUo6gvZ2IVx dugjmrG1p9Mu3Ik21/y1nvDH+K6NoFOWnxoWFu0XatKpBmBTUnsuzIXgWjsQFTOrTagvU8e2Q oRtPbKb+07CXf5sLwPW467L9qZXfMamufM1oyRmtUm4HgrHdEog1bz/KzXNvU/CKqtlXMJk/T sHWIIROXijLMclnhyJpXfqju7LE5WBPUUtXcpkwqinlprMtw1tciXylPOLpnUaOTUmcM77WtF JW/ok5nY/6ZyiPQ9rl9OSiTLGO3gSqV6Rs7dHpgdVvKbTFumJWBvEK5eRHzFGK/mQfj95EWjF Y65HCB9DrzDaaX9OvO3X9JiZvAxp7sFgE4A3lc0A3Bf4jteYl0UCTNBi45V/NHhN0pzwUFy3k XzOEXFQUzh9FAQ8goW95BMAQD5DQmS0nlcZUmY8ZxJHs2nN4nFhQdRkWz2eC4Xc60Y7Jr0Fi9 nkV0P0nk5C8foUrKV5SmE95BIz5s24al82KpO3udzsHQgHXh1wm8iyQSs+m5MHBU/vfQtKEau NhTD1studHJn5Mq5n2hfVhDVtimnCNRyBwl1ujHhormjlgNjiBpkUO93+qTW/c0NXPnaBib8o Vx4e0BjvI890qkK+1Km17MVq6VsJ4lgStm9x6sC6s4qzAF36Jg8sxSfWKDXoz5q5GPa6s1Y1R hRV6fnXxX4xuFor/wVSjxv73kpSyVnlyksoDNCGPh1wrYb5OXAyp8aG28U/Y0iaxixo7Oft7C FnK0oJhqBOKNpH3Tv1S78OJxj0Ahr1FZvnYZpTNNuc301oB9eS+B16Of1R0jrXzMCCbxWz2Ch v9aMA7Uzd21hp3tMInFrY5Ryx+L5mLkDyI6TLjBOVXN513dZayXwaRtyIRef8Oon4vo/zNIXF 3TVp91y4WfH9rt1N7xWSynuuBgZGKBJQs+1OyfVQsIXsBT34MngFHnZCKi7BrQ7wiZ/tGQtXc VhTaYYVdv408rk= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 02/13] efi_loader: initialization of variable services 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 an initialization routine for variable services. Signed-off-by: Heinrich Schuchardt --- v3 no change v2 rebase patch --- include/efi_loader.h | 2 ++ lib/efi_loader/efi_setup.c | 5 +++++ lib/efi_loader/efi_variable.c | 10 ++++++++++ 3 files changed, 17 insertions(+) -- 2.20.1 diff --git a/include/efi_loader.h b/include/efi_loader.h index de1e67fd40..d30c4e8ef3 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -325,6 +325,8 @@ extern struct list_head efi_register_notify_events; /* Initialize efi execution environment */ efi_status_t efi_init_obj_list(void); +/* Initialize variable services */ +efi_status_t efi_init_variables(void); /* Called by bootefi to initialize root node */ efi_status_t efi_root_node_register(void); /* Called by bootefi to initialize runtime */ diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c index bfb57836fa..de7b616c6d 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -102,6 +102,11 @@ 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(); + /* Initialize variable services */ + ret = efi_init_variables(); + if (ret != EFI_SUCCESS) + goto out; + /* Define supported languages */ ret = efi_init_platform_lang(); if (ret != EFI_SUCCESS) diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index f71dc29ee9..6210425f5e 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -547,3 +547,13 @@ efi_status_t __efi_runtime EFIAPI efi_query_variable_info( { return EFI_UNSUPPORTED; } + +/** + * efi_init_variables() - initialize variable services + * + * Return: status code + */ +efi_status_t efi_init_variables(void) +{ + return EFI_SUCCESS; +} From patchwork Sat Jul 6 19:46:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1128525 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="BlzZHav1"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45h2Q74yCkz9sN4 for ; Sun, 7 Jul 2019 05:50:55 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 4354FC21DA1; Sat, 6 Jul 2019 19:48:55 +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 833C5C21C6A; Sat, 6 Jul 2019 19:47:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BD308C21C2C; Sat, 6 Jul 2019 19:47:05 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lists.denx.de (Postfix) with ESMTPS id 99F51C21C51 for ; Sat, 6 Jul 2019 19:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562442422; bh=yaJBZ26OQsN+oIwte1OYycoVUv1mMbAG94yaEIgIM1U=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=BlzZHav1GTPwm6XSczqmbe1DgvNBgzBlX/nwd5S95PP/cT/pxPPrZkcr869CSMxAf GxfatJtY2ztY4RfuUykU1IOUBMWVTTI8ZdmmFHnWWwDb7PrktjM8jlFO0fRLbU7FfE UMvCBxL1/blV0LkyA4rMh8n4SmGUbyAMZgLOdOfU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MbKXI-1i2Tze2Cfs-00IjrR; Sat, 06 Jul 2019 21:47:02 +0200 From: Heinrich Schuchardt To: Alexander Graf , AKASHI Takahiro Date: Sat, 6 Jul 2019 21:46:24 +0200 Message-Id: <20190706194634.3349-4-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190706194634.3349-1-xypron.glpk@gmx.de> References: <20190706194634.3349-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:fy+gGCiiheoKUKDMJ7+LnCWRtq8QwASFA2IUREPEVUyLqKtheGJ pTuUISm0OPE8p4JUtNtrBqZAx1pP998jHzQXVEREbeoy5Xhp3mzmzjXWhWus31fpnQUuwtx TmoCYeZAp370YNnXB+In36j+4WH5OzYfsJ9XgNva/Bi92javLs6AbXLncJEVJQEXEKKy22X +Zlg3nt61esyy4/oLVnQg== X-UI-Out-Filterresults: notjunk:1; V03:K0:0nhT0V6La1E=:5p9JtPio4WXgiVj1W8bDwt JHU7NF3PheFzTgIHuN7C+Cj0Wunn2rlXTYNEP1CStkvS/aoWzr0xvOC3z7bZWKWHJLktsxdw8 V6KeYn2pday00yoYalfHb07umkCRjYW4r6e76WGRl18KmAXi6rPXcgb9fnkLnyV6UjRSRMJHS OytJJT/sRqdzTgYXeQjNskeJkmxOJ0kyvZ0U2pwQpmUdj3m6ic4Ljy3euvx+Ns9rFaJ01OWGK mhihS8RTMKGhVVN+rq344YrnZImmTT6FOavWy6PxHlu81yxuhjK3m6VFfdpqplJ0c6ZDUW7km +wTG+MJNiAkhYnTGUlS28xNqrlBMP9LyTYRNfu0zEUtYnSfUAxKwzd7RiGVI4aAYjm7V+Rk9E yx5E29/3vVXo5U/KTNdysDSHMU6UAHDIdF28MBotI6UGvznwgBT7DK/nVTGM9nRndUzzfOCNc Xiq6/sJQ/BrqoTgErB8LISGNp+18AO5sB5cwbDlGLYgENrAUcFjnadpEtNSw5FSBtMZzB5TYg 0JcAKPSv4nZ4GP/3XEiqqraJDryjzj0II+35imBQUPY246cDa8TL0r++RAGwUY9lXlFlroZpe vZSn3FztdYmOMhfZqyypD0luEjXY1/LDbumhFoq6SEup4QkaujOOjAR5RaUGYHTS4nlNij/UI o7TABqcS3rdSjVQVBCnrRMxdiHr1hvFA0REi9MV+Thj2V/bB6nTzcc5ZJyuCyLwUtjEKw+iG5 R1o+35C84qDZ7kSne+5kMxToHaWn/hF7EpMRZtXaDAByfVMmvlnxu8dy7F/cjlUJKll5yNGGM H9NV7xMOTuVUU3coQqMUv3XJvDC/rkTqurk7L0AK2V/LfRHU8uezNPRfizm8mtMZ1hTfJdGpg 3KdjnCWLDfNjzzueRFRTQTT4dSIVkaEJXFo4vlpLuyhwTU60GRhheO5nvFK8wO+sA99j50Wot wPbZKS/UBES9W3PNMDW+L6q0qkHQL2gO5EZFtTPCcpawExVBI2ImJnm0K4XTfVBfievA0puz1 THVPdKhPwgbejviO81TeHhDpgUoNozXniIsxbxscmaPOUo1jmgfKSrH4OaGpGcYxjJ/Ql32Ma xnrhFueXrKphr0= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 03/13] efi_loader: remove NULL entries from runtime detach list 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" Some entries in the system table are set to NULL in ExitBootServices(). We had them in the runtime detach list to avoid relocation of NULL. Let's instead assign the pointers dynamically in efi_initialize_system_table() to avoid the relocation entry. Signed-off-by: Heinrich Schuchardt --- v3 new patch --- lib/efi_loader/efi_boottime.c | 13 +++++++++---- lib/efi_loader/efi_runtime.c | 16 ---------------- 2 files changed, 9 insertions(+), 20 deletions(-) -- 2.20.1 diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index e62410c57f..bf2df80c83 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -3620,11 +3620,7 @@ struct efi_system_table __efi_runtime_data systab = { }, .fw_vendor = firmware_vendor, .fw_revision = FW_VERSION << 16 | FW_PATCHLEVEL << 8, - .con_in = &efi_con_in, - .con_out = &efi_con_out, - .std_err = &efi_con_out, .runtime = &efi_runtime_services, - .boottime = &efi_boot_services, .nr_tables = 0, .tables = NULL, }; @@ -3644,6 +3640,15 @@ efi_status_t efi_initialize_system_table(void) sizeof(struct efi_configuration_table), (void **)&systab.tables); + /* + * These entries will be set to NULL in ExitBootServices(). To avoid + * relocation in SetVirtualAddressMap(), set them dynamically. + */ + systab.con_in = &efi_con_in; + systab.con_out = &efi_con_out; + systab.std_err = &efi_con_out; + systab.boottime = &efi_boot_services; + /* Set CRC32 field in table headers */ efi_update_table_header_crc32(&systab.hdr); efi_update_table_header_crc32(&efi_runtime_services.hdr); diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index dd91880ad6..c56230cad3 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -408,22 +408,6 @@ static const struct efi_runtime_detach_list_struct efi_runtime_detach_list[] = { }, { .ptr = &efi_runtime_services.set_time, .patchto = &efi_set_time, - }, { - /* Clean up system table */ - .ptr = &systab.con_in, - .patchto = NULL, - }, { - /* Clean up system table */ - .ptr = &systab.con_out, - .patchto = NULL, - }, { - /* Clean up system table */ - .ptr = &systab.std_err, - .patchto = NULL, - }, { - /* Clean up system table */ - .ptr = &systab.boottime, - .patchto = NULL, }, { .ptr = &efi_runtime_services.get_variable, .patchto = &efi_device_error, From patchwork Sat Jul 6 19:46:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1128518 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="EUkRVMzO"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45h2L24qHBz9sN4 for ; Sun, 7 Jul 2019 05:47:20 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 28D98C21E5B; Sat, 6 Jul 2019 19:47:09 +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 EBD31C21C2C; Sat, 6 Jul 2019 19:47:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 051FAC21CB6; Sat, 6 Jul 2019 19:47:04 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lists.denx.de (Postfix) with ESMTPS id 8F98FC21C50 for ; Sat, 6 Jul 2019 19:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562442423; bh=tlihy2UOK2FeKkikkwWbSXJZhO++m5OGafJ5N7Dxn+k=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=EUkRVMzOujju58GfgeAaOiUL78fxOWSTGU2jpQGBC3q9UtcnF2DosBoy9yQUU5di6 6THDF/AWD6roKg5b12DjWSk32Nz8iuwszDFEsTRACV5YEkROJ6n17/IaCbSilQrUz9 njSNHsjbwyMgU5puQucrKkINnNueTlp2oSWd8HFE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MQNFY-1hvq9K3DQ4-00TiEH; Sat, 06 Jul 2019 21:47:02 +0200 From: Heinrich Schuchardt To: Alexander Graf , AKASHI Takahiro Date: Sat, 6 Jul 2019 21:46:25 +0200 Message-Id: <20190706194634.3349-5-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190706194634.3349-1-xypron.glpk@gmx.de> References: <20190706194634.3349-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:ZAj3eLyWcuPk5oJgjrOSXRkK5mPi7KkAV91aXMIeYXNiqWWqUzF juR8XLa6urqgERZr4/6eu/AssOl3Ll6KIYMkojch+dpPbrg7+PoAXFIt8jXAuvwIrCHXNXC 6ilxHLEKOaffX1yaGgrMDcuHOXHfMUyTg+dsph+pMC0YtceU/bY2QQ7zAmfo93epMGx90XP MUHXybgvWMFwTN7NffL/A== X-UI-Out-Filterresults: notjunk:1; V03:K0:gS7+LE/PvzI=:dVx3w+Eq2WQl0YSu/lOWkB iYKhpm7G25anCmdTcJWxaRW9JOFhErU+HUy08Z5RvStU0hMKjIvD7aOM+wNbvLu1KnFhD5rcS nvN7yGy7AMqGdcao2ZVAgH7r7dg04ryMhqWDu59mxAL6HhZ5XGplDCeFMIw9/WUNYE8BKxfox xYX0mcYEygnocM/FV2qFSXf2K+lrbQSNzDm3RS2e8yEYx2VGf5J5pXFeUNDNWw+9cw9xgzufo KBPIICrL2VP5ZX6tR+ADvbki548zFoTYFNYbxuuYf26du3bHwPPyuSYzCTdaUkF+YE3E9XDYW hjAjeQ0vkEifbVh42tLjnPHQzXuVzgNmRy4c/sRzydn6mVJfrVzS2R6QuSfMp1r1ViU4nZLxB iKCWuKS1KsCsk6qmy34qfE3wVRqs02JA9TxFIjH7llqn4epHGU9n6mRBAqiZqPPs84hrXdVTj o+Nv4fYAXswzh8cPwhSn1Dv6iXlspowyxmCn8+LKlvK0KpS/8z0lAOZ72i7R62oW2Jk6uF/jq VFc9O4RFflfT7/WC/VsJt66miDe3w8ptcHCC3fQFBQXiJEeQWUjAopfC+3hT7gVWe9UZjq2Bn d0YLY324qb/+qUOZCiDn6h/+uruRu05EwKUP57t2gQRQc/gHFMSIcwZEyWnAhtZFWksZd2KSI TZR6fRI9lCvy/VVVa8o/7AoV1gYl6LTURtImbcIJMY+TZEc1UxmxFqeEOvObSY8B4kgo0ZHYP albHf/q+pDN+Qg/QI1Vt0r923Kujqtn+0j1uFsar5Ca0euLcX90FhqyYEJiZOAnq6geP53mMQ pWEbVbW2URliJ+n3AaAKeMEk86xBs1n5I/a3bwFB5iNdDioZiQo3jyU4TkCb15eFGaQF0vPgg KwqBBqOns+yUuBW6zXkkoS2LE1t9jjcmMd7noS/Zk79hzMJ6cPhT02+KRdsAPJXXjY8vZEoKH GZ7PuJGgDkwJ/ZSlIlFfWrKl1/nmqGxOFpOs6kXuUYJC9eReaUoS19buDsQh9KvFuy+7Cuzii /Or7+GphtsVUH+M4ZD+yTndDS+jCX9b1tDqEi4BQdodBJ1I1xXsNMQcyDEA4Mj8jo6G6wViEY VhD1VW71FcPhiA= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 04/13] efi_loader: clean up runtime detaching 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" The detaching of the runtime will have to move to ExitBootServices() to encompass operating system that do not call SetVirtualAddressMap(). This patch changes the logic for the relocation of the pointers in the runtime table such that the relocation becomes independent of the entries in the detach list. Signed-off-by: Heinrich Schuchardt --- v3 no change v2 separate efi_relocate_runtime_table() and efi_runtime_detach() --- lib/efi_loader/efi_runtime.c | 78 +++++++++++++++++++++++++----------- 1 file changed, 55 insertions(+), 23 deletions(-) -- 2.20.1 diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index c56230cad3..702136ae0e 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -420,29 +420,53 @@ static const struct efi_runtime_detach_list_struct efi_runtime_detach_list[] = { } }; -static bool efi_runtime_tobedetached(void *p) +/** + * efi_is_runtime_service_pointer() - check if pointer points to runtime table + * + * @p: pointer to check + * Return: true if the pointer points to a service function pointer in the + * runtime table + */ +static bool efi_is_runtime_service_pointer(void *p) { - int i; - - for (i = 0; i < ARRAY_SIZE(efi_runtime_detach_list); i++) - if (efi_runtime_detach_list[i].ptr == p) - return true; - - return false; + return p >= (void *)&efi_runtime_services.get_time && + p <= (void *)&efi_runtime_services.query_variable_info; } -static void efi_runtime_detach(ulong offset) +static __efi_runtime void efi_runtime_detach(void) { int i; - ulong patchoff = offset - (ulong)gd->relocaddr; + /* + * Replace boottime functions by runtime functions + * TODO: move this step to ExitBootServices() + */ for (i = 0; i < ARRAY_SIZE(efi_runtime_detach_list); i++) { ulong patchto = (ulong)efi_runtime_detach_list[i].patchto; ulong *p = efi_runtime_detach_list[i].ptr; - ulong newaddr = patchto ? (patchto + patchoff) : 0; - debug("%s: Setting %p to %lx\n", __func__, p, newaddr); - *p = newaddr; + debug("%s: Setting %p to %lx\n", __func__, p, patchto); + *p = patchto; + } +} + +static __efi_runtime void efi_relocate_runtime_table(ulong offset) +{ + ulong patchoff; + void **pos; + + /* Relocate the runtime services pointers */ + patchoff = offset - gd->relocaddr; + for (pos = (void **)&efi_runtime_services.get_time; + pos <= (void **)&efi_runtime_services.query_variable_info; ++pos) { + /* + * The UEFI spec requires not to update VirtualAddressMap() + * and ConvertPointer(). + */ + if (*pos && pos != + (void **)&efi_runtime_services.set_virtual_address_map && + pos != (void **)&efi_runtime_services.convert_pointer) + *pos += patchoff; } /* Update CRC32 */ @@ -467,6 +491,10 @@ void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map) p = (void*)((ulong)rel->offset - base) + gd->relocaddr; + /* The runtime services are updated in efi_runtime_detach() */ + if (map && efi_is_runtime_service_pointer(p)) + continue; + debug("%s: rel->info=%#lx *p=%#lx rel->offset=%p\n", __func__, rel->info, *p, rel->offset); @@ -490,9 +518,8 @@ void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map) } #endif default: - if (!efi_runtime_tobedetached(p)) - printf("%s: Unknown relocation type %llx\n", - __func__, rel->info & R_MASK); + printf("%s: Unknown relocation type %llx\n", + __func__, rel->info & R_MASK); continue; } @@ -500,9 +527,8 @@ void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map) if (map && ((newaddr < map->virtual_start) || newaddr > (map->virtual_start + (map->num_pages << EFI_PAGE_SHIFT)))) { - if (!efi_runtime_tobedetached(p)) - printf("%s: Relocation at %p is out of " - "range (%lx)\n", __func__, p, newaddr); + printf("%s: Relocation at %p is out of range (%lx)\n", + __func__, p, newaddr); continue; } @@ -607,7 +633,15 @@ static efi_status_t EFIAPI efi_set_virtual_address_map( } } - /* Move the actual runtime code over */ + /* + * Some runtime services are implemented in a way that we can only offer + * them at boottime. Replace those function pointers. + * + * TODO: move this call to ExitBootServices(). + */ + efi_runtime_detach(); + + /* Relocate the runtime. See TODO above */ for (i = 0; i < n; i++) { struct efi_mem_desc *map; @@ -616,10 +650,8 @@ static efi_status_t EFIAPI efi_set_virtual_address_map( ulong new_offset = map->virtual_start - map->physical_start + gd->relocaddr; + efi_relocate_runtime_table(new_offset); efi_runtime_relocate(new_offset, map); - /* Once we're virtual, we can no longer handle - complex callbacks */ - efi_runtime_detach(new_offset); return EFI_EXIT(EFI_SUCCESS); } } From patchwork Sat Jul 6 19:46:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1128526 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="bCDN12At"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45h2QR0Wdlz9sN4 for ; Sun, 7 Jul 2019 05:51:10 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9343FC21C3F; Sat, 6 Jul 2019 19:47:52 +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 7D287C21DB3; Sat, 6 Jul 2019 19:47:08 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5D7F6C21C3F; Sat, 6 Jul 2019 19:47:05 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lists.denx.de (Postfix) with ESMTPS id C29C4C21C6A for ; Sat, 6 Jul 2019 19:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562442423; bh=R98f2X2Z22MPMEFlCrBzwGqZyH4RJ5JNJTIFwQHDPVc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=bCDN12At2LT87GXu9tCIJxYkngqIgIfVD6Ey08Iyh+1HhO0KIWftHDnp+Uj0DAXUK SbAEvJLFPtmLEwd7Mdo5ttLM7xFxx2VVmOL5TebsGAAiPUTXdTps7hY7yv0hJJisor UB76rUkHlPACRq1LYzVWkYHO5vHAr6HaPBKDXY+M= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MMXVC-1hs4e902P8-008NkF; Sat, 06 Jul 2019 21:47:03 +0200 From: Heinrich Schuchardt To: Alexander Graf , AKASHI Takahiro Date: Sat, 6 Jul 2019 21:46:26 +0200 Message-Id: <20190706194634.3349-6-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190706194634.3349-1-xypron.glpk@gmx.de> References: <20190706194634.3349-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:GxTkFJTCiioDxN5hRlDJH9sC/PnEB1HmEbWm/II+ZwAqJYvyEcu AgLKm9oJK40o5SMyqRwrUcryoItlkHt51O6GFzjF3V8lf4t9Sr3qOfw8cZ3K5TjqE9Rz6CT goxDnEeEo6uLKiyThiaZclNotQOSeh/RNdYpN93hXJ4M8xC32uM7prn45zCN7GvLbRTk3rZ yZlhPtIu9BQpm8QuIJpkw== X-UI-Out-Filterresults: notjunk:1; V03:K0:mQ5tC6quQ1g=:gghSRBH5MikkAiOT4zDsk9 yfpNYlQaB29l7ERwLVLPs7OaMBwEumuWlNTzZUbpo7QNp3E0WLwEcxTMYNGcAHxUIz2J1zqXO zf4A8v8Hdupfa29NA9jmcF0j3kq3mUK5SWR+wHpKkkxOv+tt3BbaoT+oysOsaaG4ygNU5KmBE DiSGz9kR+uMY/kG+rev6eWk1cCFxtjumIGBQBT3Bt8fHOP8HF/8g2A6ZPbJd0sao8dIAdsmGx ix43f4sZoypMgb9Imw603M+cov1BykuGjKO3nRSVVnYOwTEZKEoQVQ/AG/11lMqCvURU75d63 DsjhBsGFZHXfUjZ/B1JlLFIooWKVW9nxSgbwK3Q3AvUrA8uQIuwljcg66RRqfPAXnqZxIt2h7 e0CAjFAhXhq855xsTNCq4g+q2TVwIxoNcvnt6HnhpgXS4OrYBmAAIuo0qCW0uMDDPpqTlihtl HorliHywAVd+CmBCPDx6pqkFDT1lqIc5OnFSwwRJVJeWhx2K1bAa4mmPcYJucylIefMC83Zwk VUQJGMsr8zia4PCUwZ4gEcmAaxJD14QJVxH9bPuMOWp2Lz5YGf5tKiIOsd/DtcKcyEAAm2g5F aXHo9K0rKqMMHzYPKeyDTU0IWU8HYmyV9JjaLBM/B8KuoS7Mbqu5XSsXNGP0VioGI9h+Wlx55 OurLbc5PF2EEDojV2R9VlBRQ+2F3rwR0Yjb+Ye+70N9so8M9ahh9zj/QEyIDotCHD+7rvrVoc 7kHLO5nugCET5gdNLdV5OjxCmpJE21twsNaLnGlc2ci0ocXlk6h77i8a2NkmWNeLIU5/BTC8e QElHSxUL+XtHfDJtIMMBmyXTC5vyNjI+3DdV9rySyki1SioS7OKcb+XhQBxu/93kI/CtHwnqt ERYDH7/+7dflP8A1K/u+SdDQ5mq1Zq6nzoUtKspfqKaOgSroPf2ArjT99FkOtlb/Lt9HFBoPb /jDCXGiE8NffxnINAgc2DQlTVbFzMAMfcTAvwUtEw2UeCNhSJBZMOqKFC71iue3lnjOnuo+Kh gSDj3n6F/NPBZ12Nmi8oK3StgMfplr6NUQULMSKDpCdtL2NEEtUQO8jjhYyhexSOrDsbuZVKt LiDuIiBchYuF40= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 05/13] efi_loader: let the variable driver patch out the runtime 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" Our variable services are only provided at boottime. Therefore when leaving boottime the variable function are replaced by dummy functions returning EFI_UNSUPPORTED. Move this patching of the runtime table to the variable services implementation. Executed it in ExitBootServices(). Signed-off-by: Heinrich Schuchardt --- v3 rebase patch v2 Do not use an event but a direct call at ExitBootServices(). So we do the patching after processing all events. --- include/efi_loader.h | 2 ++ lib/efi_loader/efi_boottime.c | 3 ++- lib/efi_loader/efi_runtime.c | 9 ------- lib/efi_loader/efi_variable.c | 44 +++++++++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 10 deletions(-) -- 2.20.1 diff --git a/include/efi_loader.h b/include/efi_loader.h index d30c4e8ef3..8d75dde569 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -327,6 +327,8 @@ extern struct list_head efi_register_notify_events; efi_status_t efi_init_obj_list(void); /* Initialize variable services */ efi_status_t efi_init_variables(void); +/* Notify ExitBootServices() is called */ +void efi_variables_boot_exit_notify(void); /* Called by bootefi to initialize root node */ efi_status_t efi_root_node_register(void); /* Called by bootefi to initialize runtime */ diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index bf2df80c83..ba4c1e5765 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1968,7 +1968,8 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, /* Make sure that notification functions are not called anymore */ efi_tpl = TPL_HIGH_LEVEL; - /* TODO: Should persist EFI variables here */ + /* Notify variable services */ + efi_variables_boot_exit_notify(); board_quiesce_devices(); diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 702136ae0e..bc2a23afbb 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -408,15 +408,6 @@ static const struct efi_runtime_detach_list_struct efi_runtime_detach_list[] = { }, { .ptr = &efi_runtime_services.set_time, .patchto = &efi_set_time, - }, { - .ptr = &efi_runtime_services.get_variable, - .patchto = &efi_device_error, - }, { - .ptr = &efi_runtime_services.get_next_variable_name, - .patchto = &efi_device_error, - }, { - .ptr = &efi_runtime_services.set_variable, - .patchto = &efi_device_error, } }; diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index 6210425f5e..bc8ed678c9 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -548,6 +548,50 @@ efi_status_t __efi_runtime EFIAPI efi_query_variable_info( return EFI_UNSUPPORTED; } +/** + * efi_get_variable_runtime() - runtime implementation of GetVariable() + */ +static efi_status_t __efi_runtime EFIAPI +efi_get_variable_runtime(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_runtime() - runtime implementation of + * GetNextVariable() + */ +static efi_status_t __efi_runtime EFIAPI +efi_get_next_variable_name_runtime(efi_uintn_t *variable_name_size, + u16 *variable_name, const efi_guid_t *vendor) +{ + return EFI_UNSUPPORTED; +} + +/** + * efi_set_variable_runtime() - runtime implementation of SetVariable() + */ +static efi_status_t __efi_runtime EFIAPI +efi_set_variable_runtime(u16 *variable_name, const efi_guid_t *vendor, + u32 attributes, efi_uintn_t data_size, + const void *data) +{ + return EFI_UNSUPPORTED; +} + +/** + * efi_variables_boot_exit_notify() - notify ExitBootServices() is called + */ +void efi_variables_boot_exit_notify(void) +{ + efi_runtime_services.get_variable = efi_get_variable_runtime; + efi_runtime_services.get_next_variable_name = + efi_get_next_variable_name_runtime; + efi_runtime_services.set_variable = efi_set_variable_runtime; + efi_update_table_header_crc32(&efi_runtime_services.hdr); +} + /** * efi_init_variables() - initialize variable services * From patchwork Sat Jul 6 19:46:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1128520 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="ARvsKe08"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45h2MH09z9z9sN4 for ; Sun, 7 Jul 2019 05:48:26 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 65654C21D4A; Sat, 6 Jul 2019 19:47:25 +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 63CCEC21CB1; Sat, 6 Jul 2019 19:47:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1A605C21C50; Sat, 6 Jul 2019 19:47:04 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by lists.denx.de (Postfix) with ESMTPS id 9A696C21C57 for ; Sat, 6 Jul 2019 19:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562442423; bh=yTDlwSYUZCDCDzNSsXN6TU/RP2VcFQpuvm7J1Q5ZOos=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ARvsKe08ELXaOibs1rzs3us6AjfIVo6REDos7diHaZaPE1PxbBR00GmQ8TAdKmSqm 2ueicx8pTcBEyszhWeeLcb6723kuwJp/9E9peI6pX38hQyr7u+RX3MoEFyyPV5xIYk nRG04JErViYJ/wg2XkjnK+k3Av0uw8xEs7rOHHRo= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0Lqm3a-1iNq1l16Qs-00ePAp; Sat, 06 Jul 2019 21:47:03 +0200 From: Heinrich Schuchardt To: Alexander Graf , AKASHI Takahiro Date: Sat, 6 Jul 2019 21:46:27 +0200 Message-Id: <20190706194634.3349-7-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190706194634.3349-1-xypron.glpk@gmx.de> References: <20190706194634.3349-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:AK+iMF1yEwqP352CSJC83Z/mn0hk07fDyeiE0bIx93mtS7Kz9Mm /bSBjNYZowmGFTAqPQo6O+fKFT7ufjyw5Euq78LN3sMN6R1RWF7vJ8NHuqMmjH737BT1p0T DUI/Yx0c7IoGa4MAHA482NTZxQ0q/wgkLzhW8JW9aJd0MJqmPALUbfRDvFAtCcm988kcZHu agNY3iJkCax+/i67XBXUg== X-UI-Out-Filterresults: notjunk:1; V03:K0:Lq17fqIjT3c=:AZbC5BeV+Pxsfnp9BjKEEw uAO6h5F0uRkQFa5LT19DK/kU+1olfV6nyY1bfN+fjHvJ+2OM/Nz+wyAia5mGFYx/5TIGdhRKl mh69Xyq76tcxVH75UpDko44KPYY/iVWcdvVUnAe88Eq51f6Sc1FRAw80KzwxWiK8HprBwo/yq mqBhXWYGbYaHRnEI5279QRykczKeq0EkR776kReNpC0Wf5+5lGZP6oGhxYPLTlIGCQYmYyei3 q4S1nQ26jZpLms1ABGCiqAoV78DSa4KOOpwAHsZM6f8LyFnpT3XGkZyKRUlux2ibW1BI10ikq GpoABKEPW9FgPdeHRic+DaNhQEFRBJgLbPMRT6FIdpVnpbw43KFX43atSBGio28bD0U5DVUFF MMFH2MbfTz1SdCJi7i5TKMJjDvETxXlTyhh28Hf9f8UKPpT2xbVmCpaOdcr8dgbHRh6uHYg9w OzqVt5vLiPEryPXX39zQKPqTAEqGPumlJEQxyhsCWB2xNo7432ikOhT+8S3BfyRUCmMnsU/k9 kGNHE4uvzs9aVuAw/yRzWrIMrPtFgHuAkSuUs57Uu8NTVkrMeZ3j5byY/1jnQlWGR9vdy+z+2 xWKvV2M2nTmvxDYHZLRn7eOF9x4d+wkxLPA4X5xZQaW0NTzB/DB8NZfEcFqqSvfL9BpaCaB61 PojpPCMm0DeR+H8VGzOUkWdg/aAhPO9CzlF5VlHFvXaWRbJ335jLyS5ZKt+gYyLGF9kHNuH0A p1ViRFkIWOLN8YUdlGF9lKfIS7Wz6mSluzGGhvmvsMcAS+F5wdAxjT8hIy36CDcmYlV34NVl+ ho7YVvTytCgLPor2CUnbOL5W2j2c9riJ9w+8klvxCSBlLlYlGKod0S3jMBu9OekyRVTvvb+/I WBYj5sF2ZMdLC9kpoyN6p4FS3Zx1jE9KbnMMSSPdYtRntGK/T7Yv5f3QBFynD/JWqkkL9gmQe c8TaovyrIwNIDT1cNvVUVMxn2+LKbQlPuhz00bW2vSESxfFsVtjw3b2qjh5TThcq2Tu8yk/YL Lv535ItdF+u5PqvUGlqekRIgJ7rdVtgYT7/8T4RRDr1POhtSIY+PEic/wLyFmYjPleCIns2OS v0VpFEM9qJGRMU= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 06/13] efi_loader: unimplemented runtime services 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" Unimplemented runtime services should always return EFI_UNSUPPORTED as described in the UEFI 2.8 spec. Signed-off-by: Heinrich Schuchardt --- v3 no change v2 no change --- lib/efi_loader/efi_runtime.c | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) -- 2.20.1 diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index bc2a23afbb..7e0526f485 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -26,8 +26,6 @@ struct efi_runtime_mmio_list { LIST_HEAD(efi_runtime_mmio); static efi_status_t __efi_runtime EFIAPI efi_unimplemented(void); -static efi_status_t __efi_runtime EFIAPI efi_device_error(void); -static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void); /* * TODO(sjg@chromium.org): These defines and structures should come from the ELF @@ -717,34 +715,6 @@ static efi_status_t __efi_runtime EFIAPI efi_unimplemented(void) return EFI_UNSUPPORTED; } -/** - * efi_device_error() - replacement function, returns EFI_DEVICE_ERROR - * - * This function is used after SetVirtualAddressMap() is called as replacement - * for services that are not available anymore due to constraints of the U-Boot - * implementation. - * - * Return: EFI_DEVICE_ERROR - */ -static efi_status_t __efi_runtime EFIAPI efi_device_error(void) -{ - return EFI_DEVICE_ERROR; -} - -/** - * efi_invalid_parameter() - replacement function, returns EFI_INVALID_PARAMETER - * - * This function is used after SetVirtualAddressMap() is called as replacement - * for services that are not available anymore due to constraints of the U-Boot - * implementation. - * - * Return: EFI_INVALID_PARAMETER - */ -static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void) -{ - return EFI_INVALID_PARAMETER; -} - /** * efi_update_capsule() - process information from operating system * @@ -800,11 +770,11 @@ struct efi_runtime_services __efi_runtime_data efi_runtime_services = { .get_wakeup_time = (void *)&efi_unimplemented, .set_wakeup_time = (void *)&efi_unimplemented, .set_virtual_address_map = &efi_set_virtual_address_map, - .convert_pointer = (void *)&efi_invalid_parameter, + .convert_pointer = (void *)&efi_unimplemented, .get_variable = efi_get_variable, .get_next_variable_name = efi_get_next_variable_name, .set_variable = efi_set_variable, - .get_next_high_mono_count = (void *)&efi_device_error, + .get_next_high_mono_count = (void *)&efi_unimplemented, .reset_system = &efi_reset_system_boottime, .update_capsule = efi_update_capsule, .query_capsule_caps = efi_query_capsule_caps, From patchwork Sat Jul 6 19:46:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1128528 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="Bg2N/9oo"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45h2Ry6v9Xz9sN4 for ; Sun, 7 Jul 2019 05:52:30 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 783ACC21DD7; Sat, 6 Jul 2019 19:48:42 +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 E5BF5C21E1A; Sat, 6 Jul 2019 19:47:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A52D3C21C51; Sat, 6 Jul 2019 19:47:05 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lists.denx.de (Postfix) with ESMTPS id D9DF6C21C93 for ; Sat, 6 Jul 2019 19:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562442423; bh=Ep2brcAUyvLHd1MjHXo3HehZTVRkk7ru9TGfYs9A4S8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Bg2N/9ooj7Mz3LqCHE03tCiq9hq0Zk2oxOOTihwsoEKZREmF9ilWKE8NrKNlJcZK9 l5z0Lw427tC3vRPH1H5OgkQ8BQ1kFSNJeOcZr6uUNFiwecHJx0kTBb00G5vNTSxdOC kn16xBYRavJ1qg7OfrtmRrTVCYxIvGjQGUQ1vptY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0LeiJ8-1iIIe126FK-00qU0N; Sat, 06 Jul 2019 21:47:03 +0200 From: Heinrich Schuchardt To: Alexander Graf , AKASHI Takahiro Date: Sat, 6 Jul 2019 21:46:28 +0200 Message-Id: <20190706194634.3349-8-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190706194634.3349-1-xypron.glpk@gmx.de> References: <20190706194634.3349-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:2oV1ApPVYJiFXRJFglQadX6jZ8yCIWWglav5mB0jeQv9GTiAwlJ psBY20L07C+wPjyVS8iV6TkrPv0n1qEhLeO6P7JCYTeDlsiVXJ9ezEn+BWwyKhPcoxxmzIY fpEotL5ND+UWAjgzCjL3me7EO+h/He++TIqgSTjsGJLge7zLcHVxdetdn4FXxbWOtyJn2zp 8QAXSg0P5DGVMaDQzENWw== X-UI-Out-Filterresults: notjunk:1; V03:K0:f9PpT4Tpao4=:UNfhC+n5pBtexpq75OPlRV TUN/rO0YCpukA3Jg7iDizP7l/OAvv5tZn2A41BE44x0glHGn6EQ6mM6c2SwPbl+/VAltjFK7g hpP/0Y5Qh0TkFobyMlHXIT2mIt+SuUBnO1DkiMua7pIfU+MySetbpUF95rYpthsqULMn72KOL f002AHD3oQnRzlTHt46x53IFCiZVEUT01kdiVo36jmrdgLj67XWm3MTTwchK813dS7w6AJJdA 5AkXdMFVlY4D0pnU5cMnZq+V/kC7DmxAakFR1Ditb+V3X6fsLZA+D309Ig7ZEABE0eZCmvAGW lslczQxX1uOq1l+fMnep6kSQkKkZOj1obqmUHg+0+WXIQJXvVZalsjYNOcnAEbOPvTcqgB91G rtDTyI22WUy5pLiEZ7PYJGvZ1mtIld110uWzMgzcvdMw98lfSK/hyJ8fBQsX+/7muqT1JSc/i kPt7QfYMIvlOkk4Vh9NYe9Cx2qgdvDVpZBJ9KqwAo9Pj//VxFzvhzUeyHs4tjGB18bNy7hiYp BrjIVDWZrTtUNRGRhpplzx1T5/cvH0m+ZhNE39ibpjCqPcqKs0qnmH7+uFltPQlZh+onUhXQO oMUIHer/lm1Kqmh4QUkcbIwuMpYZMoZ9euVp+rUbkDQqUxhDalV+ux+E+4Pb+i+wlcl+CDIiD iI1WXoGAh/EbKs8ZGBvzOJ/GtfoKM9VeLZ8zfTqsODV5aXE48HtkgJ5P47leekKxTnzLq4rhR iMQvMnf3Apw+OUvwc5iHZlvCftFVDZXv8k+6ipf/rUZLlvNByO7P1C15m1DX2TcRNAkmwPpkQ WwO+9nL/EWXc45Ppu6vme0cQet+4hbboZoQ04WXQZeT9Z9OumIuk/Ra4K6S4W5LovG0rwIjJz xX7TmDQw2cz/BoBhEvtwGVXZ2sVuaQgXa0g+dStrkSVkSfHKTzCRxo+GLssnIS35twibVmBDt 1h2670BW3FcWwuGn4cEy2q+S3iI3vwUoOIhJ74BY5B97sPx7UVt55+rTLvnJufbajZvGckBgf vGiiAw6Mp/ZD1OOkwuur25LXrH6BRCKqWKwvdDtHFxuTqk9z6U/C4z8Y+ViZFdc2fyHE1Q6EV ofBVmI3RDmU+Xc= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 07/13] efi_selftest: test variable services at runtime 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 unit test for the variable services at runtime. Currently we expect EFI_UNSUPPORTED to be returned as the runtime implementation is still missing. Signed-off-by: Heinrich Schuchardt --- v3 no change v2 rebase patch --- lib/efi_selftest/Makefile | 1 + .../efi_selftest_variables_runtime.c | 94 +++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 lib/efi_selftest/efi_selftest_variables_runtime.c -- 2.20.1 diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index 3bebd0f573..88678755cc 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -35,6 +35,7 @@ efi_selftest_textoutput.o \ efi_selftest_tpl.o \ efi_selftest_util.o \ efi_selftest_variables.o \ +efi_selftest_variables_runtime.o \ efi_selftest_watchdog.o obj-$(CONFIG_EFI_DEVICE_PATH_TO_TEXT) += efi_selftest_devicepath.o diff --git a/lib/efi_selftest/efi_selftest_variables_runtime.c b/lib/efi_selftest/efi_selftest_variables_runtime.c new file mode 100644 index 0000000000..b3b40ad2cf --- /dev/null +++ b/lib/efi_selftest/efi_selftest_variables_runtime.c @@ -0,0 +1,94 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * efi_selftest_variables_runtime + * + * Copyright (c) 2019 Heinrich Schuchardt + * + * This unit test checks the runtime services for variables after + * ExitBootServices(): + * GetVariable, GetNextVariableName, SetVariable, QueryVariableInfo. + */ + +#include + +#define EFI_ST_MAX_DATA_SIZE 16 +#define EFI_ST_MAX_VARNAME_SIZE 40 + +static struct efi_boot_services *boottime; +static struct efi_runtime_services *runtime; +static const efi_guid_t guid_vendor0 = + EFI_GUID(0x67029eb5, 0x0af2, 0xf6b1, + 0xda, 0x53, 0xfc, 0xb5, 0x66, 0xdd, 0x1c, 0xe6); + +/* + * Setup unit test. + * + * @handle handle of the loaded image + * @systable system table + */ +static int setup(const efi_handle_t img_handle, + const struct efi_system_table *systable) +{ + boottime = systable->boottime; + runtime = systable->runtime; + + return EFI_ST_SUCCESS; +} + +/** + * execute() - execute unit test + * + * As runtime support is not implmented expect EFI_UNSUPPORTED to be returned. + */ +static int execute(void) +{ + efi_status_t ret; + efi_uintn_t len; + u32 attr; + u8 v[16] = {0x5d, 0xd1, 0x5e, 0x51, 0x5a, 0x05, 0xc7, 0x0c, + 0x35, 0x4a, 0xae, 0x87, 0xa5, 0xdf, 0x0f, 0x65,}; + u8 data[EFI_ST_MAX_DATA_SIZE]; + u16 varname[EFI_ST_MAX_VARNAME_SIZE]; + efi_guid_t guid; + u64 max_storage, rem_storage, max_size; + + ret = runtime->query_variable_info(EFI_VARIABLE_BOOTSERVICE_ACCESS, + &max_storage, &rem_storage, + &max_size); + if (ret != EFI_UNSUPPORTED) { + efi_st_error("QueryVariableInfo failed\n"); + return EFI_ST_FAILURE; + } + + ret = runtime->set_variable(L"efi_st_var0", &guid_vendor0, + EFI_VARIABLE_BOOTSERVICE_ACCESS | + EFI_VARIABLE_RUNTIME_ACCESS, + 3, v + 4); + if (ret != EFI_UNSUPPORTED) { + efi_st_error("SetVariable failed\n"); + return EFI_ST_FAILURE; + } + len = 3; + ret = runtime->get_variable(L"efi_st_var0", &guid_vendor0, + &attr, &len, data); + if (ret != EFI_UNSUPPORTED) { + efi_st_error("GetVariable failed\n"); + return EFI_ST_FAILURE; + } + memset(&guid, 0, 16); + *varname = 0; + ret = runtime->get_next_variable_name(&len, varname, &guid); + if (ret != EFI_UNSUPPORTED) { + efi_st_error("GetNextVariableName failed\n"); + return EFI_ST_FAILURE; + } + + return EFI_ST_SUCCESS; +} + +EFI_UNIT_TEST(variables_run) = { + .name = "variables at runtime", + .phase = EFI_SETUP_BEFORE_BOOTTIME_EXIT, + .setup = setup, + .execute = execute, +}; From patchwork Sat Jul 6 19:46:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1128523 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="D9J4TJ1u"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45h2PF1qMlz9sN4 for ; Sun, 7 Jul 2019 05:50:09 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CB5BDC21C3F; Sat, 6 Jul 2019 19:48:04 +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 07910C21DD9; Sat, 6 Jul 2019 19:47:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6A894C21C51; Sat, 6 Jul 2019 19:47:05 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lists.denx.de (Postfix) with ESMTPS id F3703C21CB1 for ; Sat, 6 Jul 2019 19:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562442423; bh=qJQ+oP60CzQEyLLbcDfhuKtz7uzFeZJP82FmKOEMHtU=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=D9J4TJ1u/NhoQ2rHS/1kTla/FZRa3nEL6Fh44Am0KTfL++C3Z1TKyQYIyDCdVGo0N 6GxJoFRa9IG5is6TPp2xxqC79BmrjkmJds/Cddr2yRf3cj2Eln+WlLiTz/Gebmj6Vb lI71LoyBpo3kYs9qmKkf/14zs1SA+BKJgv4wOzd4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MUDXS-1ht5nB35E2-00Qwnz; Sat, 06 Jul 2019 21:47:03 +0200 From: Heinrich Schuchardt To: Alexander Graf , AKASHI Takahiro Date: Sat, 6 Jul 2019 21:46:29 +0200 Message-Id: <20190706194634.3349-9-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190706194634.3349-1-xypron.glpk@gmx.de> References: <20190706194634.3349-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:GiWdvz1ZwctUgzNS+e8HLZCiW+V/R9t1fKSSmrrj5S8x4hRFpv/ e1ci6EVnrXAHmPu/koVvxF6onr4foZyaeRu4Dp46FoWMMuaF/eFZzLaAgYntHsEtx3QDF3v 5cULW7egp0iSN59kg6ByharzBQqDwVDtoSkv0R7WzOuQIOKvJhw4LbfDIGnMYcDmJqk/F2O 3WFy2iK7uYDEA/N5FRevA== X-UI-Out-Filterresults: notjunk:1; V03:K0:0MgQ6k9LzGA=:3NuDNB4cfWoGyjnIj4AK0a wsMgF0GUrsyUYJoyf0VV2rxU2ANxULqxUATXsRF88mSy3doERNQsdNLJGLYUiWcXqVMjslxpe yCyRFv98cDBST9gWNjzCaArubCFEjF6gu1lxPB9V1dA8nkjpD7560Xaevep8brcGgXl/HRWSU Kq1nOvMrviQw0wDgFawrjbz/g2N1JhfwKe4gYgD1HiEhShQ+sZP8KwHp9i3mdt4IfrBQ6YHTs vGHr3AOaa3U+B2ZUWOM03lJR76UCmkmjgcOyuZJtcFx2k6lqx63Lnrwcbwm+b/C2+PhTA9zpN tj3GR2SZYL7nDkPfivcMnfHaqUXXHfZmHhU1mKV0yWhEP7IVwM4B4Od+bd+7/vRpKCZD6wy5E qoIyUclm6wWxC6iDMoeZPnRQ+Lchf2d4Ozu6D+9xh+XwUqhHEgS45IgPRd1Pq9An56AOvVRE/ M/Cyz+e3RqLOOzgpe2Hl8KPeioH5D2dtqus+/iILNry8HMQgk+Sb8ru23txly9840VIGiOor+ HNmIq7VU6ZjjBfg0YmM1lpacjomHYSHIhYvluWoPc18l9e3ZrH9IHuf4qUBDwEldHS9dcpvoP icScD9PR5wbC8C5LxPHWKU9hMX8WqLTxgfGfg6bhRB+kGoPCL9OoIY3wdcR3LxizMgccAB4+s P2JQTp1f/p/rqh7nH3chexLE7anR5AL0CEBPlMO+k8RwJRICah4gP2Jt99jGVmalfi2hE0Q+V XnVKevpeYAvuuV2v2Zfvo4W4OV4NqhvJAX2uKSFy/fOzzm/bOPUZmB6NGeY2pr/HEWeqKPmR5 QyjIir+u5c/YDwUL3aOGXUZJLwfY1pOzP5nNXzAIXu59/f+gCTEGmM86YMUTR/k4cHF4FRKLq rIzZZjgSFKaNIeitfZfoFsGx0WJkZKHJgWploXhi3EGgyXeWKOmI/3JBUTylHvq//7IvrE71Q M1QGQWW3ijvAU/elyFeN/F4X+wLXCP18vs4y4GzFk2rRueL3IEpdA8FYLvPSfoIpSA0b3z2sC K9PEPqdrf+c4HB6juqigWkHvfQWEYC2fvCsA43UDNM8kjzRTTTsScDbh1oAOMQ0awBu3FS+3v OSxUQUQG9qYRzk= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 08/13] efi_loader: split off detaching SetVirtualAddress() 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" The runtime services SetVirtualAddress() and ConvertPointer() become unavailable after SetVirtualAddress(). Other runtime services become unavailable after ExitBootServices. Move the update of SetVirtualAddress() and ConvertPointer() to efi_relocate_runtime_table(). Use functions with the correct signature when detaching. Signed-off-by: Heinrich Schuchardt --- v3 new patch --- lib/efi_loader/efi_runtime.c | 69 ++++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 11 deletions(-) -- 2.20.1 diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 7e0526f485..63d8a29146 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -395,10 +395,6 @@ static const struct efi_runtime_detach_list_struct efi_runtime_detach_list[] = { /* do_reset is gone */ .ptr = &efi_runtime_services.reset_system, .patchto = efi_reset_system, - }, { - /* invalidate_*cache_all are gone */ - .ptr = &efi_runtime_services.set_virtual_address_map, - .patchto = &efi_unimplemented, }, { /* RTC accessors are gone */ .ptr = &efi_runtime_services.get_time, @@ -439,6 +435,50 @@ static __efi_runtime void efi_runtime_detach(void) } } +/** + * efi_set_virtual_address_map_runtime() - change from physical to virtual + * mapping + * + * This function implements the SetVirtualAddressMap() runtime service after + * it is first called. + * + * See the Unified Extensible Firmware Interface (UEFI) specification for + * details. + * + * @memory_map_size: size of the virtual map + * @descriptor_size: size of an entry in the map + * @descriptor_version: version of the map entries + * @virtmap: virtual address mapping information + * Return: status code EFI_UNSUPPORTED + */ +static efi_status_t EFIAPI efi_set_virtual_address_map_runtime( + unsigned long memory_map_size, + unsigned long descriptor_size, + uint32_t descriptor_version, + struct efi_mem_desc *virtmap) +{ + return EFI_UNSUPPORTED; +} + +/** + * efi_convert_pointer_runtime() - convert from physical to virtual pointer + * + * This function implements the ConvertPointer() runtime service after + * the first call to SetVirtualAddressMap(). + * + * See the Unified Extensible Firmware Interface (UEFI) specification for + * details. + * + * @debug_disposition: indicates if pointer may be converted to NULL + * @address: pointer to be converted + * Return: status code EFI_UNSUPPORTED + */ +static __efi_runtime efi_status_t EFIAPI efi_convert_pointer_runtime( + efi_uintn_t debug_disposition, void **address) +{ + return EFI_UNSUPPORTED; +} + static __efi_runtime void efi_relocate_runtime_table(ulong offset) { ulong patchoff; @@ -448,16 +488,23 @@ static __efi_runtime void efi_relocate_runtime_table(ulong offset) patchoff = offset - gd->relocaddr; for (pos = (void **)&efi_runtime_services.get_time; pos <= (void **)&efi_runtime_services.query_variable_info; ++pos) { - /* - * The UEFI spec requires not to update VirtualAddressMap() - * and ConvertPointer(). - */ - if (*pos && pos != - (void **)&efi_runtime_services.set_virtual_address_map && - pos != (void **)&efi_runtime_services.convert_pointer) + if (*pos) *pos += patchoff; } + /* + * The entry for SetVirtualAddress() must point to a physical address. + * After the first execution the service must return EFI_UNSUPPORTED. + */ + efi_runtime_services.set_virtual_address_map = + &efi_set_virtual_address_map_runtime; + + /* + * The entry for ConvertPointer() must point to a physical address. + * The service is not usable after SetVirtualAddress(). + */ + efi_runtime_services.convert_pointer = &efi_convert_pointer_runtime; + /* Update CRC32 */ efi_update_table_header_crc32(&efi_runtime_services.hdr); } From patchwork Sat Jul 6 19:46:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1128524 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="LzUJcpIR"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45h2Q11Z7Qz9sN4 for ; Sun, 7 Jul 2019 05:50:48 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id A76B4C21C57; Sat, 6 Jul 2019 19:49:10 +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 1ACCEC21E2C; Sat, 6 Jul 2019 19:47:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D81B0C21C50; Sat, 6 Jul 2019 19:47:05 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lists.denx.de (Postfix) with ESMTPS id 485D7C21C2C for ; Sat, 6 Jul 2019 19:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562442424; bh=PeOe9y6B7gihMEbpwGDikILiDUcKPe5ghBZliRKzFko=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=LzUJcpIR8jRugXWTjrwC1yEsYAeuoqPhszqFXQg0rS7U3XHgesBUYgAa7witzknpQ HMvjiBiu76As6feRD+ryxBF2/u6KUuhCgMbFIaNQCYYsoPsHpC8Uwkvnct9+d/JUPw 0dYm6ob7fUle44/7RFjU/SQLuRXrsrw3ujFZFowY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0LyA2L-1iXMos46rd-015X52; Sat, 06 Jul 2019 21:47:04 +0200 From: Heinrich Schuchardt To: Alexander Graf , AKASHI Takahiro Date: Sat, 6 Jul 2019 21:46:30 +0200 Message-Id: <20190706194634.3349-10-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190706194634.3349-1-xypron.glpk@gmx.de> References: <20190706194634.3349-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:teevYNXfSEw1Nif6IMr5Pn5taHiy/EA9jssgh7G0TO0UblLkXYP bYVNbvjEhUY58pzKX+NevCNH4CAue+rKgi6T8S50HTfiPiyagzBGZki8WbSxHQMX2apFtpH Ab+E+123tn4Y+Dj46kQnpHDKnOyBBMd26DukrrDjSjCCu+zcZz8czxl3f0tQKYeVgovzAk9 ZxQDkC9+CKKyltIBA3Odw== X-UI-Out-Filterresults: notjunk:1; V03:K0:08OITdfBz8Y=:2gQ7f9xSydt0qEShVUf3LK vqsn0NhV6KT0yI/Gt2JDiOX4Eh3BwbZ2sIUkhjBKypzHpsmf1fxgPJdSVHamLqHnXA79lvRVE K++qc3gLwDrJJEFb/NuSJ+jAEPpbIYGBZBype63ToCcGMaKUKGCuZIC4FgqMiSkYedY5CruNz hjvrU/x017fLnAWNDcg58gsqoUOwV4j0+LmxVlNlK/FR/jLI3myPMaWjWeCYXNymGEEmMH1W/ 7y231DamDMve8P+vbOHCUhQnaDOfDHNsNJgmO0rx8AYB6Gy4aXCDkbhcXRmpUXFpiptxeq1TV xjekPFx6RKd7wt+9zVGbK3p1RoVGoz2d6DT7NP4l4GEs+jbjjHJPqit8EQgHB+B5e4OO2UtX4 /5IpdMLBehya48FZEsGsMtQS0ZLFtX9VrVimcWcE9+XXhWPxgzJbtBUxowL0B3w97NgrD5/yz crQduG76zz+7f8R3eu7yUvezHxyRPefGty+Iv1YbCHGgGM2o4IBi69oOWT0nm3h0XPTr7qgeC YjPxH/+nyiqT/V8Y4H0X0yzwLYFZojaZeuVY9fDIIaIN6R2IB5EH4e+6DMxfbdCzXkEDTF/n2 Fw0iixrd14dzG75aeA5Y1+RUn+y9zfuBfhUTvnTIXZJ0WFCJuuUsJjfs0KxdFSCcLMjQFKa5y QttJqNbSNA6VpeJFBE1d+dvGEs5JZfTmMoAUfStU49S97Ttnbf1gGH0uc+SDKjHm+3otYIObB LmuB+hPUN7PSUk1qI5VubdGvAPqFm7sWyfBjceC0LFKb2zCaFQVbk/5PcZkgewlps8JmWkPes gUrMTVpF5fcID9dAZDwD6tzUNU0cNSXcKbchzwkZLG9UirE9Vd2FpkomGUzoPRxf2DeV3h/nP J+24hv2VNU28m7y4jcJ593SDX4PuCv3Q4NEYg23O07GYyzLPy4qoQpFQb9qq19cpo4Xip6Ch5 6XCnDf3whvyT/qeTCqdgqXer7d9IutBC7GzaVnK1vd/EVik3K8J1+NXS7TELsemg9S1WGqAHj qh7Ygt4pHR5WbFGDvy+5p5cL8r6FO2czF41GQ/zTMviuo/WJB9swGvheHuiREUb3lyYeOro3A PS0pSHFLIooiuY= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 09/13] efi_loader: bump UEFI specification number to 2.8 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" We are implementing UEFI variable RuntimeServicesSupported and set the unimplemented runtime functions return EFI_UNSUPPORTED as described in UEFI specification 2.8. So let's also advertise this specification version in our system table. Signed-off-by: Heinrich Schuchardt Reviewed-by: Alexander Graf --- v3 no change, added to patch series --- include/efi_api.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/include/efi_api.h b/include/efi_api.h index a36ececc81..d4f32dbdc8 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -23,8 +23,8 @@ #include #endif -/* UEFI spec version 2.7 */ -#define EFI_SPECIFICATION_VERSION (2 << 16 | 70) +/* UEFI spec version 2.8 */ +#define EFI_SPECIFICATION_VERSION (2 << 16 | 80) /* Types and defines for EFI CreateEvent */ enum efi_timer_delay { From patchwork Sat Jul 6 19:46:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1128527 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="TUNCVqLn"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45h2QS0MHXz9sNj for ; Sun, 7 Jul 2019 05:51:11 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B3A29C21CB6; Sat, 6 Jul 2019 19:49:22 +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 9E3FEC21E29; Sat, 6 Jul 2019 19:47:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id F0775C21C51; Sat, 6 Jul 2019 19:47:05 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lists.denx.de (Postfix) with ESMTPS id 66890C21C50 for ; Sat, 6 Jul 2019 19:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562442424; bh=0vgAwc2SzwmyHgVYP0YOIo8NZlIl7gBePLr1Gi+cKjY=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=TUNCVqLn1fpOjyM3bWOCcnrNCA3CKmNETErmPZ/C+2Xww+NNrYFfyp/hPIcI526/B wJW+2UTG3lgfyOvMyxFsfIiByVfCkbOrfKODL2y11WIAOH6KEwvGzPkOXEINv6cjVH ZYJsDPhwLBZxhDo9o5QcThviCNkse2LESS9m2bBs= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0LguAU-1iG6ms0w3K-00oH4x; Sat, 06 Jul 2019 21:47:04 +0200 From: Heinrich Schuchardt To: Alexander Graf , AKASHI Takahiro Date: Sat, 6 Jul 2019 21:46:31 +0200 Message-Id: <20190706194634.3349-11-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190706194634.3349-1-xypron.glpk@gmx.de> References: <20190706194634.3349-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:LWth3pK4Z6wEJFIq1T1oZXArbU5B2CCb/x5/CMsXL4VCYlkgcVj bM4DejjOOh7A1ni1zb7a2rJo7vPlcs2C5sCBLFbzQ+gKDVzUQoBKQszQpDsSKEH81Ngzwph RcbVwLg4sNEMiMS/BS9KpDD4RffP8Uh42RhSshqfVpgDOHV+x8e4yWtOyIaR84QNAJIw5x/ 8SPsaDIYmkjpNkMrQt8iQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:8Io6A1QDzQU=:82BjhPjiA41f0dahXijvo6 lMPSL/cRmiLFgj4BCkDnJtkr8Ufuyko6JlqQKV56vhkwcieromAxvQtHxkd87oYS5pYWUF4i+ AG1FC/o2WS0a1vqvB5eN/WyyD09XffT0bG0ggZovJkrQojrEtLwdXpKW97RciyLABrl55U4/K NRvP687iuqFnemj6YUmRGHTTsbGugmbaLlgjSv5pGZvt+cWQRhzBfNY8ZiJ2U5OFUe6mhjEMS IOGab8wX3tcU3aEJNKOajkUl2mBUyR8jwcSlw+pC4Uo1RD6oFW5trZZ+JvwNMzhw/mEJ+vCaQ EvIYpYICm+h9WTMGIydhjX1R7yKJJhmO2AfuAfr7ektQCPEG9b2pMz2SYXrcinsVCp1vyShii S6sQfQkukvl5YvrF+PTzxXHCv4+dsoYhSe6HAP/vHQ7h6AOlS8+S5hqODSyOW9KAyxPFdzEW9 edQYOQ8blHd0oBQY5p1CRihd18X8a917Uc+84o+ziK4Hvpi6DPE0nkzJ1qebRdYM5m6RzuXiC XsL3+pzVF7XTobtiL6JGpEKb/CYbDdfWcjtSZa3CtHc4U84XFFF08V5DwZW/oKOgGFuftttGg OEAI+9sYncNFrhPhP005/fpZ+yEYhuCtZZEYZdyUm2dNu3dqAI6cnX1p2ZAynXrmV3wYM43nP ERH0KqC+qefhcZWRCOKeL53x0RRiK+IxjUaqjhrubMtEgwsOD/J1Z6nLGXjVembvhEH7LBbz1 PEJtc8X5g6csFrJcskudoU/Z8VkaDBsYQ6diOY1CzT9hBNHFW/kDmvyGrZ7t1VlM0CHSin7DT qiiW34tH8KStydpAfPjugQ1ZCHUdeuxfCnflfY0+fGxYKxYPw4ToYqSfDKau8KxHjbmKIaGD6 eJdIFIyqJtDgOI67Tl41a6uVHnEXAP9UZGVLr9JXgX76W3j7iJ/+jcjNRODwlwg+73mv7p45V 7Ko5quH/es1zr4kjEDbxWuDFg/xoogrplDCSffL8rTTGVgbD7rJCmqk0UJA/UPP9IBFz+JJ2t szjZVsTKAZA/3p+uxgeeku5j9k5F5eAxodwTfwK/tVMW1zwN0RdyDABDkM6b3gBGpEOqsQYl8 6QgspuvEkx9Z2w= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 10/13] test/py: not all boards support UEFI runtime reset 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" As not all boards support resets at runtime do not test for it in the Python tests. Signed-off-by: Heinrich Schuchardt --- v3 new patch --- test/py/tests/test_efi_selftest.py | 4 ---- 1 file changed, 4 deletions(-) -- 2.20.1 diff --git a/test/py/tests/test_efi_selftest.py b/test/py/tests/test_efi_selftest.py index 516e41cf51..d5430f9c12 100644 --- a/test/py/tests/test_efi_selftest.py +++ b/test/py/tests/test_efi_selftest.py @@ -19,10 +19,6 @@ def test_efi_selftest(u_boot_console): m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key']) if m != 0: raise Exception('Failures occurred during the EFI selftest') - u_boot_console.run_command(cmd='', wait_for_echo=False, wait_for_prompt=False); - m = u_boot_console.p.expect(['resetting', 'U-Boot']) - if m != 0: - raise Exception('Reset failed during the EFI selftest') u_boot_console.restart_uboot(); @pytest.mark.buildconfigspec('cmd_bootefi_selftest') From patchwork Sat Jul 6 19:46:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1128529 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="MfigbETH"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45h2SF30g7z9sN4 for ; Sun, 7 Jul 2019 05:52:45 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 0107BC21DAF; Sat, 6 Jul 2019 19:49:35 +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 3E946C21E18; Sat, 6 Jul 2019 19:47:13 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1A760C21C2C; Sat, 6 Jul 2019 19:47:05 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lists.denx.de (Postfix) with ESMTPS id 96F88C21C3F for ; Sat, 6 Jul 2019 19:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562442424; bh=/t4Ikv0fRuggo+qnIOLrOVJTQL5IiSFi4HXM0Ed32B8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=MfigbETHEC9B3fo1WaFgXJQsbV5n7rFFnwuhCIBxHiOCy45prFS7AdFo+A1bzANBP HAR24m5DWF/WkT8aM94+Pezty2ZXki3LDsvVM1Z+1pcJ3sziC4T6Z0MWsx3wx2j2ZS HkEIlQez2HEwHXPgU+m5mM+BsjNy5i0Lt0S3reLE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MADqP-1hdTur1von-00BM1w; Sat, 06 Jul 2019 21:47:04 +0200 From: Heinrich Schuchardt To: Alexander Graf , AKASHI Takahiro Date: Sat, 6 Jul 2019 21:46:32 +0200 Message-Id: <20190706194634.3349-12-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190706194634.3349-1-xypron.glpk@gmx.de> References: <20190706194634.3349-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:AyM4YFNK9Q40zHUnKsO3jldGAdgM2/jjccDaYEb9wYkPDcitvel r6Ul5TpmuNLTtOcrhP28GypLkyBqvRLDtu1nob5yfTLW0ZLVTnD6xLvoUmWJHFuhgILEanm AgJqYz9DEUGlgqqz45ttjC4aVUK+olE7JgiL8mheTABLuWNahDH3Xt9/emQI7ajAX0uBee6 d5+YZI2nBiXUrhle8+9qg== X-UI-Out-Filterresults: notjunk:1; V03:K0:b91W5wDQXEY=:/lqXuDkpy6os8ATlJz5Et5 4wC1Ua9aGTzK4kxucqMeXwhLWTrmGJV2vm58C4dNELnk1HiqhUp6g48TJZnfphU0Hovv/8c6O JsJW6oD2MdpPFKkZ78C/rka1pVgIoVMBbidabGjYuwhH0NYHHLooNFP0Y3FDSrrOtrCItCXiU fYV422IuwHg6NyEBY6CTu/OsRzgyobRBPdONfUXmacrFt7NF3hLSzPYXUfB8y33cJUyZZsZ+o cNWE7GwFaUv4TefwSBZarGigB+dXpF3JbWjgSLVBzg1/Mr4UTGgMSUy9b+iQ6YFMEIzveUAmL d8OrCQ/rdozTS7ZlJFpP6M6xlOOQxobMifbYJLIwDosMrN2D7+CK8oJvrrjZTsIyhc9deLi4/ c5OdVhbCERsLmGiB6f2sRfgcIx97aRRNoLaaIJMvzKofDGmDQ/bjK7g3KH0yYXlUHtGLAUbx/ NP7SXPsuJGKUms4dBFSWAwim5Gq2mZhjlGiaSVGMnMjAJrUx8RO78pfFDzWmdhz16X6nAWOov wqULI5L0Ls0Eq6g+H3sTOYgVyE9iiGXvB3tequET0JS0UsmkxQiL/vrz/WUhuAkgdxuafu/Cs yI3XbYIXZ5W8hzLzXiKqGhoKlMq0hs2jkjN5MQUjRtPU9C/mQ9kAE9A78TIi5NTJXODqki9K5 8t5R2VoKujx3VXcRl9w6eQAjwGRaGUlTBg3qRC9EsbbONndxCYi4+bxwzupb/fMOnDWjWs1yx UVivAUcTxd1qq0Jl5ukPnI1u/tSR/xUlQ3uet5k8O0sztysh8ySIuemG9SpYpTn+P2PJoxriE ZecL+W5nFESV92gvTtXzl2cdTp95W+h5BMszpGDvYuK4IWmKTvFXlW6DSws/iOhfDMODEljAS E3l8lD2xkiWSFbg6ZIm/yiNJfO8gqC1KcgUYEnqiOLYhiv1z9ukhtD8z8FHFPuKYpLTvOywal 1+X0tjv0DTT3SolzC9vqwZmehxrH1iDiFzzowl1341RoyKKifQyKE4fvChkWXC695ykJtndbp 43B4bV+VUCj4wCJ2yPZmT14yHOpNINJUHyMFRID0DJ5scehxCdKWE5v8FZ9ajOa4v2eA8Kqhr 535bA5jXFZmTCg= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 11/13] efi_loader: decision on EFI_RT_SUPPORTED_RESET_SYSTEM 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" Move the logic determining which board supports reset at runtime to Kconfig. Signed-off-by: Heinrich Schuchardt --- v3 no change --- lib/efi_loader/Kconfig | 6 ++++++ lib/efi_loader/efi_runtime.c | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index cd5436c576..a7f2c68fa9 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -101,4 +101,10 @@ config EFI_PLATFORM_LANG_CODES RFC 4646 format, e.g. "en-US;de-DE". The first language code is used to initialize the PlatformLang variable. +config EFI_HAVE_RUNTIME_RESET + # bool "Reset runtime service is available" + bool + default y + depends on ARCH_BCM283X || FSL_LAYERSCAPE || PSCI_RESET || SYSRESET_X86 + endif diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 63d8a29146..59dde8a27d 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -95,10 +95,7 @@ efi_status_t efi_init_runtime_supported(void) * This value must be synced with efi_runtime_detach_list * as well as efi_runtime_services. */ -#if CONFIG_IS_ENABLED(ARCH_BCM283X) || \ - CONFIG_IS_ENABLED(FSL_LAYERSCAPE) || \ - CONFIG_IS_ENABLED(SYSRESET_X86) || \ - CONFIG_IS_ENABLED(PSCI_RESET) +#ifdef CONFIG_EFI_HAVE_RUNTIME_RESET efi_runtime_services_supported |= EFI_RT_SUPPORTED_RESET_SYSTEM; #endif efi_runtime_services_supported |= From patchwork Sat Jul 6 19:46:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1128530 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="O6or/izy"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45h2SS2g5fz9sN4 for ; Sun, 7 Jul 2019 05:52:56 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 04259C21D8E; Sat, 6 Jul 2019 19:49:48 +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 EEC88C21DAF; Sat, 6 Jul 2019 19:47:13 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2F60CC21C50; Sat, 6 Jul 2019 19:47:06 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lists.denx.de (Postfix) with ESMTPS id D3B0AC21BE5 for ; Sat, 6 Jul 2019 19:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562442424; bh=+7GIOEcv2BFl9PcJzkZ+XXOnX4kO6NX3pUN+VBk9/a0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=O6or/izyZlwvffWMZCvarSspVoVsIq876KjTyoiaQKBqw5bQx9zSKJnKfi6l5ukqz uXvbOIOxr6Q8uLh6kNrxI4LnB0kC8YWd0lY+aFgxVIxjrngqFgg7A3Sb4sKUwUI6L7 DwvWzuN4c07Ag7hG/5wY8fkMNakVppbNo7B/mxfo= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0LcnRD-1iC0Br2uBj-00k8Lm; Sat, 06 Jul 2019 21:47:04 +0200 From: Heinrich Schuchardt To: Alexander Graf , AKASHI Takahiro Date: Sat, 6 Jul 2019 21:46:33 +0200 Message-Id: <20190706194634.3349-13-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190706194634.3349-1-xypron.glpk@gmx.de> References: <20190706194634.3349-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:8HvDuuvNmxvWh/wBHcyIJwlLa0nsr/HmgH+/DAPje9eyfv45vMb TZ8tUpCu8XfUfb5gn7/O3LvdDM6bNi969J3o/sB4ZqkH7t2G2vUwfRj8FkoWJnC5hXSInvO LH+N7FrH9g7thPbjSTpScRNj+DbStDTatPtsXZQps5NJStp4uXmi4O6Smx3sgYFv4vd+PUS G7l00Qg3zMzuKPOQE7wUQ== X-UI-Out-Filterresults: notjunk:1; V03:K0:ocXbLOk3ebU=:j5z2Ftqr0SQQh11/3Wrgsr KHdK8CUQQMbav15Tndc45N09QYNVyCx6A8jGbk4HsY5fIs9rXkLuRmfkA6nLP1Zg5A5iwtuCs etvHvcGBBLpn8QnhOTeQTDnd5appYRuL6T8ijSMny9QSQe2/kejNStzlq1PW+nJLlY84RhuwQ aV097/EcEPzivRAZsQuy5F5/I/I8Q9jkbPQdN5DEIpRKRsYdwgOae2FkJQ9hGUtvWSJ54ORYu z9xf31g+3/fnCv3TBhAJZWgVz9yUNU+BtPcsirCvinPBJ9cyvgjverXeOcxcudhNDVmiUi/P0 2Uk6aB/3u6jGp9Mfk3Z5QV9rfHaOc7QGxpuvaEkKAbToo+PozNCNYOGLJWgXE4wWqWcMwFO3T N4WPhf8w2QwHUjxs2gQIbAAPEg0eULCbmDDl6avGZyfLtPFxQTYNl1tqgG+SPI9eiaIahYuLn GdZGEe9fJVqBPV0q74F5KoBk1/7EmnXMdt2nIF1WS6kZa1KTHKr1yLqJICOY872c/Vr21r5r+ 0ticxlNS+FH7N+T4ofVfkAN/G1K2Kqni0jCwIOPQ2zsNtjBpSTyaP3b4c4H3ZSBGnffIu39Nt ew87J5vYkXvcj+6lRf0gvFp1btBgiSxSuPnAhCwn+heWeGRX/CW1w4tMtcxxuHTniMoZ9mXd8 k1D/ZFNT6JtIR/MqcISivEewSbwIol4QPWqmI5/VK9k5PINYzjM+jBwsLk2C/767qVEjQRvhV 7X+E+1bDt5cK8FdzaNy10iaRneHRYpzpCCOF9Lv3yO8GpdGHzms6PG4ptFkr9oYabIULut4BP 3Vx5JbxOMvXJE76wWeF+gpKN8v+PjSaj6b8sHfTq+NQ+ojr4uif4w0iWZzhT/JbYZiCzKigo2 EaB7LbUAMhOgTAjAhZZ6GTwRJzrH89gBnKnfVOCbXU3MF5si38+Iz1jgxxrrzf6voFRb2flHc dH5al5TYDvPUXaCFsRROUkWoFRVffJSrGZJ85ty8akESqFMlZSR5x10Acya3vjqVnfnViJkKM roNY5NGK+1UKVvEhX0ZSSEl6f/NIkEsu8+EY4IxHne4fsSm8AnRvL0DTBSG0V5fWmvsa+M/QK 9UnJ/dbbxumA1g= Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 12/13] efi_loader: simplify detaching 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" We do not need any array typed detach list. Let's simply update the pointers directly. Signed-off-by: Heinrich Schuchardt --- v3 new patch --- lib/efi_loader/efi_runtime.c | 40 ++++++++---------------------------- 1 file changed, 8 insertions(+), 32 deletions(-) -- 2.20.1 diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 59dde8a27d..dcbe824451 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -382,26 +382,6 @@ efi_status_t __weak __efi_runtime EFIAPI efi_set_time(struct efi_time *time) return EFI_UNSUPPORTED; } -struct efi_runtime_detach_list_struct { - void *ptr; - void *patchto; -}; - -static const struct efi_runtime_detach_list_struct efi_runtime_detach_list[] = { - { - /* do_reset is gone */ - .ptr = &efi_runtime_services.reset_system, - .patchto = efi_reset_system, - }, { - /* RTC accessors are gone */ - .ptr = &efi_runtime_services.get_time, - .patchto = &efi_get_time, - }, { - .ptr = &efi_runtime_services.set_time, - .patchto = &efi_set_time, - } -}; - /** * efi_is_runtime_service_pointer() - check if pointer points to runtime table * @@ -415,21 +395,17 @@ static bool efi_is_runtime_service_pointer(void *p) p <= (void *)&efi_runtime_services.query_variable_info; } +/** + * efi_runtime_detach() - detach unimplemented runtime functions + */ static __efi_runtime void efi_runtime_detach(void) { - int i; - - /* - * Replace boottime functions by runtime functions - * TODO: move this step to ExitBootServices() - */ - for (i = 0; i < ARRAY_SIZE(efi_runtime_detach_list); i++) { - ulong patchto = (ulong)efi_runtime_detach_list[i].patchto; - ulong *p = efi_runtime_detach_list[i].ptr; + efi_runtime_services.reset_system = efi_reset_system; + efi_runtime_services.get_time = efi_get_time; + efi_runtime_services.set_time = efi_set_time; - debug("%s: Setting %p to %lx\n", __func__, p, patchto); - *p = patchto; - } + /* Update CRC32 */ + efi_update_table_header_crc32(&efi_runtime_services.hdr); } /** From patchwork Sat Jul 6 19:46:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1128531 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="I5q4/ZUc"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45h2TB068mz9sN4 for ; Sun, 7 Jul 2019 05:53:33 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id A6E7BC21BE5; Sat, 6 Jul 2019 19:50:01 +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 8C21FC21E0B; Sat, 6 Jul 2019 19:47:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 851C6C21BE5; Sat, 6 Jul 2019 19:47:06 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lists.denx.de (Postfix) with ESMTPS id 23713C21C3F for ; Sat, 6 Jul 2019 19:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1562442425; bh=SfLofAyjrOjNDuW48IOnAQoFiMGtIu9bRoPMeIOA0sU=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=I5q4/ZUciLFFi7cVwduZnxozDQlQdBHG3t+XqYeLDCK9LlBLumw9g4iMeOxfiP6+1 L5jJW/HAsZ1FQtEAhpb+cCa6UjJj39AmhhnSGEzyvtxOVMA7Nkz9acetaSz2H5buMY 7EkMx5N6U1jpxw58X4U16+iRLo0lzO7+b9uGCy9o= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MWgND-1hzwTj41Ep-00Xqgs; Sat, 06 Jul 2019 21:47:05 +0200 From: Heinrich Schuchardt To: Alexander Graf , AKASHI Takahiro Date: Sat, 6 Jul 2019 21:46:34 +0200 Message-Id: <20190706194634.3349-14-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190706194634.3349-1-xypron.glpk@gmx.de> References: <20190706194634.3349-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:1lR7/MTHBp7vcJILChgU2N9juAHthsmtwRMs97F3wV6AqpF2UA2 1K9oxLPBY+qUKKPBbasCPidunJSOdz6cKv6DRU7zFG4I1SjJU02s8EP+kJZale2pXUXujKN UmWky3dolhYYEC5ldWWs0Idq16pLPqKYw1vN+RrumWHPNgUCa4HVnZRq0bAVUzqk2huu26H dX0sHS6D0O4IM9v9c5PdA== X-UI-Out-Filterresults: notjunk:1; V03:K0:zbNOlQoI1YI=:BKQS6vs5cA6k2JD15nxmVi PiBY4HYYO07hRqc0j0bBvIacxzRhFOTCpdjnRUAi0qZzM4lebu3x/2DMR56yO08M9t/wa4Ad0 sAeNpYgR8AecgCvIFirYI5VUmHIrgk+dpAWLkLNwi2p0fP7qchLJRRXkCI5+GuIVVgExiD8Me 0lETTQ4mBDRXfeoTAPwi3GRvCwxrLaXzAj6jBE/2G3TIk0HqP1lSF29AV3/aDQWyYXPuEH6Qy TaKNGjYtPzj3y9v5Nrwtn/ZnUr2cedxFokyE1HQYNmi38L8iAZHlfQSoeW8goL/zN4Xz8VPlO VsSARC2+uA1HwBUs/01UCBl4Y+4Gdfx5OponT147lb+TBaA7txe3IyBniOLLyicwZlKXKbGDJ nRy/qwtGA6Y4gfBaxcBLgUfm+GPVeqGGdAK4IuQO2dr4ln3dDOPSaWpasC8UuLIcRzekOKM6s x3KvCSggUiE+rSBgnkN6cZ80/CWJ15nueqwQnPA+W4s/8x42+0D7//tKw8tuNMCaNz5g+209g HUsISjHuY/IzWcHFu9jx34A5mRyNoqtBQXNbv2UnXv6vjMTB9m+Pmz92xesDzSOTXrF3iaqOs mnPrFWdor2XF7B4/0yDsA2BlyMJ6roKldOsfwmFwuraz7jTebwRy2v48XnLtGtrx4g+hjl72x T/WnjBnINg0PnM6gSnjOziQy8hItcWH3z6eFcUg0N6weiV6P8Y99xUxdFld5cS51+k/EU9IXj FaVwRKZlkDp1D1PaPgeoJY6dg+QfOvld7BAdLV7pIwITSag3HE60f2VWuwRWjUb3/Ey35oj5U Syey4W+FeK4knxFhx51pBhFp7sV1u07g00lCtG2IHj+gHbzNGrJ8Tr95fLTcGM+g43VaTyW4p fi2iYejPWGRAWG0RXx/FSnLSPGhv76i/jASZdZu9z0HeJnDFPYC0sId4z3/65aOV4VQtze6/3 2QSTMGK5PGDl7FvuB20vOwKPNgNDPWXZbNPlxJMdxH8PgKwESvVj6s9edBJRKucqx/SUIbHhn cBEtEUg94tR211U8mO/o9MbD5t0B/lSuZLpFucgMGHa1qLCY1qnXiD9W1qwj/UHeOU3vstxn+ MxBfB2+8Ur2+8I= Cc: u-boot@lists.denx.de, Ard Biesheuvel , Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 13/13] efi_loader: detach runtime in ExitBootServices() 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" Linux can be called with a command line parameter efi=novamap, cf. commit 4e46c2a95621 ("efi/arm/arm64: Allow SetVirtualAddressMap() to be omitted"). In this case SetVirtualAddressMap() is not called after ExitBootServices(). OpenBSD 32bit does not call SetVirtualAddressMap() either. Runtime services must be set to an implementation supported at runtime in ExitBootServices(). Reported-by: Ard Biesheuvel Suggested-by: Alexander Graf Signed-off-by: Heinrich Schuchardt --- v3 new patch --- include/efi_loader.h | 2 ++ lib/efi_loader/efi_boottime.c | 3 +++ lib/efi_loader/efi_runtime.c | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/include/efi_loader.h b/include/efi_loader.h index 8d75dde569..db4763fc9b 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -333,6 +333,8 @@ void efi_variables_boot_exit_notify(void); efi_status_t efi_root_node_register(void); /* Called by bootefi to initialize runtime */ efi_status_t efi_initialize_system_table(void); +/* efi_runtime_detach() - detach unimplemented runtime functions */ +void efi_runtime_detach(void); /* Called by bootefi to make console interface available */ efi_status_t efi_console_register(void); /* Called by bootefi to make all disk storage accessible as EFI objects */ diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index ba4c1e5765..c2f89805c7 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1973,6 +1973,9 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, board_quiesce_devices(); + /* Patch out unsupported runtime function */ + efi_runtime_detach(); + /* Fix up caches for EFI payloads if necessary */ efi_exit_caches(); diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index dcbe824451..7a64dd42ca 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -398,7 +398,7 @@ static bool efi_is_runtime_service_pointer(void *p) /** * efi_runtime_detach() - detach unimplemented runtime functions */ -static __efi_runtime void efi_runtime_detach(void) +void efi_runtime_detach(void) { efi_runtime_services.reset_system = efi_reset_system; efi_runtime_services.get_time = efi_get_time;