From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from muminek.juszkiewicz.com.pl (muminek.juszkiewicz.com.pl [213.251.184.221]) by mx.groups.io with SMTP id smtpd.web11.10012.1682001876072771166 for ; Thu, 20 Apr 2023 07:44:36 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=softfail (domain: linaro.org, ip: 213.251.184.221, mailfrom: marcin.juszkiewicz@linaro.org) Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id 4B11F260840; Thu, 20 Apr 2023 16:44:32 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at juszkiewicz.com.pl Received: from muminek.juszkiewicz.com.pl ([127.0.0.1]) by localhost (muminek.juszkiewicz.com.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6NnXqNQ9n7uO; Thu, 20 Apr 2023 16:44:29 +0200 (CEST) Received: from applejack.lan (83.11.213.14.ipv4.supernova.orange.pl [83.11.213.14]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id 10451260080; Thu, 20 Apr 2023 16:44:28 +0200 (CEST) From: "Marcin Juszkiewicz" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Rebecca Cran , Pedro Falcato , Marcin Juszkiewicz Subject: [PATCH v6 1/2] ArmLib: add functions to read system registers Date: Thu, 20 Apr 2023 16:44:22 +0200 Message-Id: <20230420144423.70726-1-marcin.juszkiewicz@linaro.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable ArmCpuInfo uses those to read system registers and other parts of EDK2 may find them useful. Signed-off-by: Marcin Juszkiewicz --- ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h | 50 +++++++++++++++- .../Library/ArmLib/AArch64/AArch64Support.S | 58 ++++++++++++++++--- 2 files changed, 99 insertions(+), 9 deletions(-) diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h b/ArmPkg/Library/= ArmLib/AArch64/AArch64Lib.h index 330481fc50db..6380a019ddc5 100644 --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h @@ -40,7 +40,43 @@ ArmCleanInvalidateDataCacheEntryBySetWay ( =20 UINTN EFIAPI -ArmReadIdAA64Pfr0 ( +ArmReadIdAA64Dfr0 ( + VOID + ); + +UINTN +EFIAPI +ArmReadIdAA64Dfr1 ( + VOID + ); + +UINTN +EFIAPI +ArmReadIdAA64Isar0 ( + VOID + ); + +UINTN +EFIAPI +ArmReadIdAA64Isar1 ( + VOID + ); + +UINTN +EFIAPI +ArmReadIdAA64Isar2 ( + VOID + ); + +UINTN +EFIAPI +ArmReadIdAA64Mmfr0 ( + VOID + ); + +UINTN +EFIAPI +ArmReadIdAA64Mmfr1 ( VOID ); =20 @@ -54,4 +90,16 @@ ArmReadIdAA64Mmfr2 ( VOID ); =20 +UINTN +EFIAPI +ArmReadIdAA64Pfr0 ( + VOID + ); + +UINTN +EFIAPI +ArmReadIdAA64Pfr1 ( + VOID + ); + #endif // AARCH64_LIB_H_ diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S b/ArmPkg/Libr= ary/ArmLib/AArch64/AArch64Support.S index d3cc1e86716b..a7111e51882c 100644 --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S @@ -425,10 +425,6 @@ ASM_FUNC(ArmCallWFI) wfi ret =20 -ASM_FUNC(ArmReadIdAA64Mmfr2) - mrs x0, ID_AA64MMFR2_EL1 // read EL1 MMFR2 - ret - ASM_FUNC(ArmReadMpidr) mrs x0, mpidr_el1 // read EL1 MPIDR ret @@ -452,10 +448,6 @@ ASM_FUNC(ArmIsArchTimerImplemented) ret =20 =20 -ASM_FUNC(ArmReadIdAA64Pfr0) - mrs x0, id_aa64pfr0_el1 // Read ID_AA64PFR0 Register - ret - =20 // VOID ArmWriteHcr(UINTN Hcr) ASM_FUNC(ArmWriteHcr) @@ -482,4 +474,54 @@ ASM_FUNC(ArmWriteCntHctl) msr cnthctl_el2, x0 ret =20 + +ASM_FUNC(ArmReadIdAA64Dfr0) + mrs x0, ID_AA64DFR0_EL1 + ret + + +ASM_FUNC(ArmReadIdAA64Dfr1) + mrs x0, ID_AA64DFR1_EL1 + ret + + +ASM_FUNC(ArmReadIdAA64Isar0) + mrs x0, ID_AA64ISAR0_EL1 + ret + + +ASM_FUNC(ArmReadIdAA64Isar1) + mrs x0, ID_AA64ISAR1_EL1 + ret + + +ASM_FUNC(ArmReadIdAA64Isar2) + mrs x0, ID_AA64ISAR2_EL1 + ret + + +ASM_FUNC(ArmReadIdAA64Mmfr0) + mrs x0, ID_AA64MMFR0_EL1 + ret + + +ASM_FUNC(ArmReadIdAA64Mmfr1) + mrs x0, ID_AA64MMFR1_EL1 + ret + + +ASM_FUNC(ArmReadIdAA64Mmfr2) + mrs x0, ID_AA64MMFR2_EL1 + ret + + +ASM_FUNC(ArmReadIdAA64Pfr0) + mrs x0, ID_AA64PFR0_EL1 + ret + + +ASM_FUNC(ArmReadIdAA64Pfr1) + mrs x0, ID_AA64PFR1_EL1 + ret + ASM_FUNCTION_REMOVE_IF_UNREFERENCED --=20 2.40.0