From patchwork Tue May 19 01:28:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gary guo X-Patchwork-Id: 48726 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B68BA2121F for ; Tue, 19 May 2015 01:29:28 +0000 (UTC) Received: by wgyu3 with SMTP id u3sf139354wgy.3 for ; Mon, 18 May 2015 18:29:27 -0700 (PDT) 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:cc:subject :precedence:reply-to:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=eYqRfunhMqB7oKBDfWco5hbbGuwj5+RB8VZ9fo2jFbA=; b=gWoC50aBdipzrbS5XdyKlh3B3Nj1ShmcwrSbIDSi5lsbwp+FSMB2r9d6xszzfa3zVE S/WNd7V3wXOns6W9EIVenf1zb/3/eEYuWH/qxgpMXc1zki92EC9ABdHyUCOamsNnVlRX H7QyfZaxyfwOBDtBWOcla/sKekHnB3sQ483NEHzFibB6JMf0Ijcuk7DC2HGurb3lanHC UIKv+pEzLzUyC3DtP4mL2BLtbH8D8CLH/ZNkknjM5XMpWe5Lq2zzna/EOgNr1mh+ub3M OkLk+2UmTVG26Z5XHNuhAIcrNfcROBCk5HlH0aBamL3G/ECWgzGSzTYgw0vKv9EpGoH/ aHYA== X-Gm-Message-State: ALoCoQkJu4KOMgtegGQF3WYD7HGR3GSS3W/cSBpxilzppvc22qI99hx0i4tR1XO4Cn8b31tHI3T1 X-Received: by 10.152.37.101 with SMTP id x5mr20007745laj.5.1431998967672; Mon, 18 May 2015 18:29:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.163 with SMTP id a3ls332706lab.103.gmail; Mon, 18 May 2015 18:29:27 -0700 (PDT) X-Received: by 10.112.204.72 with SMTP id kw8mr19478771lbc.88.1431998967443; Mon, 18 May 2015 18:29:27 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id kd4si7775516lbc.42.2015.05.18.18.29.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 May 2015 18:29:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by laat2 with SMTP id t2so743154laa.1 for ; Mon, 18 May 2015 18:29:27 -0700 (PDT) X-Received: by 10.112.29.36 with SMTP id g4mr19854400lbh.56.1431998966959; Mon, 18 May 2015 18:29:26 -0700 (PDT) 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.108.230 with SMTP id hn6csp443190lbb; Mon, 18 May 2015 18:29:25 -0700 (PDT) X-Received: by 10.107.128.30 with SMTP id b30mr4904664iod.84.1431998965414; Mon, 18 May 2015 18:29:25 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id f7si10334182icg.60.2015.05.18.18.29.24 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 18 May 2015 18:29:25 -0700 (PDT) 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 1YuWLK-0001s9-Ep; Tue, 19 May 2015 01:29:14 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YuWLJ-0001s3-Hm for edk2-devel@lists.sourceforge.net; Tue, 19 May 2015 01:29:13 +0000 Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.192.176 as permitted sender) client-ip=209.85.192.176; envelope-from=heyi.guo@linaro.org; helo=mail-pd0-f176.google.com; Received: from mail-pd0-f176.google.com ([209.85.192.176]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YuWLI-0005Bc-JX for edk2-devel@lists.sourceforge.net; Tue, 19 May 2015 01:29:13 +0000 Received: by pdea3 with SMTP id a3so854088pde.2 for ; Mon, 18 May 2015 18:29:07 -0700 (PDT) X-Received: by 10.70.35.201 with SMTP id k9mr48467477pdj.128.1431998946900; Mon, 18 May 2015 18:29:06 -0700 (PDT) Received: from localhost.localdomain ([180.150.148.224]) by mx.google.com with ESMTPSA id k3sm11262885pde.18.2015.05.18.18.29.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 May 2015 18:29:05 -0700 (PDT) From: Heyi Guo To: olivier.martin@arm.com Date: Tue, 19 May 2015 09:28:51 +0800 Message-Id: <1431998931-3095-1-git-send-email-heyi.guo@linaro.org> X-Mailer: git-send-email 2.1.4 X-Spam-Score: -1.5 (-) 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_PASS SPF: sender matches SPF record X-Headers-End: 1YuWLI-0005Bc-JX Cc: edk2-devel@lists.sourceforge.net, ilias.biris@linaro.org Subject: [edk2] [PATCH] Fix Ebl dumpgcd bug with memory type and IO type 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: heyi.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 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 1. Data type for GcdMemoryType and GcdIoType is enumeration type rather than bit field, so we need to use strict equation "==" instead of bit-and "&"; 2. Testing for GcdIoType should use EfiGcdIoType*** constants rather than EfiGcdMemoryType***; 3. As we are going to use strict equation, it is clearer to use switch-case than if-else. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Heyi Guo --- ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c | 31 +++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c b/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c index 8999910..4a5f2be 100644 --- a/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c +++ b/ArmPlatformPkg/Library/EblCmdLib/EblCmdLib.c @@ -325,14 +325,23 @@ EblDumpGcd ( if (MemorySpaceMap[i].Attributes & EFI_MEMORY_XP) AsciiPrint (" MEM_XP"); - if (MemorySpaceMap[i].GcdMemoryType & EfiGcdMemoryTypeNonExistent) + switch (MemorySpaceMap[i].GcdMemoryType) { + case EfiGcdMemoryTypeNonExistent: AsciiPrint (" TYPE_NONEXISTENT"); - if (MemorySpaceMap[i].GcdMemoryType & EfiGcdMemoryTypeReserved) + break; + case EfiGcdMemoryTypeReserved: AsciiPrint (" TYPE_RESERVED"); - if (MemorySpaceMap[i].GcdMemoryType & EfiGcdMemoryTypeSystemMemory) + break; + case EfiGcdMemoryTypeSystemMemory: AsciiPrint (" TYPE_SYSMEM"); - if (MemorySpaceMap[i].GcdMemoryType & EfiGcdMemoryTypeMemoryMappedIo) + break; + case EfiGcdMemoryTypeMemoryMappedIo: AsciiPrint (" TYPE_MEMMAP"); + break; + default: + AsciiPrint (" TYPE_UNKNOWN"); + break; + } AsciiPrint ("\n"); } @@ -347,12 +356,20 @@ EblDumpGcd ( AsciiPrint ("IO %08lx - %08lx",IoSpaceMap[i].BaseAddress,IoSpaceMap[i].BaseAddress+IoSpaceMap[i].Length); AsciiPrint ("\t%08x %08x",IoSpaceMap[i].ImageHandle,IoSpaceMap[i].DeviceHandle); - if (IoSpaceMap[i].GcdIoType & EfiGcdMemoryTypeNonExistent) + switch (IoSpaceMap[i].GcdIoType) { + case EfiGcdIoTypeNonExistent: AsciiPrint (" TYPE_NONEXISTENT"); - if (IoSpaceMap[i].GcdIoType & EfiGcdMemoryTypeReserved) + break; + case EfiGcdIoTypeReserved: AsciiPrint (" TYPE_RESERVED"); - if (IoSpaceMap[i].GcdIoType & EfiGcdIoTypeIo) + break; + case EfiGcdIoTypeIo: AsciiPrint (" TYPE_IO"); + break; + default: + AsciiPrint (" TYPE_UNKNOWN"); + break; + } AsciiPrint ("\n"); }