From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7778921C91277 for ; Thu, 3 Aug 2017 23:51:45 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Aug 2017 23:53:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,319,1498546800"; d="scan'208";a="1159055262" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga001.jf.intel.com with ESMTP; 03 Aug 2017 23:53:57 -0700 Received: from fmsmsx119.amr.corp.intel.com (10.18.124.207) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 3 Aug 2017 23:53:56 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX119.amr.corp.intel.com (10.18.124.207) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 3 Aug 2017 23:53:56 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.151]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.188]) with mapi id 14.03.0319.002; Fri, 4 Aug 2017 14:53:54 +0800 From: "Ni, Ruiyu" To: "Dong, Eric" , "edk2-devel@lists.01.org" CC: "Fan, Jeff" , "Kinney, Michael D" Thread-Topic: [Patch 4/7] QuarkSocPkg MtrrLib: Remove reference deprecated macro. Thread-Index: AQHTDDtxXukHhsxA5EGfpas1J2Hd+aJya/8ggACwcYCAAKfwQA== Date: Fri, 4 Aug 2017 06:53:54 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5B9CC01D@SHSMSX104.ccr.corp.intel.com> References: <1501752726-14072-1-git-send-email-eric.dong@intel.com> <1501752726-14072-5-git-send-email-eric.dong@intel.com> <734D49CCEBEEF84792F5B80ED585239D5B9CA522@SHSMSX104.ccr.corp.intel.com> In-Reply-To: Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch 4/7] QuarkSocPkg MtrrLib: Remove reference deprecated macro. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2017 06:51:45 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I agree. Thanks/Ray > -----Original Message----- > From: Dong, Eric > Sent: Friday, August 4, 2017 12:53 PM > To: Ni, Ruiyu ; edk2-devel@lists.01.org > Cc: Fan, Jeff ; Kinney, Michael D > > Subject: RE: [Patch 4/7] QuarkSocPkg MtrrLib: Remove reference deprecated > macro. >=20 > Ray, >=20 > I check the spec, found the Quark definition has some small difference wi= th > normal MSR. So I prefer not do this change for Quark. >=20 > Thanks, > Eric > -----Original Message----- > From: Ni, Ruiyu > Sent: Thursday, August 3, 2017 6:22 PM > To: Dong, Eric ; edk2-devel@lists.01.org > Cc: Fan, Jeff ; Kinney, Michael D > > Subject: RE: [Patch 4/7] QuarkSocPkg MtrrLib: Remove reference deprecated > macro. >=20 > Eric, > Please refer to the below code sample to avoid defining local macros. >=20 > MSR_IA32_MTRR_DEF_TYPE_REGISTER DefType; > // > // Enable Cache MTRR > // > DefType.Uint64 =3D AsmReadMsr64 (MSR_IA32_MTRR_DEF_TYPE); > DefType.Bits.E =3D 1; > DefType.Bits.FE =3D 1; > AsmWriteMsr64 (MSR_IA32_MTRR_DEF_TYPE, DefType.Uint64); >=20 > Thanks/Ray >=20 > > -----Original Message----- > > From: Dong, Eric > > Sent: Thursday, August 3, 2017 5:32 PM > > To: edk2-devel@lists.01.org > > Cc: Fan, Jeff ; Ni, Ruiyu ; > > Kinney, Michael D > > Subject: [Patch 4/7] QuarkSocPkg MtrrLib: Remove reference deprecated > > macro. > > > > Cc: Jeff Fan > > Cc: Ruiyu Ni > > Cc: Michael D Kinney > > Contributed-under: TianoCore Contribution Agreement 1.0 > > Signed-off-by: Eric Dong > > --- > > .../QuarkNorthCluster/Library/MtrrLib/MtrrLib.c | 26 +++++++++++++-= --- > -- > > --- > > 1 file changed, 15 insertions(+), 11 deletions(-) > > > > diff --git a/QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.c > > b/QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.c > > index 2760427..fe00b37 100644 > > --- a/QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.c > > +++ b/QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.c > > @@ -23,6 +23,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF > ANY KIND, > > EITHER EXPRESS OR IMPLIED. > > > > #define QUARK_SOC_CPUID_FAMILY_MODEL_STEPPING 0x590 > > > > +#define CACHE_MTRR_ENABLED 0x800 > > +#define CACHE_FIXED_MTRR_ENABLED 0x400 > > +#define IA32_MTRR_CAP_VCNT_MASK 0xFF > > + > > // > > // Context to save and restore when MTRRs are programmed // @@ > > -121,7 > > +125,7 @@ GetVariableMtrrCountWorker ( { > > UINT32 VariableMtrrCount; > > > > - VariableMtrrCount =3D (UINT32)(MtrrRegisterRead > > (QUARK_NC_HOST_BRIDGE_IA32_MTRR_CAP) & > > MTRR_LIB_IA32_MTRR_CAP_VCNT_MASK); > > + VariableMtrrCount =3D (UINT32)(MtrrRegisterRead > > + (QUARK_NC_HOST_BRIDGE_IA32_MTRR_CAP) & > > IA32_MTRR_CAP_VCNT_MASK); > > ASSERT (VariableMtrrCount <=3D MTRR_NUMBER_OF_VARIABLE_MTRR); > > return VariableMtrrCount; > > } > > @@ -558,7 +562,7 @@ MtrrGetMemoryAttributeInVariableMtrrWorker ( > > > > ZeroMem (VariableMtrr, sizeof (VARIABLE_MTRR) * > > MTRR_NUMBER_OF_VARIABLE_MTRR); > > for (Index =3D 0, UsedMtrr =3D 0; Index < FirmwareVariableMtrrCount; > > Index++) { > > - if ((VariableSettings->Mtrr[Index].Mask & > > MTRR_LIB_CACHE_MTRR_ENABLED) !=3D 0) { > > + if ((VariableSettings->Mtrr[Index].Mask & CACHE_MTRR_ENABLED) !=3D > > + 0) { > > VariableMtrr[Index].Msr =3D (UINT32)Index; > > VariableMtrr[Index].BaseAddress =3D > > (VariableSettings->Mtrr[Index].Base > > & MtrrValidAddressMask); > > VariableMtrr[Index].Length =3D ((~(VariableSettings- > >Mtrr[Index].Mask > > & MtrrValidAddressMask)) & MtrrValidBitsMask) + 1; @@ -969,7 +973,7 > @@ > > ProgramVariableMtrr ( > > // MTRR Physical Mask > > // > > TempQword =3D ~(Length - 1); > > - VariableSettings->Mtrr[MtrrNumber].Mask =3D (TempQword & > > MtrrValidAddressMask) | MTRR_LIB_CACHE_MTRR_ENABLED; > > + VariableSettings->Mtrr[MtrrNumber].Mask =3D (TempQword & > > + MtrrValidAddressMask) | CACHE_MTRR_ENABLED; > > } > > > > > > @@ -1157,7 +1161,7 @@ MtrrGetMemoryAttributeByAddressWorker ( > > } > > MtrrType =3D MTRR_CACHE_INVALID_TYPE; > > > > - if ((TempQword & MTRR_LIB_CACHE_MTRR_ENABLED) =3D=3D 0) { > > + if ((TempQword & CACHE_MTRR_ENABLED) =3D=3D 0) { > > return CacheUncacheable; > > } > > > > @@ -1165,7 +1169,7 @@ MtrrGetMemoryAttributeByAddressWorker ( > > // If address is less than 1M, then try to go through the fixed MTRR > > // > > if (Address < BASE_1MB) { > > - if ((TempQword & MTRR_LIB_CACHE_FIXED_MTRR_ENABLED) !=3D 0) { > > + if ((TempQword & CACHE_FIXED_MTRR_ENABLED) !=3D 0) { > > // > > // Go through the fixed MTRR > > // > > @@ -1539,7 +1543,7 @@ MtrrSetMemoryAttributeWorker ( > > } > > if (MtrrSetting !=3D NULL) { > > MtrrSetting->Fixed.Mtrr[MsrNum] =3D > > (MtrrSetting->Fixed.Mtrr[MsrNum] & ~ClearMask) | OrMask; > > - MtrrSetting->MtrrDefType |=3D > > MTRR_LIB_CACHE_FIXED_MTRR_ENABLED; > > + MtrrSetting->MtrrDefType |=3D CACHE_FIXED_MTRR_ENABLED; > > } else { > > if (!FixedSettingsValid[MsrNum]) { > > WorkingFixedSettings.Mtrr[MsrNum] =3D MtrrRegisterRead > > (mMtrrLibFixedMtrrTable[MsrNum].Msr); > > @@ -1654,7 +1658,7 @@ MtrrSetMemoryAttributeWorker ( > > // Find first unused MTRR > > // > > for (MsrNum =3D 0; MsrNum < VariableMtrrCount; MsrNum++) { > > - if ((VariableSettings->Mtrr[MsrNum].Mask & > > MTRR_LIB_CACHE_MTRR_ENABLED) =3D=3D 0) { > > + if ((VariableSettings->Mtrr[MsrNum].Mask & CACHE_MTRR_ENABLED) > > =3D=3D > > + 0) { > > break; > > } > > } > > @@ -1674,7 +1678,7 @@ MtrrSetMemoryAttributeWorker ( > > // Find unused MTRR > > // > > for (; MsrNum < VariableMtrrCount; MsrNum++) { > > - if ((VariableSettings->Mtrr[MsrNum].Mask & > > MTRR_LIB_CACHE_MTRR_ENABLED) =3D=3D 0) { > > + if ((VariableSettings->Mtrr[MsrNum].Mask & > > + CACHE_MTRR_ENABLED) =3D=3D 0) { > > break; > > } > > } > > @@ -1705,7 +1709,7 @@ MtrrSetMemoryAttributeWorker ( > > // Find unused MTRR > > // > > for (; MsrNum < VariableMtrrCount; MsrNum++) { > > - if ((VariableSettings->Mtrr[MsrNum].Mask & > > MTRR_LIB_CACHE_MTRR_ENABLED) =3D=3D 0) { > > + if ((VariableSettings->Mtrr[MsrNum].Mask & CACHE_MTRR_ENABLED) > > =3D=3D > > + 0) { > > break; > > } > > } > > @@ -1728,7 +1732,7 @@ MtrrSetMemoryAttributeWorker ( > > // Find unused MTRR > > // > > for (; MsrNum < VariableMtrrCount; MsrNum++) { > > - if ((VariableSettings->Mtrr[MsrNum].Mask & > > MTRR_LIB_CACHE_MTRR_ENABLED) =3D=3D 0) { > > + if ((VariableSettings->Mtrr[MsrNum].Mask & CACHE_MTRR_ENABLED) > > =3D=3D > > + 0) { > > break; > > } > > } > > @@ -1801,7 +1805,7 @@ Done: > > DEBUG((DEBUG_CACHE, " Status =3D %r\n", Status)); > > if (!RETURN_ERROR (Status)) { > > if (MtrrSetting !=3D NULL) { > > - MtrrSetting->MtrrDefType |=3D MTRR_LIB_CACHE_MTRR_ENABLED; > > + MtrrSetting->MtrrDefType |=3D CACHE_MTRR_ENABLED; > > } > > MtrrDebugPrintAllMtrrsWorker (MtrrSetting); > > } > > -- > > 2.7.0.windows.1