[edk2-devel] [PATCH v5 05/23] ArmPkg: Add helper function to read the Memory Model Feature Register 4

Rebecca Cran posted 23 patches 5 months, 2 weeks ago

[edk2-devel] [PATCH v5 05/23] ArmPkg: Add helper function to read the Memory Model Feature Register 4

Posted by Rebecca Cran 5 months, 2 weeks ago
In AARCH32, CCIDX support is indicated in the MMFR4 register - unlike
under AARCH64 where it's in MMFR2. Add a helper function to read it.

Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
---
 ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h          | 8 ++++++--
 ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S   | 4 ++++
 ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm | 4 ++++
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h
index bb7bda0a3aeb..dcf6723b803b 100644
--- a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h
+++ b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h
@@ -48,9 +48,13 @@ ArmCleanInvalidateDataCacheEntryBySetWay (
   IN  UINTN   SetWayFormat
   );
 
-UINTN
+/** Reads the ID_MMFR4 register.
+
+   @return The contents of the ID_MMFR4 register.
+**/
+UINT32
 EFIAPI
-ArmReadIdPfr0 (
+ArmReadIdMmfr4 (
   VOID
   );
 
diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S
index 01c91b10fcb7..a60a2f634132 100644
--- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S
+++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S
@@ -60,6 +60,10 @@ ASM_FUNC(ArmDisableInterrupts)
   isb
   bx      LR
 
+ASM_FUNC(ArmReadIdMmfr4)
+  mrc    p15,0,r0,c0,c2,6     @ Read ID_MMFR4 Register
+  bx     lr
+
 // UINT32
 // ReadCCSIDR (
 //   IN UINT32 CSSELR
diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm
index 26ffa331b929..1679b09b797a 100644
--- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm
+++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm
@@ -64,6 +64,10 @@
   isb
   bx      LR
 
+ RVCT_ASM_EXPORT ArmReadIdMmfr4
+  mrc    p15,0,r0,c0,c2,6     ; Read ID_MMFR4 Register
+  bx     LR
+
 // UINT32
 // ReadCCSIDR (
 //   IN UINT32 CSSELR
-- 
2.26.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69643): https://edk2.groups.io/g/devel/message/69643
Mute This Topic: https://groups.io/mt/79438407/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH v5 05/23] ArmPkg: Add helper function to read the Memory Model Feature Register 4

Posted by Leif Lindholm 5 months, 1 week ago
On Mon, Jan 04, 2021 at 15:58:12 -0700, Rebecca Cran wrote:
> In AARCH32, CCIDX support is indicated in the MMFR4 register - unlike
> under AARCH64 where it's in MMFR2. Add a helper function to read it.
> 
> Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>

Reviewed-by: Leif Lindholm <leif@nuviainc.com>

However, and I say this as someone who usually tells people to split
their patches up: this one could be squashed with the preceding two.

> ---
>  ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h          | 8 ++++++--
>  ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S   | 4 ++++
>  ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm | 4 ++++
>  3 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h
> index bb7bda0a3aeb..dcf6723b803b 100644
> --- a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h
> +++ b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h
> @@ -48,9 +48,13 @@ ArmCleanInvalidateDataCacheEntryBySetWay (
>    IN  UINTN   SetWayFormat
>    );
>  
> -UINTN
> +/** Reads the ID_MMFR4 register.
> +
> +   @return The contents of the ID_MMFR4 register.
> +**/
> +UINT32
>  EFIAPI
> -ArmReadIdPfr0 (
> +ArmReadIdMmfr4 (
>    VOID
>    );
>  
> diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S
> index 01c91b10fcb7..a60a2f634132 100644
> --- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S
> +++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S
> @@ -60,6 +60,10 @@ ASM_FUNC(ArmDisableInterrupts)
>    isb
>    bx      LR
>  
> +ASM_FUNC(ArmReadIdMmfr4)
> +  mrc    p15,0,r0,c0,c2,6     @ Read ID_MMFR4 Register
> +  bx     lr
> +
>  // UINT32
>  // ReadCCSIDR (
>  //   IN UINT32 CSSELR
> diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm
> index 26ffa331b929..1679b09b797a 100644
> --- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm
> +++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm
> @@ -64,6 +64,10 @@
>    isb
>    bx      LR
>  
> + RVCT_ASM_EXPORT ArmReadIdMmfr4
> +  mrc    p15,0,r0,c0,c2,6     ; Read ID_MMFR4 Register
> +  bx     LR
> +
>  // UINT32
>  // ReadCCSIDR (
>  //   IN UINT32 CSSELR
> -- 
> 2.26.2
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70079): https://edk2.groups.io/g/devel/message/70079
Mute This Topic: https://groups.io/mt/79438407/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-