mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 16:14:04 +02:00
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>
This commit is contained in:
parent
a6eaba4d7f
commit
f75c747828
@ -21,6 +21,15 @@ STATIC UINT32 gIndent;
|
|||||||
STATIC UINT32 mTableErrorCount;
|
STATIC UINT32 mTableErrorCount;
|
||||||
STATIC UINT32 mTableWarningCount;
|
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.
|
This function resets the ACPI table error counter to Zero.
|
||||||
**/
|
**/
|
||||||
@ -114,10 +123,13 @@ VerifyChecksum (
|
|||||||
IN UINT32 Length
|
IN UINT32 Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN ByteCount = 0;
|
UINTN ByteCount;
|
||||||
UINT8 Checksum = 0;
|
UINT8 Checksum;
|
||||||
UINTN OriginalAttribute;
|
UINTN OriginalAttribute;
|
||||||
|
|
||||||
|
ByteCount = 0;
|
||||||
|
Checksum = 0;
|
||||||
|
|
||||||
while (ByteCount < Length) {
|
while (ByteCount < Length) {
|
||||||
Checksum += *(Ptr++);
|
Checksum += *(Ptr++);
|
||||||
ByteCount++;
|
ByteCount++;
|
||||||
@ -166,11 +178,14 @@ DumpRaw (
|
|||||||
IN UINT32 Length
|
IN UINT32 Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN ByteCount = 0;
|
UINTN ByteCount;
|
||||||
UINTN PartLineChars;
|
UINTN PartLineChars;
|
||||||
UINTN AsciiBufferIndex = 0;
|
UINTN AsciiBufferIndex;
|
||||||
CHAR8 AsciiBuffer[17];
|
CHAR8 AsciiBuffer[17];
|
||||||
|
|
||||||
|
ByteCount = 0;
|
||||||
|
AsciiBufferIndex = 0;
|
||||||
|
|
||||||
Print (L"Address : 0x%p\n", Ptr);
|
Print (L"Address : 0x%p\n", Ptr);
|
||||||
Print (L"Length : %d\n", Length);
|
Print (L"Length : %d\n", Length);
|
||||||
|
|
||||||
@ -277,7 +292,10 @@ DumpUint64 (
|
|||||||
// Some fields are not aligned and this causes alignment faults
|
// Some fields are not aligned and this causes alignment faults
|
||||||
// on ARM platforms if the compiler generates LDRD instructions.
|
// on ARM platforms if the compiler generates LDRD instructions.
|
||||||
// Perform word access so that LDRD instructions are not generated.
|
// 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 <<= 32;
|
||||||
Val |= *(UINT32*)Ptr;
|
Val |= *(UINT32*)Ptr;
|
||||||
|
|
||||||
@ -456,13 +474,16 @@ ParseAcpi (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 Index;
|
UINT32 Index;
|
||||||
UINT32 Offset = 0;
|
UINT32 Offset;
|
||||||
|
BOOLEAN HighLight;
|
||||||
|
|
||||||
|
Offset = 0;
|
||||||
|
|
||||||
// Increment the Indent
|
// Increment the Indent
|
||||||
gIndent += Indent;
|
gIndent += Indent;
|
||||||
|
|
||||||
if (Trace && (AsciiName != NULL)){
|
if (Trace && (AsciiName != NULL)){
|
||||||
BOOLEAN HighLight = GetColourHighlighting ();
|
HighLight = GetColourHighlighting ();
|
||||||
UINTN OriginalAttribute;
|
UINTN OriginalAttribute;
|
||||||
|
|
||||||
if (HighLight) {
|
if (HighLight) {
|
||||||
@ -620,11 +641,6 @@ DumpAcpiHeader (
|
|||||||
IN UINT8* Ptr
|
IN UINT8* Ptr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
|
||||||
ACPI_PARSER AcpiHeaderParser[] = {
|
|
||||||
PARSE_ACPI_HEADER (&AcpiHdrInfo)
|
|
||||||
};
|
|
||||||
|
|
||||||
return ParseAcpi (
|
return ParseAcpi (
|
||||||
TRUE,
|
TRUE,
|
||||||
0,
|
0,
|
||||||
@ -658,10 +674,6 @@ ParseAcpiHeader (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 BytesParsed;
|
UINT32 BytesParsed;
|
||||||
ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
|
|
||||||
ACPI_PARSER AcpiHeaderParser[] = {
|
|
||||||
PARSE_ACPI_HEADER (&AcpiHdrInfo)
|
|
||||||
};
|
|
||||||
|
|
||||||
BytesParsed = ParseAcpi (
|
BytesParsed = ParseAcpi (
|
||||||
FALSE,
|
FALSE,
|
||||||
|
@ -45,32 +45,32 @@ RegisterParser (
|
|||||||
IN PARSE_ACPI_TABLE_PROC ParserProc
|
IN PARSE_ACPI_TABLE_PROC ParserProc
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 index;
|
UINT32 Index;
|
||||||
|
|
||||||
if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) {
|
if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search if a parser is already installed
|
// Search if a parser is already installed
|
||||||
for (index = 0;
|
for (Index = 0;
|
||||||
index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
|
Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
|
||||||
index++)
|
Index++)
|
||||||
{
|
{
|
||||||
if (Signature == mTableParserList[index].Signature) {
|
if (Signature == mTableParserList[Index].Signature) {
|
||||||
if (mTableParserList[index].Parser != NULL) {
|
if (mTableParserList[Index].Parser != NULL) {
|
||||||
return EFI_ALREADY_STARTED;
|
return EFI_ALREADY_STARTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the first free slot and register the parser
|
// Find the first free slot and register the parser
|
||||||
for (index = 0;
|
for (Index = 0;
|
||||||
index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
|
Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
|
||||||
index++)
|
Index++)
|
||||||
{
|
{
|
||||||
if (mTableParserList[index].Signature == ACPI_PARSER_SIGNATURE_NULL) {
|
if (mTableParserList[Index].Signature == ACPI_PARSER_SIGNATURE_NULL) {
|
||||||
mTableParserList[index].Signature = Signature;
|
mTableParserList[Index].Signature = Signature;
|
||||||
mTableParserList[index].Parser = ParserProc;
|
mTableParserList[Index].Parser = ParserProc;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,19 +96,19 @@ DeregisterParser (
|
|||||||
IN UINT32 Signature
|
IN UINT32 Signature
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 index;
|
UINT32 Index;
|
||||||
|
|
||||||
if (Signature == ACPI_PARSER_SIGNATURE_NULL) {
|
if (Signature == ACPI_PARSER_SIGNATURE_NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (index = 0;
|
for (Index = 0;
|
||||||
index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
|
Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
|
||||||
index++)
|
Index++)
|
||||||
{
|
{
|
||||||
if (Signature == mTableParserList[index].Signature) {
|
if (Signature == mTableParserList[Index].Signature) {
|
||||||
mTableParserList[index].Signature = ACPI_PARSER_SIGNATURE_NULL;
|
mTableParserList[Index].Signature = ACPI_PARSER_SIGNATURE_NULL;
|
||||||
mTableParserList[index].Parser = NULL;
|
mTableParserList[Index].Parser = NULL;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,18 +137,18 @@ GetParser (
|
|||||||
OUT PARSE_ACPI_TABLE_PROC * ParserProc
|
OUT PARSE_ACPI_TABLE_PROC * ParserProc
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 index;
|
UINT32 Index;
|
||||||
|
|
||||||
if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) {
|
if ((ParserProc == NULL) || (Signature == ACPI_PARSER_SIGNATURE_NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (index = 0;
|
for (Index = 0;
|
||||||
index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
|
Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
|
||||||
index++)
|
Index++)
|
||||||
{
|
{
|
||||||
if (Signature == mTableParserList[index].Signature) {
|
if (Signature == mTableParserList[Index].Signature) {
|
||||||
*ParserProc = mTableParserList[index].Parser;
|
*ParserProc = mTableParserList[Index].Parser;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,8 +122,11 @@ DumpAcpiTableToFile (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
|
CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
|
||||||
SHELL_FILE_HANDLE DumpFileHandle = NULL;
|
SHELL_FILE_HANDLE DumpFileHandle;
|
||||||
UINTN TransferBytes = Length;
|
UINTN TransferBytes;
|
||||||
|
|
||||||
|
DumpFileHandle = NULL;
|
||||||
|
TransferBytes = Length;
|
||||||
|
|
||||||
UnicodeSPrint (
|
UnicodeSPrint (
|
||||||
FileNameBuffer,
|
FileNameBuffer,
|
||||||
@ -186,20 +189,25 @@ ProcessTableReportOptions (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN OriginalAttribute;
|
UINTN OriginalAttribute;
|
||||||
UINT8* SignaturePtr = (UINT8*)(UINTN)&Signature;
|
UINT8* SignaturePtr;
|
||||||
BOOLEAN Log = FALSE;
|
BOOLEAN Log;
|
||||||
BOOLEAN HighLight = GetColourHighlighting ();
|
BOOLEAN HighLight;
|
||||||
|
|
||||||
|
SignaturePtr = (UINT8*)(UINTN)&Signature;
|
||||||
|
Log = FALSE;
|
||||||
|
HighLight = GetColourHighlighting ();
|
||||||
|
|
||||||
switch (GetReportOption ()) {
|
switch (GetReportOption ()) {
|
||||||
case EREPORT_ALL:
|
case ReportAll:
|
||||||
Log = TRUE;
|
Log = TRUE;
|
||||||
break;
|
break;
|
||||||
case EREPORT_SELECTED:
|
case ReportSelected:
|
||||||
if (Signature == GetSelectedAcpiTable ()) {
|
if (Signature == GetSelectedAcpiTable ()) {
|
||||||
Log = TRUE;
|
Log = TRUE;
|
||||||
mSelectedAcpiTableFound = TRUE;
|
mSelectedAcpiTableFound = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EREPORT_TABLE_LIST:
|
case ReportTableList:
|
||||||
if (mTableCount == 0) {
|
if (mTableCount == 0) {
|
||||||
if (HighLight) {
|
if (HighLight) {
|
||||||
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
||||||
@ -223,13 +231,13 @@ ProcessTableReportOptions (
|
|||||||
SignaturePtr[3]
|
SignaturePtr[3]
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case EREPORT_DUMP_BIN_FILE:
|
case ReportDumpBinFile:
|
||||||
if (Signature == GetSelectedAcpiTable ()) {
|
if (Signature == GetSelectedAcpiTable ()) {
|
||||||
mSelectedAcpiTableFound = TRUE;
|
mSelectedAcpiTableFound = TRUE;
|
||||||
DumpAcpiTableToFile (TablePtr, Length);
|
DumpAcpiTableToFile (TablePtr, Length);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EREPORT_MAX:
|
case ReportMax:
|
||||||
// We should never be here.
|
// We should never be here.
|
||||||
// This case is only present to prevent compiler warning.
|
// This case is only present to prevent compiler warning.
|
||||||
break;
|
break;
|
||||||
@ -273,9 +281,11 @@ ConvertStrToAcpiSignature (
|
|||||||
IN CONST CHAR16* Str
|
IN CONST CHAR16* Str
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT8 Index = 0;
|
UINT8 Index;
|
||||||
CHAR8 Ptr[4];
|
CHAR8 Ptr[4];
|
||||||
|
|
||||||
|
Index = 0;
|
||||||
|
|
||||||
// Convert to Upper case and convert to ASCII
|
// Convert to Upper case and convert to ASCII
|
||||||
while ((Index < 4) && (Str[Index] != 0)) {
|
while ((Index < 4) && (Str[Index] != 0)) {
|
||||||
if (Str[Index] >= L'a' && Str[Index] <= L'z') {
|
if (Str[Index] >= L'a' && Str[Index] <= L'z') {
|
||||||
@ -371,12 +381,12 @@ AcpiView (
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReportOption = GetReportOption ();
|
ReportOption = GetReportOption ();
|
||||||
if (EREPORT_TABLE_LIST != ReportOption) {
|
if (ReportTableList != ReportOption) {
|
||||||
if (((EREPORT_SELECTED == ReportOption) ||
|
if (((ReportSelected == ReportOption) ||
|
||||||
(EREPORT_DUMP_BIN_FILE == ReportOption)) &&
|
(ReportDumpBinFile == ReportOption)) &&
|
||||||
(!mSelectedAcpiTableFound)) {
|
(!mSelectedAcpiTableFound)) {
|
||||||
Print (L"\nRequested ACPI Table not found.\n");
|
Print (L"\nRequested ACPI Table not found.\n");
|
||||||
} else if (EREPORT_DUMP_BIN_FILE != ReportOption) {
|
} else if (ReportDumpBinFile != ReportOption) {
|
||||||
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
OriginalAttribute = gST->ConOut->Mode->Attribute;
|
||||||
|
|
||||||
Print (L"\nTable Statistics:\n");
|
Print (L"\nTable Statistics:\n");
|
||||||
@ -426,15 +436,15 @@ ShellCommandRunAcpiView (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
SHELL_STATUS ShellStatus = SHELL_SUCCESS;
|
SHELL_STATUS ShellStatus;
|
||||||
LIST_ENTRY* Package = NULL;
|
LIST_ENTRY* Package;
|
||||||
CHAR16* ProblemParam;
|
CHAR16* ProblemParam;
|
||||||
CONST CHAR16* Temp;
|
CONST CHAR16* Temp;
|
||||||
CHAR8 ColourOption[8];
|
CHAR8 ColourOption[8];
|
||||||
SHELL_FILE_HANDLE TmpDumpFileHandle = NULL;
|
SHELL_FILE_HANDLE TmpDumpFileHandle;
|
||||||
|
|
||||||
// Set Defaults
|
// Set Defaults
|
||||||
mReportType = EREPORT_ALL;
|
mReportType = ReportAll;
|
||||||
mTableCount = 0;
|
mTableCount = 0;
|
||||||
mBinTableCount = 0;
|
mBinTableCount = 0;
|
||||||
mSelectedAcpiTable = 0;
|
mSelectedAcpiTable = 0;
|
||||||
@ -443,6 +453,10 @@ ShellCommandRunAcpiView (
|
|||||||
mVerbose = TRUE;
|
mVerbose = TRUE;
|
||||||
mConsistencyCheck = TRUE;
|
mConsistencyCheck = TRUE;
|
||||||
|
|
||||||
|
ShellStatus = SHELL_SUCCESS;
|
||||||
|
Package = NULL;
|
||||||
|
TmpDumpFileHandle = NULL;
|
||||||
|
|
||||||
// Reset The error/warning counters
|
// Reset The error/warning counters
|
||||||
ResetErrorCount ();
|
ResetErrorCount ();
|
||||||
ResetWarningCount ();
|
ResetWarningCount ();
|
||||||
@ -547,19 +561,19 @@ ShellCommandRunAcpiView (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ShellCommandLineGetFlag (Package, L"-l")) {
|
if (ShellCommandLineGetFlag (Package, L"-l")) {
|
||||||
mReportType = EREPORT_TABLE_LIST;
|
mReportType = ReportTableList;
|
||||||
} else {
|
} else {
|
||||||
mSelectedAcpiTableName = ShellCommandLineGetValue (Package, L"-s");
|
mSelectedAcpiTableName = ShellCommandLineGetValue (Package, L"-s");
|
||||||
if (mSelectedAcpiTableName != NULL) {
|
if (mSelectedAcpiTableName != NULL) {
|
||||||
mSelectedAcpiTable = (UINT32)ConvertStrToAcpiSignature (
|
mSelectedAcpiTable = (UINT32)ConvertStrToAcpiSignature (
|
||||||
mSelectedAcpiTableName
|
mSelectedAcpiTableName
|
||||||
);
|
);
|
||||||
mReportType = EREPORT_SELECTED;
|
mReportType = ReportSelected;
|
||||||
|
|
||||||
if (ShellCommandLineGetFlag (Package, L"-d")) {
|
if (ShellCommandLineGetFlag (Package, L"-d")) {
|
||||||
// Create a temporary file to check if the media is writable.
|
// Create a temporary file to check if the media is writable.
|
||||||
CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
|
CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
|
||||||
mReportType = EREPORT_DUMP_BIN_FILE;
|
mReportType = ReportDumpBinFile;
|
||||||
|
|
||||||
UnicodeSPrint (
|
UnicodeSPrint (
|
||||||
FileNameBuffer,
|
FileNameBuffer,
|
||||||
|
@ -33,11 +33,11 @@
|
|||||||
The EREPORT_OPTION enum describes ACPI table Reporting options.
|
The EREPORT_OPTION enum describes ACPI table Reporting options.
|
||||||
**/
|
**/
|
||||||
typedef enum ReportOption {
|
typedef enum ReportOption {
|
||||||
EREPORT_ALL, ///< Report All tables.
|
ReportAll, ///< Report All tables.
|
||||||
EREPORT_SELECTED, ///< Report Selected table.
|
ReportSelected, ///< Report Selected table.
|
||||||
EREPORT_TABLE_LIST, ///< Report List of tables.
|
ReportTableList, ///< Report List of tables.
|
||||||
EREPORT_DUMP_BIN_FILE, ///< Dump selected table to a file.
|
ReportDumpBinFile, ///< Dump selected table to a file.
|
||||||
EREPORT_MAX
|
ReportMax,
|
||||||
} EREPORT_OPTION;
|
} EREPORT_OPTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,7 +112,10 @@ ValidateNameSpaceStrLen (
|
|||||||
IN VOID* Context
|
IN VOID* Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT16 NameSpaceStrLen = *(UINT16*)Ptr;
|
UINT16 NameSpaceStrLen;
|
||||||
|
|
||||||
|
NameSpaceStrLen = *(UINT16*)Ptr;
|
||||||
|
|
||||||
if (NameSpaceStrLen < 2) {
|
if (NameSpaceStrLen < 2) {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
|
@ -138,7 +138,10 @@ ValidateGtBlockTimerCount (
|
|||||||
IN VOID* Context
|
IN VOID* Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 BlockTimerCount = *(UINT32*)Ptr;
|
UINT32 BlockTimerCount;
|
||||||
|
|
||||||
|
BlockTimerCount = *(UINT32*)Ptr;
|
||||||
|
|
||||||
if (BlockTimerCount > 8) {
|
if (BlockTimerCount > 8) {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
|
@ -27,13 +27,13 @@ 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 {
|
typedef enum IortNode {
|
||||||
EIORT_NODE_ITS_GROUP, ///< ITS Group node
|
Iort_Node_ITS_Group, ///< ITS Group node
|
||||||
EIORT_NODE_NAMED_COMPONENT, ///< Named Component node
|
Iort_Node_Named_Component, ///< Named Component node
|
||||||
EIORT_NODE_ROOT_COMPLEX, ///< Root Complex node
|
Iort_Node_Root_Complex, ///< Root Complex node
|
||||||
EIORT_NODE_SMMUV1_V2, ///< SMMU v1/v2 node
|
Iort_Node_SMMUV1_V2, ///< SMMU v1/v2 node
|
||||||
EIORT_NODE_SMMUV3, ///< SMMU v3 node
|
Iort_Node_SMMUV3, ///< SMMU v3 node
|
||||||
EIORT_NODE_PMCG, ///< PMC group node
|
Iort_Node_PMCG, ///< PMC group node
|
||||||
EIORT_NODE_MAX
|
Iort_Node_Max
|
||||||
} EIORT_NODE;
|
} EIORT_NODE;
|
||||||
|
|
||||||
// Local Variables
|
// Local Variables
|
||||||
@ -665,13 +665,13 @@ ParseAcpiIort (
|
|||||||
Print (L"0x%x\n", Offset);
|
Print (L"0x%x\n", Offset);
|
||||||
|
|
||||||
switch (*IortNodeType) {
|
switch (*IortNodeType) {
|
||||||
case EIORT_NODE_ITS_GROUP:
|
case Iort_Node_ITS_Group:
|
||||||
DumpIortNodeIts (
|
DumpIortNodeIts (
|
||||||
NodePtr,
|
NodePtr,
|
||||||
*IortNodeLength
|
*IortNodeLength
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case EIORT_NODE_NAMED_COMPONENT:
|
case Iort_Node_Named_Component:
|
||||||
DumpIortNodeNamedComponent (
|
DumpIortNodeNamedComponent (
|
||||||
NodePtr,
|
NodePtr,
|
||||||
*IortNodeLength,
|
*IortNodeLength,
|
||||||
@ -679,7 +679,7 @@ ParseAcpiIort (
|
|||||||
*IortIdMappingOffset
|
*IortIdMappingOffset
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case EIORT_NODE_ROOT_COMPLEX:
|
case Iort_Node_Root_Complex:
|
||||||
DumpIortNodeRootComplex (
|
DumpIortNodeRootComplex (
|
||||||
NodePtr,
|
NodePtr,
|
||||||
*IortNodeLength,
|
*IortNodeLength,
|
||||||
@ -687,7 +687,7 @@ ParseAcpiIort (
|
|||||||
*IortIdMappingOffset
|
*IortIdMappingOffset
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case EIORT_NODE_SMMUV1_V2:
|
case Iort_Node_SMMUV1_V2:
|
||||||
DumpIortNodeSmmuV1V2 (
|
DumpIortNodeSmmuV1V2 (
|
||||||
NodePtr,
|
NodePtr,
|
||||||
*IortNodeLength,
|
*IortNodeLength,
|
||||||
@ -695,7 +695,7 @@ ParseAcpiIort (
|
|||||||
*IortIdMappingOffset
|
*IortIdMappingOffset
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case EIORT_NODE_SMMUV3:
|
case Iort_Node_SMMUV3:
|
||||||
DumpIortNodeSmmuV3 (
|
DumpIortNodeSmmuV3 (
|
||||||
NodePtr,
|
NodePtr,
|
||||||
*IortNodeLength,
|
*IortNodeLength,
|
||||||
@ -703,7 +703,7 @@ ParseAcpiIort (
|
|||||||
*IortIdMappingOffset
|
*IortIdMappingOffset
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case EIORT_NODE_PMCG:
|
case Iort_Node_PMCG:
|
||||||
DumpIortNodePmcg (
|
DumpIortNodePmcg (
|
||||||
NodePtr,
|
NodePtr,
|
||||||
*IortNodeLength,
|
*IortNodeLength,
|
||||||
|
@ -197,7 +197,9 @@ ParseAcpiMadt (
|
|||||||
{
|
{
|
||||||
UINT32 Offset;
|
UINT32 Offset;
|
||||||
UINT8* InterruptContollerPtr;
|
UINT8* InterruptContollerPtr;
|
||||||
UINT32 GICDCount = 0;
|
UINT32 GICDCount;
|
||||||
|
|
||||||
|
GICDCount = 0;
|
||||||
|
|
||||||
if (!Trace) {
|
if (!Trace) {
|
||||||
return;
|
return;
|
||||||
|
@ -88,7 +88,10 @@ ValidateRsdtAddress (
|
|||||||
// Root System Description Pointer (RSDP), ACPI ? 5.2.5.
|
// Root System Description Pointer (RSDP), ACPI ? 5.2.5.
|
||||||
// - Within the RSDP, the RsdtAddress field must be null (zero) and the
|
// - Within the RSDP, the RsdtAddress field must be null (zero) and the
|
||||||
// XsdtAddresss MUST be a valid, non-null, 64-bit value.
|
// XsdtAddresss MUST be a valid, non-null, 64-bit value.
|
||||||
UINT32 RsdtAddr = *(UINT32*)Ptr;
|
UINT32 RsdtAddr;
|
||||||
|
|
||||||
|
RsdtAddr = *(UINT32*)Ptr;
|
||||||
|
|
||||||
if (RsdtAddr != 0) {
|
if (RsdtAddr != 0) {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
@ -120,7 +123,10 @@ ValidateXsdtAddress (
|
|||||||
// Root System Description Pointer (RSDP), ACPI ? 5.2.5.
|
// Root System Description Pointer (RSDP), ACPI ? 5.2.5.
|
||||||
// - Within the RSDP, the RsdtAddress field must be null (zero) and the
|
// - Within the RSDP, the RsdtAddress field must be null (zero) and the
|
||||||
// XsdtAddresss MUST be a valid, non-null, 64-bit value.
|
// XsdtAddresss MUST be a valid, non-null, 64-bit value.
|
||||||
UINT64 XsdtAddr = *(UINT64*)Ptr;
|
UINT64 XsdtAddr;
|
||||||
|
|
||||||
|
XsdtAddr = *(UINT64*)Ptr;
|
||||||
|
|
||||||
if (XsdtAddr == 0) {
|
if (XsdtAddr == 0) {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
|
@ -63,8 +63,8 @@ ParseAcpiSlit (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 Offset;
|
UINT32 Offset;
|
||||||
UINT64 i;
|
UINT64 Count;
|
||||||
UINT64 j;
|
UINT64 Index;
|
||||||
UINT64 LocalityCount;
|
UINT64 LocalityCount;
|
||||||
UINT8* LocalityPtr;
|
UINT8* LocalityPtr;
|
||||||
CHAR16 Buffer[80]; // Used for AsciiName param of ParseAcpi
|
CHAR16 Buffer[80]; // Used for AsciiName param of ParseAcpi
|
||||||
@ -98,46 +98,46 @@ ParseAcpiSlit (
|
|||||||
PrintFieldName (0, Buffer);
|
PrintFieldName (0, Buffer);
|
||||||
Print (L"\n");
|
Print (L"\n");
|
||||||
Print (L" ");
|
Print (L" ");
|
||||||
for (j = 0; j < LocalityCount; j++) {
|
for (Index = 0; Index < LocalityCount; Index++) {
|
||||||
Print (L" (%3d) ", j);
|
Print (L" (%3d) ", Index);
|
||||||
}
|
}
|
||||||
Print (L"\n");
|
Print (L"\n");
|
||||||
for (i = 0; i < LocalityCount; i++) {
|
for (Count = 0; Count< LocalityCount; Count++) {
|
||||||
Print (L" (%3d) ", i);
|
Print (L" (%3d) ", Count);
|
||||||
for (j = 0; j < LocalityCount; j++) {
|
for (Index = 0; Index < LocalityCount; Index++) {
|
||||||
Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, i, j));
|
Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, Count, Index));
|
||||||
}
|
}
|
||||||
Print (L"\n");
|
Print (L"\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
for (i = 0; i < LocalityCount; i++) {
|
for (Count = 0; Count < LocalityCount; Count++) {
|
||||||
for (j = 0; j < LocalityCount; j++) {
|
for (Index = 0; Index < LocalityCount; Index++) {
|
||||||
// Element[x][x] must be equal to 10
|
// 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 ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Diagonal Element[0x%lx][0x%lx] (%3d)."
|
L"ERROR: Diagonal Element[0x%lx][0x%lx] (%3d)."
|
||||||
" Normalized Value is not 10\n",
|
" Normalized Value is not 10\n",
|
||||||
i,
|
Count,
|
||||||
j,
|
Index,
|
||||||
SLIT_ELEMENT (LocalityPtr, i, j)
|
SLIT_ELEMENT (LocalityPtr, Count, Index)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Element[i][j] must be equal to Element[j][i]
|
// Element[i][j] must be equal to Element[j][i]
|
||||||
if (SLIT_ELEMENT (LocalityPtr, i, j) !=
|
if (SLIT_ELEMENT (LocalityPtr, Count, Index) !=
|
||||||
SLIT_ELEMENT (LocalityPtr, j, i)) {
|
SLIT_ELEMENT (LocalityPtr, Index, Count)) {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
L"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and \n"
|
L"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and \n"
|
||||||
"Element[0x%lx][0x%lx] (%3d) do not match.\n",
|
"Element[0x%lx][0x%lx] (%3d) do not match.\n",
|
||||||
i,
|
Count,
|
||||||
j,
|
Index,
|
||||||
SLIT_ELEMENT (LocalityPtr, i, j),
|
SLIT_ELEMENT (LocalityPtr, Count, Index),
|
||||||
j,
|
Index,
|
||||||
i,
|
Count,
|
||||||
SLIT_ELEMENT (LocalityPtr, j, i)
|
SLIT_ELEMENT (LocalityPtr, Index, Count)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,10 @@ ValidateInterruptType (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||||
UINT8 InterruptType = *Ptr;
|
UINT8 InterruptType;
|
||||||
|
|
||||||
|
InterruptType = *Ptr;
|
||||||
|
|
||||||
if (InterruptType !=
|
if (InterruptType !=
|
||||||
EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC) {
|
EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC) {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
@ -126,7 +129,10 @@ ValidateIrq (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
|
||||||
UINT8 Irq = *Ptr;
|
UINT8 Irq;
|
||||||
|
|
||||||
|
Irq = *Ptr;
|
||||||
|
|
||||||
if (Irq != 0) {
|
if (Irq != 0) {
|
||||||
IncrementErrorCount ();
|
IncrementErrorCount ();
|
||||||
Print (
|
Print (
|
||||||
|
@ -177,7 +177,10 @@ DumpSratApicProximity (
|
|||||||
IN UINT8* Ptr
|
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);
|
Print (Format, ProximityDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,13 +213,19 @@ ParseAcpiSrat (
|
|||||||
{
|
{
|
||||||
UINT32 Offset;
|
UINT32 Offset;
|
||||||
UINT8* ResourcePtr;
|
UINT8* ResourcePtr;
|
||||||
UINT32 GicCAffinityIndex = 0;
|
UINT32 GicCAffinityIndex;
|
||||||
UINT32 GicITSAffinityIndex = 0;
|
UINT32 GicITSAffinityIndex;
|
||||||
UINT32 MemoryAffinityIndex = 0;
|
UINT32 MemoryAffinityIndex;
|
||||||
UINT32 ApicSapicAffinityIndex = 0;
|
UINT32 ApicSapicAffinityIndex;
|
||||||
UINT32 X2ApicAffinityIndex = 0;
|
UINT32 X2ApicAffinityIndex;
|
||||||
CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi
|
CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi
|
||||||
|
|
||||||
|
GicCAffinityIndex = 0;
|
||||||
|
GicITSAffinityIndex = 0;
|
||||||
|
MemoryAffinityIndex = 0;
|
||||||
|
ApicSapicAffinityIndex = 0;
|
||||||
|
X2ApicAffinityIndex = 0;
|
||||||
|
|
||||||
if (!Trace) {
|
if (!Trace) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,10 @@ RegisterAllParsers (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN Count = sizeof (ParserList) / sizeof (ParserList[0]);
|
UINTN Count;
|
||||||
|
|
||||||
|
Count = sizeof (ParserList) / sizeof (ParserList[0]);
|
||||||
|
|
||||||
while (Count-- != 0) {
|
while (Count-- != 0) {
|
||||||
Status = RegisterParser (
|
Status = RegisterParser (
|
||||||
ParserList[Count].Signature,
|
ParserList[Count].Signature,
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
UefiShellAcpiViewCommandLib.uni
|
UefiShellAcpiViewCommandLib.uni
|
||||||
UefiShellAcpiViewCommandLib.c
|
UefiShellAcpiViewCommandLib.c
|
||||||
UefiShellAcpiViewCommandLib.h
|
UefiShellAcpiViewCommandLib.h
|
||||||
|
AcpiParser.h
|
||||||
|
AcpiTableParser.h
|
||||||
|
AcpiView.h
|
||||||
AcpiParser.c
|
AcpiParser.c
|
||||||
AcpiTableParser.c
|
AcpiTableParser.c
|
||||||
AcpiView.c
|
AcpiView.c
|
||||||
|
Loading…
x
Reference in New Issue
Block a user