From patchwork Thu Jun 14 16:33:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138582 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2339110lji; Thu, 14 Jun 2018 09:37:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL+ghkqQRRUclSyzd+kjeClLAhVRUwn4A5rDrStTl3qVw3ZCb6JwSxQb9llJdMjXzsN3CgB X-Received: by 2002:a50:8edb:: with SMTP id x27-v6mr3226460edx.128.1528994254585; Thu, 14 Jun 2018 09:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528994254; cv=none; d=google.com; s=arc-20160816; b=VNSPikbtQau2XJbrH3M2P0GshyHo3vG644x+D1s9kTdT5PXGPBvF7i+or0ITy0QO0G MrymnSPX/VEYtN0sW80dnS59ulT+ImZNRBPwi3XSVqmQKgWauXijbyNE//GJdkT39795 lcDbCM1wz/zP1WXrAKQklQ6EFXUkSE6OorFuz560wDm36c0g4URkNfqz5C0D9R8cKike KWZki9VmkJdIrg+OaEdH3rRMeMyzlWfbEe7YUPN5n25sZay/7dEoXM2cPkxmo82eP+Fv P85p7e9j2gb971LmgQaEJeVZpqTipxAamQQEcWG6xwTdxVdvUkKWHRc/YOvwqIP0ILNz k9Ww== 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=tutR6kKRF032iMwhmxuv45N+m504KJHhEdnoarn9Rh8=; b=YaLDhYWQQdib5j/zu7zaTzZtqqaIehvehhAFxch6em1xGH6+17BLscVANvEYwfcah4 2gbutAIk/xRKlp/iJryTiRHufQBkpSlv67euHLw4Cm1FoaLhFcpW9xDxiK56vfbtopuW DPSwlbTdKMlQBqiAFlhSqnDem+CtU1ojpBZkVRzSROBNFTpcJl1hQhRWTdnF6iDFjlqn xNrq0xBqhCAacVf/mXCbJP9VselgcKnQTFhPQsMoJRtF9m9X62YNq8Nfj6owFN83qziA b/Ri2xAPPCug/SsN3pGmY6oDFy/BXQrHcAIwvscxYmEqlDocqFbPUbRdBoqX8pWMJmDP CCjw== 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 t26-v6si3317656edc.28.2018.06.14.09.37.33; Thu, 14 Jun 2018 09:37:34 -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 C4BFDC21E15; Thu, 14 Jun 2018 16:36:41 +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 E80CAC21EF2; Thu, 14 Jun 2018 16:33:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B184DC21C2C; 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 8750AC21DAF 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 DF06AAF81; 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:33 +0200 Message-Id: <20180614163334.46827-11-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 10/11] efi_loader: Pass virtual address to fs_read() 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 fs_read() function wants to get a virtual (u-boot address space in sandbox) address rather than a physical (host address space in sandbox) one. So let's convert from the real pointer back a the physical address to make efi_loader on sandbox happier. Signed-off-by: Alexander Graf --- lib/efi_loader/efi_file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c index e6a15bcb52..ecf174a3dd 100644 --- a/lib/efi_loader/efi_file.c +++ b/lib/efi_loader/efi_file.c @@ -232,8 +232,10 @@ static efi_status_t file_read(struct file_handle *fh, u64 *buffer_size, void *buffer) { loff_t actread; + /* fs_read expects buffer as virtual address */ + uintptr_t buffer_addr = (uintptr_t)map_to_sysmem((uintptr_t)buffer); - if (fs_read(fh->path, (ulong)buffer, fh->offset, + if (fs_read(fh->path, buffer_addr, fh->offset, *buffer_size, &actread)) return EFI_DEVICE_ERROR;