From: "Marcin Juszkiewicz" <marcin.juszkiewicz@linaro.org>
To: Ard Biesheuvel <ardb@kernel.org>, devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
Leif Lindholm <quic_llindhol@quicinc.com>,
Rebecca Cran <rebecca@bsdio.com>
Subject: Re: [edk2-devel] [PATCH v2] add ArmCpuInfo EFI application
Date: Fri, 7 Apr 2023 14:46:13 +0200 [thread overview]
Message-ID: <fcdf1011-fede-392b-3ceb-45775ab1aa24@linaro.org> (raw)
In-Reply-To: <CAMj1kXGQN56WcPxG0cD+16yaN6BSALi6wLSStYgnCmOgfFrDpQ@mail.gmail.com>
W dniu 7.04.2023 o 12:55, Ard Biesheuvel pisze:
> Hello Marcin,
>
> Thanks for this - it looks useful.
> Some comments below.
Thanks.
> On Fri, 7 Apr 2023 at 12:40, Marcin Juszkiewicz
> <marcin.juszkiewicz@linaro.org> wrote:
>>
>> App goes through ID_AA64*_EL1 system registers and decode their values.
>>
>> First version which does not use much of current AArch64 support code
>> present in EDK2. Written to check what data is there and what can be
>> done with it.
>>
>> Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
>> ---
>> MdeModulePkg/MdeModulePkg.dsc | 3 +-
>> MdeModulePkg/Application/ArmCpuInfo/ArmCpuInfo.inf | 38 +
>> MdeModulePkg/Application/ArmCpuInfo/readargs.h | 12 +
>> MdeModulePkg/Application/ArmCpuInfo/ArmCpuInfo.c | 2274 ++++++++++++++++++++
>> MdeModulePkg/Application/ArmCpuInfo/readregs.s | 49 +
>> 5 files changed, 2375 insertions(+), 1 deletion(-)
>>
>
> Why are you adding this to MdeModulePkg rather than ArmPkg?
This is the first time I wrote something for EDK2 so worked to get it
built first rather than to get it right. Looked at HelloWorld example
and followed.
Moved to ArmPkg/Application/ArmCpuInfo/ in current code.
>> diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
>> index 1014598f31c3..1ecfb345159f 100644
>> --- a/MdeModulePkg/MdeModulePkg.dsc
>> +++ b/MdeModulePkg/MdeModulePkg.dsc
>> @@ -216,6 +216,7 @@ [PcdsDynamicExDefault]
>> gEfiMdeModulePkgTokenSpaceGuid.PcdRecoveryFileName|L"FVMAIN.FV"
>>
>> [Components]
>> + MdeModulePkg/Application/ArmCpuInfo/ArmCpuInfo.inf
>> MdeModulePkg/Application/HelloWorld/HelloWorld.inf
>> MdeModulePkg/Application/DumpDynPcd/DumpDynPcd.inf
>> MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.inf
>> @@ -520,4 +521,4 @@ [Components.X64]
>> MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf
>>
>> [BuildOptions]
>> -
>> +GCC:*_*_AARCH64_CC_FLAGS = -march=armv9-a
>
> This belongs in the app's INF, not in the package DSC where it affects
> code generation for all components, which may need to run on much
> older CPUs
Dropped that line as it was not needed in the end.
>> diff --git a/MdeModulePkg/Application/ArmCpuInfo/ArmCpuInfo.c b/MdeModulePkg/Application/ArmCpuInfo/ArmCpuInfo.c
>> new file mode 100644
>> index 000000000000..ac27902e3533
>> +void print_values(const char* field, const char* bits, const int value, const char* description)
>> +{
>> + char binaries[17][5] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111",
>> + "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"};
>> +
>
> STATIC CONST CHAR8[] please, and you can use [] for the first
> dimension (and drop the final element)
done
>> + AsciiPrint(" %-16a | %5a | %5a | %a\n", field, bits, binaries[value], description);
>
> This should be value & 0xf so you never access outside of the array.
done
>> +void handle_aa64mmfr0_el1(const UINT64 aa64mmfr0_el1)
>> +{
>> + UINT64 value;
>> + char* regname = "ID_AA64MMFR0_EL1";
>
> STATIC CONST CHAR8 RegName[] = ...
done
>> + char* description;
>> + char* bits;
>
> CONST
It is not const.
>> +
>> +
>> + bits = "3:0 ";
>> + value = aa64mmfr0_el1 & 0xf;
>> + switch(value)
>
> Space after switch
done
>> + if(value == 0b0110)
>
> Space after if
done
> etc etc
>
> There are some other style issues here, which I am sure the CI will
> whine about, so you might want to run uncrustify on it.
done
next prev parent reply other threads:[~2023-04-07 12:46 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-31 18:02 [PATCH] add ArmCpuInfo EFI application Marcin Juszkiewicz
2023-04-06 21:05 ` [edk2-devel] " Rebecca Cran
2023-04-07 10:39 ` [PATCH v2] " Marcin Juszkiewicz
2023-04-07 10:55 ` [edk2-devel] " Ard Biesheuvel
2023-04-07 12:46 ` Marcin Juszkiewicz [this message]
2023-04-07 13:07 ` Ard Biesheuvel
2023-04-07 12:47 ` [PATCH v3] " Marcin Juszkiewicz
2023-04-07 13:02 ` [edk2-devel] " Pedro Falcato
2023-04-07 13:05 ` Pedro Falcato
2023-04-07 13:29 ` Marcin Juszkiewicz
2023-04-07 13:40 ` Pedro Falcato
2023-04-07 13:41 ` Pedro Falcato
2023-04-07 13:42 ` Marcin Juszkiewicz
2023-04-07 14:02 ` [PATCH v4] " Marcin Juszkiewicz
[not found] ` <1753ABF1A296B040.11304@groups.io>
2023-04-07 15:11 ` [edk2-devel] " Marcin Juszkiewicz
2023-04-07 15:29 ` [PATCH v5 0/2] add ArmCpuInfo application Marcin Juszkiewicz
2023-04-07 15:29 ` [PATCH v5 1/2] ArmLib: add functions to read system registers Marcin Juszkiewicz
2023-04-20 10:54 ` Leif Lindholm
2023-04-07 15:29 ` [PATCH v5 2/2] add ArmCpuInfo EFI application Marcin Juszkiewicz
2023-04-20 12:43 ` Leif Lindholm
2023-04-20 14:42 ` [edk2-devel] " Marcin Juszkiewicz
2023-04-20 14:44 ` [PATCH v6 1/2] ArmLib: add functions to read system registers Marcin Juszkiewicz
2023-04-20 14:44 ` [PATCH v6 2/2] add ArmCpuInfo EFI application Marcin Juszkiewicz
2023-04-20 17:29 ` Leif Lindholm
2023-04-21 14:37 ` [edk2-devel] " Rebecca Cran
2023-04-21 14:59 ` Marcin Juszkiewicz
2023-04-21 15:15 ` Rebecca Cran
2023-04-21 15:51 ` [PATCH v7 1/2] ArmLib: add functions to read system registers Marcin Juszkiewicz
2023-04-21 15:51 ` [PATCH v7 2/2] add ArmCpuInfo EFI application Marcin Juszkiewicz
2023-04-21 20:18 ` Leif Lindholm
2023-04-21 16:33 ` [edk2-devel] [PATCH v6 " Leif Lindholm
2023-04-13 9:31 ` [PATCH v5 0/2] add ArmCpuInfo application Marcin Juszkiewicz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fcdf1011-fede-392b-3ceb-45775ab1aa24@linaro.org \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox