W dniu 7.04.2023 o 15:02, Pedro Falcato pisze:

+EFI_STATUS
+EFIAPI
+UefiMain  (
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  UINT64  aa64dfr0_el1  = read_aa64dfr0_el1 ();
+  UINT64  aa64dfr1_el1  = read_aa64dfr1_el1 ();
+  UINT64  aa64isar0_el1 = read_aa64isar0_el1 ();
+  UINT64  aa64isar1_el1 = read_aa64isar1_el1 ();
+  UINT64  aa64isar2_el1 = read_aa64isar2_el1 ();
+  UINT64  aa64mmfr0_el1 = read_aa64mmfr0_el1 ();
+  UINT64  aa64mmfr1_el1 = read_aa64mmfr1_el1 ();
+  UINT64  aa64mmfr2_el1 = read_aa64mmfr2_el1 ();
+  UINT64  aa64pfr0_el1  = read_aa64pfr0_el1 ();
+  UINT64  aa64pfr1_el1  = read_aa64pfr1_el1 ();

EDK2 requires separation between declarations and code (something
alike old C89 semantics, but stricter). so:
     UINT64 aa64pfr1_el1;
     <...>
     aa64pfr1_el1 = read_aa64pfr1_el1 ();

done

+
+  /*    UINT64 aa64smfr0_el1 = read_aa64smfr0_el1 ();*/
+  /*    UINT64 aa64zfr0_el1 = read_aa64zfr0_el1 ();*/

Dead Code?

I ignore SVE/SME registers for now. Dropped code.

+
+  AsciiPrint ("ID_AA64MMFR0_EL1 = 0x%016lx\n", aa64mmfr0_el1);
+  AsciiPrint ("ID_AA64MMFR1_EL1 = 0x%016lx\n", aa64mmfr1_el1);
+  AsciiPrint ("ID_AA64MMFR2_EL1 = 0x%016lx\n", aa64mmfr2_el1);
+  AsciiPrint ("ID_AA64PFR0_EL1  = 0x%016lx\n", aa64pfr0_el1);
+  AsciiPrint ("ID_AA64PFR1_EL1  = 0x%016lx\n", aa64pfr1_el1);
+  AsciiPrint ("ID_AA64ISAR0_EL1 = 0x%016lx\n", aa64isar0_el1);
+  AsciiPrint ("ID_AA64ISAR1_EL1 = 0x%016lx\n", aa64isar1_el1);
+  AsciiPrint ("ID_AA64ISAR2_EL1 = 0x%016lx\n", aa64isar2_el1);
+  AsciiPrint ("ID_AA64DFR0_EL1  = 0x%016lx\n", aa64dfr0_el1);
+  AsciiPrint ("ID_AA64DFR1_EL1  = 0x%016lx\n", aa64dfr1_el1);            // 
ignore

Why ignore?

Was 0 on systems I checked. Dropped.

+  /*    AsciiPrint ("ID_AA64SMFR0_EL1 = 0x%016lx\n", aa64smfr0_el1);*/
+  /*    AsciiPrint ("ID_AA64ZFR0_EL1 = 0x%016lx\n", aa64zfr0_el1);*/

dead?

Dropped.

diff --git a/ArmPkg/Application/ArmCpuInfo/readregs.s 
b/ArmPkg/Application/ArmCpuInfo/readregs.s

ASM files that require preprocessing should have a capital S here (.S vs .s)

After renaming it to readregs.S (and changing in ArmCpuInfo.inf) I get:

build.py...
/home/marcin/devel/linaro/sbsa-qemu/code/edk2/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.inf(29): error 000E: File/directory not found in workspace
        readregs.S is not found in packages path:

new file mode 100644
index 000000000000..052834b3c3f2
--- /dev/null
+++ b/ArmPkg/Application/ArmCpuInfo/readregs.s
@@ -0,0 +1,49 @@
+#include <AsmMacroIoLibV8.h>
+
+ASM_FUNC(read_aa64pfr0_el1)
+        mrs x0, ID_AA64PFR0_EL1;
+        ret;

ASM lines (for GAS at least) don't usually end in semicolons. so
    +ASM_FUNC(read_aa64pfr0_el1)
    +        mrs x0, ID_AA64PFR0_EL1
    +        ret

You'd only need the semicolons if you had multiple instructions in one
line (like mrs x0, ID_AA...; ret)

thanks, dropped semicolons

+# ASM_FUNC(read_aa64zfr0_el1)
+#     mrs x0, ID_AA64ZFR0_EL1;
+#     ret;
+
+# ASM_FUNC(read_aa64smfr0_el1)
+#     mrs x0, ID_AA64SMFR0_EL1;
+#     ret;

Dead code?

Those two registers names were missing so got disabled. Dropped.


Brief comments in general:
1) You use binary literals extensively, which are not portable (GNU C
extension, AFAIK not in MSVC)

My C skills are rusty and the last time I used compiler other than GCC was in Borland Turbo C 3 times.

2) Naming of identifiers (vars, functions, etc) needs to follow the
EDK2 style. eg:
     description vs Description
     read_aa64mmfr1_el1 vs ReadAa64MmfrEl1
     etc...

ok

> Forgot mentioning: STATIC vs static, CONST vs const,
> VOID vs void, CHAR8 vs char, etc.
> All fun microsoftisms you need to use here.

Will be fun.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102699): https://edk2.groups.io/g/devel/message/102699
Mute This Topic: https://groups.io/mt/98123579/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to