:p
atchew
Login
ECC tool report some coding style issue in UefiShellAcpiViewCommandLib. This patch series is to clean these issues. Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Evan Lloyd <evan.lloyd@arm.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Evan Lloyd <evan.lloyd@arm.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Dandan Bi (2): ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues .../UefiShellAcpiViewCommandLib/AcpiParser.c | 174 +++++++++------- .../UefiShellAcpiViewCommandLib/AcpiParser.h | 229 ++++++++++++--------- .../UefiShellAcpiViewCommandLib/AcpiTableParser.c | 77 +++---- .../UefiShellAcpiViewCommandLib/AcpiTableParser.h | 45 ++-- .../Library/UefiShellAcpiViewCommandLib/AcpiView.c | 113 ++++++---- .../Library/UefiShellAcpiViewCommandLib/AcpiView.h | 75 ++++--- .../Parsers/Bgrt/BgrtParser.c | 12 +- .../Parsers/Dbg2/Dbg2Parser.c | 34 +-- .../Parsers/Dsdt/DsdtParser.c | 7 +- .../Parsers/Fadt/FadtParser.c | 68 ++++-- .../Parsers/Gtdt/GtdtParser.c | 57 +++-- .../Parsers/Iort/IortParser.c | 159 ++++++++------ .../Parsers/Madt/MadtParser.c | 67 +++--- .../Parsers/Mcfg/McfgParser.c | 18 +- .../Parsers/Rsdp/RsdpParser.c | 42 ++-- .../Parsers/Slit/SlitParser.c | 61 +++--- .../Parsers/Spcr/SpcrParser.c | 42 ++-- .../Parsers/Srat/SratParser.c | 82 +++++--- .../Parsers/Ssdt/SsdtParser.c | 7 +- .../Parsers/Xsdt/XsdtParser.c | 11 +- .../UefiShellAcpiViewCommandLib.c | 18 +- .../UefiShellAcpiViewCommandLib.h | 10 +- .../UefiShellAcpiViewCommandLib.inf | 3 + 23 files changed, 835 insertions(+), 576 deletions(-) -- 2.14.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Make the function comments follow EDK2 coding style. Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Evan Lloyd <evan.lloyd@arm.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Evan Lloyd <evan.lloyd@arm.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> --- .../UefiShellAcpiViewCommandLib/AcpiParser.c | 130 ++++++------ .../UefiShellAcpiViewCommandLib/AcpiParser.h | 223 ++++++++++++--------- .../UefiShellAcpiViewCommandLib/AcpiTableParser.c | 27 ++- .../UefiShellAcpiViewCommandLib/AcpiTableParser.h | 39 ++-- .../Library/UefiShellAcpiViewCommandLib/AcpiView.c | 55 +++-- .../Library/UefiShellAcpiViewCommandLib/AcpiView.h | 59 +++--- .../Parsers/Bgrt/BgrtParser.c | 12 +- .../Parsers/Dbg2/Dbg2Parser.c | 29 +-- .../Parsers/Dsdt/DsdtParser.c | 7 +- .../Parsers/Fadt/FadtParser.c | 68 +++++-- .../Parsers/Gtdt/GtdtParser.c | 52 +++-- .../Parsers/Iort/IortParser.c | 133 +++++++----- .../Parsers/Madt/MadtParser.c | 63 +++--- .../Parsers/Mcfg/McfgParser.c | 18 +- .../Parsers/Rsdp/RsdpParser.c | 32 +-- .../Parsers/Slit/SlitParser.c | 17 +- .../Parsers/Spcr/SpcrParser.c | 32 +-- .../Parsers/Srat/SratParser.c | 61 +++--- .../Parsers/Ssdt/SsdtParser.c | 7 +- .../Parsers/Xsdt/XsdtParser.c | 11 +- .../UefiShellAcpiViewCommandLib.c | 13 +- .../UefiShellAcpiViewCommandLib.h | 4 +- 22 files changed, 645 insertions(+), 447 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file ACPI parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ STATIC UINT32 gIndent; STATIC UINT32 mTableErrorCount; STATIC UINT32 mTableWarningCount; -/** This function resets the ACPI table error counter to Zero. -*/ +/** + This function resets the ACPI table error counter to Zero. +**/ VOID ResetErrorCount ( VOID ) { mTableErrorCount = 0; } -/** This function returns the ACPI table error count. +/** + This function returns the ACPI table error count. @retval Returns the count of errors detected in the ACPI tables. -*/ +**/ UINT32 GetErrorCount ( VOID ) { return mTableErrorCount; } -/** This function resets the ACPI table warning counter to Zero. -*/ +/** + This function resets the ACPI table warning counter to Zero. +**/ VOID ResetWarningCount ( VOID ) { mTableWarningCount = 0; } -/** This function returns the ACPI table warning count. +/** + This function returns the ACPI table warning count. @retval Returns the count of warning detected in the ACPI tables. -*/ +**/ UINT32 GetWarningCount ( VOID ) { return mTableWarningCount; } -/** This function increments the ACPI table error counter. -*/ +/** + This function increments the ACPI table error counter. +**/ VOID EFIAPI IncrementErrorCount ( VOID ) { mTableErrorCount++; } -/** This function increments the ACPI table warning counter. -*/ +/** + This function increments the ACPI table warning counter. +**/ VOID EFIAPI IncrementWarningCount ( VOID ) { mTableWarningCount++; } -/** This function verifies the ACPI table checksum. +/** + This function verifies the ACPI table checksum. This function verifies the checksum for the ACPI table and optionally prints the status. @param [in] Log If TRUE log the status of the checksum. @param [in] Ptr Pointer to the start of the table buffer. @param [in] Length The length of the buffer. @retval TRUE The checksum is OK. @retval FALSE The checksum failed. -*/ +**/ BOOLEAN EFIAPI VerifyChecksum ( IN BOOLEAN Log, IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ VerifyChecksum ( } return (Checksum == 0); } -/** This function performs a raw data dump of the ACPI table. +/** + This function performs a raw data dump of the ACPI table. @param [in] Ptr Pointer to the start of the table buffer. @param [in] Length The length of the buffer. -*/ +**/ VOID EFIAPI DumpRaw ( IN UINT8* Ptr, IN UINT32 Length @@ -XXX,XX +XXX,XX @@ DumpRaw ( // Print ASCII data for the final line. AsciiBuffer[AsciiBufferIndex] = '\0'; Print (L" %a", AsciiBuffer); } -/** This function traces 1 byte of data as specified in the - format string. +/** + This function traces 1 byte of data as specified in the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint8 ( IN CONST CHAR16* Format, IN UINT8* Ptr ) { Print (Format, *Ptr); } -/** This function traces 2 bytes of data as specified in the - format string. +/** + This function traces 2 bytes of data as specified in the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint16 ( IN CONST CHAR16* Format, IN UINT8* Ptr ) { Print (Format, *(UINT16*)Ptr); } -/** This function traces 4 bytes of data as specified in the - format string. +/** + This function traces 4 bytes of data as specified in the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint32 ( IN CONST CHAR16* Format, IN UINT8* Ptr ) { Print (Format, *(UINT32*)Ptr); } -/** This function traces 8 bytes of data as specified by the - format string. +/** + This function traces 8 bytes of data as specified by the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint64 ( IN CONST CHAR16* Format, IN UINT8* Ptr @@ -XXX,XX +XXX,XX @@ DumpUint64 ( Val |= *(UINT32*)Ptr; Print (Format, Val); } -/** This function traces 3 characters which can be optionally - formated using the format string if specified. +/** + This function traces 3 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. -*/ +**/ VOID EFIAPI Dump3Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr @@ -XXX,XX +XXX,XX @@ Dump3Chars ( Ptr[1], Ptr[2] ); } -/** This function traces 4 characters which can be optionally - formated using the format string if specified. +/** + This function traces 4 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. -*/ +**/ VOID EFIAPI Dump4Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr @@ -XXX,XX +XXX,XX @@ Dump4Chars ( Ptr[2], Ptr[3] ); } -/** This function traces 6 characters which can be optionally - formated using the format string if specified. +/** + This function traces 6 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. -*/ +**/ VOID EFIAPI Dump6Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr @@ -XXX,XX +XXX,XX @@ Dump6Chars ( Ptr[4], Ptr[5] ); } -/** This function traces 8 characters which can be optionally - formated using the format string if specified. +/** + This function traces 8 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. -*/ +**/ VOID EFIAPI Dump8Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr @@ -XXX,XX +XXX,XX @@ Dump8Chars ( Ptr[6], Ptr[7] ); } -/** This function indents and prints the ACPI table Field Name. +/** + This function indents and prints the ACPI table Field Name. @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] FieldName Pointer to the Field Name. -*/ +**/ VOID EFIAPI PrintFieldName ( IN UINT32 Indent, IN CONST CHAR16* FieldName @@ -XXX,XX +XXX,XX @@ PrintFieldName ( (OUTPUT_FIELD_COLUMN_WIDTH - gIndent - Indent), FieldName ); } -/** This function is used to parse an ACPI table buffer. +/** + This function is used to parse an ACPI table buffer. The ACPI table buffer is parsed using the ACPI table parser information specified by a pointer to an array of ACPI_PARSER elements. This parser function iterates through each item on the ACPI_PARSER array and logs the ACPI table fields. @@ -XXX,XX +XXX,XX @@ PrintFieldName ( @param [in] Parser Pointer to an array of ACPI_PARSER structure that describes the table being parsed. @param [in] ParserItems Number of items in the ACPI_PARSER array. @retval Number of bytes parsed. -*/ +**/ UINT32 EFIAPI ParseAcpi ( IN BOOLEAN Trace, IN UINT32 Indent, @@ -XXX,XX +XXX,XX @@ ParseAcpi ( // Decrement the Indent gIndent -= Indent; return Offset; } -/** An array describing the ACPI Generic Address Structure. +/** + An array describing the ACPI Generic Address Structure. The GasParser array is used by the ParseAcpi function to parse and/or trace the GAS structure. -*/ +**/ STATIC CONST ACPI_PARSER GasParser[] = { {L"Address Space ID", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Register Bit Width", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, {L"Register Bit Offset", 1, 2, L"0x%x", NULL, NULL, NULL, NULL}, {L"Address Size", 1, 3, L"0x%x", NULL, NULL, NULL, NULL}, {L"Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL} }; -/** This function indents and traces the GAS structure as described - by the GasParser. +/** + This function indents and traces the GAS structure as described by the GasParser. @param [in] Ptr Pointer to the start of the buffer. @param [in] Indent Number of spaces to indent the output. -*/ +**/ VOID EFIAPI DumpGasStruct ( IN UINT8* Ptr, IN UINT32 Indent @@ -XXX,XX +XXX,XX @@ DumpGasStruct ( GAS_LENGTH, PARSER_PARAMS (GasParser) ); } -/** This function traces the GAS structure as described by the GasParser. +/** + This function traces the GAS structure as described by the GasParser. @param [in] Format Optional format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpGas ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr ) { DumpGasStruct (Ptr, 2); } -/** This function traces the ACPI header as described by the AcpiHeaderParser. +/** + This function traces the ACPI header as described by the AcpiHeaderParser. @param [in] Ptr Pointer to the start of the buffer. @retval Number of bytes parsed. -*/ +**/ UINT32 EFIAPI DumpAcpiHeader ( IN UINT8* Ptr ) @@ -XXX,XX +XXX,XX @@ DumpAcpiHeader ( ACPI_DESCRIPTION_HEADER_LENGTH, PARSER_PARAMS (AcpiHeaderParser) ); } -/** This function parses the ACPI header as described by the AcpiHeaderParser. +/** + This function parses the ACPI header as described by the AcpiHeaderParser. This function optionally returns the signature, length and revision of the ACPI table. @param [in] Ptr Pointer to the start of the buffer. @param [out] Signature Gets location of the ACPI table signature. @param [out] Length Gets location of the length of the ACPI table. @param [out] Revision Gets location of the revision of the ACPI table. @retval Number of bytes parsed. -*/ +**/ UINT32 EFIAPI ParseAcpiHeader ( IN UINT8* Ptr, OUT CONST UINT32** Signature, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -XXX,XX +XXX,XX @@ -/** +/** @file Header file for ACPI parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ /// However The signature for ACPI tables is 4 bytes. /// To work around this oddity define a signature type /// that allows us to process the log options. #define RSDP_TABLE_INFO SIGNATURE_32('R', 'S', 'D', 'P') -/** This function increments the ACPI table error counter. -*/ +/** + This function increments the ACPI table error counter. +**/ VOID EFIAPI IncrementErrorCount ( VOID ); -/** This function increments the ACPI table warning counter. -*/ +/** + This function increments the ACPI table warning counter. +**/ VOID EFIAPI IncrementWarningCount ( VOID ); -/** This function verifies the ACPI table checksum. +/** + This function verifies the ACPI table checksum. This function verifies the checksum for the ACPI table and optionally prints the status. @param [in] Log If TRUE log the status of the checksum. @param [in] Ptr Pointer to the start of the table buffer. @param [in] Length The length of the buffer. @retval TRUE The checksum is OK. @retval FALSE The checksum failed. -*/ +**/ BOOLEAN EFIAPI VerifyChecksum ( IN BOOLEAN Log, IN UINT8* Ptr, IN UINT32 Length ); -/** This function performs a raw data dump of the ACPI table. +/** + This function performs a raw data dump of the ACPI table. @param [in] Ptr Pointer to the start of the table buffer. @param [in] Length The length of the buffer. -*/ +**/ VOID EFIAPI DumpRaw ( IN UINT8* Ptr, IN UINT32 Length ); -/** This function traces 1 byte of datum as specified in the - format string. +/** + This function traces 1 byte of datum as specified in the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint8 ( IN CONST CHAR16* Format, IN UINT8* Ptr ); -/** This function traces 2 bytes of data as specified in the - format string. +/** + This function traces 2 bytes of data as specified in the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint16 ( IN CONST CHAR16* Format, IN UINT8* Ptr ); -/** This function traces 4 bytes of data as specified in the - format string. +/** + This function traces 4 bytes of data as specified in the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint32 ( IN CONST CHAR16* Format, IN UINT8* Ptr ); -/** This function traces 8 bytes of data as specified by the - format string. +/** + This function traces 8 bytes of data as specified by the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint64 ( IN CONST CHAR16* Format, IN UINT8* Ptr ); -/** This function traces 3 characters which can be optionally - formated using the format string if specified. +/** + This function traces 3 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. -*/ +**/ VOID EFIAPI Dump3Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr ); -/** This function traces 4 characters which can be optionally - formated using the format string if specified. +/** + This function traces 4 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. -*/ +**/ VOID EFIAPI Dump4Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr ); -/** This function traces 6 characters which can be optionally - formated using the format string if specified. +/** + This function traces 6 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. -*/ +**/ VOID EFIAPI Dump6Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr ); -/** This function traces 8 characters which can be optionally - formated using the format string if specified. +/** + This function traces 8 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. -*/ +**/ VOID EFIAPI Dump8Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr ); -/** This function indents and prints the ACPI table Field Name. +/** + This function indents and prints the ACPI table Field Name. @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] FieldName Pointer to the Field Name. -*/ +**/ VOID EFIAPI PrintFieldName ( IN UINT32 Indent, IN CONST CHAR16* FieldName -); + ); -/** This function pointer is the template for customizing the trace output +/** + This function pointer is the template for customizing the trace output @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. -*/ +**/ typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16* Format, UINT8* Ptr); -/** This function pointer is the template for validating an ACPI table field. +/** + 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] 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); -/** The ACPI_PARSER structure describes the fields of an ACPI table and - provides means for the parser to interpret and trace appropriately. +/** + The ACPI_PARSER structure describes the fields of an ACPI table and + provides means for the parser to interpret and trace appropriately. The first three members are populated based on information present in in the ACPI table specifications. The remaining members describe how the parser should report the field information, validate the field data and/or update an external pointer to the field (ItemPtr). @@ -XXX,XX +XXX,XX @@ typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8* Ptr, VOID* Context); The PrintFormatter function may choose to use the format string specified by 'Format' or use its own internal format string. The 'Format' and 'PrintFormatter' members allow flexibility for representing the field data. -*/ +**/ typedef struct AcpiParser { /// String describing the ACPI table field /// (Field column from ACPI table spec) CONST CHAR16* NameStr; @@ -XXX,XX +XXX,XX @@ typedef struct AcpiParser { /// decisions about the field being validated. /// e.g. this could be a pointer to the ACPI table header VOID* Context; } ACPI_PARSER; -/** A structure used to store the pointers to the members of the - ACPI description header structure that was parsed. -*/ +/** + A structure used to store the pointers to the members of the + ACPI description header structure that was parsed. +**/ typedef struct AcpiDescriptionHeaderInfo { /// ACPI table signature UINT32* Signature; /// Length of the ACPI table UINT32* Length; @@ -XXX,XX +XXX,XX @@ typedef struct AcpiDescriptionHeaderInfo { UINT32* CreatorId; /// Creator revision UINT32* CreatorRevision; } ACPI_DESCRIPTION_HEADER_INFO; -/** This function is used to parse an ACPI table buffer. +/** + This function is used to parse an ACPI table buffer. The ACPI table buffer is parsed using the ACPI table parser information specified by a pointer to an array of ACPI_PARSER elements. This parser function iterates through each item on the ACPI_PARSER array and logs the ACPI table fields. @@ -XXX,XX +XXX,XX @@ typedef struct AcpiDescriptionHeaderInfo { @param [in] Parser Pointer to an array of ACPI_PARSER structure that describes the table being parsed. @param [in] ParserItems Number of items in the ACPI_PARSER array. @retval Number of bytes parsed. -*/ +**/ UINT32 EFIAPI ParseAcpi ( IN BOOLEAN Trace, IN UINT32 Indent, IN CONST CHAR8* AsciiName OPTIONAL, IN UINT8* Ptr, IN UINT32 Length, IN CONST ACPI_PARSER* Parser, IN UINT32 ParserItems -); + ); -/** This is a helper macro to pass parameters to the Parser functions. +/** + This is a helper macro to pass parameters to the Parser functions. @param [in] Parser The name of the ACPI_PARSER array describing the ACPI table fields. -*/ +**/ #define PARSER_PARAMS(Parser) Parser, sizeof (Parser) / sizeof (Parser[0]) -/** This is a helper macro for describing the ACPI header fields. +/** + This is a helper macro for describing the ACPI header fields. @param [out] Info Pointer to retrieve the ACPI table header information. -*/ +**/ #define PARSE_ACPI_HEADER(Info) \ { L"Signature", 4, 0, NULL, Dump4Chars, \ (VOID**)&(Info)->Signature , NULL, NULL }, \ { L"Length", 4, 4, L"%d", NULL, \ (VOID**)&(Info)->Length, NULL, NULL }, \ @@ -XXX,XX +XXX,XX @@ ParseAcpi ( { L"Creator ID", 4, 28, NULL, Dump4Chars, \ (VOID**)&(Info)->CreatorId, NULL, NULL }, \ { L"Creator Revision", 4, 32, L"0x%X", NULL, \ (VOID**)&(Info)->CreatorRevision, NULL, NULL } -/** Length of the ACPI GAS structure. +/** + Length of the ACPI GAS structure. NOTE: This might normally be defined as sizeof (EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE). However, we deliberately minimise any reference to the EDK2 ACPI headers in an attempt to provide cross checking. -*/ +**/ #define GAS_LENGTH 12 -/** Length of the ACPI Header structure. +/** + Length of the ACPI Header structure. NOTE: This might normally be defined as sizeof (EFI_ACPI_DESCRIPTION_HEADER). However, we deliberately minimise any reference to the EDK2 ACPI headers in an attempt to provide cross checking. -*/ +**/ #define ACPI_DESCRIPTION_HEADER_LENGTH 36 -/** This function indents and traces the GAS structure as described - by the GasParser. +/** + This function indents and traces the GAS structure as described by the GasParser. @param [in] Ptr Pointer to the start of the buffer. @param [in] Indent Number of spaces to indent the output. -*/ +**/ VOID EFIAPI DumpGasStruct ( IN UINT8* Ptr, IN UINT32 Indent ); -/** This function traces the GAS structure as described by the GasParser. +/** + This function traces the GAS structure as described by the GasParser. @param [in] Format Optional format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpGas ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr ); -/** This function traces the ACPI header as described by the AcpiHeaderParser. +/** + This function traces the ACPI header as described by the AcpiHeaderParser. @param [in] Ptr Pointer to the start of the buffer. @retval Number of bytes parsed. -*/ +**/ UINT32 EFIAPI DumpAcpiHeader ( IN UINT8* Ptr ); -/** This function parses the ACPI header as described by the AcpiHeaderParser. +/** + This function parses the ACPI header as described by the AcpiHeaderParser. This function optionally returns the Signature, Length and revision of the ACPI table. @param [in] Ptr Pointer to the start of the buffer. @param [out] Signature Gets location of the ACPI table signature. @param [out] Length Gets location of the length of the ACPI table. @param [out] Revision Gets location of the revision of the ACPI table. @retval Number of bytes parsed. -*/ +**/ UINT32 EFIAPI ParseAcpiHeader ( IN UINT8* Ptr, OUT CONST UINT32** Signature, OUT CONST UINT32** Length, OUT CONST UINT8** Revision ); -/** This function parses the ACPI BGRT table. +/** + This function parses the ACPI BGRT table. When trace is enabled this function parses the BGRT 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 ParseAcpiBgrt ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI DBG2 table. +/** + This function parses the ACPI DBG2 table. When trace is enabled this function parses the DBG2 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 ParseAcpiDbg2 ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI DSDT table. +/** + This function parses the ACPI DSDT table. When trace is enabled this function parses the DSDT table and traces the ACPI table fields. For the DSDT table only the ACPI header fields are parsed and traced. @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 ParseAcpiDsdt ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI FADT table. +/** + This function parses the ACPI FADT table. This function parses the FADT table and optionally 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 ParseAcpiFadt ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI GTDT table. +/** + This function parses the ACPI GTDT table. When trace is enabled this function parses the GTDT table and traces the ACPI table fields. This function also parses the following platform timer structures: - GT Block timer @@ -XXX,XX +XXX,XX @@ ParseAcpiFadt ( @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 ParseAcpiGtdt ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI IORT table. +/** + This function parses the ACPI IORT table. When trace is enabled this function parses the IORT table and traces the ACPI fields. This function also parses the following nodes: - ITS Group @@ -XXX,XX +XXX,XX @@ ParseAcpiGtdt ( @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 ParseAcpiIort ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI MADT table. +/** + This function parses the ACPI MADT table. When trace is enabled this function parses the MADT table and traces the ACPI table fields. This function currently parses the following Interrupt Controller Structures: @@ -XXX,XX +XXX,XX @@ ParseAcpiIort ( @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 ParseAcpiMadt ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI MCFG table. +/** + This function parses the ACPI MCFG table. When trace is enabled this function parses the MCFG 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 ParseAcpiMcfg ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI RSDP table. +/** + This function parses the ACPI RSDP table. This function invokes the parser for the XSDT table. * Note - This function does not support parsing of RSDT table. This function also performs a RAW dump of the ACPI table and @@ -XXX,XX +XXX,XX @@ ParseAcpiMcfg ( @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 ParseAcpiRsdp ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI SLIT table. +/** + This function parses the ACPI SLIT table. When trace is enabled this function parses the SLIT table and traces the ACPI table fields. This function also validates System Localities for the following: - Diagonal elements have a normalized value of 10 @@ -XXX,XX +XXX,XX @@ ParseAcpiRsdp ( @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 ParseAcpiSlit ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI SPCR table. +/** + This function parses the ACPI SPCR table. When trace is enabled this function parses the SPCR table and traces the ACPI table fields. This function also performs validations 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 ParseAcpiSpcr ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI SRAT table. +/** + This function parses the ACPI SRAT table. When trace is enabled this function parses the SRAT table and traces the ACPI table fields. This function parses the following Resource Allocation Structures: - Processor Local APIC/SAPIC Affinity Structure @@ -XXX,XX +XXX,XX @@ ParseAcpiSpcr ( @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 ParseAcpiSrat ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI SSDT table. +/** + This function parses the ACPI SSDT table. When trace is enabled this function parses the SSDT table and traces the ACPI table fields. For the SSDT table only the ACPI header fields are parsed and traced. @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 ParseAcpiSsdt ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI XSDT table +/** + This function parses the ACPI XSDT table and optionally traces the ACPI table fields. This function also performs validation of the XSDT 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 ParseAcpiXsdt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file ACPI table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include <Library/UefiLib.h> #include "AcpiParser.h" #include "AcpiTableParser.h" #include "AcpiView.h" -/** A list of registered ACPI table parsers. -*/ +/** + A list of registered ACPI table parsers. +**/ STATIC ACPI_TABLE_PARSER mTableParserList[MAX_ACPI_TABLE_PARSERS]; -/** Register the ACPI table Parser +/** + Register the ACPI table Parser This function registers the ACPI table parser. @param [in] Signature The ACPI table signature. @param [in] ParserProc The ACPI table parser. @@ -XXX,XX +XXX,XX @@ STATIC ACPI_TABLE_PARSER mTableParserList[MAX_ACPI_TABLE_PARSERS]; @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_ALREADY_STARTED The parser for the Table was already registered. @retval EFI_OUT_OF_RESOURCES No space to register the parser. -*/ +**/ EFI_STATUS EFIAPI RegisterParser ( IN UINT32 Signature, IN PARSE_ACPI_TABLE_PROC ParserProc @@ -XXX,XX +XXX,XX @@ RegisterParser ( // No free slot found return EFI_OUT_OF_RESOURCES; } -/** Deregister the ACPI table Parser +/** + Deregister the ACPI table Parser This function deregisters the ACPI table parser. @param [in] Signature The ACPI table signature. @retval EFI_SUCCESS The parser was deregistered. @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_NOT_FOUND A registered parser was not found. -*/ +**/ EFI_STATUS EFIAPI DeregisterParser ( IN UINT32 Signature ) @@ -XXX,XX +XXX,XX @@ DeregisterParser ( // No matching registered parser found. return EFI_NOT_FOUND; } -/** Get the ACPI table Parser +/** + Get the ACPI table Parser This function returns the ACPI table parser proc from the list of registered parsers. @param [in] Signature The ACPI table signature. @param [out] ParserProc Pointer to a ACPI table parser proc. @retval EFI_SUCCESS The parser was returned successfully. @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_NOT_FOUND A registered parser was not found. -*/ +**/ EFI_STATUS EFIAPI GetParser ( IN UINT32 Signature, OUT PARSE_ACPI_TABLE_PROC * ParserProc @@ -XXX,XX +XXX,XX @@ GetParser ( // No matching registered parser found. return EFI_NOT_FOUND; } -/** This function processes the ACPI tables. +/** + This function processes the ACPI tables. This function calls ProcessTableReportOptions() to list the ACPI tables, perform binary dump of the tables and determine if the ACPI fields should be traced. This function also invokes the parser for the ACPI tables. @@ -XXX,XX +XXX,XX @@ GetParser ( This function also performs a RAW dump of the ACPI table including the unknown/unparsed ACPI tables and validates the checksum. @param [in] Ptr Pointer to the start of the ACPI table data buffer. -*/ +**/ VOID EFIAPI ProcessAcpiTable ( IN UINT8* Ptr ) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h @@ -XXX,XX +XXX,XX @@ -/** +/** @file Header file for ACPI table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ **/ #ifndef ACPITABLEPARSER_H_ #define ACPITABLEPARSER_H_ -/** The maximum number of ACPI table parsers. +/** + The maximum number of ACPI table parsers. */ #define MAX_ACPI_TABLE_PARSERS 16 /** An invalid/NULL signature value. */ #define ACPI_PARSER_SIGNATURE_NULL 0 -/** A function that parses the ACPI table. +/** + A function that parses the ACPI 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. -*/ +**/ typedef VOID (EFIAPI * PARSE_ACPI_TABLE_PROC) ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** The ACPI table parser information -*/ +/** + The ACPI table parser information +**/ typedef struct AcpiTableParser { /// ACPI table signature UINT32 Signature; /// The ACPI table parser function. PARSE_ACPI_TABLE_PROC Parser; } ACPI_TABLE_PARSER; -/** Register the ACPI table Parser +/** + Register the ACPI table Parser This function registers the ACPI table parser. @param [in] Signature The ACPI table signature. @param [in] ParserProc The ACPI table parser. @@ -XXX,XX +XXX,XX @@ typedef struct AcpiTableParser { @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_ALREADY_STARTED The parser for the Table was already registered. @retval EFI_OUT_OF_RESOURCES No space to register the parser. -*/ +**/ EFI_STATUS EFIAPI RegisterParser ( IN UINT32 Signature, IN PARSE_ACPI_TABLE_PROC ParserProc -); + ); -/** Deregister the ACPI table Parser +/** + Deregister the ACPI table Parser This function deregisters the ACPI table parser. @param [in] Signature The ACPI table signature. @retval EFI_SUCCESS The parser was deregistered. @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_NOT_FOUND A registered parser was not found. -*/ +**/ EFI_STATUS EFIAPI DeregisterParser ( IN UINT32 Signature -); + ); -/** This function processes the ACPI tables. +/** + This function processes the ACPI tables. This function calls ProcessTableReportOptions() to list the ACPI tables, perform binary dump of the tables and determine if the ACPI fields should be traced. This function also invokes the parser for the ACPI tables. @@ -XXX,XX +XXX,XX @@ DeregisterParser ( This function also performs a RAW dump of the ACPI table including the unknown/unparsed ACPI tables and validates the checksum. @param [in] Ptr Pointer to the start of the ACPI table data buffer. -*/ +**/ VOID EFIAPI ProcessAcpiTable ( IN UINT8* Ptr ); -/** Get the ACPI table Parser +/** + Get the ACPI table Parser This function returns the ACPI table parser proc from the list of registered parsers. @param [in] Signature The ACPI table signature. @param [out] ParserProc Pointer to a ACPI table parser proc. @retval EFI_SUCCESS The parser was returned successfully. @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_NOT_FOUND A registered parser was not found. -*/ +**/ EFI_STATUS EFIAPI GetParser ( IN UINT32 Signature, OUT PARSE_ACPI_TABLE_PROC * ParserProc diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -XXX,XX +XXX,XX @@ STATIC UINT32 mTableCount; STATIC UINT32 mBinTableCount; STATIC BOOLEAN mVerbose; STATIC BOOLEAN mConsistencyCheck; STATIC BOOLEAN mColourHighlighting; -/** An array of acpiview command line parameters. -*/ +/** + An array of acpiview command line parameters. +**/ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { {L"/?", TypeFlag}, {L"-c", TypeFlag}, {L"-d", TypeFlag}, {L"-h", TypeValue}, @@ -XXX,XX +XXX,XX @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { {L"-s", TypeValue}, {L"-v", TypeFlag}, {NULL, TypeMax} }; -/** This function returns the colour highlighting status. +/** + This function returns the colour highlighting status. @retval TRUE if colour highlighting is enabled. -*/ +**/ BOOLEAN GetColourHighlighting ( VOID ) { return mColourHighlighting; } -/** This function sets the colour highlighting status. +/** + This function sets the colour highlighting status. -*/ + @param Highlight The Highlight status. + +**/ VOID SetColourHighlighting ( BOOLEAN Highlight ) { mColourHighlighting = Highlight; } -/** This function returns the report options. +/** + This function returns the report options. @retval Returns the report option. -*/ +**/ STATIC EREPORT_OPTION GetReportOption ( VOID ) { return mReportType; } -/** This function returns the selected ACPI table. +/** + This function returns the selected ACPI table. @retval Returns signature of the selected ACPI table. -*/ +**/ STATIC UINT32 GetSelectedAcpiTable ( VOID ) { return mSelectedAcpiTable; } -/** This function dumps the ACPI table to a file. +/** + This function dumps the ACPI table to a file. + @param [in] Ptr Pointer to the ACPI table data. @param [in] Length The length of the ACPI table. @retval TRUE Success. @retval FALSE Failure. -*/ +**/ STATIC BOOLEAN DumpAcpiTableToFile ( IN CONST UINT8* Ptr, IN CONST UINTN Length @@ -XXX,XX +XXX,XX @@ DumpAcpiTableToFile ( ShellCloseFile (&DumpFileHandle); return (Length == TransferBytes); } -/** This function processes the table reporting options for the ACPI table. +/** + This function processes the table reporting options for the ACPI table. @param [in] Signature The ACPI table Signature. @param [in] TablePtr Pointer to the ACPI table data. @param [in] Length The length fo the ACPI table. @retval Returns TRUE if the ACPI table should be traced. -*/ +**/ BOOLEAN ProcessTableReportOptions ( IN CONST UINT32 Signature, IN CONST UINT8* TablePtr, IN CONST UINT32 Length @@ -XXX,XX +XXX,XX @@ ProcessTableReportOptions ( } return Log; } -/** This function converts a string to ACPI table signature. +/** + This function converts a string to ACPI table signature. @param [in] Str Pointer to the string to be converted to the ACPI table signature. @retval The ACPI table signature. -*/ +**/ STATIC UINT32 ConvertStrToAcpiSignature ( IN CONST CHAR16* Str ) @@ -XXX,XX +XXX,XX @@ ConvertStrToAcpiSignature ( Index++; } return *(UINT32*)Ptr; } -/** This function iterates the configuration table entries in the - system table, retrieves the RSDP pointer and starts parsing - the ACPI tables. +/** + This function iterates the configuration table entries in the + system table, retrieves the RSDP pointer and starts parsing the ACPI tables. @param [in] SystemTable Pointer to the EFI system table. @retval Returns EFI_NOT_FOUND if the RSDP pointer is not found. Returns EFI_UNSUPPORTED if the RSDP version is less than 2. Returns EFI_SUCCESS if successful. -*/ +**/ STATIC EFI_STATUS EFIAPI AcpiView ( IN EFI_SYSTEM_TABLE* SystemTable @@ -XXX,XX +XXX,XX @@ AcpiView ( /** Function for 'acpiview' command. @param[in] ImageHandle Handle to the Image (NULL if Internal). @param[in] SystemTable Pointer to the System Table (NULL if Internal). -*/ +**/ SHELL_STATUS EFIAPI ShellCommandRunAcpiView ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE* SystemTable diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h @@ -XXX,XX +XXX,XX @@ -/** +/** @file Header file for AcpiView Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ **/ #ifndef ACPIVIEW_H_ #define ACPIVIEW_H_ -/** A macro to define the max file name length -*/ +/** + A macro to define the max file name length +**/ #define MAX_FILE_NAME_LEN 128 -/** Offset to the RSDP revision from the start of the RSDP -*/ +/** + Offset to the RSDP revision from the start of the RSDP +**/ #define RSDP_REVISION_OFFSET 15 -/** Offset to the RSDP length from the start of the RSDP -*/ +/** + Offset to the RSDP length from the start of the RSDP +**/ #define RSDP_LENGTH_OFFSET 20 -/** The EREPORT_OPTION enum describes ACPI table Reporting options. -*/ +/** + The EREPORT_OPTION enum describes ACPI table Reporting options. +**/ typedef enum ReportOption { EREPORT_ALL, ///< Report All tables. EREPORT_SELECTED, ///< Report Selected table. EREPORT_TABLE_LIST, ///< Report List of tables. EREPORT_DUMP_BIN_FILE, ///< Dump selected table to a file. EREPORT_MAX } EREPORT_OPTION; -/** This function resets the ACPI table error counter to Zero. -*/ +/** + This function resets the ACPI table error counter to Zero. +**/ VOID ResetErrorCount ( VOID ); -/** This function returns the ACPI table error count. +/** + This function returns the ACPI table error count. @retval Returns the count of errors detected in the ACPI tables. -*/ +**/ UINT32 GetErrorCount ( VOID ); -/** This function resets the ACPI table warning counter to Zero. -*/ +/** + This function resets the ACPI table warning counter to Zero. +**/ VOID ResetWarningCount ( VOID ); -/** This function returns the ACPI table warning count. +/** + This function returns the ACPI table warning count. @retval Returns the count of warning detected in the ACPI tables. -*/ +**/ UINT32 GetWarningCount ( VOID ); -/** This function returns the colour highlighting status. +/** + This function returns the colour highlighting status. @retval TRUE if colour highlighting is enabled. -*/ +**/ BOOLEAN GetColourHighlighting ( VOID ); -/** This function sets the colour highlighting status. +/** + This function sets the colour highlighting status. + + @param Highlight The Highlight status. -*/ +**/ VOID SetColourHighlighting ( BOOLEAN Highlight ); -/** This function processes the table reporting options for the ACPI table. +/** + This function processes the table reporting options for the ACPI table. @param [in] Signature The ACPI table Signature. @param [in] TablePtr Pointer to the ACPI table data. @param [in] Length The length fo the ACPI table. @retval Returns TRUE if the ACPI table should be traced. -*/ +**/ BOOLEAN ProcessTableReportOptions ( IN CONST UINT32 Signature, IN CONST UINT8* TablePtr, IN CONST UINT32 Length diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file BGRT table parser Copyright (c) 2017 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include "AcpiTableParser.h" // Local variables STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** An ACPI_PARSER array describing the ACPI BDRT Table. -*/ +/** + An ACPI_PARSER array describing the ACPI BDRT Table. +**/ STATIC CONST ACPI_PARSER BgrtParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"Version", 2, 36, L"0x%x", NULL, NULL, NULL, NULL}, {L"Status", 1, 38, L"0x%x", NULL, NULL, NULL, NULL}, {L"Image Type", 1, 39, L"0x%x", NULL, NULL, NULL, NULL}, {L"Image Address", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Image Offset X", 4, 48, L"%d", NULL, NULL, NULL, NULL}, {L"Image Offset Y", 4, 52, L"%d", NULL, NULL, NULL, NULL} }; -/** This function parses the ACPI BGRT table. +/** + This function parses the ACPI BGRT table. When trace is enabled this function parses the BGRT 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 ParseAcpiBgrt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file DBG2 table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ STATIC CONST UINT16* OEMDataLength; STATIC CONST UINT16* OEMDataOffset; STATIC CONST UINT16* BaseAddrRegOffset; STATIC CONST UINT16* AddrSizeOffset; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** This function Validates the NameSpace string length. +/** + This function Validates the NameSpace string length. @param [in] Ptr Pointer to the start of the buffer. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateNameSpaceStrLen ( IN UINT8* Ptr, IN VOID* Context ); -/** This function parses the debug device information structure. +/** + This function parses the debug device information structure. @param [in] Ptr Pointer to the start of the buffer. @param [out] Length Pointer in which the length of the debug device information is returned. -*/ +**/ STATIC VOID EFIAPI DumpDbgDeviceInfo ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER DbgDevInfoParser[] = { (VOID**)&BaseAddrRegOffset, NULL, NULL}, {L"Address Size Offset", 2, 20, L"0x%x", NULL, (VOID**)&AddrSizeOffset, NULL, NULL} }; -/** This function validates the NameSpace string length. +/** + This function validates the NameSpace string length. @param [in] Ptr Pointer to the start of the buffer. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateNameSpaceStrLen ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateNameSpaceStrLen ( NameSpaceStrLen ); } } -/** This function parses the debug device information structure. +/** + This function parses the debug device information structure. @param [in] Ptr Pointer to the start of the buffer. - @param [out] Ptr Pointer in which the length of the debug + @param [out] Length Pointer in which the length of the debug device information is returned. -*/ +**/ STATIC VOID EFIAPI DumpDbgDeviceInfo ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ DumpDbgDeviceInfo ( } *Length = *DbgDevInfoLen; } -/** This function parses the ACPI DBG2 table. +/** + This function parses the ACPI DBG2 table. When trace is enabled this function parses the DBG2 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 ParseAcpiDbg2 ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file DSDT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include <IndustryStandard/Acpi.h> #include <Library/UefiLib.h> #include "AcpiParser.h" #include "AcpiTableParser.h" -/** This function parses the ACPI DSDT table. +/** + This function parses the ACPI DSDT table. When trace is enabled this function parses the DSDT table and traces the ACPI table fields. For the DSDT table only the ACPI header fields are parsed and traced. @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 ParseAcpiDsdt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file FADT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ STATIC CONST UINT32* DsdtAddress; STATIC CONST UINT64* X_DsdtAddress; STATIC CONST UINT8* FadtMinorRevision; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** A macro defining the Hardware reduced ACPI flag -*/ +/** + A macro defining the Hardware reduced ACPI flag +**/ #define HW_REDUCED_ACPI BIT20 -// Forward declarations +/** + Get the ACPI XSDT header info. +**/ CONST ACPI_DESCRIPTION_HEADER_INFO* CONST EFIAPI GetAcpiXsdtHeaderInfo ( VOID -); + ); +/** + This function validates the Firmware Control Field. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ STATIC VOID EFIAPI ValidateFirmwareCtrl ( IN UINT8* Ptr, IN VOID* Context -); + ); + +/** + This function validates the X_Firmware Control Field. + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ STATIC VOID EFIAPI ValidateXFirmwareCtrl ( IN UINT8* Ptr, IN VOID* Context -); + ); +/** + This function validates the flags. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ STATIC VOID EFIAPI ValidateFlags ( IN UINT8* Ptr, IN VOID* Context -); + ); -/** An ACPI_PARSER array describing the ACPI FADT Table. -*/ +/** + An ACPI_PARSER array describing the ACPI FADT Table. +**/ STATIC CONST ACPI_PARSER FadtParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"FIRMWARE_CTRL", 4, 36, L"0x%x", NULL, NULL, ValidateFirmwareCtrl, NULL}, {L"DSDT", 4, 40, L"0x%x", NULL, (VOID**)&DsdtAddress, NULL, NULL}, {L"Reserved", 1, 44, L"%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER FadtParser[] = { {L"SLEEP_CONTROL_REG", 12, 244, NULL, DumpGas, NULL, NULL, NULL}, {L"SLEEP_STATUS_REG", 12, 256, NULL, DumpGas, NULL, NULL, NULL}, {L"Hypervisor VendorIdentity", 8, 268, L"%lx", NULL, NULL, NULL, NULL} }; -/** This function validates the Firmware Control Field. +/** + This function validates the Firmware Control Field. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateFirmwareCtrl ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateFirmwareCtrl ( ); } #endif } -/** This function validates the X_Firmware Control Field. +/** + This function validates the X_Firmware Control Field. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateXFirmwareCtrl ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateXFirmwareCtrl ( ); } #endif } -/** This function validates the flags. +/** + This function validates the flags. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateFlags ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateFlags ( ); } #endif } -/** This function parses the ACPI FADT table. - This function parses the FADT table and optionally traces the ACPI - table fields. +/** + This function parses the ACPI FADT table. + This function parses the FADT table and optionally 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 ParseAcpiFadt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file GTDT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ STATIC CONST UINT16* PlatformTimerLength; STATIC CONST UINT32* GtBlockTimerCount; STATIC CONST UINT32* GtBlockTimerOffset; STATIC CONST UINT16* GtBlockLength; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** This function validates the GT Block timer count. +/** + This function validates the GT Block timer count. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateGtBlockTimerCount ( IN UINT8* Ptr, IN VOID* Context ); -/** An ACPI_PARSER array describing the ACPI GTDT Table. -*/ +/** + An ACPI_PARSER array describing the ACPI GTDT Table. +**/ STATIC CONST ACPI_PARSER GtdtParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"CntControlBase Physical Address", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Reserved", 4, 44, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER GtdtParser[] = { (VOID**)&GtdtPlatformTimerCount, NULL, NULL}, {L"Platform Timer Offset", 4, 92, L"0x%x", NULL, (VOID**)&GtdtPlatformTimerOffset, NULL, NULL} }; -/** An ACPI_PARSER array describing the Platform timer header. -*/ +/** + An ACPI_PARSER array describing the Platform timer header. +**/ STATIC CONST ACPI_PARSER GtPlatformTimerHeaderParser[] = { {L"Type", 1, 0, NULL, NULL, (VOID**)&PlatformTimerType, NULL, NULL}, {L"Length", 2, 1, NULL, NULL, (VOID**)&PlatformTimerLength, NULL, NULL}, {L"Reserved", 1, 3, NULL, NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the Platform GT Block. -*/ +/** + An ACPI_PARSER array describing the Platform GT Block. +**/ STATIC CONST ACPI_PARSER GtBlockParser[] = { {L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL}, {L"Length", 2, 1, L"%d", NULL, (VOID**)&GtBlockLength, NULL, NULL}, {L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL}, {L"Physical address (CntCtlBase)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER GtBlockParser[] = { ValidateGtBlockTimerCount, NULL}, {L"Timer Offset", 4, 16, L"%d", NULL, (VOID**)&GtBlockTimerOffset, NULL, NULL} }; -/** An ACPI_PARSER array describing the GT Block timer. -*/ +/** + An ACPI_PARSER array describing the GT Block timer. +**/ STATIC CONST ACPI_PARSER GtBlockTimerParser[] = { {L"Frame Number", 1, 0, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}, {L"Physical address (CntBaseX)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx", NULL, NULL, NULL, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER GtBlockTimerParser[] = { {L"Virtual Timer GSIV", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, {L"Virtual Timer Flags", 4, 32, L"0x%x", NULL, NULL, NULL, NULL}, {L"Common Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the Platform Watchdog. -*/ +/** + An ACPI_PARSER array describing the Platform Watchdog. +**/ STATIC CONST ACPI_PARSER SBSAGenericWatchdogParser[] = { {L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL}, {L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL}, {L"RefreshFrame Physical address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}, {L"ControlFrame Physical address", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Watchdog Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL}, {L"Watchdog Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL} }; -/** This function validates the GT Block timer count. +/** + This function validates the GT Block timer count. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateGtBlockTimerCount ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateGtBlockTimerCount ( BlockTimerCount ); } } -/** This function parses the Platform GT Block. +/** + This function parses the Platform GT Block. @param [in] Ptr Pointer to the start of the GT Block data. @param [in] Length Length of the GT Block structure. -*/ +**/ STATIC VOID DumpGTBlock ( IN UINT8* Ptr, IN UINT16 Length @@ -XXX,XX +XXX,XX @@ DumpGTBlock ( ); } } } -/** This function parses the Platform Watchdog timer. +/** + This function parses the Platform Watchdog timer. @param [in] Ptr Pointer to the start of the watchdog timer data. @param [in] Length Length of the watchdog timer structure. -*/ +**/ STATIC VOID DumpWatchdogTimer ( IN UINT8* Ptr, IN UINT16 Length @@ -XXX,XX +XXX,XX @@ DumpWatchdogTimer ( Length, PARSER_PARAMS (SBSAGenericWatchdogParser) ); } -/** This function parses the ACPI GTDT table. +/** + This function parses the ACPI GTDT table. When trace is enabled this function parses the GTDT table and traces the ACPI table fields. This function also parses the following platform timer structures: - GT Block timer @@ -XXX,XX +XXX,XX @@ DumpWatchdogTimer ( @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 ParseAcpiGtdt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file IORT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include "AcpiTableParser.h" // Local variables STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** The EIORT_NODE enum describes the IORT Node types. -*/ +/** + The EIORT_NODE enum describes the IORT Node types. +**/ typedef enum IortNode { EIORT_NODE_ITS_GROUP, ///< ITS Group node EIORT_NODE_NAMED_COMPONENT, ///< Named Component node EIORT_NODE_ROOT_COMPLEX, ///< Root Complex node EIORT_NODE_SMMUV1_V2, ///< SMMU v1/v2 node @@ -XXX,XX +XXX,XX @@ STATIC CONST UINT32* InterruptContextOffset; STATIC CONST UINT32* PmuInterruptCount; STATIC CONST UINT32* PmuInterruptOffset; STATIC CONST UINT32* ItsCount; -/** This function validates the ID Mapping array count for the ITS node. +/** + 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] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateItsIdMappingCount ( IN UINT8* Ptr, IN VOID* Context ); -/** This function validates the ID Mapping array offset for the ITS node. +/** + 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] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateItsIdArrayReference ( IN UINT8* Ptr, IN VOID* Context ); -/** Helper Macro for populating the IORT Node header in the ACPI_PARSER - array. +/** + Helper Macro for populating the IORT Node header in the ACPI_PARSER array. @param [out] ValidateIdMappingCount Optional pointer to a function for validating the ID Mapping count. @param [out] ValidateIdArrayReference Optional pointer to a function for validating the ID Array reference. -*/ +**/ #define PARSE_IORT_NODE_HEADER(ValidateIdMappingCount, \ ValidateIdArrayReference) \ { L"Type", 1, 0, L"%d", NULL, (VOID**)&IortNodeType, NULL, NULL }, \ { L"Length", 2, 1, L"%d", NULL, (VOID**)&IortNodeLength, NULL, NULL }, \ { L"Revision", 1, 3, L"%d", NULL, NULL, NULL, NULL }, \ @@ -XXX,XX +XXX,XX @@ ValidateItsIdArrayReference ( { L"Number of ID mappings", 4, 8, L"%d", NULL, \ (VOID**)&IortIdMappingCount, ValidateIdMappingCount, NULL }, \ { L"Reference to ID Array", 4, 12, L"0x%x", NULL, \ (VOID**)&IortIdMappingOffset, ValidateIdArrayReference, NULL } -/** An ACPI_PARSER array describing the ACPI IORT Table -*/ +/** + An ACPI_PARSER array describing the ACPI IORT Table +**/ STATIC CONST ACPI_PARSER IortParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"Number of IORT Nodes", 4, 36, L"%d", NULL, (VOID**)&IortNodeCount, NULL, NULL}, {L"Offset to Array of IORT Nodes", 4, 40, L"0x%x", NULL, (VOID**)&IortNodeOffset, NULL, NULL}, {L"Reserved", 4, 44, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the IORT node header structure. -*/ +/** + An ACPI_PARSER array describing the IORT node header structure. +**/ STATIC CONST ACPI_PARSER IortNodeHeaderParser[] = { PARSE_IORT_NODE_HEADER (NULL, NULL) }; -/** An ACPI_PARSER array describing the IORT SMMUv1/2 node. -*/ +/** + An ACPI_PARSER array describing the IORT SMMUv1/2 node. +**/ STATIC CONST ACPI_PARSER IortNodeSmmuV1V2Parser[] = { PARSE_IORT_NODE_HEADER (NULL, NULL), {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Span", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Model", 4, 32, L"%d", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER IortNodeSmmuV1V2Parser[] = { {L"SMMU_NSgIrpt interrupt flags", 4, 64, L"0x%x", NULL, NULL, NULL, NULL}, {L"SMMU_NSgCfgIrpt", 4, 68, L"0x%x", NULL, NULL, NULL, NULL}, {L"SMMU_NSgCfgIrpt interrupt flags", 4, 72, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the SMMUv1/2 Node Interrupt Array. -*/ +/** + An ACPI_PARSER array describing the SMMUv1/2 Node Interrupt Array. +**/ STATIC CONST ACPI_PARSER InterruptArrayParser[] = { {L" Interrupt GSIV", 4, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L" Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the IORT ID Mapping. -*/ +/** + An ACPI_PARSER array describing the IORT ID Mapping. +**/ STATIC CONST ACPI_PARSER IortNodeIdMappingParser[] = { {L" Input base", 4, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L" Number of IDs", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, {L" Output base", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, {L" Output reference", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}, {L" Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the IORT SMMUv3 node. -*/ +/** + An ACPI_PARSER array describing the IORT SMMUv3 node. +**/ STATIC CONST ACPI_PARSER IortNodeSmmuV3Parser[] = { PARSE_IORT_NODE_HEADER (NULL, NULL), {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER IortNodeSmmuV3Parser[] = { {L"PRI", 4, 48, L"0x%x", NULL, NULL, NULL, NULL}, {L"GERR", 4, 52, L"0x%x", NULL, NULL, NULL, NULL}, {L"Sync", 4, 56, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the IORT ITS node. -*/ +/** + An ACPI_PARSER array describing the IORT ITS node. +**/ STATIC CONST ACPI_PARSER IortNodeItsParser[] = { PARSE_IORT_NODE_HEADER ( ValidateItsIdMappingCount, ValidateItsIdArrayReference ), {L" Number of ITSs", 4, 16, L"%d", NULL, (VOID**)&ItsCount, NULL} }; -/** An ACPI_PARSER array describing the ITS ID. -*/ +/** + An ACPI_PARSER array describing the ITS ID. +**/ STATIC CONST ACPI_PARSER ItsIdParser[] = { { L" GIC ITS Identifier", 4, 0, L"%d", NULL, NULL, NULL } }; -/** An ACPI_PARSER array describing the IORT Names Component node. -*/ +/** + An ACPI_PARSER array describing the IORT Names Component node. +**/ STATIC CONST ACPI_PARSER IortNodeNamedComponentParser[] = { PARSE_IORT_NODE_HEADER (NULL, NULL), {L"Node Flags", 4, 16, L"%d", NULL, NULL, NULL, NULL}, {L"Memory access properties", 8, 20, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Device memory address size limit", 1, 28, L"%d", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the IORT Root Complex node. -*/ +/** + An ACPI_PARSER array describing the IORT Root Complex node. +**/ STATIC CONST ACPI_PARSER IortNodeRootComplexParser[] = { PARSE_IORT_NODE_HEADER (NULL, NULL), {L"Memory access properties", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, {L"ATS Attribute", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, {L"PCI Segment number", 4, 28, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the IORT PMCG node. -*/ +/** + An ACPI_PARSER array describing the IORT PMCG node. +**/ STATIC CONST ACPI_PARSER IortNodePmcgParser[] = { PARSE_IORT_NODE_HEADER (NULL, NULL), {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Overflow interrupt GSIV", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, {L"Node reference", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, }; -/** This function validates the ID Mapping array count for the ITS node. +/** + 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] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateItsIdMappingCount ( IN UINT8* Ptr, - VOID* Context + IN VOID* Context ) { if (*(UINT32*)Ptr != 0) { IncrementErrorCount (); Print (L"\nERROR: IORT ID Mapping count must be zero."); } } -/** This function validates the ID Mapping array offset for the ITS node. +/** + 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] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateItsIdArrayReference ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateItsIdArrayReference ( IncrementErrorCount (); Print (L"\nERROR: IORT ID Mapping offset must be zero."); } } -/** This function parses the IORT Node Id Mapping array. +/** + This function parses the IORT Node Id Mapping array. @param [in] Ptr Pointer to the start of the IORT Table. @param [in] MappingCount The ID Mapping count. @param [in] MappingOffset The offset of the ID Mapping array from the start of the IORT table. -*/ +**/ STATIC VOID DumpIortNodeIdMappings ( IN UINT8* Ptr, IN UINT32 MappingCount, @@ -XXX,XX +XXX,XX @@ DumpIortNodeIdMappings ( IdMappingPtr += Offset; Index++; } } -/** This function parses the IORT SMMUv1/2 node. +/** + This function parses the IORT SMMUv1/2 node. @param [in] Ptr Pointer to the start of the buffer. @param [in] Length Length of the buffer. @param [in] MappingCount The ID Mapping count. @param [in] MappingOffset The offset of the ID Mapping array from the start of the IORT table. -*/ +**/ STATIC VOID DumpIortNodeSmmuV1V2 ( IN UINT8* Ptr, IN UINT16 Length, @@ -XXX,XX +XXX,XX @@ DumpIortNodeSmmuV1V2 ( if (*IortIdMappingCount != 0) { DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset); } } -/** This function parses the IORT SMMUv3 node. +/** + This function parses the IORT SMMUv3 node. @param [in] Ptr Pointer to the start of the buffer. @param [in] Length Length of the buffer. @param [in] MappingCount The ID Mapping count. @param [in] MappingOffset The offset of the ID Mapping array from the start of the IORT table. -*/ +**/ STATIC VOID DumpIortNodeSmmuV3 ( IN UINT8* Ptr, IN UINT16 Length, @@ -XXX,XX +XXX,XX @@ DumpIortNodeSmmuV3 ( if (*IortIdMappingCount != 0) { DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset); } } -/** This function parses the IORT ITS node. +/** + This function parses the IORT ITS node. @param [in] Ptr Pointer to the start of the buffer. @param [in] Length Length of the buffer. -*/ +**/ STATIC VOID DumpIortNodeIts ( IN UINT8* Ptr, IN UINT16 Length @@ -XXX,XX +XXX,XX @@ DumpIortNodeIts ( } // Note: ITS does not have the ID Mappings Array } -/** This function parses the IORT Named Component node. +/** + This function parses the IORT Named Component node. @param [in] Ptr Pointer to the start of the buffer. @param [in] Length Length of the buffer. @param [in] MappingCount The ID Mapping count. @param [in] MappingOffset The offset of the ID Mapping array from the start of the IORT table. -*/ +**/ STATIC VOID DumpIortNodeNamedComponent ( IN UINT8* Ptr, IN UINT16 Length, @@ -XXX,XX +XXX,XX @@ DumpIortNodeNamedComponent ( if (*IortIdMappingCount != 0) { DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset); } } -/** This function parses the IORT Root Complex node. +/** + This function parses the IORT Root Complex node. @param [in] Ptr Pointer to the start of the buffer. @param [in] Length Length of the buffer. @param [in] MappingCount The ID Mapping count. @param [in] MappingOffset The offset of the ID Mapping array from the start of the IORT table. -*/ +**/ STATIC VOID DumpIortNodeRootComplex ( IN UINT8* Ptr, IN UINT16 Length, @@ -XXX,XX +XXX,XX @@ DumpIortNodeRootComplex ( if (*IortIdMappingCount != 0) { DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset); } } -/** This function parses the IORT PMCG node. +/** + This function parses the IORT PMCG node. @param [in] Ptr Pointer to the start of the buffer. @param [in] Length Length of the buffer. @param [in] MappingCount The ID Mapping count. @param [in] MappingOffset The offset of the ID Mapping array from the start of the IORT table. -*/ +**/ STATIC VOID DumpIortNodePmcg ( IN UINT8* Ptr, IN UINT16 Length, @@ -XXX,XX +XXX,XX @@ DumpIortNodePmcg ( *IortIdMappingCount ); } } -/** This function parses the ACPI IORT table. - When trace is enabled this function parses the IORT table and - traces the ACPI fields. +/** + This function parses the ACPI IORT table. + When trace is enabled this function parses the IORT table and traces the ACPI fields. This function also parses the following nodes: - ITS Group - Named Component - Root Complex @@ -XXX,XX +XXX,XX @@ DumpIortNodePmcg ( @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 ParseAcpiIort ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file MADT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ // Local Variables STATIC CONST UINT8* MadtInterruptControllerType; STATIC CONST UINT8* MadtInterruptControllerLength; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -// Forward declarations +/** + This function validates the System Vector Base in the GICD. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ STATIC VOID EFIAPI ValidateGICDSystemVectorBase ( IN UINT8* Ptr, IN VOID* Context -); + ); -/** An ACPI_PARSER array describing the GICC Interrupt - Controller Structure. -*/ +/** + An ACPI_PARSER array describing the GICC Interrupt Controller Structure. +**/ STATIC CONST ACPI_PARSER GicCParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER GicCParser[] = { {L"Processor Power Efficiency Class", 1, 76, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 3, 77, L"%x %x %x", Dump3Chars, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the GICD Interrupt - Controller Structure. -*/ +/** + An ACPI_PARSER array describing the GICD Interrupt Controller Structure. +**/ STATIC CONST ACPI_PARSER GicDParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER GicDParser[] = { ValidateGICDSystemVectorBase, NULL}, {L"GIC Version", 1, 20, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 3, 21, L"%x %x %x", Dump3Chars, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the MSI Frame Interrupt - Controller Structure. -*/ +/** + An ACPI_PARSER array describing the MSI Frame Interrupt Controller Structure. +**/ STATIC CONST ACPI_PARSER GicMSIFrameParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER GicMSIFrameParser[] = { {L"SPI Count", 2, 20, L"%d", NULL, NULL, NULL, NULL}, {L"SPI Base", 2, 22, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the GICR Interrupt - Controller Structure. -*/ +/** + An ACPI_PARSER array describing the GICR Interrupt Controller Structure. +**/ STATIC CONST ACPI_PARSER GicRParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, {L"Discovery Range Base Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Discovery Range Length", 4, 12, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the GIC ITS Interrupt - Controller Structure. -*/ +/** + An ACPI_PARSER array describing the GIC ITS Interrupt Controller Structure. +**/ STATIC CONST ACPI_PARSER GicITSParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, {L"GIC ITS ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, {L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Reserved", 4, 16, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the ACPI MADT Table. -*/ +/** + An ACPI_PARSER array describing the ACPI MADT Table. +**/ STATIC CONST ACPI_PARSER MadtParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"Local Interrupt Controller Address", 4, 36, L"0x%x", NULL, NULL, NULL, NULL}, {L"Flags", 4, 40, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the MADT Interrupt - Controller Structure Header Structure. -*/ +/** + An ACPI_PARSER array describing the MADT Interrupt Controller Structure Header Structure. +**/ STATIC CONST ACPI_PARSER MadtInterruptControllerHeaderParser[] = { {NULL, 1, 0, NULL, NULL, (VOID**)&MadtInterruptControllerType, NULL, NULL}, {L"Length", 1, 1, NULL, NULL, (VOID**)&MadtInterruptControllerLength, NULL, NULL}, {L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL} }; -/** This function validates the System Vector Base in the GICD. +/** + This function validates the System Vector Base in the GICD. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateGICDSystemVectorBase ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateGICDSystemVectorBase ( L"\nERROR: System Vector Base must be zero." ); } } -/** This function parses the ACPI MADT table. +/** + This function parses the ACPI MADT table. When trace is enabled this function parses the MADT table and traces the ACPI table fields. This function currently parses the following Interrupt Controller Structures: @@ -XXX,XX +XXX,XX @@ ValidateGICDSystemVectorBase ( @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 ParseAcpiMadt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file MCFG table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include "AcpiTableParser.h" // Local variables STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** An ACPI_PARSER array describing the ACPI MCFG Table. -*/ +/** + An ACPI_PARSER array describing the ACPI MCFG Table. +**/ STATIC CONST ACPI_PARSER McfgParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"Reserved", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL}, }; -/** An ACPI_PARSER array describing the PCI configuration Space - Base Address structure. -*/ +/** + An ACPI_PARSER array describing the PCI configuration Space Base Address structure. +**/ STATIC CONST ACPI_PARSER PciCfgSpaceBaseAddrParser[] = { {L"Base Address", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL}, {L"PCI Segment Group No.", 2, 8, L"0x%x", NULL, NULL, NULL, NULL}, {L"Start Bus No.", 1, 10, L"0x%x", NULL, NULL, NULL, NULL}, {L"End Bus No.", 1, 11, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL} }; -/** This function parses the ACPI MCFG table. +/** + This function parses the ACPI MCFG table. When trace is enabled this function parses the MCFG 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 ParseAcpiMcfg ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file RSDP table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include "AcpiTableParser.h" // Local Variables STATIC CONST UINT64* XsdtAddress; -/** This function validates the RSDT Address. +/** + This function validates the RSDT Address. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateRsdtAddress ( IN UINT8* Ptr, IN VOID* Context ); -/** This function validates the XSDT Address. +/** + This function validates the XSDT Address. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateXsdtAddress ( IN UINT8* Ptr, IN VOID* Context ); -/** An array describing the ACPI RSDP Table. -*/ +/** + An array describing the ACPI RSDP Table. +**/ STATIC CONST ACPI_PARSER RsdpParser[] = { {L"Signature", 8, 0, NULL, Dump8Chars, NULL, NULL, NULL}, {L"Checksum", 1, 8, L"0x%x", NULL, NULL, NULL, NULL}, {L"Oem ID", 6, 9, NULL, Dump6Chars, NULL, NULL, NULL}, {L"Revision", 1, 15, L"%d", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER RsdpParser[] = { ValidateXsdtAddress, NULL}, {L"Extended Checksum", 1, 32, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL} }; -/** This function validates the RSDT Address. +/** + This function validates the RSDT Address. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateRsdtAddress ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateRsdtAddress ( ); } #endif } -/** This function validates the XSDT Address. +/** + This function validates the XSDT Address. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateXsdtAddress ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateXsdtAddress ( ); } #endif } -/** This function parses the ACPI RSDP table. +/** + This function parses the ACPI RSDP table. This function invokes the parser for the XSDT table. * Note - This function does not support parsing of RSDT table. This function also performs a RAW dump of the ACPI table and @@ -XXX,XX +XXX,XX @@ ValidateXsdtAddress ( @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 ParseAcpiRsdp ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file SLIT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ // Local Variables STATIC CONST UINT64* SlitSystemLocalityCount; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** An ACPI_PARSER array describing the ACPI SLIT table. -*/ +/** + An ACPI_PARSER array describing the ACPI SLIT table. +**/ STATIC CONST ACPI_PARSER SlitParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"Number of System Localities", 8, 36, L"0x%lx", NULL, (VOID**)&SlitSystemLocalityCount, NULL, NULL} }; -/** Macro to get the value of a System Locality -*/ +/** + Macro to get the value of a System Locality +**/ #define SLIT_ELEMENT(Ptr, i, j) *(Ptr + (i * LocalityCount) + j) -/** This function parses the ACPI SLIT table. +/** + This function parses the ACPI SLIT table. When trace is enabled this function parses the SLIT table and traces the ACPI table fields. This function also validates System Localities for the following: - Diagonal elements have a normalized value of 10 @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER SlitParser[] = { @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 ParseAcpiSlit ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file SPCR table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include "AcpiTableParser.h" // Local variables STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** This function validates the Interrupt Type. +/** + This function validates the Interrupt Type. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateInterruptType ( IN UINT8* Ptr, IN VOID* Context ); -/** This function validates the Irq. +/** + This function validates the Irq. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateIrq ( IN UINT8* Ptr, IN VOID* Context ); -/** An ACPI_PARSER array describing the ACPI SPCR Table. -*/ +/** + An ACPI_PARSER array describing the ACPI SPCR Table. +**/ STATIC CONST ACPI_PARSER SpcrParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"Interface Type", 1, 36, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 3, 37, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}, {L"Base Address", 12, 40, NULL, DumpGas, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER SpcrParser[] = { {L"PCI Flags", 4, 71, L"0x%x", NULL, NULL, NULL, NULL}, {L"PCI Segment", 1, 75, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 4, 76, L"%x", NULL, NULL, NULL, NULL} }; -/** This function validates the Interrupt Type. +/** + This function validates the Interrupt Type. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateInterruptType ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateInterruptType ( ); } #endif } -/** This function validates the Irq. +/** + This function validates the Irq. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateIrq ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateIrq ( ); } #endif } -/** This function parses the ACPI SPCR table. +/** + This function parses the ACPI SPCR table. When trace is enabled this function parses the SPCR table and traces the ACPI table fields. This function also performs validations 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 ParseAcpiSpcr ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file SRAT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ // Local Variables STATIC CONST UINT8* SratRAType; STATIC CONST UINT8* SratRALength; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** This function validates the Reserved field in the SRAT table header. +/** + This function validates the Reserved field in the SRAT table header. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateSratReserved ( IN UINT8* Ptr, IN VOID* Context ); -/** This function traces the APIC Proximity Domain field. +/** + This function traces the APIC Proximity Domain field. @param [in] Format Format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ STATIC VOID DumpSratApicProximity ( IN CONST CHAR16* Format, IN UINT8* Ptr ); -/** An ACPI_PARSER array describing the SRAT Table. -*/ +/** + An ACPI_PARSER array describing the SRAT Table. +**/ STATIC CONST ACPI_PARSER SratParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"Reserved", 4, 36, L"0x%x", NULL, NULL, ValidateSratReserved, NULL}, {L"Reserved", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the Resource Allocation - structure header. -*/ +/** + An ACPI_PARSER array describing the Resource Allocation structure header. +**/ STATIC CONST ACPI_PARSER SratResourceAllocationParser[] = { {L"Type", 1, 0, NULL, NULL, (VOID**)&SratRAType, NULL, NULL}, {L"Length", 1, 1, NULL, NULL, (VOID**)&SratRALength, NULL, NULL} }; -/** An ACPI_PARSER array describing the GICC Affinity structure. -*/ +/** + An ACPI_PARSER array describing the GICC Affinity structure. +**/ STATIC CONST ACPI_PARSER SratGicCAffinityParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, {L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL}, {L"ACPI Processor UID", 4, 6, L"0x%x", NULL, NULL, NULL, NULL}, {L"Flags", 4, 10, L"0x%x", NULL, NULL, NULL, NULL}, {L"Clock Domain", 4, 14, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the GIC ITS Affinity structure. -*/ +/** + An ACPI_PARSER array describing the GIC ITS Affinity structure. +**/ STATIC CONST ACPI_PARSER SratGicITSAffinityParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, {L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL}, {L"ITS Id", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, }; -/** An ACPI_PARSER array describing the Memory Affinity structure. -*/ +/** + An ACPI_PARSER array describing the Memory Affinity structure. +**/ STATIC CONST ACPI_PARSER SratMemAffinityParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, {L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER SratMemAffinityParser[] = { {L"Reserved", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, {L"Flags", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the APIC/SAPIC Affinity structure. -*/ +/** + An ACPI_PARSER array describing the APIC/SAPIC Affinity structure. +**/ STATIC CONST ACPI_PARSER SratApciSapicAffinityParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, {L"Proximity Domain [7:0]", 1, 2, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER SratApciSapicAffinityParser[] = { {L"Proximity Domain [31:8]", 3, 9, L"0x%x", DumpSratApicProximity, NULL, NULL, NULL}, {L"Clock Domain", 4, 12, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the Processor Local x2APIC - Affinity structure. -*/ +/** + An ACPI_PARSER array describing the Processor Local x2APIC Affinity structure. +**/ STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] = { /** This function validates the Reserved field in the SRAT table header. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateSratReserved ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateSratReserved ( IncrementErrorCount (); Print (L"\nERROR: Reserved should be 1 for backward compatibility.\n"); } } -/** This function traces the APIC Proximity Domain field. +/** + This function traces the APIC Proximity Domain field. @param [in] Format Format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ STATIC VOID DumpSratApicProximity ( IN CONST CHAR16* Format, IN UINT8* Ptr @@ -XXX,XX +XXX,XX @@ DumpSratApicProximity ( { UINT32 ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16); Print (Format, ProximityDomain); } -/** This function parses the ACPI SRAT table. +/** + This function parses the ACPI SRAT table. When trace is enabled this function parses the SRAT table and traces the ACPI table fields. This function parses the following Resource Allocation Structures: - Processor Local APIC/SAPIC Affinity Structure @@ -XXX,XX +XXX,XX @@ DumpSratApicProximity ( @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 ParseAcpiSrat ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file SSDT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include <IndustryStandard/Acpi.h> #include <Library/UefiLib.h> #include "AcpiParser.h" #include "AcpiTableParser.h" -/** This function parses the ACPI SSDT table. +/** + This function parses the ACPI SSDT table. When trace is enabled this function parses the SSDT table and traces the ACPI table fields. For the SSDT table only the ACPI header fields are parsed and traced. @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 ParseAcpiSsdt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file XSDT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; */ STATIC CONST ACPI_PARSER XsdtParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo) }; +/** + Get the ACPI XSDT header info. +**/ CONST ACPI_DESCRIPTION_HEADER_INFO* CONST EFIAPI GetAcpiXsdtHeaderInfo ( VOID ) { return &AcpiHdrInfo; } -/** This function parses the ACPI XSDT table - and optionally traces the ACPI table fields. +/** + This function parses the ACPI XSDT table and optionally traces the ACPI table fields. This function also performs validation of the XSDT 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 ParseAcpiXsdt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file Main file for 'acpiview' Shell command function. Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ ACPI_TABLE_PARSER ParserList[] = { {EFI_ACPI_6_2_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE, ParseAcpiSrat}, {EFI_ACPI_6_2_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiSsdt}, {EFI_ACPI_6_2_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiXsdt} }; -/** This function registers all the available table parsers. +/** + This function registers all the available table parsers. @retval EFI_SUCCESS The parser is registered. @retval EFI_ALREADY_STARTED The parser for the ACPI Table was already registered. @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_OUT_OF_RESOURCES No space to register the parser. -*/ +**/ EFI_STATUS RegisterAllParsers ( ) { EFI_STATUS Status; @@ -XXX,XX +XXX,XX @@ RegisterAllParsers ( /** Return the file name of the help text file if not using HII. @return The string pointer to the file name. -*/ +**/ CONST CHAR16* EFIAPI ShellCommandGetManFileNameAcpiView ( VOID ) @@ -XXX,XX +XXX,XX @@ ShellCommandGetManFileNameAcpiView ( @param SystemTable The EFI System Table pointer. @retval EFI_SUCCESS The Shell command handlers were installed successfully. @retval EFI_DEVICE_ERROR Hii package failed to install. -*/ +**/ EFI_STATUS EFIAPI UefiShellAcpiViewCommandLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable @@ -XXX,XX +XXX,XX @@ UefiShellAcpiViewCommandLibConstructor ( /** Destructor for the library. free any resources. @param ImageHandle The image handle of the process. @param SystemTable The EFI System Table pointer. -*/ +**/ EFI_STATUS EFIAPI UefiShellAcpiViewCommandLibDestructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h @@ -XXX,XX +XXX,XX @@ -/** +/** @file Header file for 'acpiview' Shell command functions. Copyright (c) 2016 - 2017, ARM Limited. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ extern EFI_HII_HANDLE gShellAcpiViewHiiHandle; /** Function for 'acpiview' command. @param[in] ImageHandle Handle to the Image (NULL if Internal). @param[in] SystemTable Pointer to the System Table (NULL if Internal). -*/ +**/ SHELL_STATUS EFIAPI ShellCommandRunAcpiView ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable -- 2.14.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
1. Separate variable definition and initialization. 2. Make the variable naming following Edk2 rule. Naming convention of local variable: a.First character should be upper case. b.Must contain lower case characters. c.No white space characters. Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Evan Lloyd <evan.lloyd@arm.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Evan Lloyd <evan.lloyd@arm.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> --- .../UefiShellAcpiViewCommandLib/AcpiParser.c | 44 ++++++++++------ .../UefiShellAcpiViewCommandLib/AcpiParser.h | 6 +-- .../UefiShellAcpiViewCommandLib/AcpiTableParser.c | 50 +++++++++---------- .../UefiShellAcpiViewCommandLib/AcpiTableParser.h | 6 +-- .../Library/UefiShellAcpiViewCommandLib/AcpiView.c | 58 ++++++++++++++-------- .../Library/UefiShellAcpiViewCommandLib/AcpiView.h | 16 +++--- .../Parsers/Dbg2/Dbg2Parser.c | 5 +- .../Parsers/Gtdt/GtdtParser.c | 5 +- .../Parsers/Iort/IortParser.c | 26 +++++----- .../Parsers/Madt/MadtParser.c | 4 +- .../Parsers/Rsdp/RsdpParser.c | 10 +++- .../Parsers/Slit/SlitParser.c | 44 ++++++++-------- .../Parsers/Spcr/SpcrParser.c | 10 +++- .../Parsers/Srat/SratParser.c | 21 +++++--- .../UefiShellAcpiViewCommandLib.c | 5 +- .../UefiShellAcpiViewCommandLib.h | 6 +-- .../UefiShellAcpiViewCommandLib.inf | 3 ++ 17 files changed, 190 insertions(+), 129 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -XXX,XX +XXX,XX @@ STATIC UINT32 gIndent; STATIC UINT32 mTableErrorCount; STATIC UINT32 mTableWarningCount; +STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; + +/** + An ACPI_PARSER array describing the ACPI header. +**/ +STATIC CONST ACPI_PARSER AcpiHeaderParser[] = { + PARSE_ACPI_HEADER (&AcpiHdrInfo) +}; + /** This function resets the ACPI table error counter to Zero. **/ VOID ResetErrorCount ( @@ -XXX,XX +XXX,XX @@ VerifyChecksum ( IN BOOLEAN Log, IN UINT8* Ptr, IN UINT32 Length ) { - UINTN ByteCount = 0; - UINT8 Checksum = 0; + UINTN ByteCount; + UINT8 Checksum; UINTN OriginalAttribute; + ByteCount = 0; + Checksum = 0; + while (ByteCount < Length) { Checksum += *(Ptr++); ByteCount++; } @@ -XXX,XX +XXX,XX @@ EFIAPI DumpRaw ( IN UINT8* Ptr, IN UINT32 Length ) { - UINTN ByteCount = 0; + UINTN ByteCount; UINTN PartLineChars; - UINTN AsciiBufferIndex = 0; + UINTN AsciiBufferIndex; CHAR8 AsciiBuffer[17]; + ByteCount = 0; + AsciiBufferIndex = 0; + Print (L"Address : 0x%p\n", Ptr); Print (L"Length : %d\n", Length); while (ByteCount < Length) { if ((ByteCount & 0x0F) == 0) { @@ -XXX,XX +XXX,XX @@ DumpUint64 ( ) { // Some fields are not aligned and this causes alignment faults // on ARM platforms if the compiler generates LDRD instructions. // Perform word access so that LDRD instructions are not generated. - UINT64 Val = *(UINT32*)(Ptr + sizeof (UINT32)); + UINT64 Val; + + Val = *(UINT32*)(Ptr + sizeof (UINT32)); + Val <<= 32; Val |= *(UINT32*)Ptr; Print (Format, Val); } @@ -XXX,XX +XXX,XX @@ ParseAcpi ( IN CONST ACPI_PARSER* Parser, IN UINT32 ParserItems ) { UINT32 Index; - UINT32 Offset = 0; + UINT32 Offset; + BOOLEAN HighLight; + + Offset = 0; // Increment the Indent gIndent += Indent; if (Trace && (AsciiName != NULL)){ - BOOLEAN HighLight = GetColourHighlighting (); + HighLight = GetColourHighlighting (); UINTN OriginalAttribute; if (HighLight) { OriginalAttribute = gST->ConOut->Mode->Attribute; gST->ConOut->SetAttribute ( @@ -XXX,XX +XXX,XX @@ UINT32 EFIAPI DumpAcpiHeader ( IN UINT8* Ptr ) { - ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - ACPI_PARSER AcpiHeaderParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo) - }; - return ParseAcpi ( TRUE, 0, "ACPI Table Header", Ptr, @@ -XXX,XX +XXX,XX @@ ParseAcpiHeader ( OUT CONST UINT32** Length, OUT CONST UINT8** Revision ) { UINT32 BytesParsed; - ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - ACPI_PARSER AcpiHeaderParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo) - }; BytesParsed = ParseAcpi ( FALSE, 0, NULL, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -XXX,XX +XXX,XX @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#ifndef ACPIPARSER_H_ -#define ACPIPARSER_H_ +#ifndef __ACPIPARSER_H__ +#define __ACPIPARSER_H__ #define OUTPUT_FIELD_COLUMN_WIDTH 36 /// The RSDP table signature is "RSD PTR " (8 bytes) /// However The signature for ACPI tables is 4 bytes. @@ -XXX,XX +XXX,XX @@ ParseAcpiXsdt ( IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -#endif // ACPIPARSER_H_ +#endif // __ACPIPARSER_H__ diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c @@ -XXX,XX +XXX,XX @@ EFIAPI RegisterParser ( IN UINT32 Signature, IN PARSE_ACPI_TABLE_PROC ParserProc ) { - UINT32 index; + UINT32 Index; if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) { return EFI_INVALID_PARAMETER; } // Search if a parser is already installed - for (index = 0; - index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - index++) + for (Index = 0; + Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); + Index++) { - if (Signature == mTableParserList[index].Signature) { - if (mTableParserList[index].Parser != NULL) { + if (Signature == mTableParserList[Index].Signature) { + if (mTableParserList[Index].Parser != NULL) { return EFI_ALREADY_STARTED; } } } // Find the first free slot and register the parser - for (index = 0; - index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - index++) + for (Index = 0; + Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); + Index++) { - if (mTableParserList[index].Signature == ACPI_PARSER_SIGNATURE_NULL) { - mTableParserList[index].Signature = Signature; - mTableParserList[index].Parser = ParserProc; + if (mTableParserList[Index].Signature == ACPI_PARSER_SIGNATURE_NULL) { + mTableParserList[Index].Signature = Signature; + mTableParserList[Index].Parser = ParserProc; return EFI_SUCCESS; } } // No free slot found @@ -XXX,XX +XXX,XX @@ EFI_STATUS EFIAPI DeregisterParser ( IN UINT32 Signature ) { - UINT32 index; + UINT32 Index; if (Signature == ACPI_PARSER_SIGNATURE_NULL) { return EFI_INVALID_PARAMETER; } - for (index = 0; - index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - index++) + for (Index = 0; + Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); + Index++) { - if (Signature == mTableParserList[index].Signature) { - mTableParserList[index].Signature = ACPI_PARSER_SIGNATURE_NULL; - mTableParserList[index].Parser = NULL; + if (Signature == mTableParserList[Index].Signature) { + mTableParserList[Index].Signature = ACPI_PARSER_SIGNATURE_NULL; + mTableParserList[Index].Parser = NULL; return EFI_SUCCESS; } } // No matching registered parser found. @@ -XXX,XX +XXX,XX @@ EFIAPI GetParser ( IN UINT32 Signature, OUT PARSE_ACPI_TABLE_PROC * ParserProc ) { - UINT32 index; + UINT32 Index; if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) { return EFI_INVALID_PARAMETER; } - for (index = 0; - index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - index++) + for (Index = 0; + Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); + Index++) { - if (Signature == mTableParserList[index].Signature) { - *ParserProc = mTableParserList[index].Parser; + if (Signature == mTableParserList[Index].Signature) { + *ParserProc = mTableParserList[Index].Parser; return EFI_SUCCESS; } } // No matching registered parser found. diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h @@ -XXX,XX +XXX,XX @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#ifndef ACPITABLEPARSER_H_ -#define ACPITABLEPARSER_H_ +#ifndef __ACPITABLEPARSER_H__ +#define __ACPITABLEPARSER_H__ /** The maximum number of ACPI table parsers. */ #define MAX_ACPI_TABLE_PARSERS 16 @@ -XXX,XX +XXX,XX @@ EFIAPI GetParser ( IN UINT32 Signature, OUT PARSE_ACPI_TABLE_PROC * ParserProc ); -#endif // ACPITABLEPARSER_H_ +#endif // __ACPITABLEPARSER_H__ diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -XXX,XX +XXX,XX @@ DumpAcpiTableToFile ( IN CONST UINTN Length ) { EFI_STATUS Status; CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - SHELL_FILE_HANDLE DumpFileHandle = NULL; - UINTN TransferBytes = Length; + SHELL_FILE_HANDLE DumpFileHandle; + UINTN TransferBytes; + + DumpFileHandle = NULL; + TransferBytes = Length; UnicodeSPrint ( FileNameBuffer, sizeof (FileNameBuffer), L".\\%s%04d.bin", @@ -XXX,XX +XXX,XX @@ ProcessTableReportOptions ( IN CONST UINT8* TablePtr, IN CONST UINT32 Length ) { UINTN OriginalAttribute; - UINT8* SignaturePtr = (UINT8*)(UINTN)&Signature; - BOOLEAN Log = FALSE; - BOOLEAN HighLight = GetColourHighlighting (); + UINT8* SignaturePtr; + BOOLEAN Log; + BOOLEAN HighLight; + + SignaturePtr = (UINT8*)(UINTN)&Signature; + Log = FALSE; + HighLight = GetColourHighlighting (); + switch (GetReportOption ()) { - case EREPORT_ALL: + case ReportAll: Log = TRUE; break; - case EREPORT_SELECTED: + case ReportSelected: if (Signature == GetSelectedAcpiTable ()) { Log = TRUE; mSelectedAcpiTableFound = TRUE; } break; - case EREPORT_TABLE_LIST: + case ReportTableList: if (mTableCount == 0) { if (HighLight) { OriginalAttribute = gST->ConOut->Mode->Attribute; gST->ConOut->SetAttribute ( gST->ConOut, @@ -XXX,XX +XXX,XX @@ ProcessTableReportOptions ( SignaturePtr[1], SignaturePtr[2], SignaturePtr[3] ); break; - case EREPORT_DUMP_BIN_FILE: + case ReportDumpBinFile: if (Signature == GetSelectedAcpiTable ()) { mSelectedAcpiTableFound = TRUE; DumpAcpiTableToFile (TablePtr, Length); } break; - case EREPORT_MAX: + case ReportMax: // We should never be here. // This case is only present to prevent compiler warning. break; } // switch @@ -XXX,XX +XXX,XX @@ STATIC UINT32 ConvertStrToAcpiSignature ( IN CONST CHAR16* Str ) { - UINT8 Index = 0; + UINT8 Index; CHAR8 Ptr[4]; + Index = 0; + // Convert to Upper case and convert to ASCII while ((Index < 4) && (Str[Index] != 0)) { if (Str[Index] >= L'a' && Str[Index] <= L'z') { Ptr[Index] = (CHAR8)(Str[Index] - (L'a' - L'A')); } else { @@ -XXX,XX +XXX,XX @@ AcpiView ( ); return EFI_NOT_FOUND; } ReportOption = GetReportOption (); - if (EREPORT_TABLE_LIST != ReportOption) { - if (((EREPORT_SELECTED == ReportOption) || - (EREPORT_DUMP_BIN_FILE == ReportOption)) && + if (ReportTableList != ReportOption) { + if (((ReportSelected == ReportOption) || + (ReportDumpBinFile == ReportOption)) && (!mSelectedAcpiTableFound)) { Print (L"\nRequested ACPI Table not found.\n"); - } else if (EREPORT_DUMP_BIN_FILE != ReportOption) { + } else if (ReportDumpBinFile != ReportOption) { OriginalAttribute = gST->ConOut->Mode->Attribute; Print (L"\nTable Statistics:\n"); if (GetColourHighlighting ()) { @@ -XXX,XX +XXX,XX @@ ShellCommandRunAcpiView ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE* SystemTable ) { EFI_STATUS Status; - SHELL_STATUS ShellStatus = SHELL_SUCCESS; - LIST_ENTRY* Package = NULL; + SHELL_STATUS ShellStatus; + LIST_ENTRY* Package; CHAR16* ProblemParam; CONST CHAR16* Temp; CHAR8 ColourOption[8]; - SHELL_FILE_HANDLE TmpDumpFileHandle = NULL; + SHELL_FILE_HANDLE TmpDumpFileHandle; // Set Defaults - mReportType = EREPORT_ALL; + mReportType = ReportAll; mTableCount = 0; mBinTableCount = 0; mSelectedAcpiTable = 0; mSelectedAcpiTableName = NULL; mSelectedAcpiTableFound = FALSE; mVerbose = TRUE; mConsistencyCheck = TRUE; + ShellStatus = SHELL_SUCCESS; + Package = NULL; + TmpDumpFileHandle = NULL; + // Reset The error/warning counters ResetErrorCount (); ResetWarningCount (); Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); @@ -XXX,XX +XXX,XX @@ ShellCommandRunAcpiView ( SetColourHighlighting (FALSE); } } if (ShellCommandLineGetFlag (Package, L"-l")) { - mReportType = EREPORT_TABLE_LIST; + mReportType = ReportTableList; } else { mSelectedAcpiTableName = ShellCommandLineGetValue (Package, L"-s"); if (mSelectedAcpiTableName != NULL) { mSelectedAcpiTable = (UINT32)ConvertStrToAcpiSignature ( mSelectedAcpiTableName ); - mReportType = EREPORT_SELECTED; + mReportType = ReportSelected; if (ShellCommandLineGetFlag (Package, L"-d")) { // Create a temporary file to check if the media is writable. CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - mReportType = EREPORT_DUMP_BIN_FILE; + mReportType = ReportDumpBinFile; UnicodeSPrint ( FileNameBuffer, sizeof (FileNameBuffer), L".\\%s%04d.tmp", diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h @@ -XXX,XX +XXX,XX @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#ifndef ACPIVIEW_H_ -#define ACPIVIEW_H_ +#ifndef __ACPIVIEW_H__ +#define __ACPIVIEW_H__ /** A macro to define the max file name length **/ #define MAX_FILE_NAME_LEN 128 @@ -XXX,XX +XXX,XX @@ /** The EREPORT_OPTION enum describes ACPI table Reporting options. **/ typedef enum ReportOption { - EREPORT_ALL, ///< Report All tables. - EREPORT_SELECTED, ///< Report Selected table. - EREPORT_TABLE_LIST, ///< Report List of tables. - EREPORT_DUMP_BIN_FILE, ///< Dump selected table to a file. - EREPORT_MAX + ReportAll, ///< Report All tables. + ReportSelected, ///< Report Selected table. + ReportTableList, ///< Report List of tables. + ReportDumpBinFile, ///< Dump selected table to a file. + ReportMax, } EREPORT_OPTION; /** This function resets the ACPI table error counter to Zero. **/ @@ -XXX,XX +XXX,XX @@ ProcessTableReportOptions ( IN CONST UINT32 Signature, IN CONST UINT8* TablePtr, IN CONST UINT32 Length ); -#endif // ACPIVIEW_H_ +#endif // __ACPIVIEW_H__ diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c @@ -XXX,XX +XXX,XX @@ EFIAPI ValidateNameSpaceStrLen ( IN UINT8* Ptr, IN VOID* Context ) { - UINT16 NameSpaceStrLen = *(UINT16*)Ptr; + UINT16 NameSpaceStrLen; + + NameSpaceStrLen = *(UINT16*)Ptr; + if (NameSpaceStrLen < 2) { IncrementErrorCount (); Print ( L"\nERROR: NamespaceString Length = %d. If no Namespace device exists,\n" " then NamespaceString[] must contain a period '.'", diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c @@ -XXX,XX +XXX,XX @@ EFIAPI ValidateGtBlockTimerCount ( IN UINT8* Ptr, IN VOID* Context ) { - UINT32 BlockTimerCount = *(UINT32*)Ptr; + UINT32 BlockTimerCount; + + BlockTimerCount = *(UINT32*)Ptr; + if (BlockTimerCount > 8) { IncrementErrorCount (); Print ( L"\nERROR: Timer Count = %d. Max Timer Count is 8.", BlockTimerCount diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -XXX,XX +XXX,XX @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; /** The EIORT_NODE enum describes the IORT Node types. **/ typedef enum IortNode { - EIORT_NODE_ITS_GROUP, ///< ITS Group node - EIORT_NODE_NAMED_COMPONENT, ///< Named Component node - EIORT_NODE_ROOT_COMPLEX, ///< Root Complex node - EIORT_NODE_SMMUV1_V2, ///< SMMU v1/v2 node - EIORT_NODE_SMMUV3, ///< SMMU v3 node - EIORT_NODE_PMCG, ///< PMC group node - EIORT_NODE_MAX + Iort_Node_ITS_Group, ///< ITS Group node + Iort_Node_Named_Component, ///< Named Component node + Iort_Node_Root_Complex, ///< Root Complex node + Iort_Node_SMMUV1_V2, ///< SMMU v1/v2 node + Iort_Node_SMMUV3, ///< SMMU v3 node + Iort_Node_PMCG, ///< PMC group node + Iort_Node_Max } EIORT_NODE; // Local Variables STATIC CONST UINT32* IortNodeCount; STATIC CONST UINT32* IortNodeOffset; @@ -XXX,XX +XXX,XX @@ ParseAcpiIort ( PrintFieldName (2, L"* Node Offset *"); Print (L"0x%x\n", Offset); switch (*IortNodeType) { - case EIORT_NODE_ITS_GROUP: + case Iort_Node_ITS_Group: DumpIortNodeIts ( NodePtr, *IortNodeLength ); break; - case EIORT_NODE_NAMED_COMPONENT: + case Iort_Node_Named_Component: DumpIortNodeNamedComponent ( NodePtr, *IortNodeLength, *IortIdMappingCount, *IortIdMappingOffset ); break; - case EIORT_NODE_ROOT_COMPLEX: + case Iort_Node_Root_Complex: DumpIortNodeRootComplex ( NodePtr, *IortNodeLength, *IortIdMappingCount, *IortIdMappingOffset ); break; - case EIORT_NODE_SMMUV1_V2: + case Iort_Node_SMMUV1_V2: DumpIortNodeSmmuV1V2 ( NodePtr, *IortNodeLength, *IortIdMappingCount, *IortIdMappingOffset ); break; - case EIORT_NODE_SMMUV3: + case Iort_Node_SMMUV3: DumpIortNodeSmmuV3 ( NodePtr, *IortNodeLength, *IortIdMappingCount, *IortIdMappingOffset ); break; - case EIORT_NODE_PMCG: + case Iort_Node_PMCG: DumpIortNodePmcg ( NodePtr, *IortNodeLength, *IortIdMappingCount, *IortIdMappingOffset diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -XXX,XX +XXX,XX @@ ParseAcpiMadt ( IN UINT8 AcpiTableRevision ) { UINT32 Offset; UINT8* InterruptContollerPtr; - UINT32 GICDCount = 0; + UINT32 GICDCount; + + GICDCount = 0; if (!Trace) { return; } diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c @@ -XXX,XX +XXX,XX @@ ValidateRsdtAddress ( // Reference: Server Base Boot Requirements System Software on ARM Platforms // Section: 4.2.1.1 RSDP // Root System Description Pointer (RSDP), ACPI ? 5.2.5. // - Within the RSDP, the RsdtAddress field must be null (zero) and the // XsdtAddresss MUST be a valid, non-null, 64-bit value. - UINT32 RsdtAddr = *(UINT32*)Ptr; + UINT32 RsdtAddr; + + RsdtAddr = *(UINT32*)Ptr; + if (RsdtAddr != 0) { IncrementErrorCount (); Print ( L"\nERROR: Rsdt Address = 0x%p. This must be NULL on ARM Platforms.", RsdtAddr @@ -XXX,XX +XXX,XX @@ ValidateXsdtAddress ( // Reference: Server Base Boot Requirements System Software on ARM Platforms // Section: 4.2.1.1 RSDP // Root System Description Pointer (RSDP), ACPI ? 5.2.5. // - Within the RSDP, the RsdtAddress field must be null (zero) and the // XsdtAddresss MUST be a valid, non-null, 64-bit value. - UINT64 XsdtAddr = *(UINT64*)Ptr; + UINT64 XsdtAddr; + + XsdtAddr = *(UINT64*)Ptr; + if (XsdtAddr == 0) { IncrementErrorCount (); Print ( L"\nERROR: Xsdt Address = 0x%p. This must not be NULL on ARM Platforms.", XsdtAddr diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c @@ -XXX,XX +XXX,XX @@ ParseAcpiSlit ( IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ) { UINT32 Offset; - UINT64 i; - UINT64 j; + UINT64 Count; + UINT64 Index; UINT64 LocalityCount; UINT8* LocalityPtr; CHAR16 Buffer[80]; // Used for AsciiName param of ParseAcpi if (!Trace) { @@ -XXX,XX +XXX,XX @@ ParseAcpiSlit ( LocalityCount ); PrintFieldName (0, Buffer); Print (L"\n"); Print (L" "); - for (j = 0; j < LocalityCount; j++) { - Print (L" (%3d) ", j); + for (Index = 0; Index < LocalityCount; Index++) { + Print (L" (%3d) ", Index); } Print (L"\n"); - for (i = 0; i < LocalityCount; i++) { - Print (L" (%3d) ", i); - for (j = 0; j < LocalityCount; j++) { - Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, i, j)); + for (Count = 0; Count< LocalityCount; Count++) { + Print (L" (%3d) ", Count); + for (Index = 0; Index < LocalityCount; Index++) { + Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, Count, Index)); } Print (L"\n"); } } // Validate - for (i = 0; i < LocalityCount; i++) { - for (j = 0; j < LocalityCount; j++) { + for (Count = 0; Count < LocalityCount; Count++) { + for (Index = 0; Index < LocalityCount; Index++) { // Element[x][x] must be equal to 10 - if ((i == j) && (SLIT_ELEMENT (LocalityPtr, i, j) != 10)) { + if ((Count == Index) && (SLIT_ELEMENT (LocalityPtr, Count,Index) != 10)) { IncrementErrorCount (); Print ( L"ERROR: Diagonal Element[0x%lx][0x%lx] (%3d)." " Normalized Value is not 10\n", - i, - j, - SLIT_ELEMENT (LocalityPtr, i, j) + Count, + Index, + SLIT_ELEMENT (LocalityPtr, Count, Index) ); } // Element[i][j] must be equal to Element[j][i] - if (SLIT_ELEMENT (LocalityPtr, i, j) != - SLIT_ELEMENT (LocalityPtr, j, i)) { + if (SLIT_ELEMENT (LocalityPtr, Count, Index) != + SLIT_ELEMENT (LocalityPtr, Index, Count)) { IncrementErrorCount (); Print ( L"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and \n" "Element[0x%lx][0x%lx] (%3d) do not match.\n", - i, - j, - SLIT_ELEMENT (LocalityPtr, i, j), - j, - i, - SLIT_ELEMENT (LocalityPtr, j, i) + Count, + Index, + SLIT_ELEMENT (LocalityPtr, Count, Index), + Index, + Count, + SLIT_ELEMENT (LocalityPtr, Index, Count) ); } } } } diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c @@ -XXX,XX +XXX,XX @@ ValidateInterruptType ( IN UINT8* Ptr, IN VOID* Context ) { #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - UINT8 InterruptType = *Ptr; + UINT8 InterruptType; + + InterruptType = *Ptr; + if (InterruptType != EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC) { IncrementErrorCount (); Print ( L"\nERROR: InterruptType = %d. This must be 8 on ARM Platforms", @@ -XXX,XX +XXX,XX @@ ValidateIrq ( IN UINT8* Ptr, IN VOID* Context ) { #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - UINT8 Irq = *Ptr; + UINT8 Irq; + + Irq = *Ptr; + if (Irq != 0) { IncrementErrorCount (); Print ( L"\nERROR: Irq = %d. This must be zero on ARM Platforms\n", Irq diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -XXX,XX +XXX,XX @@ VOID DumpSratApicProximity ( IN CONST CHAR16* Format, IN UINT8* Ptr ) { - UINT32 ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16); + UINT32 ProximityDomain; + + ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16); + Print (Format, ProximityDomain); } /** This function parses the ACPI SRAT table. @@ -XXX,XX +XXX,XX @@ ParseAcpiSrat ( IN UINT8 AcpiTableRevision ) { UINT32 Offset; UINT8* ResourcePtr; - UINT32 GicCAffinityIndex = 0; - UINT32 GicITSAffinityIndex = 0; - UINT32 MemoryAffinityIndex = 0; - UINT32 ApicSapicAffinityIndex = 0; - UINT32 X2ApicAffinityIndex = 0; + UINT32 GicCAffinityIndex; + UINT32 GicITSAffinityIndex; + UINT32 MemoryAffinityIndex; + UINT32 ApicSapicAffinityIndex; + UINT32 X2ApicAffinityIndex; CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi + GicCAffinityIndex = 0; + GicITSAffinityIndex = 0; + MemoryAffinityIndex = 0; + ApicSapicAffinityIndex = 0; + X2ApicAffinityIndex = 0; + if (!Trace) { return; } Offset = ParseAcpi ( diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c @@ -XXX,XX +XXX,XX @@ ACPI_TABLE_PARSER ParserList[] = { EFI_STATUS RegisterAllParsers ( ) { EFI_STATUS Status; - UINTN Count = sizeof (ParserList) / sizeof (ParserList[0]); + UINTN Count; + + Count = sizeof (ParserList) / sizeof (ParserList[0]); + while (Count-- != 0) { Status = RegisterParser ( ParserList[Count].Signature, ParserList[Count].Parser ); diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h @@ -XXX,XX +XXX,XX @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#ifndef UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_ -#define UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_ +#ifndef __UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H__ +#define __UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H__ extern EFI_HII_HANDLE gShellAcpiViewHiiHandle; /** Function for 'acpiview' command. @@ -XXX,XX +XXX,XX @@ EFIAPI ShellCommandRunAcpiView ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ); -#endif // UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_ +#endif // __UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H__ diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf @@ -XXX,XX +XXX,XX @@ [Sources.common] UefiShellAcpiViewCommandLib.uni UefiShellAcpiViewCommandLib.c UefiShellAcpiViewCommandLib.h + AcpiParser.h + AcpiTableParser.h + AcpiView.h AcpiParser.c AcpiTableParser.c AcpiView.c Parsers/Bgrt/BgrtParser.c Parsers/Dbg2/Dbg2Parser.c -- 2.14.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
ECC tool report some coding style issue in UefiShellAcpiViewCommandLib. This patch series is to clean these issues. V2: Remove the updates of guard macros in header files in patch 2. Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Evan Lloyd <evan.lloyd@arm.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Dandan Bi (2): ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues .../UefiShellAcpiViewCommandLib/AcpiParser.c | 174 +++++++++------- .../UefiShellAcpiViewCommandLib/AcpiParser.h | 223 ++++++++++++--------- .../UefiShellAcpiViewCommandLib/AcpiTableParser.c | 77 +++---- .../UefiShellAcpiViewCommandLib/AcpiTableParser.h | 39 ++-- .../Library/UefiShellAcpiViewCommandLib/AcpiView.c | 113 +++++++---- .../Library/UefiShellAcpiViewCommandLib/AcpiView.h | 69 ++++--- .../Parsers/Bgrt/BgrtParser.c | 12 +- .../Parsers/Dbg2/Dbg2Parser.c | 34 ++-- .../Parsers/Dsdt/DsdtParser.c | 7 +- .../Parsers/Fadt/FadtParser.c | 68 +++++-- .../Parsers/Gtdt/GtdtParser.c | 57 ++++-- .../Parsers/Iort/IortParser.c | 159 ++++++++------- .../Parsers/Madt/MadtParser.c | 67 ++++--- .../Parsers/Mcfg/McfgParser.c | 18 +- .../Parsers/Rsdp/RsdpParser.c | 42 ++-- .../Parsers/Slit/SlitParser.c | 61 +++--- .../Parsers/Spcr/SpcrParser.c | 42 ++-- .../Parsers/Srat/SratParser.c | 82 +++++--- .../Parsers/Ssdt/SsdtParser.c | 7 +- .../Parsers/Xsdt/XsdtParser.c | 11 +- .../UefiShellAcpiViewCommandLib.c | 18 +- .../UefiShellAcpiViewCommandLib.h | 4 +- .../UefiShellAcpiViewCommandLib.inf | 3 + 23 files changed, 823 insertions(+), 564 deletions(-) -- 2.14.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Make the function comments follow EDK2 coding style. Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Evan Lloyd <evan.lloyd@arm.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> --- .../UefiShellAcpiViewCommandLib/AcpiParser.c | 130 ++++++------ .../UefiShellAcpiViewCommandLib/AcpiParser.h | 223 ++++++++++++--------- .../UefiShellAcpiViewCommandLib/AcpiTableParser.c | 27 ++- .../UefiShellAcpiViewCommandLib/AcpiTableParser.h | 39 ++-- .../Library/UefiShellAcpiViewCommandLib/AcpiView.c | 55 +++-- .../Library/UefiShellAcpiViewCommandLib/AcpiView.h | 59 +++--- .../Parsers/Bgrt/BgrtParser.c | 12 +- .../Parsers/Dbg2/Dbg2Parser.c | 29 +-- .../Parsers/Dsdt/DsdtParser.c | 7 +- .../Parsers/Fadt/FadtParser.c | 68 +++++-- .../Parsers/Gtdt/GtdtParser.c | 52 +++-- .../Parsers/Iort/IortParser.c | 133 +++++++----- .../Parsers/Madt/MadtParser.c | 63 +++--- .../Parsers/Mcfg/McfgParser.c | 18 +- .../Parsers/Rsdp/RsdpParser.c | 32 +-- .../Parsers/Slit/SlitParser.c | 17 +- .../Parsers/Spcr/SpcrParser.c | 32 +-- .../Parsers/Srat/SratParser.c | 61 +++--- .../Parsers/Ssdt/SsdtParser.c | 7 +- .../Parsers/Xsdt/XsdtParser.c | 11 +- .../UefiShellAcpiViewCommandLib.c | 13 +- .../UefiShellAcpiViewCommandLib.h | 4 +- 22 files changed, 645 insertions(+), 447 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file ACPI parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ STATIC UINT32 gIndent; STATIC UINT32 mTableErrorCount; STATIC UINT32 mTableWarningCount; -/** This function resets the ACPI table error counter to Zero. -*/ +/** + This function resets the ACPI table error counter to Zero. +**/ VOID ResetErrorCount ( VOID ) { mTableErrorCount = 0; } -/** This function returns the ACPI table error count. +/** + This function returns the ACPI table error count. @retval Returns the count of errors detected in the ACPI tables. -*/ +**/ UINT32 GetErrorCount ( VOID ) { return mTableErrorCount; } -/** This function resets the ACPI table warning counter to Zero. -*/ +/** + This function resets the ACPI table warning counter to Zero. +**/ VOID ResetWarningCount ( VOID ) { mTableWarningCount = 0; } -/** This function returns the ACPI table warning count. +/** + This function returns the ACPI table warning count. @retval Returns the count of warning detected in the ACPI tables. -*/ +**/ UINT32 GetWarningCount ( VOID ) { return mTableWarningCount; } -/** This function increments the ACPI table error counter. -*/ +/** + This function increments the ACPI table error counter. +**/ VOID EFIAPI IncrementErrorCount ( VOID ) { mTableErrorCount++; } -/** This function increments the ACPI table warning counter. -*/ +/** + This function increments the ACPI table warning counter. +**/ VOID EFIAPI IncrementWarningCount ( VOID ) { mTableWarningCount++; } -/** This function verifies the ACPI table checksum. +/** + This function verifies the ACPI table checksum. This function verifies the checksum for the ACPI table and optionally prints the status. @param [in] Log If TRUE log the status of the checksum. @param [in] Ptr Pointer to the start of the table buffer. @param [in] Length The length of the buffer. @retval TRUE The checksum is OK. @retval FALSE The checksum failed. -*/ +**/ BOOLEAN EFIAPI VerifyChecksum ( IN BOOLEAN Log, IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ VerifyChecksum ( } return (Checksum == 0); } -/** This function performs a raw data dump of the ACPI table. +/** + This function performs a raw data dump of the ACPI table. @param [in] Ptr Pointer to the start of the table buffer. @param [in] Length The length of the buffer. -*/ +**/ VOID EFIAPI DumpRaw ( IN UINT8* Ptr, IN UINT32 Length @@ -XXX,XX +XXX,XX @@ DumpRaw ( // Print ASCII data for the final line. AsciiBuffer[AsciiBufferIndex] = '\0'; Print (L" %a", AsciiBuffer); } -/** This function traces 1 byte of data as specified in the - format string. +/** + This function traces 1 byte of data as specified in the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint8 ( IN CONST CHAR16* Format, IN UINT8* Ptr ) { Print (Format, *Ptr); } -/** This function traces 2 bytes of data as specified in the - format string. +/** + This function traces 2 bytes of data as specified in the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint16 ( IN CONST CHAR16* Format, IN UINT8* Ptr ) { Print (Format, *(UINT16*)Ptr); } -/** This function traces 4 bytes of data as specified in the - format string. +/** + This function traces 4 bytes of data as specified in the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint32 ( IN CONST CHAR16* Format, IN UINT8* Ptr ) { Print (Format, *(UINT32*)Ptr); } -/** This function traces 8 bytes of data as specified by the - format string. +/** + This function traces 8 bytes of data as specified by the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint64 ( IN CONST CHAR16* Format, IN UINT8* Ptr @@ -XXX,XX +XXX,XX @@ DumpUint64 ( Val |= *(UINT32*)Ptr; Print (Format, Val); } -/** This function traces 3 characters which can be optionally - formated using the format string if specified. +/** + This function traces 3 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. -*/ +**/ VOID EFIAPI Dump3Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr @@ -XXX,XX +XXX,XX @@ Dump3Chars ( Ptr[1], Ptr[2] ); } -/** This function traces 4 characters which can be optionally - formated using the format string if specified. +/** + This function traces 4 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. -*/ +**/ VOID EFIAPI Dump4Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr @@ -XXX,XX +XXX,XX @@ Dump4Chars ( Ptr[2], Ptr[3] ); } -/** This function traces 6 characters which can be optionally - formated using the format string if specified. +/** + This function traces 6 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. -*/ +**/ VOID EFIAPI Dump6Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr @@ -XXX,XX +XXX,XX @@ Dump6Chars ( Ptr[4], Ptr[5] ); } -/** This function traces 8 characters which can be optionally - formated using the format string if specified. +/** + This function traces 8 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. -*/ +**/ VOID EFIAPI Dump8Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr @@ -XXX,XX +XXX,XX @@ Dump8Chars ( Ptr[6], Ptr[7] ); } -/** This function indents and prints the ACPI table Field Name. +/** + This function indents and prints the ACPI table Field Name. @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] FieldName Pointer to the Field Name. -*/ +**/ VOID EFIAPI PrintFieldName ( IN UINT32 Indent, IN CONST CHAR16* FieldName @@ -XXX,XX +XXX,XX @@ PrintFieldName ( (OUTPUT_FIELD_COLUMN_WIDTH - gIndent - Indent), FieldName ); } -/** This function is used to parse an ACPI table buffer. +/** + This function is used to parse an ACPI table buffer. The ACPI table buffer is parsed using the ACPI table parser information specified by a pointer to an array of ACPI_PARSER elements. This parser function iterates through each item on the ACPI_PARSER array and logs the ACPI table fields. @@ -XXX,XX +XXX,XX @@ PrintFieldName ( @param [in] Parser Pointer to an array of ACPI_PARSER structure that describes the table being parsed. @param [in] ParserItems Number of items in the ACPI_PARSER array. @retval Number of bytes parsed. -*/ +**/ UINT32 EFIAPI ParseAcpi ( IN BOOLEAN Trace, IN UINT32 Indent, @@ -XXX,XX +XXX,XX @@ ParseAcpi ( // Decrement the Indent gIndent -= Indent; return Offset; } -/** An array describing the ACPI Generic Address Structure. +/** + An array describing the ACPI Generic Address Structure. The GasParser array is used by the ParseAcpi function to parse and/or trace the GAS structure. -*/ +**/ STATIC CONST ACPI_PARSER GasParser[] = { {L"Address Space ID", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Register Bit Width", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, {L"Register Bit Offset", 1, 2, L"0x%x", NULL, NULL, NULL, NULL}, {L"Address Size", 1, 3, L"0x%x", NULL, NULL, NULL, NULL}, {L"Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL} }; -/** This function indents and traces the GAS structure as described - by the GasParser. +/** + This function indents and traces the GAS structure as described by the GasParser. @param [in] Ptr Pointer to the start of the buffer. @param [in] Indent Number of spaces to indent the output. -*/ +**/ VOID EFIAPI DumpGasStruct ( IN UINT8* Ptr, IN UINT32 Indent @@ -XXX,XX +XXX,XX @@ DumpGasStruct ( GAS_LENGTH, PARSER_PARAMS (GasParser) ); } -/** This function traces the GAS structure as described by the GasParser. +/** + This function traces the GAS structure as described by the GasParser. @param [in] Format Optional format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpGas ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr ) { DumpGasStruct (Ptr, 2); } -/** This function traces the ACPI header as described by the AcpiHeaderParser. +/** + This function traces the ACPI header as described by the AcpiHeaderParser. @param [in] Ptr Pointer to the start of the buffer. @retval Number of bytes parsed. -*/ +**/ UINT32 EFIAPI DumpAcpiHeader ( IN UINT8* Ptr ) @@ -XXX,XX +XXX,XX @@ DumpAcpiHeader ( ACPI_DESCRIPTION_HEADER_LENGTH, PARSER_PARAMS (AcpiHeaderParser) ); } -/** This function parses the ACPI header as described by the AcpiHeaderParser. +/** + This function parses the ACPI header as described by the AcpiHeaderParser. This function optionally returns the signature, length and revision of the ACPI table. @param [in] Ptr Pointer to the start of the buffer. @param [out] Signature Gets location of the ACPI table signature. @param [out] Length Gets location of the length of the ACPI table. @param [out] Revision Gets location of the revision of the ACPI table. @retval Number of bytes parsed. -*/ +**/ UINT32 EFIAPI ParseAcpiHeader ( IN UINT8* Ptr, OUT CONST UINT32** Signature, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -XXX,XX +XXX,XX @@ -/** +/** @file Header file for ACPI parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ /// However The signature for ACPI tables is 4 bytes. /// To work around this oddity define a signature type /// that allows us to process the log options. #define RSDP_TABLE_INFO SIGNATURE_32('R', 'S', 'D', 'P') -/** This function increments the ACPI table error counter. -*/ +/** + This function increments the ACPI table error counter. +**/ VOID EFIAPI IncrementErrorCount ( VOID ); -/** This function increments the ACPI table warning counter. -*/ +/** + This function increments the ACPI table warning counter. +**/ VOID EFIAPI IncrementWarningCount ( VOID ); -/** This function verifies the ACPI table checksum. +/** + This function verifies the ACPI table checksum. This function verifies the checksum for the ACPI table and optionally prints the status. @param [in] Log If TRUE log the status of the checksum. @param [in] Ptr Pointer to the start of the table buffer. @param [in] Length The length of the buffer. @retval TRUE The checksum is OK. @retval FALSE The checksum failed. -*/ +**/ BOOLEAN EFIAPI VerifyChecksum ( IN BOOLEAN Log, IN UINT8* Ptr, IN UINT32 Length ); -/** This function performs a raw data dump of the ACPI table. +/** + This function performs a raw data dump of the ACPI table. @param [in] Ptr Pointer to the start of the table buffer. @param [in] Length The length of the buffer. -*/ +**/ VOID EFIAPI DumpRaw ( IN UINT8* Ptr, IN UINT32 Length ); -/** This function traces 1 byte of datum as specified in the - format string. +/** + This function traces 1 byte of datum as specified in the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint8 ( IN CONST CHAR16* Format, IN UINT8* Ptr ); -/** This function traces 2 bytes of data as specified in the - format string. +/** + This function traces 2 bytes of data as specified in the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint16 ( IN CONST CHAR16* Format, IN UINT8* Ptr ); -/** This function traces 4 bytes of data as specified in the - format string. +/** + This function traces 4 bytes of data as specified in the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint32 ( IN CONST CHAR16* Format, IN UINT8* Ptr ); -/** This function traces 8 bytes of data as specified by the - format string. +/** + This function traces 8 bytes of data as specified by the format string. @param [in] Format The format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpUint64 ( IN CONST CHAR16* Format, IN UINT8* Ptr ); -/** This function traces 3 characters which can be optionally - formated using the format string if specified. +/** + This function traces 3 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. -*/ +**/ VOID EFIAPI Dump3Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr ); -/** This function traces 4 characters which can be optionally - formated using the format string if specified. +/** + This function traces 4 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. -*/ +**/ VOID EFIAPI Dump4Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr ); -/** This function traces 6 characters which can be optionally - formated using the format string if specified. +/** + This function traces 6 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. -*/ +**/ VOID EFIAPI Dump6Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr ); -/** This function traces 8 characters which can be optionally - formated using the format string if specified. +/** + This function traces 8 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. -*/ +**/ VOID EFIAPI Dump8Chars ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr ); -/** This function indents and prints the ACPI table Field Name. +/** + This function indents and prints the ACPI table Field Name. @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] FieldName Pointer to the Field Name. -*/ +**/ VOID EFIAPI PrintFieldName ( IN UINT32 Indent, IN CONST CHAR16* FieldName -); + ); -/** This function pointer is the template for customizing the trace output +/** + This function pointer is the template for customizing the trace output @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. -*/ +**/ typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16* Format, UINT8* Ptr); -/** This function pointer is the template for validating an ACPI table field. +/** + 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] 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); -/** The ACPI_PARSER structure describes the fields of an ACPI table and - provides means for the parser to interpret and trace appropriately. +/** + The ACPI_PARSER structure describes the fields of an ACPI table and + provides means for the parser to interpret and trace appropriately. The first three members are populated based on information present in in the ACPI table specifications. The remaining members describe how the parser should report the field information, validate the field data and/or update an external pointer to the field (ItemPtr). @@ -XXX,XX +XXX,XX @@ typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8* Ptr, VOID* Context); The PrintFormatter function may choose to use the format string specified by 'Format' or use its own internal format string. The 'Format' and 'PrintFormatter' members allow flexibility for representing the field data. -*/ +**/ typedef struct AcpiParser { /// String describing the ACPI table field /// (Field column from ACPI table spec) CONST CHAR16* NameStr; @@ -XXX,XX +XXX,XX @@ typedef struct AcpiParser { /// decisions about the field being validated. /// e.g. this could be a pointer to the ACPI table header VOID* Context; } ACPI_PARSER; -/** A structure used to store the pointers to the members of the - ACPI description header structure that was parsed. -*/ +/** + A structure used to store the pointers to the members of the + ACPI description header structure that was parsed. +**/ typedef struct AcpiDescriptionHeaderInfo { /// ACPI table signature UINT32* Signature; /// Length of the ACPI table UINT32* Length; @@ -XXX,XX +XXX,XX @@ typedef struct AcpiDescriptionHeaderInfo { UINT32* CreatorId; /// Creator revision UINT32* CreatorRevision; } ACPI_DESCRIPTION_HEADER_INFO; -/** This function is used to parse an ACPI table buffer. +/** + This function is used to parse an ACPI table buffer. The ACPI table buffer is parsed using the ACPI table parser information specified by a pointer to an array of ACPI_PARSER elements. This parser function iterates through each item on the ACPI_PARSER array and logs the ACPI table fields. @@ -XXX,XX +XXX,XX @@ typedef struct AcpiDescriptionHeaderInfo { @param [in] Parser Pointer to an array of ACPI_PARSER structure that describes the table being parsed. @param [in] ParserItems Number of items in the ACPI_PARSER array. @retval Number of bytes parsed. -*/ +**/ UINT32 EFIAPI ParseAcpi ( IN BOOLEAN Trace, IN UINT32 Indent, IN CONST CHAR8* AsciiName OPTIONAL, IN UINT8* Ptr, IN UINT32 Length, IN CONST ACPI_PARSER* Parser, IN UINT32 ParserItems -); + ); -/** This is a helper macro to pass parameters to the Parser functions. +/** + This is a helper macro to pass parameters to the Parser functions. @param [in] Parser The name of the ACPI_PARSER array describing the ACPI table fields. -*/ +**/ #define PARSER_PARAMS(Parser) Parser, sizeof (Parser) / sizeof (Parser[0]) -/** This is a helper macro for describing the ACPI header fields. +/** + This is a helper macro for describing the ACPI header fields. @param [out] Info Pointer to retrieve the ACPI table header information. -*/ +**/ #define PARSE_ACPI_HEADER(Info) \ { L"Signature", 4, 0, NULL, Dump4Chars, \ (VOID**)&(Info)->Signature , NULL, NULL }, \ { L"Length", 4, 4, L"%d", NULL, \ (VOID**)&(Info)->Length, NULL, NULL }, \ @@ -XXX,XX +XXX,XX @@ ParseAcpi ( { L"Creator ID", 4, 28, NULL, Dump4Chars, \ (VOID**)&(Info)->CreatorId, NULL, NULL }, \ { L"Creator Revision", 4, 32, L"0x%X", NULL, \ (VOID**)&(Info)->CreatorRevision, NULL, NULL } -/** Length of the ACPI GAS structure. +/** + Length of the ACPI GAS structure. NOTE: This might normally be defined as sizeof (EFI_ACPI_6_2_GENERIC_ADDRESS_STRUCTURE). However, we deliberately minimise any reference to the EDK2 ACPI headers in an attempt to provide cross checking. -*/ +**/ #define GAS_LENGTH 12 -/** Length of the ACPI Header structure. +/** + Length of the ACPI Header structure. NOTE: This might normally be defined as sizeof (EFI_ACPI_DESCRIPTION_HEADER). However, we deliberately minimise any reference to the EDK2 ACPI headers in an attempt to provide cross checking. -*/ +**/ #define ACPI_DESCRIPTION_HEADER_LENGTH 36 -/** This function indents and traces the GAS structure as described - by the GasParser. +/** + This function indents and traces the GAS structure as described by the GasParser. @param [in] Ptr Pointer to the start of the buffer. @param [in] Indent Number of spaces to indent the output. -*/ +**/ VOID EFIAPI DumpGasStruct ( IN UINT8* Ptr, IN UINT32 Indent ); -/** This function traces the GAS structure as described by the GasParser. +/** + This function traces the GAS structure as described by the GasParser. @param [in] Format Optional format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ VOID EFIAPI DumpGas ( IN CONST CHAR16* Format OPTIONAL, IN UINT8* Ptr ); -/** This function traces the ACPI header as described by the AcpiHeaderParser. +/** + This function traces the ACPI header as described by the AcpiHeaderParser. @param [in] Ptr Pointer to the start of the buffer. @retval Number of bytes parsed. -*/ +**/ UINT32 EFIAPI DumpAcpiHeader ( IN UINT8* Ptr ); -/** This function parses the ACPI header as described by the AcpiHeaderParser. +/** + This function parses the ACPI header as described by the AcpiHeaderParser. This function optionally returns the Signature, Length and revision of the ACPI table. @param [in] Ptr Pointer to the start of the buffer. @param [out] Signature Gets location of the ACPI table signature. @param [out] Length Gets location of the length of the ACPI table. @param [out] Revision Gets location of the revision of the ACPI table. @retval Number of bytes parsed. -*/ +**/ UINT32 EFIAPI ParseAcpiHeader ( IN UINT8* Ptr, OUT CONST UINT32** Signature, OUT CONST UINT32** Length, OUT CONST UINT8** Revision ); -/** This function parses the ACPI BGRT table. +/** + This function parses the ACPI BGRT table. When trace is enabled this function parses the BGRT 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 ParseAcpiBgrt ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI DBG2 table. +/** + This function parses the ACPI DBG2 table. When trace is enabled this function parses the DBG2 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 ParseAcpiDbg2 ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI DSDT table. +/** + This function parses the ACPI DSDT table. When trace is enabled this function parses the DSDT table and traces the ACPI table fields. For the DSDT table only the ACPI header fields are parsed and traced. @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 ParseAcpiDsdt ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI FADT table. +/** + This function parses the ACPI FADT table. This function parses the FADT table and optionally 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 ParseAcpiFadt ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI GTDT table. +/** + This function parses the ACPI GTDT table. When trace is enabled this function parses the GTDT table and traces the ACPI table fields. This function also parses the following platform timer structures: - GT Block timer @@ -XXX,XX +XXX,XX @@ ParseAcpiFadt ( @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 ParseAcpiGtdt ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI IORT table. +/** + This function parses the ACPI IORT table. When trace is enabled this function parses the IORT table and traces the ACPI fields. This function also parses the following nodes: - ITS Group @@ -XXX,XX +XXX,XX @@ ParseAcpiGtdt ( @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 ParseAcpiIort ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI MADT table. +/** + This function parses the ACPI MADT table. When trace is enabled this function parses the MADT table and traces the ACPI table fields. This function currently parses the following Interrupt Controller Structures: @@ -XXX,XX +XXX,XX @@ ParseAcpiIort ( @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 ParseAcpiMadt ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI MCFG table. +/** + This function parses the ACPI MCFG table. When trace is enabled this function parses the MCFG 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 ParseAcpiMcfg ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI RSDP table. +/** + This function parses the ACPI RSDP table. This function invokes the parser for the XSDT table. * Note - This function does not support parsing of RSDT table. This function also performs a RAW dump of the ACPI table and @@ -XXX,XX +XXX,XX @@ ParseAcpiMcfg ( @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 ParseAcpiRsdp ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI SLIT table. +/** + This function parses the ACPI SLIT table. When trace is enabled this function parses the SLIT table and traces the ACPI table fields. This function also validates System Localities for the following: - Diagonal elements have a normalized value of 10 @@ -XXX,XX +XXX,XX @@ ParseAcpiRsdp ( @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 ParseAcpiSlit ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI SPCR table. +/** + This function parses the ACPI SPCR table. When trace is enabled this function parses the SPCR table and traces the ACPI table fields. This function also performs validations 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 ParseAcpiSpcr ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI SRAT table. +/** + This function parses the ACPI SRAT table. When trace is enabled this function parses the SRAT table and traces the ACPI table fields. This function parses the following Resource Allocation Structures: - Processor Local APIC/SAPIC Affinity Structure @@ -XXX,XX +XXX,XX @@ ParseAcpiSpcr ( @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 ParseAcpiSrat ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI SSDT table. +/** + This function parses the ACPI SSDT table. When trace is enabled this function parses the SSDT table and traces the ACPI table fields. For the SSDT table only the ACPI header fields are parsed and traced. @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 ParseAcpiSsdt ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** This function parses the ACPI XSDT table +/** + This function parses the ACPI XSDT table and optionally traces the ACPI table fields. This function also performs validation of the XSDT 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 ParseAcpiXsdt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file ACPI table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include <Library/UefiLib.h> #include "AcpiParser.h" #include "AcpiTableParser.h" #include "AcpiView.h" -/** A list of registered ACPI table parsers. -*/ +/** + A list of registered ACPI table parsers. +**/ STATIC ACPI_TABLE_PARSER mTableParserList[MAX_ACPI_TABLE_PARSERS]; -/** Register the ACPI table Parser +/** + Register the ACPI table Parser This function registers the ACPI table parser. @param [in] Signature The ACPI table signature. @param [in] ParserProc The ACPI table parser. @@ -XXX,XX +XXX,XX @@ STATIC ACPI_TABLE_PARSER mTableParserList[MAX_ACPI_TABLE_PARSERS]; @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_ALREADY_STARTED The parser for the Table was already registered. @retval EFI_OUT_OF_RESOURCES No space to register the parser. -*/ +**/ EFI_STATUS EFIAPI RegisterParser ( IN UINT32 Signature, IN PARSE_ACPI_TABLE_PROC ParserProc @@ -XXX,XX +XXX,XX @@ RegisterParser ( // No free slot found return EFI_OUT_OF_RESOURCES; } -/** Deregister the ACPI table Parser +/** + Deregister the ACPI table Parser This function deregisters the ACPI table parser. @param [in] Signature The ACPI table signature. @retval EFI_SUCCESS The parser was deregistered. @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_NOT_FOUND A registered parser was not found. -*/ +**/ EFI_STATUS EFIAPI DeregisterParser ( IN UINT32 Signature ) @@ -XXX,XX +XXX,XX @@ DeregisterParser ( // No matching registered parser found. return EFI_NOT_FOUND; } -/** Get the ACPI table Parser +/** + Get the ACPI table Parser This function returns the ACPI table parser proc from the list of registered parsers. @param [in] Signature The ACPI table signature. @param [out] ParserProc Pointer to a ACPI table parser proc. @retval EFI_SUCCESS The parser was returned successfully. @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_NOT_FOUND A registered parser was not found. -*/ +**/ EFI_STATUS EFIAPI GetParser ( IN UINT32 Signature, OUT PARSE_ACPI_TABLE_PROC * ParserProc @@ -XXX,XX +XXX,XX @@ GetParser ( // No matching registered parser found. return EFI_NOT_FOUND; } -/** This function processes the ACPI tables. +/** + This function processes the ACPI tables. This function calls ProcessTableReportOptions() to list the ACPI tables, perform binary dump of the tables and determine if the ACPI fields should be traced. This function also invokes the parser for the ACPI tables. @@ -XXX,XX +XXX,XX @@ GetParser ( This function also performs a RAW dump of the ACPI table including the unknown/unparsed ACPI tables and validates the checksum. @param [in] Ptr Pointer to the start of the ACPI table data buffer. -*/ +**/ VOID EFIAPI ProcessAcpiTable ( IN UINT8* Ptr ) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h @@ -XXX,XX +XXX,XX @@ -/** +/** @file Header file for ACPI table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ **/ #ifndef ACPITABLEPARSER_H_ #define ACPITABLEPARSER_H_ -/** The maximum number of ACPI table parsers. +/** + The maximum number of ACPI table parsers. */ #define MAX_ACPI_TABLE_PARSERS 16 /** An invalid/NULL signature value. */ #define ACPI_PARSER_SIGNATURE_NULL 0 -/** A function that parses the ACPI table. +/** + A function that parses the ACPI 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. -*/ +**/ typedef VOID (EFIAPI * PARSE_ACPI_TABLE_PROC) ( IN BOOLEAN Trace, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ); -/** The ACPI table parser information -*/ +/** + The ACPI table parser information +**/ typedef struct AcpiTableParser { /// ACPI table signature UINT32 Signature; /// The ACPI table parser function. PARSE_ACPI_TABLE_PROC Parser; } ACPI_TABLE_PARSER; -/** Register the ACPI table Parser +/** + Register the ACPI table Parser This function registers the ACPI table parser. @param [in] Signature The ACPI table signature. @param [in] ParserProc The ACPI table parser. @@ -XXX,XX +XXX,XX @@ typedef struct AcpiTableParser { @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_ALREADY_STARTED The parser for the Table was already registered. @retval EFI_OUT_OF_RESOURCES No space to register the parser. -*/ +**/ EFI_STATUS EFIAPI RegisterParser ( IN UINT32 Signature, IN PARSE_ACPI_TABLE_PROC ParserProc -); + ); -/** Deregister the ACPI table Parser +/** + Deregister the ACPI table Parser This function deregisters the ACPI table parser. @param [in] Signature The ACPI table signature. @retval EFI_SUCCESS The parser was deregistered. @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_NOT_FOUND A registered parser was not found. -*/ +**/ EFI_STATUS EFIAPI DeregisterParser ( IN UINT32 Signature -); + ); -/** This function processes the ACPI tables. +/** + This function processes the ACPI tables. This function calls ProcessTableReportOptions() to list the ACPI tables, perform binary dump of the tables and determine if the ACPI fields should be traced. This function also invokes the parser for the ACPI tables. @@ -XXX,XX +XXX,XX @@ DeregisterParser ( This function also performs a RAW dump of the ACPI table including the unknown/unparsed ACPI tables and validates the checksum. @param [in] Ptr Pointer to the start of the ACPI table data buffer. -*/ +**/ VOID EFIAPI ProcessAcpiTable ( IN UINT8* Ptr ); -/** Get the ACPI table Parser +/** + Get the ACPI table Parser This function returns the ACPI table parser proc from the list of registered parsers. @param [in] Signature The ACPI table signature. @param [out] ParserProc Pointer to a ACPI table parser proc. @retval EFI_SUCCESS The parser was returned successfully. @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_NOT_FOUND A registered parser was not found. -*/ +**/ EFI_STATUS EFIAPI GetParser ( IN UINT32 Signature, OUT PARSE_ACPI_TABLE_PROC * ParserProc diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -XXX,XX +XXX,XX @@ STATIC UINT32 mTableCount; STATIC UINT32 mBinTableCount; STATIC BOOLEAN mVerbose; STATIC BOOLEAN mConsistencyCheck; STATIC BOOLEAN mColourHighlighting; -/** An array of acpiview command line parameters. -*/ +/** + An array of acpiview command line parameters. +**/ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { {L"/?", TypeFlag}, {L"-c", TypeFlag}, {L"-d", TypeFlag}, {L"-h", TypeValue}, @@ -XXX,XX +XXX,XX @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { {L"-s", TypeValue}, {L"-v", TypeFlag}, {NULL, TypeMax} }; -/** This function returns the colour highlighting status. +/** + This function returns the colour highlighting status. @retval TRUE if colour highlighting is enabled. -*/ +**/ BOOLEAN GetColourHighlighting ( VOID ) { return mColourHighlighting; } -/** This function sets the colour highlighting status. +/** + This function sets the colour highlighting status. -*/ + @param Highlight The Highlight status. + +**/ VOID SetColourHighlighting ( BOOLEAN Highlight ) { mColourHighlighting = Highlight; } -/** This function returns the report options. +/** + This function returns the report options. @retval Returns the report option. -*/ +**/ STATIC EREPORT_OPTION GetReportOption ( VOID ) { return mReportType; } -/** This function returns the selected ACPI table. +/** + This function returns the selected ACPI table. @retval Returns signature of the selected ACPI table. -*/ +**/ STATIC UINT32 GetSelectedAcpiTable ( VOID ) { return mSelectedAcpiTable; } -/** This function dumps the ACPI table to a file. +/** + This function dumps the ACPI table to a file. + @param [in] Ptr Pointer to the ACPI table data. @param [in] Length The length of the ACPI table. @retval TRUE Success. @retval FALSE Failure. -*/ +**/ STATIC BOOLEAN DumpAcpiTableToFile ( IN CONST UINT8* Ptr, IN CONST UINTN Length @@ -XXX,XX +XXX,XX @@ DumpAcpiTableToFile ( ShellCloseFile (&DumpFileHandle); return (Length == TransferBytes); } -/** This function processes the table reporting options for the ACPI table. +/** + This function processes the table reporting options for the ACPI table. @param [in] Signature The ACPI table Signature. @param [in] TablePtr Pointer to the ACPI table data. @param [in] Length The length fo the ACPI table. @retval Returns TRUE if the ACPI table should be traced. -*/ +**/ BOOLEAN ProcessTableReportOptions ( IN CONST UINT32 Signature, IN CONST UINT8* TablePtr, IN CONST UINT32 Length @@ -XXX,XX +XXX,XX @@ ProcessTableReportOptions ( } return Log; } -/** This function converts a string to ACPI table signature. +/** + This function converts a string to ACPI table signature. @param [in] Str Pointer to the string to be converted to the ACPI table signature. @retval The ACPI table signature. -*/ +**/ STATIC UINT32 ConvertStrToAcpiSignature ( IN CONST CHAR16* Str ) @@ -XXX,XX +XXX,XX @@ ConvertStrToAcpiSignature ( Index++; } return *(UINT32*)Ptr; } -/** This function iterates the configuration table entries in the - system table, retrieves the RSDP pointer and starts parsing - the ACPI tables. +/** + This function iterates the configuration table entries in the + system table, retrieves the RSDP pointer and starts parsing the ACPI tables. @param [in] SystemTable Pointer to the EFI system table. @retval Returns EFI_NOT_FOUND if the RSDP pointer is not found. Returns EFI_UNSUPPORTED if the RSDP version is less than 2. Returns EFI_SUCCESS if successful. -*/ +**/ STATIC EFI_STATUS EFIAPI AcpiView ( IN EFI_SYSTEM_TABLE* SystemTable @@ -XXX,XX +XXX,XX @@ AcpiView ( /** Function for 'acpiview' command. @param[in] ImageHandle Handle to the Image (NULL if Internal). @param[in] SystemTable Pointer to the System Table (NULL if Internal). -*/ +**/ SHELL_STATUS EFIAPI ShellCommandRunAcpiView ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE* SystemTable diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h @@ -XXX,XX +XXX,XX @@ -/** +/** @file Header file for AcpiView Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ **/ #ifndef ACPIVIEW_H_ #define ACPIVIEW_H_ -/** A macro to define the max file name length -*/ +/** + A macro to define the max file name length +**/ #define MAX_FILE_NAME_LEN 128 -/** Offset to the RSDP revision from the start of the RSDP -*/ +/** + Offset to the RSDP revision from the start of the RSDP +**/ #define RSDP_REVISION_OFFSET 15 -/** Offset to the RSDP length from the start of the RSDP -*/ +/** + Offset to the RSDP length from the start of the RSDP +**/ #define RSDP_LENGTH_OFFSET 20 -/** The EREPORT_OPTION enum describes ACPI table Reporting options. -*/ +/** + The EREPORT_OPTION enum describes ACPI table Reporting options. +**/ typedef enum ReportOption { EREPORT_ALL, ///< Report All tables. EREPORT_SELECTED, ///< Report Selected table. EREPORT_TABLE_LIST, ///< Report List of tables. EREPORT_DUMP_BIN_FILE, ///< Dump selected table to a file. EREPORT_MAX } EREPORT_OPTION; -/** This function resets the ACPI table error counter to Zero. -*/ +/** + This function resets the ACPI table error counter to Zero. +**/ VOID ResetErrorCount ( VOID ); -/** This function returns the ACPI table error count. +/** + This function returns the ACPI table error count. @retval Returns the count of errors detected in the ACPI tables. -*/ +**/ UINT32 GetErrorCount ( VOID ); -/** This function resets the ACPI table warning counter to Zero. -*/ +/** + This function resets the ACPI table warning counter to Zero. +**/ VOID ResetWarningCount ( VOID ); -/** This function returns the ACPI table warning count. +/** + This function returns the ACPI table warning count. @retval Returns the count of warning detected in the ACPI tables. -*/ +**/ UINT32 GetWarningCount ( VOID ); -/** This function returns the colour highlighting status. +/** + This function returns the colour highlighting status. @retval TRUE if colour highlighting is enabled. -*/ +**/ BOOLEAN GetColourHighlighting ( VOID ); -/** This function sets the colour highlighting status. +/** + This function sets the colour highlighting status. + + @param Highlight The Highlight status. -*/ +**/ VOID SetColourHighlighting ( BOOLEAN Highlight ); -/** This function processes the table reporting options for the ACPI table. +/** + This function processes the table reporting options for the ACPI table. @param [in] Signature The ACPI table Signature. @param [in] TablePtr Pointer to the ACPI table data. @param [in] Length The length fo the ACPI table. @retval Returns TRUE if the ACPI table should be traced. -*/ +**/ BOOLEAN ProcessTableReportOptions ( IN CONST UINT32 Signature, IN CONST UINT8* TablePtr, IN CONST UINT32 Length diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file BGRT table parser Copyright (c) 2017 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include "AcpiTableParser.h" // Local variables STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** An ACPI_PARSER array describing the ACPI BDRT Table. -*/ +/** + An ACPI_PARSER array describing the ACPI BDRT Table. +**/ STATIC CONST ACPI_PARSER BgrtParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"Version", 2, 36, L"0x%x", NULL, NULL, NULL, NULL}, {L"Status", 1, 38, L"0x%x", NULL, NULL, NULL, NULL}, {L"Image Type", 1, 39, L"0x%x", NULL, NULL, NULL, NULL}, {L"Image Address", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Image Offset X", 4, 48, L"%d", NULL, NULL, NULL, NULL}, {L"Image Offset Y", 4, 52, L"%d", NULL, NULL, NULL, NULL} }; -/** This function parses the ACPI BGRT table. +/** + This function parses the ACPI BGRT table. When trace is enabled this function parses the BGRT 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 ParseAcpiBgrt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file DBG2 table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ STATIC CONST UINT16* OEMDataLength; STATIC CONST UINT16* OEMDataOffset; STATIC CONST UINT16* BaseAddrRegOffset; STATIC CONST UINT16* AddrSizeOffset; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** This function Validates the NameSpace string length. +/** + This function Validates the NameSpace string length. @param [in] Ptr Pointer to the start of the buffer. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateNameSpaceStrLen ( IN UINT8* Ptr, IN VOID* Context ); -/** This function parses the debug device information structure. +/** + This function parses the debug device information structure. @param [in] Ptr Pointer to the start of the buffer. @param [out] Length Pointer in which the length of the debug device information is returned. -*/ +**/ STATIC VOID EFIAPI DumpDbgDeviceInfo ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER DbgDevInfoParser[] = { (VOID**)&BaseAddrRegOffset, NULL, NULL}, {L"Address Size Offset", 2, 20, L"0x%x", NULL, (VOID**)&AddrSizeOffset, NULL, NULL} }; -/** This function validates the NameSpace string length. +/** + This function validates the NameSpace string length. @param [in] Ptr Pointer to the start of the buffer. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateNameSpaceStrLen ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateNameSpaceStrLen ( NameSpaceStrLen ); } } -/** This function parses the debug device information structure. +/** + This function parses the debug device information structure. @param [in] Ptr Pointer to the start of the buffer. - @param [out] Ptr Pointer in which the length of the debug + @param [out] Length Pointer in which the length of the debug device information is returned. -*/ +**/ STATIC VOID EFIAPI DumpDbgDeviceInfo ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ DumpDbgDeviceInfo ( } *Length = *DbgDevInfoLen; } -/** This function parses the ACPI DBG2 table. +/** + This function parses the ACPI DBG2 table. When trace is enabled this function parses the DBG2 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 ParseAcpiDbg2 ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file DSDT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include <IndustryStandard/Acpi.h> #include <Library/UefiLib.h> #include "AcpiParser.h" #include "AcpiTableParser.h" -/** This function parses the ACPI DSDT table. +/** + This function parses the ACPI DSDT table. When trace is enabled this function parses the DSDT table and traces the ACPI table fields. For the DSDT table only the ACPI header fields are parsed and traced. @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 ParseAcpiDsdt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file FADT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ STATIC CONST UINT32* DsdtAddress; STATIC CONST UINT64* X_DsdtAddress; STATIC CONST UINT8* FadtMinorRevision; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** A macro defining the Hardware reduced ACPI flag -*/ +/** + A macro defining the Hardware reduced ACPI flag +**/ #define HW_REDUCED_ACPI BIT20 -// Forward declarations +/** + Get the ACPI XSDT header info. +**/ CONST ACPI_DESCRIPTION_HEADER_INFO* CONST EFIAPI GetAcpiXsdtHeaderInfo ( VOID -); + ); +/** + This function validates the Firmware Control Field. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ STATIC VOID EFIAPI ValidateFirmwareCtrl ( IN UINT8* Ptr, IN VOID* Context -); + ); + +/** + This function validates the X_Firmware Control Field. + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ STATIC VOID EFIAPI ValidateXFirmwareCtrl ( IN UINT8* Ptr, IN VOID* Context -); + ); +/** + This function validates the flags. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ STATIC VOID EFIAPI ValidateFlags ( IN UINT8* Ptr, IN VOID* Context -); + ); -/** An ACPI_PARSER array describing the ACPI FADT Table. -*/ +/** + An ACPI_PARSER array describing the ACPI FADT Table. +**/ STATIC CONST ACPI_PARSER FadtParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"FIRMWARE_CTRL", 4, 36, L"0x%x", NULL, NULL, ValidateFirmwareCtrl, NULL}, {L"DSDT", 4, 40, L"0x%x", NULL, (VOID**)&DsdtAddress, NULL, NULL}, {L"Reserved", 1, 44, L"%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER FadtParser[] = { {L"SLEEP_CONTROL_REG", 12, 244, NULL, DumpGas, NULL, NULL, NULL}, {L"SLEEP_STATUS_REG", 12, 256, NULL, DumpGas, NULL, NULL, NULL}, {L"Hypervisor VendorIdentity", 8, 268, L"%lx", NULL, NULL, NULL, NULL} }; -/** This function validates the Firmware Control Field. +/** + This function validates the Firmware Control Field. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateFirmwareCtrl ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateFirmwareCtrl ( ); } #endif } -/** This function validates the X_Firmware Control Field. +/** + This function validates the X_Firmware Control Field. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateXFirmwareCtrl ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateXFirmwareCtrl ( ); } #endif } -/** This function validates the flags. +/** + This function validates the flags. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateFlags ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateFlags ( ); } #endif } -/** This function parses the ACPI FADT table. - This function parses the FADT table and optionally traces the ACPI - table fields. +/** + This function parses the ACPI FADT table. + This function parses the FADT table and optionally 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 ParseAcpiFadt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file GTDT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ STATIC CONST UINT16* PlatformTimerLength; STATIC CONST UINT32* GtBlockTimerCount; STATIC CONST UINT32* GtBlockTimerOffset; STATIC CONST UINT16* GtBlockLength; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** This function validates the GT Block timer count. +/** + This function validates the GT Block timer count. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateGtBlockTimerCount ( IN UINT8* Ptr, IN VOID* Context ); -/** An ACPI_PARSER array describing the ACPI GTDT Table. -*/ +/** + An ACPI_PARSER array describing the ACPI GTDT Table. +**/ STATIC CONST ACPI_PARSER GtdtParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"CntControlBase Physical Address", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Reserved", 4, 44, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER GtdtParser[] = { (VOID**)&GtdtPlatformTimerCount, NULL, NULL}, {L"Platform Timer Offset", 4, 92, L"0x%x", NULL, (VOID**)&GtdtPlatformTimerOffset, NULL, NULL} }; -/** An ACPI_PARSER array describing the Platform timer header. -*/ +/** + An ACPI_PARSER array describing the Platform timer header. +**/ STATIC CONST ACPI_PARSER GtPlatformTimerHeaderParser[] = { {L"Type", 1, 0, NULL, NULL, (VOID**)&PlatformTimerType, NULL, NULL}, {L"Length", 2, 1, NULL, NULL, (VOID**)&PlatformTimerLength, NULL, NULL}, {L"Reserved", 1, 3, NULL, NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the Platform GT Block. -*/ +/** + An ACPI_PARSER array describing the Platform GT Block. +**/ STATIC CONST ACPI_PARSER GtBlockParser[] = { {L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL}, {L"Length", 2, 1, L"%d", NULL, (VOID**)&GtBlockLength, NULL, NULL}, {L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL}, {L"Physical address (CntCtlBase)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER GtBlockParser[] = { ValidateGtBlockTimerCount, NULL}, {L"Timer Offset", 4, 16, L"%d", NULL, (VOID**)&GtBlockTimerOffset, NULL, NULL} }; -/** An ACPI_PARSER array describing the GT Block timer. -*/ +/** + An ACPI_PARSER array describing the GT Block timer. +**/ STATIC CONST ACPI_PARSER GtBlockTimerParser[] = { {L"Frame Number", 1, 0, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}, {L"Physical address (CntBaseX)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx", NULL, NULL, NULL, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER GtBlockTimerParser[] = { {L"Virtual Timer GSIV", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, {L"Virtual Timer Flags", 4, 32, L"0x%x", NULL, NULL, NULL, NULL}, {L"Common Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the Platform Watchdog. -*/ +/** + An ACPI_PARSER array describing the Platform Watchdog. +**/ STATIC CONST ACPI_PARSER SBSAGenericWatchdogParser[] = { {L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL}, {L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL}, {L"RefreshFrame Physical address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}, {L"ControlFrame Physical address", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Watchdog Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL}, {L"Watchdog Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL} }; -/** This function validates the GT Block timer count. +/** + This function validates the GT Block timer count. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateGtBlockTimerCount ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateGtBlockTimerCount ( BlockTimerCount ); } } -/** This function parses the Platform GT Block. +/** + This function parses the Platform GT Block. @param [in] Ptr Pointer to the start of the GT Block data. @param [in] Length Length of the GT Block structure. -*/ +**/ STATIC VOID DumpGTBlock ( IN UINT8* Ptr, IN UINT16 Length @@ -XXX,XX +XXX,XX @@ DumpGTBlock ( ); } } } -/** This function parses the Platform Watchdog timer. +/** + This function parses the Platform Watchdog timer. @param [in] Ptr Pointer to the start of the watchdog timer data. @param [in] Length Length of the watchdog timer structure. -*/ +**/ STATIC VOID DumpWatchdogTimer ( IN UINT8* Ptr, IN UINT16 Length @@ -XXX,XX +XXX,XX @@ DumpWatchdogTimer ( Length, PARSER_PARAMS (SBSAGenericWatchdogParser) ); } -/** This function parses the ACPI GTDT table. +/** + This function parses the ACPI GTDT table. When trace is enabled this function parses the GTDT table and traces the ACPI table fields. This function also parses the following platform timer structures: - GT Block timer @@ -XXX,XX +XXX,XX @@ DumpWatchdogTimer ( @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 ParseAcpiGtdt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file IORT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include "AcpiTableParser.h" // Local variables STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** The EIORT_NODE enum describes the IORT Node types. -*/ +/** + The EIORT_NODE enum describes the IORT Node types. +**/ typedef enum IortNode { EIORT_NODE_ITS_GROUP, ///< ITS Group node EIORT_NODE_NAMED_COMPONENT, ///< Named Component node EIORT_NODE_ROOT_COMPLEX, ///< Root Complex node EIORT_NODE_SMMUV1_V2, ///< SMMU v1/v2 node @@ -XXX,XX +XXX,XX @@ STATIC CONST UINT32* InterruptContextOffset; STATIC CONST UINT32* PmuInterruptCount; STATIC CONST UINT32* PmuInterruptOffset; STATIC CONST UINT32* ItsCount; -/** This function validates the ID Mapping array count for the ITS node. +/** + 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] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateItsIdMappingCount ( IN UINT8* Ptr, IN VOID* Context ); -/** This function validates the ID Mapping array offset for the ITS node. +/** + 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] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateItsIdArrayReference ( IN UINT8* Ptr, IN VOID* Context ); -/** Helper Macro for populating the IORT Node header in the ACPI_PARSER - array. +/** + Helper Macro for populating the IORT Node header in the ACPI_PARSER array. @param [out] ValidateIdMappingCount Optional pointer to a function for validating the ID Mapping count. @param [out] ValidateIdArrayReference Optional pointer to a function for validating the ID Array reference. -*/ +**/ #define PARSE_IORT_NODE_HEADER(ValidateIdMappingCount, \ ValidateIdArrayReference) \ { L"Type", 1, 0, L"%d", NULL, (VOID**)&IortNodeType, NULL, NULL }, \ { L"Length", 2, 1, L"%d", NULL, (VOID**)&IortNodeLength, NULL, NULL }, \ { L"Revision", 1, 3, L"%d", NULL, NULL, NULL, NULL }, \ @@ -XXX,XX +XXX,XX @@ ValidateItsIdArrayReference ( { L"Number of ID mappings", 4, 8, L"%d", NULL, \ (VOID**)&IortIdMappingCount, ValidateIdMappingCount, NULL }, \ { L"Reference to ID Array", 4, 12, L"0x%x", NULL, \ (VOID**)&IortIdMappingOffset, ValidateIdArrayReference, NULL } -/** An ACPI_PARSER array describing the ACPI IORT Table -*/ +/** + An ACPI_PARSER array describing the ACPI IORT Table +**/ STATIC CONST ACPI_PARSER IortParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"Number of IORT Nodes", 4, 36, L"%d", NULL, (VOID**)&IortNodeCount, NULL, NULL}, {L"Offset to Array of IORT Nodes", 4, 40, L"0x%x", NULL, (VOID**)&IortNodeOffset, NULL, NULL}, {L"Reserved", 4, 44, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the IORT node header structure. -*/ +/** + An ACPI_PARSER array describing the IORT node header structure. +**/ STATIC CONST ACPI_PARSER IortNodeHeaderParser[] = { PARSE_IORT_NODE_HEADER (NULL, NULL) }; -/** An ACPI_PARSER array describing the IORT SMMUv1/2 node. -*/ +/** + An ACPI_PARSER array describing the IORT SMMUv1/2 node. +**/ STATIC CONST ACPI_PARSER IortNodeSmmuV1V2Parser[] = { PARSE_IORT_NODE_HEADER (NULL, NULL), {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Span", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Model", 4, 32, L"%d", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER IortNodeSmmuV1V2Parser[] = { {L"SMMU_NSgIrpt interrupt flags", 4, 64, L"0x%x", NULL, NULL, NULL, NULL}, {L"SMMU_NSgCfgIrpt", 4, 68, L"0x%x", NULL, NULL, NULL, NULL}, {L"SMMU_NSgCfgIrpt interrupt flags", 4, 72, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the SMMUv1/2 Node Interrupt Array. -*/ +/** + An ACPI_PARSER array describing the SMMUv1/2 Node Interrupt Array. +**/ STATIC CONST ACPI_PARSER InterruptArrayParser[] = { {L" Interrupt GSIV", 4, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L" Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the IORT ID Mapping. -*/ +/** + An ACPI_PARSER array describing the IORT ID Mapping. +**/ STATIC CONST ACPI_PARSER IortNodeIdMappingParser[] = { {L" Input base", 4, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L" Number of IDs", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, {L" Output base", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, {L" Output reference", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}, {L" Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the IORT SMMUv3 node. -*/ +/** + An ACPI_PARSER array describing the IORT SMMUv3 node. +**/ STATIC CONST ACPI_PARSER IortNodeSmmuV3Parser[] = { PARSE_IORT_NODE_HEADER (NULL, NULL), {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER IortNodeSmmuV3Parser[] = { {L"PRI", 4, 48, L"0x%x", NULL, NULL, NULL, NULL}, {L"GERR", 4, 52, L"0x%x", NULL, NULL, NULL, NULL}, {L"Sync", 4, 56, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the IORT ITS node. -*/ +/** + An ACPI_PARSER array describing the IORT ITS node. +**/ STATIC CONST ACPI_PARSER IortNodeItsParser[] = { PARSE_IORT_NODE_HEADER ( ValidateItsIdMappingCount, ValidateItsIdArrayReference ), {L" Number of ITSs", 4, 16, L"%d", NULL, (VOID**)&ItsCount, NULL} }; -/** An ACPI_PARSER array describing the ITS ID. -*/ +/** + An ACPI_PARSER array describing the ITS ID. +**/ STATIC CONST ACPI_PARSER ItsIdParser[] = { { L" GIC ITS Identifier", 4, 0, L"%d", NULL, NULL, NULL } }; -/** An ACPI_PARSER array describing the IORT Names Component node. -*/ +/** + An ACPI_PARSER array describing the IORT Names Component node. +**/ STATIC CONST ACPI_PARSER IortNodeNamedComponentParser[] = { PARSE_IORT_NODE_HEADER (NULL, NULL), {L"Node Flags", 4, 16, L"%d", NULL, NULL, NULL, NULL}, {L"Memory access properties", 8, 20, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Device memory address size limit", 1, 28, L"%d", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the IORT Root Complex node. -*/ +/** + An ACPI_PARSER array describing the IORT Root Complex node. +**/ STATIC CONST ACPI_PARSER IortNodeRootComplexParser[] = { PARSE_IORT_NODE_HEADER (NULL, NULL), {L"Memory access properties", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, {L"ATS Attribute", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, {L"PCI Segment number", 4, 28, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the IORT PMCG node. -*/ +/** + An ACPI_PARSER array describing the IORT PMCG node. +**/ STATIC CONST ACPI_PARSER IortNodePmcgParser[] = { PARSE_IORT_NODE_HEADER (NULL, NULL), {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Overflow interrupt GSIV", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, {L"Node reference", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, }; -/** This function validates the ID Mapping array count for the ITS node. +/** + 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] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateItsIdMappingCount ( IN UINT8* Ptr, - VOID* Context + IN VOID* Context ) { if (*(UINT32*)Ptr != 0) { IncrementErrorCount (); Print (L"\nERROR: IORT ID Mapping count must be zero."); } } -/** This function validates the ID Mapping array offset for the ITS node. +/** + 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] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateItsIdArrayReference ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateItsIdArrayReference ( IncrementErrorCount (); Print (L"\nERROR: IORT ID Mapping offset must be zero."); } } -/** This function parses the IORT Node Id Mapping array. +/** + This function parses the IORT Node Id Mapping array. @param [in] Ptr Pointer to the start of the IORT Table. @param [in] MappingCount The ID Mapping count. @param [in] MappingOffset The offset of the ID Mapping array from the start of the IORT table. -*/ +**/ STATIC VOID DumpIortNodeIdMappings ( IN UINT8* Ptr, IN UINT32 MappingCount, @@ -XXX,XX +XXX,XX @@ DumpIortNodeIdMappings ( IdMappingPtr += Offset; Index++; } } -/** This function parses the IORT SMMUv1/2 node. +/** + This function parses the IORT SMMUv1/2 node. @param [in] Ptr Pointer to the start of the buffer. @param [in] Length Length of the buffer. @param [in] MappingCount The ID Mapping count. @param [in] MappingOffset The offset of the ID Mapping array from the start of the IORT table. -*/ +**/ STATIC VOID DumpIortNodeSmmuV1V2 ( IN UINT8* Ptr, IN UINT16 Length, @@ -XXX,XX +XXX,XX @@ DumpIortNodeSmmuV1V2 ( if (*IortIdMappingCount != 0) { DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset); } } -/** This function parses the IORT SMMUv3 node. +/** + This function parses the IORT SMMUv3 node. @param [in] Ptr Pointer to the start of the buffer. @param [in] Length Length of the buffer. @param [in] MappingCount The ID Mapping count. @param [in] MappingOffset The offset of the ID Mapping array from the start of the IORT table. -*/ +**/ STATIC VOID DumpIortNodeSmmuV3 ( IN UINT8* Ptr, IN UINT16 Length, @@ -XXX,XX +XXX,XX @@ DumpIortNodeSmmuV3 ( if (*IortIdMappingCount != 0) { DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset); } } -/** This function parses the IORT ITS node. +/** + This function parses the IORT ITS node. @param [in] Ptr Pointer to the start of the buffer. @param [in] Length Length of the buffer. -*/ +**/ STATIC VOID DumpIortNodeIts ( IN UINT8* Ptr, IN UINT16 Length @@ -XXX,XX +XXX,XX @@ DumpIortNodeIts ( } // Note: ITS does not have the ID Mappings Array } -/** This function parses the IORT Named Component node. +/** + This function parses the IORT Named Component node. @param [in] Ptr Pointer to the start of the buffer. @param [in] Length Length of the buffer. @param [in] MappingCount The ID Mapping count. @param [in] MappingOffset The offset of the ID Mapping array from the start of the IORT table. -*/ +**/ STATIC VOID DumpIortNodeNamedComponent ( IN UINT8* Ptr, IN UINT16 Length, @@ -XXX,XX +XXX,XX @@ DumpIortNodeNamedComponent ( if (*IortIdMappingCount != 0) { DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset); } } -/** This function parses the IORT Root Complex node. +/** + This function parses the IORT Root Complex node. @param [in] Ptr Pointer to the start of the buffer. @param [in] Length Length of the buffer. @param [in] MappingCount The ID Mapping count. @param [in] MappingOffset The offset of the ID Mapping array from the start of the IORT table. -*/ +**/ STATIC VOID DumpIortNodeRootComplex ( IN UINT8* Ptr, IN UINT16 Length, @@ -XXX,XX +XXX,XX @@ DumpIortNodeRootComplex ( if (*IortIdMappingCount != 0) { DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset); } } -/** This function parses the IORT PMCG node. +/** + This function parses the IORT PMCG node. @param [in] Ptr Pointer to the start of the buffer. @param [in] Length Length of the buffer. @param [in] MappingCount The ID Mapping count. @param [in] MappingOffset The offset of the ID Mapping array from the start of the IORT table. -*/ +**/ STATIC VOID DumpIortNodePmcg ( IN UINT8* Ptr, IN UINT16 Length, @@ -XXX,XX +XXX,XX @@ DumpIortNodePmcg ( *IortIdMappingCount ); } } -/** This function parses the ACPI IORT table. - When trace is enabled this function parses the IORT table and - traces the ACPI fields. +/** + This function parses the ACPI IORT table. + When trace is enabled this function parses the IORT table and traces the ACPI fields. This function also parses the following nodes: - ITS Group - Named Component - Root Complex @@ -XXX,XX +XXX,XX @@ DumpIortNodePmcg ( @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 ParseAcpiIort ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file MADT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ // Local Variables STATIC CONST UINT8* MadtInterruptControllerType; STATIC CONST UINT8* MadtInterruptControllerLength; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -// Forward declarations +/** + This function validates the System Vector Base in the GICD. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ STATIC VOID EFIAPI ValidateGICDSystemVectorBase ( IN UINT8* Ptr, IN VOID* Context -); + ); -/** An ACPI_PARSER array describing the GICC Interrupt - Controller Structure. -*/ +/** + An ACPI_PARSER array describing the GICC Interrupt Controller Structure. +**/ STATIC CONST ACPI_PARSER GicCParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER GicCParser[] = { {L"Processor Power Efficiency Class", 1, 76, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 3, 77, L"%x %x %x", Dump3Chars, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the GICD Interrupt - Controller Structure. -*/ +/** + An ACPI_PARSER array describing the GICD Interrupt Controller Structure. +**/ STATIC CONST ACPI_PARSER GicDParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER GicDParser[] = { ValidateGICDSystemVectorBase, NULL}, {L"GIC Version", 1, 20, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 3, 21, L"%x %x %x", Dump3Chars, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the MSI Frame Interrupt - Controller Structure. -*/ +/** + An ACPI_PARSER array describing the MSI Frame Interrupt Controller Structure. +**/ STATIC CONST ACPI_PARSER GicMSIFrameParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER GicMSIFrameParser[] = { {L"SPI Count", 2, 20, L"%d", NULL, NULL, NULL, NULL}, {L"SPI Base", 2, 22, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the GICR Interrupt - Controller Structure. -*/ +/** + An ACPI_PARSER array describing the GICR Interrupt Controller Structure. +**/ STATIC CONST ACPI_PARSER GicRParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, {L"Discovery Range Base Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Discovery Range Length", 4, 12, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the GIC ITS Interrupt - Controller Structure. -*/ +/** + An ACPI_PARSER array describing the GIC ITS Interrupt Controller Structure. +**/ STATIC CONST ACPI_PARSER GicITSParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, {L"GIC ITS ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, {L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Reserved", 4, 16, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the ACPI MADT Table. -*/ +/** + An ACPI_PARSER array describing the ACPI MADT Table. +**/ STATIC CONST ACPI_PARSER MadtParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"Local Interrupt Controller Address", 4, 36, L"0x%x", NULL, NULL, NULL, NULL}, {L"Flags", 4, 40, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the MADT Interrupt - Controller Structure Header Structure. -*/ +/** + An ACPI_PARSER array describing the MADT Interrupt Controller Structure Header Structure. +**/ STATIC CONST ACPI_PARSER MadtInterruptControllerHeaderParser[] = { {NULL, 1, 0, NULL, NULL, (VOID**)&MadtInterruptControllerType, NULL, NULL}, {L"Length", 1, 1, NULL, NULL, (VOID**)&MadtInterruptControllerLength, NULL, NULL}, {L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL} }; -/** This function validates the System Vector Base in the GICD. +/** + This function validates the System Vector Base in the GICD. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateGICDSystemVectorBase ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateGICDSystemVectorBase ( L"\nERROR: System Vector Base must be zero." ); } } -/** This function parses the ACPI MADT table. +/** + This function parses the ACPI MADT table. When trace is enabled this function parses the MADT table and traces the ACPI table fields. This function currently parses the following Interrupt Controller Structures: @@ -XXX,XX +XXX,XX @@ ValidateGICDSystemVectorBase ( @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 ParseAcpiMadt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file MCFG table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include "AcpiTableParser.h" // Local variables STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** An ACPI_PARSER array describing the ACPI MCFG Table. -*/ +/** + An ACPI_PARSER array describing the ACPI MCFG Table. +**/ STATIC CONST ACPI_PARSER McfgParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"Reserved", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL}, }; -/** An ACPI_PARSER array describing the PCI configuration Space - Base Address structure. -*/ +/** + An ACPI_PARSER array describing the PCI configuration Space Base Address structure. +**/ STATIC CONST ACPI_PARSER PciCfgSpaceBaseAddrParser[] = { {L"Base Address", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL}, {L"PCI Segment Group No.", 2, 8, L"0x%x", NULL, NULL, NULL, NULL}, {L"Start Bus No.", 1, 10, L"0x%x", NULL, NULL, NULL, NULL}, {L"End Bus No.", 1, 11, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL} }; -/** This function parses the ACPI MCFG table. +/** + This function parses the ACPI MCFG table. When trace is enabled this function parses the MCFG 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 ParseAcpiMcfg ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file RSDP table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include "AcpiTableParser.h" // Local Variables STATIC CONST UINT64* XsdtAddress; -/** This function validates the RSDT Address. +/** + This function validates the RSDT Address. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateRsdtAddress ( IN UINT8* Ptr, IN VOID* Context ); -/** This function validates the XSDT Address. +/** + This function validates the XSDT Address. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateXsdtAddress ( IN UINT8* Ptr, IN VOID* Context ); -/** An array describing the ACPI RSDP Table. -*/ +/** + An array describing the ACPI RSDP Table. +**/ STATIC CONST ACPI_PARSER RsdpParser[] = { {L"Signature", 8, 0, NULL, Dump8Chars, NULL, NULL, NULL}, {L"Checksum", 1, 8, L"0x%x", NULL, NULL, NULL, NULL}, {L"Oem ID", 6, 9, NULL, Dump6Chars, NULL, NULL, NULL}, {L"Revision", 1, 15, L"%d", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER RsdpParser[] = { ValidateXsdtAddress, NULL}, {L"Extended Checksum", 1, 32, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL} }; -/** This function validates the RSDT Address. +/** + This function validates the RSDT Address. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateRsdtAddress ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateRsdtAddress ( ); } #endif } -/** This function validates the XSDT Address. +/** + This function validates the XSDT Address. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateXsdtAddress ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateXsdtAddress ( ); } #endif } -/** This function parses the ACPI RSDP table. +/** + This function parses the ACPI RSDP table. This function invokes the parser for the XSDT table. * Note - This function does not support parsing of RSDT table. This function also performs a RAW dump of the ACPI table and @@ -XXX,XX +XXX,XX @@ ValidateXsdtAddress ( @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 ParseAcpiRsdp ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file SLIT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ // Local Variables STATIC CONST UINT64* SlitSystemLocalityCount; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** An ACPI_PARSER array describing the ACPI SLIT table. -*/ +/** + An ACPI_PARSER array describing the ACPI SLIT table. +**/ STATIC CONST ACPI_PARSER SlitParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"Number of System Localities", 8, 36, L"0x%lx", NULL, (VOID**)&SlitSystemLocalityCount, NULL, NULL} }; -/** Macro to get the value of a System Locality -*/ +/** + Macro to get the value of a System Locality +**/ #define SLIT_ELEMENT(Ptr, i, j) *(Ptr + (i * LocalityCount) + j) -/** This function parses the ACPI SLIT table. +/** + This function parses the ACPI SLIT table. When trace is enabled this function parses the SLIT table and traces the ACPI table fields. This function also validates System Localities for the following: - Diagonal elements have a normalized value of 10 @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER SlitParser[] = { @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 ParseAcpiSlit ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file SPCR table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include "AcpiTableParser.h" // Local variables STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** This function validates the Interrupt Type. +/** + This function validates the Interrupt Type. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateInterruptType ( IN UINT8* Ptr, IN VOID* Context ); -/** This function validates the Irq. +/** + This function validates the Irq. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateIrq ( IN UINT8* Ptr, IN VOID* Context ); -/** An ACPI_PARSER array describing the ACPI SPCR Table. -*/ +/** + An ACPI_PARSER array describing the ACPI SPCR Table. +**/ STATIC CONST ACPI_PARSER SpcrParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"Interface Type", 1, 36, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 3, 37, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}, {L"Base Address", 12, 40, NULL, DumpGas, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER SpcrParser[] = { {L"PCI Flags", 4, 71, L"0x%x", NULL, NULL, NULL, NULL}, {L"PCI Segment", 1, 75, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 4, 76, L"%x", NULL, NULL, NULL, NULL} }; -/** This function validates the Interrupt Type. +/** + This function validates the Interrupt Type. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateInterruptType ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateInterruptType ( ); } #endif } -/** This function validates the Irq. +/** + This function validates the Irq. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateIrq ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateIrq ( ); } #endif } -/** This function parses the ACPI SPCR table. +/** + This function parses the ACPI SPCR table. When trace is enabled this function parses the SPCR table and traces the ACPI table fields. This function also performs validations 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 ParseAcpiSpcr ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file SRAT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ // Local Variables STATIC CONST UINT8* SratRAType; STATIC CONST UINT8* SratRALength; STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; -/** This function validates the Reserved field in the SRAT table header. +/** + This function validates the Reserved field in the SRAT table header. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateSratReserved ( IN UINT8* Ptr, IN VOID* Context ); -/** This function traces the APIC Proximity Domain field. +/** + This function traces the APIC Proximity Domain field. @param [in] Format Format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ STATIC VOID DumpSratApicProximity ( IN CONST CHAR16* Format, IN UINT8* Ptr ); -/** An ACPI_PARSER array describing the SRAT Table. -*/ +/** + An ACPI_PARSER array describing the SRAT Table. +**/ STATIC CONST ACPI_PARSER SratParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo), {L"Reserved", 4, 36, L"0x%x", NULL, NULL, ValidateSratReserved, NULL}, {L"Reserved", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the Resource Allocation - structure header. -*/ +/** + An ACPI_PARSER array describing the Resource Allocation structure header. +**/ STATIC CONST ACPI_PARSER SratResourceAllocationParser[] = { {L"Type", 1, 0, NULL, NULL, (VOID**)&SratRAType, NULL, NULL}, {L"Length", 1, 1, NULL, NULL, (VOID**)&SratRALength, NULL, NULL} }; -/** An ACPI_PARSER array describing the GICC Affinity structure. -*/ +/** + An ACPI_PARSER array describing the GICC Affinity structure. +**/ STATIC CONST ACPI_PARSER SratGicCAffinityParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, {L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL}, {L"ACPI Processor UID", 4, 6, L"0x%x", NULL, NULL, NULL, NULL}, {L"Flags", 4, 10, L"0x%x", NULL, NULL, NULL, NULL}, {L"Clock Domain", 4, 14, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the GIC ITS Affinity structure. -*/ +/** + An ACPI_PARSER array describing the GIC ITS Affinity structure. +**/ STATIC CONST ACPI_PARSER SratGicITSAffinityParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, {L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL}, {L"ITS Id", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, }; -/** An ACPI_PARSER array describing the Memory Affinity structure. -*/ +/** + An ACPI_PARSER array describing the Memory Affinity structure. +**/ STATIC CONST ACPI_PARSER SratMemAffinityParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, {L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER SratMemAffinityParser[] = { {L"Reserved", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, {L"Flags", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the APIC/SAPIC Affinity structure. -*/ +/** + An ACPI_PARSER array describing the APIC/SAPIC Affinity structure. +**/ STATIC CONST ACPI_PARSER SratApciSapicAffinityParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, {L"Proximity Domain [7:0]", 1, 2, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER SratApciSapicAffinityParser[] = { {L"Proximity Domain [31:8]", 3, 9, L"0x%x", DumpSratApicProximity, NULL, NULL, NULL}, {L"Clock Domain", 4, 12, L"0x%x", NULL, NULL, NULL, NULL} }; -/** An ACPI_PARSER array describing the Processor Local x2APIC - Affinity structure. -*/ +/** + An ACPI_PARSER array describing the Processor Local x2APIC Affinity structure. +**/ STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] = { {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, {L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, @@ -XXX,XX +XXX,XX @@ STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] = { /** This function validates the Reserved field in the SRAT table header. @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. -*/ +**/ STATIC VOID EFIAPI ValidateSratReserved ( IN UINT8* Ptr, @@ -XXX,XX +XXX,XX @@ ValidateSratReserved ( IncrementErrorCount (); Print (L"\nERROR: Reserved should be 1 for backward compatibility.\n"); } } -/** This function traces the APIC Proximity Domain field. +/** + This function traces the APIC Proximity Domain field. @param [in] Format Format string for tracing the data. @param [in] Ptr Pointer to the start of the buffer. -*/ +**/ STATIC VOID DumpSratApicProximity ( IN CONST CHAR16* Format, IN UINT8* Ptr @@ -XXX,XX +XXX,XX @@ DumpSratApicProximity ( { UINT32 ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16); Print (Format, ProximityDomain); } -/** This function parses the ACPI SRAT table. +/** + This function parses the ACPI SRAT table. When trace is enabled this function parses the SRAT table and traces the ACPI table fields. This function parses the following Resource Allocation Structures: - Processor Local APIC/SAPIC Affinity Structure @@ -XXX,XX +XXX,XX @@ DumpSratApicProximity ( @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 ParseAcpiSrat ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file SSDT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ #include <IndustryStandard/Acpi.h> #include <Library/UefiLib.h> #include "AcpiParser.h" #include "AcpiTableParser.h" -/** This function parses the ACPI SSDT table. +/** + This function parses the ACPI SSDT table. When trace is enabled this function parses the SSDT table and traces the ACPI table fields. For the SSDT table only the ACPI header fields are parsed and traced. @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 ParseAcpiSsdt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file XSDT table parser Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; */ STATIC CONST ACPI_PARSER XsdtParser[] = { PARSE_ACPI_HEADER (&AcpiHdrInfo) }; +/** + Get the ACPI XSDT header info. +**/ CONST ACPI_DESCRIPTION_HEADER_INFO* CONST EFIAPI GetAcpiXsdtHeaderInfo ( VOID ) { return &AcpiHdrInfo; } -/** This function parses the ACPI XSDT table - and optionally traces the ACPI table fields. +/** + This function parses the ACPI XSDT table and optionally traces the ACPI table fields. This function also performs validation of the XSDT 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 ParseAcpiXsdt ( IN BOOLEAN Trace, IN UINT8* Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c @@ -XXX,XX +XXX,XX @@ -/** +/** @file Main file for 'acpiview' Shell command function. Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ ACPI_TABLE_PARSER ParserList[] = { {EFI_ACPI_6_2_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE, ParseAcpiSrat}, {EFI_ACPI_6_2_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiSsdt}, {EFI_ACPI_6_2_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiXsdt} }; -/** This function registers all the available table parsers. +/** + This function registers all the available table parsers. @retval EFI_SUCCESS The parser is registered. @retval EFI_ALREADY_STARTED The parser for the ACPI Table was already registered. @retval EFI_INVALID_PARAMETER A parameter is invalid. @retval EFI_OUT_OF_RESOURCES No space to register the parser. -*/ +**/ EFI_STATUS RegisterAllParsers ( ) { EFI_STATUS Status; @@ -XXX,XX +XXX,XX @@ RegisterAllParsers ( /** Return the file name of the help text file if not using HII. @return The string pointer to the file name. -*/ +**/ CONST CHAR16* EFIAPI ShellCommandGetManFileNameAcpiView ( VOID ) @@ -XXX,XX +XXX,XX @@ ShellCommandGetManFileNameAcpiView ( @param SystemTable The EFI System Table pointer. @retval EFI_SUCCESS The Shell command handlers were installed successfully. @retval EFI_DEVICE_ERROR Hii package failed to install. -*/ +**/ EFI_STATUS EFIAPI UefiShellAcpiViewCommandLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable @@ -XXX,XX +XXX,XX @@ UefiShellAcpiViewCommandLibConstructor ( /** Destructor for the library. free any resources. @param ImageHandle The image handle of the process. @param SystemTable The EFI System Table pointer. -*/ +**/ EFI_STATUS EFIAPI UefiShellAcpiViewCommandLibDestructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h @@ -XXX,XX +XXX,XX @@ -/** +/** @file Header file for 'acpiview' Shell command functions. Copyright (c) 2016 - 2017, ARM Limited. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -XXX,XX +XXX,XX @@ extern EFI_HII_HANDLE gShellAcpiViewHiiHandle; /** Function for 'acpiview' command. @param[in] ImageHandle Handle to the Image (NULL if Internal). @param[in] SystemTable Pointer to the System Table (NULL if Internal). -*/ +**/ SHELL_STATUS EFIAPI ShellCommandRunAcpiView ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable -- 2.14.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
1. Separate variable definition and initialization. 2. Make the variable naming following Edk2 rule. V2: Remove the updates of guard macros in header files. Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Evan Lloyd <evan.lloyd@arm.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> --- .../UefiShellAcpiViewCommandLib/AcpiParser.c | 44 ++++++++++------ .../UefiShellAcpiViewCommandLib/AcpiTableParser.c | 50 +++++++++---------- .../Library/UefiShellAcpiViewCommandLib/AcpiView.c | 58 ++++++++++++++-------- .../Library/UefiShellAcpiViewCommandLib/AcpiView.h | 10 ++-- .../Parsers/Dbg2/Dbg2Parser.c | 5 +- .../Parsers/Gtdt/GtdtParser.c | 5 +- .../Parsers/Iort/IortParser.c | 26 +++++----- .../Parsers/Madt/MadtParser.c | 4 +- .../Parsers/Rsdp/RsdpParser.c | 10 +++- .../Parsers/Slit/SlitParser.c | 44 ++++++++-------- .../Parsers/Spcr/SpcrParser.c | 10 +++- .../Parsers/Srat/SratParser.c | 21 +++++--- .../UefiShellAcpiViewCommandLib.c | 5 +- .../UefiShellAcpiViewCommandLib.inf | 3 ++ 14 files changed, 178 insertions(+), 117 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -XXX,XX +XXX,XX @@ STATIC UINT32 gIndent; STATIC UINT32 mTableErrorCount; STATIC UINT32 mTableWarningCount; +STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; + +/** + An ACPI_PARSER array describing the ACPI header. +**/ +STATIC CONST ACPI_PARSER AcpiHeaderParser[] = { + PARSE_ACPI_HEADER (&AcpiHdrInfo) +}; + /** This function resets the ACPI table error counter to Zero. **/ VOID ResetErrorCount ( @@ -XXX,XX +XXX,XX @@ VerifyChecksum ( IN BOOLEAN Log, IN UINT8* Ptr, IN UINT32 Length ) { - UINTN ByteCount = 0; - UINT8 Checksum = 0; + UINTN ByteCount; + UINT8 Checksum; UINTN OriginalAttribute; + ByteCount = 0; + Checksum = 0; + while (ByteCount < Length) { Checksum += *(Ptr++); ByteCount++; } @@ -XXX,XX +XXX,XX @@ EFIAPI DumpRaw ( IN UINT8* Ptr, IN UINT32 Length ) { - UINTN ByteCount = 0; + UINTN ByteCount; UINTN PartLineChars; - UINTN AsciiBufferIndex = 0; + UINTN AsciiBufferIndex; CHAR8 AsciiBuffer[17]; + ByteCount = 0; + AsciiBufferIndex = 0; + Print (L"Address : 0x%p\n", Ptr); Print (L"Length : %d\n", Length); while (ByteCount < Length) { if ((ByteCount & 0x0F) == 0) { @@ -XXX,XX +XXX,XX @@ DumpUint64 ( ) { // Some fields are not aligned and this causes alignment faults // on ARM platforms if the compiler generates LDRD instructions. // Perform word access so that LDRD instructions are not generated. - UINT64 Val = *(UINT32*)(Ptr + sizeof (UINT32)); + UINT64 Val; + + Val = *(UINT32*)(Ptr + sizeof (UINT32)); + Val <<= 32; Val |= *(UINT32*)Ptr; Print (Format, Val); } @@ -XXX,XX +XXX,XX @@ ParseAcpi ( IN CONST ACPI_PARSER* Parser, IN UINT32 ParserItems ) { UINT32 Index; - UINT32 Offset = 0; + UINT32 Offset; + BOOLEAN HighLight; + + Offset = 0; // Increment the Indent gIndent += Indent; if (Trace && (AsciiName != NULL)){ - BOOLEAN HighLight = GetColourHighlighting (); + HighLight = GetColourHighlighting (); UINTN OriginalAttribute; if (HighLight) { OriginalAttribute = gST->ConOut->Mode->Attribute; gST->ConOut->SetAttribute ( @@ -XXX,XX +XXX,XX @@ UINT32 EFIAPI DumpAcpiHeader ( IN UINT8* Ptr ) { - ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - ACPI_PARSER AcpiHeaderParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo) - }; - return ParseAcpi ( TRUE, 0, "ACPI Table Header", Ptr, @@ -XXX,XX +XXX,XX @@ ParseAcpiHeader ( OUT CONST UINT32** Length, OUT CONST UINT8** Revision ) { UINT32 BytesParsed; - ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; - ACPI_PARSER AcpiHeaderParser[] = { - PARSE_ACPI_HEADER (&AcpiHdrInfo) - }; BytesParsed = ParseAcpi ( FALSE, 0, NULL, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c @@ -XXX,XX +XXX,XX @@ EFIAPI RegisterParser ( IN UINT32 Signature, IN PARSE_ACPI_TABLE_PROC ParserProc ) { - UINT32 index; + UINT32 Index; if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) { return EFI_INVALID_PARAMETER; } // Search if a parser is already installed - for (index = 0; - index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - index++) + for (Index = 0; + Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); + Index++) { - if (Signature == mTableParserList[index].Signature) { - if (mTableParserList[index].Parser != NULL) { + if (Signature == mTableParserList[Index].Signature) { + if (mTableParserList[Index].Parser != NULL) { return EFI_ALREADY_STARTED; } } } // Find the first free slot and register the parser - for (index = 0; - index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - index++) + for (Index = 0; + Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); + Index++) { - if (mTableParserList[index].Signature == ACPI_PARSER_SIGNATURE_NULL) { - mTableParserList[index].Signature = Signature; - mTableParserList[index].Parser = ParserProc; + if (mTableParserList[Index].Signature == ACPI_PARSER_SIGNATURE_NULL) { + mTableParserList[Index].Signature = Signature; + mTableParserList[Index].Parser = ParserProc; return EFI_SUCCESS; } } // No free slot found @@ -XXX,XX +XXX,XX @@ EFI_STATUS EFIAPI DeregisterParser ( IN UINT32 Signature ) { - UINT32 index; + UINT32 Index; if (Signature == ACPI_PARSER_SIGNATURE_NULL) { return EFI_INVALID_PARAMETER; } - for (index = 0; - index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - index++) + for (Index = 0; + Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); + Index++) { - if (Signature == mTableParserList[index].Signature) { - mTableParserList[index].Signature = ACPI_PARSER_SIGNATURE_NULL; - mTableParserList[index].Parser = NULL; + if (Signature == mTableParserList[Index].Signature) { + mTableParserList[Index].Signature = ACPI_PARSER_SIGNATURE_NULL; + mTableParserList[Index].Parser = NULL; return EFI_SUCCESS; } } // No matching registered parser found. @@ -XXX,XX +XXX,XX @@ EFIAPI GetParser ( IN UINT32 Signature, OUT PARSE_ACPI_TABLE_PROC * ParserProc ) { - UINT32 index; + UINT32 Index; if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) { return EFI_INVALID_PARAMETER; } - for (index = 0; - index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); - index++) + for (Index = 0; + Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0])); + Index++) { - if (Signature == mTableParserList[index].Signature) { - *ParserProc = mTableParserList[index].Parser; + if (Signature == mTableParserList[Index].Signature) { + *ParserProc = mTableParserList[Index].Parser; return EFI_SUCCESS; } } // No matching registered parser found. diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -XXX,XX +XXX,XX @@ DumpAcpiTableToFile ( IN CONST UINTN Length ) { EFI_STATUS Status; CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - SHELL_FILE_HANDLE DumpFileHandle = NULL; - UINTN TransferBytes = Length; + SHELL_FILE_HANDLE DumpFileHandle; + UINTN TransferBytes; + + DumpFileHandle = NULL; + TransferBytes = Length; UnicodeSPrint ( FileNameBuffer, sizeof (FileNameBuffer), L".\\%s%04d.bin", @@ -XXX,XX +XXX,XX @@ ProcessTableReportOptions ( IN CONST UINT8* TablePtr, IN CONST UINT32 Length ) { UINTN OriginalAttribute; - UINT8* SignaturePtr = (UINT8*)(UINTN)&Signature; - BOOLEAN Log = FALSE; - BOOLEAN HighLight = GetColourHighlighting (); + UINT8* SignaturePtr; + BOOLEAN Log; + BOOLEAN HighLight; + + SignaturePtr = (UINT8*)(UINTN)&Signature; + Log = FALSE; + HighLight = GetColourHighlighting (); + switch (GetReportOption ()) { - case EREPORT_ALL: + case ReportAll: Log = TRUE; break; - case EREPORT_SELECTED: + case ReportSelected: if (Signature == GetSelectedAcpiTable ()) { Log = TRUE; mSelectedAcpiTableFound = TRUE; } break; - case EREPORT_TABLE_LIST: + case ReportTableList: if (mTableCount == 0) { if (HighLight) { OriginalAttribute = gST->ConOut->Mode->Attribute; gST->ConOut->SetAttribute ( gST->ConOut, @@ -XXX,XX +XXX,XX @@ ProcessTableReportOptions ( SignaturePtr[1], SignaturePtr[2], SignaturePtr[3] ); break; - case EREPORT_DUMP_BIN_FILE: + case ReportDumpBinFile: if (Signature == GetSelectedAcpiTable ()) { mSelectedAcpiTableFound = TRUE; DumpAcpiTableToFile (TablePtr, Length); } break; - case EREPORT_MAX: + case ReportMax: // We should never be here. // This case is only present to prevent compiler warning. break; } // switch @@ -XXX,XX +XXX,XX @@ STATIC UINT32 ConvertStrToAcpiSignature ( IN CONST CHAR16* Str ) { - UINT8 Index = 0; + UINT8 Index; CHAR8 Ptr[4]; + Index = 0; + // Convert to Upper case and convert to ASCII while ((Index < 4) && (Str[Index] != 0)) { if (Str[Index] >= L'a' && Str[Index] <= L'z') { Ptr[Index] = (CHAR8)(Str[Index] - (L'a' - L'A')); } else { @@ -XXX,XX +XXX,XX @@ AcpiView ( ); return EFI_NOT_FOUND; } ReportOption = GetReportOption (); - if (EREPORT_TABLE_LIST != ReportOption) { - if (((EREPORT_SELECTED == ReportOption) || - (EREPORT_DUMP_BIN_FILE == ReportOption)) && + if (ReportTableList != ReportOption) { + if (((ReportSelected == ReportOption) || + (ReportDumpBinFile == ReportOption)) && (!mSelectedAcpiTableFound)) { Print (L"\nRequested ACPI Table not found.\n"); - } else if (EREPORT_DUMP_BIN_FILE != ReportOption) { + } else if (ReportDumpBinFile != ReportOption) { OriginalAttribute = gST->ConOut->Mode->Attribute; Print (L"\nTable Statistics:\n"); if (GetColourHighlighting ()) { @@ -XXX,XX +XXX,XX @@ ShellCommandRunAcpiView ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE* SystemTable ) { EFI_STATUS Status; - SHELL_STATUS ShellStatus = SHELL_SUCCESS; - LIST_ENTRY* Package = NULL; + SHELL_STATUS ShellStatus; + LIST_ENTRY* Package; CHAR16* ProblemParam; CONST CHAR16* Temp; CHAR8 ColourOption[8]; - SHELL_FILE_HANDLE TmpDumpFileHandle = NULL; + SHELL_FILE_HANDLE TmpDumpFileHandle; // Set Defaults - mReportType = EREPORT_ALL; + mReportType = ReportAll; mTableCount = 0; mBinTableCount = 0; mSelectedAcpiTable = 0; mSelectedAcpiTableName = NULL; mSelectedAcpiTableFound = FALSE; mVerbose = TRUE; mConsistencyCheck = TRUE; + ShellStatus = SHELL_SUCCESS; + Package = NULL; + TmpDumpFileHandle = NULL; + // Reset The error/warning counters ResetErrorCount (); ResetWarningCount (); Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); @@ -XXX,XX +XXX,XX @@ ShellCommandRunAcpiView ( SetColourHighlighting (FALSE); } } if (ShellCommandLineGetFlag (Package, L"-l")) { - mReportType = EREPORT_TABLE_LIST; + mReportType = ReportTableList; } else { mSelectedAcpiTableName = ShellCommandLineGetValue (Package, L"-s"); if (mSelectedAcpiTableName != NULL) { mSelectedAcpiTable = (UINT32)ConvertStrToAcpiSignature ( mSelectedAcpiTableName ); - mReportType = EREPORT_SELECTED; + mReportType = ReportSelected; if (ShellCommandLineGetFlag (Package, L"-d")) { // Create a temporary file to check if the media is writable. CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - mReportType = EREPORT_DUMP_BIN_FILE; + mReportType = ReportDumpBinFile; UnicodeSPrint ( FileNameBuffer, sizeof (FileNameBuffer), L".\\%s%04d.tmp", diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h @@ -XXX,XX +XXX,XX @@ /** The EREPORT_OPTION enum describes ACPI table Reporting options. **/ typedef enum ReportOption { - EREPORT_ALL, ///< Report All tables. - EREPORT_SELECTED, ///< Report Selected table. - EREPORT_TABLE_LIST, ///< Report List of tables. - EREPORT_DUMP_BIN_FILE, ///< Dump selected table to a file. - EREPORT_MAX + ReportAll, ///< Report All tables. + ReportSelected, ///< Report Selected table. + ReportTableList, ///< Report List of tables. + ReportDumpBinFile, ///< Dump selected table to a file. + ReportMax, } EREPORT_OPTION; /** This function resets the ACPI table error counter to Zero. **/ diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c @@ -XXX,XX +XXX,XX @@ EFIAPI ValidateNameSpaceStrLen ( IN UINT8* Ptr, IN VOID* Context ) { - UINT16 NameSpaceStrLen = *(UINT16*)Ptr; + UINT16 NameSpaceStrLen; + + NameSpaceStrLen = *(UINT16*)Ptr; + if (NameSpaceStrLen < 2) { IncrementErrorCount (); Print ( L"\nERROR: NamespaceString Length = %d. If no Namespace device exists,\n" " then NamespaceString[] must contain a period '.'", diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c @@ -XXX,XX +XXX,XX @@ EFIAPI ValidateGtBlockTimerCount ( IN UINT8* Ptr, IN VOID* Context ) { - UINT32 BlockTimerCount = *(UINT32*)Ptr; + UINT32 BlockTimerCount; + + BlockTimerCount = *(UINT32*)Ptr; + if (BlockTimerCount > 8) { IncrementErrorCount (); Print ( L"\nERROR: Timer Count = %d. Max Timer Count is 8.", BlockTimerCount diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -XXX,XX +XXX,XX @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; /** The EIORT_NODE enum describes the IORT Node types. **/ typedef enum IortNode { - EIORT_NODE_ITS_GROUP, ///< ITS Group node - EIORT_NODE_NAMED_COMPONENT, ///< Named Component node - EIORT_NODE_ROOT_COMPLEX, ///< Root Complex node - EIORT_NODE_SMMUV1_V2, ///< SMMU v1/v2 node - EIORT_NODE_SMMUV3, ///< SMMU v3 node - EIORT_NODE_PMCG, ///< PMC group node - EIORT_NODE_MAX + Iort_Node_ITS_Group, ///< ITS Group node + Iort_Node_Named_Component, ///< Named Component node + Iort_Node_Root_Complex, ///< Root Complex node + Iort_Node_SMMUV1_V2, ///< SMMU v1/v2 node + Iort_Node_SMMUV3, ///< SMMU v3 node + Iort_Node_PMCG, ///< PMC group node + Iort_Node_Max } EIORT_NODE; // Local Variables STATIC CONST UINT32* IortNodeCount; STATIC CONST UINT32* IortNodeOffset; @@ -XXX,XX +XXX,XX @@ ParseAcpiIort ( PrintFieldName (2, L"* Node Offset *"); Print (L"0x%x\n", Offset); switch (*IortNodeType) { - case EIORT_NODE_ITS_GROUP: + case Iort_Node_ITS_Group: DumpIortNodeIts ( NodePtr, *IortNodeLength ); break; - case EIORT_NODE_NAMED_COMPONENT: + case Iort_Node_Named_Component: DumpIortNodeNamedComponent ( NodePtr, *IortNodeLength, *IortIdMappingCount, *IortIdMappingOffset ); break; - case EIORT_NODE_ROOT_COMPLEX: + case Iort_Node_Root_Complex: DumpIortNodeRootComplex ( NodePtr, *IortNodeLength, *IortIdMappingCount, *IortIdMappingOffset ); break; - case EIORT_NODE_SMMUV1_V2: + case Iort_Node_SMMUV1_V2: DumpIortNodeSmmuV1V2 ( NodePtr, *IortNodeLength, *IortIdMappingCount, *IortIdMappingOffset ); break; - case EIORT_NODE_SMMUV3: + case Iort_Node_SMMUV3: DumpIortNodeSmmuV3 ( NodePtr, *IortNodeLength, *IortIdMappingCount, *IortIdMappingOffset ); break; - case EIORT_NODE_PMCG: + case Iort_Node_PMCG: DumpIortNodePmcg ( NodePtr, *IortNodeLength, *IortIdMappingCount, *IortIdMappingOffset diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -XXX,XX +XXX,XX @@ ParseAcpiMadt ( IN UINT8 AcpiTableRevision ) { UINT32 Offset; UINT8* InterruptContollerPtr; - UINT32 GICDCount = 0; + UINT32 GICDCount; + + GICDCount = 0; if (!Trace) { return; } diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c @@ -XXX,XX +XXX,XX @@ ValidateRsdtAddress ( // Reference: Server Base Boot Requirements System Software on ARM Platforms // Section: 4.2.1.1 RSDP // Root System Description Pointer (RSDP), ACPI ? 5.2.5. // - Within the RSDP, the RsdtAddress field must be null (zero) and the // XsdtAddresss MUST be a valid, non-null, 64-bit value. - UINT32 RsdtAddr = *(UINT32*)Ptr; + UINT32 RsdtAddr; + + RsdtAddr = *(UINT32*)Ptr; + if (RsdtAddr != 0) { IncrementErrorCount (); Print ( L"\nERROR: Rsdt Address = 0x%p. This must be NULL on ARM Platforms.", RsdtAddr @@ -XXX,XX +XXX,XX @@ ValidateXsdtAddress ( // Reference: Server Base Boot Requirements System Software on ARM Platforms // Section: 4.2.1.1 RSDP // Root System Description Pointer (RSDP), ACPI ? 5.2.5. // - Within the RSDP, the RsdtAddress field must be null (zero) and the // XsdtAddresss MUST be a valid, non-null, 64-bit value. - UINT64 XsdtAddr = *(UINT64*)Ptr; + UINT64 XsdtAddr; + + XsdtAddr = *(UINT64*)Ptr; + if (XsdtAddr == 0) { IncrementErrorCount (); Print ( L"\nERROR: Xsdt Address = 0x%p. This must not be NULL on ARM Platforms.", XsdtAddr diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c @@ -XXX,XX +XXX,XX @@ ParseAcpiSlit ( IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ) { UINT32 Offset; - UINT64 i; - UINT64 j; + UINT64 Count; + UINT64 Index; UINT64 LocalityCount; UINT8* LocalityPtr; CHAR16 Buffer[80]; // Used for AsciiName param of ParseAcpi if (!Trace) { @@ -XXX,XX +XXX,XX @@ ParseAcpiSlit ( LocalityCount ); PrintFieldName (0, Buffer); Print (L"\n"); Print (L" "); - for (j = 0; j < LocalityCount; j++) { - Print (L" (%3d) ", j); + for (Index = 0; Index < LocalityCount; Index++) { + Print (L" (%3d) ", Index); } Print (L"\n"); - for (i = 0; i < LocalityCount; i++) { - Print (L" (%3d) ", i); - for (j = 0; j < LocalityCount; j++) { - Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, i, j)); + for (Count = 0; Count< LocalityCount; Count++) { + Print (L" (%3d) ", Count); + for (Index = 0; Index < LocalityCount; Index++) { + Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, Count, Index)); } Print (L"\n"); } } // Validate - for (i = 0; i < LocalityCount; i++) { - for (j = 0; j < LocalityCount; j++) { + for (Count = 0; Count < LocalityCount; Count++) { + for (Index = 0; Index < LocalityCount; Index++) { // Element[x][x] must be equal to 10 - if ((i == j) && (SLIT_ELEMENT (LocalityPtr, i, j) != 10)) { + if ((Count == Index) && (SLIT_ELEMENT (LocalityPtr, Count,Index) != 10)) { IncrementErrorCount (); Print ( L"ERROR: Diagonal Element[0x%lx][0x%lx] (%3d)." " Normalized Value is not 10\n", - i, - j, - SLIT_ELEMENT (LocalityPtr, i, j) + Count, + Index, + SLIT_ELEMENT (LocalityPtr, Count, Index) ); } // Element[i][j] must be equal to Element[j][i] - if (SLIT_ELEMENT (LocalityPtr, i, j) != - SLIT_ELEMENT (LocalityPtr, j, i)) { + if (SLIT_ELEMENT (LocalityPtr, Count, Index) != + SLIT_ELEMENT (LocalityPtr, Index, Count)) { IncrementErrorCount (); Print ( L"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and \n" "Element[0x%lx][0x%lx] (%3d) do not match.\n", - i, - j, - SLIT_ELEMENT (LocalityPtr, i, j), - j, - i, - SLIT_ELEMENT (LocalityPtr, j, i) + Count, + Index, + SLIT_ELEMENT (LocalityPtr, Count, Index), + Index, + Count, + SLIT_ELEMENT (LocalityPtr, Index, Count) ); } } } } diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c @@ -XXX,XX +XXX,XX @@ ValidateInterruptType ( IN UINT8* Ptr, IN VOID* Context ) { #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - UINT8 InterruptType = *Ptr; + UINT8 InterruptType; + + InterruptType = *Ptr; + if (InterruptType != EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC) { IncrementErrorCount (); Print ( L"\nERROR: InterruptType = %d. This must be 8 on ARM Platforms", @@ -XXX,XX +XXX,XX @@ ValidateIrq ( IN UINT8* Ptr, IN VOID* Context ) { #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) - UINT8 Irq = *Ptr; + UINT8 Irq; + + Irq = *Ptr; + if (Irq != 0) { IncrementErrorCount (); Print ( L"\nERROR: Irq = %d. This must be zero on ARM Platforms\n", Irq diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -XXX,XX +XXX,XX @@ VOID DumpSratApicProximity ( IN CONST CHAR16* Format, IN UINT8* Ptr ) { - UINT32 ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16); + UINT32 ProximityDomain; + + ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16); + Print (Format, ProximityDomain); } /** This function parses the ACPI SRAT table. @@ -XXX,XX +XXX,XX @@ ParseAcpiSrat ( IN UINT8 AcpiTableRevision ) { UINT32 Offset; UINT8* ResourcePtr; - UINT32 GicCAffinityIndex = 0; - UINT32 GicITSAffinityIndex = 0; - UINT32 MemoryAffinityIndex = 0; - UINT32 ApicSapicAffinityIndex = 0; - UINT32 X2ApicAffinityIndex = 0; + UINT32 GicCAffinityIndex; + UINT32 GicITSAffinityIndex; + UINT32 MemoryAffinityIndex; + UINT32 ApicSapicAffinityIndex; + UINT32 X2ApicAffinityIndex; CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi + GicCAffinityIndex = 0; + GicITSAffinityIndex = 0; + MemoryAffinityIndex = 0; + ApicSapicAffinityIndex = 0; + X2ApicAffinityIndex = 0; + if (!Trace) { return; } Offset = ParseAcpi ( diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c @@ -XXX,XX +XXX,XX @@ ACPI_TABLE_PARSER ParserList[] = { EFI_STATUS RegisterAllParsers ( ) { EFI_STATUS Status; - UINTN Count = sizeof (ParserList) / sizeof (ParserList[0]); + UINTN Count; + + Count = sizeof (ParserList) / sizeof (ParserList[0]); + while (Count-- != 0) { Status = RegisterParser ( ParserList[Count].Signature, ParserList[Count].Parser ); diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf index XXXXXXX..XXXXXXX 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf @@ -XXX,XX +XXX,XX @@ [Sources.common] UefiShellAcpiViewCommandLib.uni UefiShellAcpiViewCommandLib.c UefiShellAcpiViewCommandLib.h + AcpiParser.h + AcpiTableParser.h + AcpiView.h AcpiParser.c AcpiTableParser.c AcpiView.c Parsers/Bgrt/BgrtParser.c Parsers/Dbg2/Dbg2Parser.c -- 2.14.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel