Re: [edk2] [PATCH v2 2/2] ArmPkg/ArmGicArchLib: use common source file
On 31 July 2015 at 15:50, Ryan Harkin wrote: > > > On 31 July 2015 at 15:49, Ryan Harkin wrote: > >> Now that the Arm and Aarch64 source files are identical and rely on >> conditional compilation to provide arch specific code, remove the >> duplicated files and use one common file. >> >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Ryan Harkin >> Reviewed-by: Ard Biesheuvel >> --- >> ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c | 77 >> -- >> .../ArmGicArchLib/{AArch64 => }/ArmGicArchLib.c| 0 >> ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf | 7 +- >> 3 files changed, 2 insertions(+), 82 deletions(-) >> >> diff --git a/ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c >> b/ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c >> deleted file mode 100644 >> index 75ba156..000 >> --- a/ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c >> +++ /dev/null >> @@ -1,77 +0,0 @@ >> -/** @file >> -* >> -* Copyright (c) 2014, ARM Limited. All rights reserved. >> -* >> -* This program and the accompanying materials are licensed and made >> available >> -* under the terms and conditions of the BSD License which accompanies >> this >> -* distribution. The full text of the license may be found at >> -* http://opensource.org/licenses/bsd-license.php >> -* >> -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, >> -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR >> IMPLIED. >> -* >> -**/ >> - >> -#include >> -#include >> - >> -STATIC ARM_GIC_ARCH_REVISIONmGicArchRevision = >> ARM_GIC_ARCH_REVISION_2; >> - >> -STATIC >> -RETURN_STATUS >> -EFIAPI >> -GicSystemRegistersSupported ( >> - VOID >> - ) >> -{ >> -#if defined (MDE_CPU_ARM) >> - return (ArmReadIdPfr1 () & ARM_PFR1_GIC); >> -#elif defined(MDE_CPU_AARCH64) >> - return (ArmReadIdPfr0 () & AARCH64_PFR0_GIC); >> -#else >> - #error "Unknown chipset." >> -#endif >> -} >> - >> -RETURN_STATUS >> -EFIAPI >> -ArmGicArchLibInitialize ( >> - VOID >> - ) >> -{ >> - UINT32IccSre; >> - >> - // Ideally we would like to use the GICC IIDR Architecture version >> here, but >> - // this does not seem to be very reliable as the implementation could >> easily >> - // get it wrong. It is more reliable to check if the GICv3 System >> Register >> - // feature is implemented on the CPU. This is also convenient as our >> GICv3 >> - // driver requires SRE. If only Memory mapped access is available we >> try to >> - // drive the GIC as a v2. >> - if (GicSystemRegistersSupported()) { >> -// Make sure System Register access is enabled (SRE). This depends >> on the >> -// higher privilege level giving us permission, otherwise we will >> either >> -// cause an exception here, or the write doesn't stick in which case >> we need >> -// to fall back to the GICv2 MMIO interface. >> -// Note: We do not need to set ICC_SRE_EL2.Enable because the OS is >> started >> -// at the same exception level. >> -// It is the OS responsibility to set this bit. >> -IccSre = ArmGicV3GetControlSystemRegisterEnable (); >> -if (!(IccSre & ICC_SRE_EL2_SRE)) { >> - ArmGicV3SetControlSystemRegisterEnable (IccSre| ICC_SRE_EL2_SRE); >> > > Ach! No, now I need a v3. > > Sorry for the noise > False alarm, I'm mis-reading how git send-email -M munged the report and I thought I'd kept the version without the space before the '|'. v2 is what I expected afterall. > > > >> - IccSre = ArmGicV3GetControlSystemRegisterEnable (); >> -} >> -if (IccSre & ICC_SRE_EL2_SRE) { >> - mGicArchRevision = ARM_GIC_ARCH_REVISION_3; >> -} >> - } >> - return RETURN_SUCCESS; >> -} >> - >> -ARM_GIC_ARCH_REVISION >> -EFIAPI >> -ArmGicGetSupportedArchRevision ( >> - VOID >> - ) >> -{ >> - return mGicArchRevision; >> -} >> diff --git a/ArmPkg/Library/ArmGicArchLib/AArch64/ArmGicArchLib.c >> b/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.c >> similarity index 100% >> rename from ArmPkg/Library/ArmGicArchLib/AArch64/ArmGicArchLib.c >> rename to ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.c >> diff --git a/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf >> b/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf >> index 7dbcb08..5c968e6 100644 >> --- a/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf >> +++ b/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf >> @@ -20,11 +20,8 @@ >>LIBRARY_CLASS = ArmGicArchLib|DXE_DRIVER UEFI_DRIVER >> UEFI_APPLICATION >>CONSTRUCTOR= ArmGicArchLibInitialize >> >> -[Sources.ARM] >> - Arm/ArmGicArchLib.c >> - >> -[Sources.AARCH64] >> - AArch64/ArmGicArchLib.c >> +[Sources.common] >> + ArmGicArchLib.c >> >> [Packages] >>MdePkg/MdePkg.dec >> -- >> 2.1.0 >> >> > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2 2/2] ArmPkg/ArmGicArchLib: use common source file
On 31 July 2015 at 15:49, Ryan Harkin wrote: > Now that the Arm and Aarch64 source files are identical and rely on > conditional compilation to provide arch specific code, remove the > duplicated files and use one common file. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ryan Harkin > Reviewed-by: Ard Biesheuvel > --- > ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c | 77 > -- > .../ArmGicArchLib/{AArch64 => }/ArmGicArchLib.c| 0 > ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf | 7 +- > 3 files changed, 2 insertions(+), 82 deletions(-) > > diff --git a/ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c > b/ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c > deleted file mode 100644 > index 75ba156..000 > --- a/ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c > +++ /dev/null > @@ -1,77 +0,0 @@ > -/** @file > -* > -* Copyright (c) 2014, ARM Limited. All rights reserved. > -* > -* This program and the accompanying materials are licensed and made > available > -* under the terms and conditions of the BSD License which accompanies > this > -* distribution. The full text of the license may be found at > -* http://opensource.org/licenses/bsd-license.php > -* > -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR > IMPLIED. > -* > -**/ > - > -#include > -#include > - > -STATIC ARM_GIC_ARCH_REVISIONmGicArchRevision = > ARM_GIC_ARCH_REVISION_2; > - > -STATIC > -RETURN_STATUS > -EFIAPI > -GicSystemRegistersSupported ( > - VOID > - ) > -{ > -#if defined (MDE_CPU_ARM) > - return (ArmReadIdPfr1 () & ARM_PFR1_GIC); > -#elif defined(MDE_CPU_AARCH64) > - return (ArmReadIdPfr0 () & AARCH64_PFR0_GIC); > -#else > - #error "Unknown chipset." > -#endif > -} > - > -RETURN_STATUS > -EFIAPI > -ArmGicArchLibInitialize ( > - VOID > - ) > -{ > - UINT32IccSre; > - > - // Ideally we would like to use the GICC IIDR Architecture version > here, but > - // this does not seem to be very reliable as the implementation could > easily > - // get it wrong. It is more reliable to check if the GICv3 System > Register > - // feature is implemented on the CPU. This is also convenient as our > GICv3 > - // driver requires SRE. If only Memory mapped access is available we > try to > - // drive the GIC as a v2. > - if (GicSystemRegistersSupported()) { > -// Make sure System Register access is enabled (SRE). This depends on > the > -// higher privilege level giving us permission, otherwise we will > either > -// cause an exception here, or the write doesn't stick in which case > we need > -// to fall back to the GICv2 MMIO interface. > -// Note: We do not need to set ICC_SRE_EL2.Enable because the OS is > started > -// at the same exception level. > -// It is the OS responsibility to set this bit. > -IccSre = ArmGicV3GetControlSystemRegisterEnable (); > -if (!(IccSre & ICC_SRE_EL2_SRE)) { > - ArmGicV3SetControlSystemRegisterEnable (IccSre| ICC_SRE_EL2_SRE); > Ach! No, now I need a v3. Sorry for the noise > - IccSre = ArmGicV3GetControlSystemRegisterEnable (); > -} > -if (IccSre & ICC_SRE_EL2_SRE) { > - mGicArchRevision = ARM_GIC_ARCH_REVISION_3; > -} > - } > - return RETURN_SUCCESS; > -} > - > -ARM_GIC_ARCH_REVISION > -EFIAPI > -ArmGicGetSupportedArchRevision ( > - VOID > - ) > -{ > - return mGicArchRevision; > -} > diff --git a/ArmPkg/Library/ArmGicArchLib/AArch64/ArmGicArchLib.c > b/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.c > similarity index 100% > rename from ArmPkg/Library/ArmGicArchLib/AArch64/ArmGicArchLib.c > rename to ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.c > diff --git a/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf > b/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf > index 7dbcb08..5c968e6 100644 > --- a/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf > +++ b/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf > @@ -20,11 +20,8 @@ >LIBRARY_CLASS = ArmGicArchLib|DXE_DRIVER UEFI_DRIVER > UEFI_APPLICATION >CONSTRUCTOR= ArmGicArchLibInitialize > > -[Sources.ARM] > - Arm/ArmGicArchLib.c > - > -[Sources.AARCH64] > - AArch64/ArmGicArchLib.c > +[Sources.common] > + ArmGicArchLib.c > > [Packages] >MdePkg/MdePkg.dec > -- > 2.1.0 > > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH v2 2/2] ArmPkg/ArmGicArchLib: use common source file
Now that the Arm and Aarch64 source files are identical and rely on conditional compilation to provide arch specific code, remove the duplicated files and use one common file. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ryan Harkin Reviewed-by: Ard Biesheuvel --- ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c | 77 -- .../ArmGicArchLib/{AArch64 => }/ArmGicArchLib.c| 0 ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf | 7 +- 3 files changed, 2 insertions(+), 82 deletions(-) diff --git a/ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c b/ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c deleted file mode 100644 index 75ba156..000 --- a/ArmPkg/Library/ArmGicArchLib/Arm/ArmGicArchLib.c +++ /dev/null @@ -1,77 +0,0 @@ -/** @file -* -* Copyright (c) 2014, ARM Limited. All rights reserved. -* -* This program and the accompanying materials are licensed and made available -* under the terms and conditions of the BSD License which accompanies this -* distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#include - -STATIC ARM_GIC_ARCH_REVISIONmGicArchRevision = ARM_GIC_ARCH_REVISION_2; - -STATIC -RETURN_STATUS -EFIAPI -GicSystemRegistersSupported ( - VOID - ) -{ -#if defined (MDE_CPU_ARM) - return (ArmReadIdPfr1 () & ARM_PFR1_GIC); -#elif defined(MDE_CPU_AARCH64) - return (ArmReadIdPfr0 () & AARCH64_PFR0_GIC); -#else - #error "Unknown chipset." -#endif -} - -RETURN_STATUS -EFIAPI -ArmGicArchLibInitialize ( - VOID - ) -{ - UINT32IccSre; - - // Ideally we would like to use the GICC IIDR Architecture version here, but - // this does not seem to be very reliable as the implementation could easily - // get it wrong. It is more reliable to check if the GICv3 System Register - // feature is implemented on the CPU. This is also convenient as our GICv3 - // driver requires SRE. If only Memory mapped access is available we try to - // drive the GIC as a v2. - if (GicSystemRegistersSupported()) { -// Make sure System Register access is enabled (SRE). This depends on the -// higher privilege level giving us permission, otherwise we will either -// cause an exception here, or the write doesn't stick in which case we need -// to fall back to the GICv2 MMIO interface. -// Note: We do not need to set ICC_SRE_EL2.Enable because the OS is started -// at the same exception level. -// It is the OS responsibility to set this bit. -IccSre = ArmGicV3GetControlSystemRegisterEnable (); -if (!(IccSre & ICC_SRE_EL2_SRE)) { - ArmGicV3SetControlSystemRegisterEnable (IccSre| ICC_SRE_EL2_SRE); - IccSre = ArmGicV3GetControlSystemRegisterEnable (); -} -if (IccSre & ICC_SRE_EL2_SRE) { - mGicArchRevision = ARM_GIC_ARCH_REVISION_3; -} - } - return RETURN_SUCCESS; -} - -ARM_GIC_ARCH_REVISION -EFIAPI -ArmGicGetSupportedArchRevision ( - VOID - ) -{ - return mGicArchRevision; -} diff --git a/ArmPkg/Library/ArmGicArchLib/AArch64/ArmGicArchLib.c b/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.c similarity index 100% rename from ArmPkg/Library/ArmGicArchLib/AArch64/ArmGicArchLib.c rename to ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.c diff --git a/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf b/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf index 7dbcb08..5c968e6 100644 --- a/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf +++ b/ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf @@ -20,11 +20,8 @@ LIBRARY_CLASS = ArmGicArchLib|DXE_DRIVER UEFI_DRIVER UEFI_APPLICATION CONSTRUCTOR= ArmGicArchLibInitialize -[Sources.ARM] - Arm/ArmGicArchLib.c - -[Sources.AARCH64] - AArch64/ArmGicArchLib.c +[Sources.common] + ArmGicArchLib.c [Packages] MdePkg/MdePkg.dec -- 2.1.0 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel