From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Fri, 16 Aug 2019 09:46:33 -0700 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9B3D7C04510D; Fri, 16 Aug 2019 16:46:32 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-63.ams2.redhat.com [10.36.116.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 84E21187B6; Fri, 16 Aug 2019 16:46:31 +0000 (UTC) Subject: Re: [Patch v4 1/6] UefiCpuPkg/RegisterCpuFeaturesLib: Add "Test Then Write" Macros. To: Eric Dong , devel@edk2.groups.io Cc: Ray Ni , Star Zeng References: <20190816035730.3252-1-eric.dong@intel.com> <20190816035730.3252-2-eric.dong@intel.com> From: "Laszlo Ersek" Message-ID: <25943607-ebb0-c8d8-0198-a557314f2fdf@redhat.com> Date: Fri, 16 Aug 2019 18:46:30 +0200 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: <20190816035730.3252-2-eric.dong@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 16 Aug 2019 16:46:32 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 08/16/19 05:57, Eric Dong wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2040 > > Add below new micros which test the current value before write the new > value. Only write new value when current value not same as new value. > CPU_REGISTER_TABLE_TEST_THEN_WRITE32 > CPU_REGISTER_TABLE_TEST_THEN_WRITE64 > CPU_REGISTER_TABLE_TEST_THEN_WRITE_FIELD > > Also add below API: > CpuRegisterTableTestThenWrite > > Signed-off-by: Eric Dong > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Star Zeng > --- > UefiCpuPkg/Include/AcpiCpuData.h | 3 +- > .../Include/Library/RegisterCpuFeaturesLib.h | 91 +++++++++++++++++++ > .../RegisterCpuFeaturesLib.c | 44 ++++++++- > 3 files changed, 134 insertions(+), 4 deletions(-) > > diff --git a/UefiCpuPkg/Include/AcpiCpuData.h b/UefiCpuPkg/Include/AcpiCpuData.h > index b963a2f592..77da5d4455 100644 > --- a/UefiCpuPkg/Include/AcpiCpuData.h > +++ b/UefiCpuPkg/Include/AcpiCpuData.h > @@ -78,7 +78,8 @@ typedef struct { > UINT32 Index; // offset 4 - 7 > UINT8 ValidBitStart; // offset 8 > UINT8 ValidBitLength; // offset 9 > - UINT16 Reserved; // offset 10 - 11 > + BOOLEAN TestThenWrite; // offset 10 > + UINT8 Reserved1; // offset 11 > UINT32 HighIndex; // offset 12-15, only valid for MemoryMapped > UINT64 Value; // offset 16-23 > } CPU_REGISTER_TABLE_ENTRY; Acked-by: Laszlo Ersek