* [edk2-devel] [PATCH v2 1/1] ShellPkg: Acpiview/GTDT: Print timer flags information.
@ 2023-07-17 7:44 levi.yun
2023-07-27 2:54 ` Gao, Zhichao
0 siblings, 1 reply; 2+ messages in thread
From: levi.yun @ 2023-07-17 7:44 UTC (permalink / raw)
To: devel
Cc: yeoreum.yun, zhichao.gao, pedro.falcato, sami.mujawar,
pierre.gondois, nd
Currently, GTDT only prints the value of timer flags in hex.
This change prints the detail information about Timer flags in GTDT.
before:
Shell> acpiview -s GTDT
...
Non-Secure EL1 timer FLAGS : 0x2
Virtual timer GSIV : 0x1B
Virtual timer FLAGS : 0x2
...
after:
Shell> acpiview -s GTDT
...
Non-Secure EL1 timer FLAGS : 0x2
Timer Interrupt Mode : Level Trigger(0)
Timer Interrupt Polarity : Active Low(1)
Always-on Capability : 0
Reserved : 0
Virtual timer GSIV : 0x1B
Virtual timer FLAGS : 0x2
Signed-off-by: levi.yun <yeoreum.yun@arm.com>
Tested-by: Pierre Gondois <pierre.gondois@arm.com>
---
The changes can be seen at https://github.com/LeviYeoReum/edk2/tree/2711_gtdt_flags_v2
Notes:
v2:
- Fix typos.
- Remove unnecessary type casting.
ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c | 111 +++++++++++++++++---
1 file changed, 98 insertions(+), 13 deletions(-)
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
index e62927098a010a0e1dad8361dcfc6559d32dcebf..c95b96a673bf7e6afea7902f5730dcb61a3ce508 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
@@ -84,33 +84,118 @@ ValidateGtFrameNumber (
}
}
+/**
+ This function prints trigger mode information in timer flags.
+
+ @param [in] Format Print format.
+ @param [in] Ptr Pointer to the start of the field data.
+**/
+STATIC
+VOID
+EFIAPI
+PrintTimerInterruptMode (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr
+ )
+{
+ UINT8 TriggerMode;
+
+ TriggerMode = *Ptr;
+
+ Print (
+ L"%s(%d)",
+ (TriggerMode ? L"Edge Trigger" : L"Level Trigger"),
+ TriggerMode
+ );
+}
+
+/**
+ This function prints polarity information in timer flags.
+
+ @param [in] Format Print format.
+ @param [in] Ptr Pointer to the start of the field data.
+**/
+STATIC
+VOID
+EFIAPI
+PrintTimerInterruptPolarity (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr
+ )
+{
+ UINT8 Polarity;
+
+ Polarity = *Ptr;
+
+ Print (
+ L"%s(%d)",
+ (Polarity ? L"Active Low" : L"Active High"),
+ Polarity
+ );
+}
+
+/**
+ An ACPI_PARSER array describing the Timer Flags Field in GTDT Table.
+**/
+STATIC CONST ACPI_PARSER TimerFlagsParser[] = {
+ { L"Timer Interrupt Mode", 1, 0, NULL, PrintTimerInterruptMode, NULL, NULL, NULL },
+ { L"Timer Interrupt Polarity", 1, 1, NULL, PrintTimerInterruptPolarity, NULL, NULL, NULL },
+ { L"Always-on Capability", 1, 2, L"%d", NULL, NULL, NULL, NULL },
+ { L"Reserved", 29, 3, L"%d", NULL, NULL, NULL, NULL },
+};
+
+/**
+ This function parses the Timer Flags.
+
+ @param [in] Format Print format.
+ @param [in] Ptr Pointer to the start of the Timer flags.
+ **/
+STATIC
+VOID
+EFIAPI
+DumpTimerFlags (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr
+ )
+{
+ DumpUint32 (L"0x%x\n", Ptr);
+ ParseAcpiBitFields (
+ TRUE,
+ 2,
+ NULL,
+ Ptr,
+ 4,
+ PARSER_PARAMS (TimerFlagsParser)
+ );
+}
+
/**
An ACPI_PARSER array describing the ACPI GTDT Table.
**/
STATIC CONST ACPI_PARSER GtdtParser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo),
- { L"CntControlBase Physical Address",8, 36, L"0x%lx", NULL, NULL,
+ { L"CntControlBase Physical Address",8, 36, L"0x%lx", NULL, NULL,
NULL, NULL },
- { L"Reserved", 4, 44, L"0x%x", NULL, NULL,NULL, NULL },
- { L"Secure EL1 timer GSIV", 4, 48, L"0x%x", NULL, NULL,NULL, NULL },
- { L"Secure EL1 timer FLAGS", 4, 52, L"0x%x", NULL, NULL,NULL, NULL },
+ { L"Reserved", 4, 44, L"0x%x", NULL, NULL,NULL, NULL },
+ { L"Secure EL1 timer GSIV", 4, 48, L"0x%x", NULL, NULL,NULL, NULL },
+ { L"Secure EL1 timer FLAGS", 4, 52, NULL, DumpTimerFlags, NULL,NULL, NULL },
- { L"Non-Secure EL1 timer GSIV", 4, 56, L"0x%x", NULL, NULL,NULL, NULL },
- { L"Non-Secure EL1 timer FLAGS", 4, 60, L"0x%x", NULL, NULL,NULL, NULL },
+ { L"Non-Secure EL1 timer GSIV", 4, 56, L"0x%x", NULL, NULL,NULL, NULL },
+ { L"Non-Secure EL1 timer FLAGS", 4, 60, NULL, DumpTimerFlags, NULL,NULL, NULL },
- { L"Virtual timer GSIV", 4, 64, L"0x%x", NULL, NULL,NULL, NULL },
- { L"Virtual timer FLAGS", 4, 68, L"0x%x", NULL, NULL,NULL, NULL },
+ { L"Virtual timer GSIV", 4, 64, L"0x%x", NULL, NULL,NULL, NULL },
+ { L"Virtual timer FLAGS", 4, 68, L"0x%x", DumpTimerFlags, NULL,NULL, NULL },
- { L"Non-Secure EL2 timer GSIV", 4, 72, L"0x%x", NULL, NULL,NULL, NULL },
- { L"Non-Secure EL2 timer FLAGS", 4, 76, L"0x%x", NULL, NULL,NULL, NULL },
+ { L"Non-Secure EL2 timer GSIV", 4, 72, L"0x%x", NULL, NULL,NULL, NULL },
+ { L"Non-Secure EL2 timer FLAGS", 4, 76, L"0x%x", DumpTimerFlags, NULL,NULL, NULL },
- { L"CntReadBase Physical address", 8, 80, L"0x%lx", NULL, NULL,NULL, NULL },
+ { L"CntReadBase Physical address", 8, 80, L"0x%lx", NULL, NULL,NULL, NULL },
{ L"Platform Timer Count", 4, 88, L"%d", NULL,
(VOID **)&GtdtPlatformTimerCount, NULL, NULL },
{ L"Platform Timer Offset", 4, 92, L"0x%x", NULL,
(VOID **)&GtdtPlatformTimerOffset,NULL, NULL },
- { L"Virtual EL2 Timer GSIV", 4, 96, L"0x%x", NULL, NULL,NULL, NULL },
- { L"Virtual EL2 Timer Flags", 4, 100, L"0x%x", NULL, NULL,NULL, NULL }
+ { L"Virtual EL2 Timer GSIV", 4, 96, L"0x%x", NULL, NULL,NULL, NULL },
+ { L"Virtual EL2 Timer Flags", 4, 100, L"0x%x", NULL, NULL,NULL, NULL }
};
/**
--
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106957): https://edk2.groups.io/g/devel/message/106957
Mute This Topic: https://groups.io/mt/100190622/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [edk2-devel] [PATCH v2 1/1] ShellPkg: Acpiview/GTDT: Print timer flags information.
2023-07-17 7:44 [edk2-devel] [PATCH v2 1/1] ShellPkg: Acpiview/GTDT: Print timer flags information levi.yun
@ 2023-07-27 2:54 ` Gao, Zhichao
0 siblings, 0 replies; 2+ messages in thread
From: Gao, Zhichao @ 2023-07-27 2:54 UTC (permalink / raw)
To: devel@edk2.groups.io, yeoreum.yun@arm.com
Cc: pedro.falcato@gmail.com, sami.mujawar@arm.com,
pierre.gondois@arm.com, nd@arm.com
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Thanks,
Zhichao
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of levi.yun
> Sent: Monday, July 17, 2023 3:44 PM
> To: devel@edk2.groups.io
> Cc: yeoreum.yun@arm.com; Gao, Zhichao <zhichao.gao@intel.com>;
> pedro.falcato@gmail.com; sami.mujawar@arm.com;
> pierre.gondois@arm.com; nd@arm.com
> Subject: [edk2-devel] [PATCH v2 1/1] ShellPkg: Acpiview/GTDT: Print timer
> flags information.
>
> Currently, GTDT only prints the value of timer flags in hex.
> This change prints the detail information about Timer flags in GTDT.
>
> before:
> Shell> acpiview -s GTDT
> ...
> Non-Secure EL1 timer FLAGS : 0x2
> Virtual timer GSIV : 0x1B
> Virtual timer FLAGS : 0x2
> ...
>
> after:
> Shell> acpiview -s GTDT
> ...
> Non-Secure EL1 timer FLAGS : 0x2
> Timer Interrupt Mode : Level Trigger(0)
> Timer Interrupt Polarity : Active Low(1)
> Always-on Capability : 0
> Reserved : 0
>
> Virtual timer GSIV : 0x1B
> Virtual timer FLAGS : 0x2
>
> Signed-off-by: levi.yun <yeoreum.yun@arm.com>
> Tested-by: Pierre Gondois <pierre.gondois@arm.com>
> ---
> The changes can be seen at
> https://github.com/LeviYeoReum/edk2/tree/2711_gtdt_flags_v2
>
> Notes:
> v2:
> - Fix typos.
> - Remove unnecessary type casting.
>
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
> | 111 +++++++++++++++++---
> 1 file changed, 98 insertions(+), 13 deletions(-)
>
> diff --git
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> index
> e62927098a010a0e1dad8361dcfc6559d32dcebf..c95b96a673bf7e6afea7902f57
> 30dcb61a3ce508 100644
> ---
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> +++
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser
> .c
> @@ -84,33 +84,118 @@ ValidateGtFrameNumber (
> }
> }
>
> +/**
> + This function prints trigger mode information in timer flags.
> +
> + @param [in] Format Print format.
> + @param [in] Ptr Pointer to the start of the field data.
> +**/
> +STATIC
> +VOID
> +EFIAPI
> +PrintTimerInterruptMode (
> + IN CONST CHAR16 *Format OPTIONAL,
> + IN UINT8 *Ptr
> + )
> +{
> + UINT8 TriggerMode;
> +
> + TriggerMode = *Ptr;
> +
> + Print (
> + L"%s(%d)",
> + (TriggerMode ? L"Edge Trigger" : L"Level Trigger"),
> + TriggerMode
> + );
> +}
> +
> +/**
> + This function prints polarity information in timer flags.
> +
> + @param [in] Format Print format.
> + @param [in] Ptr Pointer to the start of the field data.
> +**/
> +STATIC
> +VOID
> +EFIAPI
> +PrintTimerInterruptPolarity (
> + IN CONST CHAR16 *Format OPTIONAL,
> + IN UINT8 *Ptr
> + )
> +{
> + UINT8 Polarity;
> +
> + Polarity = *Ptr;
> +
> + Print (
> + L"%s(%d)",
> + (Polarity ? L"Active Low" : L"Active High"),
> + Polarity
> + );
> +}
> +
> +/**
> + An ACPI_PARSER array describing the Timer Flags Field in GTDT Table.
> +**/
> +STATIC CONST ACPI_PARSER TimerFlagsParser[] = {
> + { L"Timer Interrupt Mode", 1, 0, NULL, PrintTimerInterruptMode,
> NULL, NULL, NULL },
> + { L"Timer Interrupt Polarity", 1, 1, NULL, PrintTimerInterruptPolarity, NULL,
> NULL, NULL },
> + { L"Always-on Capability", 1, 2, L"%d", NULL, NULL, NULL,
> NULL },
> + { L"Reserved", 29, 3, L"%d", NULL, NULL, NULL, NULL },
> +};
> +
> +/**
> + This function parses the Timer Flags.
> +
> + @param [in] Format Print format.
> + @param [in] Ptr Pointer to the start of the Timer flags.
> + **/
> +STATIC
> +VOID
> +EFIAPI
> +DumpTimerFlags (
> + IN CONST CHAR16 *Format OPTIONAL,
> + IN UINT8 *Ptr
> + )
> +{
> + DumpUint32 (L"0x%x\n", Ptr);
> + ParseAcpiBitFields (
> + TRUE,
> + 2,
> + NULL,
> + Ptr,
> + 4,
> + PARSER_PARAMS (TimerFlagsParser)
> + );
> +}
> +
> /**
> An ACPI_PARSER array describing the ACPI GTDT Table.
> **/
> STATIC CONST ACPI_PARSER GtdtParser[] = {
> PARSE_ACPI_HEADER (&AcpiHdrInfo),
> - { L"CntControlBase Physical Address",8, 36, L"0x%lx", NULL, NULL,
> + { L"CntControlBase Physical Address",8, 36, L"0x%lx", NULL, NULL,
> NULL, NULL },
> - { L"Reserved", 4, 44, L"0x%x", NULL, NULL,NULL, NULL },
> - { L"Secure EL1 timer GSIV", 4, 48, L"0x%x", NULL, NULL,NULL,
> NULL },
> - { L"Secure EL1 timer FLAGS", 4, 52, L"0x%x", NULL, NULL,NULL,
> NULL },
> + { L"Reserved", 4, 44, L"0x%x", NULL, NULL,NULL, NULL },
> + { L"Secure EL1 timer GSIV", 4, 48, L"0x%x", NULL, NULL,NULL,
> NULL },
> + { L"Secure EL1 timer FLAGS", 4, 52, NULL, DumpTimerFlags,
> NULL,NULL, NULL },
>
> - { L"Non-Secure EL1 timer GSIV", 4, 56, L"0x%x", NULL, NULL,NULL,
> NULL },
> - { L"Non-Secure EL1 timer FLAGS", 4, 60, L"0x%x", NULL, NULL,NULL,
> NULL },
> + { L"Non-Secure EL1 timer GSIV", 4, 56, L"0x%x", NULL,
> NULL,NULL, NULL },
> + { L"Non-Secure EL1 timer FLAGS", 4, 60, NULL, DumpTimerFlags,
> NULL,NULL, NULL },
>
> - { L"Virtual timer GSIV", 4, 64, L"0x%x", NULL, NULL,NULL, NULL },
> - { L"Virtual timer FLAGS", 4, 68, L"0x%x", NULL, NULL,NULL, NULL },
> + { L"Virtual timer GSIV", 4, 64, L"0x%x", NULL, NULL,NULL,
> NULL },
> + { L"Virtual timer FLAGS", 4, 68, L"0x%x", DumpTimerFlags,
> NULL,NULL, NULL },
>
> - { L"Non-Secure EL2 timer GSIV", 4, 72, L"0x%x", NULL, NULL,NULL,
> NULL },
> - { L"Non-Secure EL2 timer FLAGS", 4, 76, L"0x%x", NULL, NULL,NULL,
> NULL },
> + { L"Non-Secure EL2 timer GSIV", 4, 72, L"0x%x", NULL,
> NULL,NULL, NULL },
> + { L"Non-Secure EL2 timer FLAGS", 4, 76, L"0x%x", DumpTimerFlags,
> NULL,NULL, NULL },
>
> - { L"CntReadBase Physical address", 8, 80, L"0x%lx", NULL, NULL,NULL,
> NULL },
> + { L"CntReadBase Physical address", 8, 80, L"0x%lx", NULL,
> NULL,NULL, NULL },
> { L"Platform Timer Count", 4, 88, L"%d", NULL,
> (VOID **)&GtdtPlatformTimerCount, NULL, NULL },
> { L"Platform Timer Offset", 4, 92, L"0x%x", NULL,
> (VOID **)&GtdtPlatformTimerOffset,NULL, NULL },
> - { L"Virtual EL2 Timer GSIV", 4, 96, L"0x%x", NULL, NULL,NULL, NULL },
> - { L"Virtual EL2 Timer Flags", 4, 100, L"0x%x", NULL, NULL,NULL, NULL }
> + { L"Virtual EL2 Timer GSIV", 4, 96, L"0x%x", NULL, NULL,NULL,
> NULL },
> + { L"Virtual EL2 Timer Flags", 4, 100, L"0x%x", NULL, NULL,NULL,
> NULL }
> };
>
> /**
> --
> Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")
> IMPORTANT NOTICE: The contents of this email and any attachments are
> confidential and may also be privileged. If you are not the intended recipient,
> please notify the sender immediately and do not disclose the contents to any
> other person, use it for any purpose, or store or copy the information in any
> medium. Thank you.
>
>
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107289): https://edk2.groups.io/g/devel/message/107289
Mute This Topic: https://groups.io/mt/100190622/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-27 2:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-17 7:44 [edk2-devel] [PATCH v2 1/1] ShellPkg: Acpiview/GTDT: Print timer flags information levi.yun
2023-07-27 2:54 ` Gao, Zhichao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox