diff options
author | Dandan Bi <dandan.bi@intel.com> | 2018-06-05 09:20:05 +0800 |
---|---|---|
committer | Eric Dong <eric.dong@intel.com> | 2018-06-11 16:10:22 +0800 |
commit | f75c7478280b96d191e86856c0b1c49ff711c284 (patch) | |
tree | b2f9c063d386e3006f5db0a272b6fc990c1d1344 /ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | |
parent | a6eaba4d7f23262ab8e8502b476bdf5249a54ad4 (diff) | |
download | edk2-f75c7478280b96d191e86856c0b1c49ff711c284.tar.gz edk2-f75c7478280b96d191e86856c0b1c49ff711c284.tar.bz2 edk2-f75c7478280b96d191e86856c0b1c49ff711c284.zip |
ShellPkg/UefiShellAcpiViewCommandLib: Fix ECC issues
1. Separate variable definition and initialization.
2. Make the variable naming following Edk2 rule.
V2: Remove the updates of guard macros in header files.
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Evan Lloyd <evan.lloyd@arm.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Diffstat (limited to 'ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c')
-rw-r--r-- | ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index 088575d014..6d3bc451ac 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -21,6 +21,15 @@ 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.
**/
@@ -114,10 +123,13 @@ VerifyChecksum ( 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++;
@@ -166,11 +178,14 @@ DumpRaw ( 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);
@@ -277,7 +292,10 @@ 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;
@@ -456,13 +474,16 @@ ParseAcpi ( )
{
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) {
@@ -620,11 +641,6 @@ DumpAcpiHeader ( IN UINT8* Ptr
)
{
- ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
- ACPI_PARSER AcpiHeaderParser[] = {
- PARSE_ACPI_HEADER (&AcpiHdrInfo)
- };
-
return ParseAcpi (
TRUE,
0,
@@ -658,10 +674,6 @@ ParseAcpiHeader ( )
{
UINT32 BytesParsed;
- ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
- ACPI_PARSER AcpiHeaderParser[] = {
- PARSE_ACPI_HEADER (&AcpiHdrInfo)
- };
BytesParsed = ParseAcpi (
FALSE,
|