* [PATCH v2 0/3] Remove unnecessary APIs in MtrrLib @ 2020-07-13 8:12 Ni, Ray 2020-07-13 8:12 ` [PATCH v2 1/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrGetVariableMtrr() Ni, Ray ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: Ni, Ray @ 2020-07-13 8:12 UTC (permalink / raw) To: devel Ray Ni (3): UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrGetVariableMtrr() UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetVariableMtrr() UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetFixedMtrr() UefiCpuPkg/Include/Library/MtrrLib.h | 47 +-------------- UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 85 +--------------------------- 2 files changed, 2 insertions(+), 130 deletions(-) -- 2.27.0.windows.1 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrGetVariableMtrr() 2020-07-13 8:12 [PATCH v2 0/3] Remove unnecessary APIs in MtrrLib Ni, Ray @ 2020-07-13 8:12 ` Ni, Ray 2020-07-13 14:53 ` [edk2-devel] " Laszlo Ersek 2020-07-14 2:15 ` Dong, Eric 2020-07-13 8:12 ` [PATCH v2 2/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetVariableMtrr() Ni, Ray 2020-07-13 8:12 ` [PATCH v2 3/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetFixedMtrr() Ni, Ray 2 siblings, 2 replies; 10+ messages in thread From: Ni, Ray @ 2020-07-13 8:12 UTC (permalink / raw) To: devel; +Cc: Eric Dong, Laszlo Ersek, Rahul Kumar MtrrGetVariableMtrr() returns all the variable MTRR settings. But in fact MtrrGetAllMtrrs() and MtrrGetMemoryAttributeInVariableMtrr() are used by callers to get the MTRR settings. The former one returns both the fixed and variable MTRR settings. The patch removes the necessary API MtrrGetVariableMtrr() to simplify the MtrrLib API. There is no code in edk2 and edk2-platforms repo that calls MtrrGetVariableMtrr(). Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> --- UefiCpuPkg/Include/Library/MtrrLib.h | 17 +---------------- UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 27 +-------------------------- 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/UefiCpuPkg/Include/Library/MtrrLib.h b/UefiCpuPkg/Include/Library/MtrrLib.h index 95ffbc8bf1..cfe3c0ab59 100644 --- a/UefiCpuPkg/Include/Library/MtrrLib.h +++ b/UefiCpuPkg/Include/Library/MtrrLib.h @@ -1,7 +1,7 @@ /** @file MTRR setting library - Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2008 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -185,21 +185,6 @@ MtrrGetMemoryAttribute ( ); -/** - This function will get the raw value in variable MTRRs - - @param[out] VariableSettings A buffer to hold variable MTRRs content. - - @return The buffer point to MTRR_VARIABLE_SETTINGS in which holds the content of the variable MTRR - -**/ -MTRR_VARIABLE_SETTINGS* -EFIAPI -MtrrGetVariableMtrr ( - OUT MTRR_VARIABLE_SETTINGS *VariableSettings - ); - - /** This function sets variable MTRRs diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c index dfa848022b..f4a10edc87 100644 --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c @@ -5,7 +5,7 @@ Most of services in this library instance are suggested to be invoked by BSP only, except for MtrrSetAllMtrrs() which is used to sync BSP's MTRR setting to APs. - Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2008 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -456,31 +456,6 @@ MtrrGetVariableMtrrWorker ( return VariableSettings; } -/** - This function will get the raw value in variable MTRRs - - @param[out] VariableSettings A buffer to hold variable MTRRs content. - - @return The VariableSettings input pointer - -**/ -MTRR_VARIABLE_SETTINGS* -EFIAPI -MtrrGetVariableMtrr ( - OUT MTRR_VARIABLE_SETTINGS *VariableSettings - ) -{ - if (!IsMtrrSupported ()) { - return VariableSettings; - } - - return MtrrGetVariableMtrrWorker ( - NULL, - GetVariableMtrrCountWorker (), - VariableSettings - ); -} - /** Programs fixed MTRRs registers. -- 2.27.0.windows.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v2 1/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrGetVariableMtrr() 2020-07-13 8:12 ` [PATCH v2 1/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrGetVariableMtrr() Ni, Ray @ 2020-07-13 14:53 ` Laszlo Ersek 2020-07-14 2:15 ` Dong, Eric 1 sibling, 0 replies; 10+ messages in thread From: Laszlo Ersek @ 2020-07-13 14:53 UTC (permalink / raw) To: devel, ray.ni; +Cc: Eric Dong, Rahul Kumar On 07/13/20 10:12, Ni, Ray wrote: > MtrrGetVariableMtrr() returns all the variable MTRR settings. > But in fact MtrrGetAllMtrrs() and > MtrrGetMemoryAttributeInVariableMtrr() are used by callers to get the > MTRR settings. The former one returns both the fixed and variable > MTRR settings. > > The patch removes the necessary API MtrrGetVariableMtrr() to simplify (1) I think we should replace "necessary" with "unnecessary" in the commit message. with that fixed: Reviewed-by: Laszlo Ersek <lersek@redhat.com> > the MtrrLib API. > > There is no code in edk2 and edk2-platforms repo that calls > MtrrGetVariableMtrr(). > > Signed-off-by: Ray Ni <ray.ni@intel.com> > Cc: Eric Dong <eric.dong@intel.com> > Cc: Laszlo Ersek <lersek@redhat.com> > Cc: Rahul Kumar <rahul1.kumar@intel.com> > --- > UefiCpuPkg/Include/Library/MtrrLib.h | 17 +---------------- > UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 27 +-------------------------- > 2 files changed, 2 insertions(+), 42 deletions(-) > > diff --git a/UefiCpuPkg/Include/Library/MtrrLib.h b/UefiCpuPkg/Include/Library/MtrrLib.h > index 95ffbc8bf1..cfe3c0ab59 100644 > --- a/UefiCpuPkg/Include/Library/MtrrLib.h > +++ b/UefiCpuPkg/Include/Library/MtrrLib.h > @@ -1,7 +1,7 @@ > /** @file > MTRR setting library > > - Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR> > + Copyright (c) 2008 - 2020, Intel Corporation. All rights reserved.<BR> > SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > @@ -185,21 +185,6 @@ MtrrGetMemoryAttribute ( > ); > > > -/** > - This function will get the raw value in variable MTRRs > - > - @param[out] VariableSettings A buffer to hold variable MTRRs content. > - > - @return The buffer point to MTRR_VARIABLE_SETTINGS in which holds the content of the variable MTRR > - > -**/ > -MTRR_VARIABLE_SETTINGS* > -EFIAPI > -MtrrGetVariableMtrr ( > - OUT MTRR_VARIABLE_SETTINGS *VariableSettings > - ); > - > - > /** > This function sets variable MTRRs > > diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > index dfa848022b..f4a10edc87 100644 > --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > @@ -5,7 +5,7 @@ > Most of services in this library instance are suggested to be invoked by BSP only, > except for MtrrSetAllMtrrs() which is used to sync BSP's MTRR setting to APs. > > - Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.<BR> > + Copyright (c) 2008 - 2020, Intel Corporation. All rights reserved.<BR> > SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > @@ -456,31 +456,6 @@ MtrrGetVariableMtrrWorker ( > return VariableSettings; > } > > -/** > - This function will get the raw value in variable MTRRs > - > - @param[out] VariableSettings A buffer to hold variable MTRRs content. > - > - @return The VariableSettings input pointer > - > -**/ > -MTRR_VARIABLE_SETTINGS* > -EFIAPI > -MtrrGetVariableMtrr ( > - OUT MTRR_VARIABLE_SETTINGS *VariableSettings > - ) > -{ > - if (!IsMtrrSupported ()) { > - return VariableSettings; > - } > - > - return MtrrGetVariableMtrrWorker ( > - NULL, > - GetVariableMtrrCountWorker (), > - VariableSettings > - ); > -} > - > /** > Programs fixed MTRRs registers. > > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v2 1/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrGetVariableMtrr() 2020-07-13 8:12 ` [PATCH v2 1/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrGetVariableMtrr() Ni, Ray 2020-07-13 14:53 ` [edk2-devel] " Laszlo Ersek @ 2020-07-14 2:15 ` Dong, Eric 1 sibling, 0 replies; 10+ messages in thread From: Dong, Eric @ 2020-07-14 2:15 UTC (permalink / raw) To: devel@edk2.groups.io, Ni, Ray; +Cc: Laszlo Ersek, Kumar, Rahul1 Reviewed-by: Eric Dong <eric.dong@intel.com> > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ni, Ray > Sent: Monday, July 13, 2020 4:13 PM > To: devel@edk2.groups.io > Cc: Dong, Eric <eric.dong@intel.com>; Laszlo Ersek <lersek@redhat.com>; > Kumar, Rahul1 <rahul1.kumar@intel.com> > Subject: [edk2-devel] [PATCH v2 1/3] UefiCpuPkg/MtrrLib: Remove > unnecessary API MtrrGetVariableMtrr() > > MtrrGetVariableMtrr() returns all the variable MTRR settings. > But in fact MtrrGetAllMtrrs() and > MtrrGetMemoryAttributeInVariableMtrr() are used by callers to get the > MTRR settings. The former one returns both the fixed and variable > MTRR settings. > > The patch removes the necessary API MtrrGetVariableMtrr() to simplify > the MtrrLib API. > > There is no code in edk2 and edk2-platforms repo that calls > MtrrGetVariableMtrr(). > > Signed-off-by: Ray Ni <ray.ni@intel.com> > Cc: Eric Dong <eric.dong@intel.com> > Cc: Laszlo Ersek <lersek@redhat.com> > Cc: Rahul Kumar <rahul1.kumar@intel.com> > --- > UefiCpuPkg/Include/Library/MtrrLib.h | 17 +---------------- > UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 27 +-------------------------- > 2 files changed, 2 insertions(+), 42 deletions(-) > > diff --git a/UefiCpuPkg/Include/Library/MtrrLib.h > b/UefiCpuPkg/Include/Library/MtrrLib.h > index 95ffbc8bf1..cfe3c0ab59 100644 > --- a/UefiCpuPkg/Include/Library/MtrrLib.h > +++ b/UefiCpuPkg/Include/Library/MtrrLib.h > @@ -1,7 +1,7 @@ > /** @file > > MTRR setting library > > > > - Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR> > > + Copyright (c) 2008 - 2020, Intel Corporation. All rights reserved.<BR> > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > **/ > > @@ -185,21 +185,6 @@ MtrrGetMemoryAttribute ( > ); > > > > > > -/** > > - This function will get the raw value in variable MTRRs > > - > > - @param[out] VariableSettings A buffer to hold variable MTRRs content. > > - > > - @return The buffer point to MTRR_VARIABLE_SETTINGS in which holds the > content of the variable MTRR > > - > > -**/ > > -MTRR_VARIABLE_SETTINGS* > > -EFIAPI > > -MtrrGetVariableMtrr ( > > - OUT MTRR_VARIABLE_SETTINGS *VariableSettings > > - ); > > - > > - > > /** > > This function sets variable MTRRs > > > > diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > index dfa848022b..f4a10edc87 100644 > --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > @@ -5,7 +5,7 @@ > Most of services in this library instance are suggested to be invoked by BSP > only, > > except for MtrrSetAllMtrrs() which is used to sync BSP's MTRR setting to > APs. > > > > - Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.<BR> > > + Copyright (c) 2008 - 2020, Intel Corporation. All rights reserved.<BR> > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > **/ > > @@ -456,31 +456,6 @@ MtrrGetVariableMtrrWorker ( > return VariableSettings; > > } > > > > -/** > > - This function will get the raw value in variable MTRRs > > - > > - @param[out] VariableSettings A buffer to hold variable MTRRs content. > > - > > - @return The VariableSettings input pointer > > - > > -**/ > > -MTRR_VARIABLE_SETTINGS* > > -EFIAPI > > -MtrrGetVariableMtrr ( > > - OUT MTRR_VARIABLE_SETTINGS *VariableSettings > > - ) > > -{ > > - if (!IsMtrrSupported ()) { > > - return VariableSettings; > > - } > > - > > - return MtrrGetVariableMtrrWorker ( > > - NULL, > > - GetVariableMtrrCountWorker (), > > - VariableSettings > > - ); > > -} > > - > > /** > > Programs fixed MTRRs registers. > > > > -- > 2.27.0.windows.1 > > > -=-=-=-=-=-= > Groups.io Links: You receive all messages sent to this group. > > View/Reply Online (#62404): https://edk2.groups.io/g/devel/message/62404 > Mute This Topic: https://groups.io/mt/75472802/1768733 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [eric.dong@intel.com] > -=-=-=-=-=-= ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 2/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetVariableMtrr() 2020-07-13 8:12 [PATCH v2 0/3] Remove unnecessary APIs in MtrrLib Ni, Ray 2020-07-13 8:12 ` [PATCH v2 1/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrGetVariableMtrr() Ni, Ray @ 2020-07-13 8:12 ` Ni, Ray 2020-07-13 14:54 ` [edk2-devel] " Laszlo Ersek 2020-07-14 2:15 ` Dong, Eric 2020-07-13 8:12 ` [PATCH v2 3/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetFixedMtrr() Ni, Ray 2 siblings, 2 replies; 10+ messages in thread From: Ni, Ray @ 2020-07-13 8:12 UTC (permalink / raw) To: devel; +Cc: Eric Dong, Laszlo Ersek, Rahul Kumar MtrrSetVariableMtrr() sets all the variable MTRR settings. But in fact MtrrSetAllMtrrs() is always used by callers to set all MTRR settings including the fixed and variable ones. The patch removes the necessary API MtrrSetVariableMtrr() to simplify the MtrrLib API. There is no code in edk2 and edk2-platforms repo that calls MtrrGetVariableMtrr(). Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> --- UefiCpuPkg/Include/Library/MtrrLib.h | 15 -------------- UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 29 ---------------------------- 2 files changed, 44 deletions(-) diff --git a/UefiCpuPkg/Include/Library/MtrrLib.h b/UefiCpuPkg/Include/Library/MtrrLib.h index cfe3c0ab59..0bc69e235c 100644 --- a/UefiCpuPkg/Include/Library/MtrrLib.h +++ b/UefiCpuPkg/Include/Library/MtrrLib.h @@ -185,21 +185,6 @@ MtrrGetMemoryAttribute ( ); -/** - This function sets variable MTRRs - - @param[in] VariableSettings A buffer to hold variable MTRRs content. - - @return The pointer of VariableSettings - -**/ -MTRR_VARIABLE_SETTINGS* -EFIAPI -MtrrSetVariableMtrr ( - IN MTRR_VARIABLE_SETTINGS *VariableSettings - ); - - /** This function gets the content in fixed MTRRs diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c index f4a10edc87..8b54f2c03b 100644 --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c @@ -2558,35 +2558,6 @@ MtrrSetVariableMtrrWorker ( } } - -/** - This function sets variable MTRRs - - @param[in] VariableSettings A buffer to hold variable MTRRs content. - - @return The pointer of VariableSettings - -**/ -MTRR_VARIABLE_SETTINGS* -EFIAPI -MtrrSetVariableMtrr ( - IN MTRR_VARIABLE_SETTINGS *VariableSettings - ) -{ - MTRR_CONTEXT MtrrContext; - - if (!IsMtrrSupported ()) { - return VariableSettings; - } - - MtrrLibPreMtrrChange (&MtrrContext); - MtrrSetVariableMtrrWorker (VariableSettings); - MtrrLibPostMtrrChange (&MtrrContext); - MtrrDebugPrintAllMtrrs (); - - return VariableSettings; -} - /** Worker function setting fixed MTRRs -- 2.27.0.windows.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v2 2/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetVariableMtrr() 2020-07-13 8:12 ` [PATCH v2 2/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetVariableMtrr() Ni, Ray @ 2020-07-13 14:54 ` Laszlo Ersek 2020-07-14 2:15 ` Dong, Eric 1 sibling, 0 replies; 10+ messages in thread From: Laszlo Ersek @ 2020-07-13 14:54 UTC (permalink / raw) To: devel, ray.ni; +Cc: Eric Dong, Rahul Kumar On 07/13/20 10:12, Ni, Ray wrote: > MtrrSetVariableMtrr() sets all the variable MTRR settings. > But in fact MtrrSetAllMtrrs() is always used by callers to set all > MTRR settings including the fixed and variable ones. > > The patch removes the necessary API MtrrSetVariableMtrr() to simplify (1) necessary -> unnecessary Reviewed-by: Laszlo Ersek <lersek@redhat.com> Thanks Laszlo > the MtrrLib API. > > There is no code in edk2 and edk2-platforms repo that calls > MtrrGetVariableMtrr(). > > Signed-off-by: Ray Ni <ray.ni@intel.com> > Cc: Eric Dong <eric.dong@intel.com> > Cc: Laszlo Ersek <lersek@redhat.com> > Cc: Rahul Kumar <rahul1.kumar@intel.com> > --- > UefiCpuPkg/Include/Library/MtrrLib.h | 15 -------------- > UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 29 ---------------------------- > 2 files changed, 44 deletions(-) > > diff --git a/UefiCpuPkg/Include/Library/MtrrLib.h b/UefiCpuPkg/Include/Library/MtrrLib.h > index cfe3c0ab59..0bc69e235c 100644 > --- a/UefiCpuPkg/Include/Library/MtrrLib.h > +++ b/UefiCpuPkg/Include/Library/MtrrLib.h > @@ -185,21 +185,6 @@ MtrrGetMemoryAttribute ( > ); > > > -/** > - This function sets variable MTRRs > - > - @param[in] VariableSettings A buffer to hold variable MTRRs content. > - > - @return The pointer of VariableSettings > - > -**/ > -MTRR_VARIABLE_SETTINGS* > -EFIAPI > -MtrrSetVariableMtrr ( > - IN MTRR_VARIABLE_SETTINGS *VariableSettings > - ); > - > - > /** > This function gets the content in fixed MTRRs > > diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > index f4a10edc87..8b54f2c03b 100644 > --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > @@ -2558,35 +2558,6 @@ MtrrSetVariableMtrrWorker ( > } > } > > - > -/** > - This function sets variable MTRRs > - > - @param[in] VariableSettings A buffer to hold variable MTRRs content. > - > - @return The pointer of VariableSettings > - > -**/ > -MTRR_VARIABLE_SETTINGS* > -EFIAPI > -MtrrSetVariableMtrr ( > - IN MTRR_VARIABLE_SETTINGS *VariableSettings > - ) > -{ > - MTRR_CONTEXT MtrrContext; > - > - if (!IsMtrrSupported ()) { > - return VariableSettings; > - } > - > - MtrrLibPreMtrrChange (&MtrrContext); > - MtrrSetVariableMtrrWorker (VariableSettings); > - MtrrLibPostMtrrChange (&MtrrContext); > - MtrrDebugPrintAllMtrrs (); > - > - return VariableSettings; > -} > - > /** > Worker function setting fixed MTRRs > > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v2 2/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetVariableMtrr() 2020-07-13 8:12 ` [PATCH v2 2/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetVariableMtrr() Ni, Ray 2020-07-13 14:54 ` [edk2-devel] " Laszlo Ersek @ 2020-07-14 2:15 ` Dong, Eric 1 sibling, 0 replies; 10+ messages in thread From: Dong, Eric @ 2020-07-14 2:15 UTC (permalink / raw) To: devel@edk2.groups.io, Ni, Ray; +Cc: Laszlo Ersek, Kumar, Rahul1 Reviewed-by: Eric Dong <eric.dong@intel.com> > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ni, Ray > Sent: Monday, July 13, 2020 4:13 PM > To: devel@edk2.groups.io > Cc: Dong, Eric <eric.dong@intel.com>; Laszlo Ersek <lersek@redhat.com>; > Kumar, Rahul1 <rahul1.kumar@intel.com> > Subject: [edk2-devel] [PATCH v2 2/3] UefiCpuPkg/MtrrLib: Remove > unnecessary API MtrrSetVariableMtrr() > > MtrrSetVariableMtrr() sets all the variable MTRR settings. > But in fact MtrrSetAllMtrrs() is always used by callers to set all > MTRR settings including the fixed and variable ones. > > The patch removes the necessary API MtrrSetVariableMtrr() to simplify > the MtrrLib API. > > There is no code in edk2 and edk2-platforms repo that calls > MtrrGetVariableMtrr(). > > Signed-off-by: Ray Ni <ray.ni@intel.com> > Cc: Eric Dong <eric.dong@intel.com> > Cc: Laszlo Ersek <lersek@redhat.com> > Cc: Rahul Kumar <rahul1.kumar@intel.com> > --- > UefiCpuPkg/Include/Library/MtrrLib.h | 15 -------------- > UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 29 ---------------------------- > 2 files changed, 44 deletions(-) > > diff --git a/UefiCpuPkg/Include/Library/MtrrLib.h > b/UefiCpuPkg/Include/Library/MtrrLib.h > index cfe3c0ab59..0bc69e235c 100644 > --- a/UefiCpuPkg/Include/Library/MtrrLib.h > +++ b/UefiCpuPkg/Include/Library/MtrrLib.h > @@ -185,21 +185,6 @@ MtrrGetMemoryAttribute ( > ); > > > > > > -/** > > - This function sets variable MTRRs > > - > > - @param[in] VariableSettings A buffer to hold variable MTRRs content. > > - > > - @return The pointer of VariableSettings > > - > > -**/ > > -MTRR_VARIABLE_SETTINGS* > > -EFIAPI > > -MtrrSetVariableMtrr ( > > - IN MTRR_VARIABLE_SETTINGS *VariableSettings > > - ); > > - > > - > > /** > > This function gets the content in fixed MTRRs > > > > diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > index f4a10edc87..8b54f2c03b 100644 > --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > @@ -2558,35 +2558,6 @@ MtrrSetVariableMtrrWorker ( > } > > } > > > > - > > -/** > > - This function sets variable MTRRs > > - > > - @param[in] VariableSettings A buffer to hold variable MTRRs content. > > - > > - @return The pointer of VariableSettings > > - > > -**/ > > -MTRR_VARIABLE_SETTINGS* > > -EFIAPI > > -MtrrSetVariableMtrr ( > > - IN MTRR_VARIABLE_SETTINGS *VariableSettings > > - ) > > -{ > > - MTRR_CONTEXT MtrrContext; > > - > > - if (!IsMtrrSupported ()) { > > - return VariableSettings; > > - } > > - > > - MtrrLibPreMtrrChange (&MtrrContext); > > - MtrrSetVariableMtrrWorker (VariableSettings); > > - MtrrLibPostMtrrChange (&MtrrContext); > > - MtrrDebugPrintAllMtrrs (); > > - > > - return VariableSettings; > > -} > > - > > /** > > Worker function setting fixed MTRRs > > > > -- > 2.27.0.windows.1 > > > -=-=-=-=-=-= > Groups.io Links: You receive all messages sent to this group. > > View/Reply Online (#62405): https://edk2.groups.io/g/devel/message/62405 > Mute This Topic: https://groups.io/mt/75472803/1768733 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [eric.dong@intel.com] > -=-=-=-=-=-= ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 3/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetFixedMtrr() 2020-07-13 8:12 [PATCH v2 0/3] Remove unnecessary APIs in MtrrLib Ni, Ray 2020-07-13 8:12 ` [PATCH v2 1/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrGetVariableMtrr() Ni, Ray 2020-07-13 8:12 ` [PATCH v2 2/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetVariableMtrr() Ni, Ray @ 2020-07-13 8:12 ` Ni, Ray 2020-07-13 14:54 ` [edk2-devel] " Laszlo Ersek 2020-07-14 2:15 ` Dong, Eric 2 siblings, 2 replies; 10+ messages in thread From: Ni, Ray @ 2020-07-13 8:12 UTC (permalink / raw) To: devel; +Cc: Eric Dong, Laszlo Ersek, Rahul Kumar MtrrSetFixedMtrr() sets all the fixed MTRR settings. But in fact MtrrSetAllMtrrs() is always used by callers to set all MTRR settings including the fixed and variable ones. The patch removes the necessary API MtrrSetFixedMtrr() to simplify the MtrrLib API. There is no code in edk2 and edk2-platforms repo that calls MtrrGetVariableMtrr(). Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> --- UefiCpuPkg/Include/Library/MtrrLib.h | 15 -------------- UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 29 ---------------------------- 2 files changed, 44 deletions(-) diff --git a/UefiCpuPkg/Include/Library/MtrrLib.h b/UefiCpuPkg/Include/Library/MtrrLib.h index 0bc69e235c..9110787067 100644 --- a/UefiCpuPkg/Include/Library/MtrrLib.h +++ b/UefiCpuPkg/Include/Library/MtrrLib.h @@ -200,21 +200,6 @@ MtrrGetFixedMtrr ( ); -/** - This function sets fixed MTRRs - - @param[in] FixedSettings A buffer holding fixed MTRRs content. - - @return The pointer of FixedSettings - -**/ -MTRR_FIXED_SETTINGS* -EFIAPI -MtrrSetFixedMtrr ( - IN MTRR_FIXED_SETTINGS *FixedSettings - ); - - /** This function gets the content in all MTRRs (variable and fixed) diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c index 8b54f2c03b..ceab7a065f 100644 --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c @@ -2580,35 +2580,6 @@ MtrrSetFixedMtrrWorker ( } -/** - This function sets fixed MTRRs - - @param[in] FixedSettings A buffer to hold fixed MTRRs content. - - @retval The pointer of FixedSettings - -**/ -MTRR_FIXED_SETTINGS* -EFIAPI -MtrrSetFixedMtrr ( - IN MTRR_FIXED_SETTINGS *FixedSettings - ) -{ - MTRR_CONTEXT MtrrContext; - - if (!IsMtrrSupported ()) { - return FixedSettings; - } - - MtrrLibPreMtrrChange (&MtrrContext); - MtrrSetFixedMtrrWorker (FixedSettings); - MtrrLibPostMtrrChange (&MtrrContext); - MtrrDebugPrintAllMtrrs (); - - return FixedSettings; -} - - /** This function gets the content in all MTRRs (variable and fixed) -- 2.27.0.windows.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v2 3/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetFixedMtrr() 2020-07-13 8:12 ` [PATCH v2 3/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetFixedMtrr() Ni, Ray @ 2020-07-13 14:54 ` Laszlo Ersek 2020-07-14 2:15 ` Dong, Eric 1 sibling, 0 replies; 10+ messages in thread From: Laszlo Ersek @ 2020-07-13 14:54 UTC (permalink / raw) To: devel, ray.ni; +Cc: Eric Dong, Rahul Kumar On 07/13/20 10:12, Ni, Ray wrote: > MtrrSetFixedMtrr() sets all the fixed MTRR settings. > But in fact MtrrSetAllMtrrs() is always used by callers to set all > MTRR settings including the fixed and variable ones. > > The patch removes the necessary API MtrrSetFixedMtrr() to simplify (1) necessary -> unnecessary Reviewed-by: Laszlo Ersek <lersek@redhat.com> Thanks Laszlo > the MtrrLib API. > > There is no code in edk2 and edk2-platforms repo that calls > MtrrGetVariableMtrr(). > > Signed-off-by: Ray Ni <ray.ni@intel.com> > Cc: Eric Dong <eric.dong@intel.com> > Cc: Laszlo Ersek <lersek@redhat.com> > Cc: Rahul Kumar <rahul1.kumar@intel.com> > --- > UefiCpuPkg/Include/Library/MtrrLib.h | 15 -------------- > UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 29 ---------------------------- > 2 files changed, 44 deletions(-) > > diff --git a/UefiCpuPkg/Include/Library/MtrrLib.h b/UefiCpuPkg/Include/Library/MtrrLib.h > index 0bc69e235c..9110787067 100644 > --- a/UefiCpuPkg/Include/Library/MtrrLib.h > +++ b/UefiCpuPkg/Include/Library/MtrrLib.h > @@ -200,21 +200,6 @@ MtrrGetFixedMtrr ( > ); > > > -/** > - This function sets fixed MTRRs > - > - @param[in] FixedSettings A buffer holding fixed MTRRs content. > - > - @return The pointer of FixedSettings > - > -**/ > -MTRR_FIXED_SETTINGS* > -EFIAPI > -MtrrSetFixedMtrr ( > - IN MTRR_FIXED_SETTINGS *FixedSettings > - ); > - > - > /** > This function gets the content in all MTRRs (variable and fixed) > > diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > index 8b54f2c03b..ceab7a065f 100644 > --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > @@ -2580,35 +2580,6 @@ MtrrSetFixedMtrrWorker ( > } > > > -/** > - This function sets fixed MTRRs > - > - @param[in] FixedSettings A buffer to hold fixed MTRRs content. > - > - @retval The pointer of FixedSettings > - > -**/ > -MTRR_FIXED_SETTINGS* > -EFIAPI > -MtrrSetFixedMtrr ( > - IN MTRR_FIXED_SETTINGS *FixedSettings > - ) > -{ > - MTRR_CONTEXT MtrrContext; > - > - if (!IsMtrrSupported ()) { > - return FixedSettings; > - } > - > - MtrrLibPreMtrrChange (&MtrrContext); > - MtrrSetFixedMtrrWorker (FixedSettings); > - MtrrLibPostMtrrChange (&MtrrContext); > - MtrrDebugPrintAllMtrrs (); > - > - return FixedSettings; > -} > - > - > /** > This function gets the content in all MTRRs (variable and fixed) > > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v2 3/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetFixedMtrr() 2020-07-13 8:12 ` [PATCH v2 3/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetFixedMtrr() Ni, Ray 2020-07-13 14:54 ` [edk2-devel] " Laszlo Ersek @ 2020-07-14 2:15 ` Dong, Eric 1 sibling, 0 replies; 10+ messages in thread From: Dong, Eric @ 2020-07-14 2:15 UTC (permalink / raw) To: devel@edk2.groups.io, Ni, Ray; +Cc: Laszlo Ersek, Kumar, Rahul1 Reviewed-by: Eric Dong <eric.dong@intel.com> > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ni, Ray > Sent: Monday, July 13, 2020 4:13 PM > To: devel@edk2.groups.io > Cc: Dong, Eric <eric.dong@intel.com>; Laszlo Ersek <lersek@redhat.com>; > Kumar, Rahul1 <rahul1.kumar@intel.com> > Subject: [edk2-devel] [PATCH v2 3/3] UefiCpuPkg/MtrrLib: Remove > unnecessary API MtrrSetFixedMtrr() > > MtrrSetFixedMtrr() sets all the fixed MTRR settings. > But in fact MtrrSetAllMtrrs() is always used by callers to set all MTRR settings > including the fixed and variable ones. > > The patch removes the necessary API MtrrSetFixedMtrr() to simplify the > MtrrLib API. > > There is no code in edk2 and edk2-platforms repo that calls > MtrrGetVariableMtrr(). > > Signed-off-by: Ray Ni <ray.ni@intel.com> > Cc: Eric Dong <eric.dong@intel.com> > Cc: Laszlo Ersek <lersek@redhat.com> > Cc: Rahul Kumar <rahul1.kumar@intel.com> > --- > UefiCpuPkg/Include/Library/MtrrLib.h | 15 -------------- > UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 29 ---------------------------- > 2 files changed, 44 deletions(-) > > diff --git a/UefiCpuPkg/Include/Library/MtrrLib.h > b/UefiCpuPkg/Include/Library/MtrrLib.h > index 0bc69e235c..9110787067 100644 > --- a/UefiCpuPkg/Include/Library/MtrrLib.h > +++ b/UefiCpuPkg/Include/Library/MtrrLib.h > @@ -200,21 +200,6 @@ MtrrGetFixedMtrr ( > ); -/**- This function sets fixed MTRRs-- @param[in] FixedSettings A > buffer holding fixed MTRRs content.-- @return The pointer of > FixedSettings--**/-MTRR_FIXED_SETTINGS*-EFIAPI-MtrrSetFixedMtrr (- IN > MTRR_FIXED_SETTINGS *FixedSettings- );-- /** This function gets the > content in all MTRRs (variable and fixed) diff --git > a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > index 8b54f2c03b..ceab7a065f 100644 > --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > @@ -2580,35 +2580,6 @@ MtrrSetFixedMtrrWorker ( > } -/**- This function sets fixed MTRRs-- @param[in] FixedSettings A > buffer to hold fixed MTRRs content.-- @retval The pointer of FixedSettings-- > **/-MTRR_FIXED_SETTINGS*-EFIAPI-MtrrSetFixedMtrr (- IN > MTRR_FIXED_SETTINGS *FixedSettings- )-{- MTRR_CONTEXT > MtrrContext;-- if (!IsMtrrSupported ()) {- return FixedSettings;- }-- > MtrrLibPreMtrrChange (&MtrrContext);- MtrrSetFixedMtrrWorker > (FixedSettings);- MtrrLibPostMtrrChange (&MtrrContext);- > MtrrDebugPrintAllMtrrs ();-- return FixedSettings;-}-- /** This function gets > the content in all MTRRs (variable and fixed) -- > 2.27.0.windows.1 > > > -=-=-=-=-=-= > Groups.io Links: You receive all messages sent to this group. > > View/Reply Online (#62406): https://edk2.groups.io/g/devel/message/62406 > Mute This Topic: https://groups.io/mt/75472804/1768733 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [eric.dong@intel.com] - > =-=-=-=-=-= ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2020-07-14 2:15 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-07-13 8:12 [PATCH v2 0/3] Remove unnecessary APIs in MtrrLib Ni, Ray 2020-07-13 8:12 ` [PATCH v2 1/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrGetVariableMtrr() Ni, Ray 2020-07-13 14:53 ` [edk2-devel] " Laszlo Ersek 2020-07-14 2:15 ` Dong, Eric 2020-07-13 8:12 ` [PATCH v2 2/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetVariableMtrr() Ni, Ray 2020-07-13 14:54 ` [edk2-devel] " Laszlo Ersek 2020-07-14 2:15 ` Dong, Eric 2020-07-13 8:12 ` [PATCH v2 3/3] UefiCpuPkg/MtrrLib: Remove unnecessary API MtrrSetFixedMtrr() Ni, Ray 2020-07-13 14:54 ` [edk2-devel] " Laszlo Ersek 2020-07-14 2:15 ` Dong, Eric
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox