From patchwork Tue Dec 18 05:02:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 154058 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3279331ljp; Mon, 17 Dec 2018 21:03:32 -0800 (PST) X-Google-Smtp-Source: AFSGD/W6BTbEBmoJG7llALvH3exNW295POBt2mvN+FLlkYoDQ3NQpNotyQhR7gyQSNNuU4MELAPq X-Received: by 2002:a50:a2e5:: with SMTP id 92mr15387602edm.169.1545109412671; Mon, 17 Dec 2018 21:03:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545109412; cv=none; d=google.com; s=arc-20160816; b=zeZfrrOD4opyh90Q9GU2jjjOS1ciaCFHJHX97QXH28pE21uVZnY+oc4SCyVFjUBsh6 Nr3fj5zRra6HPCVbsZxCIqDE2oOEStA8f94zO6cASMyQHEX1W/eYFM4jvKo8q7gsWsfX 4mVV2LzZh+bwlKq7cbHjkl5ITzetPt+iHTJJUes8PFEEDQI2h00hkz0WHm8Xjp3wwQ6H uwgaTpmbwxInGW7K/AqdBmo4YSXs3zPsepd4+URCMptmKyBtdBBlSpd2UOEXCy4VSeGz RBj6U8V9LCH+OLNZgF9k736esdKssyGBxQ0YknYcrGy84lM+bLMsLQfynCAjEH705mnG B0xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature; bh=S183cCR6kh9GC0iwI93tn8VdHe6FFfSBTo5AZ9w+Z+g=; b=uszwGMAeqf4w6CIguR6WjH/9r3PbbzwPDnhYOoTPulEwGEIuUjl18RatKlkUVVCeqj uOFoS0FrV4RX0YLEL/2n7/RrkNIYbEN60pudkKMt6hFJU2xNujXlmxMWT41VvpYG8Lse ZPQKZa9xmhOB/1XhOWWns1oBDUe6ITh9nMw9e8JKhZXnVrVNhb02FuNwLE6ggzEuJ8FD ALpqfg5tYP7GftxG/ubARAcT5hZyGj7Y646/QDUwAJr5GF2QPaXMFm9KrXsBPgrwbZ8W ppQJYZPgRgJw7xVldzijCra915WGiT8alGF9QgT1GG/FBdD7Bbm0wuEVHTCZmuRK6EPu CyuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=dqcZinfz; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id l19-v6si2118851ejp.77.2018.12.17.21.03.32; Mon, 17 Dec 2018 21:03:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=dqcZinfz; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 5068EC21FC2; Tue, 18 Dec 2018 05:01:28 +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_DNSWL_BLOCKED, 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 5757AC21EBE; Tue, 18 Dec 2018 05:00:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1AEF1C21E89; Tue, 18 Dec 2018 04:59:42 +0000 (UTC) Received: from mail-yb1-f196.google.com (mail-yb1-f196.google.com [209.85.219.196]) by lists.denx.de (Postfix) with ESMTPS id 31988C22033 for ; Tue, 18 Dec 2018 04:59:38 +0000 (UTC) Received: by mail-yb1-f196.google.com with SMTP id c67so6027298ybf.0 for ; Mon, 17 Dec 2018 20:59:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XfdP5/2N9Uf+K6ylGDnd2ScBCIbYNHqyXjeSfDq385A=; b=dqcZinfz3Kp3Jua0QW1eHAOVbbiCwsAHk8zB/2rbKlti1fHxp2lqunsWMWaLzF+oZx M1x3OeLXE9oXImTjABXKmKaBHrhFEscUm4z2olNSSATCUV54QBW/HxvxyYqokhwWEACY 7gaaaayhOiwFQCmvHJjuZE1IcvFg6I8oJobr0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XfdP5/2N9Uf+K6ylGDnd2ScBCIbYNHqyXjeSfDq385A=; b=l0E0FydBL0FxrxKhHmdrIKLbrurdz5TLuA5D0OuTSt/2M5QjQLzO7VjaFaVg7gMqfS rMqRdSC2GIAxRuH6JP+Es6s4j1bCK4zOnry6jmKTea/nv4TjXfmQgWiynEPTDWaIYW27 gRX+7GYZBgsB1CcqATYo1/wYfXoT7FAhda3OXqw1hx8lrUlJZWcI2XRgblHCIHwpMovR nu2YB8jHIhf4uhPHGlxJh2Yv43UHt2IorocV9EPsRXdmaedJh5LNnwGe0gw42uVmXigB Qy4TtNPn9+Bw2/XYjlxn5pTmOjLx0HCQ91NENz3pliTvHxM4wJwfklODQolAu3COlxBD 4KGg== X-Gm-Message-State: AA+aEWa05/XvvWYGoIN08jIPAU9xvzr3XMrjc6nCGEfmtI9/E92nG0ZS XitPVJWRou1nJfMQuB9j5y2FAg== X-Received: by 2002:a25:2c04:: with SMTP id s4mr355202ybs.245.1545109177117; Mon, 17 Dec 2018 20:59:37 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id p11sm4485428ywm.60.2018.12.17.20.59.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Dec 2018 20:59:36 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com, agraf@suse.de, xypron.glpk@gmx.de Date: Tue, 18 Dec 2018 14:02:54 +0900 Message-Id: <20181218050257.20142-3-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181218050257.20142-1-takahiro.akashi@linaro.org> References: <20181218050257.20142-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 2/5] efi_loader: bootmgr: allow for running a given load option 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" With an extra argument, efi_bootmgr_load() can now load an efi binary based on a "BootXXXX" variable specified. Signed-off-by: AKASHI Takahiro --- cmd/bootefi.c | 2 +- include/efi_loader.h | 3 ++- lib/efi_loader/efi_bootmgr.c | 9 ++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 7012d72ab50d..3ebae1cdad08 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -452,7 +452,7 @@ static int do_bootefi_bootmgr_exec(void) void *addr; efi_status_t r; - addr = efi_bootmgr_load(&device_path, &file_path); + addr = efi_bootmgr_load(-1, &device_path, &file_path); if (!addr) return 1; diff --git a/include/efi_loader.h b/include/efi_loader.h index dd68cfce5c65..5a6321122c9c 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -551,7 +551,8 @@ struct efi_load_option { void efi_deserialize_load_option(struct efi_load_option *lo, u8 *data); unsigned long efi_serialize_load_option(struct efi_load_option *lo, u8 **data); -void *efi_bootmgr_load(struct efi_device_path **device_path, +void *efi_bootmgr_load(int boot_id, + struct efi_device_path **device_path, struct efi_device_path **file_path); #else /* CONFIG_IS_ENABLED(EFI_LOADER) */ diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c index a54ae28343ce..db391147fb2d 100644 --- a/lib/efi_loader/efi_bootmgr.c +++ b/lib/efi_loader/efi_bootmgr.c @@ -180,7 +180,8 @@ error: * available load-options, finding and returning the first one that can * be loaded successfully. */ -void *efi_bootmgr_load(struct efi_device_path **device_path, +void *efi_bootmgr_load(int boot_id, + struct efi_device_path **device_path, struct efi_device_path **file_path) { u16 bootnext, *bootorder; @@ -195,6 +196,12 @@ void *efi_bootmgr_load(struct efi_device_path **device_path, bs = systab.boottime; rs = systab.runtime; + /* specified boot option */ + if (boot_id != -1) { + image = try_load_entry(boot_id, device_path, file_path); + goto error; + } + /* BootNext */ size = sizeof(bootnext); ret = rs->get_variable(L"BootNext",