[edk2] [PATCH] ArmPkg/Library/ArmLib: add ArmWriteSctlr

Michael Zimmermann posted 1 patch 6 years, 11 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
ArmPkg/Include/Library/ArmLib.h             | 6 ++++++
ArmPkg/Library/ArmLib/Arm/ArmLibSupport.S   | 4 ++++
ArmPkg/Library/ArmLib/Arm/ArmLibSupport.asm | 3 +++
3 files changed, 13 insertions(+)
[edk2] [PATCH] ArmPkg/Library/ArmLib: add ArmWriteSctlr
Posted by Michael Zimmermann 6 years, 11 months ago
This currently isn't needed by anything in the edk2 tree but
it's useful for externally maintained platforms which have
to set this register e.g. to disable alignment aborts.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
---
 ArmPkg/Include/Library/ArmLib.h             | 6 ++++++
 ArmPkg/Library/ArmLib/Arm/ArmLibSupport.S   | 4 ++++
 ArmPkg/Library/ArmLib/Arm/ArmLibSupport.asm | 3 +++
 3 files changed, 13 insertions(+)

diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h
index 24e84c7a1965..ffda50e9d767 100644
--- a/ArmPkg/Include/Library/ArmLib.h
+++ b/ArmPkg/Include/Library/ArmLib.h
@@ -558,6 +558,12 @@ ArmReadSctlr (
   VOID
   );
 
+VOID
+EFIAPI
+ArmWriteSctlr (
+  IN  UINT32   Value
+  );
+
 UINTN
 EFIAPI
 ArmReadHVBar (
diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.S b/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.S
index a0b5ed500298..149b57e059ee 100644
--- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.S
+++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.S
@@ -153,6 +153,10 @@ ASM_FUNC(ArmReadSctlr)
   mrc     p15, 0, r0, c1, c0, 0      @ Read SCTLR into R0 (Read control register configuration data)
   bx      lr
 
+ASM_FUNC(ArmWriteSctlr)
+  mcr     p15, 0, r0, c1, c0, 0
+  bx      lr
+
 ASM_FUNC(ArmReadCpuActlr)
   mrc     p15, 0, r0, c1, c0, 1
   bx      lr
diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.asm b/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.asm
index 85b0feee20d4..219140c22b13 100644
--- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.asm
+++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.asm
@@ -155,6 +155,9 @@
   mrc     p15, 0, r0, c1, c0, 0      // Read SCTLR into R0 (Read control register configuration data)
   bx      lr
 
+ RVCT_ASM_EXPORT ArmWriteSctlr
+  mcr     p15, 0, r0, c1, c0, 0
+  bx      lr
 
  RVCT_ASM_EXPORT ArmReadCpuActlr
   mrc     p15, 0, r0, c1, c0, 1
-- 
2.15.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] ArmPkg/Library/ArmLib: add ArmWriteSctlr
Posted by Ard Biesheuvel 6 years, 11 months ago
On 10 January 2018 at 06:38, Michael Zimmermann
<sigmaepsilon92@gmail.com> wrote:
> This currently isn't needed by anything in the edk2 tree but
> it's useful for externally maintained platforms which have
> to set this register e.g. to disable alignment aborts.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>

Thanks Michael

You missed the AArch64 version, could you add it there as well?
Otherwise, the libraries get out of sync.

> ---
>  ArmPkg/Include/Library/ArmLib.h             | 6 ++++++
>  ArmPkg/Library/ArmLib/Arm/ArmLibSupport.S   | 4 ++++
>  ArmPkg/Library/ArmLib/Arm/ArmLibSupport.asm | 3 +++
>  3 files changed, 13 insertions(+)
>
> diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h
> index 24e84c7a1965..ffda50e9d767 100644
> --- a/ArmPkg/Include/Library/ArmLib.h
> +++ b/ArmPkg/Include/Library/ArmLib.h
> @@ -558,6 +558,12 @@ ArmReadSctlr (
>    VOID
>    );
>
> +VOID
> +EFIAPI
> +ArmWriteSctlr (
> +  IN  UINT32   Value
> +  );
> +
>  UINTN
>  EFIAPI
>  ArmReadHVBar (
> diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.S b/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.S
> index a0b5ed500298..149b57e059ee 100644
> --- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.S
> +++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.S
> @@ -153,6 +153,10 @@ ASM_FUNC(ArmReadSctlr)
>    mrc     p15, 0, r0, c1, c0, 0      @ Read SCTLR into R0 (Read control register configuration data)
>    bx      lr
>
> +ASM_FUNC(ArmWriteSctlr)
> +  mcr     p15, 0, r0, c1, c0, 0
> +  bx      lr
> +
>  ASM_FUNC(ArmReadCpuActlr)
>    mrc     p15, 0, r0, c1, c0, 1
>    bx      lr
> diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.asm b/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.asm
> index 85b0feee20d4..219140c22b13 100644
> --- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.asm
> +++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupport.asm
> @@ -155,6 +155,9 @@
>    mrc     p15, 0, r0, c1, c0, 0      // Read SCTLR into R0 (Read control register configuration data)
>    bx      lr
>
> + RVCT_ASM_EXPORT ArmWriteSctlr
> +  mcr     p15, 0, r0, c1, c0, 0
> +  bx      lr
>
>   RVCT_ASM_EXPORT ArmReadCpuActlr
>    mrc     p15, 0, r0, c1, c0, 1
> --
> 2.15.1
>
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel