From patchwork Mon Jun 18 14:08:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 138967 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4018653lji; Mon, 18 Jun 2018 07:26:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKxWBXovXvwG+oV6DKefsGcnXeCSsxceUlbgPyFwVagc9+9W26uijF6c9H9inEI6WoYZ41s X-Received: by 2002:a50:f416:: with SMTP id r22-v6mr11301679edm.94.1529331962819; Mon, 18 Jun 2018 07:26:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529331962; cv=none; d=google.com; s=arc-20160816; b=gA3B/TFyXQbF8ABHFRWEs0X0ipEOiJyDPk4T8axF3vg5KLgA7p3vFTqlx9ZhmS0y6i dUpFRnHq7lqemT2PUA861TkNvlnb2CHII5S4hXEym8Jv5ryhXuvRUXZGnFvBEU76YmM7 uxzF1MmXcPRFxAp1esTw7/o0SqjFyH93d6IxaoDi5Umd1Wwo1UOwovtwpvAvzgf0kVfO pUZTsKYuT70C6alZYFqQAAfc1q4F5cl1quqoLPJcqQo2NdbD3V0cDkOsii/+IkMxVaG1 fUydscIVI/7tbJOnnSaCDJLfkUxc4Zenc6XtT/ffdQtvnYOJF2F62matSyZ0Y0QFNhXN nEjA== 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:to:from:references:message-id:in-reply-to:date:mime-version :arc-authentication-results; bh=aDvWjjtg1DcRC/5hNWnqwEFkDZe80YR4Qczhr4RJu3U=; b=FhPH9qErcChc377YN1bqb/ZjsRwuBn7nJhaFKUpf6UW2oTLjZ657/xcGyb6ajs3J/K n1X2r3VEAKy0p7A/P/HMGVAPkMkbHf0jWGodYQn/yzc+F5B4LY5X13RVAMPWTs59+a63 cDt4zHxjOv6gSgnRbT0I66lsQ/Lr+svjG3eF1j8H+iOTYZKUsUz3aGtdejYMM8YYY3iP c9zR40al4IAEYI7CzT60oCSIj3CNIvFJ5IrDNlwNyEe5mDzamR9nZ48a7J90tgngiaap yolYfniEicYvuT6LHh2QHxfkfwkXb1ZlUeD2hYEyihUTLiGJSLCj+2+KFC4XToc25wO0 iT4w== ARC-Authentication-Results: i=1; mx.google.com; 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=chromium.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id k32-v6si5999086edc.340.2018.06.18.07.26.02; Mon, 18 Jun 2018 07:26:02 -0700 (PDT) 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; 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=chromium.org Received: by lists.denx.de (Postfix, from userid 105) id 70B4AC21EF7; Mon, 18 Jun 2018 14:19:21 +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 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 A78A7C21EE7; Mon, 18 Jun 2018 14:19:19 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id F343AC21DFD; Mon, 18 Jun 2018 14:09:45 +0000 (UTC) Received: from mail-vk0-f74.google.com (mail-vk0-f74.google.com [209.85.213.74]) by lists.denx.de (Postfix) with ESMTPS id 95D0DC21EB4 for ; Mon, 18 Jun 2018 14:09:41 +0000 (UTC) Received: by mail-vk0-f74.google.com with SMTP id p83-v6so7073822vkf.9 for ; Mon, 18 Jun 2018 07:09:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=hLKBwvNKsCn70e1WHmIcCO6AWcJeqg59aFNzpeOdJkM=; b=Z8N0zwZntyMvEY5fMtuWloKr6gtISBYu4YCVYdqDUPu1j8a/mMhKz2lCdgCinEWsYc y9qLTk7PnMIDdJpl7Vc7N9uvb72TI3/5xiXmKJI5oxNAsYqa7yrrAN/mFXo2Q+mfGciG HyNmmAginjWlevsZMrCiorliCjTxs64hKgzQ32Zj6ZMi8d+AQd/GWH42IvQtxUire6p9 nWXgGqhIC63HViGS9Kg9JHoGrA8IeTVEoQldneag5XenPHPO2VOvIqyKd2fsTy9exolD QuqFD69HqF7+BrxYCqC0iHPckSL8/xgRy0gVHCf67bttjw/JBlWomNdJD5pTznVoinFM j+5w== X-Gm-Message-State: APt69E3RzzB884ddF8v0fg/+Bt9WCI5Zgw9V1JYKQwOmQCoyXVnfXtz1 OQ2L7tPBtmPH1gmMLQ0qM62A6sI= MIME-Version: 1.0 X-Received: by 2002:ab0:52dd:: with SMTP id w29-v6mr5663223uaw.84.1529330980576; Mon, 18 Jun 2018 07:09:40 -0700 (PDT) Date: Mon, 18 Jun 2018 08:08:26 -0600 In-Reply-To: <20180618140835.195901-1-sjg@chromium.org> Message-Id: <20180618140835.195901-22-sjg@chromium.org> References: <20180618140835.195901-1-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog From: Simon Glass To: U-Boot Mailing List Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v8 21/30] efi_loader: Use map_sysmem() in bootefi command 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" From: Alexander Graf The bootefi command gets a few addresses as values passed in. In sandbox, these values are in U-Boot address space, so we need to make sure we explicitly call map_sysmem() on them to be able to access them. Signed-off-by: Alexander Graf Reviewed-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None cmd/bootefi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index c89f83fb33..b62635f448 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -452,7 +453,8 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) char *saddr; unsigned long addr; efi_status_t r; - void *fdt_addr; + unsigned long fdt_addr; + void *fdt; /* Allow unaligned memory access */ allow_unaligned(); @@ -469,11 +471,12 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return CMD_RET_USAGE; if (argc > 2) { - fdt_addr = (void *)simple_strtoul(argv[2], NULL, 16); + fdt_addr = simple_strtoul(argv[2], NULL, 16); if (!fdt_addr && *argv[2] != '0') return CMD_RET_USAGE; /* Install device tree */ - r = efi_install_fdt(fdt_addr); + fdt = map_sysmem(fdt_addr, 0); + r = efi_install_fdt(fdt); if (r != EFI_SUCCESS) { printf("ERROR: failed to install device tree\n"); return CMD_RET_FAILURE; @@ -492,7 +495,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) addr = simple_strtoul(saddr, NULL, 16); else addr = CONFIG_SYS_LOAD_ADDR; - memcpy((char *)addr, __efi_helloworld_begin, size); + memcpy(map_sysmem(addr, size), __efi_helloworld_begin, size); } else #endif if (IS_ENABLED(CONFIG_BOOTEFI_TEST) && !strcmp(argv[1], "test")) { @@ -538,7 +541,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } printf("## Starting EFI application at %08lx ...\n", addr); - r = do_bootefi_exec((void *)addr, bootefi_device_path, + r = do_bootefi_exec(map_sysmem(addr, 0), bootefi_device_path, bootefi_image_path); printf("## Application terminated, r = %lu\n", r & ~EFI_ERROR_MASK);