From patchwork Mon Nov 5 09:06:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 150154 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2353489ljp; Mon, 5 Nov 2018 01:06:03 -0800 (PST) X-Google-Smtp-Source: AJdET5dNnNrApJbEAoG5LSL70WGPQmM0eckUvYTtOM5WZBEK2wQcP4S5epj3c7erxjEItAR1yPPp X-Received: by 2002:a50:b839:: with SMTP id j54-v6mr17706304ede.16.1541408763264; Mon, 05 Nov 2018 01:06:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541408763; cv=none; d=google.com; s=arc-20160816; b=O8SC/TXyZw+vMUQRRnbjQQgt0t9y2X9Yh96AKxT1CPM8Kw7DsYL2Uf+c+vtp/jMqyE cISUCqxa6q5TEHZ/NQZhsYBnZGk2pg4TZL+tAUu1yi6bq0moQpuZIvywRqDaCDWM+9wX IJemKvD0yYEZ9AAdqYGPIb9D9SDVAVWDi7aaOnylAMjDDG+D6YXpOIodO6cu/MQ2Ll/Q U/ZUt461mJ36bpQMHmHC7fqUs/gzRxkSdvh1aESjvjBIyb6pW/ouFxeiDpptH39opI+m IHYOf2j2HVdeAhg3LTMqu3vExEtfQsSmF+cjDr/Ideh4p3h9AQRKwuxmf32U0h2Bvpl/ HgIw== 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=EwHQv86LTCMYqGQXY+m+TYDyC+yxInq7dCLfmsG4Ru8=; b=slZ6oCGk77UAEHNHWVlI88MtF1AbnHU3HY/bWOtnczm5ATiggOb4KNH/eQZvbvg2WJ 2HJ9tbPSeatGNASOQnr9ZAuDS00KlC90BKxghRZr+ux/xZKxhb4P4TEnKqK6FVS4zJzK +7wCzerZtFjomtzMTtG7EMdGBOZXX+gyTIU5BGa1ePQNow8sHu/SVpIixDyU9wK/eN6V HKRhUj/lgatH3fmdK+gDPUAy4zJ4GdafNQC7ic6Jiwe9B6dzkP9hlOSyVKYqYH0hPSRQ B7mmQUd9SAIQOHxYIPYGn6wJA8x3hDZIoP/0dmzUCcELF6LVG2FKJFGkTsLlm1R72rZC 100g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BP2Lkah9; 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 w19-v6si4148414ejv.41.2018.11.05.01.06.03; Mon, 05 Nov 2018 01:06:03 -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=BP2Lkah9; 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 D8FE2C221F2; Mon, 5 Nov 2018 09:05:33 +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 7D5F5C2220B; Mon, 5 Nov 2018 09:05:00 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BC932C221FB; Mon, 5 Nov 2018 09:04:50 +0000 (UTC) Received: from mail-yb1-f195.google.com (mail-yb1-f195.google.com [209.85.219.195]) by lists.denx.de (Postfix) with ESMTPS id 67242C2220C for ; Mon, 5 Nov 2018 09:04:45 +0000 (UTC) Received: by mail-yb1-f195.google.com with SMTP id f15-v6so3460656ybq.13 for ; Mon, 05 Nov 2018 01:04:45 -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=HrMYuKGtMyWD8ckyvCWUWRftmFaZuWeVkkJCGjzisCY=; b=BP2Lkah9XKdt8UDK45/HGkeJC9yiAwSlbSdXp7FBB3+oOFVEb9maoYbsrSudpuJygV DrehjGM8VFHWDEsClqLyuuz+ODd/oPeiv66hzb3I+hAmYAMghG8dSlEhuCA93tz4BwmZ a5j4vNIx6YHmfx/4IQVQ7Q24lRN325edhaQzM= 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=HrMYuKGtMyWD8ckyvCWUWRftmFaZuWeVkkJCGjzisCY=; b=Y8ZZcWWZl8AO7shDnEJexEQ4PLJBbTg/wmOOo0GlzaK/KJD8gIwGVqoiuDITIdycM1 oOw18oKex40NEIaykBPdJlTHWxlRlAtVeS4zRFVGcXGbCG/Pi9d1rZV3oXEZird+beqB cqOTeo1ZBzC5dXX2FO/FY8EGkgNadqp9DoMCnbBmkyxEtJQtsf4WYpfyk/wtT/NgCWLx IKBp14L8+B86NFV907dFOvKxKvmmKt2ehJquLe5NgOAiKKVp+Lt3MhIiaJK+nwv9MvYc 2i6+28DraSHiluKj76qeSqE4b2QwJO9yX87fF0TR9PzLgktx65XoCuOND/VfpYrz3c6i vWWA== X-Gm-Message-State: AGRZ1gLvpyOelg/oVnBCJkEWFiEUpMMRzrD9N5aIuxM0X44Ve6kk8/ei LoVXRgVwKkrF4aGn3PKImOD+PA== X-Received: by 2002:a25:77d2:: with SMTP id s201-v6mr6039519ybc.236.1541408684304; Mon, 05 Nov 2018 01:04:44 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id d17-v6sm11147979ywe.68.2018.11.05.01.04.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 01:04:43 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com, agraf@suse.de Date: Mon, 5 Nov 2018 18:06:42 +0900 Message-Id: <20181105090653.7409-4-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181105090653.7409-1-takahiro.akashi@linaro.org> References: <20181105090653.7409-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Cc: xypron.glpk@gmx.de, u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2 03/14] 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 --- include/efi_loader.h | 3 ++- lib/efi_loader/efi_bootmgr.c | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index d83de906fbce..ce0f420b5004 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -540,7 +540,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 a095df3f540b..74eb832a8c92 100644 --- a/lib/efi_loader/efi_bootmgr.c +++ b/lib/efi_loader/efi_bootmgr.c @@ -170,7 +170,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) { uint16_t *bootorder; @@ -183,6 +184,11 @@ void *efi_bootmgr_load(struct efi_device_path **device_path, bs = systab.boottime; rs = systab.runtime; + if (boot_id != -1) { + image = try_load_entry(boot_id, device_path, file_path); + goto error; + } + bootorder = get_var(L"BootOrder", &efi_global_variable_guid, &size); if (!bootorder) goto error;