From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web11.5236.1580817180573676864 for ; Tue, 04 Feb 2020 03:53:00 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qg4nG427; spf=pass (domain: redhat.com, ip: 205.139.110.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580817178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l7HKTsz+klM6+TsPTauEioDY7RyvULRFpnARExz1Mmc=; b=Qg4nG427iawwpUoEOGt2qdv70WuYPUMAMXYtvf2jZ7ASt7uKjEZzZ+SyCI2Maiv0R91J0F GRbP7H60B7xynN6Q0zkXZptF2R71osYhpH0RAhA5zDJn+ePOKVJxFsLUcDFa2IZ5NOToYd u6BULQVY0+LpvWL1kX02Z8ihDQd+9+E= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-356-kBWKJk3XM7eNeKNZ3WRVPw-1; Tue, 04 Feb 2020 06:52:56 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D55B13FF; Tue, 4 Feb 2020 11:52:55 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (unknown [10.36.118.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22BFC89F01; Tue, 4 Feb 2020 11:52:53 +0000 (UTC) Subject: Re: [PATCH V2] UefiCpuPkg RegisterCpuFeaturesLib: Match data type and format specifier To: Star Zeng , devel@edk2.groups.io Cc: Eric Dong , Ray Ni References: <20200204070204.41260-1-star.zeng@intel.com> From: "Laszlo Ersek" Message-ID: <9bd38312-639d-ecd0-fa11-fe636c7880e3@redhat.com> Date: Tue, 4 Feb 2020 12:52:53 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200204070204.41260-1-star.zeng@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: kBWKJk3XM7eNeKNZ3WRVPw-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 02/04/20 08:02, Star Zeng wrote: > Match data type and format specifier for printing. > 1. Type cast ProcessorNumber and FeatureIndex to UINT32 > as %d only expects a UINT32. > 2. Use %08x instead of %08lx for CacheControl to print Index > as it is UINT32 type. > 3. Use %016lx instead of %08lx for MemoryMapped to print > (Index | LShiftU64 (HighIndex, 32)) as it is UINT64 type. > > Cc: Eric Dong > Cc: Ray Ni > Cc: Laszlo Ersek > Signed-off-by: Star Zeng > --- > .../CpuFeaturesInitialize.c | 24 +++++++++---------- > 1 file changed, 12 insertions(+), 12 deletions(-) > > diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > index 0a4fcff033a3..fc96fb4372cf 100644 > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > @@ -430,8 +430,8 @@ DumpRegisterTableOnProcessor ( > DEBUG (( > DebugPrintErrorLevel, > "Processor: %04d: Index %04d, MSR : %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n", > - ProcessorNumber, > - FeatureIndex, > + (UINT32) ProcessorNumber, > + (UINT32) FeatureIndex, > RegisterTableEntry->Index, > RegisterTableEntry->ValidBitStart, > RegisterTableEntry->ValidBitLength, > @@ -442,8 +442,8 @@ DumpRegisterTableOnProcessor ( > DEBUG (( > DebugPrintErrorLevel, > "Processor: %04d: Index %04d, CR : %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n", > - ProcessorNumber, > - FeatureIndex, > + (UINT32) ProcessorNumber, > + (UINT32) FeatureIndex, > RegisterTableEntry->Index, > RegisterTableEntry->ValidBitStart, > RegisterTableEntry->ValidBitLength, > @@ -453,9 +453,9 @@ DumpRegisterTableOnProcessor ( > case MemoryMapped: > DEBUG (( > DebugPrintErrorLevel, > - "Processor: %04d: Index %04d, MMIO : %08lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n", > - ProcessorNumber, > - FeatureIndex, > + "Processor: %04d: Index %04d, MMIO : %016lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n", > + (UINT32) ProcessorNumber, > + (UINT32) FeatureIndex, > RegisterTableEntry->Index | LShiftU64 (RegisterTableEntry->HighIndex, 32), > RegisterTableEntry->ValidBitStart, > RegisterTableEntry->ValidBitLength, > @@ -465,9 +465,9 @@ DumpRegisterTableOnProcessor ( > case CacheControl: > DEBUG (( > DebugPrintErrorLevel, > - "Processor: %04d: Index %04d, CACHE: %08lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n", > - ProcessorNumber, > - FeatureIndex, > + "Processor: %04d: Index %04d, CACHE: %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n", > + (UINT32) ProcessorNumber, > + (UINT32) FeatureIndex, > RegisterTableEntry->Index, > RegisterTableEntry->ValidBitStart, > RegisterTableEntry->ValidBitLength, > @@ -478,8 +478,8 @@ DumpRegisterTableOnProcessor ( > DEBUG (( > DebugPrintErrorLevel, > "Processor: %04d: Index %04d, SEMAP: %s\r\n", > - ProcessorNumber, > - FeatureIndex, > + (UINT32) ProcessorNumber, > + (UINT32) FeatureIndex, > mDependTypeStr[MIN ((UINT32)RegisterTableEntry->Value, InvalidDepType)] > )); > break; > Reviewed-by: Laszlo Ersek Thanks! Laszlo