public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1 0/1] ShellPkg: Adds Local APIC parser to AcpiView
@ 2022-08-09  6:49 Abdul Lateef Attar
  2022-08-09  6:49 ` [PATCH v1 1/1] " Abdul Lateef Attar
  0 siblings, 1 reply; 4+ messages in thread
From: Abdul Lateef Attar @ 2022-08-09  6:49 UTC (permalink / raw)
  To: devel; +Cc: Ray Ni, Zhichao Gao

Parse Type 0 or Local APIC structure.
Also parse the Local APIC Flags as bitfields.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>

Abdul Lateef Attar (1):
  ShellPkg: Adds Local APIC parser to AcpiView

 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 74 ++++++++++++++++++--
 1 file changed, 67 insertions(+), 7 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1 1/1] ShellPkg: Adds Local APIC parser to AcpiView
  2022-08-09  6:49 [PATCH v1 0/1] ShellPkg: Adds Local APIC parser to AcpiView Abdul Lateef Attar
@ 2022-08-09  6:49 ` Abdul Lateef Attar
  2022-08-22  9:19   ` Gao, Zhichao
  0 siblings, 1 reply; 4+ messages in thread
From: Abdul Lateef Attar @ 2022-08-09  6:49 UTC (permalink / raw)
  To: devel; +Cc: Ray Ni, Zhichao Gao

Parse Type 0 or Local APIC structure.
Also parse the Local APIC Flags as bitfields.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Abdul Lateef Attar <abdattar@amd.com>
---
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 74 ++++++++++++++++++--
 1 file changed, 67 insertions(+), 7 deletions(-)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
index aaa68c99f514..41edcb9ffd1d 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
@@ -2,6 +2,7 @@
   MADT table parser
 
   Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
+  Copyright (c) 2022, AMD Incorporated. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
   @par Reference(s):
@@ -206,17 +207,65 @@ STATIC CONST ACPI_PARSER  InterruptSourceOverride[] = {
   { L"Flags",                   2, 8, L"0x%x", NULL, NULL, NULL, NULL }
 };
 
+STATIC CONST ACPI_PARSER  LocalApicFlags[] = {
+  { L"Enabled",        1,  0, L"%d", NULL, NULL, NULL, NULL },
+  { L"Online Capable", 1,  1, L"%d", NULL, NULL, NULL, NULL },
+  { L"Reserved",       30, 2, L"%d", NULL, NULL, NULL, NULL }
+};
+
+/**
+  This function traces Bit Flags fields.
+  If no format string is specified the Format must be NULL.
+
+  @param [in] Format  Optional format string for tracing the data.
+  @param [in] Ptr     Pointer to the start of the buffer.
+**/
+VOID
+EFIAPI
+DumpLocalApicBitFlags (
+  IN CONST CHAR16  *Format OPTIONAL,
+  IN UINT8         *Ptr
+  )
+{
+  if (Format != NULL) {
+    Print (Format, *(UINT32 *)Ptr);
+    return;
+  }
+
+  Print (L"0x%X\n", *(UINT32 *)Ptr);
+  ParseAcpiBitFields (
+    TRUE,
+    2,
+    NULL,
+    Ptr,
+    4,
+    PARSER_PARAMS (LocalApicFlags)
+    );
+}
+
+/**
+   An ACPI_PARSER array describing the Processor Local APIC Structure.
+ **/
+STATIC CONST ACPI_PARSER  ProcessorLocalApic[] = {
+  { L"Type",               1, 0, L"0x%x", NULL,                  NULL, NULL, NULL },
+  { L"Length",             1, 1, L"%d",   NULL,                  NULL, NULL, NULL },
+
+  { L"ACPI Processor UID", 1, 2, L"0x%x", NULL,                  NULL, NULL, NULL },
+  { L"APIC ID",            1, 3, L"0x%x", NULL,                  NULL, NULL, NULL },
+  { L"Flags",              4, 4, NULL,    DumpLocalApicBitFlags, NULL, NULL, NULL }
+};
+
 /**
   An ACPI_PARSER array describing the Processor Local x2APIC Structure.
 **/
 STATIC CONST ACPI_PARSER  ProcessorLocalX2Apic[] = {
-  { L"Type",               1, 0,  L"0x%x", NULL, NULL, NULL, NULL },
-  { L"Length",             1, 1,  L"%d",   NULL, NULL, NULL, NULL },
-  { L"Reserved",           2, 2,  L"0x%x", NULL, NULL, NULL, NULL },
+  { L"Type",               1, 0,  L"0x%x", NULL,                  NULL, NULL, NULL },
+  { L"Length",             1, 1,  L"%d",   NULL,                  NULL, NULL, NULL },
+  { L"Reserved",           2, 2,  L"0x%x", NULL,                  NULL, NULL, NULL },
 
-  { L"X2APIC ID",          4, 4,  L"0x%x", NULL, NULL, NULL, NULL },
-  { L"Flags",              4, 8,  L"0x%x", NULL, NULL, NULL, NULL },
-  { L"ACPI Processor UID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }
+  { L"X2APIC ID",          4, 4,  L"0x%x", NULL,                  NULL, NULL, NULL },
+  { L"Flags",              4, 8,  NULL,    DumpLocalApicBitFlags, NULL, NULL, NULL },
+  { L"ACPI Processor UID", 4, 12, L"0x%x", NULL,                  NULL, NULL, NULL }
 };
 
 /**
@@ -441,7 +490,18 @@ ParseAcpiMadt (
           );
         break;
       }
-
+      case EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC:
+      {
+        ParseAcpi (
+          TRUE,
+          2,
+          "PROCESSOR LOCAL APIC",
+          InterruptContollerPtr,
+          *MadtInterruptControllerLength,
+          PARSER_PARAMS (ProcessorLocalApic)
+          );
+        break;
+      }
       case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC:
       {
         ParseAcpi (
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] ShellPkg: Adds Local APIC parser to AcpiView
  2022-08-09  6:49 ` [PATCH v1 1/1] " Abdul Lateef Attar
@ 2022-08-22  9:19   ` Gao, Zhichao
  2022-08-31  2:32     ` 回复: [edk2-devel] " gaoliming
  0 siblings, 1 reply; 4+ messages in thread
From: Gao, Zhichao @ 2022-08-22  9:19 UTC (permalink / raw)
  To: Abdul Lateef Attar, devel@edk2.groups.io; +Cc: Ni, Ray

It is better to file a BZ for this change. Anyway,
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>

Thanks,
Zhichao

> -----Original Message-----
> From: Abdul Lateef Attar <abdattar@amd.com>
> Sent: Tuesday, August 9, 2022 2:49 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> Subject: [PATCH v1 1/1] ShellPkg: Adds Local APIC parser to AcpiView
> 
> Parse Type 0 or Local APIC structure.
> Also parse the Local APIC Flags as bitfields.
> 
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Zhichao Gao <zhichao.gao@intel.com>
> Signed-off-by: Abdul Lateef Attar <abdattar@amd.com>
> ---
> 
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.
> c | 74 ++++++++++++++++++--
>  1 file changed, 67 insertions(+), 7 deletions(-)
> 
> diff --git
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> er.c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> er.c
> index aaa68c99f514..41edcb9ffd1d 100644
> ---
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> er.c
> +++
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> er.c
> @@ -2,6 +2,7 @@
>    MADT table parser
> 
> 
> 
>    Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
> 
> +  Copyright (c) 2022, AMD Incorporated. All rights reserved.
> 
>    SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
> 
>    @par Reference(s):
> 
> @@ -206,17 +207,65 @@ STATIC CONST ACPI_PARSER
> InterruptSourceOverride[] = {
>    { L"Flags",                   2, 8, L"0x%x", NULL, NULL, NULL, NULL }
> 
>  };
> 
> 
> 
> +STATIC CONST ACPI_PARSER  LocalApicFlags[] = {
> 
> +  { L"Enabled",        1,  0, L"%d", NULL, NULL, NULL, NULL },
> 
> +  { L"Online Capable", 1,  1, L"%d", NULL, NULL, NULL, NULL },
> 
> +  { L"Reserved",       30, 2, L"%d", NULL, NULL, NULL, NULL }
> 
> +};
> 
> +
> 
> +/**
> 
> +  This function traces Bit Flags fields.
> 
> +  If no format string is specified the Format must be NULL.
> 
> +
> 
> +  @param [in] Format  Optional format string for tracing the data.
> 
> +  @param [in] Ptr     Pointer to the start of the buffer.
> 
> +**/
> 
> +VOID
> 
> +EFIAPI
> 
> +DumpLocalApicBitFlags (
> 
> +  IN CONST CHAR16  *Format OPTIONAL,
> 
> +  IN UINT8         *Ptr
> 
> +  )
> 
> +{
> 
> +  if (Format != NULL) {
> 
> +    Print (Format, *(UINT32 *)Ptr);
> 
> +    return;
> 
> +  }
> 
> +
> 
> +  Print (L"0x%X\n", *(UINT32 *)Ptr);
> 
> +  ParseAcpiBitFields (
> 
> +    TRUE,
> 
> +    2,
> 
> +    NULL,
> 
> +    Ptr,
> 
> +    4,
> 
> +    PARSER_PARAMS (LocalApicFlags)
> 
> +    );
> 
> +}
> 
> +
> 
> +/**
> 
> +   An ACPI_PARSER array describing the Processor Local APIC Structure.
> 
> + **/
> 
> +STATIC CONST ACPI_PARSER  ProcessorLocalApic[] = {
> 
> +  { L"Type",               1, 0, L"0x%x", NULL,                  NULL, NULL, NULL },
> 
> +  { L"Length",             1, 1, L"%d",   NULL,                  NULL, NULL, NULL },
> 
> +
> 
> +  { L"ACPI Processor UID", 1, 2, L"0x%x", NULL,                  NULL, NULL, NULL },
> 
> +  { L"APIC ID",            1, 3, L"0x%x", NULL,                  NULL, NULL, NULL },
> 
> +  { L"Flags",              4, 4, NULL,    DumpLocalApicBitFlags, NULL, NULL, NULL }
> 
> +};
> 
> +
> 
>  /**
> 
>    An ACPI_PARSER array describing the Processor Local x2APIC Structure.
> 
>  **/
> 
>  STATIC CONST ACPI_PARSER  ProcessorLocalX2Apic[] = {
> 
> -  { L"Type",               1, 0,  L"0x%x", NULL, NULL, NULL, NULL },
> 
> -  { L"Length",             1, 1,  L"%d",   NULL, NULL, NULL, NULL },
> 
> -  { L"Reserved",           2, 2,  L"0x%x", NULL, NULL, NULL, NULL },
> 
> +  { L"Type",               1, 0,  L"0x%x", NULL,                  NULL, NULL, NULL },
> 
> +  { L"Length",             1, 1,  L"%d",   NULL,                  NULL, NULL, NULL },
> 
> +  { L"Reserved",           2, 2,  L"0x%x", NULL,                  NULL, NULL, NULL },
> 
> 
> 
> -  { L"X2APIC ID",          4, 4,  L"0x%x", NULL, NULL, NULL, NULL },
> 
> -  { L"Flags",              4, 8,  L"0x%x", NULL, NULL, NULL, NULL },
> 
> -  { L"ACPI Processor UID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }
> 
> +  { L"X2APIC ID",          4, 4,  L"0x%x", NULL,                  NULL, NULL, NULL },
> 
> +  { L"Flags",              4, 8,  NULL,    DumpLocalApicBitFlags, NULL, NULL, NULL },
> 
> +  { L"ACPI Processor UID", 4, 12, L"0x%x", NULL,                  NULL, NULL, NULL }
> 
>  };
> 
> 
> 
>  /**
> 
> @@ -441,7 +490,18 @@ ParseAcpiMadt (
>            );
> 
>          break;
> 
>        }
> 
> -
> 
> +      case EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC:
> 
> +      {
> 
> +        ParseAcpi (
> 
> +          TRUE,
> 
> +          2,
> 
> +          "PROCESSOR LOCAL APIC",
> 
> +          InterruptContollerPtr,
> 
> +          *MadtInterruptControllerLength,
> 
> +          PARSER_PARAMS (ProcessorLocalApic)
> 
> +          );
> 
> +        break;
> 
> +      }
> 
>        case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC:
> 
>        {
> 
>          ParseAcpi (
> 
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* 回复: [edk2-devel] [PATCH v1 1/1] ShellPkg: Adds Local APIC parser to AcpiView
  2022-08-22  9:19   ` Gao, Zhichao
@ 2022-08-31  2:32     ` gaoliming
  0 siblings, 0 replies; 4+ messages in thread
From: gaoliming @ 2022-08-31  2:32 UTC (permalink / raw)
  To: devel, zhichao.gao, 'Abdul Lateef Attar'; +Cc: 'Ni, Ray'

Abdul:
  This patch is merged again into edk2 at
3c06953fd76ca2d1372ce5b0df14608de53cd148. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Gao, Zhichao
> 发送时间: 2022年8月22日 17:19
> 收件人: Abdul Lateef Attar <abdattar@amd.com>; devel@edk2.groups.io
> 抄送: Ni, Ray <ray.ni@intel.com>
> 主题: Re: [edk2-devel] [PATCH v1 1/1] ShellPkg: Adds Local APIC parser to
> AcpiView
> 
> It is better to file a BZ for this change. Anyway,
> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
> 
> Thanks,
> Zhichao
> 
> > -----Original Message-----
> > From: Abdul Lateef Attar <abdattar@amd.com>
> > Sent: Tuesday, August 9, 2022 2:49 PM
> > To: devel@edk2.groups.io
> > Cc: Ni, Ray <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> > Subject: [PATCH v1 1/1] ShellPkg: Adds Local APIC parser to AcpiView
> >
> > Parse Type 0 or Local APIC structure.
> > Also parse the Local APIC Flags as bitfields.
> >
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Zhichao Gao <zhichao.gao@intel.com>
> > Signed-off-by: Abdul Lateef Attar <abdattar@amd.com>
> > ---
> >
> >
> ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.
> > c | 74 ++++++++++++++++++--
> >  1 file changed, 67 insertions(+), 7 deletions(-)
> >
> > diff --git
> >
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> > er.c
> >
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> > er.c
> > index aaa68c99f514..41edcb9ffd1d 100644
> > ---
> >
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> > er.c
> > +++
> >
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
> > er.c
> > @@ -2,6 +2,7 @@
> >    MADT table parser
> >
> >
> >
> >    Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
> >
> > +  Copyright (c) 2022, AMD Incorporated. All rights reserved.
> >
> >    SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >
> >
> >    @par Reference(s):
> >
> > @@ -206,17 +207,65 @@ STATIC CONST ACPI_PARSER
> > InterruptSourceOverride[] = {
> >    { L"Flags",                   2, 8, L"0x%x", NULL, NULL, NULL,
> NULL }
> >
> >  };
> >
> >
> >
> > +STATIC CONST ACPI_PARSER  LocalApicFlags[] = {
> >
> > +  { L"Enabled",        1,  0, L"%d", NULL, NULL, NULL, NULL },
> >
> > +  { L"Online Capable", 1,  1, L"%d", NULL, NULL, NULL, NULL },
> >
> > +  { L"Reserved",       30, 2, L"%d", NULL, NULL, NULL, NULL }
> >
> > +};
> >
> > +
> >
> > +/**
> >
> > +  This function traces Bit Flags fields.
> >
> > +  If no format string is specified the Format must be NULL.
> >
> > +
> >
> > +  @param [in] Format  Optional format string for tracing the data.
> >
> > +  @param [in] Ptr     Pointer to the start of the buffer.
> >
> > +**/
> >
> > +VOID
> >
> > +EFIAPI
> >
> > +DumpLocalApicBitFlags (
> >
> > +  IN CONST CHAR16  *Format OPTIONAL,
> >
> > +  IN UINT8         *Ptr
> >
> > +  )
> >
> > +{
> >
> > +  if (Format != NULL) {
> >
> > +    Print (Format, *(UINT32 *)Ptr);
> >
> > +    return;
> >
> > +  }
> >
> > +
> >
> > +  Print (L"0x%X\n", *(UINT32 *)Ptr);
> >
> > +  ParseAcpiBitFields (
> >
> > +    TRUE,
> >
> > +    2,
> >
> > +    NULL,
> >
> > +    Ptr,
> >
> > +    4,
> >
> > +    PARSER_PARAMS (LocalApicFlags)
> >
> > +    );
> >
> > +}
> >
> > +
> >
> > +/**
> >
> > +   An ACPI_PARSER array describing the Processor Local APIC Structure.
> >
> > + **/
> >
> > +STATIC CONST ACPI_PARSER  ProcessorLocalApic[] = {
> >
> > +  { L"Type",               1, 0, L"0x%x", NULL,
> NULL, NULL, NULL },
> >
> > +  { L"Length",             1, 1, L"%d",   NULL,
> NULL, NULL, NULL },
> >
> > +
> >
> > +  { L"ACPI Processor UID", 1, 2, L"0x%x", NULL,
> NULL, NULL, NULL },
> >
> > +  { L"APIC ID",            1, 3, L"0x%x", NULL,
> NULL, NULL, NULL },
> >
> > +  { L"Flags",              4, 4, NULL,    DumpLocalApicBitFlags,
> NULL, NULL, NULL }
> >
> > +};
> >
> > +
> >
> >  /**
> >
> >    An ACPI_PARSER array describing the Processor Local x2APIC Structure.
> >
> >  **/
> >
> >  STATIC CONST ACPI_PARSER  ProcessorLocalX2Apic[] = {
> >
> > -  { L"Type",               1, 0,  L"0x%x", NULL, NULL, NULL, NULL },
> >
> > -  { L"Length",             1, 1,  L"%d",   NULL, NULL, NULL, NULL },
> >
> > -  { L"Reserved",           2, 2,  L"0x%x", NULL, NULL, NULL, NULL },
> >
> > +  { L"Type",               1, 0,  L"0x%x", NULL,
> NULL, NULL, NULL },
> >
> > +  { L"Length",             1, 1,  L"%d",   NULL,
> NULL, NULL, NULL },
> >
> > +  { L"Reserved",           2, 2,  L"0x%x", NULL,
> NULL, NULL, NULL },
> >
> >
> >
> > -  { L"X2APIC ID",          4, 4,  L"0x%x", NULL, NULL, NULL, NULL },
> >
> > -  { L"Flags",              4, 8,  L"0x%x", NULL, NULL, NULL, NULL },
> >
> > -  { L"ACPI Processor UID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }
> >
> > +  { L"X2APIC ID",          4, 4,  L"0x%x", NULL,
> NULL, NULL, NULL },
> >
> > +  { L"Flags",              4, 8,  NULL,    DumpLocalApicBitFlags,
> NULL, NULL, NULL },
> >
> > +  { L"ACPI Processor UID", 4, 12, L"0x%x", NULL,
> NULL, NULL, NULL }
> >
> >  };
> >
> >
> >
> >  /**
> >
> > @@ -441,7 +490,18 @@ ParseAcpiMadt (
> >            );
> >
> >          break;
> >
> >        }
> >
> > -
> >
> > +      case EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC:
> >
> > +      {
> >
> > +        ParseAcpi (
> >
> > +          TRUE,
> >
> > +          2,
> >
> > +          "PROCESSOR LOCAL APIC",
> >
> > +          InterruptContollerPtr,
> >
> > +          *MadtInterruptControllerLength,
> >
> > +          PARSER_PARAMS (ProcessorLocalApic)
> >
> > +          );
> >
> > +        break;
> >
> > +      }
> >
> >        case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC:
> >
> >        {
> >
> >          ParseAcpi (
> >
> > --
> > 2.25.1
> 
> 
> 
> 
> 




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-31  2:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-09  6:49 [PATCH v1 0/1] ShellPkg: Adds Local APIC parser to AcpiView Abdul Lateef Attar
2022-08-09  6:49 ` [PATCH v1 1/1] " Abdul Lateef Attar
2022-08-22  9:19   ` Gao, Zhichao
2022-08-31  2:32     ` 回复: [edk2-devel] " gaoliming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox