diff options
Diffstat (limited to 'ShellPkg/Library')
29 files changed, 3720 insertions, 181 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index eac9286176..728d8b523a 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -1,7 +1,7 @@ /** @file
ACPI parser
- Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.
+ Copyright (c) 2016 - 2024, Arm Limited. All rights reserved.
Copyright (c) 2022, AMD Incorporated. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -319,12 +319,14 @@ DumpUint64 ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
VOID
EFIAPI
Dump3Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
Print (
@@ -343,12 +345,14 @@ Dump3Chars ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
VOID
EFIAPI
Dump4Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
Print (
@@ -368,12 +372,14 @@ Dump4Chars ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
VOID
EFIAPI
Dump6Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
Print (
@@ -395,12 +401,14 @@ Dump6Chars ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
VOID
EFIAPI
Dump8Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
Print (
@@ -424,12 +432,14 @@ Dump8Chars ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
VOID
EFIAPI
Dump12Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
Print (
@@ -450,6 +460,171 @@ Dump12Chars ( }
/**
+ This function traces 16 characters which can be optionally
+ formated using the format string if specified.
+
+ 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.
+ @param [in] Length Length of the field.
+**/
+VOID
+EFIAPI
+Dump16Chars (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
+ )
+{
+ Print (
+ (Format != NULL) ? Format : L"%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
+ Ptr[0],
+ Ptr[1],
+ Ptr[2],
+ Ptr[3],
+ Ptr[4],
+ Ptr[5],
+ Ptr[6],
+ Ptr[7],
+ Ptr[8],
+ Ptr[9],
+ Ptr[10],
+ Ptr[11],
+ Ptr[12],
+ Ptr[13],
+ Ptr[14],
+ Ptr[15]
+ );
+}
+
+/**
+ This function traces reserved fields up to 8 bytes in length.
+
+ Format string is ignored by this function as the reserved field is printed
+ byte by byte with intermittent spacing <eg: 0 0 0 0>. Use DumpxChars for any
+ other use case.
+ @param [in] Format Optional format string for tracing the data.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
+**/
+VOID
+EFIAPI
+DumpReserved (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
+ )
+{
+ switch (Length) {
+ case 8:
+ Print (
+ L"%u %u %u %u %u %u %u %u",
+ Ptr[0],
+ Ptr[1],
+ Ptr[2],
+ Ptr[3],
+ Ptr[4],
+ Ptr[5],
+ Ptr[6],
+ Ptr[7]
+ );
+ break;
+ case 7:
+ Print (
+ L"%u %u %u %u %u %u %u",
+ Ptr[0],
+ Ptr[1],
+ Ptr[2],
+ Ptr[3],
+ Ptr[4],
+ Ptr[5],
+ Ptr[6]
+ );
+ break;
+ case 6:
+ Print (
+ L"%u %u %u %u %u %u",
+ Ptr[0],
+ Ptr[1],
+ Ptr[2],
+ Ptr[3],
+ Ptr[4],
+ Ptr[5]
+ );
+ break;
+ case 5:
+ Print (
+ L"%u %u %u %u %u",
+ Ptr[0],
+ Ptr[1],
+ Ptr[2],
+ Ptr[3],
+ Ptr[4]
+ );
+ break;
+ case 4:
+ Print (
+ L"%u %u %u %u",
+ Ptr[0],
+ Ptr[1],
+ Ptr[2],
+ Ptr[3]
+ );
+ break;
+ case 3:
+ Print (
+ L"%u %u %u",
+ Ptr[0],
+ Ptr[1],
+ Ptr[2]
+ );
+ break;
+ case 2:
+ Print (
+ L"%u %u",
+ Ptr[0],
+ Ptr[1]
+ );
+ break;
+ case 1:
+ Print (
+ L"%u",
+ Ptr[0]
+ );
+ break;
+ default:
+ return;
+ }
+}
+
+/**
+ This function traces reserved fields up to 64 bits in length.
+
+ Format string is ignored by this function as the reserved field is printed
+ byte by byte with intermittent spacing. eg: <0 0 0 0>. When the field length
+ isn't a multiple of 8, the number of bytes are "ceil"-ed by one. eg for 27
+ bits <0 0 0 0>
+
+ @param [in] Format Optional format string for tracing the data.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field as number of bits.
+**/
+VOID
+EFIAPI
+DumpReservedBits (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
+ )
+{
+ UINT32 ByteLength;
+
+ ByteLength = (Length + 7) >> 3;
+ DumpReserved (Format, Ptr, ByteLength);
+}
+
+/**
This function indents and prints the ACPI table Field Name.
@param [in] Indent Number of spaces to add to the global table indent.
@@ -587,7 +762,7 @@ ParseAcpi ( // the Format for printing
PrintFieldName (2, Parser[Index].NameStr);
if (Parser[Index].PrintFormatter != NULL) {
- Parser[Index].PrintFormatter (Parser[Index].Format, Ptr);
+ Parser[Index].PrintFormatter (Parser[Index].Format, Ptr, Parser[Index].Length);
} else if (Parser[Index].Format != NULL) {
switch (Parser[Index].Length) {
case 1:
@@ -616,7 +791,11 @@ ParseAcpi ( if (GetConsistencyChecking () &&
(Parser[Index].FieldValidator != NULL))
{
- Parser[Index].FieldValidator (Ptr, Parser[Index].Context);
+ Parser[Index].FieldValidator (
+ Ptr,
+ Parser[Index].Length,
+ Parser[Index].Context
+ );
}
Print (L"\n");
@@ -681,12 +860,14 @@ DumpGasStruct ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
VOID
EFIAPI
DumpGas (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
DumpGasStruct (Ptr, 2, sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE));
@@ -892,7 +1073,7 @@ ParseAcpiBitFields ( // the Format for printing
PrintFieldName (2, Parser[Index].NameStr);
if (Parser[Index].PrintFormatter != NULL) {
- Parser[Index].PrintFormatter (Parser[Index].Format, (UINT8 *)&Data);
+ Parser[Index].PrintFormatter (Parser[Index].Format, (UINT8 *)&Data, Parser[Index].Length);
} else if (Parser[Index].Format != NULL) {
// convert bit length to byte length
switch ((Parser[Index].Length + 7) >> 3) {
@@ -927,7 +1108,11 @@ ParseAcpiBitFields ( if (GetConsistencyChecking () &&
(Parser[Index].FieldValidator != NULL))
{
- Parser[Index].FieldValidator ((UINT8 *)&Data, Parser[Index].Context);
+ Parser[Index].FieldValidator (
+ (UINT8 *)&Data,
+ Parser[Index].Length,
+ Parser[Index].Context
+ );
}
Print (L"\n");
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index 6468fe5d8c..6427ea7d8a 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -2,7 +2,7 @@ Header file for ACPI parser
Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
- Copyright (c) 2016 - 2020, Arm Limited. All rights reserved.
+ Copyright (c) 2016 - 2024, Arm Limited. All rights reserved.
Copyright (c) 2022, AMD Incorporated. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -130,12 +130,14 @@ DumpUint64 ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
VOID
EFIAPI
Dump3Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
);
/**
@@ -146,12 +148,14 @@ Dump3Chars ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
VOID
EFIAPI
Dump4Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
);
/**
@@ -162,12 +166,14 @@ Dump4Chars ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
VOID
EFIAPI
Dump6Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
);
/**
@@ -178,12 +184,14 @@ Dump6Chars ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
VOID
EFIAPI
Dump8Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
);
/**
@@ -194,12 +202,70 @@ Dump8Chars ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
VOID
EFIAPI
Dump12Chars (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
+ );
+
+/**
+ This function traces 16 characters which can be optionally
+ formated using the format string if specified.
+
+ 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.
+ @param [in] Length Length of the field.
+**/
+VOID
+EFIAPI
+Dump16Chars (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
+ );
+
+/**
+ This function traces reserved fields up to 8 bytes in length.
+
+ Format string is ignored by this function as the reserved field is printed
+ byte by byte with intermittent spacing <eg: 0 0 0 0>. Use DumpxChars for any
+ other use case.
+ @param [in] Format Optional format string for tracing the data.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
+**/
+VOID
+EFIAPI
+DumpReserved (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
+ );
+
+/**
+ This function traces reserved fields up to 64 bits in length.
+
+ Format string is ignored by this function as the reserved field is printed
+ byte by byte with intermittent spacing. eg: <0 0 0 0>. When the field length
+ isn't a multiple of 8, the number of bytes are "ceil"-ed by one. eg for 27
+ bits <0 0 0 0>
+
+ @param [in] Format Optional format string for tracing the data.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field as number of bits.
+**/
+VOID
+EFIAPI
+DumpReservedBits (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
);
/**
@@ -227,18 +293,24 @@ PrintFieldName ( @param [in] Format Format string for tracing the data as specified by
the 'Format' member of ACPI_PARSER.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
-typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16 *Format, UINT8 *Ptr);
+typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16 *Format, UINT8 *Ptr, UINT32 Length);
/**
This function pointer is the template for validating an ACPI table field.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information as specified by
the 'Context' member of the ACPI_PARSER.
e.g. this could be a pointer to the ACPI table header.
**/
-typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8 *Ptr, VOID *Context);
+typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(
+ UINT8 *Ptr,
+ UINT32 Length,
+ VOID *Context
+ );
/**
The ACPI_PARSER structure describes the fields of an ACPI table and
@@ -468,12 +540,14 @@ DumpGasStruct ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
VOID
EFIAPI
DumpGas (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
);
/**
@@ -617,6 +691,27 @@ ParseAcpiDsdt ( );
/**
+ This function parses the EINJ table.
+ When trace is enabled this function parses the EINJ table and
+ traces the ACPI table fields.
+
+ This function also performs validation of the ACPI table fields.
+
+ @param [in] Trace If TRUE, trace the ACPI fields.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] AcpiTableLength Length of the ACPI table.
+ @param [in] AcpiTableRevision Revision of the ACPI table.
+**/
+VOID
+EFIAPI
+ParseAcpiEinj (
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
+ );
+
+/**
This function parses the ACPI ERST table.
When trace is enabled this function parses the ERST table and
traces the ACPI table fields.
@@ -705,6 +800,27 @@ ParseAcpiGtdt ( );
/**
+ This function parses the ACPI HEST table.
+ When trace is enabled this function parses the HEST table and
+ traces the ACPI table fields.
+
+ This function also performs validation of the ACPI table fields.
+
+ @param [in] Trace If TRUE, trace the ACPI fields.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] AcpiTableLength Length of the ACPI table.
+ @param [in] AcpiTableRevision Revision of the ACPI table.
+**/
+VOID
+EFIAPI
+ParseAcpiHest (
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
+ );
+
+/**
This function parses the ACPI HMAT table.
When trace is enabled this function parses the HMAT table and
traces the ACPI table fields.
@@ -827,6 +943,27 @@ ParseAcpiMcfg ( );
/**
+ This function parses the ACPI MPAM table.
+ When trace is enabled this function parses the MPAM table and
+ traces the ACPI table fields.
+
+ This function also performs validation of the ACPI table fields.
+
+ @param [in] Trace If TRUE, trace the ACPI fields.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] AcpiTableLength Length of the ACPI table.
+ @param [in] AcpiTableRevision Revision of the ACPI table.
+**/
+VOID
+EFIAPI
+ParseAcpiMpam (
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
+ );
+
+/**
This function parses the ACPI PCCT table including its sub-structures
of type 0 through 4.
When trace is enabled this function parses the PCCT table and
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c index 48f71484fb..af70c41826 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c @@ -1,7 +1,7 @@ /** @file
AEST table parser
- Copyright (c) 2020, Arm Limited.
+ Copyright (c) 2020 - 2024, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -33,6 +33,7 @@ STATIC UINT8 *ProcessorResourceType; Validate Processor Flags.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -40,8 +41,9 @@ STATIC VOID
EFIAPI
ValidateProcessorFlags (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
// If the global or shared node flag is set then the ACPI Processor ID
@@ -59,6 +61,7 @@ ValidateProcessorFlags ( Validate GIC Interface Type.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -66,8 +69,9 @@ STATIC VOID
EFIAPI
ValidateGicInterfaceType (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
UINT32 GicInterfaceType;
@@ -83,6 +87,7 @@ ValidateGicInterfaceType ( Validate Interface Type.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -90,8 +95,9 @@ STATIC VOID
EFIAPI
ValidateInterfaceType (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
if (*Ptr > 1) {
@@ -104,6 +110,7 @@ ValidateInterfaceType ( Validate Interrupt Type.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -111,8 +118,9 @@ STATIC VOID
EFIAPI
ValidateInterruptType (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
if (*Ptr > 1) {
@@ -125,6 +133,7 @@ ValidateInterruptType ( Validate interrupt flags.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -132,8 +141,9 @@ STATIC VOID
EFIAPI
ValidateInterruptFlags (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
if ((*Ptr & 0xfe) != 0) {
@@ -147,12 +157,14 @@ ValidateInterruptFlags ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
VOID
EFIAPI
DumpVendorSpecificData (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
Print (
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c index d25d4d84f8..3d43d5cb8c 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c @@ -1,7 +1,7 @@ /** @file
DBG2 table parser
- Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2024, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -30,6 +30,7 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; This function validates the NameSpace string length.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -37,8 +38,9 @@ STATIC VOID
EFIAPI
ValidateNameSpaceStrLen (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
UINT16 NameSpaceStrLen;
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c new file mode 100644 index 0000000000..d01b15ff5f --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Einj/EinjParser.c @@ -0,0 +1,370 @@ +/** @file
+ EINJ table parser
+
+ Copyright (c) 2024, Arm Limited.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Specification Reference:
+ - ACPI 6.5, Table 18.3.2 ACPI Error Source
+**/
+
+#include <IndustryStandard/Acpi.h>
+#include <Library/UefiLib.h>
+
+#include "AcpiParser.h"
+#include "AcpiTableParser.h"
+#include "AcpiView.h"
+
+STATIC ACPI_DESCRIPTION_HEADER_INFO mAcpiHdrInfo;
+STATIC UINT32 *mEinjInjectionHdrSize;
+STATIC UINT32 *mEinjInjectionEntryCnt;
+
+STATIC CONST CHAR16 *InstNameTable[] = {
+ L"READ_REGISTER",
+ L"READ_REGISTER_VALUE",
+ L"WRITE_REGISTER",
+ L"WRITE_REGISTER_VALUE",
+ L"NOOP",
+};
+
+/**
+ This function validates the flags field in the EINJ injection header.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information e.g. this
+ could be a pointer to the ACPI table header.
+**/
+STATIC
+VOID
+EFIAPI
+ValidateInjectionFlags (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 Flags;
+
+ Flags = *(UINT8 *)Ptr;
+
+ if (Flags != 0) {
+ IncrementErrorCount ();
+ Print (L"\nERROR: Injection Flags must be zero...");
+ }
+}
+
+/**
+ An ACPI_PARSER array describing the ACPI EINJ Table.
+**/
+STATIC CONST ACPI_PARSER EinjParser[] = {
+ PARSE_ACPI_HEADER (&mAcpiHdrInfo),
+ { L"Injection Header Size", 4, 36, L"%d", NULL, (VOID **)&mEinjInjectionHdrSize,
+ NULL, NULL },
+ { L"Injection Flags", 1, 40, L"0x%x", NULL, NULL, ValidateInjectionFlags,NULL },
+ { L"Reserved", 3, 41, NULL, NULL, NULL, NULL, NULL },
+ { L"Injection Entry Count", 4, 44, L"%d", NULL, (VOID **)&mEinjInjectionEntryCnt,
+ NULL, NULL },
+ /// Injection Action Table.
+ /// ...
+};
+
+/**
+ This function validates the injection action field in
+ the EINJ injection instruction entry.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information e.g. this
+ could be a pointer to the ACPI table header.
+**/
+STATIC
+VOID
+EFIAPI
+ValidateInjectionAction (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 InjectionAction;
+ UINT8 MaxInjectionAction;
+
+ InjectionAction = *(UINT8 *)Ptr;
+
+ /**
+ * EFI_ACPI_6_5_EINJ_TRIGGER_ERROR is only used Trigger Action Table
+ * not used in Injection Action Table in EINJ.
+ * Cf ACPI 6.5 Table 18.24 - Error Injection Table
+ * Cf ACPI 6.5 Table 18.36 - Trigger Error Action
+ */
+ if (*mAcpiHdrInfo.Revision < EFI_ACPI_6_5_ERROR_INJECTION_TABLE_REVISION) {
+ MaxInjectionAction = EFI_ACPI_6_5_EINJ_GET_EXECUTE_OPERATION_TIMINGS;
+ } else {
+ MaxInjectionAction = EFI_ACPI_6_5_EINJ_EINJV2_GET_ERROR_TYPE;
+ }
+
+ if ((InjectionAction < EFI_ACPI_6_5_EINJ_BEGIN_INJECTION_OPERATION) ||
+ (InjectionAction > MaxInjectionAction))
+ {
+ IncrementErrorCount ();
+ Print (L"\nERROR: Invalid Injection Action(0x%x)...", InjectionAction);
+ }
+}
+
+/**
+ This function validates the instruction field in
+ the EINJ injection instruction entry.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information e.g. this
+ could be a pointer to the ACPI table header.
+**/
+STATIC
+VOID
+EFIAPI
+ValidateInstruction (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 Inst;
+
+ Inst = *Ptr;
+
+ if (*mAcpiHdrInfo.Revision <= EFI_ACPI_6_5_ERROR_INJECTION_TABLE_REVISION) {
+ if (Inst > EFI_ACPI_6_5_EINJ_NOOP) {
+ IncrementErrorCount ();
+ Print (L"\nERROR: Invalid Instruction(0x%x)...", Inst);
+ }
+ }
+}
+
+/**
+ This function validates the register region field in
+ the EINJ injection instruction entry.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information e.g. this
+ could be a pointer to the ACPI table header.
+**/
+STATIC
+VOID
+EFIAPI
+ValidateRegisterRegion (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE *RegisterRegion;
+
+ RegisterRegion = (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE *)Ptr;
+
+ if ((RegisterRegion->AddressSpaceId != EFI_ACPI_6_5_SYSTEM_MEMORY) &&
+ (RegisterRegion->AddressSpaceId != EFI_ACPI_6_5_SYSTEM_IO))
+ {
+ IncrementErrorCount ();
+ Print (L"\nERROR: Register Region Must be SYSTEM_MEMORY or SYSTEM_IO...");
+ }
+}
+
+/**
+ Dumps the injection action fields in injection instruction entry.
+
+ @param [in] Format Optional format string for tracing the data.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
+**/
+STATIC
+VOID
+EFIAPI
+DumpInjectionInstAction (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
+ )
+{
+ UINT8 InjectionAction;
+ CONST CHAR16 *ActionName;
+
+ InjectionAction = *Ptr;
+
+ switch (InjectionAction) {
+ case EFI_ACPI_6_5_EINJ_BEGIN_INJECTION_OPERATION:
+ ActionName = L"BEGIN_INJECTION_OPERATION";
+ break;
+ case EFI_ACPI_6_5_EINJ_GET_TRIGGER_ERROR_ACTION_TABLE:
+ ActionName = L"GET_TRIGGER_ERROR_ACTION_TABLE";
+ break;
+ case EFI_ACPI_6_5_EINJ_SET_ERROR_TYPE:
+ ActionName = L"SET_ERROR_TYPE";
+ break;
+ case EFI_ACPI_6_5_EINJ_GET_ERROR_TYPE:
+ ActionName = L"GET_ERROR_TYPE";
+ break;
+ case EFI_ACPI_6_5_EINJ_END_OPERATION:
+ ActionName = L"END_OPERATION";
+ break;
+ case EFI_ACPI_6_5_EINJ_EXECUTE_OPERATION:
+ ActionName = L"EXECUTE_OPERATION";
+ break;
+ case EFI_ACPI_6_5_EINJ_CHECK_BUSY_STATUS:
+ ActionName = L"CHECK_BUSY_STATUS";
+ break;
+ case EFI_ACPI_6_5_EINJ_GET_COMMAND_STATUS:
+ ActionName = L"GET_COMMAND_STATUS";
+ break;
+ case EFI_ACPI_6_5_EINJ_SET_ERROR_TYPE_WITH_ADDRESS:
+ ActionName = L"SET_ERROR_TYPE_WITH_ADDRESS";
+ break;
+ case EFI_ACPI_6_5_EINJ_GET_EXECUTE_OPERATION_TIMINGS:
+ ActionName = L"GET_EXECUTE_OPERATION_TIMINGS";
+ break;
+ case EFI_ACPI_6_5_EINJ_EINJV2_SET_ERROR_TYPE:
+ ActionName = L"EINJV2_SET_ERROR_TYPE";
+ break;
+ case EFI_ACPI_6_5_EINJ_EINJV2_GET_ERROR_TYPE:
+ ActionName = L"EINJV2_GET_ERROR_TYPE";
+ break;
+ case EFI_ACPI_6_5_EINJ_TRIGGER_ERROR:
+ ActionName = L"TRIGGER_ERROR";
+ break;
+ default:
+ IncrementErrorCount ();
+ ActionName = L"UNKNOWN";
+ }
+
+ Print (L"%s(0x%x)", ActionName, InjectionAction);
+}
+
+/**
+ Dumps the instruction fields in injection instruction entry.
+
+ @param [in] Format Optional format string for tracing the data.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
+**/
+STATIC
+VOID
+EFIAPI
+DumpInstruction (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
+ )
+{
+ UINT8 Inst;
+ CONST CHAR16 *InstName;
+
+ Inst = *Ptr;
+
+ if (Inst < ARRAY_SIZE (InstNameTable)) {
+ InstName = InstNameTable[Inst];
+ } else {
+ IncrementErrorCount ();
+ InstName = L"UNKNOWN";
+ }
+
+ Print (L"%s(0x%x)", InstName, Inst);
+}
+
+/**
+ An ACPI_PARSER array describing the EINJ Injection instruction entry.
+**/
+STATIC CONST ACPI_PARSER EinjInjectionInstEntryParser[] = {
+ { L"Injection Action", 1, 0, NULL, DumpInjectionInstAction, NULL,
+ ValidateInjectionAction, NULL },
+ { L"Instruction", 1, 1, NULL, DumpInstruction, NULL,
+ ValidateInstruction, NULL },
+ { L"Flags", 1, 2, L"0x%x", NULL, NULL,NULL, NULL },
+ { L"Reserved", 1, 3, NULL, NULL, NULL,NULL, NULL },
+ { L"Register Region", 12, 4, NULL, DumpGas, NULL,
+ ValidateRegisterRegion, NULL },
+ { L"Value", 8, 16, L"0x%x", NULL, NULL,NULL, NULL },
+ { L"Mask", 8, 24, L"0x%x", NULL, NULL,NULL, NULL },
+};
+
+/**
+ This function parses the EINJ table.
+ When trace is enabled this function parses the EINJ table and
+ traces the ACPI table fields.
+
+ This function also performs validation of the ACPI table fields.
+
+ @param [in] Trace If TRUE, trace the ACPI fields.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] AcpiTableLength Length of the ACPI table.
+ @param [in] AcpiTableRevision Revision of the ACPI table.
+**/
+VOID
+EFIAPI
+ParseAcpiEinj (
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
+ )
+{
+ UINT32 Offset;
+ UINT8 *InjInstEntryPtr;
+ UINT32 InjInstEntrySize;
+
+ if (!Trace) {
+ return;
+ }
+
+ Offset = ParseAcpi (
+ TRUE,
+ 0,
+ "EINJ",
+ Ptr,
+ AcpiTableLength,
+ PARSER_PARAMS (EinjParser)
+ );
+
+ // Validate Error Source Descriptors Count.
+ if ((mEinjInjectionHdrSize == NULL) || (*mEinjInjectionHdrSize != Offset)) {
+ IncrementErrorCount ();
+ Print (L"ERROR: Invalid Injection Header...\n");
+ return;
+ }
+
+ if ((mEinjInjectionEntryCnt == NULL) || (*mEinjInjectionEntryCnt == 0)) {
+ IncrementErrorCount ();
+ Print (L"ERROR: Injection Instruction Entry should be presented...\n");
+ return;
+ }
+
+ InjInstEntrySize = sizeof (EFI_ACPI_6_5_EINJ_INJECTION_INSTRUCTION_ENTRY);
+
+ if ((*mEinjInjectionEntryCnt * InjInstEntrySize) != (AcpiTableLength - Offset)) {
+ IncrementErrorCount ();
+ Print (
+ L"ERROR: Incorrect count for Injection Instruction Entry.\n" \
+ L" Injection Entry Count= %d.\n" \
+ L" Present Count= %d.\n",
+ *mEinjInjectionEntryCnt,
+ (AcpiTableLength - Offset) / InjInstEntrySize
+ );
+ }
+
+ while (Offset < AcpiTableLength) {
+ InjInstEntryPtr = Ptr + Offset;
+
+ // Get Injection Instruction Entry.
+ ParseAcpi (
+ TRUE,
+ 2,
+ "Injection Instruction Entry",
+ InjInstEntryPtr,
+ AcpiTableLength - Offset,
+ PARSER_PARAMS (EinjInjectionInstEntryParser)
+ );
+
+ Offset += InjInstEntrySize;
+ } // while
+}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParser.c index f3ae09309c..e237e0e04e 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParser.c @@ -2,7 +2,7 @@ ERST table parser
Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
- Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2024, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -70,6 +70,7 @@ STATIC CONST CHAR16 *ErstInstructionTable[] = { Validate Erst action.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -77,8 +78,9 @@ STATIC VOID
EFIAPI
ValidateErstAction (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
if (*Ptr > EFI_ACPI_6_4_ERST_GET_EXECUTE_OPERATION_TIMINGS) {
@@ -91,6 +93,7 @@ ValidateErstAction ( Validate Erst instruction.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -98,8 +101,9 @@ STATIC VOID
EFIAPI
ValidateErstInstruction (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
if (*Ptr > EFI_ACPI_6_4_ERST_MOVE_DATA) {
@@ -112,6 +116,7 @@ ValidateErstInstruction ( Validate Erst flags.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -119,8 +124,9 @@ STATIC VOID
EFIAPI
ValidateErstFlags (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
if ((*Ptr & 0xfe) != 0) {
@@ -165,13 +171,15 @@ FormatByte ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the Action byte.
+ @param [in] Length Length of the field.
**/
STATIC
VOID
EFIAPI
DumpErstAction (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
FormatByte (ErstActionTable, *Ptr, ARRAY_SIZE (ErstActionTable));
@@ -182,13 +190,15 @@ DumpErstAction ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the Instruction byte.
+ @param [in] Length Length of the field.
**/
STATIC
VOID
EFIAPI
DumpErstInstruction (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
FormatByte (ErstInstructionTable, *Ptr, ARRAY_SIZE (ErstInstructionTable));
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c index abc58d6552..d89fcb13a4 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c @@ -1,7 +1,7 @@ /** @file
FADT table parser
- Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2024, Arm Limited. All rights reserved.
Copyright (c) 2022, AMD Incorporated. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -57,6 +57,7 @@ GetAcpiXsdtHeaderInfo ( This function validates the Firmware Control Field.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -64,8 +65,9 @@ STATIC VOID
EFIAPI
ValidateFirmwareCtrl (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
@@ -83,6 +85,7 @@ ValidateFirmwareCtrl ( This function validates the X_Firmware Control Field.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -90,8 +93,9 @@ STATIC VOID
EFIAPI
ValidateXFirmwareCtrl (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
@@ -109,6 +113,7 @@ ValidateXFirmwareCtrl ( This function validates the flags.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -116,8 +121,9 @@ STATIC VOID
EFIAPI
ValidateFlags (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
@@ -163,12 +169,14 @@ STATIC CONST ACPI_PARSER FadtFlagParser[] = { @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
VOID
EFIAPI
DumpFadtFlags (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c index e62927098a..c8681e8424 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c @@ -1,7 +1,7 @@ /** @file
GTDT table parser
- Copyright (c) 2016 - 2021, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2024, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -30,6 +30,7 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; This function validates the GT Block timer count.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -37,8 +38,9 @@ STATIC VOID
EFIAPI
ValidateGtBlockTimerCount (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
UINT32 BlockTimerCount;
@@ -59,6 +61,7 @@ ValidateGtBlockTimerCount ( This function validates the GT Frame Number.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -66,8 +69,9 @@ STATIC VOID
EFIAPI
ValidateGtFrameNumber (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
UINT8 FrameNumber;
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hest/HestParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hest/HestParser.c new file mode 100644 index 0000000000..75fc40b0ba --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hest/HestParser.c @@ -0,0 +1,982 @@ +/** @file
+ HEST table parser
+
+ Copyright (c) 2024, Arm Limited.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Specification Reference:
+ - ACPI 6.5, Table 18.3.2 ACPI Error Source
+**/
+
+#include <IndustryStandard/Acpi.h>
+#include <Library/UefiLib.h>
+
+#include "AcpiParser.h"
+#include "AcpiTableParser.h"
+#include "AcpiView.h"
+
+STATIC ACPI_DESCRIPTION_HEADER_INFO mAcpiHdrInfo;
+STATIC UINT32 *mHestErrorSourceCount;
+STATIC UINT16 *mHestErrorSourceType;
+STATIC UINT8 *mHestIA32HardwareBankCount;
+
+/**
+ An String array for Error Notification Structure's type.
+ Cf ACPI 6.5 Table 18.14: Hardware Error Notification Structure
+**/
+STATIC CONST CHAR16 *HestErrorNotificationStructureTypeStr[] = {
+ L"Polled",
+ L"External Interrupt",
+ L"Local Interrupt",
+ L"SCI",
+ L"NMI",
+ L"CMCI",
+ L"MCE",
+ L"GPIO-Signal",
+ L"ARMv8 SEA",
+ L"ARMv8 SEI",
+ L"External Interrupt - GSIV",
+ L"Software Delegated Exception",
+};
+
+/**
+ An ACPI_PARSER array describing the ACPI HEST Table.
+**/
+STATIC CONST ACPI_PARSER HestParser[] = {
+ PARSE_ACPI_HEADER (&mAcpiHdrInfo),
+ { L"Error Source Count", 4, 36, L"%d", NULL,
+ (VOID **)&mHestErrorSourceCount,NULL, NULL },
+ // Error Source Descriptor 1
+ // Error Source Descriptor Type
+ // Error Source Descriptor Data
+ // ...
+ // Error Source Descriptor 2
+ // Error Source Descriptor Type
+ // Error Source Descriptor Data
+ // ...
+ // ....
+ // Error Source Descriptor n
+ // Error Source Descriptor Type
+ // Error Source Descriptor Data
+ // ...
+};
+
+/**
+ An ACPI_PARSER array describing the HEST error source descriptor type.
+**/
+STATIC CONST ACPI_PARSER HestErrorSourceTypeParser[] = {
+ { L"Type", 2, 0, L"%d", NULL, (VOID **)&mHestErrorSourceType, NULL, NULL },
+};
+
+/**
+ An ACPI_PARSER array describing the HEST error source flags information.
+**/
+STATIC CONST ACPI_PARSER HestErrorSourceFlags[] = {
+ { L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL },
+ { L"Global", 1, 1, L"%d", NULL, NULL, NULL, NULL },
+ { L"GHES Assist", 1, 2, L"%d", NULL, NULL, NULL, NULL },
+ { L"Reserved", 5, 3, NULL, NULL, NULL, NULL, NULL }
+};
+
+/**
+ An ACPI_PARSER array describing IA-32 Architecture Machine Check Bank Structure
+ Cf ACPI 6.5 Table 18.4: IA-32 Architecture Machine Check Error Bank Structure
+**/
+STATIC CONST ACPI_PARSER HestErrorIA32ArchMachineCheckBankStructureParser[] = {
+ { L"Bank Number", 1, 0, L"%d", NULL, NULL, NULL, NULL },
+ { L"Clear Status On Initialization", 1, 1, L"%d", NULL, NULL, NULL, NULL },
+ { L"Status Data Format", 1, 2, L"%d", NULL, NULL, NULL, NULL },
+ { L"Reserved", 1, 3, NULL, NULL, NULL, NULL, NULL },
+ { L"Control Register MSR Address", 4, 4, L"0x%lx", NULL, NULL, NULL, NULL },
+ { L"Control Init Data", 8, 8, L"0x%llx", NULL, NULL, NULL, NULL },
+ { L"Status Register MSR Address", 4, 16, L"0x%lx", NULL, NULL, NULL, NULL },
+ { L"Address Register MSR Address", 4, 20, L"0x%lx", NULL, NULL, NULL, NULL },
+ { L"Misc Register MSR Address", 4, 24, L"0x%lx", NULL, NULL, NULL, NULL },
+};
+
+/**
+ An ACPI_PARSER array describing the Hardware Error Notification Structure's
+ Configuration Write Enable Field (CWE)
+ Cf ACPI 6.5 Table 18.14: Hardware Error Notification Structure
+**/
+STATIC CONST ACPI_PARSER HestErrorNotificationCweParser[] = {
+ { L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL },
+ { L"Poll Interval", 1, 1, L"%d", NULL, NULL, NULL, NULL },
+ { L"Switch To Polling Threshold Value", 1, 2, L"%d", NULL, NULL, NULL, NULL },
+ { L"Switch To Polling Threshold Window", 1, 3, L"%d", NULL, NULL, NULL, NULL },
+ { L"Error Threshold Value", 1, 4, L"%d", NULL, NULL, NULL, NULL },
+ { L"Error Threshold Window", 1, 5, L"%d", NULL, NULL, NULL, NULL },
+ { L"Reserved", 10, 6, L"0x%x", NULL, NULL, NULL, NULL },
+};
+
+/**
+ This function validates the Type field of Hardware Error Notification Structure
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information e.g. this
+ could be a pointer to the ACPI table header.
+**/
+STATIC
+VOID
+EFIAPI
+ValidateErrorNotificationType (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 Type;
+
+ Type = *(UINT8 *)Ptr;
+
+ if (Type >
+ EFI_ACPI_6_5_HARDWARE_ERROR_NOTIFICATION_SOFTWARE_DELEGATED_EXCEPTION)
+ {
+ IncrementErrorCount ();
+ Print (
+ L"\nERROR: Notification Structure Type must be <= 0x%x.",
+ EFI_ACPI_6_5_HARDWARE_ERROR_NOTIFICATION_SOFTWARE_DELEGATED_EXCEPTION
+ );
+ }
+}
+
+/**
+ Dumps flags fields of error source descriptor.
+
+ @param [in] Format Optional format string for tracing the data.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
+**/
+STATIC
+VOID
+EFIAPI
+DumpSourceFlags (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
+ )
+{
+ if (Format != NULL) {
+ Print (Format, *(UINT32 *)Ptr);
+ return;
+ }
+
+ Print (L"0x%x\n", *Ptr);
+ ParseAcpiBitFields (
+ TRUE,
+ 2,
+ NULL,
+ Ptr,
+ 1,
+ PARSER_PARAMS (HestErrorSourceFlags)
+ );
+}
+
+/**
+ Dumps type fields of Error Notification Structure
+
+ @param [in] Format Optional format string for tracing the data.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
+**/
+STATIC
+VOID
+EFIAPI
+DumpErrorNotificationType (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
+ )
+{
+ if (Format != NULL) {
+ Print (Format, *Ptr);
+ return;
+ }
+
+ if (*Ptr <= EFI_ACPI_6_5_HARDWARE_ERROR_NOTIFICATION_SOFTWARE_DELEGATED_EXCEPTION) {
+ Print (L"%s(0x%x)", HestErrorNotificationStructureTypeStr[*Ptr]);
+ } else {
+ Print (L"UNKNOWN(0x%x)", HestErrorNotificationStructureTypeStr[*Ptr]);
+ }
+}
+
+/**
+ Dumps Configuration Write Enable fields of Hardware Error Notification Structure.
+
+ @param [in] Format Optional format string for tracing the data.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
+**/
+STATIC
+VOID
+EFIAPI
+DumpErrorNotificationCwe (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
+ )
+{
+ if (Format != NULL) {
+ Print (Format, *(UINT32 *)Ptr);
+ return;
+ }
+
+ Print (L"0x%x\n", *Ptr);
+ ParseAcpiBitFields (
+ TRUE,
+ 2,
+ NULL,
+ Ptr,
+ 1,
+ PARSER_PARAMS (HestErrorNotificationCweParser)
+ );
+}
+
+/**
+ An ACPI_PARSER array describing the Hardware Error Notification Structure
+ Cf ACPI 6.5 Table 18.14: Hardware Error Notification Structure
+**/
+STATIC CONST ACPI_PARSER HestErrorNotificationParser[] = {
+ { L"Type", 1, 0, NULL, DumpErrorNotificationType, NULL, ValidateErrorNotificationType, NULL },
+ { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
+ { L"Configuration Write Enable", 2, 2, NULL, DumpErrorNotificationCwe, NULL, NULL, NULL },
+ { L"Pull Interval", 4, 4, L"%d ms", NULL, NULL, NULL, NULL },
+ { L"Vector", 4, 8, L"%d", NULL, NULL, NULL, NULL },
+ { L"Switch To Polling Threshold Value", 4, 12, L"%d", NULL, NULL, NULL, NULL },
+ { L"Switch To Polling Threshold Window", 4, 16, L"%d ms", NULL, NULL, NULL, NULL },
+ { L"Error Threshold Value", 4, 20, L"%d", NULL, NULL, NULL, NULL },
+ { L"Error Threshold Window", 4, 24, L"%d ms", NULL, NULL, NULL, NULL },
+};
+
+/**
+ This function validates reserved bits of
+ pci related Error source structure's bus field.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information e.g. this
+ could be a pointer to the ACPI table header.
+**/
+STATIC
+VOID
+EFIAPI
+ValidatePciBusReservedBits (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ if (*Ptr != 0x00) {
+ IncrementErrorCount ();
+ Print (L"\nERROR: bits[31:24] should must be zero...");
+ }
+}
+
+/**
+ An ACPI_PARSER array describing the PCI related Error Source Bus field.
+**/
+STATIC CONST ACPI_PARSER HestErrorSourcePciCommonBusParser[] = {
+ { L"Bus", 8, 0, L"%d", NULL, NULL, NULL, NULL },
+ { L"Segment Number", 16, 8, L"%d", NULL, NULL, NULL, NULL },
+ { L"Reserved", 8, 24, L"0x%x", NULL, NULL, ValidatePciBusReservedBits, NULL },
+};
+
+/**
+ This function validates the flags field of IA32 related
+ error source descriptor structure.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information e.g. this
+ could be a pointer to the ACPI table header.
+**/
+STATIC
+VOID
+EFIAPI
+ValidateIA32ErrorSourceFlags (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 SourceFlags;
+
+ SourceFlags = *(UINT8 *)Ptr;
+
+ if ((SourceFlags &
+ ~(EFI_ACPI_6_5_ERROR_SOURCE_FLAG_FIRMWARE_FIRST |
+ EFI_ACPI_6_5_ERROR_SOURCE_FLAG_GHES_ASSIST)) != 0)
+ {
+ IncrementErrorCount ();
+ Print (L"\nERROR: Invalid IA32 source flags field value...");
+ }
+
+ if (((SourceFlags & EFI_ACPI_6_5_ERROR_SOURCE_FLAG_FIRMWARE_FIRST) != 0) &&
+ ((SourceFlags & EFI_ACPI_6_5_ERROR_SOURCE_FLAG_GHES_ASSIST) != 0))
+ {
+ IncrementErrorCount ();
+ Print (L"\nERROR: GHES_ASSIST should be reserved if FIRMWARE_FIRST is set...");
+ }
+}
+
+/**
+ This function validates the flags field of PCI related
+ error source descriptor structure.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information e.g. this
+ could be a pointer to the ACPI table header.
+**/
+STATIC
+VOID
+EFIAPI
+ValidatePciErrorSourceFlags (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 SourceFlags;
+
+ SourceFlags = *(UINT8 *)Ptr;
+
+ if ((SourceFlags &
+ ~(EFI_ACPI_6_5_ERROR_SOURCE_FLAG_FIRMWARE_FIRST |
+ EFI_ACPI_6_5_ERROR_SOURCE_FLAG_GLOBAL)) != 0)
+ {
+ IncrementErrorCount ();
+ Print (L"\nERROR: Invalid PCI source flags field value...");
+ }
+}
+
+/**
+ This function validates the flags field of Ghes related
+ error source descriptor structure.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information e.g. this
+ could be a pointer to the ACPI table header.
+**/
+STATIC
+VOID
+EFIAPI
+ValidateGhesSourceFlags (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 SourceFlags;
+
+ SourceFlags = *(UINT8 *)Ptr;
+
+ if (SourceFlags != 0) {
+ IncrementErrorCount ();
+ Print (L"\nERROR: Ghes'source flags should be reserved...");
+ }
+}
+
+/**
+ This function validates the enabled field of error source descriptor
+ structure.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information e.g. this
+ could be a pointer to the ACPI table header.
+**/
+STATIC
+VOID
+EFIAPI
+ValidateEnabledField (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ if (*(UINT8 *)Ptr > 1) {
+ IncrementErrorCount ();
+ Print (L"\nERROR: Invalid Enabled field value must be either 0 or 1.");
+ }
+}
+
+/**
+ This function validates the number of records to preallocated and
+ max sections per record fields of error source descriptor
+ structure.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information e.g. this
+ could be a pointer to the ACPI table header.
+**/
+STATIC
+VOID
+EFIAPI
+ValidateRecordCount (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 RecordCount;
+ BOOLEAN CheckRecordCount;
+
+ RecordCount = *Ptr;
+ CheckRecordCount = ((BOOLEAN)(UINTN)Context);
+
+ if ((CheckRecordCount) && (RecordCount == 0)) {
+ IncrementErrorCount ();
+ Print (L"\nERROR: Record count must be >= 1...");
+ }
+}
+
+/**
+ Dumps the notification structure fields.
+
+ @param [in] Format Optional format string for tracing the data.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
+**/
+STATIC
+VOID
+EFIAPI
+DumpNotificationStructure (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
+ )
+{
+ UINT32 Offset;
+ UINT32 Size;
+
+ Size = sizeof (EFI_ACPI_6_5_HARDWARE_ERROR_NOTIFICATION_STRUCTURE);
+ Print (L"\n");
+ Offset = ParseAcpi (
+ TRUE,
+ 2,
+ NULL,
+ Ptr,
+ Size,
+ PARSER_PARAMS (HestErrorNotificationParser)
+ );
+ if (Offset != Size) {
+ IncrementErrorCount ();
+ Print (L"ERROR: Failed to parse Hardware Error Notification Structure!\n");
+ }
+}
+
+/**
+ Dumps bus field in the PCI related Error Source Structure.
+ from HestTable.
+ @param [in] Format Optional format string for tracing the data.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
+**/
+STATIC
+VOID
+EFIAPI
+DumpPciBus (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
+ )
+{
+ if (Format != NULL) {
+ Print (Format, *(UINT32 *)Ptr);
+ return;
+ }
+
+ Print (L"0x%x\n", *Ptr);
+ ParseAcpiBitFields (
+ TRUE,
+ 2,
+ NULL,
+ Ptr,
+ 1,
+ PARSER_PARAMS (HestErrorSourcePciCommonBusParser)
+ );
+}
+
+/**
+ Dumps the IA32 Arch Machine Check Error Bank structure fields.
+
+ @param [in] HestTable Start pointer to Hest table.
+ @param [in] AcpiTableLength Length of HestTable.
+ @param [in,out] Offset Offset to machine check bank structure
+ from HestTable.
+
+ @retval EFI_SUCCESS Success
+ @retval EFI_INVALID_PARAMETER Invalid Hest Table
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+DumpIA32ArchMachineCheckErrorBankStructure (
+ IN UINT8 *HestTable,
+ UINT32 AcpiTableLength,
+ UINT32 *Offset
+ )
+{
+ UINT8 Idx;
+ UINT8 *IA32BankStructPtr;
+ UINT32 TotalBankStructSize;
+
+ TotalBankStructSize = *mHestIA32HardwareBankCount *
+ sizeof (EFI_ACPI_6_5_IA32_ARCHITECTURE_MACHINE_CHECK_ERROR_BANK_STRUCTURE);
+
+ if ((*Offset + TotalBankStructSize) > AcpiTableLength) {
+ IncrementErrorCount ();
+ Print (
+ L"ERROR: Not enough data for "
+ "IA-32 Architecture Machine Check Exception Error source.\n"
+ );
+ return EFI_INVALID_PARAMETER;
+ }
+
+ for (Idx = 0; Idx < *mHestIA32HardwareBankCount; Idx++) {
+ IA32BankStructPtr = HestTable + *Offset;
+ ParseAcpi (
+ TRUE,
+ 4,
+ "IA-32 Architecture Machine Check Bank Structure",
+ IA32BankStructPtr,
+ sizeof (EFI_ACPI_6_5_IA32_ARCHITECTURE_MACHINE_CHECK_ERROR_BANK_STRUCTURE),
+ PARSER_PARAMS (HestErrorIA32ArchMachineCheckBankStructureParser)
+ );
+ *Offset +=
+ sizeof (EFI_ACPI_6_5_IA32_ARCHITECTURE_MACHINE_CHECK_ERROR_BANK_STRUCTURE);
+ }
+
+ *mHestIA32HardwareBankCount = 0;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Helper macro to populate the header fields of error source descriptor in the
+ ACPI_PARSER array.
+**/
+#define PARSE_HEST_ERROR_SOURCE_COMMON_HEADER(FlagsValidateFunc, CheckRecordCount) \
+ { L"Type", 2, 0, L"%d", NULL, NULL, NULL, NULL }, \
+ { L"Source Id", 2, 2, L"%d", NULL, NULL, NULL, NULL }, \
+ { L"Reserved", 2, 4, NULL, NULL, NULL, NULL, NULL }, \
+ { L"Flags", 1, 6, NULL, DumpSourceFlags, NULL, \
+ FlagsValidateFunc, NULL }, \
+ { L"Enabled", 1, 7, L"%d", NULL, NULL, ValidateEnabledField, NULL }, \
+ { L"Number of Records to Pre-allocate", 4, 8, L"%d", NULL, NULL, \
+ ValidateRecordCount, (VOID *) ((UINTN) CheckRecordCount) }, \
+ { L"Max Sections Per Record", 4, 12, L"%d", NULL, NULL, \
+ ValidateRecordCount, (VOID *) ((UINTN) CheckRecordCount) }
+
+/**
+ Helper macro to populate the header fields of PCI related
+ error source descriptor in the ACPI_PARSER array.
+**/
+#define PARSE_HEST_PCI_ERROR_SOURCE_COMMON_HEADER() \
+ PARSE_HEST_ERROR_SOURCE_COMMON_HEADER(ValidatePciErrorSourceFlags, TRUE), \
+ { L"Bus", 4, 16, NULL, DumpPciBus, NULL, NULL, NULL }, \
+ { L"Device", 2, 20, L"%d", NULL, NULL, NULL, NULL }, \
+ { L"Function", 2, 22, L"%d", NULL, NULL, NULL, NULL }, \
+ { L"Device Control", 2, 24, L"%d", NULL, NULL, NULL, NULL }, \
+ { L"Reserved", 2, 26, NULL, NULL, NULL, NULL, NULL }, \
+ { L"Uncorrectable Error Mask", 4, 28, L"0x%lx", NULL, NULL, NULL, NULL }, \
+ { L"Uncorrectable Error Severity", 4, 32, L"%d", NULL, NULL, NULL, NULL }, \
+ { L"Correctable Error Mask", 4, 36, L"0x%lx", NULL, NULL, NULL, NULL }, \
+ { L"Advanced Error Capabilities and Control", 4, 40, L"%d", NULL, NULL, \
+ NULL, NULL }
+
+/**
+ Helper macro to populate the header fields of GHES related
+ error source descriptor in the ACPI_PARSER array.
+**/
+#define PARSE_HEST_GHES_ERROR_SOURCE() \
+ { L"Type", 2, 0, L"%d", NULL, NULL, NULL, NULL }, \
+ { L"Source Id", 2, 2, L"%d", NULL, NULL, NULL, NULL }, \
+ { L"Related Source Id", 2, 4, L"0x%x", NULL, NULL, NULL, NULL }, \
+ { L"Flags", 1, 6, L"0x%x", NULL, NULL, ValidateGhesSourceFlags, NULL }, \
+ { L"Enabled", 1, 7, L"%d", NULL, NULL, ValidateEnabledField, NULL }, \
+ { L"Number of Records to Pre-allocate", 4, 8, L"%d", NULL, NULL, \
+ ValidateRecordCount, (VOID *) ((UINTN) TRUE) }, \
+ { L"Max Sections Per Record", 4, 12, L"%d", NULL, NULL, \
+ ValidateRecordCount, (VOID *) ((UINTN) TRUE) }, \
+ { L"Max Raw Data Length", 4, 16, L"%d", NULL, NULL, NULL, NULL }, \
+ { L"Error Status Address", 12, 20, NULL, DumpGas, NULL, NULL, NULL }, \
+ { L"Notification Structure", 28, 32, NULL, DumpNotificationStructure, \
+ NULL, NULL, NULL }, \
+ { L"Error Status Block Length", 4, 60, L"%d", NULL, NULL, NULL, NULL }
+
+/**
+ An ACPI_PARSER array describing the IA-32 Architecture Machine Check Exception
+ error source descriptor.
+ Cf ACPI 6.5 Table 18.3: IA-32 Architecture Machine Check Exception Structure
+**/
+STATIC CONST ACPI_PARSER HestErrorSourceIA32ArchMachineCheckExceptionParser[] = {
+ PARSE_HEST_ERROR_SOURCE_COMMON_HEADER (ValidateIA32ErrorSourceFlags, FALSE),
+ { L"Global Capability Init Data",
+ 8, 16, L"0x%llx", NULL, NULL, NULL, NULL },
+ { L"Global Control Init Data",
+ 8, 24, L"0x%llx", NULL, NULL, NULL, NULL },
+ { L"Number of Hardware Banks",
+ 1, 32, L"%d", NULL, (VOID **)&mHestIA32HardwareBankCount, NULL, NULL },
+ { L"Reserved",
+ 7, 33, NULL, NULL, NULL, NULL, NULL },
+ /// HestErrorIA32ArchMachineCheckBankStructureParser
+ /// ...
+};
+
+/**
+ An ACPI_PARSER array describing the IA-32 Architecture Machine Check Exception
+ error source descriptor.
+ Cf ACPI 6.5 Table 18.5: IA-32 Architecture Machine Check Exception Structure
+**/
+STATIC CONST ACPI_PARSER HestErrorSourceIA32ArchCorrectedMachineCheckParser[] = {
+ PARSE_HEST_ERROR_SOURCE_COMMON_HEADER (ValidateIA32ErrorSourceFlags, TRUE),
+ { L"Notification Structure",
+ 28, 16, NULL, DumpNotificationStructure, NULL, NULL, NULL },
+ { L"Number of Hardware Banks",
+ 1, 44, L"%d", NULL, (VOID **)&mHestIA32HardwareBankCount, NULL, NULL },
+ { L"Reserved",
+ 3, 45, NULL, NULL, NULL, NULL, NULL },
+ /// HestErrorIA32ArchMachineCheckBankStructureParser
+ /// ...
+};
+
+/**
+ An ACPI_PARSER array describing the IA-32 Non-Maskable Interrupt
+ error source descriptor.
+ Cf ACPI 6.5 Table 18.6: IA-32 Architecture NMI Error Structure
+**/
+STATIC CONST ACPI_PARSER HestErrorSourceIA32ArchNonMaskableInterruptParser[] = {
+ { L"Type", 2, 0, L"%d", NULL, NULL, NULL, NULL },
+ { L"Source Id", 2, 2, L"%d", NULL, NULL, NULL, NULL },
+ { L"Reserved", 4, 4, NULL, NULL, NULL, NULL, NULL },
+ { L"Number of Records to Pre-allocate", 4, 8, L"%d", NULL, NULL,
+ ValidateRecordCount, (VOID *)((UINTN)TRUE) },
+ { L"Max Sections Per Record", 4, 12, L"%d", NULL, NULL,
+ ValidateRecordCount, (VOID *)((UINTN)TRUE) },
+ { L"Max Raw Data Length", 4, 16, L"%d", NULL, NULL, NULL, NULL },
+};
+
+/**
+ An ACPI_PARSER array describing the HEST PCIe Root Port AER
+ error source descriptor.
+ Cf ACPI 6.5 Table 18.7: PCI Express Root Port AER Structure
+**/
+STATIC CONST ACPI_PARSER HestErrorSourcePciExpressRootPortAerParser[] = {
+ PARSE_HEST_PCI_ERROR_SOURCE_COMMON_HEADER (),
+ { L"Root Error Command",
+ 4, 44,L"%d", NULL, NULL, NULL, NULL },
+};
+
+/**
+ An ACPI_PARSER array describing the HEST PCIe Device AER
+ error source descriptor.
+ Cf ACPI 6.5 Table 18.8: PCI Express Device AER Structure
+**/
+STATIC CONST ACPI_PARSER HestErrorSourcePciExpressDeviceAerParser[] = {
+ PARSE_HEST_PCI_ERROR_SOURCE_COMMON_HEADER (),
+};
+
+/**
+ An ACPI_PARSER array describing the HEST PCIe/PCI-X Bridge AER
+ error source descriptor.
+ Cf ACPI 6.5 Table 18.9: PCI Express/PCI-X Bridge AER Structure
+**/
+STATIC CONST ACPI_PARSER HestErrorSourcePciExpressBridgeAerParser[] = {
+ PARSE_HEST_PCI_ERROR_SOURCE_COMMON_HEADER (),
+ { L"Secondary Uncorrectable Error Mask",
+ 4, 44, L"0x%lx", NULL, NULL, NULL, NULL },
+ { L"Secondary Uncorrectable Error Severity",
+ 4, 48, L"%d", NULL, NULL, NULL, NULL },
+ { L"Secondary Advanced Error Capabilities and Control",
+ 4, 52, L"%d", NULL, NULL, NULL, NULL },
+};
+
+/**
+ An ACPI_PARSER array describing the HEST GHES error source descriptor.
+ Cf ACPI 6.5 Table 18.10: Generic Hardware Error Source Structure
+**/
+STATIC CONST ACPI_PARSER HestErrorSourceGhesParser[] = {
+ PARSE_HEST_GHES_ERROR_SOURCE (),
+};
+
+/**
+ An ACPI_PARSER array describing the HEST GHESv2 error source descriptor.
+ Cf ACPI 6.5 Table 18.11: Generic Hardware Error Source version 2 Structure
+**/
+STATIC CONST ACPI_PARSER HestErrorSourceGhesv2Parser[] = {
+ PARSE_HEST_GHES_ERROR_SOURCE (),
+ { L"Read Ack Register", 12, 64, NULL, DumpGas, NULL, NULL, NULL },
+ { L"Read Ack Preserve", 8, 76, L"%llx", NULL, NULL, NULL, NULL },
+ { L"Read Ack Write", 8, 84, L"%llx", NULL, NULL, NULL, NULL },
+};
+
+/**
+ An ACPI_PARSER array describing the IA-32 Architecture Deferred Machine Check
+ error source descriptor.
+ Cf ACPI 6.5 Table 18.15: IA-32 Architecture Deferred Machine Check Structure
+**/
+STATIC CONST ACPI_PARSER HestErrorSourceIA32ArchDeferredMachineCheckParser[] = {
+ PARSE_HEST_ERROR_SOURCE_COMMON_HEADER (ValidateIA32ErrorSourceFlags, TRUE),
+ { L"Notification Structure", 28, 16, NULL, DumpNotificationStructure,
+ NULL, NULL, NULL },
+ { L"Number of Hardware Banks", 1, 44, L"%d", NULL,
+ (VOID **)&mHestIA32HardwareBankCount, NULL, NULL },
+ { L"Reserved", 3, 45, NULL, NULL, NULL,NULL, NULL },
+ /// HestErrorIA32ArchMachineCheckBankStructureParser
+ /// ...
+};
+
+/**
+ This function parses the ACPI HEST table.
+ When trace is enabled this function parses the HEST table and
+ traces the ACPI table fields.
+
+ This function also performs validation of the ACPI table fields.
+
+ @param [in] Trace If TRUE, trace the ACPI fields.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] AcpiTableLength Length of the ACPI table.
+ @param [in] AcpiTableRevision Revision of the ACPI table.
+**/
+VOID
+EFIAPI
+ParseAcpiHest (
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Offset;
+ UINT8 *ErrorSourcePtr;
+ UINT32 ParsedErrorSourceCount;
+ UINT32 CurErrorSourceType;
+
+ if (Trace != TRUE) {
+ return;
+ }
+
+ Offset = ParseAcpi (
+ TRUE,
+ 0,
+ "HEST",
+ Ptr,
+ AcpiTableLength,
+ PARSER_PARAMS (HestParser)
+ );
+
+ // Validate Error Source Descriptors Count.
+ if (mHestErrorSourceCount == NULL) {
+ IncrementErrorCount ();
+ Print (L"ERROR: Invalid Hardware Error Source Table Header...\n");
+ return;
+ }
+
+ ParsedErrorSourceCount = 0;
+ CurErrorSourceType = EFI_ACPI_6_5_IA32_ARCHITECTURE_MACHINE_CHECK_EXCEPTION;
+
+ while ((Offset < AcpiTableLength) && (ParsedErrorSourceCount < *mHestErrorSourceCount)) {
+ ErrorSourcePtr = Ptr + Offset;
+
+ // Get Type of Error Source Descriptor.
+ ParseAcpi (
+ FALSE,
+ 0,
+ NULL,
+ ErrorSourcePtr,
+ AcpiTableLength - Offset,
+ PARSER_PARAMS (HestErrorSourceTypeParser)
+ );
+
+ // Validate Error Source Descriptors Type.
+ if (mHestErrorSourceType == NULL) {
+ IncrementErrorCount ();
+ Print (L"ERROR: Invalid Error Source Structure...\n");
+ return;
+ }
+
+ if (CurErrorSourceType > *mHestErrorSourceType) {
+ IncrementErrorCount ();
+ Print (L"ERROR: Error Source Structure must be sorted in Type with ascending order...\n");
+ return;
+ }
+
+ switch (*mHestErrorSourceType) {
+ case EFI_ACPI_6_5_IA32_ARCHITECTURE_MACHINE_CHECK_EXCEPTION:
+ ParseAcpi (
+ TRUE,
+ 2,
+ "IA-32 Architecture Machine Check Exception",
+ ErrorSourcePtr,
+ sizeof (EFI_ACPI_6_5_IA32_ARCHITECTURE_MACHINE_CHECK_EXCEPTION_STRUCTURE),
+ PARSER_PARAMS (HestErrorSourceIA32ArchMachineCheckExceptionParser)
+ );
+
+ Offset +=
+ sizeof (EFI_ACPI_6_5_IA32_ARCHITECTURE_MACHINE_CHECK_EXCEPTION_STRUCTURE);
+
+ Status = DumpIA32ArchMachineCheckErrorBankStructure (
+ Ptr,
+ AcpiTableLength,
+ &Offset
+ );
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ break;
+ case EFI_ACPI_6_5_IA32_ARCHITECTURE_CORRECTED_MACHINE_CHECK:
+ ParseAcpi (
+ TRUE,
+ 2,
+ "IA-32 Architecture Corrected Machine Check",
+ ErrorSourcePtr,
+ sizeof (EFI_ACPI_6_5_IA32_ARCHITECTURE_CORRECTED_MACHINE_CHECK_STRUCTURE),
+ PARSER_PARAMS (HestErrorSourceIA32ArchCorrectedMachineCheckParser)
+ );
+
+ Offset +=
+ sizeof (EFI_ACPI_6_5_IA32_ARCHITECTURE_CORRECTED_MACHINE_CHECK_STRUCTURE);
+
+ Status = DumpIA32ArchMachineCheckErrorBankStructure (
+ Ptr,
+ AcpiTableLength,
+ &Offset
+ );
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ break;
+ case EFI_ACPI_6_5_IA32_ARCHITECTURE_NMI_ERROR:
+ ParseAcpi (
+ TRUE,
+ 2,
+ "IA-32 Architecture Non-Maskable Interrupt",
+ ErrorSourcePtr,
+ sizeof (EFI_ACPI_6_5_IA32_ARCHITECTURE_NMI_ERROR_STRUCTURE),
+ PARSER_PARAMS (HestErrorSourceIA32ArchNonMaskableInterruptParser)
+ );
+
+ Offset +=
+ sizeof (EFI_ACPI_6_5_IA32_ARCHITECTURE_NMI_ERROR_STRUCTURE);
+ break;
+ case EFI_ACPI_6_5_PCI_EXPRESS_ROOT_PORT_AER:
+ ParseAcpi (
+ TRUE,
+ 2,
+ "PCI Express RootPort AER Structure",
+ ErrorSourcePtr,
+ sizeof (EFI_ACPI_6_5_PCI_EXPRESS_ROOT_PORT_AER_STRUCTURE),
+ PARSER_PARAMS (HestErrorSourcePciExpressRootPortAerParser)
+ );
+
+ Offset += sizeof (EFI_ACPI_6_5_PCI_EXPRESS_ROOT_PORT_AER_STRUCTURE);
+ break;
+ case EFI_ACPI_6_5_PCI_EXPRESS_DEVICE_AER:
+ ParseAcpi (
+ TRUE,
+ 2,
+ "PCI Express Device AER Structure",
+ ErrorSourcePtr,
+ sizeof (EFI_ACPI_6_5_PCI_EXPRESS_DEVICE_AER_STRUCTURE),
+ PARSER_PARAMS (HestErrorSourcePciExpressDeviceAerParser)
+ );
+
+ Offset += sizeof (EFI_ACPI_6_5_PCI_EXPRESS_DEVICE_AER_STRUCTURE);
+ break;
+ case EFI_ACPI_6_5_PCI_EXPRESS_BRIDGE_AER:
+ ParseAcpi (
+ TRUE,
+ 2,
+ "PCI Express Bridge AER Structure",
+ ErrorSourcePtr,
+ sizeof (EFI_ACPI_6_5_PCI_EXPRESS_BRIDGE_AER_STRUCTURE),
+ PARSER_PARAMS (HestErrorSourcePciExpressBridgeAerParser)
+ );
+
+ Offset += sizeof (EFI_ACPI_6_5_PCI_EXPRESS_BRIDGE_AER_STRUCTURE);
+ break;
+ case EFI_ACPI_6_5_GENERIC_HARDWARE_ERROR:
+ ParseAcpi (
+ TRUE,
+ 2,
+ "Generic Hardware Error Source Structure",
+ ErrorSourcePtr,
+ sizeof (EFI_ACPI_6_5_GENERIC_HARDWARE_ERROR_SOURCE_STRUCTURE),
+ PARSER_PARAMS (HestErrorSourceGhesParser)
+ );
+
+ Offset += sizeof (EFI_ACPI_6_5_GENERIC_HARDWARE_ERROR_SOURCE_STRUCTURE);
+ break;
+ case EFI_ACPI_6_5_GENERIC_HARDWARE_ERROR_VERSION_2:
+ ParseAcpi (
+ TRUE,
+ 2,
+ "Generic Hardware Error Source V2 Structure",
+ ErrorSourcePtr,
+ sizeof (
+ EFI_ACPI_6_5_GENERIC_HARDWARE_ERROR_SOURCE_VERSION_2_STRUCTURE
+ ),
+ PARSER_PARAMS (HestErrorSourceGhesv2Parser)
+ );
+
+ Offset +=
+ sizeof (
+ EFI_ACPI_6_5_GENERIC_HARDWARE_ERROR_SOURCE_VERSION_2_STRUCTURE
+ );
+ break;
+ case EFI_ACPI_6_5_IA32_ARCHITECTURE_DEFERRED_MACHINE_CHECK:
+ ParseAcpi (
+ TRUE,
+ 2,
+ "IA-32 Architecture Deferred Machine Check",
+ ErrorSourcePtr,
+ sizeof (EFI_ACPI_6_5_IA32_ARCHITECTURE_DEFERRED_MACHINE_CHECK_STRUCTURE),
+ PARSER_PARAMS (HestErrorSourceIA32ArchDeferredMachineCheckParser)
+ );
+
+ Offset +=
+ sizeof (EFI_ACPI_6_5_IA32_ARCHITECTURE_DEFERRED_MACHINE_CHECK_STRUCTURE),
+
+ Status = DumpIA32ArchMachineCheckErrorBankStructure (
+ Ptr,
+ AcpiTableLength,
+ &Offset
+ );
+ if (EFI_ERROR (Status)) {
+ return;
+ }
+
+ break;
+ default:
+ IncrementErrorCount ();
+ Print (L"ERROR: Invalid Error Source Descriptor Type(%d).\n", *mHestErrorSourceType);
+ return;
+ } // switch
+
+ ParsedErrorSourceCount++;
+ } // while
+
+ if (ParsedErrorSourceCount < *mHestErrorSourceCount) {
+ IncrementErrorCount ();
+ Print (
+ L"ERROR: Invalid Error Source Count... Real:%d, ErrorSourceCount:%d\n",
+ ParsedErrorSourceCount,
+ *mHestErrorSourceCount
+ );
+ return;
+ }
+
+ if (Offset < AcpiTableLength) {
+ IncrementErrorCount ();
+ Print (L"ERROR: Invalid Error Source Count, There's more data...\n");
+ return;
+ }
+}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c index 2a1357c853..8f48927da7 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c @@ -1,7 +1,7 @@ /** @file
HMAT table parser
- Copyright (c) 2020, Arm Limited.
+ Copyright (c) 2020 - 2024, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -54,6 +54,7 @@ STATIC CONST CHAR16 *SllbiNames[] = { This function validates the Cache Attributes field.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -61,8 +62,9 @@ STATIC VOID
EFIAPI
ValidateCacheAttributes (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *
@@ -109,13 +111,15 @@ ValidateCacheAttributes ( @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
STATIC
VOID
EFIAPI
DumpCacheAttributes (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hpet/HpetParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hpet/HpetParser.c index 1b4c38f2af..c8ccdd4785 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hpet/HpetParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hpet/HpetParser.c @@ -1,6 +1,7 @@ /** @file
HPET table parser
+ Copyright (c) 2024, Arm Limited. All rights reserved.
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -24,7 +25,8 @@ VOID EFIAPI
DumpHpetPageProtectionFlag (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
@@ -71,7 +73,8 @@ VOID EFIAPI
DumpHpetFlag (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
@@ -101,7 +104,8 @@ VOID EFIAPI
DumpCounterSize (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
@@ -121,6 +125,7 @@ DumpCounterSize ( This function validates the flags.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -128,8 +133,9 @@ STATIC VOID
EFIAPI
ValidateHpetRevId (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
if ((*(UINT8 *)Ptr) == 0) {
@@ -163,7 +169,8 @@ VOID EFIAPI
DumpHpetEventTimerBlockId (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c index 599cf0ee8f..299ea4fd45 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -1,7 +1,7 @@ /** @file
IORT table parser
- Copyright (c) 2016 - 2022, Arm Limited. All rights reserved.
+ Copyright (c) 2016 - 2024, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -46,6 +46,7 @@ STATIC CONST UINT32 *RmrMemDescOffset; This function validates the ID Mapping array count for the ITS node.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -53,8 +54,9 @@ STATIC VOID
EFIAPI
ValidateItsIdMappingCount (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
if (*(UINT32 *)Ptr != 0) {
@@ -68,6 +70,7 @@ ValidateItsIdMappingCount ( Monitoring Counter Group (PMCG) node.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -75,8 +78,9 @@ STATIC VOID
EFIAPI
ValidatePmcgIdMappingCount (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
if (*(UINT32 *)Ptr > 1) {
@@ -89,6 +93,7 @@ ValidatePmcgIdMappingCount ( This function validates the ID Mapping array offset for the ITS node.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -96,8 +101,9 @@ STATIC VOID
EFIAPI
ValidateItsIdArrayReference (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
if (*(UINT32 *)Ptr != 0) {
@@ -111,6 +117,7 @@ ValidateItsIdArrayReference ( and is 64K aligned.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -118,8 +125,9 @@ STATIC VOID
EFIAPI
ValidatePhysicalRange (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
UINT64 Value;
@@ -135,6 +143,7 @@ ValidatePhysicalRange ( This function validates that the RMR memory range descriptor count.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -142,8 +151,9 @@ STATIC VOID
EFIAPI
ValidateRmrMemDescCount (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
if (*(UINT32 *)Ptr == 0) {
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c index 3a4f246347..56ab507ef1 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -1,8 +1,9 @@ /** @file
MADT table parser
- Copyright (c) 2016 - 2023, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2024, Arm Limited. All rights reserved.
Copyright (c) 2022, AMD Incorporated. All rights reserved.
+ Copyright (c) 2024, Loongson Technology Corporation Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -28,6 +29,7 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; This function validates the System Vector Base in the GICD.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -35,8 +37,9 @@ STATIC VOID
EFIAPI
ValidateGICDSystemVectorBase (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
if (*(UINT32 *)Ptr != 0) {
@@ -51,6 +54,7 @@ ValidateGICDSystemVectorBase ( This function validates the SPE Overflow Interrupt in the GICC.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -58,8 +62,9 @@ STATIC VOID
EFIAPI
ValidateSpeOverflowInterrupt (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
UINT16 SpeOverflowInterrupt;
@@ -101,6 +106,7 @@ ValidateSpeOverflowInterrupt ( This function validates the TRBE Interrupt in the GICC.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -108,8 +114,9 @@ STATIC VOID
EFIAPI
ValidateTrbeInterrupt (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
UINT16 TrbeInterrupt;
@@ -263,12 +270,14 @@ STATIC CONST ACPI_PARSER LocalApicFlags[] = { @param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
VOID
EFIAPI
DumpLocalApicBitFlags (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
@@ -326,6 +335,92 @@ STATIC CONST ACPI_PARSER LocalX2ApicNmi[] = { };
/**
+ An ACPI_PARSER array describing the Core Pragrammable Interrupt Controller (CORE PIC) Structure.
+**/
+STATIC CONST ACPI_PARSER CorePic[] = {
+ { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
+ { L"Version", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"ACPI Processor ID", 4, 3, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Physical Processor ID", 4, 7, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Flags", 4, 11, L"0x%x", NULL, NULL, NULL, NULL }
+};
+
+/**
+ An ACPI_PARSER array describing the Leagcy I/O Programmable Interrupt Controller (LIO PIC) Structure.
+**/
+STATIC CONST ACPI_PARSER LegacyIoPic[] = {
+ { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
+ { L"Version", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Base Address", 8, 3, L"0x%lx", NULL, NULL, NULL, NULL },
+ { L"Size", 2, 11, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Cascade Vector", 2, 13, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Cascade vector mapping", 8, 15, L"0x%lx", NULL, NULL, NULL, NULL }
+};
+
+/**
+ An ACPI_PARSER array describing the HyperTransport Programmable Interrupt Controller (HT PIC) Structure.
+**/
+STATIC CONST ACPI_PARSER HyperTransportPic[] = {
+ { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
+ { L"Version", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Base Address", 8, 3, L"0x%lx", NULL, NULL, NULL, NULL },
+ { L"Size", 2, 11, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Cascade Vector", 8, 13, L"0x%lx", NULL, NULL, NULL, NULL }
+};
+
+/**
+ An ACPI_PARSER array describing the Extend I/0 Programmable Interrupt Controller (EIO PIC) Structure.
+**/
+STATIC CONST ACPI_PARSER ExtendIoPic[] = {
+ { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
+ { L"Version", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Cascade Vector", 1, 3, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Node", 1, 4, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Node Map", 8, 5, L"0x%lx", NULL, NULL, NULL, NULL }
+};
+
+/**
+ An ACPI_PARSER array describing the MSI Programmable Interrupt Controller (MSI PIC) Structure.
+**/
+STATIC CONST ACPI_PARSER MsiPic[] = {
+ { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
+ { L"Version", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Message Address", 8, 3, L"0x%lx", NULL, NULL, NULL, NULL },
+ { L"Start", 4, 11, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Count", 4, 15, L"0x%x", NULL, NULL, NULL, NULL }
+};
+
+/**
+ An ACPI_PARSER array describing the Bridge I/O Programmable Interrupt Controller (BIO PIC) Structure.
+**/
+STATIC CONST ACPI_PARSER BridgeIoPic[] = {
+ { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
+ { L"Version", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Base Address", 8, 3, L"0x%lx", NULL, NULL, NULL, NULL },
+ { L"Size", 2, 11, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Hardware ID", 2, 13, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"GSI base", 2, 15, L"0x%x", NULL, NULL, NULL, NULL }
+};
+
+/**
+ An ACPI_PARSER array describing the LPC Programmable Interrupt Controller (LPC PIC) Structure.
+**/
+STATIC CONST ACPI_PARSER LpcPic[] = {
+ { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
+ { L"Version", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Base Address", 8, 3, L"0x%lx", NULL, NULL, NULL, NULL },
+ { L"Size", 2, 11, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Cascade vector", 2, 13, L"0x%x", NULL, NULL, NULL, NULL }
+};
+
+/**
An ACPI_PARSER array describing the ACPI MADT Table.
**/
STATIC CONST ACPI_PARSER MadtParser[] = {
@@ -572,6 +667,97 @@ ParseAcpiMadt ( break;
}
+ case EFI_ACPI_6_5_CORE_PIC:
+ {
+ ParseAcpi (
+ TRUE,
+ 2,
+ "CORE PIC",
+ InterruptContollerPtr,
+ *MadtInterruptControllerLength,
+ PARSER_PARAMS (CorePic)
+ );
+ break;
+ }
+
+ case EFI_ACPI_6_5_LIO_PIC:
+ {
+ ParseAcpi (
+ TRUE,
+ 2,
+ "LIO PIC",
+ InterruptContollerPtr,
+ *MadtInterruptControllerLength,
+ PARSER_PARAMS (LegacyIoPic)
+ );
+ break;
+ }
+
+ case EFI_ACPI_6_5_HT_PIC:
+ {
+ ParseAcpi (
+ TRUE,
+ 2,
+ "HT PIC",
+ InterruptContollerPtr,
+ *MadtInterruptControllerLength,
+ PARSER_PARAMS (HyperTransportPic)
+ );
+ break;
+ }
+
+ case EFI_ACPI_6_5_EIO_PIC:
+ {
+ ParseAcpi (
+ TRUE,
+ 2,
+ "EIO PIC",
+ InterruptContollerPtr,
+ *MadtInterruptControllerLength,
+ PARSER_PARAMS (ExtendIoPic)
+ );
+ break;
+ }
+
+ case EFI_ACPI_6_5_MSI_PIC:
+ {
+ ParseAcpi (
+ TRUE,
+ 2,
+ "MSI PIC",
+ InterruptContollerPtr,
+ *MadtInterruptControllerLength,
+ PARSER_PARAMS (MsiPic)
+ );
+ break;
+ }
+
+ case EFI_ACPI_6_5_BIO_PIC:
+ {
+ ParseAcpi (
+ TRUE,
+ 2,
+ "BIO PIC",
+ InterruptContollerPtr,
+ *MadtInterruptControllerLength,
+ PARSER_PARAMS (BridgeIoPic)
+ );
+ break;
+ }
+
+ case EFI_ACPI_6_5_LPC_PIC:
+ {
+ ParseAcpi (
+ TRUE,
+ 2,
+ "LPC PIC",
+ InterruptContollerPtr,
+ *MadtInterruptControllerLength,
+ PARSER_PARAMS (LpcPic)
+ );
+ break;
+ }
+
default:
{
IncrementErrorCount ();
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mpam/MpamParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mpam/MpamParser.c new file mode 100644 index 0000000000..acbb859fc3 --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mpam/MpamParser.c @@ -0,0 +1,1241 @@ +/** @file
+ MPAM table parser
+
+ Copyright (c) 2024, Arm Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Specification Reference:
+ - [1] ACPI for Memory System Resource Partitioning and Monitoring 2.0
+ (https://developer.arm.com/documentation/den0065/latest)
+
+ @par Glossary:
+ - MPAM - Memory System Resource Partitioning And Monitoring
+ - MSC - Memory System Component
+ - PCC - Platform Communication Channel
+ - RIS - Resource Instance Selection
+ - SMMU - Arm System Memory Management Unit
+ **/
+
+#include <IndustryStandard/Mpam.h>
+#include <Library/PrintLib.h>
+#include <Library/UefiLib.h>
+#include "AcpiParser.h"
+#include "AcpiView.h"
+#include "AcpiViewConfig.h"
+
+// Local variables
+STATIC CONST UINT8 *MscInterfaceType;
+STATIC CONST UINT8 *ResourceLocatorType;
+STATIC UINT32 MpamMscNodeStart;
+STATIC CONST UINT16 *MpamMscNodeLength;
+STATIC CONST UINT32 *NumberOfMscResources;
+STATIC CONST UINT32 *NumberOfFunctionalDependencies;
+STATIC CONST UINT32 *NumberOfInterconnectDescriptors;
+STATIC CONST UINT64 *InterconnectTableOffset;
+STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
+
+// Array of locator type names. New types should be added keeping the order
+// preserved as locator type is used to index into the array while parsing.
+STATIC CONST CHAR16 *MpamMscLocatorTitles[] = {
+ L"Processor cache",
+ L"Memory",
+ L"SMMU",
+ L"Memory cache",
+ L"ACPI device",
+ L"Interconnect"
+};
+
+/**
+ When the length of the table is insufficient to be parsed, this function could
+ be used to display an appropriate error message.
+
+ @param [in] ErrorMsg Error message string that has to be appended to the
+ main error log. This string could explain the reason
+ why a insufficient length error was encountered in
+ the first place.
+**/
+STATIC
+VOID
+EFIAPI
+MpamLengthError (
+ IN CONST CHAR16 *ErrorMsg
+ )
+{
+ IncrementErrorCount ();
+ Print (L"\nERROR : ");
+ Print (ErrorMsg);
+ Print (
+ L"\nError : Insufficient MPAM MSC Node length. Table length : %u.\n",
+ *(AcpiHdrInfo.Length)
+ );
+}
+
+/**
+ This function validates reserved fields. Any reserved field within the MPAM
+ specification must be 0.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information. For this
+ particular function, context holds the size of the
+ reserved field that needs to be validated.
+**/
+STATIC
+VOID
+EFIAPI
+ValidateReserved (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ while (Length > 0) {
+ if (Ptr[Length-1] != 0) {
+ IncrementErrorCount ();
+ Print (L"\nERROR : Reserved field must be 0\n");
+ break;
+ }
+
+ Length--;
+ }
+}
+
+/**
+ This function validates bit-length reserved fields. Any reserved field within
+ the MPAM specification must be 0.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information. For this
+ particular function, context holds the size of the
+ reserved field that needs to be validated.
+**/
+STATIC
+VOID
+EFIAPI
+ValidateReservedBits (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT32 ByteLength;
+
+ ByteLength = (Length + 7) >> 3;
+ ValidateReserved (Ptr, ByteLength, Context);
+}
+
+/**
+ This function validates the MMIO size within the MSC node body for MPAM ACPI
+ table. MPAM ACPI specification states that the MMIO size for an MSC having PCC
+ type interface should be zero.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information. For this
+ function, context holds the parent/double pointer to a
+ variable holding the interface type. Make sure to call
+ the function accordingly.
+**/
+STATIC
+VOID
+EFIAPI
+ValidateMmioSize (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 InterfaceType;
+ UINT32 MmioSize;
+
+ InterfaceType = *MscInterfaceType;
+
+ if (InterfaceType == EFI_ACPI_MPAM_INTERFACE_PCC) {
+ MmioSize = *((UINT32 *)Ptr);
+
+ if (MmioSize != 0) {
+ IncrementErrorCount ();
+ Print (
+ L"\nERROR: MMIO size must be 0 for PCC interface type. Size - %u\n",
+ MmioSize
+ );
+ }
+ }
+}
+
+/**
+ This function decodes and validates the link type for MPAM's interconnect
+ descriptor. Valid links are of NUMA and PROC type.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information. For this
+ function, context is ignored.
+**/
+STATIC
+VOID
+EFIAPI
+DecodeLinkType (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 LinkType;
+
+ LinkType = *Ptr;
+
+ if (LinkType == EFI_ACPI_MPAM_LINK_TYPE_NUMA) {
+ Print (
+ L" (NUMA)"
+ );
+ } else if (LinkType == EFI_ACPI_MPAM_LINK_TYPE_PROC) {
+ Print (
+ L" (PROC)"
+ );
+ } else {
+ IncrementErrorCount ();
+ Print (
+ L"\nERROR: Invalid link type - %u\n",
+ (UINT32)LinkType
+ );
+ }
+}
+
+/**
+ This function decodes the hardware ID field present within MPAM ACPI table.
+ The specification states that the hardware ID has to be set to zero if not
+ being used.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information. For this
+ function, context is ignored.
+**/
+STATIC
+VOID
+EFIAPI
+DecodeHardwareId (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT64 HardwareId;
+
+ HardwareId = *((UINT64 *)Ptr);
+
+ if (HardwareId != 0) {
+ Print (L" (");
+ Dump8Chars (NULL, Ptr, Length);
+ Print (L")");
+ }
+}
+
+/**
+ This function decodes and validates the interface type for MPAM. Valid
+ interfaces are of MMIO and PCC type.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information. For this
+ function, context is ignored.
+**/
+STATIC
+VOID
+EFIAPI
+DecodeInterfaceType (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 InterfaceType;
+
+ InterfaceType = *Ptr;
+
+ if (InterfaceType == EFI_ACPI_MPAM_INTERFACE_MMIO) {
+ Print (L" (MMIO)");
+ } else if (InterfaceType == EFI_ACPI_MPAM_INTERFACE_PCC) {
+ Print (L" (PCC)");
+ } else {
+ IncrementErrorCount ();
+ Print (
+ L"\nERROR: Invalid interface type - %u\n",
+ (UINT32)InterfaceType
+ );
+ }
+}
+
+/**
+ This function decodes the interrupt mode flag for MPAM. Interrupt mode could
+ either be "edge triggered" or "level triggered".
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information. For this
+ function, context holds the parent/double pointer to a
+ variable holding the interrupt gsiv. Make sure to call
+ the function accordingly.
+**/
+STATIC
+VOID
+EFIAPI
+DecodeInterruptMode (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 InterruptMode;
+
+ InterruptMode = *Ptr;
+
+ if (InterruptMode == EFI_ACPI_MPAM_INTERRUPT_LEVEL_TRIGGERED) {
+ Print (L" (Level triggered)");
+ } else {
+ Print (L" (Edge triggered)");
+ }
+}
+
+/**
+ This function decodes the interrupt type flag for MPAM. Interrupt type could
+ be "wired interrupt". Other values are reserved at this point.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information. For this
+ function, context holds the parent/double pointer to a
+ variable holding the interrupt gsiv. Make sure to call
+ the function accordingly.
+**/
+STATIC
+VOID
+EFIAPI
+DecodeInterruptType (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 InterruptType;
+
+ InterruptType = *Ptr;
+
+ if (InterruptType == EFI_ACPI_MPAM_INTERRUPT_WIRED) {
+ Print (L" (Wired interrupt)");
+ } else {
+ IncrementWarningCount ();
+ Print (L" (Reserved value!)");
+ }
+}
+
+/**
+ This function decodes the interrupt affinity valid flag for MPAM. Interrupt
+ affinity could be either be valid or not.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information. For this
+ function, context holds the parent/double pointer to a
+ variable holding the interrupt gsiv. Make sure to call
+ the function accordingly.
+**/
+STATIC
+VOID
+EFIAPI
+DecodeInterruptAffinityValid (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 InterruptAffinityValid;
+
+ InterruptAffinityValid = *Ptr;
+
+ if (InterruptAffinityValid != EFI_ACPI_MPAM_INTERRUPT_AFFINITY_VALID) {
+ Print (L" (Affinity not valid)");
+ } else {
+ Print (L" (Affinity valid)");
+ }
+}
+
+/**
+ This function decodes the interrupt affinity type flag for MPAM. Interrupt
+ affinity type could either be "Processor affinity" or "Processor container
+ affinity"
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information. For this
+ function, context holds the parent/double pointer to a
+ variable holding the interrupt gsiv. Make sure to call
+ the function accordingly.
+**/
+STATIC
+VOID
+EFIAPI
+DecodeInterruptAffinityType (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 InterruptAffinityType;
+
+ InterruptAffinityType = *Ptr;
+
+ if (InterruptAffinityType == EFI_ACPI_MPAM_INTERRUPT_PROCESSOR_AFFINITY) {
+ Print (L" (Processor affinity)");
+ } else {
+ Print (L" (Processor container affinity)");
+ }
+}
+
+/**
+ This function decodes the locator type for a particular MPAM MSC resource.
+
+ @param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
+ @param [in] Context Pointer to context specific information. For this
+ function, context holds the parent/double pointer to a
+ variable holding the interrupt gsiv. Make sure to call
+ the function accordingly.
+**/
+STATIC
+VOID
+EFIAPI
+DecodeLocatorType (
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
+ )
+{
+ UINT8 LocatorType;
+
+ LocatorType = *Ptr;
+
+ if (LocatorType <= EFI_ACPI_MPAM_LOCATION_INTERCONNECT) {
+ Print (L" (%s)", MpamMscLocatorTitles[LocatorType]);
+ } else if (LocatorType == EFI_ACPI_MPAM_LOCATION_UNKNOWN) {
+ Print (L" (Unknown)");
+ } else {
+ Print (L" (Reserved)");
+ }
+}
+
+/**
+ ACPI_PARSER array describing MPAM MSC interrupt flags.
+**/
+STATIC CONST ACPI_PARSER MpamMscInterruptFlagParser[] = {
+ { L"Interrupt Mode", 1, 0, L"%u", NULL, NULL,
+ DecodeInterruptMode, NULL },
+ { L"Interrupt Type", 2, 1, L"%u", NULL, NULL,
+ DecodeInterruptType, NULL },
+ { L"Affinity Type", 1, 3, L"%u", NULL, NULL,
+ DecodeInterruptAffinityType, NULL },
+ { L"Affinity Valid", 1, 4, L"%u", NULL, NULL,
+ DecodeInterruptAffinityValid, NULL },
+ { L"Reserved", 27, 5, NULL, DumpReservedBits, NULL,
+ ValidateReservedBits, NULL }
+};
+
+/**
+ This function traces MPAM MSC Interrupt Flags.
+ 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.
+ @param [in] Length Length of the field.
+**/
+STATIC
+VOID
+EFIAPI
+DumpMpamMscInterruptFlags (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
+ )
+{
+ Print (L"%u\n", *(UINT32 *)Ptr);
+
+ ParseAcpiBitFields (
+ TRUE,
+ 2,
+ NULL,
+ Ptr,
+ 4,
+ PARSER_PARAMS (MpamMscInterruptFlagParser)
+ );
+}
+
+/**
+ ACPI_PARSER array describing the MPAM MSC processor cache locator field.
+**/
+STATIC CONST ACPI_PARSER MpamMscProcessorCacheLocatorParser[] = {
+ { L"Cache reference", 8, 0, L"%lu", NULL, NULL, NULL, NULL },
+ { L"Reserved", 4, 8, NULL, DumpReserved, NULL,
+ ValidateReserved, NULL }
+};
+
+/**
+ ACPI_PARSER array describing the MPAM MSC memory locator field.
+**/
+STATIC CONST ACPI_PARSER MpamMscMemoryLocatorParser[] = {
+ { L"Proximity domain", 8, 0, L"%lu", NULL, NULL, NULL, NULL },
+ { L"Reserved", 4, 8, NULL, DumpReserved, NULL,
+ ValidateReserved, NULL }
+};
+
+/**
+ ACPI_PARSER array describing the MPAM MSC SMMU locator field.
+**/
+STATIC CONST ACPI_PARSER MpamMscSMMULocatorParser[] = {
+ { L"SMMU interface", 8, 0, L"%lu", NULL, NULL, NULL, NULL },
+ { L"Reserved", 4, 8, NULL, DumpReserved, NULL,
+ ValidateReserved, NULL }
+};
+
+/**
+ ACPI_PARSER array describing the MPAM MSC memory cache locator field.
+**/
+STATIC CONST ACPI_PARSER MpamMscMemoryCacheLocatorParser[] = {
+ { L"Reserved", 7, 0, NULL, DumpReserved, NULL,
+ ValidateReserved, NULL },
+ { L"Level", 1, 7, L"%u", NULL, NULL,NULL, NULL },
+ { L"Reference", 4, 8, L"%u", NULL, NULL,NULL, NULL }
+};
+
+/**
+ ACPI_PARSER array describing the MPAM MSC ACPI device locator field.
+**/
+STATIC CONST ACPI_PARSER MpamMscAcpiDeviceLocatorParser[] = {
+ { L"ACPI hardware ID", 8, 0, L"0x%lx", NULL, NULL,
+ DecodeHardwareId, NULL },
+ { L"ACPI unique ID", 4, 8, L"%u", NULL, NULL,NULL,NULL }
+};
+
+/**
+ ACPI_PARSER array describing the MPAM MSC interconnect locator field.
+**/
+STATIC CONST ACPI_PARSER MpamMscInterconnectLocatorParser[] = {
+ { L"Interconnect desc tbl offset", 8, 0, L"%lu", NULL,
+ (VOID **)&InterconnectTableOffset, NULL, NULL },
+ { L"Reserved", 4, 8, NULL, DumpReserved,
+ NULL, ValidateReserved, NULL }
+};
+
+/**
+ ACPI_PARSER array describing the MPAM MSC generic resource locator field.
+**/
+STATIC CONST ACPI_PARSER MpamMscGenericLocatorParser[] = {
+ { L"Descriptor1", 8, 0, L"%lu", NULL, NULL, NULL, NULL },
+ { L"Descriptor2", 4, 8, L"%u", NULL, NULL, NULL, NULL }
+};
+
+/**
+ This function parses the locator field within the resource node for ACPI MPAM
+ table. The parsing is based on the locator type field.
+
+ @param [in] Format Optional format string for tracing the data.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
+**/
+STATIC
+VOID
+EFIAPI
+ParseLocator (
+ IN CONST CHAR16 *Format OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length
+ )
+{
+ Print (L"\n");
+ switch (*ResourceLocatorType) {
+ case EFI_ACPI_MPAM_LOCATION_PROCESSOR_CACHE:
+ ParseAcpi (
+ TRUE,
+ 2,
+ NULL,
+ Ptr,
+ 12,
+ PARSER_PARAMS (MpamMscProcessorCacheLocatorParser)
+ );
+ break;
+ case EFI_ACPI_MPAM_LOCATION_MEMORY:
+ ParseAcpi (
+ TRUE,
+ 2,
+ NULL,
+ Ptr,
+ 12,
+ PARSER_PARAMS (MpamMscMemoryLocatorParser)
+ );
+ break;
+ case EFI_ACPI_MPAM_LOCATION_SMMU:
+ ParseAcpi (
+ TRUE,
+ 2,
+ NULL,
+ Ptr,
+ 12,
+ PARSER_PARAMS (MpamMscSMMULocatorParser)
+ );
+ break;
+ case EFI_ACPI_MPAM_LOCATION_MEMORY_CACHE:
+ ParseAcpi (
+ TRUE,
+ 2,
+ NULL,
+ Ptr,
+ 12,
+ PARSER_PARAMS (MpamMscMemoryCacheLocatorParser)
+ );
+ break;
+ case EFI_ACPI_MPAM_LOCATION_ACPI_DEVICE:
+ ParseAcpi (
+ TRUE,
+ 2,
+ NULL,
+ Ptr,
+ 12,
+ PARSER_PARAMS (MpamMscAcpiDeviceLocatorParser)
+ );
+ break;
+ case EFI_ACPI_MPAM_LOCATION_INTERCONNECT:
+ ParseAcpi (
+ TRUE,
+ 2,
+ NULL,
+ Ptr,
+ 12,
+ PARSER_PARAMS (MpamMscInterconnectLocatorParser)
+ );
+ break;
+ // For both UNKNOWN and RESERVED locator types, the locator is parsed using
+ // the generic locator parser as the spec does not define any format.
+ case EFI_ACPI_MPAM_LOCATION_UNKNOWN:
+ ParseAcpi (
+ TRUE,
+ 2,
+ NULL,
+ Ptr,
+ 12,
+ PARSER_PARAMS (MpamMscGenericLocatorParser)
+ );
+ break;
+ default:
+ Print (L"\nWARNING : Reserved locator type\n");
+ ParseAcpi (
+ TRUE,
+ 2,
+ NULL,
+ Ptr,
+ 12,
+ PARSER_PARAMS (MpamMscGenericLocatorParser)
+ );
+ IncrementWarningCount ();
+ break;
+ } // switch
+}
+
+/**
+ ACPI_PARSER array describing the Generic ACPI MPAM table header.
+**/
+STATIC CONST ACPI_PARSER MpamParser[] = {
+ PARSE_ACPI_HEADER (&AcpiHdrInfo)
+};
+
+/**
+ ACPI_PARSER array describing the MPAM MSC node object.
+**/
+STATIC CONST ACPI_PARSER MpamMscNodeParser[] = {
+ { L"Length", 2, 0, L"%u", NULL,
+ (VOID **)&MpamMscNodeLength, NULL, NULL },
+ // Once Interface type is decoded, the address of interface type field is
+ // captured into InterfaceType pointer so that it could be used to check if
+ // MMIO Size field is set as per the specification.
+ { L"Interface type", 1, 2, L"0x%x", NULL,
+ (VOID **)&MscInterfaceType, DecodeInterfaceType, NULL },
+ { L"Reserved", 1, 3, NULL, DumpReserved,
+ NULL, ValidateReserved, NULL },
+ { L"Identifier", 4, 4, L"%u", NULL,
+ NULL, NULL, NULL },
+ { L"Base address", 8, 8, L"0x%lx", NULL,
+ NULL, NULL, NULL },
+ { L"MMIO Size", 4, 16, L"0x%x", NULL,
+ NULL, ValidateMmioSize, (VOID **)&MscInterfaceType },
+ { L"Overflow interrupt", 4, 20, L"%u", NULL,
+ NULL, NULL, NULL },
+ { L"Overflow interrupt flags", 4, 24, NULL, DumpMpamMscInterruptFlags,
+ NULL, NULL, NULL },
+ { L"Reserved1", 4, 28, NULL, DumpReserved,
+ NULL, ValidateReserved, NULL },
+ { L"Overflow interrupt affinity", 4, 32, L"0x%x", NULL,
+ NULL, NULL, NULL },
+ { L"Error interrupt", 4, 36, L"%u", NULL,
+ NULL, NULL, NULL },
+ { L"Error interrupt flags", 4, 40, NULL, DumpMpamMscInterruptFlags,
+ NULL, NULL, NULL },
+ { L"Reserved2", 4, 44, NULL, DumpReserved,
+ NULL, ValidateReserved, NULL },
+ { L"Error interrupt affinity", 4, 48, L"0x%x", NULL,
+ NULL, NULL, NULL },
+ { L"MAX_NRDY_USEC", 4, 52, L"0x%x", NULL,
+ NULL, NULL, NULL },
+ { L"Hardware ID of linked device", 8, 56, L"0x%lx", NULL,
+ NULL, DecodeHardwareId, NULL },
+ { L"Instance ID of linked device", 4, 64, L"0x%x", NULL,
+ NULL, NULL, NULL },
+ { L"Number of resource nodes", 4, 68, L"%u", NULL,
+ (VOID **)&NumberOfMscResources, NULL, NULL }
+};
+
+/**
+ ACPI_PARSER array describing the MPAM MSC resource.
+**/
+STATIC CONST ACPI_PARSER MpamMscResourceParser[] = {
+ { L"Identifier", 4, 0, L"%u", NULL,
+ NULL, NULL, NULL },
+ { L"RIS index", 1, 4, L"%u", NULL,
+ NULL, NULL, NULL },
+ { L"Reserved1", 2, 5, NULL, DumpReserved,
+ NULL, ValidateReserved, NULL },
+ { L"Locator type", 1, 7, L"0x%x", NULL,
+ (VOID **)&ResourceLocatorType,
+ DecodeLocatorType, NULL },
+ { L"Locator", 12, 8, NULL, ParseLocator,
+ NULL, NULL, NULL },
+ { L"Number of func dependencies", 4, 20, L"%u", NULL,
+ (VOID **)&NumberOfFunctionalDependencies, NULL, NULL }
+};
+
+/**
+ ACPI_PARSER array describing the MPAM MSC resource's functional dependencies.
+**/
+STATIC CONST ACPI_PARSER MpamMscFunctionalDependencyParser[] = {
+ { L"Producer", 4, 0, L"0x%x", NULL, NULL, NULL, NULL },
+ { L"Reserved", 4, 4, NULL, DumpReserved,
+ NULL, ValidateReserved, NULL },
+};
+
+/**
+ ACPI_PARSER array describing the interconnect descriptor table associated with
+ the interconnect locator type.
+**/
+STATIC CONST ACPI_PARSER MpamInterconnectDescriptorTableParser[] = {
+ { L"Signature", 16, 0,
+ L"%x%x%x%x-%x%x-%x%x-%x%x-%x%x%x%x%x%x", Dump16Chars, NULL, NULL, NULL },
+ { L"Number of Interconnect desc", 4, 16,L"0x%x", NULL,
+ (VOID **)&NumberOfInterconnectDescriptors, NULL, NULL }
+};
+
+/**
+ ACPI_PARSER array describing the interconnect descriptor associated with the
+ interconnect locator type.
+**/
+STATIC CONST ACPI_PARSER MpamInterconnectDescriptorParser[] = {
+ { L"Source ID", 4, 0, L"%u", NULL, NULL, NULL, NULL },
+ { L"Destination ID", 4, 4, L"%u", NULL, NULL, NULL, NULL },
+ { L"Link type", 1, 8, L"0x%x", NULL,
+ NULL, DecodeLinkType, NULL },
+ { L"Reserved", 3, 9, NULL, DumpReserved, NULL,
+ ValidateReserved, NULL }
+};
+
+/**
+ PrintBlockTitle could be used to print the title of blocks that
+ appear more than once in the MPAM ACPI table.
+
+ @param [in] Indent Number of spaces to add to the global table
+ indent. The global table indent is 0 by
+ default; however this value is updated on
+ entry to the ParseAcpi() by adding the indent
+ value provided to ParseAcpi() and restored
+ back on exit. Therefore the total indent in
+ the output is dependent on from where this
+ function is called.
+ @param [in] Title Title string to be used for the block.
+ @param [in] Index Index of the block.
+**/
+STATIC
+VOID
+EFIAPI
+PrintBlockTitle (
+ IN UINT32 Indent,
+ IN CONST CHAR16 *Title,
+ IN CONST UINT32 Index
+ )
+{
+ Print (L"\n");
+ PrintFieldName (Indent, Title);
+ Print (L"%u\n\n", Index);
+}
+
+/**
+ This function parses the interconnect descriptor(s) associated with
+ an interconnect type locator object.
+
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] AcpiTableLength Length of the ACPI table.
+ @param [in, out] Offset Pointer to current offset within Ptr.
+
+Returns:
+
+ Status
+
+ EFI_SUCCESS MPAM MSC nodes were parsed properly.
+ EFI_BAD_BUFFER_SIZE The buffer pointer provided as input is not
+ long enough to be parsed correctly.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+ParseInterconnectDescriptors (
+ IN UINT8 *CONST Ptr,
+ IN CONST UINT32 AcpiTableLength,
+ IN OUT UINT32 *CONST Offset
+ )
+{
+ UINT32 InterconnectDescriptorIndex;
+
+ InterconnectDescriptorIndex = 0;
+
+ if (NumberOfInterconnectDescriptors == NULL) {
+ MpamLengthError (L"Number of interconnect descriptors not set!");
+ return EFI_BAD_BUFFER_SIZE;
+ }
+
+ while (InterconnectDescriptorIndex < *NumberOfInterconnectDescriptors) {
+ PrintBlockTitle (
+ 6,
+ L"* Interconnect descriptor *",
+ InterconnectDescriptorIndex
+ );
+
+ // Parse interconnect descriptor
+ *Offset += ParseAcpi (
+ TRUE,
+ 4,
+ NULL,
+ Ptr + *Offset,
+ AcpiTableLength - *Offset,
+ PARSER_PARAMS (MpamInterconnectDescriptorParser)
+ );
+
+ InterconnectDescriptorIndex++;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function parses the interconnect descriptor table associated with an
+ interconnect type locator object. It also performs necessary validation to
+ make sure the interconnect descriptor is at a valid location.
+
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] AcpiTableLength Length of the ACPI table.
+ @param [in] Offset Pointer to current offset within Ptr.
+ @param [in] InterconnectOffset Offset to the interconnect descriptor table.
+
+Returns:
+
+ Status
+
+ EFI_SUCCESS MPAM MSC nodes were parsed properly.
+ EFI_BAD_BUFFER_SIZE The buffer pointer provided as input is not
+ long enough to be parsed correctly.
+ EFI_INVALID_PARAMETER The Offset parameter encoded within the Ptr
+ buffer is not valid.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+ParseInterconnectDescriptorTable (
+ IN UINT8 *CONST Ptr,
+ IN CONST UINT32 AcpiTableLength,
+ IN UINT32 Offset,
+ IN CONST UINT64 InterconnectOffset
+ )
+{
+ EFI_STATUS Status;
+
+ // Lower bound check
+ if (Offset > (MpamMscNodeStart + InterconnectOffset)) {
+ IncrementErrorCount ();
+ Print (L"\nERROR : Parsing Interconnect descriptor table failed!\n");
+ Print (
+ L"ERROR : Offset overlaps with other objects within the MSC. Offset %u.\n",
+ InterconnectOffset
+ );
+
+ return EFI_INVALID_PARAMETER;
+ }
+
+ // Upper bound check
+ if (InterconnectOffset > (*MpamMscNodeLength)) {
+ IncrementErrorCount ();
+ Print (L"\nERROR : Parsing Interconnect descriptor table failed!\n");
+ Print (
+ L"ERROR : Offset falls outside MSC's space. Offset %u.\n",
+ InterconnectOffset
+ );
+
+ return EFI_INVALID_PARAMETER;
+ }
+
+ // It is safe to cast InterconnectOffset to UINT32 as IntercconnectOffset can
+ // never exceed the MPAM table length which is at max 2 bytes.
+ Offset = MpamMscNodeStart + (UINT32)InterconnectOffset;
+
+ Print (L"\n");
+ PrintFieldName (6, L"* Interconnect desc table *");
+ Print (L"\n\n");
+
+ // Parse interconnect descriptor table
+ Offset += ParseAcpi (
+ TRUE,
+ 4,
+ NULL,
+ Ptr + Offset,
+ AcpiTableLength - Offset,
+ PARSER_PARAMS (MpamInterconnectDescriptorTableParser)
+ );
+
+ Status = ParseInterconnectDescriptors (
+ Ptr,
+ AcpiTableLength,
+ &Offset
+ );
+
+ return Status;
+}
+
+/**
+ This function parses all the MPAM functional dependency nodes within a
+ single resource node.
+
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] AcpiTableLength Length of the ACPI table.
+ @param [in, out] Offset Pointer to current offset within Ptr.
+
+Returns:
+
+ Status
+
+ EFI_SUCCESS MPAM MSC nodes were parsed properly.
+ EFI_BAD_BUFFER_SIZE The buffer pointer provided as input is not
+ long enough to be parsed correctly.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+ParseMpamMscFunctionalDependencies (
+ IN UINT8 *CONST Ptr,
+ IN CONST UINT32 AcpiTableLength,
+ IN OUT UINT32 *CONST Offset
+ )
+{
+ UINT32 FunctionalDependencyIndex;
+
+ FunctionalDependencyIndex = 0;
+
+ if (NumberOfFunctionalDependencies == NULL) {
+ MpamLengthError (L"Number of functional dependencies not set!");
+ return EFI_BAD_BUFFER_SIZE;
+ }
+
+ while (FunctionalDependencyIndex < *NumberOfFunctionalDependencies) {
+ PrintBlockTitle (
+ 6,
+ L"* Functional dependency *",
+ FunctionalDependencyIndex
+ );
+
+ // Parse functional dependency
+ *Offset += ParseAcpi (
+ TRUE,
+ 4,
+ NULL,
+ Ptr + *Offset,
+ AcpiTableLength - *Offset,
+ PARSER_PARAMS (MpamMscFunctionalDependencyParser)
+ );
+
+ FunctionalDependencyIndex++;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function parses all the MPAM resource nodes within a single MSC
+ node within the MPAM ACPI table. It also invokes helper functions to
+ validate and parse locators and functional dependency descriptors.
+
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] AcpiTableLength Length of the ACPI table.
+ @param [in] Offset Pointer to current offset within Ptr.
+
+Returns:
+
+ Status
+
+ EFI_SUCCESS MPAM MSC nodes were parsed properly.
+ EFI_BAD_BUFFER_SIZE The buffer pointer provided as input is not
+ long enough to be parsed correctly.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+ParseMpamMscResources (
+ IN UINT8 *CONST Ptr,
+ IN CONST UINT32 AcpiTableLength,
+ IN UINT32 Offset
+ )
+{
+ EFI_STATUS Status;
+ UINT32 ResourceIndex;
+
+ ResourceIndex = 0;
+
+ if (NumberOfMscResources == NULL) {
+ MpamLengthError (L"Number of MSC resource not set!");
+ return EFI_BAD_BUFFER_SIZE;
+ }
+
+ while (ResourceIndex < *NumberOfMscResources) {
+ PrintBlockTitle (
+ 4,
+ L"* Resource *",
+ ResourceIndex
+ );
+
+ // Parse MPAM MSC resources within the MSC body.
+ Offset += ParseAcpi (
+ TRUE,
+ 2,
+ NULL,
+ Ptr + Offset,
+ AcpiTableLength - Offset,
+ PARSER_PARAMS (MpamMscResourceParser)
+ );
+
+ Status = ParseMpamMscFunctionalDependencies (Ptr, AcpiTableLength, &Offset);
+ if (Status != EFI_SUCCESS) {
+ return Status;
+ }
+
+ // If the InterconnectTableOffset field has been set, proceed to parse the
+ // interconnect descriptor table. Please note that the interconnect
+ // descriptors are placed within the MSC node body in the resource specific
+ // region. However since its easier to map an interconnect descriptor to
+ // its corresponding resource, proceed to parse it along with its parent
+ // resource. This design choice is made to keep the trace view as intuitive
+ // as possible.
+ //
+ // +---------------------+
+ // | MPAM ACPI Header |
+ // +---------------------+-------
+ // | MSC Node 0 Hdr | ^
+ // | +-----------------+ | |
+ // | | Res Node 0 | | |
+ // | | +-------------+ | | |
+ // | | | Res Node Hdr| | | |
+ // | | +-------------+ | | |
+ // | | | Res Data | | | |
+ // | | | | | | |
+ // | | | +---------+ | | | | +---------------------------+
+ // | | | | Locator | | | | ..|..| Interconnect locator desc |
+ // | | | | | | | | | | Descriptor Table Offset |--points-to->+
+ // | | | | | | | | | | Reserved [4] | |
+ // | | | +---------+ | | | | +---------------------------+ |
+ // | | | |FnDep Cnt| | | | | |
+ // | | | +---------+ | | | | |
+ // | | | |FnDep 1 | | | | | |
+ // | | | +---------+ | | | Interconnect |
+ // | | | |FnDep 2 | | | | descriptor |
+ // | | | +---------+ | | | table |
+ // | | | |FnDep n | | | | offset |
+ // | | | +---------+ | | | value |
+ // | | +-------------+ | | | |
+ // | +-----------------+ | | |
+ // | ... | | |
+ // | +-----------------+ | | |
+ // | | Res Node N | | | |
+ // | | +-------------+ | | | |
+ // | | | Res Node Hdr| | | | |
+ // | | +-------------+ | | | |
+ // | | | Res Data | | | | |
+ // | | | | | | | |
+ // | | | +---------+ | | | | |
+ // | | | | Locator | | | | | |
+ // | | | | | | | | | |
+ // | | | | | | | | | |
+ // | | | +---------+ | | | | |
+ // | | | |FnDep Cnt| | | | | |
+ // | | | +---------+ | | | | |
+ // | | | |FnDep 1 | | | | | |
+ // | | | +---------+ | | | | |
+ // | | | |FnDep 2 | | | | | |
+ // | | | +---------+ | | | | |
+ // | | | |FnDep n | | | | | |
+ // | | | +---------+ | | | | |
+ // | | +-------------+ | | | |
+ // | +-----------------+ | | |
+ // \ Resource-specific / v |
+ // / data region. \<-----------------------------------------------+
+ // \ /
+ // +---------------------+
+ // | MSC Node 1 Hdr |
+ // | ... |
+ // +---------------------+
+ if ( (*ResourceLocatorType == EFI_ACPI_MPAM_LOCATION_INTERCONNECT)
+ && (InterconnectTableOffset != NULL))
+ {
+ Status = ParseInterconnectDescriptorTable (
+ Ptr,
+ AcpiTableLength,
+ Offset,
+ *InterconnectTableOffset
+ );
+ if (Status != EFI_SUCCESS) {
+ return Status;
+ }
+ }
+
+ ResourceIndex++;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function parses all the MPAM MSC nodes within the MPAM ACPI table. It
+ also invokes a helper function to detect and parse resource nodes that maybe
+ present.
+
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] AcpiTableLength Length of the ACPI table.
+ @param [in, out] Offset Pointer to the current offset within Ptr.
+
+Returns:
+
+ Status
+
+ EFI_SUCCESS MPAM MSC nodes were parsed properly.
+ EFI_BAD_BUFFER_SIZE The buffer pointer provided as input is not
+ long enough to be parsed correctly.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+ParseMpamMscNodes (
+ IN UINT8 *CONST Ptr,
+ IN CONST UINT32 AcpiTableLength,
+ IN OUT UINT32 *CONST Offset
+ )
+{
+ EFI_STATUS Status;
+ UINT32 MscIndex;
+
+ MscIndex = 0;
+
+ while (*Offset < AcpiTableLength) {
+ MpamMscNodeStart = *Offset;
+
+ PrintBlockTitle (2, L"* MSC *", MscIndex);
+ // Parse MPAM MSC node
+ *Offset += ParseAcpi (
+ TRUE,
+ 0,
+ NULL,
+ Ptr + *Offset,
+ AcpiTableLength - *Offset,
+ PARSER_PARAMS (MpamMscNodeParser)
+ );
+
+ if (MpamMscNodeLength == NULL) {
+ MpamLengthError (L"MPAM MSC node length not set!");
+ return EFI_BAD_BUFFER_SIZE;
+ }
+
+ if (*MpamMscNodeLength < sizeof (EFI_ACPI_MPAM_MSC_NODE)) {
+ IncrementErrorCount ();
+ Print (L"\nERROR: MSC length should be at least the size of node body! ");
+ Print (L"MSC Length %u\n", *MpamMscNodeLength);
+ return EFI_BAD_BUFFER_SIZE;
+ }
+
+ // Parse MPAM MSC resources within the MSC body
+ Status = ParseMpamMscResources (Ptr, AcpiTableLength, *Offset);
+ if (Status != EFI_SUCCESS) {
+ return Status;
+ }
+
+ *Offset = MpamMscNodeStart + *MpamMscNodeLength;
+ MscIndex++;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function parses the MPAM ACPI table's generic header. It also invokes a
+ sub routine that would help with parsing rest of the table.
+
+ @param [in] Trace If TRUE, trace the ACPI fields.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] AcpiTableLength Length of the ACPI table.
+ @param [in] AcpiTableRevision Revision of the ACPI table.
+**/
+VOID
+EFIAPI
+ParseAcpiMpam (
+ IN BOOLEAN Trace,
+ IN UINT8 *Ptr,
+ IN UINT32 AcpiTableLength,
+ IN UINT8 AcpiTableRevision
+ )
+{
+ EFI_STATUS Status;
+ UINT32 Offset;
+
+ if (!Trace) {
+ return;
+ }
+
+ // Parse generic table header
+ Offset = ParseAcpi (
+ TRUE,
+ 0,
+ "MPAM",
+ Ptr,
+ AcpiTableLength,
+ PARSER_PARAMS (MpamParser)
+ );
+
+ Status = ParseMpamMscNodes (
+ Ptr,
+ AcpiTableLength,
+ &Offset
+ );
+
+ if (Status == EFI_SUCCESS) {
+ // Check if the length of all MPAM MSCs with the header, matches with the
+ // ACPI table's length field.
+ if (*(AcpiHdrInfo.Length) != Offset) {
+ IncrementErrorCount ();
+ Print (L"\nERROR: Length mismatch! : ");
+ Print (L"MSC Length total != MPAM table length.");
+ Print (
+ L"Table length : %u MSC total : %u\n",
+ *(AcpiHdrInfo.Length),
+ Offset
+ );
+ }
+ }
+}
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c index 8ad39090af..43c6a9fb6f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c @@ -1,7 +1,7 @@ /** @file
PCCT table parser
- Copyright (c) 2021, Arm Limited.
+ Copyright (c) 2021 - 2024, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -28,6 +28,7 @@ STATIC UINT8 *ExtendedPccSubspaceInterruptFlags; This function validates the length coded on 4 bytes of a shared memory range
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -35,8 +36,9 @@ STATIC VOID
EFIAPI
ValidateRangeLength4 (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
if (*(UINT32 *)Ptr < MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN) {
@@ -54,6 +56,7 @@ ValidateRangeLength4 ( This function validates the length coded on 8 bytes of a shared memory range
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -61,8 +64,9 @@ STATIC VOID
EFIAPI
ValidateRangeLength8 (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
if (*(UINT64 *)Ptr <= MIN_MEMORY_RANGE_LENGTH) {
@@ -80,6 +84,7 @@ ValidateRangeLength8 ( This function validates address space for Memory/IO GAS.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -87,8 +92,9 @@ STATIC VOID
EFIAPI
ValidatePccMemoryIoGas (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
switch (*(UINT8 *)Ptr) {
@@ -107,6 +113,7 @@ ValidatePccMemoryIoGas ( This function validates address space for structures of types other than 0.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -114,8 +121,9 @@ STATIC VOID
EFIAPI
ValidatePccGas (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
switch (*(UINT8 *)Ptr) {
@@ -135,6 +143,7 @@ ValidatePccGas ( This function validates doorbell address space for type 4 structure.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -142,8 +151,9 @@ STATIC VOID
EFIAPI
ValidatePccDoorbellGas (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
// For responder subspaces this field is optional, if not present the field
@@ -158,7 +168,7 @@ ValidatePccDoorbellGas ( }
}
- ValidatePccGas (Ptr, Context);
+ ValidatePccGas (Ptr, Length, Context);
}
/**
@@ -166,6 +176,7 @@ ValidatePccDoorbellGas ( type 4 structure.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -173,8 +184,9 @@ STATIC VOID
EFIAPI
ValidatePccIntAckGas (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
// If the subspace does not support interrupts or the interrupt is
@@ -196,13 +208,14 @@ ValidatePccIntAckGas ( }
}
- ValidatePccGas (Ptr, Context);
+ ValidatePccGas (Ptr, Length, Context);
}
/**
This function validates error status address space for type 4 structure.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -210,8 +223,9 @@ STATIC VOID
EFIAPI
ValidatePccErrStatusGas (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
// This field is ignored by the OSPM on responder channels.
@@ -219,13 +233,14 @@ ValidatePccErrStatusGas ( return;
}
- ValidatePccGas (Ptr, Context);
+ ValidatePccGas (Ptr, Length, Context);
}
/**
This function validates platform interrupt flags for type 4 structure.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -233,8 +248,9 @@ STATIC VOID
EFIAPI
ValidatePlatInterrupt (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
// If a responder subspace is present in the PCCT, then the global Platform
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c index 5377764458..fabe057d05 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c @@ -1,7 +1,7 @@ /** @file
PPTT table parser
- Copyright (c) 2019 - 2021, ARM Limited. All rights reserved.
+ Copyright (c) 2019 - 2024, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -52,6 +52,7 @@ LogCacheFlagError ( This function validates the Cache Type Structure (Type 1) Cache Flags field.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -59,8 +60,9 @@ STATIC VOID
EFIAPI
ValidateCacheFlags (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
@@ -115,6 +117,7 @@ ValidateCacheFlags ( field.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -122,8 +125,9 @@ STATIC VOID
EFIAPI
ValidateCacheNumberOfSets (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
UINT32 NumberOfSets;
@@ -166,6 +170,7 @@ ValidateCacheNumberOfSets ( field.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -173,8 +178,9 @@ STATIC VOID
EFIAPI
ValidateCacheAssociativity (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
UINT8 Associativity;
@@ -192,6 +198,7 @@ ValidateCacheAssociativity ( This function validates the Cache Type Structure (Type 1) Line size field.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -199,8 +206,9 @@ STATIC VOID
EFIAPI
ValidateCacheLineSize (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
@@ -237,6 +245,7 @@ ValidateCacheLineSize ( This function validates the Cache Type Structure (Type 1) Cache ID field.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -244,8 +253,9 @@ STATIC VOID
EFIAPI
ValidateCacheId (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
UINT32 CacheId;
@@ -276,6 +286,7 @@ ValidateCacheId ( This function validates the Cache Type Structure (Type 1) Attributes field.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -283,8 +294,9 @@ STATIC VOID
EFIAPI
ValidateCacheAttributes (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
// Reference: Advanced Configuration and Power Interface (ACPI) Specification
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c index bddf276356..895258bc1d 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c @@ -1,7 +1,7 @@ /** @file
RSDP table parser
- Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2024, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -19,6 +19,7 @@ STATIC CONST UINT64 *XsdtAddress; This function validates the RSDT Address.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -26,8 +27,9 @@ STATIC VOID
EFIAPI
ValidateRsdtAddress (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
@@ -55,6 +57,7 @@ ValidateRsdtAddress ( This function validates the XSDT Address.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -62,8 +65,9 @@ STATIC VOID
EFIAPI
ValidateXsdtAddress (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c index e5267b1d04..d172a555da 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c @@ -1,7 +1,7 @@ /** @file
SPCR table parser
- Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2024, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -22,6 +22,7 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; This function validates the Interrupt Type.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -29,8 +30,9 @@ STATIC VOID
EFIAPI
ValidateInterruptType (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
@@ -55,6 +57,7 @@ ValidateInterruptType ( This function validates the Irq.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -62,8 +65,9 @@ STATIC VOID
EFIAPI
ValidateIrq (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c index 2980704479..7bae94c076 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -1,7 +1,7 @@ /** @file
SRAT table parser
- Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2024, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
@@ -25,6 +25,7 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; This function validates the Reserved field in the SRAT table header.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -32,8 +33,9 @@ STATIC VOID
EFIAPI
ValidateSratReserved (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
if (*(UINT32 *)Ptr != 1) {
@@ -47,6 +49,7 @@ ValidateSratReserved ( Affinity Structure.
@param [in] Ptr Pointer to the start of the field data.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -54,8 +57,9 @@ STATIC VOID
EFIAPI
ValidateSratDeviceHandleType (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
UINT8 DeviceHandleType;
@@ -77,13 +81,15 @@ ValidateSratDeviceHandleType ( @param [in] Format Format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
STATIC
VOID
EFIAPI
DumpSratPciBdfNumber (
IN CONST CHAR16 *Format,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
@@ -165,13 +171,15 @@ STATIC CONST ACPI_PARSER SratDeviceHandlePciParser[] = { @param [in] Format Format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
STATIC
VOID
EFIAPI
DumpSratDeviceHandle (
IN CONST CHAR16 *Format,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (SratDeviceHandleType == NULL) {
@@ -208,13 +216,15 @@ DumpSratDeviceHandle ( @param [in] Format Format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
**/
STATIC
VOID
EFIAPI
DumpSratApicProximity (
IN CONST CHAR16 *Format,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
UINT32 ProximityDomain;
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Wsmt/WsmtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Wsmt/WsmtParser.c index 3c7252b0bf..4433c047a4 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Wsmt/WsmtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Wsmt/WsmtParser.c @@ -1,6 +1,7 @@ /** @file
WSMT table parser
+ Copyright (c) 2024, Arm Limited. All rights reserved.
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -17,7 +18,8 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; /**
This function validates the WSMT Protection flag.
- @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
@@ -26,8 +28,9 @@ STATIC VOID
EFIAPI
ValidateWsmtProtectionFlag (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
UINT32 ProtectionFlag;
@@ -49,7 +52,8 @@ ValidateWsmtProtectionFlag ( /**
This function validates the reserved bits in the WSMT Protection flag.
- @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the field.
@param [in] Context Pointer to context specific information e.g. this
could be a pointer to the ACPI table header.
**/
@@ -57,8 +61,9 @@ STATIC VOID
EFIAPI
ValidateReserved (
- IN UINT8 *Ptr,
- IN VOID *Context
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN VOID *Context
)
{
UINT32 ProtectionFlag;
@@ -92,7 +97,8 @@ VOID EFIAPI
DumpWsmtProtectionFlag (
IN CONST CHAR16 *Format OPTIONAL,
- IN UINT8 *Ptr
+ IN UINT8 *Ptr,
+ IN UINT32 Length
)
{
if (Format != NULL) {
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c index 0bdf068fe0..4f4254ac40 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c @@ -2,7 +2,7 @@ Main file for 'acpiview' Shell command function.
Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
- Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2016 - 2023, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -54,16 +54,19 @@ ACPI_TABLE_PARSER ParserList[] = { { EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, ParseAcpiDbg2 },
{ EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
ParseAcpiDsdt },
+ { EFI_ACPI_6_5_ERROR_INJECTION_TABLE_SIGNATURE, ParseAcpiEinj },
{ EFI_ACPI_6_4_ERROR_RECORD_SERIALIZATION_TABLE_SIGNATURE, ParseAcpiErst },
{ EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE, ParseAcpiFacs },
{ EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiFadt },
{ EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiGtdt },
+ { EFI_ACPI_6_5_HARDWARE_ERROR_SOURCE_TABLE_SIGNATURE, ParseAcpiHest },
{ EFI_ACPI_6_4_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_SIGNATURE, ParseAcpiHmat },
{ EFI_ACPI_6_5_HIGH_PRECISION_EVENT_TIMER_TABLE_SIGNATURE, ParseAcpiHpet },
{ EFI_ACPI_6_2_IO_REMAPPING_TABLE_SIGNATURE, ParseAcpiIort },
{ EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiMadt },
{ EFI_ACPI_6_2_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
ParseAcpiMcfg },
+ { EFI_ACPI_MEMORY_SYSTEM_RESOURCE_PARTITIONING_AND_MONITORING_TABLE_SIGNATURE, ParseAcpiMpam },
{ EFI_ACPI_6_4_PLATFORM_COMMUNICATIONS_CHANNEL_TABLE_SIGNATURE,
ParseAcpiPcct },
{ EFI_ACPI_6_4_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE,
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf index e62366116c..54dddd0ee2 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf @@ -2,7 +2,7 @@ # Provides Shell 'acpiview' command functions
#
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
-# Copyright (c) 2016 - 2020, Arm Limited. All rights reserved.<BR>
+# Copyright (c) 2016 - 2024, Arm Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -33,16 +33,19 @@ Parsers/Bgrt/BgrtParser.c
Parsers/Dbg2/Dbg2Parser.c
Parsers/Dsdt/DsdtParser.c
+ Parsers/Einj/EinjParser.c
Parsers/Erst/ErstParser.c
Parsers/Facs/FacsParser.c
Parsers/Fadt/FadtParser.c
Parsers/Gtdt/GtdtParser.c
+ Parsers/Hest/HestParser.c
Parsers/Hmat/HmatParser.c
Parsers/Hpet/HpetParser.c
Parsers/Iort/IortParser.c
Parsers/Madt/MadtParser.c
Parsers/Madt/MadtParser.h
Parsers/Mcfg/McfgParser.c
+ Parsers/Mpam/MpamParser.c
Parsers/Pcct/PcctParser.c
Parsers/Pcct/PcctParser.h
Parsers/Pptt/PpttParser.c
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni index e4a9dd5b40..4079a8e51e 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni @@ -1,6 +1,6 @@ // /**
//
-// Copyright (c) 2016 - 2020, Arm Limited. All rights reserved.<BR>
+// Copyright (c) 2016 - 2023, Arm Limited. All rights reserved.<BR>
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Module Name:
@@ -89,6 +89,7 @@ " HMAT - Heterogeneous Memory Attributes Table\r\n"
" IORT - IO Remapping Table\r\n"
" MCFG - Memory Mapped Config Space Base Address Description Table\r\n"
+" MPAM - Memory System Resource Partitioning and Monitoring Table\r\n"
" PPTT - Processor Properties Topology Table\r\n"
" RSDP - Root System Description Pointer\r\n"
" SLIT - System Locality Information Table\r\n"
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c index a609971f34..046cfd5270 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c @@ -19,6 +19,7 @@ #include <Guid/SystemResourceTable.h>
#include <Guid/DebugImageInfoTable.h>
#include <Guid/ImageAuthentication.h>
+#include <Guid/ConformanceProfiles.h>
/**
Make a printable character.
@@ -84,9 +85,267 @@ DisplayMmioMemory ( return (ShellStatus);
}
+/**
+ Display the RtPropertiesTable entries
+
+ @param[in] Address The pointer to the RtPropertiesTable.
+**/
+SHELL_STATUS
+DisplayRtProperties (
+ IN UINT64 Address
+ )
+{
+ EFI_RT_PROPERTIES_TABLE *RtPropertiesTable;
+ UINT32 RtServices;
+ SHELL_STATUS ShellStatus;
+ EFI_STATUS Status;
+
+ ShellStatus = SHELL_SUCCESS;
+
+ if (Address != 0) {
+ EfiGetSystemConfigurationTable (&gEfiRtPropertiesTableGuid, (VOID **)&RtPropertiesTable);
+
+ RtServices = (UINT32)RtPropertiesTable->RuntimeServicesSupported;
+ Status = ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_DMEM_RT_PROPERTIES),
+ gShellDebug1HiiHandle,
+ EFI_RT_PROPERTIES_TABLE_VERSION,
+ (RtServices & EFI_RT_SUPPORTED_GET_TIME) ? 1 : 0,
+ (RtServices & EFI_RT_SUPPORTED_SET_TIME) ? 1 : 0,
+ (RtServices & EFI_RT_SUPPORTED_GET_WAKEUP_TIME) ? 1 : 0,
+ (RtServices & EFI_RT_SUPPORTED_SET_WAKEUP_TIME) ? 1 : 0,
+ (RtServices & EFI_RT_SUPPORTED_GET_VARIABLE) ? 1 : 0,
+ (RtServices & EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME) ? 1 : 0,
+ (RtServices & EFI_RT_SUPPORTED_SET_VARIABLE) ? 1 : 0,
+ (RtServices & EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP) ? 1 : 0,
+ (RtServices & EFI_RT_SUPPORTED_CONVERT_POINTER) ? 1 : 0,
+ (RtServices & EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT) ? 1 : 0,
+ (RtServices & EFI_RT_SUPPORTED_RESET_SYSTEM) ? 1 : 0,
+ (RtServices & EFI_RT_SUPPORTED_UPDATE_CAPSULE) ? 1 : 0,
+ (RtServices & EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES) ? 1 : 0,
+ (RtServices & EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO) ? 1 : 0
+ );
+
+ if (EFI_ERROR (Status)) {
+ ShellStatus = SHELL_ABORTED;
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_GET_FAIL), gShellDebug1HiiHandle, L"RtPropertiesTable");
+ }
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_NOT_FOUND), gShellDebug1HiiHandle, L"RtPropertiesTable");
+ }
+
+ return (ShellStatus);
+}
+
+/**
+ Retrieve the ImageExecutionTable Entry ImageName from ImagePath
+
+ @param[in] FileName The full path of the image.
+ @param[out] BaseName The name of the image.
+**/
+EFI_STATUS
+GetBaseName (
+ IN CHAR16 *FileName,
+ OUT CHAR16 **BaseName
+ )
+{
+ UINTN StrLen;
+ CHAR16 *StrTail;
+
+ StrLen = StrSize (FileName);
+
+ for (StrTail = FileName + StrLen - 1; StrTail != FileName && *StrTail != L'\\'; StrTail--) {
+ }
+
+ if (StrTail == FileName) {
+ return EFI_NOT_FOUND;
+ }
+
+ *BaseName = StrTail+1;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Retrieve the ImageExecutionTable entries.
+**/
+EFI_STATUS
+GetImageExecutionInfo (
+ )
+{
+ EFI_STATUS Status;
+ EFI_IMAGE_EXECUTION_INFO_TABLE *ExecInfoTablePtr;
+ EFI_IMAGE_EXECUTION_INFO *InfoPtr;
+ CHAR8 *ptr;
+ CHAR16 *ImagePath;
+ CHAR16 *ImageName;
+ UINTN Image;
+ UINTN *NumberOfImages;
+ CHAR16 *ActionType;
+
+ EfiGetSystemConfigurationTable (&gEfiImageSecurityDatabaseGuid, (VOID **)&ExecInfoTablePtr);
+
+ NumberOfImages = &ExecInfoTablePtr->NumberOfImages;
+
+ ptr = (CHAR8 *)ExecInfoTablePtr + 1;
+
+ for (Image = 0; Image < *NumberOfImages; Image++, ptr += InfoPtr->InfoSize) {
+ InfoPtr = (EFI_IMAGE_EXECUTION_INFO *)ptr;
+ ImagePath = (CHAR16 *)(InfoPtr + 1);
+
+ GetBaseName (ImagePath, &ImageName);
+
+ switch (InfoPtr->Action) {
+ case EFI_IMAGE_EXECUTION_AUTHENTICATION:
+ ActionType = L"AUTHENTICATION";
+ break;
+ case EFI_IMAGE_EXECUTION_AUTH_UNTESTED:
+ ActionType = L"AUTH_UNTESTED";
+ break;
+ case EFI_IMAGE_EXECUTION_AUTH_SIG_FAILED:
+ ActionType = L"AUTH_SIG_FAILED";
+ break;
+ case EFI_IMAGE_EXECUTION_AUTH_SIG_PASSED:
+ ActionType = L"AUTH_SIG_PASSED";
+ break;
+ case EFI_IMAGE_EXECUTION_AUTH_SIG_NOT_FOUND:
+ ActionType = L"AUTH_SIG_NOT_FOUND";
+ break;
+ case EFI_IMAGE_EXECUTION_AUTH_SIG_FOUND:
+ ActionType = L"AUTH_SIG_FOUND";
+ break;
+ case EFI_IMAGE_EXECUTION_POLICY_FAILED:
+ ActionType = L"POLICY_FAILED";
+ break;
+ case EFI_IMAGE_EXECUTION_INITIALIZED:
+ ActionType = L"INITIALIZED";
+ break;
+ default:
+ ActionType = L"invalid action";
+ }
+
+ Status = ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_DMEM_IMG_EXE_ENTRY),
+ gShellDebug1HiiHandle,
+ ImageName,
+ ActionType
+ );
+ }
+
+ return Status;
+}
+
+/**
+ Display the ImageExecutionTable entries
+
+ @param[in] Address The pointer to the ImageExecutionTable.
+**/
+SHELL_STATUS
+DisplayImageExecutionEntries (
+ IN UINT64 Address
+ )
+{
+ SHELL_STATUS ShellStatus;
+ EFI_STATUS Status;
+
+ ShellStatus = SHELL_SUCCESS;
+
+ if (Address != 0) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_IMG_EXE_TABLE), gShellDebug1HiiHandle);
+ Status = GetImageExecutionInfo ();
+ if (EFI_ERROR (Status)) {
+ ShellStatus = SHELL_ABORTED;
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_GET_FAIL), gShellDebug1HiiHandle, L"ImageExecutionTable");
+ }
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_NOT_FOUND), gShellDebug1HiiHandle, L"ImageExecutionTable");
+ }
+
+ return (ShellStatus);
+}
+
+/**
+ Display the ConformanceProfileTable entries
+
+ @param[in] Address The pointer to the ConformanceProfileTable.
+**/
+SHELL_STATUS
+DisplayConformanceProfiles (
+ IN UINT64 Address
+ )
+{
+ SHELL_STATUS ShellStatus;
+ EFI_STATUS Status;
+ EFI_GUID *EntryGuid;
+ CHAR16 *GuidName;
+ UINTN Profile;
+ EFI_CONFORMANCE_PROFILES_TABLE *ConfProfTable;
+
+ ShellStatus = SHELL_SUCCESS;
+
+ if (Address != 0) {
+ EfiGetSystemConfigurationTable (&gEfiConfProfilesTableGuid, (VOID **)&ConfProfTable);
+
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_CONF_PRO_TABLE), gShellDebug1HiiHandle);
+
+ EntryGuid = (EFI_GUID *)(ConfProfTable + 1);
+
+ for (Profile = 0; Profile < ConfProfTable->NumberOfProfiles; Profile++, EntryGuid++) {
+ GuidName = L"Unknown_Profile";
+
+ if (CompareGuid (EntryGuid, &gEfiConfProfilesUefiSpecGuid)) {
+ GuidName = L"EFI_CONFORMANCE_PROFILE_UEFI_SPEC_GUID";
+ }
+
+ if (CompareGuid (EntryGuid, &gEfiConfProfilesEbbrSpec21Guid)) {
+ GuidName = L"EBBR_2.1";
+ }
+
+ if (CompareGuid (EntryGuid, &gEfiConfProfilesEbbrSpec22Guid)) {
+ GuidName = L"EBBR_2.2";
+ }
+
+ Status = ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_DMEM_CONF_PRO_ROW),
+ gShellDebug1HiiHandle,
+ GuidName,
+ EntryGuid
+ );
+ }
+
+ if (EFI_ERROR (Status)) {
+ ShellStatus = SHELL_ABORTED;
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_ERR_GET_FAIL), gShellDebug1HiiHandle, L"ComformanceProfilesTable");
+ }
+ } else {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMEM_CONF_PRO_TABLE), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (
+ -1,
+ -1,
+ NULL,
+ STRING_TOKEN (STR_DMEM_CONF_PRO_ROW),
+ gShellDebug1HiiHandle,
+ L"EFI_CONFORMANCE_PROFILES_UEFI_SPEC_GUID",
+ &gEfiConfProfilesUefiSpecGuid
+ );
+ }
+
+ return (ShellStatus);
+}
+
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
- { L"-mmio", TypeFlag },
- { NULL, TypeMax }
+ { L"-mmio", TypeFlag },
+ { L"-verbose", TypeFlag },
+ { NULL, TypeMax }
};
/**
@@ -273,6 +532,11 @@ ShellCommandRunDmem ( HiiDatabaseExportBufferAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
continue;
}
+
+ if (CompareGuid (&gST->ConfigurationTable[TableWalker].VendorGuid, &gEfiConfProfilesTableGuid)) {
+ ConformanceProfileTableAddress = (UINT64)(UINTN)gST->ConfigurationTable[TableWalker].VendorTable;
+ continue;
+ }
}
ShellPrintHiiEx (
@@ -308,6 +572,20 @@ ShellCommandRunDmem ( ConformanceProfileTableAddress
);
}
+
+ if (ShellCommandLineGetFlag (Package, L"-verbose")) {
+ if (ShellStatus == SHELL_SUCCESS) {
+ ShellStatus = DisplayRtProperties (RtPropertiesTableAddress);
+ }
+
+ if (ShellStatus == SHELL_SUCCESS) {
+ ShellStatus = DisplayImageExecutionEntries (ImageExecutionTableAddress);
+ }
+
+ if (ShellStatus == SHELL_SUCCESS) {
+ ShellStatus = DisplayConformanceProfiles (ConformanceProfileTableAddress);
+ }
+ }
} else {
ShellStatus = DisplayMmioMemory (Address, (UINTN)Size);
}
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c index 7b11f49d0d..93622733a5 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c @@ -4809,6 +4809,9 @@ ExplainPcieLinkCap ( case 5:
MaxLinkSpeed = L"32.0 GT/s";
break;
+ case 6:
+ MaxLinkSpeed = L"64.0 GT/s";
+ break;
default:
MaxLinkSpeed = L"Reserved";
break;
@@ -5015,6 +5018,9 @@ ExplainPcieLinkStatus ( case 5:
CurLinkSpeed = L"32.0 GT/s";
break;
+ case 6:
+ CurLinkSpeed = L"64.0 GT/s";
+ break;
default:
CurLinkSpeed = L"Reserved";
break;
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c index 35369f0183..5c4413cbe3 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c @@ -903,6 +903,13 @@ SmbiosPrintStructure ( ShellPrintEx (-1, -1, L"Extended Configured Memory Speed: 0x%x\n", Struct->Type17->ExtendedConfiguredMemorySpeed);
}
+ if (AE_SMBIOS_VERSION (0x3, 0x7) && (Struct->Hdr->Length > 0x5C)) {
+ ShellPrintEx (-1, -1, L"PMIC0 Manufacturer ID: 0x%x\n", Struct->Type17->Pmic0ManufacturerID);
+ ShellPrintEx (-1, -1, L"PMIC0 Revision Number: 0x%x\n", Struct->Type17->Pmic0RevisionNumber);
+ ShellPrintEx (-1, -1, L"RCD Manufacturer ID: 0x%x\n", Struct->Type17->RcdManufacturerID);
+ ShellPrintEx (-1, -1, L"RCD Revision Number: 0x%x\n", Struct->Type17->RcdRevisionNumber);
+ }
+
break;
//
@@ -1482,7 +1489,7 @@ DisplayBiosCharacteristics ( }
if (BIT (Chara, 5) != 0) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MSA_SUPPORTED), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MCA_SUPPORTED), gShellDebug1HiiHandle);
}
if (BIT (Chara, 6) != 0) {
@@ -1593,7 +1600,7 @@ DisplayBiosCharacteristics ( // Just print the Reserved
//
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_32_47), gShellDebug1HiiHandle);
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_48_64), gShellDebug1HiiHandle);
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_48_63), gShellDebug1HiiHandle);
}
/**
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni index 971e0d09bd..d55af31884 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosViewStrings.uni @@ -119,52 +119,52 @@ #string STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR #language en-US "BIOS Characteristics: \r\n"
#string STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT #language en-US "Reserved bit\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_UNKNOWN_BIT #language en-US "Unknown bit\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_NOT_SUPPORTED #language en-US "BIOS Characteristics Not Supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_NOT_SUPPORTED #language en-US "BIOS Characteristics are not supported\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_ISA_SUPPORTED #language en-US "ISA is supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_MSA_SUPPORTED #language en-US "MSA is supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_MCA_SUPPORTED #language en-US "MCA is supported\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_EISA_SUPPORTED #language en-US "EISA is supported\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_PCI_SUPPORTED #language en-US "PCI is supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_PC_CARD_SUPPORTED #language en-US "PC Card(PCMCIA) is supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_PC_CARD_SUPPORTED #language en-US "PC card (PCMCIA) is supported\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_PLUG_PLAY_SUPPORTED #language en-US "Plug and play is supported\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_APM_SUPPORTED #language en-US "APM is supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_BIOS_UPGRADEABLE #language en-US "BIOS is Upgradeable(FLASH)\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_BIOS_UPGRADEABLE #language en-US "BIOS is upgradeable (Flash)\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_BIOS_SHADOWING #language en-US "BIOS shadowing is allowed\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_VESA_SUPPORTED #language en-US "VL-VESA is supported\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_ECSD_SUPPORT #language en-US "ESCD support is available\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_BOOT_FROM_CD_SUPPORTED #language en-US "Boot from CD is supported\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_SELECTED_BOOT_SUPPORTED #language en-US "Selectable Boot is supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_BIOS_ROM_SOCKETED #language en-US "BIOS ROM is socketed\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_BOOT_FROM_PC_CARD #language en-US "Boot From PC Card(PCMCIA)is supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_EDD_ENHANCED_DRIVER #language en-US "EDD (Enhanced Disk Driver) Specification is supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_NEC #language en-US "Int 13h - Japanese Floppy for NEC 9800 1.2mb (3.5\",1k Bytes/Sector, 360 RPM) is supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_TOSHIBA #language en-US "Int 13h - Japanese Floppy for Toshiba 1.2mn (3.5\", 360 RPM) is supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_FLOPPY_SERVICES_SUPPORTED #language en-US "Int 13h - 5.25\"/360KB Floppy Services are supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_ONE_POINT_TWO_MB #language en-US "Int 13h - 5.25\"/1.2MB Floppy services are supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_720_KB #language en-US "Int 13h - 3.5\"/720KB Floppy services are supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_TWO_POINT_EIGHT_EIGHT_MB #language en-US "Int 13h - 3.5\"/2.88MB Floppy services are supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_PRINT_SCREEN_SUPPORT #language en-US "Int 5h, Print screen Services is supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_SERV_SUPPORT #language en-US "Int 9h, 8042 Keyboard services are supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_SERIAL_SERVICES_SUPPORT #language en-US "Int 14h, Serial Services are supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_PRINTER_SERVICES_SUPPORT #language en-US "Int 17h, Printer services are supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_MONO_VIDEO_SUPPORT #language en-US "Int 10h, CGA/Mono Video services are supported2\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_BIOS_ROM_SOCKETED #language en-US "BIOS ROM is socketed (e.g., PLCC or SOP socket)\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_BOOT_FROM_PC_CARD #language en-US "Boot from PC card (PCMCIA) is supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_EDD_ENHANCED_DRIVER #language en-US "EDD specification is supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_NEC #language en-US "Int 13h - Japanese floppy for NEC 9800 1.2MB (3.5\", 1K bytes/sector, 360 RPM) is supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_TOSHIBA #language en-US "Int 13h - Japanese floppy for Toshiba 1.2MB (3.5\", 360 RPM) is supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_FLOPPY_SERVICES_SUPPORTED #language en-US "Int 13h - 5.25\"/360KB floppy services are supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_ONE_POINT_TWO_MB #language en-US "Int 13h - 5.25\"/1.2MB floppy services are supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_720_KB #language en-US "Int 13h - 3.5\"/720KB floppy services are supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_TWO_POINT_EIGHT_EIGHT_MB #language en-US "Int 13h - 3.5\"/2.88MB floppy services are supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_PRINT_SCREEN_SUPPORT #language en-US "Int 5h, print screen Services is supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_SERV_SUPPORT #language en-US "Int 9h, 8042 keyboard services are supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_SERIAL_SERVICES_SUPPORT #language en-US "Int 14h, serial services are supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_PRINTER_SERVICES_SUPPORT #language en-US "Int 17h, printer services are supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_MONO_VIDEO_SUPPORT #language en-US "Int 10h, CGA/Mono Video Services are supported\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_NEC_PC_98 #language en-US "NEC PC-98\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_BITS_32_47 #language en-US " Bits 32:47 are reserved for BIOS Vendor\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_BITS_48_64 #language en-US " Bits 48:64 are reserved for System Vendor\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_BITS_32_47 #language en-US " Bits 32:47 are reserved for BIOS vendor\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_BITS_48_63 #language en-US " Bits 48:63 are reserved for system vendor\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION #language en-US "BIOS Characteristics Extension Byte1:\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_ACPI_SUPPORTED #language en-US "ACPI supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_ACPI_SUPPORTED #language en-US "ACPI is supported\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_USB_LEGACY_SUPPORTED #language en-US "USB Legacy is supported\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_AGP_SUPPORTED #language en-US "AGP is supported\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_I2O_BOOT_SUPPORTED #language en-US "I2O boot is supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_LS_120_BOOT_SUPPORTED #language en-US "LS-120 boot is supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_ATAPI_ZIP_DRIVE #language en-US "ATAPI ZIP Drive boot is supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_LS_120_BOOT_SUPPORTED #language en-US "LS-120 SuperDisk boot is supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_ATAPI_ZIP_DRIVE #language en-US "ATAPI ZIP drive boot is supported\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_1394_BOOT_SUPPORTED #language en-US "1394 boot is supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_SMART_BATTERY_SUPPORTED #language en-US "Smart battery supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_SMART_BATTERY_SUPPORTED #language en-US "Smart battery is supported\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION_2 #language en-US "BIOS Characteristics Extension Byte2:\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_BIOS_BOOT_SPEC_SUPP #language en-US "BIOS Boot Specification supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_FUNCTION_KEY_INIT #language en-US "Function key-initiated Network Service boot supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_ENABLE_TAR_CONT_DIST #language en-US "Enable Targeted Content Distribution\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_BIOS_BOOT_SPEC_SUPP #language en-US "BIOS Boot Specification is supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_FUNCTION_KEY_INIT #language en-US "Function key-initiated network service boot is supported\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_ENABLE_TAR_CONT_DIST #language en-US "Enable targeted content distribution\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_UEFI_SPEC_SUPPORT #language en-US "UEFI Specification is supported\r\n"
-#string STR_SMBIOSVIEW_PRINTINFO_VIRTUAL_MACHINE #language en-US "The SMBIOS table describes a virtual machine\r\n"
+#string STR_SMBIOSVIEW_PRINTINFO_VIRTUAL_MACHINE #language en-US "SMBIOS table describes a virtual machine\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_MCFG_SUPPORTED #language en-US "Manufacturing mode is supported\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_MCFG_ENABLED #language en-US "Manufacturing mode is enabled\r\n"
#string STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE #language en-US " Bits %d:7 are reserved for future assignment\r\n"
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf index 3741dac5d9..140e9dc644 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf @@ -139,3 +139,7 @@ gEfiJsonConfigDataTableGuid ## SOMETIMES_CONSUMES ## SystemTable
gEfiJsonCapsuleDataTableGuid ## SOMETIMES_CONSUMES ## SystemTable
gEfiJsonCapsuleResultTableGuid ## SOMETIMES_CONSUMES ## SystemTable
+ gEfiConfProfilesTableGuid ## SOMETIMES_CONSUMES ## SystemTable
+ gEfiConfProfilesUefiSpecGuid ## SOMETIMES_CONSUMES ## GUID
+ gEfiConfProfilesEbbrSpec21Guid ## SOMETIMES_CONSUMES ## GUID
+ gEfiConfProfilesEbbrSpec22Guid ## SOMETIMES_CONSUMES ## GUID
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni index 4041f0cd48..6ef923e4fd 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni @@ -126,8 +126,34 @@ "Memory Range Capsule %016LX\r\n"
"Hii Database Export Buffer %016LX\r\n"
"Conformance Profile Table %016LX\r\n"
-
-
+#string STR_DMEM_RT_PROPERTIES #language en-US "\r\nRT Properties Table\r\n"
+ "----------------------------------------\r\n"
+ "Version 0x%01LX\r\n"
+ "Runtime Services Supported:\r\n"
+ " GET_TIME %d\r\n"
+ " GET_WAKEUP_TIME %d\r\n"
+ " SET_TIME %d\r\n"
+ " SET_WAKEUP_TIME %d\r\n"
+ " GET_VARIABLE %d\r\n"
+ " GET_NEXT_VARIABLE_NAME %d\r\n"
+ " SET_VARIABLE %d\r\n"
+ " SET_VIRTUAL_ADDRESS_MAP %d\r\n"
+ " CONVERT_POINTERS %d\r\n"
+ " GET_NEXT_HIGH_MONOTONIC_COUNT %d\r\n"
+ " RESET_SYSTEM %d\r\n"
+ " UPDATE_CAPSULE %d\r\n"
+ " QUERY_CAPSULE_CAPABILITIES %d\r\n"
+ " QUERY_VARIABLE_INFO %d\r\n"
+#string STR_DMEM_IMG_EXE_TABLE #language en-US "\r\nImage Execution Table\r\n"
+ "----------------------------------------\r\n"
+#string STR_DMEM_IMG_EXE_ENTRY #language en-US "%20s: %s\r\n"
+#string STR_DMEM_CONF_PRO_TABLE #language en-US "\r\nConformance Profile Table\r\n"
+ "----------------------------------------\r\n"
+ "Version 0x1\r\n"
+ "Profile GUIDs:\r\n"
+#string STR_DMEM_CONF_PRO_ROW #language en-US " %s %g\r\n"
+#string STR_DMEM_ERR_NOT_FOUND #language en-US "\r\n%H%s%N: Table address not found.\r\n"
+#string STR_DMEM_ERR_GET_FAIL #language en-US "\r\n%H%s%N: Unable to get table information.\r\n"
#string STR_LOAD_PCI_ROM_RES #language en-US "Image '%B%s%N' load result: %r\r\n"
#string STR_LOADPCIROM_CORRUPT #language en-US "%H%s%N: File '%B%s%N' Image %d is corrupt.\r\n"
@@ -589,6 +615,7 @@ " \r\n"
" -b - Displays one screen at a time.\r\n"
" -MMIO - Forces address cycles to the PCI bus.\r\n"
+" -verbose - Displays contents of certain EFI System Tables.\r\n"
" address - Specifies a starting address in hexadecimal format.\r\n"
" size - Specifies the number of bytes to display in hexadecimal format.\r\n"
".SH DESCRIPTION\r\n"
|