From patchwork Thu Jun 14 16:55:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 929592 X-Patchwork-Delegate: sjg@chromium.org 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=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="AHrjs12I"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41692H73NZz9s01 for ; Fri, 15 Jun 2018 03:04:07 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B146DC21E29; Thu, 14 Jun 2018 16:58:02 +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=RCVD_IN_MSPIKE_H2, 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 392BBC21D9A; Thu, 14 Jun 2018 16:55:54 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A7791C21C29; Thu, 14 Jun 2018 16:55:42 +0000 (UTC) Received: from mail-io0-f196.google.com (mail-io0-f196.google.com [209.85.223.196]) by lists.denx.de (Postfix) with ESMTPS id 506D6C21E0F for ; Thu, 14 Jun 2018 16:55:38 +0000 (UTC) Received: by mail-io0-f196.google.com with SMTP id f1-v6so7834534ioh.6 for ; Thu, 14 Jun 2018 09:55:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=HEZLhwZsHZkkGWDpucgE+TzuYVvmtN97JhwZe1eZ8Ac=; b=AHrjs12I4SeDYLNWaOQykEdSlUTg2cJrxwZ4t+NeELDSFAgtj1CWtP8PcRKFqYC9VH bPjbVK7bN8zsXT3hc4+5yuH6+xMhFwFlrmStGn9NVbpkdyG0AxMc4H95K2nbQ+LfLsh9 SVtKngtE01cfU6cfzzDTv5RciQohWAfI5kohqIQUgaeQQycjBk/88MNHJko6i8SZjeQM mIIifhJw8JuSQ3v/ez0ZEcFGP+5vz5AXw3ymR2E1ZKassQHETX2onId1wUWw9G06cbp1 9szEI2vQ07Vac0Zbq2m41nBqOJUz1WvnuYwlGo9M77sIyTDbpemcwaZqOZudwAkqpmcM nvLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=HEZLhwZsHZkkGWDpucgE+TzuYVvmtN97JhwZe1eZ8Ac=; b=GP0lTNOTq23TIMXeWyKit6KIODp6segxuMt1hTZMwp57u8GnVYuAWNydT1URMdYBGK Lr7eQ9muaR7szeOjbn3GE5axWQn7ilhkXi5uLe8LSFUmQToDP9MprTqlhcuFUPP9lWTJ qXowQfvckYYO4Lpi3kqap0cgf55HTwuR9WVMWhVmoAKFW9zXu6drA0jVboGZJLQOmagu rFA21m8m5tQTtRoclRfvri2C9Kude/Ys7eURMEMFRXO0y+9GM8RibtcUeBg0xistmfqJ GoANSzBknO5a2ntrzru61gtdFOqNjJt6geWN4QYs5/6rjI2qn36rUsA+FziFGYdeuD3V Twfw== X-Gm-Message-State: APt69E1dyXbRqm/pm5FmkEKPm/JPi1WhoxXyxFL676k8ynrUq4FsvEFR ducyr1TBV/8W/JIViEAmh1XkRA== X-Google-Smtp-Source: ADUXVKI19I9dFixfeZ7Mi4anF8JG316iK4ZU3jn6TrtH6gFZzJce2hzK4VAEBEATbBRvkULdc4tlXA== X-Received: by 2002:a6b:d80c:: with SMTP id y12-v6mr2896451iob.127.1528995336763; Thu, 14 Jun 2018 09:55:36 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id k139-v6sm2967151itk.27.2018.06.14.09.55.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Jun 2018 09:55:35 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id CDE61140C6B; Thu, 14 Jun 2018 10:55:32 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Thu, 14 Jun 2018 10:55:25 -0600 Message-Id: <20180614165526.183597-11-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180614165526.183597-1-sjg@chromium.org> References: <20180614165526.183597-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v7 10/10] efi: Rename bootefi_test_finish() to bootefi_run_finish() 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This function can be used from do_bootefi_exec() so that we use mostly the same code for a normal EFI application and an EFI test. Rename the function and use it in both places. Signed-off-by: Simon Glass --- Changes in v7: - Drop patch "efi: Init the 'rows' and 'cols' variables" - Drop patches previous applied Changes in v6: None Changes in v5: - Rebase to master Changes in v4: - Rebase to master Changes in v3: - Add new patch to rename bootefi_test_finish() to bootefi_run_finish() Changes in v2: None cmd/bootefi.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index b9eb04531b..7a98c9a6bb 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -273,6 +273,20 @@ static efi_status_t bootefi_run_prepare(struct efi_loaded_image *image, return 0; } +/** + * bootefi_run_finish() - finish up after running an EFI test + * + * @image: Pointer to a struct which holds the loaded image info + * @obj: Pointer to a struct which holds the loaded image object + */ +static void bootefi_run_finish(struct efi_loaded_image *image, + struct efi_object *obj) +{ + efi_restore_gd(); + free(image->load_options); + list_del(&obj->link); +} + /* * Load an EFI payload into a newly allocated piece of memory, register all * EFI objects it would want to access and jump to it. @@ -355,8 +369,7 @@ static efi_status_t do_bootefi_exec(void *efi, ret = efi_do_enter(obj.handle, &systab, entry); exit: - /* image has returned, loaded-image obj goes *poof*: */ - list_del(&obj.link); + bootefi_run_finish(&image, &obj); return ret; } @@ -391,20 +404,6 @@ static efi_status_t bootefi_test_prepare(struct efi_loaded_image *image, bootefi_device_path, bootefi_image_path); } -/** - * bootefi_test_finish() - finish up after running an EFI test - * - * @image: Pointer to a struct which holds the loaded image info - * @obj: Pointer to a struct which holds the loaded image object - */ -static void bootefi_test_finish(struct efi_loaded_image *image, - struct efi_object *obj) -{ - efi_restore_gd(); - free(image->load_options); - list_del(&obj->link); -} - static int do_bootefi_bootmgr_exec(void) { struct efi_device_path *device_path, *file_path; @@ -491,7 +490,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return CMD_RET_FAILURE; ret = efi_test(&image, &systab); - bootefi_test_finish(&image, &obj); + bootefi_run_finish(&image, &obj); if (ret) { printf("Test failed: err=%d\n", ret); return CMD_RET_FAILURE; @@ -509,7 +508,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Execute the test */ r = efi_selftest(obj.handle, &systab); - bootefi_test_finish(&image, &obj); + bootefi_run_finish(&image, &obj); return r != EFI_SUCCESS; } else #endif