From patchwork Thu Jun 14 16:33:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138578 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2335183lji; Thu, 14 Jun 2018 09:33:54 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKPdALRFVpiQoRPV6eRP1U4k+u7DQcRZAILsQ3GxL0KVGvTW8iIbdhW0kkddwmAIOgrLWk9 X-Received: by 2002:a50:bdc7:: with SMTP id z7-v6mr3212546edh.84.1528994034586; Thu, 14 Jun 2018 09:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528994034; cv=none; d=google.com; s=arc-20160816; b=AdG3dqs1M8Wdk9lQu9yvDWs7nkg3e50RXlrY/Vn09UcUtZEHS5BFRv+8iXDFPa1cx0 V2ojEtK7AosZzJx0lokSeLCBhFbzYx5zmi2J6T783eUY0N96yGXkAev9iY6FdEtP+XVg nSLsnZ6mNro6Ipje6vWKKjt5q4Xuu4RF+TS9YR9pUA2qAN2s4Gocg+l6SAbVMeSMoFgs qX8R8juG89ae3j9hHMZ8hzhz8E0TfLRyfIWn9Svt25EFr+Dn8xBg3kHYOMhS0Xs4npd2 ehOo/sfV7PmDYfxpoReTMTdfwh7yTR/htKpErQcNCwC/emPXDYxMq96Aj7sP8zgripaK fTDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=3a0SinchE6HZI9NjrARcvXPUXR4kJxNpH5NszUO53w0=; b=W3purPwaQM4Ec88cXoZQrQPGkUJDCHxx2znlzoAwe8CmBmMuf2MmanSadKllFDiPpE TWewCGJXcYtRzlix4MBLrhKepSOh2qypD+L399L82zk1FeVRuK0G5lfVGE4+IkpabUe5 JVQL4cywwmE6ZfdY9FF+OOKVROYa4dqCEOTN6N76cQmjwvENhtRhimDUvzmmr3yleDJG 6r2Ym1D+0V/z6mCYbbittsnlaxi3vElbYEx7ZST2edPKDC4do3FqVnRvA6skVUkid5+v iBR+wifVoF04RtwPheEZl7g2WLFHf310YwkuDjxM0QKIiPBs/Gc225XuiUcjU7UslV8v F6zg== 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 Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id e11-v6si3677826edr.447.2018.06.14.09.33.42; Thu, 14 Jun 2018 09:33:54 -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 Received: by lists.denx.de (Postfix, from userid 105) id A3D0CC21E30; Thu, 14 Jun 2018 16:33:38 +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=none 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 B1CE3C21D8A; Thu, 14 Jun 2018 16:33:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A7508C21DF3; Thu, 14 Jun 2018 16:33:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 4F996C21D74 for ; Thu, 14 Jun 2018 16:33:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AF0D7AF7A; Thu, 14 Jun 2018 16:33:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 18:33:27 +0200 Message-Id: <20180614163334.46827-5-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614163334.46827-1-agraf@suse.de> References: <20180614163334.46827-1-agraf@suse.de> Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH 04/11] 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 --- cmd/bootefi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index f55a40dc84..a86a2bd4a9 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -389,7 +390,8 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) unsigned long addr; char *saddr; efi_status_t r; - void *fdt_addr; + unsigned long fdt_addr; + void *fdt; /* Allow unaligned memory access */ allow_unaligned(); @@ -406,11 +408,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; @@ -429,7 +432,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 #ifdef CONFIG_CMD_BOOTEFI_SELFTEST @@ -475,7 +478,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);