* [patch 0/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues
@ 2018-06-05 8:33 Dandan Bi
2018-06-05 8:33 ` [patch 1/2] " Dandan Bi
2018-06-05 8:33 ` [patch 2/2] " Dandan Bi
0 siblings, 2 replies; 6+ messages in thread
From: Dandan Bi @ 2018-06-05 8:33 UTC (permalink / raw)
To: edk2-devel; +Cc: Sami Mujawar, Evan Lloyd, Jaben Carsey, Ruiyu Ni
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [patch 1/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues
2018-06-05 8:33 [patch 0/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues Dandan Bi
@ 2018-06-05 8:33 ` Dandan Bi
2018-06-05 8:33 ` [patch 2/2] " Dandan Bi
1 sibling, 0 replies; 6+ messages in thread
From: Dandan Bi @ 2018-06-05 8:33 UTC (permalink / raw)
To: edk2-devel; +Cc: Sami Mujawar, Evan Lloyd, Jaben Carsey, Ruiyu Ni
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 318f386fda1..088575d0144 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -19,88 +19,95 @@
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,
@@ -144,15 +151,16 @@ 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
@@ -203,64 +211,64 @@ 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
@@ -274,18 +282,19 @@ 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
@@ -297,18 +306,19 @@ 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
@@ -321,18 +331,19 @@ 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
@@ -347,18 +358,19 @@ 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
@@ -375,21 +387,22 @@ 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
@@ -402,11 +415,12 @@ 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.
@@ -426,11 +440,11 @@ 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,
@@ -538,28 +552,29 @@ 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
@@ -574,31 +589,33 @@ 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
)
@@ -616,22 +633,23 @@ 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 4dadd4d1042..ecf7dae9038 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -20,207 +20,219 @@
/// 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).
@@ -232,11 +244,11 @@ 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;
@@ -276,13 +288,14 @@ 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;
@@ -300,11 +313,12 @@ 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.
@@ -324,34 +338,36 @@ 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 }, \
@@ -368,167 +384,177 @@ 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
@@ -538,21 +564,22 @@ 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
@@ -566,21 +593,22 @@ 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:
@@ -594,41 +622,43 @@ 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
@@ -636,21 +666,22 @@ 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
@@ -659,41 +690,43 @@ 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
@@ -705,50 +738,52 @@ 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 14a8b144114..7b1a02cad3e 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -16,15 +16,17 @@
#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.
@@ -33,11 +35,11 @@ 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
@@ -75,20 +77,21 @@ 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
)
@@ -112,22 +115,23 @@ 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
@@ -151,11 +155,12 @@ 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.
@@ -163,11 +168,11 @@ 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 a69d56da6cf..ca33b935760 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -12,45 +12,49 @@
**/
#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.
@@ -59,35 +63,37 @@ 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.
@@ -95,29 +101,30 @@ 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 3bb142538c0..f5602e94291 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -33,12 +33,13 @@ 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},
@@ -46,66 +47,74 @@ 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
@@ -158,18 +167,19 @@ 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
@@ -247,17 +257,18 @@ 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
)
@@ -275,20 +286,20 @@ 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
@@ -404,11 +415,11 @@ 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 03561ea8168..b035395a721 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -12,89 +12,102 @@
**/
#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 0b3f9a79012..c7249d7eef6 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -20,33 +20,35 @@
#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 f70a1328cc9..7f66bce074e 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -30,30 +30,32 @@ 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,
@@ -93,16 +95,17 @@ 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,
@@ -118,16 +121,17 @@ 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,
@@ -191,21 +195,22 @@ 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 ef459a12099..f1935f714c8 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -17,21 +17,22 @@
#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 fdccb2ac3bd..cca25fcce90 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -23,47 +23,72 @@
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},
@@ -121,16 +146,17 @@ 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,
@@ -145,16 +171,17 @@ 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,
@@ -169,16 +196,17 @@ 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,
@@ -193,21 +221,21 @@ 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 ce96604ee6f..30cf3e14f7e 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -27,26 +27,28 @@ 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},
@@ -67,20 +69,22 @@ 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},
@@ -88,12 +92,13 @@ 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,
@@ -103,28 +108,30 @@ 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,
@@ -139,15 +146,16 @@ 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
@@ -194,15 +202,16 @@ 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
@@ -216,11 +225,12 @@ 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
@@ -230,11 +240,11 @@ 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 503a745718d..704dfc407cc 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -21,12 +21,13 @@
#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
@@ -49,46 +50,48 @@ 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 }, \
@@ -96,29 +99,32 @@ 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},
@@ -139,29 +145,32 @@ 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},
@@ -171,79 +180,86 @@ 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,
@@ -254,17 +270,18 @@ 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,
@@ -296,18 +313,19 @@ 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,
@@ -375,18 +393,19 @@ 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,
@@ -406,15 +425,16 @@ 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
@@ -456,18 +476,19 @@ 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,
@@ -502,18 +523,19 @@ 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,
@@ -533,18 +555,19 @@ 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,
@@ -572,13 +595,13 @@ 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
@@ -590,11 +613,11 @@ 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 2ccbb7b80ed..3ac27086a6b 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -22,22 +22,28 @@
// 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},
@@ -57,13 +63,13 @@ 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},
@@ -73,13 +79,13 @@ 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},
@@ -89,61 +95,63 @@ 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,
@@ -156,11 +164,12 @@ 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:
@@ -174,11 +183,11 @@ 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 a21b30dc0d5..29fc28f7fb0 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -20,39 +20,41 @@
#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 c7acdceb947..c33bb1e9234 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -19,40 +19,43 @@
#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},
@@ -62,16 +65,17 @@ 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,
@@ -93,16 +97,17 @@ 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,
@@ -124,11 +129,12 @@ 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
@@ -136,11 +142,11 @@ 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 5f99fd46a03..a028ae541ca 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -22,23 +22,26 @@
// 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
@@ -47,11 +50,11 @@ 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 841a27ffdfa..64340886fe5 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -22,40 +22,43 @@
#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},
@@ -77,16 +80,17 @@ 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,
@@ -104,16 +108,17 @@ 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,
@@ -130,21 +135,22 @@ 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 86da55935c8..fbe943d898a 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -23,77 +23,83 @@
// 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},
@@ -105,12 +111,13 @@ 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},
@@ -120,13 +127,13 @@ 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},
@@ -140,11 +147,11 @@ 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,
@@ -155,15 +162,16 @@ 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
@@ -171,11 +179,12 @@ 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
@@ -187,11 +196,11 @@ 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 a77ccbe0606..69792140035 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -17,21 +17,22 @@
#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 0ed65d2e72c..99521cd67a7 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -27,29 +27,32 @@ 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 7de28691be2..8479bfbc9be 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -47,19 +47,20 @@ 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;
@@ -78,11 +79,11 @@ 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
)
@@ -99,11 +100,11 @@ 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
@@ -150,11 +151,11 @@ 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 59c8e21544d..f547569cf37 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h
@@ -1,6 +1,6 @@
-/**
+/** @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
@@ -19,11 +19,11 @@ 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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch 2/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues
2018-06-05 8:33 [patch 0/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues Dandan Bi
2018-06-05 8:33 ` [patch 1/2] " Dandan Bi
@ 2018-06-05 8:33 ` Dandan Bi
2018-06-05 9:13 ` Alexei Fedorov
1 sibling, 1 reply; 6+ messages in thread
From: Dandan Bi @ 2018-06-05 8:33 UTC (permalink / raw)
To: edk2-devel; +Cc: Sami Mujawar, Evan Lloyd, Jaben Carsey, Ruiyu Ni
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 088575d0144..6d3bc451acd 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
@@ -19,10 +19,19 @@
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 (
@@ -112,14 +121,17 @@ 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++;
}
@@ -164,15 +176,18 @@ 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) {
@@ -275,11 +290,14 @@ 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);
}
@@ -454,17 +472,20 @@ 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 (
@@ -618,15 +639,10 @@ 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,
@@ -656,14 +672,10 @@ 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 ecf7dae9038..cea8857bc08 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
@@ -9,12 +9,12 @@
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.
@@ -789,6 +789,6 @@ 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 7b1a02cad3e..fff5757bf58 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
@@ -43,36 +43,36 @@ 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
@@ -94,23 +94,23 @@ 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.
@@ -135,22 +135,22 @@ 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 ca33b935760..5a6c4df12f3 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
@@ -9,12 +9,12 @@
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
@@ -128,6 +128,6 @@ 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 f5602e94291..47ce93f104b 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
@@ -120,12 +120,15 @@ 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",
@@ -184,24 +187,29 @@ 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,
@@ -221,17 +229,17 @@ 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
@@ -271,13 +279,15 @@ 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 {
@@ -369,16 +379,16 @@ 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 ()) {
@@ -424,27 +434,31 @@ 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);
@@ -545,23 +559,23 @@ 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 b035395a721..4e7ac93ca03 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
@@ -9,12 +9,12 @@
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
@@ -31,15 +31,15 @@
/**
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.
**/
@@ -111,6 +111,6 @@ 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 7f66bce074e..bc8b7b00e38 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
@@ -110,11 +110,14 @@ 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 30cf3e14f7e..3a3cee948ad 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
@@ -136,11 +136,14 @@ 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 704dfc407cc..fb0abe3c43b 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
@@ -25,17 +25,17 @@ 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;
@@ -663,49 +663,49 @@ 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 3ac27086a6b..a704b0c6314 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
@@ -195,11 +195,13 @@ 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 c33bb1e9234..164cd462022 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
@@ -86,11 +86,14 @@ 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
@@ -118,11 +121,14 @@ 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 a028ae541ca..c38666d2b7f 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c
@@ -61,12 +61,12 @@ 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) {
@@ -96,50 +96,50 @@ 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 64340886fe5..815ba9a9db0 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c
@@ -96,11 +96,14 @@ 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",
@@ -124,11 +127,14 @@ 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 fbe943d898a..043277aabf8 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
@@ -175,11 +175,14 @@ 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.
@@ -208,17 +211,23 @@ 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 8479bfbc9be..c2f40009eeb 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
@@ -62,11 +62,14 @@ 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 f547569cf37..4ea958b80e7 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h
@@ -9,12 +9,12 @@
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.
@@ -27,6 +27,6 @@ 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 dbdb7e301b4..6df8c08b855 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
@@ -25,10 +25,13 @@
[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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch 2/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues
2018-06-05 8:33 ` [patch 2/2] " Dandan Bi
@ 2018-06-05 9:13 ` Alexei Fedorov
2018-06-06 2:42 ` Bi, Dandan
0 siblings, 1 reply; 6+ messages in thread
From: Alexei Fedorov @ 2018-06-05 9:13 UTC (permalink / raw)
To: Dandan Bi, edk2-devel@lists.01.org; +Cc: Jaben Carsey, Ruiyu Ni
Hi Dandan Bi,
Your patch contains a number of modifications like the one below:
-#ifndef ACPIPARSER_H_
-#define ACPIPARSER_H_
+#ifndef __ACPIPARSER_H__
+#define __ACPIPARSER_H__
which violate CCS
"3.3.2 Include Files"
"4.3.5.4 The names of guard macros shall end with an underscore character."
and the given examples.
Alexei
________________________________
From: edk2-devel <edk2-devel-bounces@lists.01.org> on behalf of Dandan Bi <dandan.bi@intel.com>
Sent: 05 June 2018 09:33
To: edk2-devel@lists.01.org
Cc: Jaben Carsey; Ruiyu Ni
Subject: [edk2] [patch 2/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues
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 088575d0144..6d3bc451acd 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
@@ -19,10 +19,19 @@
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 (
@@ -112,14 +121,17 @@ 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++;
}
@@ -164,15 +176,18 @@ 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) {
@@ -275,11 +290,14 @@ 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);
}
@@ -454,17 +472,20 @@ 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 (
@@ -618,15 +639,10 @@ 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,
@@ -656,14 +672,10 @@ 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 ecf7dae9038..cea8857bc08 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
@@ -9,12 +9,12 @@
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.
@@ -789,6 +789,6 @@ 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 7b1a02cad3e..fff5757bf58 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
@@ -43,36 +43,36 @@ 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
@@ -94,23 +94,23 @@ 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.
@@ -135,22 +135,22 @@ 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 ca33b935760..5a6c4df12f3 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
@@ -9,12 +9,12 @@
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
@@ -128,6 +128,6 @@ 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 f5602e94291..47ce93f104b 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
@@ -120,12 +120,15 @@ 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",
@@ -184,24 +187,29 @@ 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,
@@ -221,17 +229,17 @@ 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
@@ -271,13 +279,15 @@ 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 {
@@ -369,16 +379,16 @@ 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 ()) {
@@ -424,27 +434,31 @@ 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);
@@ -545,23 +559,23 @@ 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 b035395a721..4e7ac93ca03 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
@@ -9,12 +9,12 @@
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
@@ -31,15 +31,15 @@
/**
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.
**/
@@ -111,6 +111,6 @@ 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 7f66bce074e..bc8b7b00e38 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
@@ -110,11 +110,14 @@ 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 30cf3e14f7e..3a3cee948ad 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
@@ -136,11 +136,14 @@ 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 704dfc407cc..fb0abe3c43b 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
@@ -25,17 +25,17 @@ 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;
@@ -663,49 +663,49 @@ 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 3ac27086a6b..a704b0c6314 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
@@ -195,11 +195,13 @@ 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 c33bb1e9234..164cd462022 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
@@ -86,11 +86,14 @@ 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
@@ -118,11 +121,14 @@ 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 a028ae541ca..c38666d2b7f 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c
@@ -61,12 +61,12 @@ 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) {
@@ -96,50 +96,50 @@ 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 64340886fe5..815ba9a9db0 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c
@@ -96,11 +96,14 @@ 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",
@@ -124,11 +127,14 @@ 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 fbe943d898a..043277aabf8 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
@@ -175,11 +175,14 @@ 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.
@@ -208,17 +211,23 @@ 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 8479bfbc9be..c2f40009eeb 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
@@ -62,11 +62,14 @@ 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 f547569cf37..4ea958b80e7 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h
@@ -9,12 +9,12 @@
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.
@@ -27,6 +27,6 @@ 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 dbdb7e301b4..6df8c08b855 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
@@ -25,10 +25,13 @@
[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
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch 2/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues
2018-06-05 9:13 ` Alexei Fedorov
@ 2018-06-06 2:42 ` Bi, Dandan
2018-06-06 9:36 ` Alexei Fedorov
0 siblings, 1 reply; 6+ messages in thread
From: Bi, Dandan @ 2018-06-06 2:42 UTC (permalink / raw)
To: 'Alexei Fedorov', edk2-devel@lists.01.org
Cc: Carsey, Jaben, Ni, Ruiyu
Hi Alexei,
Current in the Edk2 implementation, the guard macros in the include header files start with underscore and end with underscore. And the number of underscore usually used here is one or two.
And the check tool (ECC) also follow above rule to do the check. So it will report error for the ACPIPARSER_H_
So do you agree to keep the changes in the patch or update it to_ ACPIPARSER_H_ for alignment consideration firstly?
Then there is another topic, we need to make the Check Tool align with CSS, we may enhance the check tool or update the Spec.
Thanks,
Dandan
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Alexei Fedorov
Sent: Tuesday, June 05, 2018 5:13 PM
To: Bi, Dandan <dandan.bi@intel.com>; edk2-devel@lists.01.org
Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>
Subject: Re: [edk2] [patch 2/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues
Hi Dandan Bi,
Your patch contains a number of modifications like the one below:
-#ifndef ACPIPARSER_H_
-#define ACPIPARSER_H_
+#ifndef __ACPIPARSER_H__
+#define __ACPIPARSER_H__
which violate CCS
"3.3.2 Include Files"
"4.3.5.4 The names of guard macros shall end with an underscore character."
and the given examples.
Alexei
________________________________
From: edk2-devel <edk2-devel-bounces@lists.01.org> on behalf of Dandan Bi <dandan.bi@intel.com>
Sent: 05 June 2018 09:33
To: edk2-devel@lists.01.org
Cc: Jaben Carsey; Ruiyu Ni
Subject: [edk2] [patch 2/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues
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 088575d0144..6d3bc451acd 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
@@ -19,10 +19,19 @@
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 (
@@ -112,14 +121,17 @@ 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++;
}
@@ -164,15 +176,18 @@ 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) {
@@ -275,11 +290,14 @@ 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);
}
@@ -454,17 +472,20 @@ 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 (
@@ -618,15 +639,10 @@ 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,
@@ -656,14 +672,10 @@ 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 ecf7dae9038..cea8857bc08 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
@@ -9,12 +9,12 @@
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.
@@ -789,6 +789,6 @@ 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 7b1a02cad3e..fff5757bf58 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
@@ -43,36 +43,36 @@ 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
@@ -94,23 +94,23 @@ 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.
@@ -135,22 +135,22 @@ 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 ca33b935760..5a6c4df12f3 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
@@ -9,12 +9,12 @@
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
@@ -128,6 +128,6 @@ 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 f5602e94291..47ce93f104b 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
@@ -120,12 +120,15 @@ 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",
@@ -184,24 +187,29 @@ 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,
@@ -221,17 +229,17 @@ 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
@@ -271,13 +279,15 @@ 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 {
@@ -369,16 +379,16 @@ 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 ()) {
@@ -424,27 +434,31 @@ 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); @@ -545,23 +559,23 @@ 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 b035395a721..4e7ac93ca03 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
@@ -9,12 +9,12 @@
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
@@ -31,15 +31,15 @@
/**
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.
**/
@@ -111,6 +111,6 @@ 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 7f66bce074e..bc8b7b00e38 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Pars
+++ er.c
@@ -110,11 +110,14 @@ 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 30cf3e14f7e..3a3cee948ad 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtPars
+++ er.c
@@ -136,11 +136,14 @@ 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 704dfc407cc..fb0abe3c43b 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortPars
+++ er.c
@@ -25,17 +25,17 @@ 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;
@@ -663,49 +663,49 @@ 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 3ac27086a6b..a704b0c6314 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
+++ er.c
@@ -195,11 +195,13 @@ 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 c33bb1e9234..164cd462022 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpPars
+++ er.c
@@ -86,11 +86,14 @@ 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
@@ -118,11 +121,14 @@ 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 a028ae541ca..c38666d2b7f 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitPars
+++ er.c
@@ -61,12 +61,12 @@ 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) {
@@ -96,50 +96,50 @@ 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 64340886fe5..815ba9a9db0 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrPars
+++ er.c
@@ -96,11 +96,14 @@ 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", @@ -124,11 +127,14 @@ 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 fbe943d898a..043277aabf8 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratPars
+++ er.c
@@ -175,11 +175,14 @@ 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.
@@ -208,17 +211,23 @@ 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 8479bfbc9be..c2f40009eeb 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
+++ andLib.c
@@ -62,11 +62,14 @@ 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 f547569cf37..4ea958b80e7 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
+++ andLib.h
@@ -9,12 +9,12 @@
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.
@@ -27,6 +27,6 @@ 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 dbdb7e301b4..6df8c08b855 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
+++ andLib.inf
@@ -25,10 +25,13 @@
[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
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch 2/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues
2018-06-06 2:42 ` Bi, Dandan
@ 2018-06-06 9:36 ` Alexei Fedorov
0 siblings, 0 replies; 6+ messages in thread
From: Alexei Fedorov @ 2018-06-06 9:36 UTC (permalink / raw)
To: Bi, Dandan, edk2-devel@lists.01.org; +Cc: Carsey, Jaben, Ni, Ruiyu
Hi Dandan,
The Check Tool should be aligned with CSS, so it should be updated.
Regards.
Alexei
________________________________
From: Bi, Dandan <dandan.bi@intel.com>
Sent: 06 June 2018 03:42:07
To: Alexei Fedorov; edk2-devel@lists.01.org
Cc: Carsey, Jaben; Ni, Ruiyu
Subject: RE: [edk2] [patch 2/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues
Hi Alexei,
Current in the Edk2 implementation, the guard macros in the include header files start with underscore and end with underscore. And the number of underscore usually used here is one or two.
And the check tool (ECC) also follow above rule to do the check. So it will report error for the ACPIPARSER_H_
So do you agree to keep the changes in the patch or update it to_ ACPIPARSER_H_ for alignment consideration firstly?
Then there is another topic, we need to make the Check Tool align with CSS, we may enhance the check tool or update the Spec.
Thanks,
Dandan
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Alexei Fedorov
Sent: Tuesday, June 05, 2018 5:13 PM
To: Bi, Dandan <dandan.bi@intel.com>; edk2-devel@lists.01.org
Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>
Subject: Re: [edk2] [patch 2/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues
Hi Dandan Bi,
Your patch contains a number of modifications like the one below:
-#ifndef ACPIPARSER_H_
-#define ACPIPARSER_H_
+#ifndef __ACPIPARSER_H__
+#define __ACPIPARSER_H__
which violate CCS
"3.3.2 Include Files"
"4.3.5.4 The names of guard macros shall end with an underscore character."
and the given examples.
Alexei
________________________________
From: edk2-devel <edk2-devel-bounces@lists.01.org> on behalf of Dandan Bi <dandan.bi@intel.com>
Sent: 05 June 2018 09:33
To: edk2-devel@lists.01.org
Cc: Jaben Carsey; Ruiyu Ni
Subject: [edk2] [patch 2/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues
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 088575d0144..6d3bc451acd 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c
@@ -19,10 +19,19 @@
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 (
@@ -112,14 +121,17 @@ 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++;
}
@@ -164,15 +176,18 @@ 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) {
@@ -275,11 +290,14 @@ 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);
}
@@ -454,17 +472,20 @@ 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 (
@@ -618,15 +639,10 @@ 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,
@@ -656,14 +672,10 @@ 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 ecf7dae9038..cea8857bc08 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
@@ -9,12 +9,12 @@
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.
@@ -789,6 +789,6 @@ 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 7b1a02cad3e..fff5757bf58 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c
@@ -43,36 +43,36 @@ 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
@@ -94,23 +94,23 @@ 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.
@@ -135,22 +135,22 @@ 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 ca33b935760..5a6c4df12f3 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h
@@ -9,12 +9,12 @@
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
@@ -128,6 +128,6 @@ 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 f5602e94291..47ce93f104b 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c
@@ -120,12 +120,15 @@ 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",
@@ -184,24 +187,29 @@ 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,
@@ -221,17 +229,17 @@ 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
@@ -271,13 +279,15 @@ 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 {
@@ -369,16 +379,16 @@ 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 ()) {
@@ -424,27 +434,31 @@ 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); @@ -545,23 +559,23 @@ 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 b035395a721..4e7ac93ca03 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h
@@ -9,12 +9,12 @@
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
@@ -31,15 +31,15 @@
/**
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.
**/
@@ -111,6 +111,6 @@ 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 7f66bce074e..bc8b7b00e38 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Pars
+++ er.c
@@ -110,11 +110,14 @@ 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 30cf3e14f7e..3a3cee948ad 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtPars
+++ er.c
@@ -136,11 +136,14 @@ 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 704dfc407cc..fb0abe3c43b 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortPars
+++ er.c
@@ -25,17 +25,17 @@ 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;
@@ -663,49 +663,49 @@ 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 3ac27086a6b..a704b0c6314 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPars
+++ er.c
@@ -195,11 +195,13 @@ 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 c33bb1e9234..164cd462022 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpPars
+++ er.c
@@ -86,11 +86,14 @@ 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
@@ -118,11 +121,14 @@ 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 a028ae541ca..c38666d2b7f 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitPars
+++ er.c
@@ -61,12 +61,12 @@ 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) {
@@ -96,50 +96,50 @@ 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 64340886fe5..815ba9a9db0 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrPars
+++ er.c
@@ -96,11 +96,14 @@ 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", @@ -124,11 +127,14 @@ 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 fbe943d898a..043277aabf8 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratPars
+++ er.c
@@ -175,11 +175,14 @@ 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.
@@ -208,17 +211,23 @@ 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 8479bfbc9be..c2f40009eeb 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
+++ andLib.c
@@ -62,11 +62,14 @@ 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 f547569cf37..4ea958b80e7 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
+++ andLib.h
@@ -9,12 +9,12 @@
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.
@@ -27,6 +27,6 @@ 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 dbdb7e301b4..6df8c08b855 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
+++ andLib.inf
@@ -25,10 +25,13 @@
[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
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-06-06 9:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-05 8:33 [patch 0/2] ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues Dandan Bi
2018-06-05 8:33 ` [patch 1/2] " Dandan Bi
2018-06-05 8:33 ` [patch 2/2] " Dandan Bi
2018-06-05 9:13 ` Alexei Fedorov
2018-06-06 2:42 ` Bi, Dandan
2018-06-06 9:36 ` Alexei Fedorov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox