From patchwork Wed Nov 12 14:03:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 40671 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 45A85206A5 for ; Wed, 12 Nov 2014 14:04:52 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id n15sf6656818lbi.2 for ; Wed, 12 Nov 2014 06:04:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=FBQjbq6gP30VZ9WmdmuzZkZS+9HEyiXH9+44piP0FoY=; b=C+OhcwABXhB8jsqJUWaeRbiCptDvfttxksOy7jdjcv0VnEy7ML3lEdigw0JnPHaZ4M /S8cyRi7rTcsiOrtX5xtS7hg/ZpC+MR+e3kC/HpnGIuCQ6fCfYy8gvjl2QmshU2ce5fP fA1MW5WU1XSl5NsdtDdzCl2RuO/vrHYyn5kaC8taCG5kALaqIVqucCoNawF5f/jPdv8f WlPoGXfLAttnC3W0N6asmlr1Uce4Cmh3XLxnw95++jce8W2G4orcc383U9H6sCpWR/x0 eEeQ9m+fMIfY/O57synbsw4Hnk/J2AmFTrnfk5ISOjrmzdEVN7z7qAizZwdvFhOoXDDw Nn8A== X-Gm-Message-State: ALoCoQnXfOV1obgVLsgOtDQspZ51BUb9ituQJExH0xj8wLBwn/eqvwEgVn0Jl2cT29mWvqjxjo3R X-Received: by 10.112.169.68 with SMTP id ac4mr3468lbc.24.1415801091199; Wed, 12 Nov 2014 06:04:51 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.72 with SMTP id b8ls419088laf.2.gmail; Wed, 12 Nov 2014 06:04:50 -0800 (PST) X-Received: by 10.112.36.197 with SMTP id s5mr42916795lbj.30.1415801090855; Wed, 12 Nov 2014 06:04:50 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id pg10si34899881lbb.127.2014.11.12.06.04.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 12 Nov 2014 06:04:50 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id z11so2574958lbi.25 for ; Wed, 12 Nov 2014 06:04:50 -0800 (PST) X-Received: by 10.152.42.226 with SMTP id r2mr2589118lal.29.1415801090510; Wed, 12 Nov 2014 06:04:50 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp428787lbc; Wed, 12 Nov 2014 06:04:40 -0800 (PST) X-Received: by 10.107.15.8 with SMTP id x8mr49650171ioi.13.1415801079694; Wed, 12 Nov 2014 06:04:39 -0800 (PST) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id a19si13389240igm.14.2014.11.12.06.04.39 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 12 Nov 2014 06:04:39 -0800 (PST) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XoYXA-0005B1-BP; Wed, 12 Nov 2014 14:04:32 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XoYX9-0005As-CS for edk2-devel@lists.sourceforge.net; Wed, 12 Nov 2014 14:04:31 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=lersek@redhat.com; helo=mx1.redhat.com; Received: from mx1.redhat.com ([209.132.183.28]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1XoYX5-0003uA-AZ for edk2-devel@lists.sourceforge.net; Wed, 12 Nov 2014 14:04:31 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sACE4HJC018650 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 12 Nov 2014 09:04:18 -0500 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-88.ams2.redhat.com [10.36.116.88]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sACE457Q030648; Wed, 12 Nov 2014 09:04:15 -0500 From: Laszlo Ersek To: edk2-devel@lists.sourceforge.net, jordan.l.justen@intel.com, scott@notabs.org, qin.long@intel.com Date: Wed, 12 Nov 2014 15:03:56 +0100 Message-Id: <1415801041-17550-3-git-send-email-lersek@redhat.com> In-Reply-To: <1415801041-17550-1-git-send-email-lersek@redhat.com> References: <1415801041-17550-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Spam-Score: -2.1 (--) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1XoYX5-0003uA-AZ Subject: [edk2] [PATCH 2/7] OvmfPg: flash driver: drop gratuitous 64-by-32 bit division (VS2010) X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lersek@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 In the InitializeVariableFvHeader() function, both "Start" and "BlockSize" have type UINTN. Therefore the (Start / BlockSize) division can be compiled on all platforms without intrinsics. In he current expression (EFI_LBA) Start / BlockSize "Start" is cast to UINT64 (== EFI_LBA), which leads to a 64-by-32 bit division on Ia32, breaking the VS2010 / NOOPT / Ia32 build. The simplest way to fix this is to realize we don't need a cast at all. (The prototype of QemuFlashWrite() is visible via "QemuFlash.h", and it will easily take our UINTN quotient as UINT64.) Suggested-by: Scott Duplichan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c index 42060c8..38be935 100644 --- a/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c +++ b/OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockService.c @@ -988,7 +988,7 @@ InitializeVariableFvHeader ( // WriteLength = GoodFwVolHeader->HeaderLength; Status = QemuFlashWrite ( - (EFI_LBA) Start / BlockSize, + Start / BlockSize, 0, &WriteLength, (UINT8 *) GoodFwVolHeader);