From patchwork Wed Jun 13 02:37:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 928631 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="RRNDAxm8"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 415B0s6Rgxz9s1B for ; Wed, 13 Jun 2018 12:44:29 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9CA6CC21E38; Wed, 13 Jun 2018 02:41:26 +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_H3, RCVD_IN_MSPIKE_WL, 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 B28F4C21E34; Wed, 13 Jun 2018 02:39:03 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EC498C21DEC; Wed, 13 Jun 2018 02:37:53 +0000 (UTC) Received: from mail-it0-f66.google.com (mail-it0-f66.google.com [209.85.214.66]) by lists.denx.de (Postfix) with ESMTPS id 7F32EC21E1E for ; Wed, 13 Jun 2018 02:37:49 +0000 (UTC) Received: by mail-it0-f66.google.com with SMTP id 188-v6so1927987ita.5 for ; Tue, 12 Jun 2018 19:37:49 -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=aJ9xhhInu6rj6jXjJM91FBb2ByY5EYOPx4uHJ/euGa0=; b=RRNDAxm8GyYOlbsu8Jph+3JtLGOMAVB1vkSG9E6UynkpSEl+absTQ6CzJct5mz83Bo IFqy10rsF3V2+0fkYYEI0PR6epTaubnuoWR5cWxIRFwSixWiyX9gVFd+cwkFD0+sSUHl 6OUv3QmNKoyQkofpCNVJe8YFnxQ/vsiaJTx1IKM4MsLL/yFe8/MNGG9Zs+vlBPv89fGh +32wIeLWXdpiJLACYvMOYtJ+l65cPRiaAr+9OXPbYYDXY8jxNV+KSlaMBhLwTihjaAL4 U+kan7S3Be4lRdfdR99rXt7YSxO8g+UNYIsg8D5bpoUCanyIitmPzpP48t4RNA8VKP+l 9X4Q== 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=aJ9xhhInu6rj6jXjJM91FBb2ByY5EYOPx4uHJ/euGa0=; b=pjzZQ9zeuJs6nkcfgxpJDsGeFGeVoJAnWPsSiXpbtsYWOyPaPlmTqDt9vJT1dhacxs 7xyGOLhp6X3PTS2OMKgoXrj8BvKkBJkY1ldrBHZATrM7SBe7S54rXETZzlRvs8xmFCic lJgteZqKQLi449FVff7JgBCfdHiR3QQzF/lhdo7FxorAH8oG3kPEqQCoeN/w4xzGUfXz xcUlJ4e90FIIZpjjb7uL7UhJJ7m5qLIb+U8pRCqN2Etx0z4FTeAGv1MkqPLvktkyjcYN PwW4hj/IbTvb2z5monlDsBvilxhoOcS0qgyFKOYbW1ZutLkiBzJiiri4m68Foo3+vuil A3zw== X-Gm-Message-State: APt69E1bl4vvh+DgGJSKkR25bVnn4XnO6VBBlnuRYhoeRJBoKxrMj/BD ZPn7KWU7LTDiOxM7B2i8EqXhrw== X-Google-Smtp-Source: ADUXVKJaDu7x/f/WF3Neh3+7pJXtvAnJuY+q6bNqLlCNIL0MoQCoHaPpP9WPfQMLYyeNOC59mFuvCA== X-Received: by 2002:a24:53c1:: with SMTP id n184-v6mr2991054itb.25.1528857467835; Tue, 12 Jun 2018 19:37:47 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id d13-v6sm955719itj.30.2018.06.12.19.37.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 19:37:47 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id A2AED1404EA; Tue, 12 Jun 2018 20:37:46 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 12 Jun 2018 20:37:27 -0600 Message-Id: <20180613023728.202173-13-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180613023728.202173-1-sjg@chromium.org> References: <20180613023728.202173-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v6 12/13] 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 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