ShellPkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the ShellPkg package

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:13 -08:00
committed by mergify[bot]
parent c411b485b6
commit 47d20b54f9
211 changed files with 30269 additions and 27004 deletions

View File

@ -12,16 +12,16 @@
#include "AcpiView.h"
#include "AcpiViewConfig.h"
STATIC UINT32 gIndent;
STATIC UINT32 mTableErrorCount;
STATIC UINT32 mTableWarningCount;
STATIC UINT32 gIndent;
STATIC UINT32 mTableErrorCount;
STATIC UINT32 mTableWarningCount;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
An ACPI_PARSER array describing the ACPI header.
**/
STATIC CONST ACPI_PARSER AcpiHeaderParser[] = {
STATIC CONST ACPI_PARSER AcpiHeaderParser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo)
};
@ -113,21 +113,21 @@ IncrementWarningCount (
BOOLEAN
EFIAPI
VerifyChecksum (
IN BOOLEAN Log,
IN UINT8* Ptr,
IN UINT32 Length
IN BOOLEAN Log,
IN UINT8 *Ptr,
IN UINT32 Length
)
{
UINTN ByteCount;
UINT8 Checksum;
UINTN OriginalAttribute;
UINTN ByteCount;
UINT8 Checksum;
UINTN OriginalAttribute;
//
// set local variables to suppress incorrect compiler/analyzer warnings
//
OriginalAttribute = 0;
ByteCount = 0;
Checksum = 0;
ByteCount = 0;
Checksum = 0;
while (ByteCount < Length) {
Checksum += *(Ptr++);
@ -140,22 +140,29 @@ VerifyChecksum (
if (GetColourHighlighting ()) {
gST->ConOut->SetAttribute (
gST->ConOut,
EFI_TEXT_ATTR (EFI_GREEN,
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
EFI_TEXT_ATTR (
EFI_GREEN,
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
)
);
}
Print (L"Table Checksum : OK\n\n");
} else {
IncrementErrorCount ();
if (GetColourHighlighting ()) {
gST->ConOut->SetAttribute (
gST->ConOut,
EFI_TEXT_ATTR (EFI_RED,
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
EFI_TEXT_ATTR (
EFI_RED,
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
)
);
}
Print (L"Table Checksum : FAILED (0x%X)\n\n", Checksum);
}
if (GetColourHighlighting ()) {
gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);
}
@ -173,16 +180,16 @@ VerifyChecksum (
VOID
EFIAPI
DumpRaw (
IN UINT8* Ptr,
IN UINT32 Length
IN UINT8 *Ptr,
IN UINT32 Length
)
{
UINTN ByteCount;
UINTN PartLineChars;
UINTN AsciiBufferIndex;
CHAR8 AsciiBuffer[17];
UINTN ByteCount;
UINTN PartLineChars;
UINTN AsciiBufferIndex;
CHAR8 AsciiBuffer[17];
ByteCount = 0;
ByteCount = 0;
AsciiBufferIndex = 0;
Print (L"Address : 0x%p\n", Ptr);
@ -216,6 +223,7 @@ DumpRaw (
if ((Length & 0x0F) <= 8) {
PartLineChars += 2;
}
while (PartLineChars > 0) {
Print (L" ");
PartLineChars--;
@ -236,8 +244,8 @@ DumpRaw (
VOID
EFIAPI
DumpUint8 (
IN CONST CHAR16* Format,
IN UINT8* Ptr
IN CONST CHAR16 *Format,
IN UINT8 *Ptr
)
{
Print (Format, *Ptr);
@ -252,11 +260,11 @@ DumpUint8 (
VOID
EFIAPI
DumpUint16 (
IN CONST CHAR16* Format,
IN UINT8* Ptr
IN CONST CHAR16 *Format,
IN UINT8 *Ptr
)
{
Print (Format, *(UINT16*)Ptr);
Print (Format, *(UINT16 *)Ptr);
}
/**
@ -268,11 +276,11 @@ DumpUint16 (
VOID
EFIAPI
DumpUint32 (
IN CONST CHAR16* Format,
IN UINT8* Ptr
IN CONST CHAR16 *Format,
IN UINT8 *Ptr
)
{
Print (Format, *(UINT32*)Ptr);
Print (Format, *(UINT32 *)Ptr);
}
/**
@ -284,19 +292,19 @@ DumpUint32 (
VOID
EFIAPI
DumpUint64 (
IN CONST CHAR16* Format,
IN UINT8* Ptr
IN CONST CHAR16 *Format,
IN UINT8 *Ptr
)
{
// 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;
UINT64 Val;
Val = *(UINT32*)(Ptr + sizeof (UINT32));
Val = *(UINT32 *)(Ptr + sizeof (UINT32));
Val = LShiftU64(Val,32);
Val |= (UINT64)*(UINT32*)Ptr;
Val = LShiftU64 (Val, 32);
Val |= (UINT64)*(UINT32 *)Ptr;
Print (Format, Val);
}
@ -313,8 +321,8 @@ DumpUint64 (
VOID
EFIAPI
Dump3Chars (
IN CONST CHAR16* Format OPTIONAL,
IN UINT8* Ptr
IN CONST CHAR16 *Format OPTIONAL,
IN UINT8 *Ptr
)
{
Print (
@ -337,8 +345,8 @@ Dump3Chars (
VOID
EFIAPI
Dump4Chars (
IN CONST CHAR16* Format OPTIONAL,
IN UINT8* Ptr
IN CONST CHAR16 *Format OPTIONAL,
IN UINT8 *Ptr
)
{
Print (
@ -362,8 +370,8 @@ Dump4Chars (
VOID
EFIAPI
Dump6Chars (
IN CONST CHAR16* Format OPTIONAL,
IN UINT8* Ptr
IN CONST CHAR16 *Format OPTIONAL,
IN UINT8 *Ptr
)
{
Print (
@ -389,8 +397,8 @@ Dump6Chars (
VOID
EFIAPI
Dump8Chars (
IN CONST CHAR16* Format OPTIONAL,
IN UINT8* Ptr
IN CONST CHAR16 *Format OPTIONAL,
IN UINT8 *Ptr
)
{
Print (
@ -418,8 +426,8 @@ Dump8Chars (
VOID
EFIAPI
Dump12Chars (
IN CONST CHAR16* Format OPTIONAL,
IN UINT8* Ptr
IN CONST CHAR16 *Format OPTIONAL,
IN UINT8 *Ptr
)
{
Print (
@ -454,9 +462,9 @@ Dump12Chars (
VOID
EFIAPI
PrintFieldName (
IN UINT32 Indent,
IN CONST CHAR16* FieldName
)
IN UINT32 Indent,
IN CONST CHAR16 *FieldName
)
{
Print (
L"%*a%-*s : ",
@ -498,38 +506,41 @@ EFIAPI
ParseAcpi (
IN BOOLEAN Trace,
IN UINT32 Indent,
IN CONST CHAR8* AsciiName OPTIONAL,
IN UINT8* Ptr,
IN CONST CHAR8 *AsciiName OPTIONAL,
IN UINT8 *Ptr,
IN UINT32 Length,
IN CONST ACPI_PARSER* Parser,
IN CONST ACPI_PARSER *Parser,
IN UINT32 ParserItems
)
)
{
UINT32 Index;
UINT32 Offset;
BOOLEAN HighLight;
UINTN OriginalAttribute;
UINT32 Index;
UINT32 Offset;
BOOLEAN HighLight;
UINTN OriginalAttribute;
//
// set local variables to suppress incorrect compiler/analyzer warnings
//
OriginalAttribute = 0;
Offset = 0;
Offset = 0;
// Increment the Indent
gIndent += Indent;
if (Trace && (AsciiName != NULL)){
if (Trace && (AsciiName != NULL)) {
HighLight = GetColourHighlighting ();
if (HighLight) {
OriginalAttribute = gST->ConOut->Mode->Attribute;
gST->ConOut->SetAttribute (
gST->ConOut,
EFI_TEXT_ATTR(EFI_YELLOW,
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
EFI_TEXT_ATTR (
EFI_YELLOW,
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
)
);
}
Print (
L"%*a%-*a :\n",
gIndent,
@ -544,7 +555,6 @@ ParseAcpi (
for (Index = 0; Index < ParserItems; Index++) {
if ((Offset + Parser[Index].Length) > Length) {
// For fields outside the buffer length provided, reset any pointers
// which were supposed to be updated by this function call
if (Parser[Index].ItemPtr != NULL) {
@ -556,11 +566,12 @@ ParseAcpi (
}
if (GetConsistencyChecking () &&
(Offset != Parser[Index].Offset)) {
(Offset != Parser[Index].Offset))
{
IncrementErrorCount ();
Print (
L"\nERROR: %a: Offset Mismatch for %s\n"
L"CurrentOffset = %d FieldOffset = %d\n",
L"CurrentOffset = %d FieldOffset = %d\n",
AsciiName,
Parser[Index].NameStr,
Offset,
@ -597,20 +608,23 @@ ParseAcpi (
);
} // switch
}
// Validating only makes sense if we are tracing
// the parsed table entries, to report by table name.
if (GetConsistencyChecking () &&
(Parser[Index].FieldValidator != NULL)) {
(Parser[Index].FieldValidator != NULL))
{
Parser[Index].FieldValidator (Ptr, Parser[Index].Context);
}
Print (L"\n");
} // if (Trace)
if (Parser[Index].ItemPtr != NULL) {
*Parser[Index].ItemPtr = (VOID*)Ptr;
*Parser[Index].ItemPtr = (VOID *)Ptr;
}
Ptr += Parser[Index].Length;
Ptr += Parser[Index].Length;
Offset += Parser[Index].Length;
} // for
@ -624,12 +638,12 @@ ParseAcpi (
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"Access Size", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},
{L"Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}
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"Access Size", 1, 3, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL }
};
/**
@ -644,9 +658,9 @@ STATIC CONST ACPI_PARSER GasParser[] = {
UINT32
EFIAPI
DumpGasStruct (
IN UINT8* Ptr,
IN UINT32 Indent,
IN UINT32 Length
IN UINT8 *Ptr,
IN UINT32 Indent,
IN UINT32 Length
)
{
Print (L"\n");
@ -669,8 +683,8 @@ DumpGasStruct (
VOID
EFIAPI
DumpGas (
IN CONST CHAR16* Format OPTIONAL,
IN UINT8* Ptr
IN CONST CHAR16 *Format OPTIONAL,
IN UINT8 *Ptr
)
{
DumpGasStruct (Ptr, 2, sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE));
@ -686,7 +700,7 @@ DumpGas (
UINT32
EFIAPI
DumpAcpiHeader (
IN UINT8* Ptr
IN UINT8 *Ptr
)
{
return ParseAcpi (
@ -715,13 +729,13 @@ DumpAcpiHeader (
UINT32
EFIAPI
ParseAcpiHeader (
IN UINT8* Ptr,
OUT CONST UINT32** Signature,
OUT CONST UINT32** Length,
OUT CONST UINT8** Revision
IN UINT8 *Ptr,
OUT CONST UINT32 **Signature,
OUT CONST UINT32 **Length,
OUT CONST UINT8 **Revision
)
{
UINT32 BytesParsed;
UINT32 BytesParsed;
BytesParsed = ParseAcpi (
FALSE,
@ -733,8 +747,8 @@ ParseAcpiHeader (
);
*Signature = AcpiHdrInfo.Signature;
*Length = AcpiHdrInfo.Length;
*Revision = AcpiHdrInfo.Revision;
*Length = AcpiHdrInfo.Length;
*Revision = AcpiHdrInfo.Revision;
return BytesParsed;
}

View File

@ -50,9 +50,9 @@ IncrementWarningCount (
BOOLEAN
EFIAPI
VerifyChecksum (
IN BOOLEAN Log,
IN UINT8* Ptr,
IN UINT32 Length
IN BOOLEAN Log,
IN UINT8 *Ptr,
IN UINT32 Length
);
/**
@ -64,8 +64,8 @@ VerifyChecksum (
VOID
EFIAPI
DumpRaw (
IN UINT8* Ptr,
IN UINT32 Length
IN UINT8 *Ptr,
IN UINT32 Length
);
/**
@ -77,8 +77,8 @@ DumpRaw (
VOID
EFIAPI
DumpUint8 (
IN CONST CHAR16* Format,
IN UINT8* Ptr
IN CONST CHAR16 *Format,
IN UINT8 *Ptr
);
/**
@ -90,8 +90,8 @@ DumpUint8 (
VOID
EFIAPI
DumpUint16 (
IN CONST CHAR16* Format,
IN UINT8* Ptr
IN CONST CHAR16 *Format,
IN UINT8 *Ptr
);
/**
@ -103,8 +103,8 @@ DumpUint16 (
VOID
EFIAPI
DumpUint32 (
IN CONST CHAR16* Format,
IN UINT8* Ptr
IN CONST CHAR16 *Format,
IN UINT8 *Ptr
);
/**
@ -116,8 +116,8 @@ DumpUint32 (
VOID
EFIAPI
DumpUint64 (
IN CONST CHAR16* Format,
IN UINT8* Ptr
IN CONST CHAR16 *Format,
IN UINT8 *Ptr
);
/**
@ -132,8 +132,8 @@ DumpUint64 (
VOID
EFIAPI
Dump3Chars (
IN CONST CHAR16* Format OPTIONAL,
IN UINT8* Ptr
IN CONST CHAR16 *Format OPTIONAL,
IN UINT8 *Ptr
);
/**
@ -148,8 +148,8 @@ Dump3Chars (
VOID
EFIAPI
Dump4Chars (
IN CONST CHAR16* Format OPTIONAL,
IN UINT8* Ptr
IN CONST CHAR16 *Format OPTIONAL,
IN UINT8 *Ptr
);
/**
@ -164,8 +164,8 @@ Dump4Chars (
VOID
EFIAPI
Dump6Chars (
IN CONST CHAR16* Format OPTIONAL,
IN UINT8* Ptr
IN CONST CHAR16 *Format OPTIONAL,
IN UINT8 *Ptr
);
/**
@ -180,8 +180,8 @@ Dump6Chars (
VOID
EFIAPI
Dump8Chars (
IN CONST CHAR16* Format OPTIONAL,
IN UINT8* Ptr
IN CONST CHAR16 *Format OPTIONAL,
IN UINT8 *Ptr
);
/**
@ -196,8 +196,8 @@ Dump8Chars (
VOID
EFIAPI
Dump12Chars (
IN CONST CHAR16* Format OPTIONAL,
IN UINT8* Ptr
IN CONST CHAR16 *Format OPTIONAL,
IN UINT8 *Ptr
);
/**
@ -215,8 +215,8 @@ Dump12Chars (
VOID
EFIAPI
PrintFieldName (
IN UINT32 Indent,
IN CONST CHAR16* FieldName
IN UINT32 Indent,
IN CONST CHAR16 *FieldName
);
/**
@ -226,7 +226,7 @@ PrintFieldName (
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);
typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16 *Format, UINT8 *Ptr);
/**
This function pointer is the template for validating an ACPI table field.
@ -236,7 +236,7 @@ typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CHAR16* Format, UINT8* Ptr);
the 'Context' member of the ACPI_PARSER.
e.g. this could be a pointer to the ACPI table header.
**/
typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8* Ptr, VOID* Context);
typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8 *Ptr, VOID *Context);
/**
The ACPI_PARSER structure describes the fields of an ACPI table and
@ -258,48 +258,47 @@ typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8* Ptr, VOID* Context);
representing the field data.
**/
typedef struct AcpiParser {
/// String describing the ACPI table field
/// (Field column from ACPI table spec)
CONST CHAR16* NameStr;
CONST CHAR16 *NameStr;
/// The length of the field.
/// (Byte Length column from ACPI table spec)
UINT32 Length;
UINT32 Length;
/// The offset of the field from the start of the table.
/// (Byte Offset column from ACPI table spec)
UINT32 Offset;
UINT32 Offset;
/// Optional Print() style format string for tracing the data. If not
/// used this must be set to NULL.
CONST CHAR16* Format;
CONST CHAR16 *Format;
/// Optional pointer to a print formatter function which
/// is typically used to trace complex field information.
/// If not used this must be set to NULL.
/// The Format string is passed to the PrintFormatter function
/// but may be ignored by the implementation code.
FNPTR_PRINT_FORMATTER PrintFormatter;
FNPTR_PRINT_FORMATTER PrintFormatter;
/// Optional pointer which may be set to request the parser to update
/// a pointer to the field data. This value is set after the FieldValidator
/// has been called and therefore should not be used by the FieldValidator.
/// If unused this must be set to NULL.
VOID** ItemPtr;
VOID **ItemPtr;
/// Optional pointer to a field validator function.
/// The function should directly report any appropriate error or warning
/// and invoke the appropriate counter update function.
/// If not used this parameter must be set to NULL.
FNPTR_FIELD_VALIDATOR FieldValidator;
FNPTR_FIELD_VALIDATOR FieldValidator;
/// Optional pointer to context specific information,
/// which the Field Validator function can use to determine
/// additional information about the ACPI table and make
/// decisions about the field being validated.
/// e.g. this could be a pointer to the ACPI table header
VOID* Context;
VOID *Context;
} ACPI_PARSER;
/**
@ -308,23 +307,23 @@ typedef struct AcpiParser {
**/
typedef struct AcpiDescriptionHeaderInfo {
/// ACPI table signature
UINT32* Signature;
UINT32 *Signature;
/// Length of the ACPI table
UINT32* Length;
UINT32 *Length;
/// Revision
UINT8* Revision;
UINT8 *Revision;
/// Checksum
UINT8* Checksum;
UINT8 *Checksum;
/// OEM Id - length is 6 bytes
UINT8* OemId;
UINT8 *OemId;
/// OEM table Id
UINT64* OemTableId;
UINT64 *OemTableId;
/// OEM revision Id
UINT32* OemRevision;
UINT32 *OemRevision;
/// Creator Id
UINT32* CreatorId;
UINT32 *CreatorId;
/// Creator revision
UINT32* CreatorRevision;
UINT32 *CreatorRevision;
} ACPI_DESCRIPTION_HEADER_INFO;
/**
@ -358,10 +357,10 @@ EFIAPI
ParseAcpi (
IN BOOLEAN Trace,
IN UINT32 Indent,
IN CONST CHAR8* AsciiName OPTIONAL,
IN UINT8* Ptr,
IN CONST CHAR8 *AsciiName OPTIONAL,
IN UINT8 *Ptr,
IN UINT32 Length,
IN CONST ACPI_PARSER* Parser,
IN CONST ACPI_PARSER *Parser,
IN UINT32 ParserItems
);
@ -371,7 +370,7 @@ ParseAcpi (
@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])
#define PARSER_PARAMS(Parser) Parser, sizeof (Parser) / sizeof (Parser[0])
/**
This is a helper macro for describing the ACPI header fields.
@ -410,9 +409,9 @@ ParseAcpi (
UINT32
EFIAPI
DumpGasStruct (
IN UINT8* Ptr,
IN UINT32 Indent,
IN UINT32 Length
IN UINT8 *Ptr,
IN UINT32 Indent,
IN UINT32 Length
);
/**
@ -424,8 +423,8 @@ DumpGasStruct (
VOID
EFIAPI
DumpGas (
IN CONST CHAR16* Format OPTIONAL,
IN UINT8* Ptr
IN CONST CHAR16 *Format OPTIONAL,
IN UINT8 *Ptr
);
/**
@ -438,7 +437,7 @@ DumpGas (
UINT32
EFIAPI
DumpAcpiHeader (
IN UINT8* Ptr
IN UINT8 *Ptr
);
/**
@ -457,10 +456,10 @@ DumpAcpiHeader (
UINT32
EFIAPI
ParseAcpiHeader (
IN UINT8* Ptr,
OUT CONST UINT32** Signature,
OUT CONST UINT32** Length,
OUT CONST UINT8** Revision
IN UINT8 *Ptr,
OUT CONST UINT32 **Signature,
OUT CONST UINT32 **Length,
OUT CONST UINT8 **Revision
);
/**
@ -478,10 +477,10 @@ ParseAcpiHeader (
VOID
EFIAPI
ParseAcpiAest (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -499,10 +498,10 @@ ParseAcpiAest (
VOID
EFIAPI
ParseAcpiBgrt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -520,10 +519,10 @@ ParseAcpiBgrt (
VOID
EFIAPI
ParseAcpiDbg2 (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -541,10 +540,10 @@ ParseAcpiDbg2 (
VOID
EFIAPI
ParseAcpiDsdt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -562,10 +561,10 @@ ParseAcpiDsdt (
VOID
EFIAPI
ParseAcpiFacs (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -583,10 +582,10 @@ ParseAcpiFacs (
VOID
EFIAPI
ParseAcpiFadt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -608,10 +607,10 @@ ParseAcpiFadt (
VOID
EFIAPI
ParseAcpiGtdt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -634,10 +633,10 @@ ParseAcpiGtdt (
VOID
EFIAPI
ParseAcpiHmat (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -663,10 +662,10 @@ ParseAcpiHmat (
VOID
EFIAPI
ParseAcpiIort (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -692,10 +691,10 @@ ParseAcpiIort (
VOID
EFIAPI
ParseAcpiMadt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -713,10 +712,10 @@ ParseAcpiMadt (
VOID
EFIAPI
ParseAcpiMcfg (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -735,10 +734,10 @@ ParseAcpiMcfg (
VOID
EFIAPI
ParseAcpiPcct (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -756,10 +755,10 @@ ParseAcpiPcct (
VOID
EFIAPI
ParseAcpiPptt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -779,10 +778,10 @@ ParseAcpiPptt (
VOID
EFIAPI
ParseAcpiRsdp (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -803,10 +802,10 @@ ParseAcpiRsdp (
VOID
EFIAPI
ParseAcpiSlit (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -824,10 +823,10 @@ ParseAcpiSlit (
VOID
EFIAPI
ParseAcpiSpcr (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -851,10 +850,10 @@ ParseAcpiSpcr (
VOID
EFIAPI
ParseAcpiSrat (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -872,10 +871,10 @@ ParseAcpiSrat (
VOID
EFIAPI
ParseAcpiSsdt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
/**
@ -892,10 +891,10 @@ ParseAcpiSsdt (
VOID
EFIAPI
ParseAcpiXsdt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
#endif // ACPIPARSER_H_

View File

@ -19,14 +19,14 @@
#include "AcpiView.h"
#include "AcpiViewConfig.h"
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
#include "Arm/SbbrValidator.h"
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
#include "Arm/SbbrValidator.h"
#endif
/**
A list of registered ACPI table parsers.
**/
STATIC ACPI_TABLE_PARSER mTableParserList[MAX_ACPI_TABLE_PARSERS];
STATIC ACPI_TABLE_PARSER mTableParserList[MAX_ACPI_TABLE_PARSERS];
/**
Register the ACPI table Parser
@ -46,11 +46,11 @@ STATIC ACPI_TABLE_PARSER mTableParserList[MAX_ACPI_TABLE_PARSERS];
EFI_STATUS
EFIAPI
RegisterParser (
IN UINT32 Signature,
IN PARSE_ACPI_TABLE_PROC ParserProc
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;
@ -70,12 +70,12 @@ RegisterParser (
// Find the first free slot and register the parser
for (Index = 0;
Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
Index++)
Index < (sizeof (mTableParserList) / sizeof (mTableParserList[0]));
Index++)
{
if (mTableParserList[Index].Signature == ACPI_PARSER_SIGNATURE_NULL) {
mTableParserList[Index].Signature = Signature;
mTableParserList[Index].Parser = ParserProc;
mTableParserList[Index].Parser = ParserProc;
return EFI_SUCCESS;
}
}
@ -98,10 +98,10 @@ RegisterParser (
EFI_STATUS
EFIAPI
DeregisterParser (
IN UINT32 Signature
IN UINT32 Signature
)
{
UINT32 Index;
UINT32 Index;
if (Signature == ACPI_PARSER_SIGNATURE_NULL) {
return EFI_INVALID_PARAMETER;
@ -113,7 +113,7 @@ DeregisterParser (
{
if (Signature == mTableParserList[Index].Signature) {
mTableParserList[Index].Signature = ACPI_PARSER_SIGNATURE_NULL;
mTableParserList[Index].Parser = NULL;
mTableParserList[Index].Parser = NULL;
return EFI_SUCCESS;
}
}
@ -138,11 +138,11 @@ DeregisterParser (
EFI_STATUS
EFIAPI
GetParser (
IN UINT32 Signature,
OUT PARSE_ACPI_TABLE_PROC * ParserProc
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;
@ -179,16 +179,16 @@ GetParser (
VOID
EFIAPI
ProcessAcpiTable (
IN UINT8* Ptr
IN UINT8 *Ptr
)
{
EFI_STATUS Status;
BOOLEAN Trace;
CONST UINT32* AcpiTableSignature;
CONST UINT32* AcpiTableLength;
CONST UINT8* AcpiTableRevision;
CONST UINT8* SignaturePtr;
PARSE_ACPI_TABLE_PROC ParserProc;
EFI_STATUS Status;
BOOLEAN Trace;
CONST UINT32 *AcpiTableSignature;
CONST UINT32 *AcpiTableLength;
CONST UINT8 *AcpiTableRevision;
CONST UINT8 *SignaturePtr;
PARSE_ACPI_TABLE_PROC ParserProc;
ParseAcpiHeader (
Ptr,
@ -209,7 +209,7 @@ ProcessAcpiTable (
// Do not process the ACPI table any further if the table length read
// is invalid. The ACPI table should at least contain the table header.
if (*AcpiTableLength < sizeof (EFI_ACPI_DESCRIPTION_HEADER)) {
SignaturePtr = (CONST UINT8*)AcpiTableSignature;
SignaturePtr = (CONST UINT8 *)AcpiTableSignature;
IncrementErrorCount ();
Print (
L"ERROR: Invalid %c%c%c%c table length. Length = %d\n",
@ -227,11 +227,12 @@ ProcessAcpiTable (
}
}
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
if (GetMandatoryTableValidate ()) {
ArmSbbrIncrementTableCount (*AcpiTableSignature);
}
#endif
#endif
Status = GetParser (*AcpiTableSignature, &ParserProc);
if (EFI_ERROR (Status)) {
@ -239,6 +240,7 @@ ProcessAcpiTable (
if (Trace) {
DumpAcpiHeader (Ptr);
}
return;
}

View File

@ -11,11 +11,11 @@
/**
The maximum number of ACPI table parsers.
*/
#define MAX_ACPI_TABLE_PARSERS 32
#define MAX_ACPI_TABLE_PARSERS 32
/** An invalid/NULL signature value.
*/
#define ACPI_PARSER_SIGNATURE_NULL 0
#define ACPI_PARSER_SIGNATURE_NULL 0
/**
A function that parses the ACPI table.
@ -27,9 +27,9 @@
**/
typedef
VOID
(EFIAPI * PARSE_ACPI_TABLE_PROC) (
(EFIAPI *PARSE_ACPI_TABLE_PROC)(
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
);
@ -39,10 +39,10 @@ VOID
**/
typedef struct AcpiTableParser {
/// ACPI table signature
UINT32 Signature;
UINT32 Signature;
/// The ACPI table parser function.
PARSE_ACPI_TABLE_PROC Parser;
PARSE_ACPI_TABLE_PROC Parser;
} ACPI_TABLE_PARSER;
/**
@ -63,8 +63,8 @@ typedef struct AcpiTableParser {
EFI_STATUS
EFIAPI
RegisterParser (
IN UINT32 Signature,
IN PARSE_ACPI_TABLE_PROC ParserProc
IN UINT32 Signature,
IN PARSE_ACPI_TABLE_PROC ParserProc
);
/**
@ -81,7 +81,7 @@ RegisterParser (
EFI_STATUS
EFIAPI
DeregisterParser (
IN UINT32 Signature
IN UINT32 Signature
);
/**
@ -101,7 +101,7 @@ DeregisterParser (
VOID
EFIAPI
ProcessAcpiTable (
IN UINT8* Ptr
IN UINT8 *Ptr
);
/**
@ -120,8 +120,8 @@ ProcessAcpiTable (
EFI_STATUS
EFIAPI
GetParser (
IN UINT32 Signature,
OUT PARSE_ACPI_TABLE_PROC * ParserProc
IN UINT32 Signature,
OUT PARSE_ACPI_TABLE_PROC *ParserProc
);
#endif // ACPITABLEPARSER_H_

View File

@ -23,12 +23,12 @@
#include "AcpiView.h"
#include "AcpiViewConfig.h"
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
#include "Arm/SbbrValidator.h"
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
#include "Arm/SbbrValidator.h"
#endif
STATIC UINT32 mTableCount;
STATIC UINT32 mBinTableCount;
STATIC UINT32 mTableCount;
STATIC UINT32 mBinTableCount;
/**
This function dumps the ACPI table to a file.
@ -42,13 +42,13 @@ STATIC UINT32 mBinTableCount;
STATIC
BOOLEAN
DumpAcpiTableToFile (
IN CONST UINT8* Ptr,
IN CONST UINTN Length
IN CONST UINT8 *Ptr,
IN CONST UINTN Length
)
{
CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
UINTN TransferBytes;
SELECTED_ACPI_TABLE *SelectedTable;
CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
UINTN TransferBytes;
SELECTED_ACPI_TABLE *SelectedTable;
GetSelectedAcpiTable (&SelectedTable);
@ -78,7 +78,7 @@ DumpAcpiTableToFile (
BOOLEAN
ProcessTableReportOptions (
IN CONST UINT32 Signature,
IN CONST UINT8* TablePtr,
IN CONST UINT8 *TablePtr,
IN CONST UINT32 Length
)
{
@ -92,9 +92,9 @@ ProcessTableReportOptions (
// set local variables to suppress incorrect compiler/analyzer warnings
//
OriginalAttribute = 0;
SignaturePtr = (UINT8*)(UINTN)&Signature;
Log = FALSE;
HighLight = GetColourHighlighting ();
SignaturePtr = (UINT8 *)(UINTN)&Signature;
Log = FALSE;
HighLight = GetColourHighlighting ();
GetSelectedAcpiTable (&SelectedTable);
switch (GetReportOption ()) {
@ -103,9 +103,10 @@ ProcessTableReportOptions (
break;
case ReportSelected:
if (Signature == SelectedTable->Type) {
Log = TRUE;
Log = TRUE;
SelectedTable->Found = TRUE;
}
break;
case ReportTableList:
if (mTableCount == 0) {
@ -113,15 +114,19 @@ ProcessTableReportOptions (
OriginalAttribute = gST->ConOut->Mode->Attribute;
gST->ConOut->SetAttribute (
gST->ConOut,
EFI_TEXT_ATTR(EFI_CYAN,
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
EFI_TEXT_ATTR (
EFI_CYAN,
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
)
);
}
Print (L"\nInstalled Table(s):\n");
if (HighLight) {
gST->ConOut->SetAttribute (gST->ConOut, OriginalAttribute);
}
}
Print (
L"\t%4d. %c%c%c%c\n",
++mTableCount,
@ -136,6 +141,7 @@ ProcessTableReportOptions (
SelectedTable->Found = TRUE;
DumpAcpiTableToFile (TablePtr, Length);
}
break;
case ReportMax:
// We should never be here.
@ -148,10 +154,13 @@ ProcessTableReportOptions (
OriginalAttribute = gST->ConOut->Mode->Attribute;
gST->ConOut->SetAttribute (
gST->ConOut,
EFI_TEXT_ATTR(EFI_LIGHTBLUE,
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4))
EFI_TEXT_ATTR (
EFI_LIGHTBLUE,
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
)
);
}
Print (
L"\n\n --------------- %c%c%c%c Table --------------- \n\n",
SignaturePtr[0],
@ -167,8 +176,6 @@ ProcessTableReportOptions (
return Log;
}
/**
This function iterates the configuration table entries in the
system table, retrieves the RSDP pointer and starts parsing the ACPI tables.
@ -182,17 +189,17 @@ ProcessTableReportOptions (
EFI_STATUS
EFIAPI
AcpiView (
IN EFI_SYSTEM_TABLE* SystemTable
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
UINTN Index;
EFI_CONFIGURATION_TABLE* EfiConfigurationTable;
EFI_CONFIGURATION_TABLE *EfiConfigurationTable;
BOOLEAN FoundAcpiTable;
UINTN OriginalAttribute;
UINTN PrintAttribute;
EREPORT_OPTION ReportOption;
UINT8* RsdpPtr;
UINT8 *RsdpPtr;
UINT32 RsdpLength;
UINT8 RsdpRevision;
PARSE_ACPI_TABLE_PROC RsdpParserProc;
@ -203,10 +210,10 @@ AcpiView (
// set local variables to suppress incorrect compiler/analyzer warnings
//
EfiConfigurationTable = NULL;
OriginalAttribute = 0;
OriginalAttribute = 0;
// Reset Table counts
mTableCount = 0;
mTableCount = 0;
mBinTableCount = 0;
// Reset The error/warning counters
@ -219,16 +226,19 @@ AcpiView (
// Search the table for an entry that matches the ACPI Table Guid
FoundAcpiTable = FALSE;
for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) {
if (CompareGuid (&gEfiAcpiTableGuid,
&(SystemTable->ConfigurationTable[Index].VendorGuid))) {
if (CompareGuid (
&gEfiAcpiTableGuid,
&(SystemTable->ConfigurationTable[Index].VendorGuid)
))
{
EfiConfigurationTable = &SystemTable->ConfigurationTable[Index];
FoundAcpiTable = TRUE;
FoundAcpiTable = TRUE;
break;
}
}
if (FoundAcpiTable) {
RsdpPtr = (UINT8*)EfiConfigurationTable->VendorTable;
RsdpPtr = (UINT8 *)EfiConfigurationTable->VendorTable;
// The RSDP revision is 1 byte starting at offset 15
RsdpRevision = *(RsdpPtr + RSDP_REVISION_OFFSET);
@ -240,14 +250,15 @@ AcpiView (
return EFI_UNSUPPORTED;
}
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
if (GetMandatoryTableValidate ()) {
ArmSbbrResetTableCounts ();
}
#endif
#endif
// The RSDP length is 4 bytes starting at offset 20
RsdpLength = *(UINT32*)(RsdpPtr + RSDP_LENGTH_OFFSET);
RsdpLength = *(UINT32 *)(RsdpPtr + RSDP_LENGTH_OFFSET);
Trace = ProcessTableReportOptions (RSDP_TABLE_INFO, RsdpPtr, RsdpLength);
@ -265,7 +276,6 @@ AcpiView (
RsdpLength,
RsdpRevision
);
} else {
IncrementErrorCount ();
Print (
@ -274,45 +284,50 @@ AcpiView (
return EFI_NOT_FOUND;
}
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
if (GetMandatoryTableValidate ()) {
ArmSbbrReqsValidate ((ARM_SBBR_VERSION)GetMandatoryTableSpec ());
}
#endif
#endif
ReportOption = GetReportOption ();
if (ReportTableList != ReportOption) {
if (((ReportSelected == ReportOption) ||
(ReportDumpBinFile == ReportOption)) &&
(!SelectedTable->Found)) {
(!SelectedTable->Found))
{
Print (L"\nRequested ACPI Table not found.\n");
} else if (GetConsistencyChecking () &&
(ReportDumpBinFile != ReportOption)) {
(ReportDumpBinFile != ReportOption))
{
OriginalAttribute = gST->ConOut->Mode->Attribute;
Print (L"\nTable Statistics:\n");
if (GetColourHighlighting ()) {
PrintAttribute = (GetErrorCount () > 0) ?
EFI_TEXT_ATTR (
EFI_RED,
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
) :
OriginalAttribute;
EFI_TEXT_ATTR (
EFI_RED,
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
) :
OriginalAttribute;
gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
}
Print (L"\t%d Error(s)\n", GetErrorCount ());
if (GetColourHighlighting ()) {
PrintAttribute = (GetWarningCount () > 0) ?
EFI_TEXT_ATTR (
EFI_RED,
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
) :
OriginalAttribute;
EFI_TEXT_ATTR (
EFI_RED,
((OriginalAttribute&(BIT4|BIT5|BIT6))>>4)
) :
OriginalAttribute;
gST->ConOut->SetAttribute (gST->ConOut, PrintAttribute);
}
Print (L"\t%d Warning(s)\n", GetWarningCount ());
if (GetColourHighlighting ()) {
@ -320,5 +335,6 @@ AcpiView (
}
}
}
return EFI_SUCCESS;
}

View File

@ -11,17 +11,17 @@
/**
A macro to define the max file name length
**/
#define MAX_FILE_NAME_LEN 128
#define MAX_FILE_NAME_LEN 128
/**
Offset to the RSDP revision from the start of the RSDP
**/
#define RSDP_REVISION_OFFSET 15
#define RSDP_REVISION_OFFSET 15
/**
Offset to the RSDP length from the start of the RSDP
**/
#define RSDP_LENGTH_OFFSET 20
#define RSDP_LENGTH_OFFSET 20
/**
This function resets the ACPI table error counter to Zero.
@ -71,7 +71,7 @@ GetWarningCount (
BOOLEAN
ProcessTableReportOptions (
IN CONST UINT32 Signature,
IN CONST UINT8* TablePtr,
IN CONST UINT8 *TablePtr,
IN CONST UINT32 Length
);
@ -88,7 +88,7 @@ ProcessTableReportOptions (
EFI_STATUS
EFIAPI
AcpiView (
IN EFI_SYSTEM_TABLE* SystemTable
IN EFI_SYSTEM_TABLE *SystemTable
);
#endif // ACPIVIEW_H_

View File

@ -11,14 +11,14 @@
#include "AcpiViewConfig.h"
// Report variables
STATIC BOOLEAN mConsistencyCheck;
STATIC BOOLEAN mColourHighlighting;
STATIC EREPORT_OPTION mReportType;
STATIC BOOLEAN mMandatoryTableValidate;
STATIC UINTN mMandatoryTableSpec;
STATIC BOOLEAN mConsistencyCheck;
STATIC BOOLEAN mColourHighlighting;
STATIC EREPORT_OPTION mReportType;
STATIC BOOLEAN mMandatoryTableValidate;
STATIC UINTN mMandatoryTableSpec;
// User selection of which ACPI table should be checked
SELECTED_ACPI_TABLE mSelectedAcpiTable;
SELECTED_ACPI_TABLE mSelectedAcpiTable;
/**
Reset the AcpiView user configuration to defaults
@ -29,13 +29,13 @@ AcpiConfigSetDefaults (
VOID
)
{
mReportType = ReportAll;
mSelectedAcpiTable.Type = 0;
mSelectedAcpiTable.Name = NULL;
mReportType = ReportAll;
mSelectedAcpiTable.Type = 0;
mSelectedAcpiTable.Name = NULL;
mSelectedAcpiTable.Found = FALSE;
mConsistencyCheck = TRUE;
mMandatoryTableValidate = FALSE;
mMandatoryTableSpec = 0;
mConsistencyCheck = TRUE;
mMandatoryTableValidate = FALSE;
mMandatoryTableSpec = 0;
}
/**
@ -49,25 +49,27 @@ AcpiConfigSetDefaults (
STATIC
UINT32
ConvertStrToAcpiSignature (
IN CONST CHAR16 *Str
IN CONST CHAR16 *Str
)
{
UINT8 Index;
CHAR8 Ptr[4];
UINT8 Index;
CHAR8 Ptr[4];
ZeroMem (Ptr, sizeof (Ptr));
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') {
if ((Str[Index] >= L'a') && (Str[Index] <= L'z')) {
Ptr[Index] = (CHAR8)(Str[Index] - (L'a' - L'A'));
} else {
Ptr[Index] = (CHAR8)Str[Index];
}
Index++;
}
return *(UINT32 *) Ptr;
return *(UINT32 *)Ptr;
}
/**
@ -80,7 +82,7 @@ ConvertStrToAcpiSignature (
VOID
EFIAPI
SelectAcpiTable (
IN CONST CHAR16 *TableName
IN CONST CHAR16 *TableName
)
{
ASSERT (TableName != NULL);
@ -97,7 +99,7 @@ SelectAcpiTable (
VOID
EFIAPI
GetSelectedAcpiTable (
OUT SELECTED_ACPI_TABLE **SelectedAcpiTable
OUT SELECTED_ACPI_TABLE **SelectedAcpiTable
)
{
*SelectedAcpiTable = &mSelectedAcpiTable;
@ -125,7 +127,7 @@ GetColourHighlighting (
VOID
EFIAPI
SetColourHighlighting (
BOOLEAN Highlight
BOOLEAN Highlight
)
{
mColourHighlighting = Highlight;
@ -153,7 +155,7 @@ GetConsistencyChecking (
VOID
EFIAPI
SetConsistencyChecking (
BOOLEAN ConsistencyChecking
BOOLEAN ConsistencyChecking
)
{
mConsistencyCheck = ConsistencyChecking;
@ -181,7 +183,7 @@ GetReportOption (
VOID
EFIAPI
SetReportOption (
EREPORT_OPTION ReportType
EREPORT_OPTION ReportType
)
{
mReportType = ReportType;
@ -209,7 +211,7 @@ GetMandatoryTableValidate (
VOID
EFIAPI
SetMandatoryTableValidate (
BOOLEAN Validate
BOOLEAN Validate
)
{
mMandatoryTableValidate = Validate;
@ -239,7 +241,7 @@ GetMandatoryTableSpec (
VOID
EFIAPI
SetMandatoryTableSpec (
UINTN Spec
UINTN Spec
)
{
mMandatoryTableSpec = Spec;

View File

@ -27,7 +27,7 @@ GetColourHighlighting (
VOID
EFIAPI
SetColourHighlighting (
BOOLEAN Highlight
BOOLEAN Highlight
);
/**
@ -49,7 +49,7 @@ GetConsistencyChecking (
VOID
EFIAPI
SetConsistencyChecking (
BOOLEAN ConsistencyChecking
BOOLEAN ConsistencyChecking
);
/**
@ -71,7 +71,7 @@ GetMandatoryTableValidate (
VOID
EFIAPI
SetMandatoryTableValidate (
BOOLEAN Validate
BOOLEAN Validate
);
/**
@ -95,7 +95,7 @@ GetMandatoryTableSpec (
VOID
EFIAPI
SetMandatoryTableSpec (
UINTN Spec
UINTN Spec
);
/**
@ -128,7 +128,7 @@ GetReportOption (
VOID
EFIAPI
SetReportOption (
EREPORT_OPTION ReportType
EREPORT_OPTION ReportType
);
/**
@ -136,9 +136,9 @@ SetReportOption (
ACPI table is to be examined by the AcpiView code.
**/
typedef struct {
UINT32 Type; ///< 32bit signature of the selected ACPI table.
CONST CHAR16* Name; ///< User friendly name of the selected ACPI table.
BOOLEAN Found; ///< The selected table has been found in the system.
UINT32 Type; ///< 32bit signature of the selected ACPI table.
CONST CHAR16 *Name; ///< User friendly name of the selected ACPI table.
BOOLEAN Found; ///< The selected table has been found in the system.
} SELECTED_ACPI_TABLE;
/**
@ -149,7 +149,7 @@ typedef struct {
VOID
EFIAPI
GetSelectedAcpiTable (
OUT SELECTED_ACPI_TABLE** SelectedAcpiTable
OUT SELECTED_ACPI_TABLE **SelectedAcpiTable
);
/**
@ -162,7 +162,7 @@ GetSelectedAcpiTable (
VOID
EFIAPI
SelectAcpiTable (
CONST CHAR16* TableName
CONST CHAR16 *TableName
);
/**

View File

@ -23,7 +23,7 @@
/**
SBBR specification version strings
**/
STATIC CONST CHAR8* ArmSbbrVersions[ArmSbbrVersionMax] = {
STATIC CONST CHAR8 *ArmSbbrVersions[ArmSbbrVersionMax] = {
"1.0", // ArmSbbrVersion_1_0
"1.1", // ArmSbbrVersion_1_1
"1.2" // ArmSbbrVersion_1_2
@ -32,7 +32,7 @@ STATIC CONST CHAR8* ArmSbbrVersions[ArmSbbrVersionMax] = {
/**
SBBR 1.0 mandatory ACPI tables
**/
STATIC CONST UINT32 ArmSbbr10Mandatory[] = {
STATIC CONST UINT32 ArmSbbr10Mandatory[] = {
EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
@ -45,7 +45,7 @@ STATIC CONST UINT32 ArmSbbr10Mandatory[] = {
/**
SBBR 1.1 mandatory ACPI tables
**/
STATIC CONST UINT32 ArmSbbr11Mandatory[] = {
STATIC CONST UINT32 ArmSbbr11Mandatory[] = {
EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
@ -59,7 +59,7 @@ STATIC CONST UINT32 ArmSbbr11Mandatory[] = {
/**
SBBR 1.2 mandatory ACPI tables
**/
STATIC CONST UINT32 ArmSbbr12Mandatory[] = {
STATIC CONST UINT32 ArmSbbr12Mandatory[] = {
EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
@ -74,7 +74,7 @@ STATIC CONST UINT32 ArmSbbr12Mandatory[] = {
/**
Mandatory ACPI tables for every SBBR specification version.
**/
STATIC CONST ACPI_SBBR_REQ ArmSbbrReqs[ArmSbbrVersionMax] = {
STATIC CONST ACPI_SBBR_REQ ArmSbbrReqs[ArmSbbrVersionMax] = {
{ ArmSbbr10Mandatory, ARRAY_SIZE (ArmSbbr10Mandatory) }, // SBBR v1.0
{ ArmSbbr11Mandatory, ARRAY_SIZE (ArmSbbr11Mandatory) }, // SBBR v1.1
{ ArmSbbr12Mandatory, ARRAY_SIZE (ArmSbbr12Mandatory) } // SBBR v1.2
@ -84,16 +84,16 @@ STATIC CONST ACPI_SBBR_REQ ArmSbbrReqs[ArmSbbrVersionMax] = {
Data structure to track instance counts for all ACPI tables which are
defined as 'mandatory' in any SBBR version.
**/
STATIC ACPI_TABLE_COUNTER ArmSbbrTableCounts[] = {
{EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, 0},
{EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, 0},
{EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, 0},
{EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, 0},
{EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, 0},
{EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE, 0},
{EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, 0},
{EFI_ACPI_6_3_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE, 0},
{EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE, 0}
STATIC ACPI_TABLE_COUNTER ArmSbbrTableCounts[] = {
{ EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, 0 },
{ EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, 0 },
{ EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, 0 },
{ EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, 0 },
{ EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, 0 },
{ EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE, 0 },
{ EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, 0 },
{ EFI_ACPI_6_3_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE, 0 },
{ EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE, 0 }
};
/**
@ -105,7 +105,7 @@ ArmSbbrResetTableCounts (
VOID
)
{
UINT32 Table;
UINT32 Table;
for (Table = 0; Table < ARRAY_SIZE (ArmSbbrTableCounts); Table++) {
ArmSbbrTableCounts[Table].Count = 0;
@ -124,10 +124,10 @@ ArmSbbrResetTableCounts (
BOOLEAN
EFIAPI
ArmSbbrIncrementTableCount (
UINT32 Signature
UINT32 Signature
)
{
UINT32 Table;
UINT32 Table;
for (Table = 0; Table < ARRAY_SIZE (ArmSbbrTableCounts); Table++) {
if (Signature == ArmSbbrTableCounts[Table].Signature) {
@ -154,14 +154,14 @@ ArmSbbrIncrementTableCount (
EFI_STATUS
EFIAPI
ArmSbbrReqsValidate (
ARM_SBBR_VERSION Version
ARM_SBBR_VERSION Version
)
{
UINT32 Table;
UINT32 Index;
UINT32 MandatoryTable;
CONST UINT8* SignaturePtr;
BOOLEAN IsArmSbbrViolated;
UINT32 Table;
UINT32 Index;
UINT32 MandatoryTable;
CONST UINT8 *SignaturePtr;
BOOLEAN IsArmSbbrViolated;
if (Version >= ArmSbbrVersionMax) {
return EFI_INVALID_PARAMETER;
@ -172,12 +172,13 @@ ArmSbbrReqsValidate (
// Go through the list of mandatory tables for the input SBBR version
for (Table = 0; Table < ArmSbbrReqs[Version].TableCount; Table++) {
MandatoryTable = ArmSbbrReqs[Version].Tables[Table];
SignaturePtr = (CONST UINT8*)(UINTN)&MandatoryTable;
SignaturePtr = (CONST UINT8 *)(UINTN)&MandatoryTable;
// Locate the instance count for the table with the given signature
Index = 0;
while ((Index < ARRAY_SIZE (ArmSbbrTableCounts)) &&
(ArmSbbrTableCounts[Index].Signature != MandatoryTable)) {
(ArmSbbrTableCounts[Index].Signature != MandatoryTable))
{
Index++;
}
@ -185,7 +186,7 @@ ArmSbbrReqsValidate (
IncrementErrorCount ();
Print (
L"\nERROR: SBBR v%a: Mandatory %c%c%c%c table's instance count not " \
L"found\n",
L"found\n",
ArmSbbrVersions[Version],
SignaturePtr[0],
SignaturePtr[1],

View File

@ -24,26 +24,26 @@
Arm SBBR specification versions.
**/
typedef enum {
ArmSbbrVersion_1_0 = 0,
ArmSbbrVersion_1_1 = 1,
ArmSbbrVersion_1_2 = 2,
ArmSbbrVersionMax = 3
ArmSbbrVersion_1_0 = 0,
ArmSbbrVersion_1_1 = 1,
ArmSbbrVersion_1_2 = 2,
ArmSbbrVersionMax = 3
} ARM_SBBR_VERSION;
/**
The ACPI table instance counter.
**/
typedef struct AcpiTableCounter {
CONST UINT32 Signature; /// ACPI table signature
UINT32 Count; /// Instance count
CONST UINT32 Signature; /// ACPI table signature
UINT32 Count; /// Instance count
} ACPI_TABLE_COUNTER;
/**
ACPI table SBBR requirements.
**/
typedef struct AcpiSbbrReq {
CONST UINT32* Tables; /// List of required tables
CONST UINT32 TableCount; /// Number of elements in Tables
CONST UINT32 *Tables; /// List of required tables
CONST UINT32 TableCount; /// Number of elements in Tables
} ACPI_SBBR_REQ;
/**
@ -67,7 +67,7 @@ ArmSbbrResetTableCounts (
BOOLEAN
EFIAPI
ArmSbbrIncrementTableCount (
UINT32 Signature
UINT32 Signature
);
/**
@ -85,7 +85,7 @@ ArmSbbrIncrementTableCount (
EFI_STATUS
EFIAPI
ArmSbbrReqsValidate (
ARM_SBBR_VERSION Version
ARM_SBBR_VERSION Version
);
#endif // SBBR_VALIDATOR_H_

View File

@ -18,16 +18,16 @@
#include "AcpiViewConfig.h"
// Local variables
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC UINT8* AestNodeType;
STATIC UINT16* AestNodeLength;
STATIC UINT32* NodeDataOffset;
STATIC UINT32* NodeInterfaceOffset;
STATIC UINT32* NodeInterruptArrayOffset;
STATIC UINT32* NodeInterruptCount;
STATIC UINT32* ProcessorId;
STATIC UINT8* ProcessorFlags;
STATIC UINT8* ProcessorResourceType;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC UINT8 *AestNodeType;
STATIC UINT16 *AestNodeLength;
STATIC UINT32 *NodeDataOffset;
STATIC UINT32 *NodeInterfaceOffset;
STATIC UINT32 *NodeInterruptArrayOffset;
STATIC UINT32 *NodeInterruptCount;
STATIC UINT32 *ProcessorId;
STATIC UINT8 *ProcessorFlags;
STATIC UINT8 *ProcessorResourceType;
/**
Validate Processor Flags.
@ -40,16 +40,18 @@ STATIC
VOID
EFIAPI
ValidateProcessorFlags (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
// If the global or shared node flag is set then the ACPI Processor ID
// field must be set to 0 and ignored.
if (((*Ptr & 0x3) != 0) && (*ProcessorId != 0)) {
IncrementErrorCount ();
Print (L"\nERROR: 'ACPI Processor ID' field must be set to 0 for global"
L" or shared nodes.");
Print (
L"\nERROR: 'ACPI Processor ID' field must be set to 0 for global"
L" or shared nodes."
);
}
}
@ -64,13 +66,13 @@ STATIC
VOID
EFIAPI
ValidateGicInterfaceType (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
UINT32 GicInterfaceType;
UINT32 GicInterfaceType;
GicInterfaceType = *(UINT32*)Ptr;
GicInterfaceType = *(UINT32 *)Ptr;
if (GicInterfaceType > 3) {
IncrementErrorCount ();
Print (L"\nError: Invalid GIC Interface type %d", GicInterfaceType);
@ -88,8 +90,8 @@ STATIC
VOID
EFIAPI
ValidateInterfaceType (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
if (*Ptr > 1) {
@ -109,8 +111,8 @@ STATIC
VOID
EFIAPI
ValidateInterruptType (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
if (*Ptr > 1) {
@ -130,8 +132,8 @@ STATIC
VOID
EFIAPI
ValidateInterruptFlags (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
if ((*Ptr & 0xfe) != 0) {
@ -149,8 +151,8 @@ ValidateInterruptFlags (
VOID
EFIAPI
DumpVendorSpecificData (
IN CONST CHAR16* Format OPTIONAL,
IN UINT8* Ptr
IN CONST CHAR16 *Format OPTIONAL,
IN UINT8 *Ptr
)
{
Print (
@ -183,27 +185,27 @@ DumpVendorSpecificData (
/**
An ACPI_PARSER array describing the ACPI AEST Table.
**/
STATIC CONST ACPI_PARSER AestParser[] = {
STATIC CONST ACPI_PARSER AestParser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo)
};
/**
An ACPI_PARSER array describing the AEST Node Header.
**/
STATIC CONST ACPI_PARSER AestNodeHeaderParser[] = {
{L"Type", 1, 0, L"%d", NULL, (VOID**)&AestNodeType, NULL, NULL},
{L"Length", 2, 1, L"%d", NULL, (VOID**)&AestNodeLength, NULL, NULL},
{L"Reserved", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},
{L"Node Data Offset", 4, 4, L"%d", NULL, (VOID**)&NodeDataOffset, NULL, NULL},
{L"Node Interface Offset", 4, 8, L"%d", NULL,
(VOID**)&NodeInterfaceOffset, NULL, NULL},
{L"Node Interrupt Array Offset", 4, 12, L"%d", NULL,
(VOID**)&NodeInterruptArrayOffset, NULL, NULL},
{L"Node Interrupt Count", 4, 16, L"%d", NULL,
(VOID**)&NodeInterruptCount, NULL, NULL},
{L"Timestamp Rate", 8, 20, L"%ld", NULL, NULL, NULL, NULL},
{L"Reserved1", 8, 28, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Error Injection Countdown Rate", 8, 36, L"%ld", NULL, NULL, NULL, NULL}
STATIC CONST ACPI_PARSER AestNodeHeaderParser[] = {
{ L"Type", 1, 0, L"%d", NULL, (VOID **)&AestNodeType, NULL, NULL },
{ L"Length", 2, 1, L"%d", NULL, (VOID **)&AestNodeLength, NULL, NULL },
{ L"Reserved", 1, 3, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Node Data Offset", 4, 4, L"%d", NULL, (VOID **)&NodeDataOffset, NULL, NULL },
{ L"Node Interface Offset", 4, 8, L"%d", NULL,
(VOID **)&NodeInterfaceOffset, NULL, NULL },
{ L"Node Interrupt Array Offset", 4, 12, L"%d", NULL,
(VOID **)&NodeInterruptArrayOffset, NULL, NULL },
{ L"Node Interrupt Count", 4, 16, L"%d", NULL,
(VOID **)&NodeInterruptCount, NULL, NULL },
{ L"Timestamp Rate", 8, 20, L"%ld", NULL, NULL, NULL, NULL },
{ L"Reserved1", 8, 28, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Error Injection Countdown Rate", 8, 36, L"%ld", NULL, NULL, NULL, NULL }
// Node specific data...
// Node interface...
// Node interrupt array...
@ -212,100 +214,100 @@ STATIC CONST ACPI_PARSER AestNodeHeaderParser[] = {
/**
An ACPI_PARSER array describing the Processor error node specific data.
**/
STATIC CONST ACPI_PARSER AestProcessorStructure[] = {
{L"ACPI Processor ID", 4, 0, L"0x%x", NULL, (VOID**)&ProcessorId, NULL, NULL},
{L"Resource Type", 1, 4, L"%d", NULL, (VOID**)&ProcessorResourceType, NULL,
NULL},
{L"Reserved", 1, 5, L"0x%x", NULL, NULL, NULL, NULL},
{L"Flags", 1, 6, L"0x%x", NULL, (VOID**)&ProcessorFlags,
ValidateProcessorFlags, NULL},
{L"Revision", 1, 7, L"%d", NULL, NULL, NULL, NULL},
{L"Processor Affinity Level Indicator", 8, 8, L"0x%lx", NULL, NULL, NULL,
NULL},
STATIC CONST ACPI_PARSER AestProcessorStructure[] = {
{ L"ACPI Processor ID", 4, 0, L"0x%x", NULL, (VOID **)&ProcessorId, NULL, NULL },
{ L"Resource Type", 1, 4, L"%d", NULL, (VOID **)&ProcessorResourceType, NULL,
NULL },
{ L"Reserved", 1, 5, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Flags", 1, 6, L"0x%x", NULL, (VOID **)&ProcessorFlags,
ValidateProcessorFlags, NULL },
{ L"Revision", 1, 7, L"%d", NULL, NULL, NULL, NULL },
{ L"Processor Affinity Level Indicator", 8, 8, L"0x%lx", NULL, NULL, NULL,
NULL },
// Resource specific data...
};
/**
An ACPI_PARSER array describing the processor cache resource substructure.
**/
STATIC CONST ACPI_PARSER AestProcessorCacheResourceSubstructure[] = {
{L"Cache reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 4, 4, L"%d", NULL, NULL, NULL, NULL}
STATIC CONST ACPI_PARSER AestProcessorCacheResourceSubstructure[] = {
{ L"Cache reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 4, 4, L"%d", NULL, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the processor TLB resource substructure.
**/
STATIC CONST ACPI_PARSER AestProcessorTlbResourceSubstructure[] = {
{L"TLB reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 4, 4, L"%d", NULL, NULL, NULL, NULL}
STATIC CONST ACPI_PARSER AestProcessorTlbResourceSubstructure[] = {
{ L"TLB reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 4, 4, L"%d", NULL, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the processor generic resource substructure.
**/
STATIC CONST ACPI_PARSER AestProcessorGenericResourceSubstructure[] = {
{L"Vendor-defined data", 4, 0, L"%x", NULL, NULL, NULL, NULL}
STATIC CONST ACPI_PARSER AestProcessorGenericResourceSubstructure[] = {
{ L"Vendor-defined data", 4, 0, L"%x", NULL, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the memory controller structure.
**/
STATIC CONST ACPI_PARSER AestMemoryControllerStructure[] = {
{L"Proximity Domain", 4, 0, L"0x%x", NULL, NULL, NULL, NULL}
STATIC CONST ACPI_PARSER AestMemoryControllerStructure[] = {
{ L"Proximity Domain", 4, 0, L"0x%x", NULL, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the SMMU structure.
**/
STATIC CONST ACPI_PARSER AestSmmuStructure[] = {
{L"IORT Node reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
{L"SubComponent reference ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}
STATIC CONST ACPI_PARSER AestSmmuStructure[] = {
{ L"IORT Node reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"SubComponent reference ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the vendor-defined structure.
**/
STATIC CONST ACPI_PARSER AestVendorDefinedStructure[] = {
{L"Hardware ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},
{L"Unique ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
{L"Vendor-specific data", 16, 8, NULL, DumpVendorSpecificData, NULL, NULL}
STATIC CONST ACPI_PARSER AestVendorDefinedStructure[] = {
{ L"Hardware ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Unique ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Vendor-specific data", 16, 8, NULL, DumpVendorSpecificData, NULL, NULL }
};
/**
An ACPI_PARSER array describing the GIC structure.
**/
STATIC CONST ACPI_PARSER AestGicStructure[] = {
{L"GIC Interface Type", 4, 0, L"0x%x", NULL, NULL, ValidateGicInterfaceType,
NULL},
{L"GIC Interface reference ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}
STATIC CONST ACPI_PARSER AestGicStructure[] = {
{ L"GIC Interface Type", 4, 0, L"0x%x", NULL, NULL, ValidateGicInterfaceType,
NULL },
{ L"GIC Interface reference ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}
};
/**
An ACPI_PARSER array describing the node interface.
**/
STATIC CONST ACPI_PARSER AestNodeInterface[] = {
{L"Interface Type", 1, 0, L"%d", NULL, NULL, ValidateInterfaceType, NULL},
{L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},
{L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
{L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Start Error Record Index", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
{L"Number of Error Records", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
{L"Error Records Implemented", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Error Records Support", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Addressing mode", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL}
STATIC CONST ACPI_PARSER AestNodeInterface[] = {
{ L"Interface Type", 1, 0, L"%d", NULL, NULL, ValidateInterfaceType, NULL },
{ L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL },
{ L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Start Error Record Index", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Number of Error Records", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Error Records Implemented", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Error Records Support", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Addressing mode", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the node interrupts.
**/
STATIC CONST ACPI_PARSER AestNodeInterrupt[] = {
{L"Interrupt Type", 1, 0, L"%d", NULL, NULL, ValidateInterruptType, NULL},
{L"Reserved", 2, 1, L"0x%x", NULL, NULL, NULL, NULL},
{L"Interrupt Flags", 1, 3, L"0x%x", NULL, NULL, ValidateInterruptFlags, NULL},
{L"Interrupt GSIV", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
{L"ID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved1", 3, 9, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}
STATIC CONST ACPI_PARSER AestNodeInterrupt[] = {
{ L"Interrupt Type", 1, 0, L"%d", NULL, NULL, ValidateInterruptType, NULL },
{ L"Reserved", 2, 1, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Interrupt Flags", 1, 3, L"0x%x", NULL, NULL, ValidateInterruptFlags, NULL },
{ L"Interrupt GSIV", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"ID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved1", 3, 9, L"%x %x %x", Dump3Chars, NULL, NULL, NULL }
};
/**
@ -318,11 +320,11 @@ STATIC CONST ACPI_PARSER AestNodeInterrupt[] = {
STATIC
VOID
DumpProcessorNode (
IN UINT8* Ptr,
IN UINT32 Length
IN UINT8 *Ptr,
IN UINT32 Length
)
{
UINT32 Offset;
UINT32 Offset;
Offset = ParseAcpi (
TRUE,
@ -337,7 +339,8 @@ DumpProcessorNode (
// successfully read.
if ((ProcessorId == NULL) ||
(ProcessorResourceType == NULL) ||
(ProcessorFlags == NULL)) {
(ProcessorFlags == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient Processor Error Node length. Length = %d.\n",
@ -393,8 +396,8 @@ DumpProcessorNode (
STATIC
VOID
DumpMemoryControllerNode (
IN UINT8* Ptr,
IN UINT32 Length
IN UINT8 *Ptr,
IN UINT32 Length
)
{
ParseAcpi (
@ -416,8 +419,8 @@ DumpMemoryControllerNode (
STATIC
VOID
DumpSmmuNode (
IN UINT8* Ptr,
IN UINT32 Length
IN UINT8 *Ptr,
IN UINT32 Length
)
{
ParseAcpi (
@ -439,8 +442,8 @@ DumpSmmuNode (
STATIC
VOID
DumpVendorDefinedNode (
IN UINT8* Ptr,
IN UINT32 Length
IN UINT8 *Ptr,
IN UINT32 Length
)
{
ParseAcpi (
@ -462,8 +465,8 @@ DumpVendorDefinedNode (
STATIC
VOID
DumpGicNode (
IN UINT8* Ptr,
IN UINT32 Length
IN UINT8 *Ptr,
IN UINT32 Length
)
{
ParseAcpi (
@ -485,8 +488,8 @@ DumpGicNode (
STATIC
VOID
DumpNodeInterface (
IN UINT8* Ptr,
IN UINT32 Length
IN UINT8 *Ptr,
IN UINT32 Length
)
{
ParseAcpi (
@ -509,19 +512,19 @@ DumpNodeInterface (
STATIC
VOID
DumpNodeInterrupts (
IN UINT8* Ptr,
IN UINT32 Length,
IN UINT32 InterruptCount
IN UINT8 *Ptr,
IN UINT32 Length,
IN UINT32 InterruptCount
)
{
UINT32 Offset;
UINT32 Index;
CHAR8 Buffer[64];
UINT32 Offset;
UINT32 Index;
CHAR8 Buffer[64];
if (Length < (InterruptCount * sizeof (EFI_ACPI_AEST_INTERRUPT_STRUCT))) {
IncrementErrorCount ();
Print (
L"ERROR: Node not long enough for Interrupt Array.\n"\
L"ERROR: Node not long enough for Interrupt Array.\n" \
L" Length left = %d, Required = %d, Interrupt Count = %d\n",
Length,
(InterruptCount * sizeof (EFI_ACPI_AEST_INTERRUPT_STRUCT)),
@ -547,7 +550,7 @@ DumpNodeInterrupts (
Length - Offset,
PARSER_PARAMS (AestNodeInterrupt)
);
} //for
} // for
}
/**
@ -564,7 +567,7 @@ DumpNodeInterrupts (
STATIC
VOID
DumpAestNodeStructure (
IN UINT8* Ptr,
IN UINT8 *Ptr,
IN UINT32 Length,
IN UINT8 NodeType,
IN UINT32 DataOffset,
@ -573,9 +576,9 @@ DumpAestNodeStructure (
IN UINT32 InterruptCount
)
{
UINT32 Offset;
UINT32 RemainingLength;
UINT8* NodeDataPtr;
UINT32 Offset;
UINT32 RemainingLength;
UINT8 *NodeDataPtr;
Offset = ParseAcpi (
TRUE,
@ -589,7 +592,7 @@ DumpAestNodeStructure (
if ((Offset > DataOffset) || (DataOffset > Length)) {
IncrementErrorCount ();
Print (
L"ERROR: Invalid Node Data Offset: %d.\n"\
L"ERROR: Invalid Node Data Offset: %d.\n" \
L" It should be between %d and %d.\n",
DataOffset,
Offset,
@ -600,7 +603,7 @@ DumpAestNodeStructure (
if ((Offset > InterfaceOffset) || (InterfaceOffset > Length)) {
IncrementErrorCount ();
Print (
L"ERROR: Invalid Node Interface Offset: %d.\n"\
L"ERROR: Invalid Node Interface Offset: %d.\n" \
L" It should be between %d and %d.\n",
InterfaceOffset,
Offset,
@ -611,7 +614,7 @@ DumpAestNodeStructure (
if ((Offset > InterruptArrayOffset) || (InterruptArrayOffset > Length)) {
IncrementErrorCount ();
Print (
L"ERROR: Invalid Node Interrupt Array Offset: %d.\n"\
L"ERROR: Invalid Node Interrupt Array Offset: %d.\n" \
L" It should be between %d and %d.\n",
InterruptArrayOffset,
Offset,
@ -620,7 +623,7 @@ DumpAestNodeStructure (
}
// Parse Node Data Field.
NodeDataPtr = Ptr + DataOffset;
NodeDataPtr = Ptr + DataOffset;
RemainingLength = Length - DataOffset;
switch (NodeType) {
case EFI_ACPI_AEST_NODE_TYPE_PROCESSOR:
@ -675,14 +678,14 @@ DumpAestNodeStructure (
VOID
EFIAPI
ParseAcpiAest (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
UINT32 Offset;
UINT8* NodePtr;
UINT8 *NodePtr;
if (!Trace) {
return;
@ -716,10 +719,11 @@ ParseAcpiAest (
(NodeDataOffset == NULL) ||
(NodeInterfaceOffset == NULL) ||
(NodeInterruptArrayOffset == NULL) ||
(NodeInterruptCount == NULL)) {
(NodeInterruptCount == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient length left for Node Structure.\n"\
L"ERROR: Insufficient length left for Node Structure.\n" \
L" Length left = %d.\n",
AcpiTableLength - Offset
);
@ -728,11 +732,12 @@ ParseAcpiAest (
// Validate AEST Node length
if ((*AestNodeLength == 0) ||
((Offset + (*AestNodeLength)) > AcpiTableLength)) {
((Offset + (*AestNodeLength)) > AcpiTableLength))
{
IncrementErrorCount ();
Print (
L"ERROR: Invalid AEST Node length. " \
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*AestNodeLength,
Offset,
AcpiTableLength

View File

@ -14,19 +14,19 @@
#include "AcpiTableParser.h"
// Local variables
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
An ACPI_PARSER array describing the ACPI BDRT Table.
**/
STATIC CONST ACPI_PARSER BgrtParser[] = {
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}
{ 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 }
};
/**
@ -44,10 +44,10 @@ STATIC CONST ACPI_PARSER BgrtParser[] = {
VOID
EFIAPI
ParseAcpiBgrt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
if (!Trace) {

View File

@ -14,17 +14,17 @@
#include "AcpiTableParser.h"
// Local variables pointing to the table fields
STATIC CONST UINT32* OffsetDbgDeviceInfo;
STATIC CONST UINT32* NumberDbgDeviceInfo;
STATIC CONST UINT16* DbgDevInfoLen;
STATIC CONST UINT8* GasCount;
STATIC CONST UINT16* NameSpaceStringLength;
STATIC CONST UINT16* NameSpaceStringOffset;
STATIC CONST UINT16* OEMDataLength;
STATIC CONST UINT16* OEMDataOffset;
STATIC CONST UINT16* BaseAddrRegOffset;
STATIC CONST UINT16* AddrSizeOffset;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC CONST UINT32 *OffsetDbgDeviceInfo;
STATIC CONST UINT32 *NumberDbgDeviceInfo;
STATIC CONST UINT16 *DbgDevInfoLen;
STATIC CONST UINT8 *GasCount;
STATIC CONST UINT16 *NameSpaceStringLength;
STATIC CONST UINT16 *NameSpaceStringOffset;
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.
@ -37,64 +37,64 @@ STATIC
VOID
EFIAPI
ValidateNameSpaceStrLen (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
UINT16 NameSpaceStrLen;
UINT16 NameSpaceStrLen;
NameSpaceStrLen = *(UINT16*)Ptr;
NameSpaceStrLen = *(UINT16 *)Ptr;
if (NameSpaceStrLen < 2) {
IncrementErrorCount ();
Print (
L"\nERROR: NamespaceString Length = %d. If no Namespace device exists, " \
L"NamespaceString[] must contain a period '.'",
L"NamespaceString[] must contain a period '.'",
NameSpaceStrLen
);
}
}
/// An ACPI_PARSER array describing the ACPI DBG2 table.
STATIC CONST ACPI_PARSER Dbg2Parser[] = {
STATIC CONST ACPI_PARSER Dbg2Parser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo),
{L"OffsetDbgDeviceInfo", 4, 36, L"0x%x", NULL,
(VOID**)&OffsetDbgDeviceInfo, NULL, NULL},
{L"NumberDbgDeviceInfo", 4, 40, L"%d", NULL,
(VOID**)&NumberDbgDeviceInfo, NULL, NULL}
{ L"OffsetDbgDeviceInfo", 4, 36, L"0x%x", NULL,
(VOID **)&OffsetDbgDeviceInfo, NULL, NULL },
{ L"NumberDbgDeviceInfo", 4, 40, L"%d", NULL,
(VOID **)&NumberDbgDeviceInfo, NULL, NULL }
};
/// An ACPI_PARSER array describing the debug device information structure
/// header.
STATIC CONST ACPI_PARSER DbgDevInfoHeaderParser[] = {
{L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
{L"Length", 2, 1, L"%d", NULL, (VOID**)&DbgDevInfoLen, NULL, NULL}
STATIC CONST ACPI_PARSER DbgDevInfoHeaderParser[] = {
{ L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length", 2, 1, L"%d", NULL, (VOID **)&DbgDevInfoLen, NULL, NULL }
};
/// An ACPI_PARSER array describing the debug device information.
STATIC CONST ACPI_PARSER DbgDevInfoParser[] = {
{L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
{L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL},
STATIC CONST ACPI_PARSER DbgDevInfoParser[] = {
{ L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL },
{L"Generic Address Registers Count", 1, 3, L"0x%x", NULL,
(VOID**)&GasCount, NULL, NULL},
{L"NameSpace String Length", 2, 4, L"%d", NULL,
(VOID**)&NameSpaceStringLength, ValidateNameSpaceStrLen, NULL},
{L"NameSpace String Offset", 2, 6, L"0x%x", NULL,
(VOID**)&NameSpaceStringOffset, NULL, NULL},
{L"OEM Data Length", 2, 8, L"%d", NULL, (VOID**)&OEMDataLength,
NULL, NULL},
{L"OEM Data Offset", 2, 10, L"0x%x", NULL, (VOID**)&OEMDataOffset,
NULL, NULL},
{ L"Generic Address Registers Count", 1, 3, L"0x%x", NULL,
(VOID **)&GasCount, NULL, NULL },
{ L"NameSpace String Length", 2, 4, L"%d", NULL,
(VOID **)&NameSpaceStringLength, ValidateNameSpaceStrLen, NULL },
{ L"NameSpace String Offset", 2, 6, L"0x%x", NULL,
(VOID **)&NameSpaceStringOffset, NULL, NULL },
{ L"OEM Data Length", 2, 8, L"%d", NULL, (VOID **)&OEMDataLength,
NULL, NULL },
{ L"OEM Data Offset", 2, 10, L"0x%x", NULL, (VOID **)&OEMDataOffset,
NULL, NULL },
{L"Port Type", 2, 12, L"0x%x", NULL, NULL, NULL, NULL},
{L"Port SubType", 2, 14, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 2, 16, L"%x", NULL, NULL, NULL, NULL},
{ L"Port Type", 2, 12, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Port SubType", 2, 14, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 2, 16, L"%x", NULL, NULL, NULL, NULL },
{L"Base Address Register Offset", 2, 18, L"0x%x", NULL,
(VOID**)&BaseAddrRegOffset, NULL, NULL},
{L"Address Size Offset", 2, 20, L"0x%x", NULL,
(VOID**)&AddrSizeOffset, NULL, NULL}
{ L"Base Address Register Offset", 2, 18, L"0x%x", NULL,
(VOID **)&BaseAddrRegOffset, NULL, NULL },
{ L"Address Size Offset", 2, 20, L"0x%x", NULL,
(VOID **)&AddrSizeOffset, NULL, NULL }
};
/**
@ -107,8 +107,8 @@ STATIC
VOID
EFIAPI
DumpDbgDeviceInfo (
IN UINT8* Ptr,
IN UINT16 Length
IN UINT8 *Ptr,
IN UINT16 Length
)
{
UINT16 Index;
@ -131,21 +131,23 @@ DumpDbgDeviceInfo (
(OEMDataLength == NULL) ||
(OEMDataOffset == NULL) ||
(BaseAddrRegOffset == NULL) ||
(AddrSizeOffset == NULL)) {
(AddrSizeOffset == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient Debug Device Information Structure length. " \
L"Length = %d.\n",
L"Length = %d.\n",
Length
);
return;
}
// GAS
Index = 0;
Index = 0;
Offset = *BaseAddrRegOffset;
while ((Index++ < *GasCount) &&
(Offset < Length)) {
(Offset < Length))
{
PrintFieldName (4, L"BaseAddressRegister");
Offset += (UINT16)DumpGasStruct (
Ptr + Offset,
@ -160,7 +162,7 @@ DumpDbgDeviceInfo (
IncrementErrorCount ();
Print (
L"ERROR: Invalid GAS count. GasCount = %d. RemainingBufferLength = %d. " \
L"Parsing of the Debug Device Information structure aborted.\n",
L"Parsing of the Debug Device Information structure aborted.\n",
*GasCount,
Length - *AddrSizeOffset
);
@ -168,39 +170,45 @@ DumpDbgDeviceInfo (
}
// Address Size
Index = 0;
Index = 0;
Offset = *AddrSizeOffset;
while ((Index++ < *GasCount) &&
(Offset < Length)) {
(Offset < Length))
{
PrintFieldName (4, L"Address Size");
Print (L"0x%x\n", *((UINT32*)(Ptr + Offset)));
Print (L"0x%x\n", *((UINT32 *)(Ptr + Offset)));
Offset += sizeof (UINT32);
}
// NameSpace String
Index = 0;
Index = 0;
Offset = *NameSpaceStringOffset;
PrintFieldName (4, L"NameSpace String");
while ((Index++ < *NameSpaceStringLength) &&
(Offset < Length)) {
(Offset < Length))
{
Print (L"%c", *(Ptr + Offset));
Offset++;
}
Print (L"\n");
// OEM Data
if (*OEMDataOffset != 0) {
Index = 0;
Index = 0;
Offset = *OEMDataOffset;
PrintFieldName (4, L"OEM Data");
while ((Index++ < *OEMDataLength) &&
(Offset < Length)) {
(Offset < Length))
{
Print (L"%x ", *(Ptr + Offset));
if ((Index & 7) == 0) {
Print (L"\n%-*s ", OUTPUT_FIELD_COLUMN_WIDTH, L"");
}
Offset++;
}
Print (L"\n");
}
}
@ -220,14 +228,14 @@ DumpDbgDeviceInfo (
VOID
EFIAPI
ParseAcpiDbg2 (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
UINT32 Offset;
UINT32 Index;
UINT32 Offset;
UINT32 Index;
if (!Trace) {
return;
@ -245,7 +253,8 @@ ParseAcpiDbg2 (
// Check if the values used to control the parsing logic have been
// successfully read.
if ((OffsetDbgDeviceInfo == NULL) ||
(NumberDbgDeviceInfo == NULL)) {
(NumberDbgDeviceInfo == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient table length. AcpiTableLength = %d\n",
@ -255,10 +264,9 @@ ParseAcpiDbg2 (
}
Offset = *OffsetDbgDeviceInfo;
Index = 0;
Index = 0;
while (Index++ < *NumberDbgDeviceInfo) {
// Parse the Debug Device Information Structure header to obtain Length
ParseAcpi (
FALSE,
@ -275,8 +283,8 @@ ParseAcpiDbg2 (
IncrementErrorCount ();
Print (
L"ERROR: Insufficient remaining table buffer length to read the " \
L"Debug Device Information structure's 'Length' field. " \
L"RemainingTableBufferLength = %d.\n",
L"Debug Device Information structure's 'Length' field. " \
L"RemainingTableBufferLength = %d.\n",
AcpiTableLength - Offset
);
return;
@ -284,11 +292,12 @@ ParseAcpiDbg2 (
// Validate Debug Device Information Structure length
if ((*DbgDevInfoLen == 0) ||
((Offset + (*DbgDevInfoLen)) > AcpiTableLength)) {
((Offset + (*DbgDevInfoLen)) > AcpiTableLength))
{
IncrementErrorCount ();
Print (
L"ERROR: Invalid Debug Device Information Structure length. " \
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*DbgDevInfoLen,
Offset,
AcpiTableLength

View File

@ -28,10 +28,10 @@
VOID
EFIAPI
ParseAcpiDsdt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
if (!Trace) {

View File

@ -16,23 +16,23 @@
/**
An ACPI_PARSER array describing the ACPI FACS Table.
**/
STATIC CONST ACPI_PARSER FacsParser[] = {
{L"Signature", 4, 0, L"%c%c%c%c", Dump4Chars, NULL, NULL, NULL},
{L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL},
{L"Hardware Signature", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
{L"Firmware Waking Vector", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
{L"Global Lock", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
{L"Flags", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
{L"X Firmware Walking Vector", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Version", 1, 32, L"%d", NULL, NULL, NULL, NULL},
{L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},
{L"OSPM Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 8, 40, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
NULL},
{L"Reserved", 8, 48, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
NULL},
{L"Reserved", 8, 56, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
NULL}
STATIC CONST ACPI_PARSER FacsParser[] = {
{ L"Signature", 4, 0, L"%c%c%c%c", Dump4Chars, NULL, NULL, NULL },
{ L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL },
{ L"Hardware Signature", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Firmware Waking Vector", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Global Lock", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Flags", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
{ L"X Firmware Walking Vector", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Version", 1, 32, L"%d", NULL, NULL, NULL, NULL },
{ L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL },
{ L"OSPM Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 8, 40, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
NULL },
{ L"Reserved", 8, 48, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
NULL },
{ L"Reserved", 8, 56, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,
NULL }
};
/**
@ -50,10 +50,10 @@ STATIC CONST ACPI_PARSER FacsParser[] = {
VOID
EFIAPI
ParseAcpiFacs (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
if (!Trace) {

View File

@ -15,33 +15,33 @@
#include "AcpiView.h"
// Local variables
STATIC CONST UINT32* DsdtAddress;
STATIC CONST UINT64* X_DsdtAddress;
STATIC CONST UINT32* Flags;
STATIC CONST UINT32* FirmwareCtrl;
STATIC CONST UINT64* X_FirmwareCtrl;
STATIC CONST UINT8* FadtMinorRevision;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC CONST UINT32 *DsdtAddress;
STATIC CONST UINT64 *X_DsdtAddress;
STATIC CONST UINT32 *Flags;
STATIC CONST UINT32 *FirmwareCtrl;
STATIC CONST UINT64 *X_FirmwareCtrl;
STATIC CONST UINT8 *FadtMinorRevision;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
A macro defining the Hardware reduced ACPI flag
**/
#define HW_REDUCED_ACPI BIT20
#define HW_REDUCED_ACPI BIT20
/**
Offset to the FACS signature from the start of the FACS.
**/
#define FACS_SIGNATURE_OFFSET 0
#define FACS_SIGNATURE_OFFSET 0
/**
Offset to the FACS revision from the start of the FACS.
**/
#define FACS_VERSION_OFFSET 32
#define FACS_VERSION_OFFSET 32
/**
Offset to the FACS length from the start of the FACS.
**/
#define FACS_LENGTH_OFFSET 4
#define FACS_LENGTH_OFFSET 4
/**
Get the ACPI XSDT header info.
@ -63,18 +63,19 @@ STATIC
VOID
EFIAPI
ValidateFirmwareCtrl (
IN UINT8* Ptr,
IN VOID* Context
)
IN UINT8 *Ptr,
IN VOID *Context
)
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
if (*(UINT32*)Ptr != 0) {
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
if (*(UINT32 *)Ptr != 0) {
IncrementErrorCount ();
Print (
L"\nERROR: Firmware Control must be zero for ARM platforms."
);
);
}
#endif
#endif
}
/**
@ -88,18 +89,19 @@ STATIC
VOID
EFIAPI
ValidateXFirmwareCtrl (
IN UINT8* Ptr,
IN VOID* Context
)
IN UINT8 *Ptr,
IN VOID *Context
)
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
if (*(UINT64*)Ptr != 0) {
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
if (*(UINT64 *)Ptr != 0) {
IncrementErrorCount ();
Print (
L"\nERROR: X Firmware Control must be zero for ARM platforms."
);
);
}
#endif
#endif
}
/**
@ -113,83 +115,84 @@ STATIC
VOID
EFIAPI
ValidateFlags (
IN UINT8* Ptr,
IN VOID* Context
)
IN UINT8 *Ptr,
IN VOID *Context
)
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
if (((*(UINT32*)Ptr) & HW_REDUCED_ACPI) == 0) {
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
if (((*(UINT32 *)Ptr) & HW_REDUCED_ACPI) == 0) {
IncrementErrorCount ();
Print (
L"\nERROR: HW_REDUCED_ACPI flag must be set for ARM platforms."
);
);
}
#endif
#endif
}
/**
An ACPI_PARSER array describing the ACPI FADT Table.
**/
STATIC CONST ACPI_PARSER FadtParser[] = {
STATIC CONST ACPI_PARSER FadtParser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo),
{L"FIRMWARE_CTRL", 4, 36, L"0x%x", NULL, (VOID**)&FirmwareCtrl,
ValidateFirmwareCtrl, NULL},
{L"DSDT", 4, 40, L"0x%x", NULL, (VOID**)&DsdtAddress, NULL, NULL},
{L"Reserved", 1, 44, L"%x", NULL, NULL, NULL, NULL},
{L"Preferred_PM_Profile", 1, 45, L"0x%x", NULL, NULL, NULL, NULL},
{L"SCI_INT", 2, 46, L"0x%x", NULL, NULL, NULL, NULL},
{L"SMI_CMD", 4, 48, L"0x%x", NULL, NULL, NULL, NULL},
{L"ACPI_ENABLE", 1, 52, L"0x%x", NULL, NULL, NULL, NULL},
{L"ACPI_DISABLE", 1, 53, L"0x%x", NULL, NULL, NULL, NULL},
{L"S4BIOS_REQ", 1, 54, L"0x%x", NULL, NULL, NULL, NULL},
{L"PSTATE_CNT", 1, 55, L"0x%x", NULL, NULL, NULL, NULL},
{L"PM1a_EVT_BLK", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},
{L"PM1b_EVT_BLK", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},
{L"PM1a_CNT_BLK", 4, 64, L"0x%x", NULL, NULL, NULL, NULL},
{L"PM1b_CNT_BLK", 4, 68, L"0x%x", NULL, NULL, NULL, NULL},
{L"PM2_CNT_BLK", 4, 72, L"0x%x", NULL, NULL, NULL, NULL},
{L"PM_TMR_BLK", 4, 76, L"0x%x", NULL, NULL, NULL, NULL},
{L"GPE0_BLK", 4, 80, L"0x%x", NULL, NULL, NULL, NULL},
{L"GPE1_BLK", 4, 84, L"0x%x", NULL, NULL, NULL, NULL},
{L"PM1_EVT_LEN", 1, 88, L"0x%x", NULL, NULL, NULL, NULL},
{L"PM1_CNT_LEN", 1, 89, L"0x%x", NULL, NULL, NULL, NULL},
{L"PM2_CNT_LEN", 1, 90, L"0x%x", NULL, NULL, NULL, NULL},
{L"PM_TMR_LEN", 1, 91, L"0x%x", NULL, NULL, NULL, NULL},
{L"GPE0_BLK_LEN", 1, 92, L"0x%x", NULL, NULL, NULL, NULL},
{L"GPE1_BLK_LEN", 1, 93, L"0x%x", NULL, NULL, NULL, NULL},
{L"GPE1_BASE", 1, 94, L"0x%x", NULL, NULL, NULL, NULL},
{L"CST_CNT", 1, 95, L"0x%x", NULL, NULL, NULL, NULL},
{L"P_LVL2_LAT", 2, 96, L"0x%x", NULL, NULL, NULL, NULL},
{L"P_LVL3_LAT", 2, 98, L"0x%x", NULL, NULL, NULL, NULL},
{L"FLUSH_SIZE", 2, 100, L"0x%x", NULL, NULL, NULL, NULL},
{L"FLUSH_STRIDE", 2, 102, L"0x%x", NULL, NULL, NULL, NULL},
{L"DUTY_OFFSET", 1, 104, L"0x%x", NULL, NULL, NULL, NULL},
{L"DUTY_WIDTH", 1, 105, L"0x%x", NULL, NULL, NULL, NULL},
{L"DAY_ALRM", 1, 106, L"0x%x", NULL, NULL, NULL, NULL},
{L"MON_ALRM", 1, 107, L"0x%x", NULL, NULL, NULL, NULL},
{L"CENTURY", 1, 108, L"0x%x", NULL, NULL, NULL, NULL},
{L"IAPC_BOOT_ARCH", 2, 109, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 1, 111, L"0x%x", NULL, NULL, NULL, NULL},
{L"Flags", 4, 112, L"0x%x", NULL, (VOID**)&Flags, ValidateFlags, NULL},
{L"RESET_REG", 12, 116, NULL, DumpGas, NULL, NULL, NULL},
{L"RESET_VALUE", 1, 128, L"0x%x", NULL, NULL, NULL, NULL},
{L"ARM_BOOT_ARCH", 2, 129, L"0x%x", NULL, NULL, NULL, NULL},
{L"FADT Minor Version", 1, 131, L"0x%x", NULL, (VOID**)&FadtMinorRevision,
NULL, NULL},
{L"X_FIRMWARE_CTRL", 8, 132, L"0x%lx", NULL, (VOID**)&X_FirmwareCtrl,
ValidateXFirmwareCtrl, NULL},
{L"X_DSDT", 8, 140, L"0x%lx", NULL, (VOID**)&X_DsdtAddress, NULL, NULL},
{L"X_PM1a_EVT_BLK", 12, 148, NULL, DumpGas, NULL, NULL, NULL},
{L"X_PM1b_EVT_BLK", 12, 160, NULL, DumpGas, NULL, NULL, NULL},
{L"X_PM1a_CNT_BLK", 12, 172, NULL, DumpGas, NULL, NULL, NULL},
{L"X_PM1b_CNT_BLK", 12, 184, NULL, DumpGas, NULL, NULL, NULL},
{L"X_PM2_CNT_BLK", 12, 196, NULL, DumpGas, NULL, NULL, NULL},
{L"X_PM_TMR_BLK", 12, 208, NULL, DumpGas, NULL, NULL, NULL},
{L"X_GPE0_BLK", 12, 220, NULL, DumpGas, NULL, NULL, NULL},
{L"X_GPE1_BLK", 12, 232, NULL, DumpGas, NULL, NULL, NULL},
{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}
{ L"FIRMWARE_CTRL", 4, 36, L"0x%x", NULL, (VOID **)&FirmwareCtrl,
ValidateFirmwareCtrl, NULL },
{ L"DSDT", 4, 40, L"0x%x", NULL, (VOID **)&DsdtAddress, NULL, NULL },
{ L"Reserved", 1, 44, L"%x", NULL, NULL, NULL, NULL },
{ L"Preferred_PM_Profile", 1, 45, L"0x%x", NULL, NULL, NULL, NULL },
{ L"SCI_INT", 2, 46, L"0x%x", NULL, NULL, NULL, NULL },
{ L"SMI_CMD", 4, 48, L"0x%x", NULL, NULL, NULL, NULL },
{ L"ACPI_ENABLE", 1, 52, L"0x%x", NULL, NULL, NULL, NULL },
{ L"ACPI_DISABLE", 1, 53, L"0x%x", NULL, NULL, NULL, NULL },
{ L"S4BIOS_REQ", 1, 54, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PSTATE_CNT", 1, 55, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PM1a_EVT_BLK", 4, 56, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PM1b_EVT_BLK", 4, 60, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PM1a_CNT_BLK", 4, 64, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PM1b_CNT_BLK", 4, 68, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PM2_CNT_BLK", 4, 72, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PM_TMR_BLK", 4, 76, L"0x%x", NULL, NULL, NULL, NULL },
{ L"GPE0_BLK", 4, 80, L"0x%x", NULL, NULL, NULL, NULL },
{ L"GPE1_BLK", 4, 84, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PM1_EVT_LEN", 1, 88, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PM1_CNT_LEN", 1, 89, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PM2_CNT_LEN", 1, 90, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PM_TMR_LEN", 1, 91, L"0x%x", NULL, NULL, NULL, NULL },
{ L"GPE0_BLK_LEN", 1, 92, L"0x%x", NULL, NULL, NULL, NULL },
{ L"GPE1_BLK_LEN", 1, 93, L"0x%x", NULL, NULL, NULL, NULL },
{ L"GPE1_BASE", 1, 94, L"0x%x", NULL, NULL, NULL, NULL },
{ L"CST_CNT", 1, 95, L"0x%x", NULL, NULL, NULL, NULL },
{ L"P_LVL2_LAT", 2, 96, L"0x%x", NULL, NULL, NULL, NULL },
{ L"P_LVL3_LAT", 2, 98, L"0x%x", NULL, NULL, NULL, NULL },
{ L"FLUSH_SIZE", 2, 100, L"0x%x", NULL, NULL, NULL, NULL },
{ L"FLUSH_STRIDE", 2, 102, L"0x%x", NULL, NULL, NULL, NULL },
{ L"DUTY_OFFSET", 1, 104, L"0x%x", NULL, NULL, NULL, NULL },
{ L"DUTY_WIDTH", 1, 105, L"0x%x", NULL, NULL, NULL, NULL },
{ L"DAY_ALRM", 1, 106, L"0x%x", NULL, NULL, NULL, NULL },
{ L"MON_ALRM", 1, 107, L"0x%x", NULL, NULL, NULL, NULL },
{ L"CENTURY", 1, 108, L"0x%x", NULL, NULL, NULL, NULL },
{ L"IAPC_BOOT_ARCH", 2, 109, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 1, 111, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Flags", 4, 112, L"0x%x", NULL, (VOID **)&Flags, ValidateFlags, NULL },
{ L"RESET_REG", 12, 116, NULL, DumpGas, NULL, NULL, NULL },
{ L"RESET_VALUE", 1, 128, L"0x%x", NULL, NULL, NULL, NULL },
{ L"ARM_BOOT_ARCH", 2, 129, L"0x%x", NULL, NULL, NULL, NULL },
{ L"FADT Minor Version", 1, 131, L"0x%x", NULL, (VOID **)&FadtMinorRevision,
NULL, NULL },
{ L"X_FIRMWARE_CTRL", 8, 132, L"0x%lx", NULL, (VOID **)&X_FirmwareCtrl,
ValidateXFirmwareCtrl, NULL },
{ L"X_DSDT", 8, 140, L"0x%lx", NULL, (VOID **)&X_DsdtAddress, NULL, NULL },
{ L"X_PM1a_EVT_BLK", 12, 148, NULL, DumpGas, NULL, NULL, NULL },
{ L"X_PM1b_EVT_BLK", 12, 160, NULL, DumpGas, NULL, NULL, NULL },
{ L"X_PM1a_CNT_BLK", 12, 172, NULL, DumpGas, NULL, NULL, NULL },
{ L"X_PM1b_CNT_BLK", 12, 184, NULL, DumpGas, NULL, NULL, NULL },
{ L"X_PM2_CNT_BLK", 12, 196, NULL, DumpGas, NULL, NULL, NULL },
{ L"X_PM_TMR_BLK", 12, 208, NULL, DumpGas, NULL, NULL, NULL },
{ L"X_GPE0_BLK", 12, 220, NULL, DumpGas, NULL, NULL, NULL },
{ L"X_GPE1_BLK", 12, 232, NULL, DumpGas, NULL, NULL, NULL },
{ 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 }
};
/**
@ -206,19 +209,19 @@ STATIC CONST ACPI_PARSER FadtParser[] = {
VOID
EFIAPI
ParseAcpiFadt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
EFI_STATUS Status;
UINT8* DsdtPtr;
UINT8* FirmwareCtrlPtr;
UINT32 FacsSignature;
UINT32 FacsLength;
UINT8 FacsRevision;
PARSE_ACPI_TABLE_PROC FacsParserProc;
EFI_STATUS Status;
UINT8 *DsdtPtr;
UINT8 *FirmwareCtrlPtr;
UINT32 FacsSignature;
UINT32 FacsLength;
UINT8 FacsRevision;
PARSE_ACPI_TABLE_PROC FacsParserProc;
ParseAcpi (
Trace,
@ -233,7 +236,7 @@ ParseAcpiFadt (
if (FadtMinorRevision != NULL) {
Print (L"\nSummary:\n");
PrintFieldName (2, L"FADT Version");
Print (L"%d.%d\n", *AcpiHdrInfo.Revision, *FadtMinorRevision);
Print (L"%d.%d\n", *AcpiHdrInfo.Revision, *FadtMinorRevision);
}
if (*GetAcpiXsdtHeaderInfo ()->OemTableId != *AcpiHdrInfo.OemTableId) {
@ -245,9 +248,9 @@ ParseAcpiFadt (
// If X_FIRMWARE_CTRL is not zero then use X_FIRMWARE_CTRL and ignore
// FIRMWARE_CTRL, else use FIRMWARE_CTRL.
if ((X_FirmwareCtrl != NULL) && (*X_FirmwareCtrl != 0)) {
FirmwareCtrlPtr = (UINT8*)(UINTN)(*X_FirmwareCtrl);
FirmwareCtrlPtr = (UINT8 *)(UINTN)(*X_FirmwareCtrl);
} else if ((FirmwareCtrl != NULL) && (*FirmwareCtrl != 0)) {
FirmwareCtrlPtr = (UINT8*)(UINTN)(*FirmwareCtrl);
FirmwareCtrlPtr = (UINT8 *)(UINTN)(*FirmwareCtrl);
} else {
FirmwareCtrlPtr = NULL;
// if HW_REDUCED_ACPI flag is not set, both FIRMWARE_CTRL and
@ -255,10 +258,13 @@ ParseAcpiFadt (
// present.
if ((Trace) &&
(Flags != NULL) &&
((*Flags & EFI_ACPI_6_3_HW_REDUCED_ACPI) != EFI_ACPI_6_3_HW_REDUCED_ACPI)) {
((*Flags & EFI_ACPI_6_3_HW_REDUCED_ACPI) != EFI_ACPI_6_3_HW_REDUCED_ACPI))
{
IncrementErrorCount ();
Print (L"ERROR: No FACS table found, "
L"both X_FIRMWARE_CTRL and FIRMWARE_CTRL are zero.\n");
Print (
L"ERROR: No FACS table found, "
L"both X_FIRMWARE_CTRL and FIRMWARE_CTRL are zero.\n"
);
}
}
@ -266,13 +272,13 @@ ParseAcpiFadt (
// The FACS table does not have a standard ACPI table header. Therefore,
// the signature, length and version needs to be initially parsed.
// The FACS signature is 4 bytes starting at offset 0.
FacsSignature = *(UINT32*)(FirmwareCtrlPtr + FACS_SIGNATURE_OFFSET);
FacsSignature = *(UINT32 *)(FirmwareCtrlPtr + FACS_SIGNATURE_OFFSET);
// The FACS length is 4 bytes starting at offset 4.
FacsLength = *(UINT32*)(FirmwareCtrlPtr + FACS_LENGTH_OFFSET);
FacsLength = *(UINT32 *)(FirmwareCtrlPtr + FACS_LENGTH_OFFSET);
// The FACS version is 1 byte starting at offset 32.
FacsRevision = *(UINT8*)(FirmwareCtrlPtr + FACS_VERSION_OFFSET);
FacsRevision = *(UINT8 *)(FirmwareCtrlPtr + FACS_VERSION_OFFSET);
Trace = ProcessTableReportOptions (
FacsSignature,
@ -298,12 +304,12 @@ ParseAcpiFadt (
// If X_DSDT is valid then use X_DSDT and ignore DSDT, else use DSDT.
if ((X_DsdtAddress != NULL) && (*X_DsdtAddress != 0)) {
DsdtPtr = (UINT8*)(UINTN)(*X_DsdtAddress);
DsdtPtr = (UINT8 *)(UINTN)(*X_DsdtAddress);
} else if ((DsdtAddress != NULL) && (*DsdtAddress != 0)) {
DsdtPtr = (UINT8*)(UINTN)(*DsdtAddress);
DsdtPtr = (UINT8 *)(UINTN)(*DsdtAddress);
} else {
// Both DSDT and X_DSDT cannot be invalid.
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
if (Trace) {
// The DSDT Table is mandatory for ARM systems
// as the CPU information MUST be presented in
@ -311,7 +317,8 @@ ParseAcpiFadt (
IncrementErrorCount ();
Print (L"ERROR: Both X_DSDT and DSDT are invalid.\n");
}
#endif
#endif
return;
}

View File

@ -15,16 +15,16 @@
#include "AcpiViewConfig.h"
// "The number of GT Block Timers must be less than or equal to 8"
#define GT_BLOCK_TIMER_COUNT_MAX 8
#define GT_BLOCK_TIMER_COUNT_MAX 8
// Local variables
STATIC CONST UINT32* GtdtPlatformTimerCount;
STATIC CONST UINT32* GtdtPlatformTimerOffset;
STATIC CONST UINT8* PlatformTimerType;
STATIC CONST UINT16* PlatformTimerLength;
STATIC CONST UINT32* GtBlockTimerCount;
STATIC CONST UINT32* GtBlockTimerOffset;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC CONST UINT32 *GtdtPlatformTimerCount;
STATIC CONST UINT32 *GtdtPlatformTimerOffset;
STATIC CONST UINT8 *PlatformTimerType;
STATIC CONST UINT16 *PlatformTimerLength;
STATIC CONST UINT32 *GtBlockTimerCount;
STATIC CONST UINT32 *GtBlockTimerOffset;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
This function validates the GT Block timer count.
@ -37,13 +37,13 @@ STATIC
VOID
EFIAPI
ValidateGtBlockTimerCount (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
UINT32 BlockTimerCount;
UINT32 BlockTimerCount;
BlockTimerCount = *(UINT32*)Ptr;
BlockTimerCount = *(UINT32 *)Ptr;
if (BlockTimerCount > GT_BLOCK_TIMER_COUNT_MAX) {
IncrementErrorCount ();
@ -66,13 +66,13 @@ STATIC
VOID
EFIAPI
ValidateGtFrameNumber (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
UINT8 FrameNumber;
UINT8 FrameNumber;
FrameNumber = *(UINT8*)Ptr;
FrameNumber = *(UINT8 *)Ptr;
if (FrameNumber >= GT_BLOCK_TIMER_COUNT_MAX) {
IncrementErrorCount ();
@ -87,82 +87,82 @@ ValidateGtFrameNumber (
/**
An ACPI_PARSER array describing the ACPI GTDT Table.
**/
STATIC CONST ACPI_PARSER GtdtParser[] = {
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},
{L"Secure EL1 timer GSIV", 4, 48, L"0x%x", NULL, NULL, NULL, NULL},
{L"Secure EL1 timer FLAGS", 4, 52, L"0x%x", NULL, NULL, NULL, NULL},
{ L"CntControlBase Physical Address",8, 36, L"0x%lx", NULL, NULL,
NULL, NULL },
{ L"Reserved", 4, 44, L"0x%x", NULL, NULL,NULL, NULL },
{ L"Secure EL1 timer GSIV", 4, 48, L"0x%x", NULL, NULL,NULL, NULL },
{ L"Secure EL1 timer FLAGS", 4, 52, L"0x%x", NULL, NULL,NULL, NULL },
{L"Non-Secure EL1 timer GSIV", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},
{L"Non-Secure EL1 timer FLAGS", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},
{ L"Non-Secure EL1 timer GSIV", 4, 56, L"0x%x", NULL, NULL,NULL, NULL },
{ L"Non-Secure EL1 timer FLAGS", 4, 60, L"0x%x", NULL, NULL,NULL, NULL },
{L"Virtual timer GSIV", 4, 64, L"0x%x", NULL, NULL, NULL, NULL},
{L"Virtual timer FLAGS", 4, 68, L"0x%x", NULL, NULL, NULL, NULL},
{ L"Virtual timer GSIV", 4, 64, L"0x%x", NULL, NULL,NULL, NULL },
{ L"Virtual timer FLAGS", 4, 68, L"0x%x", NULL, NULL,NULL, NULL },
{L"Non-Secure EL2 timer GSIV", 4, 72, L"0x%x", NULL, NULL, NULL, NULL},
{L"Non-Secure EL2 timer FLAGS", 4, 76, L"0x%x", NULL, NULL, NULL, NULL},
{ L"Non-Secure EL2 timer GSIV", 4, 72, L"0x%x", NULL, NULL,NULL, NULL },
{ L"Non-Secure EL2 timer FLAGS", 4, 76, L"0x%x", NULL, NULL,NULL, NULL },
{L"CntReadBase Physical address", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Platform Timer Count", 4, 88, L"%d", NULL,
(VOID**)&GtdtPlatformTimerCount, NULL, NULL},
{L"Platform Timer Offset", 4, 92, L"0x%x", NULL,
(VOID**)&GtdtPlatformTimerOffset, NULL, NULL},
{L"Virtual EL2 Timer GSIV", 4, 96, L"0x%x", NULL, NULL, NULL, NULL},
{L"Virtual EL2 Timer Flags", 4, 100, L"0x%x", NULL, NULL, NULL, NULL}
{ L"CntReadBase Physical address", 8, 80, L"0x%lx", NULL, NULL,NULL, NULL },
{ L"Platform Timer Count", 4, 88, L"%d", NULL,
(VOID **)&GtdtPlatformTimerCount, NULL, NULL },
{ L"Platform Timer Offset", 4, 92, L"0x%x", NULL,
(VOID **)&GtdtPlatformTimerOffset,NULL, NULL },
{ L"Virtual EL2 Timer GSIV", 4, 96, L"0x%x", NULL, NULL,NULL, NULL },
{ L"Virtual EL2 Timer Flags", 4, 100, L"0x%x", NULL, NULL,NULL, NULL }
};
/**
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}
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.
**/
STATIC CONST ACPI_PARSER GtBlockParser[] = {
{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"Physical address (CntCtlBase)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Timer Count", 4, 12, L"%d", NULL, (VOID**)&GtBlockTimerCount,
ValidateGtBlockTimerCount, NULL},
{L"Timer Offset", 4, 16, L"%d", NULL, (VOID**)&GtBlockTimerOffset, NULL,
NULL}
STATIC CONST ACPI_PARSER GtBlockParser[] = {
{ 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"Physical address (CntCtlBase)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Timer Count", 4, 12, L"%d", NULL, (VOID **)&GtBlockTimerCount,
ValidateGtBlockTimerCount, NULL },
{ L"Timer Offset", 4, 16, L"%d", NULL, (VOID **)&GtBlockTimerOffset, NULL,
NULL }
};
/**
An ACPI_PARSER array describing the GT Block timer.
**/
STATIC CONST ACPI_PARSER GtBlockTimerParser[] = {
{L"Frame Number", 1, 0, L"%d", NULL, NULL, ValidateGtFrameNumber, 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,
NULL},
{L"Physical Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
{L"Physical Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},
{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}
STATIC CONST ACPI_PARSER GtBlockTimerParser[] = {
{ L"Frame Number", 1, 0, L"%d", NULL, NULL, ValidateGtFrameNumber, 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,
NULL },
{ L"Physical Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Physical Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL },
{ 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.
**/
STATIC CONST ACPI_PARSER ArmGenericWatchdogParser[] = {
{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}
STATIC CONST ACPI_PARSER ArmGenericWatchdogParser[] = {
{ 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 }
};
/**
@ -174,12 +174,12 @@ STATIC CONST ACPI_PARSER ArmGenericWatchdogParser[] = {
STATIC
VOID
DumpGTBlock (
IN UINT8* Ptr,
IN UINT16 Length
IN UINT8 *Ptr,
IN UINT16 Length
)
{
UINT32 Index;
UINT32 Offset;
UINT32 Index;
UINT32 Offset;
ParseAcpi (
TRUE,
@ -193,7 +193,8 @@ DumpGTBlock (
// Check if the values used to control the parsing logic have been
// successfully read.
if ((GtBlockTimerCount == NULL) ||
(GtBlockTimerOffset == NULL)) {
(GtBlockTimerOffset == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient GT Block Structure length. Length = %d.\n",
@ -203,12 +204,13 @@ DumpGTBlock (
}
Offset = *GtBlockTimerOffset;
Index = 0;
Index = 0;
// Parse the specified number of GT Block Timer Structures or the GT Block
// Structure buffer length. Whichever is minimum.
while ((Index++ < *GtBlockTimerCount) &&
(Offset < Length)) {
(Offset < Length))
{
Offset += ParseAcpi (
TRUE,
2,
@ -229,8 +231,8 @@ DumpGTBlock (
STATIC
VOID
DumpWatchdogTimer (
IN UINT8* Ptr,
IN UINT16 Length
IN UINT8 *Ptr,
IN UINT16 Length
)
{
ParseAcpi (
@ -262,15 +264,15 @@ DumpWatchdogTimer (
VOID
EFIAPI
ParseAcpiGtdt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
UINT32 Index;
UINT32 Offset;
UINT8* TimerPtr;
UINT32 Index;
UINT32 Offset;
UINT8 *TimerPtr;
if (!Trace) {
return;
@ -288,7 +290,8 @@ ParseAcpiGtdt (
// Check if the values used to control the parsing logic have been
// successfully read.
if ((GtdtPlatformTimerCount == NULL) ||
(GtdtPlatformTimerOffset == NULL)) {
(GtdtPlatformTimerOffset == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
@ -298,13 +301,14 @@ ParseAcpiGtdt (
}
TimerPtr = Ptr + *GtdtPlatformTimerOffset;
Offset = *GtdtPlatformTimerOffset;
Index = 0;
Offset = *GtdtPlatformTimerOffset;
Index = 0;
// Parse the specified number of Platform Timer Structures or the GTDT
// buffer length. Whichever is minimum.
while ((Index++ < *GtdtPlatformTimerCount) &&
(Offset < AcpiTableLength)) {
(Offset < AcpiTableLength))
{
// Parse the Platform Timer Header to obtain Length and Type
ParseAcpi (
FALSE,
@ -318,11 +322,12 @@ ParseAcpiGtdt (
// Check if the values used to control the parsing logic have been
// successfully read.
if ((PlatformTimerType == NULL) ||
(PlatformTimerLength == NULL)) {
(PlatformTimerLength == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient remaining table buffer length to read the " \
L"Platform Timer Structure header. Length = %d.\n",
L"Platform Timer Structure header. Length = %d.\n",
AcpiTableLength - Offset
);
return;
@ -330,11 +335,12 @@ ParseAcpiGtdt (
// Validate Platform Timer Structure length
if ((*PlatformTimerLength == 0) ||
((Offset + (*PlatformTimerLength)) > AcpiTableLength)) {
((Offset + (*PlatformTimerLength)) > AcpiTableLength))
{
IncrementErrorCount ();
Print (
L"ERROR: Invalid Platform Timer Structure length. " \
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*PlatformTimerLength,
Offset,
AcpiTableLength
@ -359,6 +365,6 @@ ParseAcpiGtdt (
} // switch
TimerPtr += *PlatformTimerLength;
Offset += *PlatformTimerLength;
Offset += *PlatformTimerLength;
} // while
}

View File

@ -21,27 +21,27 @@
#include "AcpiView.h"
// Maximum Memory Domain matrix print size.
#define MAX_MEMORY_DOMAIN_TARGET_PRINT_MATRIX 10
#define MAX_MEMORY_DOMAIN_TARGET_PRINT_MATRIX 10
// Local variables
STATIC CONST UINT16* HmatStructureType;
STATIC CONST UINT32* HmatStructureLength;
STATIC CONST UINT16 *HmatStructureType;
STATIC CONST UINT32 *HmatStructureLength;
STATIC CONST UINT32* NumberInitiatorProximityDomain;
STATIC CONST UINT32* NumberTargetProximityDomain;
STATIC CONST UINT32 *NumberInitiatorProximityDomain;
STATIC CONST UINT32 *NumberTargetProximityDomain;
STATIC CONST
EFI_ACPI_6_4_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO_FLAGS*
SllbiFlags;
EFI_ACPI_6_4_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO_FLAGS *
SllbiFlags;
STATIC CONST UINT8* SllbiDataType;
STATIC CONST UINT16* NumberSMBIOSHandles;
STATIC CONST UINT8 *SllbiDataType;
STATIC CONST UINT16 *NumberSMBIOSHandles;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
Names of System Locality Latency Bandwidth Information (SLLBI) data types
**/
STATIC CONST CHAR16* SllbiNames[] = {
STATIC CONST CHAR16 *SllbiNames[] = {
L"Access %sLatency%s",
L"Read %sLatency%s",
L"Write %sLatency%s",
@ -61,15 +61,15 @@ STATIC
VOID
EFIAPI
ValidateCacheAttributes (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*
Attributes;
EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *
Attributes;
Attributes =
(EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*)Ptr;
(EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *)Ptr;
if (Attributes->TotalCacheLevels > 0x3) {
IncrementErrorCount ();
@ -78,6 +78,7 @@ ValidateCacheAttributes (
Attributes->TotalCacheLevels
);
}
if (Attributes->CacheLevel > 0x3) {
IncrementErrorCount ();
Print (
@ -85,6 +86,7 @@ ValidateCacheAttributes (
Attributes->CacheLevel
);
}
if (Attributes->CacheAssociativity > 0x2) {
IncrementErrorCount ();
Print (
@ -92,6 +94,7 @@ ValidateCacheAttributes (
Attributes->CacheAssociativity
);
}
if (Attributes->WritePolicy > 0x2) {
IncrementErrorCount ();
Print (
@ -111,15 +114,15 @@ STATIC
VOID
EFIAPI
DumpCacheAttributes (
IN CONST CHAR16* Format OPTIONAL,
IN UINT8* Ptr
IN CONST CHAR16 *Format OPTIONAL,
IN UINT8 *Ptr
)
{
EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*
Attributes;
EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *
Attributes;
Attributes =
(EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*)Ptr;
(EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *)Ptr;
Print (L"\n");
PrintFieldName (4, L"Total Cache Levels");
@ -137,55 +140,55 @@ DumpCacheAttributes (
/**
An ACPI_PARSER array describing the ACPI HMAT Table.
*/
STATIC CONST ACPI_PARSER HmatParser[] = {
STATIC CONST ACPI_PARSER HmatParser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo),
{L"Reserved", 4, 36, NULL, NULL, NULL, NULL, NULL}
{ L"Reserved", 4,36, NULL, NULL, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the HMAT structure header.
*/
STATIC CONST ACPI_PARSER HmatStructureHeaderParser[] = {
{L"Type", 2, 0, NULL, NULL, (VOID**)&HmatStructureType, NULL, NULL},
{L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL},
{L"Length", 4, 4, NULL, NULL, (VOID**)&HmatStructureLength, NULL, NULL}
STATIC CONST ACPI_PARSER HmatStructureHeaderParser[] = {
{ L"Type", 2, 0, NULL, NULL, (VOID **)&HmatStructureType, NULL, NULL },
{ L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL },
{ L"Length", 4, 4, NULL, NULL, (VOID **)&HmatStructureLength, NULL, NULL }
};
/**
An ACPI PARSER array describing the Memory Proximity Domain Attributes
Structure - Type 0.
*/
STATIC CONST ACPI_PARSER MemProximityDomainAttributeParser[] = {
{L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
{L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL},
{L"Flags", 2, 8, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 2, 10, L"0x%x", NULL, NULL, NULL, NULL},
{L"Proximity Dom for initiator", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
{L"Proximity Dom for memory", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}
STATIC CONST ACPI_PARSER MemProximityDomainAttributeParser[] = {
{ L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL },
{ L"Flags", 2, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 2, 10, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Proximity Dom for initiator", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Proximity Dom for memory", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL }
};
/**
An ACPI PARSER array describing the System Locality Latency and Bandwidth
Information Structure - Type 1.
*/
STATIC CONST ACPI_PARSER SllbiParser[] = {
{L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
{L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL},
{L"Flags", 1, 8, L"0x%x", NULL, (VOID**)&SllbiFlags, NULL, NULL},
{L"Data type", 1, 9, L"0x%x", NULL, (VOID**)&SllbiDataType, NULL, NULL},
{L"Min Transfer Size", 1, 10, L"%d", NULL, NULL, NULL, NULL},
{L"Reserved", 1, 11, L"0x%x", NULL, NULL, NULL, NULL},
{L"Initiator Proximity Dom Count", 4, 12, L"%d", NULL,
(VOID**)&NumberInitiatorProximityDomain, NULL, NULL},
{L"Target Proximity Dom Count", 4, 16, L"%d", NULL,
(VOID**)&NumberTargetProximityDomain, NULL, NULL},
{L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
{L"Entry Base Unit", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL}
STATIC CONST ACPI_PARSER SllbiParser[] = {
{ L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL },
{ L"Flags", 1, 8, L"0x%x", NULL, (VOID **)&SllbiFlags, NULL, NULL },
{ L"Data type", 1, 9, L"0x%x", NULL, (VOID **)&SllbiDataType, NULL, NULL },
{ L"Min Transfer Size", 1, 10, L"%d", NULL, NULL, NULL, NULL },
{ L"Reserved", 1, 11, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Initiator Proximity Dom Count", 4, 12, L"%d", NULL,
(VOID **)&NumberInitiatorProximityDomain, NULL, NULL },
{ L"Target Proximity Dom Count", 4, 16, L"%d", NULL,
(VOID **)&NumberTargetProximityDomain, NULL, NULL },
{ L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Entry Base Unit", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL }
// initiator Proximity Domain list ...
// target Proximity Domain list ...
// Latency/Bandwidth matrix ...
@ -195,18 +198,18 @@ STATIC CONST ACPI_PARSER SllbiParser[] = {
An ACPI PARSER array describing the Memory Side Cache Information
Structure - Type 2.
*/
STATIC CONST ACPI_PARSER MemSideCacheInfoParser[] = {
{L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
{L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL},
{L"Proximity Dom for memory", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
{L"Memory Side Cache Size", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Cache Attributes", 4, 24, NULL, DumpCacheAttributes, NULL,
ValidateCacheAttributes, NULL},
{L"Reserved", 2, 28, L"0x%x", NULL, NULL, NULL, NULL},
{L"SMBIOS Handle Count", 2, 30, L"%d", NULL,
(VOID**)&NumberSMBIOSHandles, NULL, NULL}
STATIC CONST ACPI_PARSER MemSideCacheInfoParser[] = {
{ L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL },
{ L"Proximity Dom for memory", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Memory Side Cache Size", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Cache Attributes", 4, 24, NULL, DumpCacheAttributes, NULL,
ValidateCacheAttributes, NULL },
{ L"Reserved", 2, 28, L"0x%x", NULL, NULL, NULL, NULL },
{ L"SMBIOS Handle Count", 2, 30, L"%d", NULL,
(VOID **)&NumberSMBIOSHandles, NULL, NULL }
// SMBIOS handles List ...
};
@ -222,8 +225,8 @@ STATIC CONST ACPI_PARSER MemSideCacheInfoParser[] = {
STATIC
VOID
DumpMpda (
IN UINT8* Ptr,
IN UINT32 Length
IN UINT8 *Ptr,
IN UINT32 Length
)
{
ParseAcpi (
@ -248,13 +251,13 @@ DumpMpda (
STATIC
VOID
DumpSllbi (
IN UINT8* Ptr,
IN UINT32 Length
IN UINT8 *Ptr,
IN UINT32 Length
)
{
CONST UINT32* InitiatorProximityDomainList;
CONST UINT32* TargetProximityDomainList;
CONST UINT16* LatencyBandwidthMatrix;
CONST UINT32 *InitiatorProximityDomainList;
CONST UINT32 *TargetProximityDomainList;
CONST UINT16 *LatencyBandwidthMatrix;
UINT32 Offset;
CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
CHAR16 SecondBuffer[OUTPUT_FIELD_COLUMN_WIDTH];
@ -278,11 +281,12 @@ DumpSllbi (
if ((SllbiFlags == NULL) ||
(SllbiDataType == NULL) ||
(NumberInitiatorProximityDomain == NULL) ||
(NumberTargetProximityDomain == NULL)) {
(NumberTargetProximityDomain == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient remaining table buffer length to read the " \
L"SLLBI structure header. Length = %d.\n",
L"SLLBI structure header. Length = %d.\n",
Length
);
return;
@ -306,10 +310,10 @@ DumpSllbi (
return;
}
InitiatorProximityDomainList = (UINT32*) (Ptr + Offset);
TargetProximityDomainList = InitiatorProximityDomainList +
*NumberInitiatorProximityDomain;
LatencyBandwidthMatrix = (UINT16*) (TargetProximityDomainList +
InitiatorProximityDomainList = (UINT32 *)(Ptr + Offset);
TargetProximityDomainList = InitiatorProximityDomainList +
*NumberInitiatorProximityDomain;
LatencyBandwidthMatrix = (UINT16 *)(TargetProximityDomainList +
*NumberTargetProximityDomain);
// Display each element of the Initiator Proximity Domain list
@ -350,6 +354,7 @@ DumpSllbi (
Print (L"Error: Unkown Data Type. DataType = 0x%x.\n", *SllbiDataType);
return;
}
StrCpyS (Buffer, sizeof (Buffer), SllbiNames[*SllbiDataType]);
// Adjust base name depending on Memory Hierarchy in this Structure
@ -381,7 +386,6 @@ DumpSllbi (
SllbiFlags->MemoryHierarchy
);
return;
} // switch
if (*NumberTargetProximityDomain <= MAX_MEMORY_DOMAIN_TARGET_PRINT_MATRIX) {
@ -400,34 +404,41 @@ DumpSllbi (
for (IndexTarget = 0;
IndexTarget < *NumberTargetProximityDomain;
IndexTarget++) {
IndexTarget++)
{
Print (L" %2d", IndexTarget);
}
Print (L"\n ---+");
for (IndexTarget = 0;
IndexTarget < *NumberTargetProximityDomain;
IndexTarget++) {
IndexTarget++)
{
Print (L"------");
}
Print (L"\n");
TargetStartOffset = 0;
for (IndexInitiator = 0;
IndexInitiator < *NumberInitiatorProximityDomain;
IndexInitiator++) {
IndexInitiator++)
{
Print (L" %2d |", IndexInitiator);
for (IndexTarget = 0;
IndexTarget < *NumberTargetProximityDomain;
IndexTarget++) {
IndexTarget++)
{
Print (
L" %5d",
LatencyBandwidthMatrix[TargetStartOffset + IndexTarget]
);
} // for Target
Print (L"\n");
TargetStartOffset += (*NumberTargetProximityDomain);
} // for Initiator
Print (L"\n");
} else {
// Display the latency/bandwidth matrix as a list
@ -441,10 +452,12 @@ DumpSllbi (
TargetStartOffset = 0;
for (IndexInitiator = 0;
IndexInitiator < *NumberInitiatorProximityDomain;
IndexInitiator++) {
IndexInitiator++)
{
for (IndexTarget = 0;
IndexTarget < *NumberTargetProximityDomain;
IndexTarget++) {
IndexTarget++)
{
UnicodeSPrint (
SecondBuffer,
sizeof (SecondBuffer),
@ -459,6 +472,7 @@ DumpSllbi (
LatencyBandwidthMatrix[TargetStartOffset + IndexTarget]
);
} // for Target
TargetStartOffset += (*NumberTargetProximityDomain);
} // for Initiator
}
@ -474,11 +488,11 @@ DumpSllbi (
STATIC
VOID
DumpMsci (
IN UINT8* Ptr,
IN UINT32 Length
IN UINT8 *Ptr,
IN UINT32 Length
)
{
CONST UINT16* SMBIOSHandlesList;
CONST UINT16 *SMBIOSHandlesList;
CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
UINT32 Offset;
UINT16 Index;
@ -498,7 +512,7 @@ DumpMsci (
IncrementErrorCount ();
Print (
L"ERROR: Insufficient remaining table buffer length to read the " \
L"MSCI structure header. Length = %d.\n",
L"MSCI structure header. Length = %d.\n",
Length
);
return;
@ -515,7 +529,7 @@ DumpMsci (
return;
}
SMBIOSHandlesList = (UINT16*) (Ptr + Offset);
SMBIOSHandlesList = (UINT16 *)(Ptr + Offset);
for (Index = 0; Index < *NumberSMBIOSHandles; Index++) {
UnicodeSPrint (
@ -553,14 +567,14 @@ DumpMsci (
VOID
EFIAPI
ParseAcpiHmat (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
UINT32 Offset;
UINT8* HmatStructurePtr;
UINT32 Offset;
UINT8 *HmatStructurePtr;
if (!Trace) {
return;
@ -591,11 +605,12 @@ ParseAcpiHmat (
// Check if the values used to control the parsing logic have been
// successfully read.
if ((HmatStructureType == NULL) ||
(HmatStructureLength == NULL)) {
(HmatStructureLength == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient remaining table buffer length to read the " \
L"HMAT structure header. Length = %d.\n",
L"HMAT structure header. Length = %d.\n",
AcpiTableLength - Offset
);
return;
@ -603,11 +618,12 @@ ParseAcpiHmat (
// Validate HMAT Structure length.
if ((*HmatStructureLength == 0) ||
((Offset + (*HmatStructureLength)) > AcpiTableLength)) {
((Offset + (*HmatStructureLength)) > AcpiTableLength))
{
IncrementErrorCount ();
Print (
L"ERROR: Invalid HMAT Structure length. " \
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*HmatStructureLength,
Offset,
AcpiTableLength
@ -629,7 +645,7 @@ ParseAcpiHmat (
);
break;
case EFI_ACPI_6_4_HMAT_TYPE_MEMORY_SIDE_CACHE_INFO:
DumpMsci (
DumpMsci (
HmatStructurePtr,
*HmatStructureLength
);
@ -638,7 +654,7 @@ ParseAcpiHmat (
IncrementErrorCount ();
Print (
L"ERROR: Unknown HMAT structure:"
L" Type = %d, Length = %d\n",
L" Type = %d, Length = %d\n",
*HmatStructureType,
*HmatStructureLength
);
@ -646,6 +662,6 @@ ParseAcpiHmat (
} // switch
HmatStructurePtr += *HmatStructureLength;
Offset += *HmatStructureLength;
Offset += *HmatStructureLength;
} // while
}

View File

@ -16,22 +16,22 @@
#include "AcpiViewConfig.h"
// Local variables
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC CONST UINT32* IortNodeCount;
STATIC CONST UINT32* IortNodeOffset;
STATIC CONST UINT32 *IortNodeCount;
STATIC CONST UINT32 *IortNodeOffset;
STATIC CONST UINT8* IortNodeType;
STATIC CONST UINT16* IortNodeLength;
STATIC CONST UINT32* IortIdMappingCount;
STATIC CONST UINT32* IortIdMappingOffset;
STATIC CONST UINT8 *IortNodeType;
STATIC CONST UINT16 *IortNodeLength;
STATIC CONST UINT32 *IortIdMappingCount;
STATIC CONST UINT32 *IortIdMappingOffset;
STATIC CONST UINT32* InterruptContextCount;
STATIC CONST UINT32* InterruptContextOffset;
STATIC CONST UINT32* PmuInterruptCount;
STATIC CONST UINT32* PmuInterruptOffset;
STATIC CONST UINT32 *InterruptContextCount;
STATIC CONST UINT32 *InterruptContextOffset;
STATIC CONST UINT32 *PmuInterruptCount;
STATIC CONST UINT32 *PmuInterruptOffset;
STATIC CONST UINT32* ItsCount;
STATIC CONST UINT32 *ItsCount;
/**
This function validates the ID Mapping array count for the ITS node.
@ -44,11 +44,11 @@ STATIC
VOID
EFIAPI
ValidateItsIdMappingCount (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
if (*(UINT32*)Ptr != 0) {
if (*(UINT32 *)Ptr != 0) {
IncrementErrorCount ();
Print (L"\nERROR: IORT ID Mapping count must be zero.");
}
@ -66,11 +66,11 @@ STATIC
VOID
EFIAPI
ValidatePmcgIdMappingCount (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
if (*(UINT32*)Ptr > 1) {
if (*(UINT32 *)Ptr > 1) {
IncrementErrorCount ();
Print (L"\nERROR: IORT ID Mapping count must not be greater than 1.");
}
@ -87,11 +87,11 @@ STATIC
VOID
EFIAPI
ValidateItsIdArrayReference (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
if (*(UINT32*)Ptr != 0) {
if (*(UINT32 *)Ptr != 0) {
IncrementErrorCount ();
Print (L"\nERROR: IORT ID Mapping offset must be zero.");
}
@ -119,135 +119,135 @@ ValidateItsIdArrayReference (
/**
An ACPI_PARSER array describing the ACPI IORT Table
**/
STATIC CONST ACPI_PARSER IortParser[] = {
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}
{ 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.
**/
STATIC CONST ACPI_PARSER IortNodeHeaderParser[] = {
STATIC CONST ACPI_PARSER IortNodeHeaderParser[] = {
PARSE_IORT_NODE_HEADER (NULL, NULL)
};
/**
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},
{L"Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reference to Global Interrupt Array", 4, 40, L"0x%x", NULL, NULL, NULL,
NULL},
{L"Number of context interrupts", 4, 44, L"%d", NULL,
(VOID**)&InterruptContextCount, NULL, NULL},
{L"Reference to Context Interrupt Array", 4, 48, L"0x%x", NULL,
(VOID**)&InterruptContextOffset, NULL, NULL},
{L"Number of PMU Interrupts", 4, 52, L"%d", NULL,
(VOID**)&PmuInterruptCount, NULL, NULL},
{L"Reference to PMU Interrupt Array", 4, 56, L"0x%x", NULL,
(VOID**)&PmuInterruptOffset, NULL, NULL},
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 },
{ L"Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reference to Global Interrupt Array",4, 40, L"0x%x", NULL, NULL, NULL,
NULL },
{ L"Number of context interrupts", 4, 44, L"%d", NULL,
(VOID **)&InterruptContextCount, NULL, NULL },
{ L"Reference to Context Interrupt Array",4, 48, L"0x%x", NULL,
(VOID **)&InterruptContextOffset, NULL, NULL },
{ L"Number of PMU Interrupts", 4, 52, L"%d", NULL,
(VOID **)&PmuInterruptCount, NULL, NULL },
{ L"Reference to PMU Interrupt Array",4, 56, L"0x%x", NULL,
(VOID **)&PmuInterruptOffset, NULL, NULL },
// Interrupt Array
{L"SMMU_NSgIrpt", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},
{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}
{ L"SMMU_NSgIrpt", 4, 60, L"0x%x", NULL, NULL, NULL, NULL },
{ 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.
**/
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}
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.
**/
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}
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.
**/
STATIC CONST ACPI_PARSER IortNodeSmmuV3Parser[] = {
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},
{L"VATOS Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Model", 4, 40, L"%d", NULL, NULL, NULL, NULL},
{L"Event", 4, 44, L"0x%x", NULL, NULL, NULL, NULL},
{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},
{L"Proximity domain", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},
{L"Device ID mapping index", 4, 64, L"%d", NULL, NULL, 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 },
{ L"VATOS Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Model", 4, 40, L"%d", NULL, NULL, NULL, NULL },
{ L"Event", 4, 44, L"0x%x", NULL, NULL, NULL, NULL },
{ 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 },
{ L"Proximity domain", 4, 60, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Device ID mapping index", 4, 64, L"%d", NULL, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the IORT ITS node.
**/
STATIC CONST ACPI_PARSER IortNodeItsParser[] = {
STATIC CONST ACPI_PARSER IortNodeItsParser[] = {
PARSE_IORT_NODE_HEADER (
ValidateItsIdMappingCount,
ValidateItsIdArrayReference
),
{L"Number of ITSs", 4, 16, L"%d", NULL, (VOID**)&ItsCount, NULL}
{ L"Number of ITSs", 4,16, L"%d", NULL, (VOID **)&ItsCount, NULL }
};
/**
An ACPI_PARSER array describing the ITS ID.
**/
STATIC CONST ACPI_PARSER ItsIdParser[] = {
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.
**/
STATIC CONST ACPI_PARSER IortNodeNamedComponentParser[] = {
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}
{ 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.
**/
STATIC CONST ACPI_PARSER IortNodeRootComplexParser[] = {
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},
{L"Memory access size limit", 1, 32, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, 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 },
{ L"Memory access size limit",1, 32, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the IORT PMCG node.
**/
STATIC CONST ACPI_PARSER IortNodePmcgParser[] = {
STATIC CONST ACPI_PARSER IortNodePmcgParser[] = {
PARSE_IORT_NODE_HEADER (ValidatePmcgIdMappingCount, NULL),
{L"Page 0 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},
{L"Page 1 Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}
{ L"Page 0 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 },
{ L"Page 1 Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL }
};
/**
@ -260,20 +260,21 @@ STATIC CONST ACPI_PARSER IortNodePmcgParser[] = {
STATIC
VOID
DumpIortNodeIdMappings (
IN UINT8* Ptr,
IN UINT32 Length,
IN UINT32 MappingCount
IN UINT8 *Ptr,
IN UINT32 Length,
IN UINT32 MappingCount
)
{
UINT32 Index;
UINT32 Offset;
CHAR8 Buffer[40]; // Used for AsciiName param of ParseAcpi
UINT32 Index;
UINT32 Offset;
CHAR8 Buffer[40]; // Used for AsciiName param of ParseAcpi
Index = 0;
Index = 0;
Offset = 0;
while ((Index < MappingCount) &&
(Offset < Length)) {
(Offset < Length))
{
AsciiSPrint (
Buffer,
sizeof (Buffer),
@ -304,15 +305,15 @@ DumpIortNodeIdMappings (
STATIC
VOID
DumpIortNodeSmmuV1V2 (
IN UINT8* Ptr,
IN UINT16 Length,
IN UINT32 MappingCount,
IN UINT32 MappingOffset
IN UINT8 *Ptr,
IN UINT16 Length,
IN UINT32 MappingCount,
IN UINT32 MappingOffset
)
{
UINT32 Index;
UINT32 Offset;
CHAR8 Buffer[50]; // Used for AsciiName param of ParseAcpi
UINT32 Index;
UINT32 Offset;
CHAR8 Buffer[50]; // Used for AsciiName param of ParseAcpi
ParseAcpi (
TRUE,
@ -328,7 +329,8 @@ DumpIortNodeSmmuV1V2 (
if ((InterruptContextCount == NULL) ||
(InterruptContextOffset == NULL) ||
(PmuInterruptCount == NULL) ||
(PmuInterruptOffset == NULL)) {
(PmuInterruptOffset == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient SMMUv1/2 node length. Length = %d\n",
@ -338,10 +340,11 @@ DumpIortNodeSmmuV1V2 (
}
Offset = *InterruptContextOffset;
Index = 0;
Index = 0;
while ((Index < *InterruptContextCount) &&
(Offset < Length)) {
(Offset < Length))
{
AsciiSPrint (
Buffer,
sizeof (Buffer),
@ -360,10 +363,11 @@ DumpIortNodeSmmuV1V2 (
}
Offset = *PmuInterruptOffset;
Index = 0;
Index = 0;
while ((Index < *PmuInterruptCount) &&
(Offset < Length)) {
(Offset < Length))
{
AsciiSPrint (
Buffer,
sizeof (Buffer),
@ -400,10 +404,10 @@ DumpIortNodeSmmuV1V2 (
STATIC
VOID
DumpIortNodeSmmuV3 (
IN UINT8* Ptr,
IN UINT16 Length,
IN UINT32 MappingCount,
IN UINT32 MappingOffset
IN UINT8 *Ptr,
IN UINT16 Length,
IN UINT32 MappingCount,
IN UINT32 MappingOffset
)
{
ParseAcpi (
@ -431,22 +435,22 @@ DumpIortNodeSmmuV3 (
STATIC
VOID
DumpIortNodeIts (
IN UINT8* Ptr,
IN UINT16 Length
IN UINT8 *Ptr,
IN UINT16 Length
)
{
UINT32 Offset;
UINT32 Index;
CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi
UINT32 Offset;
UINT32 Index;
CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi
Offset = ParseAcpi (
TRUE,
2,
"ITS Node",
Ptr,
Length,
PARSER_PARAMS (IortNodeItsParser)
);
TRUE,
2,
"ITS Node",
Ptr,
Length,
PARSER_PARAMS (IortNodeItsParser)
);
// Check if the values used to control the parsing logic have been
// successfully read.
@ -462,7 +466,8 @@ DumpIortNodeIts (
Index = 0;
while ((Index < *ItsCount) &&
(Offset < Length)) {
(Offset < Length))
{
AsciiSPrint (
Buffer,
sizeof (Buffer),
@ -481,7 +486,6 @@ DumpIortNodeIts (
}
// Note: ITS does not have the ID Mappings Array
}
/**
@ -496,13 +500,13 @@ DumpIortNodeIts (
STATIC
VOID
DumpIortNodeNamedComponent (
IN UINT8* Ptr,
IN UINT16 Length,
IN UINT32 MappingCount,
IN UINT32 MappingOffset
IN UINT8 *Ptr,
IN UINT16 Length,
IN UINT32 MappingCount,
IN UINT32 MappingOffset
)
{
UINT32 Offset;
UINT32 Offset;
Offset = ParseAcpi (
TRUE,
@ -517,10 +521,12 @@ DumpIortNodeNamedComponent (
PrintFieldName (2, L"Device Object Name");
while ((*(Ptr + Offset) != 0) &&
(Offset < Length)) {
(Offset < Length))
{
Print (L"%c", *(Ptr + Offset));
Offset++;
}
Print (L"\n");
DumpIortNodeIdMappings (
@ -542,10 +548,10 @@ DumpIortNodeNamedComponent (
STATIC
VOID
DumpIortNodeRootComplex (
IN UINT8* Ptr,
IN UINT16 Length,
IN UINT32 MappingCount,
IN UINT32 MappingOffset
IN UINT8 *Ptr,
IN UINT16 Length,
IN UINT32 MappingCount,
IN UINT32 MappingOffset
)
{
ParseAcpi (
@ -576,11 +582,11 @@ DumpIortNodeRootComplex (
STATIC
VOID
DumpIortNodePmcg (
IN UINT8* Ptr,
IN UINT16 Length,
IN UINT32 MappingCount,
IN UINT32 MappingOffset
)
IN UINT8 *Ptr,
IN UINT16 Length,
IN UINT32 MappingCount,
IN UINT32 MappingOffset
)
{
ParseAcpi (
TRUE,
@ -620,15 +626,15 @@ DumpIortNodePmcg (
VOID
EFIAPI
ParseAcpiIort (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
UINT32 Offset;
UINT32 Index;
UINT8* NodePtr;
UINT32 Offset;
UINT32 Index;
UINT8 *NodePtr;
if (!Trace) {
return;
@ -646,7 +652,8 @@ ParseAcpiIort (
// Check if the values used to control the parsing logic have been
// successfully read.
if ((IortNodeCount == NULL) ||
(IortNodeOffset == NULL)) {
(IortNodeOffset == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
@ -655,14 +662,15 @@ ParseAcpiIort (
return;
}
Offset = *IortNodeOffset;
Offset = *IortNodeOffset;
NodePtr = Ptr + Offset;
Index = 0;
Index = 0;
// Parse the specified number of IORT nodes or the IORT table buffer length.
// Whichever is minimum.
while ((Index++ < *IortNodeCount) &&
(Offset < AcpiTableLength)) {
(Offset < AcpiTableLength))
{
// Parse the IORT Node Header
ParseAcpi (
FALSE,
@ -678,11 +686,12 @@ ParseAcpiIort (
if ((IortNodeType == NULL) ||
(IortNodeLength == NULL) ||
(IortIdMappingCount == NULL) ||
(IortIdMappingOffset == NULL)) {
(IortIdMappingOffset == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient remaining table buffer length to read the " \
L"IORT node header. Length = %d.\n",
L"IORT node header. Length = %d.\n",
AcpiTableLength - Offset
);
return;
@ -690,11 +699,12 @@ ParseAcpiIort (
// Validate IORT Node length
if ((*IortNodeLength == 0) ||
((Offset + (*IortNodeLength)) > AcpiTableLength)) {
((Offset + (*IortNodeLength)) > AcpiTableLength))
{
IncrementErrorCount ();
Print (
L"ERROR: Invalid IORT Node length. " \
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*IortNodeLength,
Offset,
AcpiTableLength
@ -750,7 +760,7 @@ ParseAcpiIort (
*IortNodeLength,
*IortIdMappingCount,
*IortIdMappingOffset
);
);
break;
default:
@ -759,6 +769,6 @@ ParseAcpiIort (
} // switch
NodePtr += (*IortNodeLength);
Offset += (*IortNodeLength);
Offset += (*IortNodeLength);
} // while
}

View File

@ -19,9 +19,9 @@
#include "MadtParser.h"
// Local Variables
STATIC CONST UINT8* MadtInterruptControllerType;
STATIC CONST UINT8* MadtInterruptControllerLength;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC CONST UINT8 *MadtInterruptControllerType;
STATIC CONST UINT8 *MadtInterruptControllerLength;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
This function validates the System Vector Base in the GICD.
@ -34,15 +34,15 @@ STATIC
VOID
EFIAPI
ValidateGICDSystemVectorBase (
IN UINT8* Ptr,
IN VOID* Context
)
IN UINT8 *Ptr,
IN VOID *Context
)
{
if (*(UINT32*)Ptr != 0) {
if (*(UINT32 *)Ptr != 0) {
IncrementErrorCount ();
Print (
L"\nERROR: System Vector Base must be zero."
);
);
}
}
@ -57,13 +57,13 @@ STATIC
VOID
EFIAPI
ValidateSpeOverflowInterrupt (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
UINT16 SpeOverflowInterrupt;
UINT16 SpeOverflowInterrupt;
SpeOverflowInterrupt = *(UINT16*)Ptr;
SpeOverflowInterrupt = *(UINT16 *)Ptr;
// SPE not supported by this processor
if (SpeOverflowInterrupt == 0) {
@ -73,183 +73,183 @@ ValidateSpeOverflowInterrupt (
if ((SpeOverflowInterrupt < ARM_PPI_ID_MIN) ||
((SpeOverflowInterrupt > ARM_PPI_ID_MAX) &&
(SpeOverflowInterrupt < ARM_PPI_ID_EXTENDED_MIN)) ||
(SpeOverflowInterrupt > ARM_PPI_ID_EXTENDED_MAX)) {
(SpeOverflowInterrupt > ARM_PPI_ID_EXTENDED_MAX))
{
IncrementErrorCount ();
Print (
L"\nERROR: SPE Overflow Interrupt ID of %d is not in the allowed PPI ID "
L"ranges of %d-%d or %d-%d (for GICv3.1 or later).",
L"ranges of %d-%d or %d-%d (for GICv3.1 or later).",
SpeOverflowInterrupt,
ARM_PPI_ID_MIN,
ARM_PPI_ID_MAX,
ARM_PPI_ID_EXTENDED_MIN,
ARM_PPI_ID_EXTENDED_MAX
);
);
} else if (SpeOverflowInterrupt != ARM_PPI_ID_PMBIRQ) {
IncrementWarningCount();
IncrementWarningCount ();
Print (
L"\nWARNING: SPE Overflow Interrupt ID of %d is not compliant with SBSA "
L"Level 3 PPI ID assignment: %d.",
L"Level 3 PPI ID assignment: %d.",
SpeOverflowInterrupt,
ARM_PPI_ID_PMBIRQ
);
);
}
}
/**
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},
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 },
{L"CPU Interface Number", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
{L"ACPI Processor UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
{L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
{L"Parking Protocol Version", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
{ L"CPU Interface Number", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"ACPI Processor UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Parking Protocol Version", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
{L"Performance Interrupt GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
{L"Parked Address", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Physical Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
{L"GICV", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL},
{L"GICH", 8, 48, L"0x%lx", NULL, NULL, NULL, NULL},
{L"VGIC Maintenance interrupt", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},
{L"GICR Base Address", 8, 60, L"0x%lx", NULL, NULL, NULL, NULL},
{L"MPIDR", 8, 68, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Processor Power Efficiency Class", 1, 76, L"0x%x", NULL, NULL, NULL,
NULL},
{L"Reserved", 1, 77, L"0x%x", NULL, NULL, NULL, NULL},
{L"SPE overflow Interrupt", 2, 78, L"0x%x", NULL, NULL,
ValidateSpeOverflowInterrupt, NULL}
{ L"Performance Interrupt GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Parked Address", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Physical Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"GICV", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"GICH", 8, 48, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"VGIC Maintenance interrupt", 4, 56, L"0x%x", NULL, NULL, NULL, NULL },
{ L"GICR Base Address", 8, 60, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"MPIDR", 8, 68, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Processor Power Efficiency Class", 1, 76, L"0x%x", NULL, NULL, NULL,
NULL },
{ L"Reserved", 1, 77, L"0x%x", NULL, NULL, NULL, NULL },
{ L"SPE overflow Interrupt", 2, 78, L"0x%x", NULL, NULL,
ValidateSpeOverflowInterrupt, NULL }
};
/**
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},
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 },
{L"GIC ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
{L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
{L"System Vector Base", 4, 16, L"0x%x", NULL, NULL,
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}
{ L"GIC ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"System Vector Base", 4, 16, L"0x%x", NULL, NULL,
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.
**/
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},
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 },
{L"MSI Frame ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
{L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
{ L"MSI Frame ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
{L"SPI Count", 2, 20, L"%d", NULL, NULL, NULL, NULL},
{L"SPI Base", 2, 22, L"0x%x", NULL, NULL, NULL, NULL}
{ 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.
**/
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},
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}
{ 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.
**/
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},
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}
{ 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 IO APIC Structure.
**/
STATIC CONST ACPI_PARSER IoApic[] = {
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
{L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
{L"I/O APIC ID", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},
{L"I/O APIC Address", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
{L"Global System Interrupt Base", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}
STATIC CONST ACPI_PARSER IoApic[] = {
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
{ L"I/O APIC ID", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 1, 3, L"0x%x", NULL, NULL, NULL, NULL },
{ L"I/O APIC Address", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Global System Interrupt Base", 4, 8, L"0x%x", NULL, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the Interrupt Source Override Structure.
**/
STATIC CONST ACPI_PARSER InterruptSourceOverride[] = {
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
{L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
{L"Bus", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},
{L"Source", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},
{L"Global System Interrupt", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
{L"Flags", 2, 8, L"0x%x", NULL, NULL, NULL, NULL}
STATIC CONST ACPI_PARSER InterruptSourceOverride[] = {
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
{ L"Bus", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Source", 1, 3, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Global System Interrupt", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Flags", 2, 8, L"0x%x", NULL, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the Processor Local x2APIC Structure.
**/
STATIC CONST ACPI_PARSER ProcessorLocalX2Apic[] = {
{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},
STATIC CONST ACPI_PARSER ProcessorLocalX2Apic[] = {
{ 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"X2APIC ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
{L"Flags", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
{L"ACPI Processor UID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}
{ L"X2APIC ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Flags", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"ACPI Processor UID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the Local x2APIC NMI Structure.
**/
STATIC CONST ACPI_PARSER LocalX2ApicNmi[] = {
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
{L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},
{L"Flags", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
STATIC CONST ACPI_PARSER LocalX2ApicNmi[] = {
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL },
{ L"Flags", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
{L"ACPI Processor UID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
{L"Local x2APIC LINT#", 1, 8, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 3, 9, L"0x%x%x%x", Dump3Chars, NULL, NULL, NULL}
{ L"ACPI Processor UID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Local x2APIC LINT#", 1, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 3, 9, L"0x%x%x%x", Dump3Chars, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the ACPI MADT Table.
**/
STATIC CONST ACPI_PARSER MadtParser[] = {
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}
{ 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.
**/
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}
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 }
};
/**
@ -275,15 +275,15 @@ STATIC CONST ACPI_PARSER MadtInterruptControllerHeaderParser[] = {
VOID
EFIAPI
ParseAcpiMadt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
UINT32 Offset;
UINT8* InterruptContollerPtr;
UINT32 GICDCount;
UINT32 Offset;
UINT8 *InterruptContollerPtr;
UINT32 GICDCount;
GICDCount = 0;
@ -315,11 +315,12 @@ ParseAcpiMadt (
// Check if the values used to control the parsing logic have been
// successfully read.
if ((MadtInterruptControllerType == NULL) ||
(MadtInterruptControllerLength == NULL)) {
(MadtInterruptControllerLength == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient remaining table buffer length to read the " \
L"Interrupt Controller Structure header. Length = %d.\n",
L"Interrupt Controller Structure header. Length = %d.\n",
AcpiTableLength - Offset
);
return;
@ -327,11 +328,12 @@ ParseAcpiMadt (
// Validate Interrupt Controller Structure length
if ((*MadtInterruptControllerLength == 0) ||
((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength)) {
((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength))
{
IncrementErrorCount ();
Print (
L"ERROR: Invalid Interrupt Controller Structure length. " \
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*MadtInterruptControllerLength,
Offset,
AcpiTableLength
@ -340,7 +342,8 @@ ParseAcpiMadt (
}
switch (*MadtInterruptControllerType) {
case EFI_ACPI_6_3_GIC: {
case EFI_ACPI_6_3_GIC:
{
ParseAcpi (
TRUE,
2,
@ -352,15 +355,17 @@ ParseAcpiMadt (
break;
}
case EFI_ACPI_6_3_GICD: {
case EFI_ACPI_6_3_GICD:
{
if (++GICDCount > 1) {
IncrementErrorCount ();
Print (
L"ERROR: Only one GICD must be present,"
L" GICDCount = %d\n",
L" GICDCount = %d\n",
GICDCount
);
}
ParseAcpi (
TRUE,
2,
@ -372,7 +377,8 @@ ParseAcpiMadt (
break;
}
case EFI_ACPI_6_3_GIC_MSI_FRAME: {
case EFI_ACPI_6_3_GIC_MSI_FRAME:
{
ParseAcpi (
TRUE,
2,
@ -384,7 +390,8 @@ ParseAcpiMadt (
break;
}
case EFI_ACPI_6_3_GICR: {
case EFI_ACPI_6_3_GICR:
{
ParseAcpi (
TRUE,
2,
@ -396,7 +403,8 @@ ParseAcpiMadt (
break;
}
case EFI_ACPI_6_3_GIC_ITS: {
case EFI_ACPI_6_3_GIC_ITS:
{
ParseAcpi (
TRUE,
2,
@ -408,7 +416,8 @@ ParseAcpiMadt (
break;
}
case EFI_ACPI_6_3_IO_APIC: {
case EFI_ACPI_6_3_IO_APIC:
{
ParseAcpi (
TRUE,
2,
@ -420,7 +429,8 @@ ParseAcpiMadt (
break;
}
case EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE: {
case EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE:
{
ParseAcpi (
TRUE,
2,
@ -432,7 +442,8 @@ ParseAcpiMadt (
break;
}
case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC: {
case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC:
{
ParseAcpi (
TRUE,
2,
@ -444,7 +455,8 @@ ParseAcpiMadt (
break;
}
case EFI_ACPI_6_3_LOCAL_X2APIC_NMI: {
case EFI_ACPI_6_3_LOCAL_X2APIC_NMI:
{
ParseAcpi (
TRUE,
2,
@ -456,11 +468,12 @@ ParseAcpiMadt (
break;
}
default: {
default:
{
IncrementErrorCount ();
Print (
L"ERROR: Unknown Interrupt Controller Structure,"
L" Type = %d, Length = %d\n",
L" Type = %d, Length = %d\n",
*MadtInterruptControllerType,
*MadtInterruptControllerLength
);
@ -468,6 +481,6 @@ ParseAcpiMadt (
} // switch
InterruptContollerPtr += *MadtInterruptControllerLength;
Offset += *MadtInterruptControllerLength;
Offset += *MadtInterruptControllerLength;
} // while
}

View File

@ -16,25 +16,25 @@
///
/// Level 3 base server system Private Peripheral Inerrupt (PPI) ID assignments
///
#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTP 30
#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTPS 29
#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHV 28
#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTV 27
#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHP 26
#define ARM_PPI_ID_GIC_MAINTENANCE_INTERRUPT 25
#define ARM_PPI_ID_CTIIRQ 24
#define ARM_PPI_ID_PERFORMANCE_MONITORS_INTERRUPT 23
#define ARM_PPI_ID_COMMIRQ 22
#define ARM_PPI_ID_PMBIRQ 21
#define ARM_PPI_ID_CNTHPS 20
#define ARM_PPI_ID_CNTHVS 19
#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTP 30
#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTPS 29
#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHV 28
#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTV 27
#define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHP 26
#define ARM_PPI_ID_GIC_MAINTENANCE_INTERRUPT 25
#define ARM_PPI_ID_CTIIRQ 24
#define ARM_PPI_ID_PERFORMANCE_MONITORS_INTERRUPT 23
#define ARM_PPI_ID_COMMIRQ 22
#define ARM_PPI_ID_PMBIRQ 21
#define ARM_PPI_ID_CNTHPS 20
#define ARM_PPI_ID_CNTHVS 19
///
/// PPI ID allowed ranges
///
#define ARM_PPI_ID_MAX 31
#define ARM_PPI_ID_MIN 16
#define ARM_PPI_ID_EXTENDED_MAX 1119
#define ARM_PPI_ID_EXTENDED_MIN 1056
#define ARM_PPI_ID_MAX 31
#define ARM_PPI_ID_MIN 16
#define ARM_PPI_ID_EXTENDED_MAX 1119
#define ARM_PPI_ID_EXTENDED_MIN 1056
#endif // MADT_PARSER_H_

View File

@ -14,25 +14,25 @@
#include "AcpiTableParser.h"
// Local variables
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
An ACPI_PARSER array describing the ACPI MCFG Table.
**/
STATIC CONST ACPI_PARSER McfgParser[] = {
STATIC CONST ACPI_PARSER McfgParser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo),
{L"Reserved", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},
{ L"Reserved", 8,36, L"0x%lx", NULL, NULL, NULL, NULL },
};
/**
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}
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 }
};
/**
@ -50,15 +50,15 @@ STATIC CONST ACPI_PARSER PciCfgSpaceBaseAddrParser[] = {
VOID
EFIAPI
ParseAcpiMcfg (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
UINT32 Offset;
UINT32 PciCfgOffset;
UINT8* PciCfgSpacePtr;
UINT32 Offset;
UINT32 PciCfgOffset;
UINT8 *PciCfgSpacePtr;
if (!Trace) {
return;
@ -85,6 +85,6 @@ ParseAcpiMcfg (
PARSER_PARAMS (PciCfgSpaceBaseAddrParser)
);
PciCfgSpacePtr += PciCfgOffset;
Offset += PciCfgOffset;
Offset += PciCfgOffset;
}
}

View File

@ -17,12 +17,12 @@
#include "PcctParser.h"
// Local variables
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC UINT32* PccGlobalFlags;
STATIC UINT8* PccSubspaceLength;
STATIC UINT8* PccSubspaceType;
STATIC UINT8* ExtendedPccSubspaceInterruptFlags;
STATIC UINT32 *PccGlobalFlags;
STATIC UINT8 *PccSubspaceLength;
STATIC UINT8 *PccSubspaceType;
STATIC UINT8 *ExtendedPccSubspaceInterruptFlags;
/**
This function validates the length coded on 4 bytes of a shared memory range
@ -35,16 +35,16 @@ STATIC
VOID
EFIAPI
ValidateRangeLength4 (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
if (*(UINT32*)Ptr < MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN) {
if (*(UINT32 *)Ptr < MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN) {
IncrementErrorCount ();
Print (
L"\nError: Shared memory range length is too short.\n"
L"Length is %u when it should be greater than or equal to %u",
*(UINT32*)Ptr,
*(UINT32 *)Ptr,
MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN
);
}
@ -61,16 +61,16 @@ STATIC
VOID
EFIAPI
ValidateRangeLength8 (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
if (*(UINT64*)Ptr <= MIN_MEMORY_RANGE_LENGTH) {
if (*(UINT64 *)Ptr <= MIN_MEMORY_RANGE_LENGTH) {
IncrementErrorCount ();
Print (
L"\nError: Shared memory range length is too short.\n"
L"Length is %u when it should be greater than %u",
*(UINT64*)Ptr,
*(UINT64 *)Ptr,
MIN_MEMORY_RANGE_LENGTH
);
}
@ -87,14 +87,14 @@ STATIC
VOID
EFIAPI
ValidatePccMemoryIoGas (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
switch (*(UINT8*)Ptr) {
#if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
switch (*(UINT8 *)Ptr) {
#if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
case EFI_ACPI_6_4_SYSTEM_IO:
#endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
#endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
case EFI_ACPI_6_4_SYSTEM_MEMORY:
return;
default:
@ -114,14 +114,14 @@ STATIC
VOID
EFIAPI
ValidatePccGas (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
switch (*(UINT8*)Ptr) {
#if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
switch (*(UINT8 *)Ptr) {
#if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
case EFI_ACPI_6_4_SYSTEM_IO:
#endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
#endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))
case EFI_ACPI_6_4_FUNCTIONAL_FIXED_HARDWARE:
case EFI_ACPI_6_4_SYSTEM_MEMORY:
return;
@ -142,8 +142,8 @@ STATIC
VOID
EFIAPI
ValidatePccDoorbellGas (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
// For slave subspaces this field is optional, if not present the field
@ -152,7 +152,8 @@ ValidatePccDoorbellGas (
if (IsZeroBuffer (
Ptr,
sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
)) {
))
{
return;
}
}
@ -172,8 +173,8 @@ STATIC
VOID
EFIAPI
ValidatePccIntAckGas (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
// If the subspace does not support interrupts or the interrupt is
@ -183,12 +184,14 @@ ValidatePccIntAckGas (
if (((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) !=
EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) ||
((*ExtendedPccSubspaceInterruptFlags &
EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE) ==
EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE)) {
EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE) ==
EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE))
{
if (IsZeroBuffer (
Ptr,
sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE)
)) {
))
{
return;
}
}
@ -207,8 +210,8 @@ STATIC
VOID
EFIAPI
ValidatePccErrStatusGas (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
// This field is ignored by the OSPM on slave channels.
@ -230,19 +233,20 @@ STATIC
VOID
EFIAPI
ValidatePlatInterrupt (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
// If a slave subspace is present in the PCCT, then the global Platform
// Interrupt flag must be set to 1.
if ((*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) &&
((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) !=
EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT)) {
EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT))
{
IncrementErrorCount ();
Print (
L"\nError: Global Platform interrupt flag must be set to 1" \
L" if a PCC type 4 structure is present in PCCT."
L" if a PCC type 4 structure is present in PCCT."
);
}
}
@ -250,17 +254,17 @@ ValidatePlatInterrupt (
/**
An ACPI_PARSER array describing the ACPI PCCT Table.
*/
STATIC CONST ACPI_PARSER PcctParser[] = {
STATIC CONST ACPI_PARSER PcctParser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo),
{L"Flags", 4, 36, NULL, NULL, (VOID**)&PccGlobalFlags, NULL, NULL},
{L"Reserved", 8, 40, NULL, NULL, NULL, NULL, NULL}
{ L"Flags", 4, 36, NULL, NULL, (VOID **)&PccGlobalFlags, NULL, NULL },
{ L"Reserved", 8, 40, NULL, NULL, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the platform communications channel subspace
structure header.
*/
STATIC CONST ACPI_PARSER PccSubspaceHeaderParser[] = {
STATIC CONST ACPI_PARSER PccSubspaceHeaderParser[] = {
PCC_SUBSPACE_HEADER ()
// ... Type Specific Fields ...
};
@ -268,126 +272,126 @@ STATIC CONST ACPI_PARSER PccSubspaceHeaderParser[] = {
/**
An ACPI_PARSER array describing the Generic Communications Subspace - Type 0
*/
STATIC CONST ACPI_PARSER PccSubspaceType0Parser[] = {
STATIC CONST ACPI_PARSER PccSubspaceType0Parser[] = {
PCC_SUBSPACE_HEADER (),
{L"Reserved", 6, 2, L"%x %x %x %x %x %x", Dump6Chars, NULL, NULL, NULL},
{L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Memory Range Length", 8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
NULL},
{L"Doorbell Register", 12, 24, NULL, DumpGas, NULL, ValidatePccMemoryIoGas,
NULL},
{L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL},
{L"Maximum Periodic Access Rate", 4, 56, L"%u", NULL, NULL, NULL, NULL},
{L"Minimum Request Turnaround Time", 2, 60, L"%u", NULL, NULL, NULL, NULL}
{ L"Reserved", 6, 2, L"%x %x %x %x %x %x", Dump6Chars, NULL, NULL, NULL },
{ L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Memory Range Length",8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
NULL },
{ L"Doorbell Register",12, 24, NULL, DumpGas, NULL, ValidatePccMemoryIoGas,
NULL },
{ L"Doorbell Preserve",8, 36, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL },
{ L"Maximum Periodic Access Rate",4, 56, L"%u", NULL, NULL, NULL, NULL },
{ L"Minimum Request Turnaround Time",2, 60, L"%u", NULL, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the HW-Reduced Communications Subspace
- Type 1
*/
STATIC CONST ACPI_PARSER PccSubspaceType1Parser[] = {
STATIC CONST ACPI_PARSER PccSubspaceType1Parser[] = {
PCC_SUBSPACE_HEADER (),
{L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},
{L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL},
{L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Memory Range Length", 8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
NULL},
{L"Doorbell Register", 12, 24, NULL, DumpGas, NULL,
ValidatePccGas, NULL},
{L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL},
{L"Maximum Periodic Access Rate", 4, 56, L"%u", NULL, NULL, NULL, NULL},
{L"Minimum Request Turnaround Time", 2, 60, L"%u", NULL, NULL, NULL, NULL}
{ L"Platform Interrupt",4, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Platform Interrupt Flags",1, 6, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Memory Range Length",8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
NULL },
{ L"Doorbell Register",12, 24, NULL, DumpGas, NULL,
ValidatePccGas, NULL },
{ L"Doorbell Preserve",8, 36, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL },
{ L"Maximum Periodic Access Rate",4, 56, L"%u", NULL, NULL, NULL, NULL },
{ L"Minimum Request Turnaround Time",2, 60, L"%u", NULL, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the HW-Reduced Communications Subspace
- Type 2
*/
STATIC CONST ACPI_PARSER PccSubspaceType2Parser[] = {
STATIC CONST ACPI_PARSER PccSubspaceType2Parser[] = {
PCC_SUBSPACE_HEADER (),
{L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},
{L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL},
{L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Memory Range Length", 8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
NULL},
{L"Doorbell Register", 12, 24, NULL, DumpGas, NULL,
ValidatePccGas, NULL},
{L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL},
{L"Maximum Periodic Access Rate", 4, 56, L"%u", NULL, NULL, NULL, NULL},
{L"Minimum Request Turnaround Time", 2, 60, L"%u", NULL, NULL, NULL, NULL},
{L"Platform Interrupt Ack Register", 12, 62, NULL, DumpGas, NULL,
ValidatePccGas, NULL},
{L"Platform Interrupt Ack Preserve", 8, 74, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Platform Interrupt Ack Write", 8, 82, L"0x%lx", NULL, NULL,
NULL, NULL},
{ L"Platform Interrupt",4, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Platform Interrupt Flags",1, 6, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Memory Range Length",8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
NULL },
{ L"Doorbell Register",12, 24, NULL, DumpGas, NULL,
ValidatePccGas, NULL },
{ L"Doorbell Preserve",8, 36, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL },
{ L"Maximum Periodic Access Rate",4, 56, L"%u", NULL, NULL, NULL, NULL },
{ L"Minimum Request Turnaround Time",2, 60, L"%u", NULL, NULL, NULL, NULL },
{ L"Platform Interrupt Ack Register",12, 62, NULL, DumpGas, NULL,
ValidatePccGas, NULL },
{ L"Platform Interrupt Ack Preserve",8, 74, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Platform Interrupt Ack Write",8, 82, L"0x%lx", NULL, NULL,
NULL, NULL },
};
/**
An ACPI_PARSER array describing the Extended PCC Subspaces - Type 3/4
*/
STATIC CONST ACPI_PARSER PccSubspaceType3Parser[] = {
STATIC CONST ACPI_PARSER PccSubspaceType3Parser[] = {
PCC_SUBSPACE_HEADER (),
{L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL,
ValidatePlatInterrupt, NULL},
{L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL,
(VOID**)&ExtendedPccSubspaceInterruptFlags, NULL, NULL},
{L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL},
{L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Memory Range Length", 4, 16, L"0x%x", NULL, NULL, ValidateRangeLength4,
NULL},
{L"Doorbell Register", 12, 20, NULL, DumpGas, NULL,
ValidatePccDoorbellGas, NULL},
{L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Nominal Latency", 4, 48, L"%u", NULL, NULL, NULL, NULL},
{L"Maximum Periodic Access Rate", 4, 52, L"%u", NULL, NULL, NULL, NULL},
{L"Minimum Request Turnaround Time", 4, 56, L"%u", NULL, NULL, NULL, NULL},
{L"Platform Interrupt Ack Register", 12, 60, NULL, DumpGas, NULL,
ValidatePccIntAckGas, NULL},
{L"Platform Interrupt Ack Preserve", 8, 72, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Platform Interrupt Ack Set", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Reserved", 8, 88, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Cmd Complete Check Reg Addr", 12, 96, NULL, DumpGas, NULL,
ValidatePccGas, NULL},
{L"Cmd Complete Check Mask", 8, 108, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Cmd Update Reg Addr", 12, 116, NULL, DumpGas, NULL,
ValidatePccGas, NULL},
{L"Cmd Update Preserve mask", 8, 128, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Cmd Update Set mask", 8, 136, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Error Status Register", 12, 144, NULL, DumpGas, NULL,
ValidatePccErrStatusGas, NULL},
{L"Error Status Mask", 8, 156, L"0x%lx", NULL, NULL, NULL, NULL},
{ L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL,
ValidatePlatInterrupt, NULL },
{ L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL,
(VOID **)&ExtendedPccSubspaceInterruptFlags,NULL, NULL },
{ L"Reserved", 1, 7, L"0x%x", NULL, NULL,NULL, NULL },
{ L"Base Address", 8, 8, L"0x%lx", NULL, NULL,NULL, NULL },
{ L"Memory Range Length", 4, 16, L"0x%x", NULL, NULL,ValidateRangeLength4,
NULL },
{ L"Doorbell Register", 12, 20, NULL, DumpGas, NULL,
ValidatePccDoorbellGas, NULL },
{ L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL,NULL, NULL },
{ L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL,NULL, NULL },
{ L"Nominal Latency", 4, 48, L"%u", NULL, NULL,NULL, NULL },
{ L"Maximum Periodic Access Rate", 4, 52, L"%u", NULL, NULL,NULL, NULL },
{ L"Minimum Request Turnaround Time", 4, 56, L"%u", NULL, NULL,NULL, NULL },
{ L"Platform Interrupt Ack Register", 12, 60, NULL, DumpGas, NULL,
ValidatePccIntAckGas, NULL },
{ L"Platform Interrupt Ack Preserve", 8, 72, L"0x%lx", NULL, NULL,NULL, NULL },
{ L"Platform Interrupt Ack Set", 8, 80, L"0x%lx", NULL, NULL,NULL, NULL },
{ L"Reserved", 8, 88, L"0x%lx", NULL, NULL,NULL, NULL },
{ L"Cmd Complete Check Reg Addr", 12, 96, NULL, DumpGas, NULL,
ValidatePccGas, NULL },
{ L"Cmd Complete Check Mask", 8, 108, L"0x%lx", NULL, NULL,NULL, NULL },
{ L"Cmd Update Reg Addr", 12, 116, NULL, DumpGas, NULL,
ValidatePccGas, NULL },
{ L"Cmd Update Preserve mask", 8, 128, L"0x%lx", NULL, NULL,NULL, NULL },
{ L"Cmd Update Set mask", 8, 136, L"0x%lx", NULL, NULL,NULL, NULL },
{ L"Error Status Register", 12, 144, NULL, DumpGas, NULL,
ValidatePccErrStatusGas, NULL },
{ L"Error Status Mask", 8, 156, L"0x%lx", NULL, NULL,NULL, NULL },
};
/**
An ACPI_PARSER array describing the HW Registers based Communications
Subspace Structure - Type 5
*/
STATIC CONST ACPI_PARSER PccSubspaceType5Parser[] = {
STATIC CONST ACPI_PARSER PccSubspaceType5Parser[] = {
PCC_SUBSPACE_HEADER (),
{L"Version", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
{L"Base Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Shared Memory Range Length", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Doorbell Register", 12, 20, NULL, DumpGas, NULL,
ValidatePccMemoryIoGas, NULL},
{L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Command Complete Check Register", 12, 48, NULL, DumpGas, NULL,
ValidatePccMemoryIoGas, NULL},
{L"Command Complete Check Mask", 8, 60, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Error Status Register", 12, 68, NULL, DumpGas, NULL,
ValidatePccMemoryIoGas, NULL},
{L"Error Status Mask", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL},
{L"Nominal Latency", 4, 88, L"0x%x", NULL, NULL, NULL, NULL},
{L"Minimum Request Turnaround Time", 4, 92, L"0x%x", NULL, NULL, NULL, NULL}
{ L"Version", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Base Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Shared Memory Range Length",8, 12, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Doorbell Register", 12, 20, NULL, DumpGas, NULL,
ValidatePccMemoryIoGas,NULL },
{ L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Command Complete Check Register",12, 48, NULL, DumpGas, NULL,
ValidatePccMemoryIoGas,NULL },
{ L"Command Complete Check Mask",8, 60, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Error Status Register",12, 68, NULL, DumpGas, NULL,
ValidatePccMemoryIoGas,NULL },
{ L"Error Status Mask", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Nominal Latency", 4, 88, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Minimum Request Turnaround Time",4, 92, L"0x%x", NULL, NULL, NULL, NULL }
};
/**
@ -399,7 +403,7 @@ STATIC CONST ACPI_PARSER PccSubspaceType5Parser[] = {
STATIC
VOID
DumpPccSubspaceType0 (
IN UINT8* Ptr,
IN UINT8 *Ptr,
IN UINT8 Length
)
{
@ -422,7 +426,7 @@ DumpPccSubspaceType0 (
STATIC
VOID
DumpPccSubspaceType1 (
IN UINT8* Ptr,
IN UINT8 *Ptr,
IN UINT8 Length
)
{
@ -445,7 +449,7 @@ DumpPccSubspaceType1 (
STATIC
VOID
DumpPccSubspaceType2 (
IN UINT8* Ptr,
IN UINT8 *Ptr,
IN UINT8 Length
)
{
@ -468,7 +472,7 @@ DumpPccSubspaceType2 (
STATIC
VOID
DumpPccSubspaceType3 (
IN UINT8* Ptr,
IN UINT8 *Ptr,
IN UINT8 Length
)
{
@ -491,7 +495,7 @@ DumpPccSubspaceType3 (
STATIC
VOID
DumpPccSubspaceType4 (
IN UINT8* Ptr,
IN UINT8 *Ptr,
IN UINT8 Length
)
{
@ -514,7 +518,7 @@ DumpPccSubspaceType4 (
STATIC
VOID
DumpPccSubspaceType5 (
IN UINT8* Ptr,
IN UINT8 *Ptr,
IN UINT8 Length
)
{
@ -544,15 +548,15 @@ DumpPccSubspaceType5 (
VOID
EFIAPI
ParseAcpiPcct (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
UINT32 Offset;
UINT8* PccSubspacePtr;
UINTN SubspaceCount;
UINT32 Offset;
UINT8 *PccSubspacePtr;
UINTN SubspaceCount;
if (!Trace) {
return;
@ -584,11 +588,12 @@ ParseAcpiPcct (
// Check if the values used to control the parsing logic have been
// successfully read.
if ((PccSubspaceType == NULL) ||
(PccSubspaceLength == NULL)) {
(PccSubspaceLength == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient remaining table buffer length to read the " \
L"structure header. Length = %u.\n",
L"structure header. Length = %u.\n",
AcpiTableLength - Offset
);
return;
@ -596,11 +601,12 @@ ParseAcpiPcct (
// Validate Structure length
if ((*PccSubspaceLength == 0) ||
((Offset + (*PccSubspaceLength)) > AcpiTableLength)) {
((Offset + (*PccSubspaceLength)) > AcpiTableLength))
{
IncrementErrorCount ();
Print (
L"ERROR: Invalid Structure length. " \
L"Length = %u. Offset = %u. AcpiTableLength = %u.\n",
L"Length = %u. Offset = %u. AcpiTableLength = %u.\n",
*PccSubspaceLength,
Offset,
AcpiTableLength
@ -649,14 +655,14 @@ ParseAcpiPcct (
IncrementErrorCount ();
Print (
L"ERROR: Unknown PCC subspace structure:"
L" Type = %u, Length = %u\n",
L" Type = %u, Length = %u\n",
PccSubspaceType,
*PccSubspaceLength
);
}
PccSubspacePtr += *PccSubspaceLength;
Offset += *PccSubspaceLength;
Offset += *PccSubspaceLength;
SubspaceCount++;
} // while

View File

@ -11,17 +11,17 @@
/**
Minimum value for the 'length' field in subspaces of types 0, 1 and 2.
*/
#define MIN_MEMORY_RANGE_LENGTH 8
#define MIN_MEMORY_RANGE_LENGTH 8
/**
Minimum value for the 'length' field in subspaces of types 3 and 4.
*/
#define MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN 16
#define MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN 16
/**
Maximum number of PCC subspaces.
*/
#define MAX_PCC_SUBSPACES 256
#define MAX_PCC_SUBSPACES 256
/**
Parser for the header of any type of PCC subspace.

View File

@ -17,10 +17,10 @@
#include "PpttParser.h"
// Local variables
STATIC CONST UINT8* ProcessorTopologyStructureType;
STATIC CONST UINT8* ProcessorTopologyStructureLength;
STATIC CONST UINT32* NumberOfPrivateResources;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC CONST UINT8 *ProcessorTopologyStructureType;
STATIC CONST UINT8 *ProcessorTopologyStructureLength;
STATIC CONST UINT32 *NumberOfPrivateResources;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
This function validates the Cache Type Structure (Type 1) 'Number of sets'
@ -34,12 +34,13 @@ STATIC
VOID
EFIAPI
ValidateCacheNumberOfSets (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
UINT32 NumberOfSets;
NumberOfSets = *(UINT32*)Ptr;
UINT32 NumberOfSets;
NumberOfSets = *(UINT32 *)Ptr;
if (NumberOfSets == 0) {
IncrementErrorCount ();
@ -47,12 +48,12 @@ ValidateCacheNumberOfSets (
return;
}
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
if (NumberOfSets > PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX) {
IncrementErrorCount ();
Print (
L"\nERROR: When ARMv8.3-CCIDX is implemented the maximum cache number of "
L"sets must be less than or equal to %d",
L"sets must be less than or equal to %d",
PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX
);
return;
@ -62,14 +63,14 @@ ValidateCacheNumberOfSets (
IncrementWarningCount ();
Print (
L"\nWARNING: Without ARMv8.3-CCIDX, the maximum cache number of sets "
L"must be less than or equal to %d. Ignore this message if "
L"ARMv8.3-CCIDX is implemented",
L"must be less than or equal to %d. Ignore this message if "
L"ARMv8.3-CCIDX is implemented",
PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX
);
return;
}
#endif
#endif
}
/**
@ -84,12 +85,13 @@ STATIC
VOID
EFIAPI
ValidateCacheAssociativity (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
UINT8 Associativity;
Associativity = *(UINT8*)Ptr;
UINT8 Associativity;
Associativity = *(UINT8 *)Ptr;
if (Associativity == 0) {
IncrementErrorCount ();
@ -109,25 +111,26 @@ STATIC
VOID
EFIAPI
ValidateCacheLineSize (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
// Reference: ARM Architecture Reference Manual ARMv8 (D.a)
// Section D12.2.25: CCSIDR_EL1, Current Cache Size ID Register
// LineSize, bits [2:0]
// (Log2(Number of bytes in cache line)) - 4.
UINT16 LineSize;
LineSize = *(UINT16*)Ptr;
UINT16 LineSize;
LineSize = *(UINT16 *)Ptr;
if ((LineSize < PPTT_ARM_CACHE_LINE_SIZE_MIN) ||
(LineSize > PPTT_ARM_CACHE_LINE_SIZE_MAX)) {
(LineSize > PPTT_ARM_CACHE_LINE_SIZE_MAX))
{
IncrementErrorCount ();
Print (
L"\nERROR: The cache line size must be between %d and %d bytes"
L" on ARM Platforms.",
L" on ARM Platforms.",
PPTT_ARM_CACHE_LINE_SIZE_MIN,
PPTT_ARM_CACHE_LINE_SIZE_MAX
);
@ -138,7 +141,8 @@ ValidateCacheLineSize (
IncrementErrorCount ();
Print (L"\nERROR: The cache line size is not a power of 2.");
}
#endif
#endif
}
/**
@ -152,15 +156,16 @@ STATIC
VOID
EFIAPI
ValidateCacheAttributes (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
// Reference: Advanced Configuration and Power Interface (ACPI) Specification
// Version 6.2 Errata A, September 2017
// Table 5-153: Cache Type Structure
UINT8 Attributes;
Attributes = *(UINT8*)Ptr;
UINT8 Attributes;
Attributes = *(UINT8 *)Ptr;
if ((Attributes & 0xE0) != 0) {
IncrementErrorCount ();
@ -175,67 +180,67 @@ ValidateCacheAttributes (
/**
An ACPI_PARSER array describing the ACPI PPTT Table.
**/
STATIC CONST ACPI_PARSER PpttParser[] = {
STATIC CONST ACPI_PARSER PpttParser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo)
};
/**
An ACPI_PARSER array describing the processor topology structure header.
**/
STATIC CONST ACPI_PARSER ProcessorTopologyStructureHeaderParser[] = {
{L"Type", 1, 0, NULL, NULL, (VOID**)&ProcessorTopologyStructureType,
NULL, NULL},
{L"Length", 1, 1, NULL, NULL, (VOID**)&ProcessorTopologyStructureLength,
NULL, NULL},
{L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL}
STATIC CONST ACPI_PARSER ProcessorTopologyStructureHeaderParser[] = {
{ L"Type", 1, 0, NULL, NULL, (VOID **)&ProcessorTopologyStructureType,
NULL, NULL },
{ L"Length", 1, 1, NULL, NULL, (VOID **)&ProcessorTopologyStructureLength,
NULL, NULL },
{ L"Reserved", 2, 2, NULL, NULL, NULL, NULL,NULL }
};
/**
An ACPI_PARSER array describing the Processor Hierarchy Node Structure - Type 0.
**/
STATIC CONST ACPI_PARSER ProcessorHierarchyNodeStructureParser[] = {
{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},
STATIC CONST ACPI_PARSER ProcessorHierarchyNodeStructureParser[] = {
{ 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"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
{L"Parent", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
{L"ACPI Processor ID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
{L"Number of private resources", 4, 16, L"%d", NULL,
(VOID**)&NumberOfPrivateResources, NULL, NULL}
{ L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Parent", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"ACPI Processor ID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Number of private resources", 4, 16, L"%d", NULL,
(VOID **)&NumberOfPrivateResources, NULL, NULL }
};
/**
An ACPI_PARSER array describing the Cache Type Structure - Type 1.
**/
STATIC CONST ACPI_PARSER CacheTypeStructureParser[] = {
{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},
STATIC CONST ACPI_PARSER CacheTypeStructureParser[] = {
{ 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"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
{L"Next Level of Cache", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
{L"Size", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
{L"Number of sets", 4, 16, L"%d", NULL, NULL, ValidateCacheNumberOfSets, NULL},
{L"Associativity", 1, 20, L"%d", NULL, NULL, ValidateCacheAssociativity, NULL},
{L"Attributes", 1, 21, L"0x%x", NULL, NULL, ValidateCacheAttributes, NULL},
{L"Line size", 2, 22, L"%d", NULL, NULL, ValidateCacheLineSize, NULL}
{ L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Next Level of Cache", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Size", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Number of sets", 4, 16, L"%d", NULL, NULL, ValidateCacheNumberOfSets, NULL },
{ L"Associativity", 1, 20, L"%d", NULL, NULL, ValidateCacheAssociativity, NULL },
{ L"Attributes", 1, 21, L"0x%x", NULL, NULL, ValidateCacheAttributes, NULL },
{ L"Line size", 2, 22, L"%d", NULL, NULL, ValidateCacheLineSize, NULL }
};
/**
An ACPI_PARSER array describing the ID Type Structure - Type 2.
**/
STATIC CONST ACPI_PARSER IdStructureParser[] = {
{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},
STATIC CONST ACPI_PARSER IdStructureParser[] = {
{ 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"VENDOR_ID", 4, 4, NULL, Dump4Chars, NULL, NULL, NULL},
{L"LEVEL_1_ID", 8, 8, L"0x%x", NULL, NULL, NULL, NULL},
{L"LEVEL_2_ID", 8, 16, L"0x%x", NULL, NULL, NULL, NULL},
{L"MAJOR_REV", 2, 24, L"0x%x", NULL, NULL, NULL, NULL},
{L"MINOR_REV", 2, 26, L"0x%x", NULL, NULL, NULL, NULL},
{L"SPIN_REV", 2, 28, L"0x%x", NULL, NULL, NULL, NULL},
{ L"VENDOR_ID", 4, 4, NULL, Dump4Chars, NULL, NULL, NULL },
{ L"LEVEL_1_ID", 8, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"LEVEL_2_ID", 8, 16, L"0x%x", NULL, NULL, NULL, NULL },
{ L"MAJOR_REV", 2, 24, L"0x%x", NULL, NULL, NULL, NULL },
{ L"MINOR_REV", 2, 26, L"0x%x", NULL, NULL, NULL, NULL },
{ L"SPIN_REV", 2, 28, L"0x%x", NULL, NULL, NULL, NULL },
};
/**
@ -248,13 +253,13 @@ STATIC CONST ACPI_PARSER IdStructureParser[] = {
STATIC
VOID
DumpProcessorHierarchyNodeStructure (
IN UINT8* Ptr,
IN UINT8 *Ptr,
IN UINT8 Length
)
{
UINT32 Offset;
UINT32 Index;
CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
UINT32 Offset;
UINT32 Index;
CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
Offset = ParseAcpi (
TRUE,
@ -281,8 +286,8 @@ DumpProcessorHierarchyNodeStructure (
IncrementErrorCount ();
Print (
L"ERROR: Invalid Number of Private Resources. " \
L"PrivateResourceCount = %d. RemainingBufferLength = %d. " \
L"Parsing of this structure aborted.\n",
L"PrivateResourceCount = %d. RemainingBufferLength = %d. " \
L"Parsing of this structure aborted.\n",
*NumberOfPrivateResources,
Length - Offset
);
@ -304,7 +309,7 @@ DumpProcessorHierarchyNodeStructure (
PrintFieldName (4, Buffer);
Print (
L"0x%x\n",
*((UINT32*)(Ptr + Offset))
*((UINT32 *)(Ptr + Offset))
);
Offset += sizeof (UINT32);
@ -321,7 +326,7 @@ DumpProcessorHierarchyNodeStructure (
STATIC
VOID
DumpCacheTypeStructure (
IN UINT8* Ptr,
IN UINT8 *Ptr,
IN UINT8 Length
)
{
@ -344,8 +349,8 @@ DumpCacheTypeStructure (
STATIC
VOID
DumpIDStructure (
IN UINT8* Ptr,
IN UINT8 Length
IN UINT8 *Ptr,
IN UINT8 Length
)
{
ParseAcpi (
@ -378,14 +383,14 @@ DumpIDStructure (
VOID
EFIAPI
ParseAcpiPptt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
UINT32 Offset;
UINT8* ProcessorTopologyStructurePtr;
UINT32 Offset;
UINT8 *ProcessorTopologyStructurePtr;
if (!Trace) {
return;
@ -416,11 +421,12 @@ ParseAcpiPptt (
// Check if the values used to control the parsing logic have been
// successfully read.
if ((ProcessorTopologyStructureType == NULL) ||
(ProcessorTopologyStructureLength == NULL)) {
(ProcessorTopologyStructureLength == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient remaining table buffer length to read the " \
L"processor topology structure header. Length = %d.\n",
L"processor topology structure header. Length = %d.\n",
AcpiTableLength - Offset
);
return;
@ -428,11 +434,12 @@ ParseAcpiPptt (
// Validate Processor Topology Structure length
if ((*ProcessorTopologyStructureLength == 0) ||
((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength)) {
((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength))
{
IncrementErrorCount ();
Print (
L"ERROR: Invalid Processor Topology Structure length. " \
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*ProcessorTopologyStructureLength,
Offset,
AcpiTableLength
@ -466,13 +473,13 @@ ParseAcpiPptt (
IncrementErrorCount ();
Print (
L"ERROR: Unknown processor topology structure:"
L" Type = %d, Length = %d\n",
L" Type = %d, Length = %d\n",
*ProcessorTopologyStructureType,
*ProcessorTopologyStructureLength
);
}
ProcessorTopologyStructurePtr += *ProcessorTopologyStructureLength;
Offset += *ProcessorTopologyStructureLength;
Offset += *ProcessorTopologyStructureLength;
} // while
}

View File

@ -16,22 +16,22 @@
/// Cache parameters allowed by the architecture with
/// ARMv8.3-CCIDX (Cache extended number of sets)
/// Derived from CCSIDR_EL1 when ID_AA64MMFR2_EL1.CCIDX==0001
#define PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX (1 << 24)
#define PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX (1 << 21)
#define PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX (1 << 24)
#define PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX (1 << 21)
/// Cache parameters allowed by the architecture without
/// ARMv8.3-CCIDX (Cache extended number of sets)
/// Derived from CCSIDR_EL1 when ID_AA64MMFR2_EL1.CCIDX==0000
#define PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX (1 << 15)
#define PPTT_ARM_CACHE_ASSOCIATIVITY_MAX (1 << 10)
#define PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX (1 << 15)
#define PPTT_ARM_CACHE_ASSOCIATIVITY_MAX (1 << 10)
/// Common cache parameters
/// Derived from CCSIDR_EL1
/// The LineSize is represented by bits 2:0
/// (Log2(Number of bytes in cache line)) - 4 is used to represent
/// the LineSize bits.
#define PPTT_ARM_CACHE_LINE_SIZE_MAX (1 << 11)
#define PPTT_ARM_CACHE_LINE_SIZE_MIN (1 << 4)
#define PPTT_ARM_CACHE_LINE_SIZE_MAX (1 << 11)
#define PPTT_ARM_CACHE_LINE_SIZE_MIN (1 << 4)
#endif // if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)

View File

@ -13,7 +13,7 @@
#include "AcpiTableParser.h"
// Local Variables
STATIC CONST UINT64* XsdtAddress;
STATIC CONST UINT64 *XsdtAddress;
/**
This function validates the RSDT Address.
@ -26,19 +26,19 @@ STATIC
VOID
EFIAPI
ValidateRsdtAddress (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
// 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 RsdtAddr;
RsdtAddr = *(UINT32*)Ptr;
RsdtAddr = *(UINT32 *)Ptr;
if (RsdtAddr != 0) {
IncrementErrorCount ();
@ -47,7 +47,8 @@ ValidateRsdtAddress (
RsdtAddr
);
}
#endif
#endif
}
/**
@ -61,19 +62,19 @@ STATIC
VOID
EFIAPI
ValidateXsdtAddress (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
#if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
// 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 XsdtAddr;
XsdtAddr = *(UINT64*)Ptr;
XsdtAddr = *(UINT64 *)Ptr;
if (XsdtAddr == 0) {
IncrementErrorCount ();
@ -82,23 +83,24 @@ ValidateXsdtAddress (
XsdtAddr
);
}
#endif
#endif
}
/**
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},
{L"RSDT Address", 4, 16, L"0x%x", NULL, NULL, ValidateRsdtAddress, NULL},
{L"Length", 4, 20, L"%d", NULL, NULL, NULL, NULL},
{L"XSDT Address", 8, 24, L"0x%lx", NULL, (VOID**)&XsdtAddress,
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}
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 },
{ L"RSDT Address", 4, 16, L"0x%x", NULL, NULL, ValidateRsdtAddress, NULL },
{ L"Length", 4, 20, L"%d", NULL, NULL, NULL, NULL },
{ L"XSDT Address", 8, 24, L"0x%lx", NULL, (VOID **)&XsdtAddress,
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 }
};
/**
@ -118,10 +120,10 @@ STATIC CONST ACPI_PARSER RsdpParser[] = {
VOID
EFIAPI
ParseAcpiRsdp (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
if (Trace) {
@ -144,7 +146,7 @@ ParseAcpiRsdp (
IncrementErrorCount ();
Print (
L"ERROR: Insufficient table length. AcpiTableLength = %d." \
L"RSDP parsing aborted.\n",
L"RSDP parsing aborted.\n",
AcpiTableLength
);
return;
@ -160,5 +162,5 @@ ParseAcpiRsdp (
return;
}
ProcessAcpiTable ((UINT8*)(UINTN)(*XsdtAddress));
ProcessAcpiTable ((UINT8 *)(UINTN)(*XsdtAddress));
}

View File

@ -15,22 +15,22 @@
#include "AcpiTableParser.h"
// Local Variables
STATIC CONST UINT64* SlitSystemLocalityCount;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC CONST UINT64 *SlitSystemLocalityCount;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
An ACPI_PARSER array describing the ACPI SLIT table.
**/
STATIC CONST ACPI_PARSER SlitParser[] = {
STATIC CONST ACPI_PARSER SlitParser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo),
{L"Number of System Localities", 8, 36, L"0x%lx", NULL,
(VOID**)&SlitSystemLocalityCount, NULL, NULL}
{ L"Number of System Localities", 8, 36, L"0x%lx", NULL,
(VOID **)&SlitSystemLocalityCount,NULL, NULL }
};
/**
Macro to get the value of a System Locality
**/
#define SLIT_ELEMENT(Ptr, i, j) *(Ptr + (i * LocalityCount) + j)
#define SLIT_ELEMENT(Ptr, i, j) *(Ptr + (i * LocalityCount) + j)
/**
This function parses the ACPI SLIT table.
@ -50,18 +50,18 @@ STATIC CONST ACPI_PARSER SlitParser[] = {
VOID
EFIAPI
ParseAcpiSlit (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
UINT32 Offset;
UINT32 Count;
UINT32 Index;
UINT32 LocalityCount;
UINT8* LocalityPtr;
CHAR16 Buffer[80]; // Used for AsciiName param of ParseAcpi
UINT32 Offset;
UINT32 Count;
UINT32 Index;
UINT32 LocalityCount;
UINT8 *LocalityPtr;
CHAR16 Buffer[80]; // Used for AsciiName param of ParseAcpi
if (!Trace) {
return;
@ -103,8 +103,8 @@ ParseAcpiSlit (
IncrementErrorCount ();
Print (
L"ERROR: The Number of System Localities provided can't be represented " \
L"in the SLIT table. SlitSystemLocalityCount = %ld. " \
L"MaxLocalityCountAllowed = %d.\n",
L"in the SLIT table. SlitSystemLocalityCount = %ld. " \
L"MaxLocalityCountAllowed = %d.\n",
*SlitSystemLocalityCount,
MAX_UINT16
);
@ -118,7 +118,7 @@ ParseAcpiSlit (
IncrementErrorCount ();
Print (
L"ERROR: Invalid Number of System Localities. " \
L"SlitSystemLocalityCount = %ld. AcpiTableLength = %d.\n",
L"SlitSystemLocalityCount = %ld. AcpiTableLength = %d.\n",
*SlitSystemLocalityCount,
AcpiTableLength
);
@ -144,12 +144,14 @@ ParseAcpiSlit (
for (Index = 0; Index < LocalityCount; Index++) {
Print (L" (%3d) ", Index);
}
Print (L"\n");
for (Count = 0; Count< LocalityCount; Count++) {
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");
}
}
@ -158,23 +160,25 @@ ParseAcpiSlit (
for (Count = 0; Count < LocalityCount; Count++) {
for (Index = 0; Index < LocalityCount; Index++) {
// Element[x][x] must be equal to 10
if ((Count == Index) && (SLIT_ELEMENT (LocalityPtr, Count,Index) != 10)) {
if ((Count == Index) && (SLIT_ELEMENT (LocalityPtr, Count, Index) != 10)) {
IncrementErrorCount ();
Print (
L"ERROR: Diagonal Element[0x%lx][0x%lx] (%3d)."
L" Normalized Value is not 10\n",
L" Normalized Value is not 10\n",
Count,
Index,
SLIT_ELEMENT (LocalityPtr, Count, Index)
);
}
// Element[i][j] must be equal to Element[j][i]
if (SLIT_ELEMENT (LocalityPtr, Count, Index) !=
SLIT_ELEMENT (LocalityPtr, Index, Count)) {
SLIT_ELEMENT (LocalityPtr, Index, Count))
{
IncrementErrorCount ();
Print (
L"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and \n"
L"Element[0x%lx][0x%lx] (%3d) do not match.\n",
L"Element[0x%lx][0x%lx] (%3d) do not match.\n",
Count,
Index,
SLIT_ELEMENT (LocalityPtr, Count, Index),

View File

@ -16,7 +16,7 @@
#include "AcpiTableParser.h"
// Local variables
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
This function validates the Interrupt Type.
@ -29,24 +29,26 @@ STATIC
VOID
EFIAPI
ValidateInterruptType (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
UINT8 InterruptType;
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
UINT8 InterruptType;
InterruptType = *Ptr;
if (InterruptType !=
EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC) {
EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC)
{
IncrementErrorCount ();
Print (
L"\nERROR: InterruptType = %d. This must be 8 on ARM Platforms",
InterruptType
);
}
#endif
#endif
}
/**
@ -60,12 +62,12 @@ STATIC
VOID
EFIAPI
ValidateIrq (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
UINT8 Irq;
#if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
UINT8 Irq;
Irq = *Ptr;
@ -76,35 +78,36 @@ ValidateIrq (
Irq
);
}
#endif
#endif
}
/**
An ACPI_PARSER array describing the ACPI SPCR Table.
**/
STATIC CONST ACPI_PARSER SpcrParser[] = {
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},
{L"Interrupt Type", 1, 52, L"%d", NULL, NULL, ValidateInterruptType, NULL},
{L"IRQ", 1, 53, L"%d", NULL, NULL, ValidateIrq, NULL},
{L"Global System Interrupt", 4, 54, L"0x%x", NULL, NULL, NULL, NULL},
{L"Baud Rate", 1, 58, L"%d", NULL, NULL, NULL, NULL},
{L"Parity", 1, 59, L"%d", NULL, NULL, NULL, NULL},
{L"Stop Bits", 1, 60, L"%d", NULL, NULL, NULL, NULL},
{L"Flow Control", 1, 61, L"0x%x", NULL, NULL, NULL, NULL},
{L"Terminal Type", 1, 62, L"%d", NULL, NULL, NULL, NULL},
{L"Reserved", 1, 63, L"%x", NULL, NULL, NULL, NULL},
{ 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 },
{ L"Interrupt Type", 1, 52, L"%d", NULL, NULL, ValidateInterruptType, NULL },
{ L"IRQ", 1, 53, L"%d", NULL, NULL, ValidateIrq, NULL },
{ L"Global System Interrupt", 4, 54, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Baud Rate", 1, 58, L"%d", NULL, NULL, NULL, NULL },
{ L"Parity", 1, 59, L"%d", NULL, NULL, NULL, NULL },
{ L"Stop Bits", 1, 60, L"%d", NULL, NULL, NULL, NULL },
{ L"Flow Control", 1, 61, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Terminal Type", 1, 62, L"%d", NULL, NULL, NULL, NULL },
{ L"Reserved", 1, 63, L"%x", NULL, NULL, NULL, NULL },
{L"PCI Device ID", 2, 64, L"0x%x", NULL, NULL, NULL, NULL},
{L"PCI Vendor ID", 2, 66, L"0x%x", NULL, NULL, NULL, NULL},
{L"PCI Bus Number", 1, 68, L"0x%x", NULL, NULL, NULL, NULL},
{L"PCI Device Number", 1, 69, L"0x%x", NULL, NULL, NULL, NULL},
{L"PCI Function Number", 1, 70, L"0x%x", NULL, NULL, NULL, NULL},
{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}
{ L"PCI Device ID", 2, 64, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PCI Vendor ID", 2, 66, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PCI Bus Number", 1, 68, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PCI Device Number", 1, 69, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PCI Function Number", 1, 70, L"0x%x", NULL, NULL, NULL, NULL },
{ 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 }
};
/**
@ -122,10 +125,10 @@ STATIC CONST ACPI_PARSER SpcrParser[] = {
VOID
EFIAPI
ParseAcpiSpcr (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
if (!Trace) {

View File

@ -16,10 +16,10 @@
#include "AcpiViewConfig.h"
// Local Variables
STATIC CONST UINT8* SratRAType;
STATIC CONST UINT8* SratRALength;
STATIC CONST UINT8* SratDeviceHandleType;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC CONST UINT8 *SratRAType;
STATIC CONST UINT8 *SratRALength;
STATIC CONST UINT8 *SratDeviceHandleType;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
This function validates the Reserved field in the SRAT table header.
@ -32,11 +32,11 @@ STATIC
VOID
EFIAPI
ValidateSratReserved (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
if (*(UINT32*)Ptr != 1) {
if (*(UINT32 *)Ptr != 1) {
IncrementErrorCount ();
Print (L"\nERROR: Reserved should be 1 for backward compatibility.\n");
}
@ -54,11 +54,11 @@ STATIC
VOID
EFIAPI
ValidateSratDeviceHandleType (
IN UINT8* Ptr,
IN VOID* Context
IN UINT8 *Ptr,
IN VOID *Context
)
{
UINT8 DeviceHandleType;
UINT8 DeviceHandleType;
DeviceHandleType = *Ptr;
@ -82,11 +82,11 @@ STATIC
VOID
EFIAPI
DumpSratPciBdfNumber (
IN CONST CHAR16* Format,
IN UINT8* Ptr
IN CONST CHAR16 *Format,
IN UINT8 *Ptr
)
{
CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];
Print (L"\n");
@ -143,20 +143,20 @@ DumpSratPciBdfNumber (
/**
An ACPI_PARSER array describing the Device Handle - ACPI
**/
STATIC CONST ACPI_PARSER SratDeviceHandleAcpiParser[] = {
{L"ACPI_HID", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL},
{L"ACPI_UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}
STATIC CONST ACPI_PARSER SratDeviceHandleAcpiParser[] = {
{ L"ACPI_HID", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"ACPI_UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }
};
/**
An ACPI_PARSER array describing the Device Handle - PCI
**/
STATIC CONST ACPI_PARSER SratDeviceHandlePciParser[] = {
{L"PCI Segment", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},
{L"PCI BDF Number", 2, 2, NULL, DumpSratPciBdfNumber, NULL, NULL, NULL},
{L"Reserved", 12, 4, L"%x %x %x %x - %x %x %x %x - %x %x %x %x", Dump12Chars,
NULL, NULL, NULL}
STATIC CONST ACPI_PARSER SratDeviceHandlePciParser[] = {
{ L"PCI Segment", 2, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PCI BDF Number", 2, 2, NULL, DumpSratPciBdfNumber, NULL, NULL, NULL },
{ L"Reserved", 12, 4, L"%x %x %x %x - %x %x %x %x - %x %x %x %x", Dump12Chars,
NULL, NULL, NULL }
};
/**
@ -170,9 +170,9 @@ STATIC
VOID
EFIAPI
DumpSratDeviceHandle (
IN CONST CHAR16* Format,
IN UINT8* Ptr
)
IN CONST CHAR16 *Format,
IN UINT8 *Ptr
)
{
if (SratDeviceHandleType == NULL) {
IncrementErrorCount ();
@ -213,11 +213,11 @@ STATIC
VOID
EFIAPI
DumpSratApicProximity (
IN CONST CHAR16* Format,
IN UINT8* Ptr
)
IN CONST CHAR16 *Format,
IN UINT8 *Ptr
)
{
UINT32 ProximityDomain;
UINT32 ProximityDomain;
ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16);
@ -227,108 +227,108 @@ DumpSratApicProximity (
/**
An ACPI_PARSER array describing the SRAT Table.
**/
STATIC CONST ACPI_PARSER SratParser[] = {
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}
{ 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.
**/
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}
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.
**/
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},
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}
{ 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.
**/
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},
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},
{ 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 Generic Initiator Affinity Structure
**/
STATIC CONST ACPI_PARSER SratGenericInitiatorAffinityParser[] = {
{L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},
{L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},
STATIC CONST ACPI_PARSER SratGenericInitiatorAffinityParser[] = {
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL },
{L"Reserved", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},
{L"Device Handle Type", 1, 3, L"%d", NULL, (VOID**)&SratDeviceHandleType,
ValidateSratDeviceHandleType, NULL},
{L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
{L"Device Handle", 16, 8, L"%s", DumpSratDeviceHandle, 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}
{ L"Reserved", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Device Handle Type", 1, 3, L"%d", NULL, (VOID **)&SratDeviceHandleType,
ValidateSratDeviceHandleType, NULL },
{ L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Device Handle", 16, 8, L"%s", DumpSratDeviceHandle, 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 }
};
/**
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},
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},
{L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL},
{L"Base Address Low", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
{L"Base Address High", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
{L"Length Low", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
{L"Length High", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},
{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}
{ L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Base Address Low", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Base Address High", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length Low", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length High", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
{ 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.
**/
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},
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},
{L"APIC ID", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},
{L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
{L"Local SAPIC EID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL},
{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}
{ L"Proximity Domain [7:0]", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"APIC ID", 1, 3, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Local SAPIC EID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ 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.
**/
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},
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},
{L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},
{L"X2APIC ID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},
{L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},
{L"Clock Domain", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},
{L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL}
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"X2APIC ID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Clock Domain", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL }
};
/**
@ -352,28 +352,28 @@ STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] = {
VOID
EFIAPI
ParseAcpiSrat (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
UINT32 Offset;
UINT8* ResourcePtr;
UINT32 GicCAffinityIndex;
UINT32 GicITSAffinityIndex;
UINT32 GenericInitiatorAffinityIndex;
UINT32 MemoryAffinityIndex;
UINT32 ApicSapicAffinityIndex;
UINT32 X2ApicAffinityIndex;
CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi
UINT32 Offset;
UINT8 *ResourcePtr;
UINT32 GicCAffinityIndex;
UINT32 GicITSAffinityIndex;
UINT32 GenericInitiatorAffinityIndex;
UINT32 MemoryAffinityIndex;
UINT32 ApicSapicAffinityIndex;
UINT32 X2ApicAffinityIndex;
CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi
GicCAffinityIndex = 0;
GicITSAffinityIndex = 0;
GicCAffinityIndex = 0;
GicITSAffinityIndex = 0;
GenericInitiatorAffinityIndex = 0;
MemoryAffinityIndex = 0;
ApicSapicAffinityIndex = 0;
X2ApicAffinityIndex = 0;
MemoryAffinityIndex = 0;
ApicSapicAffinityIndex = 0;
X2ApicAffinityIndex = 0;
if (!Trace) {
return;
@ -403,11 +403,12 @@ ParseAcpiSrat (
// Check if the values used to control the parsing logic have been
// successfully read.
if ((SratRAType == NULL) ||
(SratRALength == NULL)) {
(SratRALength == NULL))
{
IncrementErrorCount ();
Print (
L"ERROR: Insufficient remaining table buffer length to read the " \
L"Static Resource Allocation structure header. Length = %d.\n",
L"Static Resource Allocation structure header. Length = %d.\n",
AcpiTableLength - Offset
);
return;
@ -415,11 +416,12 @@ ParseAcpiSrat (
// Validate Static Resource Allocation Structure length
if ((*SratRALength == 0) ||
((Offset + (*SratRALength)) > AcpiTableLength)) {
((Offset + (*SratRALength)) > AcpiTableLength))
{
IncrementErrorCount ();
Print (
L"ERROR: Invalid Static Resource Allocation Structure length. " \
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
L"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
*SratRALength,
Offset,
AcpiTableLength
@ -451,7 +453,7 @@ ParseAcpiSrat (
sizeof (Buffer),
"GIC ITS Affinity Structure [%d]",
GicITSAffinityIndex++
);
);
ParseAcpi (
TRUE,
2,
@ -468,7 +470,7 @@ ParseAcpiSrat (
sizeof (Buffer),
"Generic Initiator Affinity Structure [%d]",
GenericInitiatorAffinityIndex++
);
);
ParseAcpi (
TRUE,
2,
@ -476,7 +478,7 @@ ParseAcpiSrat (
ResourcePtr,
*SratRALength,
PARSER_PARAMS (SratGenericInitiatorAffinityParser)
);
);
break;
case EFI_ACPI_6_3_MEMORY_AFFINITY:
@ -537,6 +539,6 @@ ParseAcpiSrat (
}
ResourcePtr += (*SratRALength);
Offset += (*SratRALength);
Offset += (*SratRALength);
}
}

View File

@ -28,10 +28,10 @@
VOID
EFIAPI
ParseAcpiSsdt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
if (!Trace) {

View File

@ -15,11 +15,11 @@
#include "AcpiTableParser.h"
// Local variables
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/** An ACPI_PARSER array describing the ACPI XSDT table.
*/
STATIC CONST ACPI_PARSER XsdtParser[] = {
STATIC CONST ACPI_PARSER XsdtParser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo)
};
@ -30,7 +30,7 @@ CONST ACPI_DESCRIPTION_HEADER_INFO *
EFIAPI
GetAcpiXsdtHeaderInfo (
VOID
)
)
{
return &AcpiHdrInfo;
}
@ -48,17 +48,17 @@ GetAcpiXsdtHeaderInfo (
VOID
EFIAPI
ParseAcpiXsdt (
IN BOOLEAN Trace,
IN UINT8* Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
UINT32 Offset;
UINT32 TableOffset;
UINT64* TablePointer;
UINTN EntryIndex;
CHAR16 Buffer[32];
UINT32 Offset;
UINT32 TableOffset;
UINT64 *TablePointer;
UINTN EntryIndex;
CHAR16 Buffer[32];
Offset = ParseAcpi (
Trace,
@ -72,24 +72,24 @@ ParseAcpiXsdt (
TableOffset = Offset;
if (Trace) {
EntryIndex = 0;
TablePointer = (UINT64*)(Ptr + TableOffset);
EntryIndex = 0;
TablePointer = (UINT64 *)(Ptr + TableOffset);
while (Offset < AcpiTableLength) {
CONST UINT32* Signature;
CONST UINT32* Length;
CONST UINT8* Revision;
CONST UINT32 *Signature;
CONST UINT32 *Length;
CONST UINT8 *Revision;
if ((UINT64*)(UINTN)(*TablePointer) != NULL) {
UINT8* SignaturePtr;
if ((UINT64 *)(UINTN)(*TablePointer) != NULL) {
UINT8 *SignaturePtr;
ParseAcpiHeader (
(UINT8*)(UINTN)(*TablePointer),
(UINT8 *)(UINTN)(*TablePointer),
&Signature,
&Length,
&Revision
);
SignaturePtr = (UINT8*)Signature;
SignaturePtr = (UINT8 *)Signature;
UnicodeSPrint (
Buffer,
@ -114,7 +114,7 @@ ParseAcpiXsdt (
Print (L"0x%lx\n", *TablePointer);
// Validate the table pointers are not NULL
if ((UINT64*)(UINTN)(*TablePointer) == NULL) {
if ((UINT64 *)(UINTN)(*TablePointer) == NULL) {
IncrementErrorCount ();
Print (
L"ERROR: Invalid table entry at 0x%lx, table address is 0x%lx\n",
@ -122,18 +122,20 @@ ParseAcpiXsdt (
*TablePointer
);
}
Offset += sizeof (UINT64);
TablePointer++;
} // while
}
// Process the tables
Offset = TableOffset;
TablePointer = (UINT64*)(Ptr + TableOffset);
Offset = TableOffset;
TablePointer = (UINT64 *)(Ptr + TableOffset);
while (Offset < AcpiTableLength) {
if ((UINT64*)(UINTN)(*TablePointer) != NULL) {
ProcessAcpiTable ((UINT8*)(UINTN)(*TablePointer));
if ((UINT64 *)(UINTN)(*TablePointer) != NULL) {
ProcessAcpiTable ((UINT8 *)(UINTN)(*TablePointer));
}
Offset += sizeof (UINT64);
TablePointer++;
} // while

View File

@ -25,20 +25,20 @@
#include "AcpiView.h"
#include "AcpiViewConfig.h"
CONST CHAR16 gShellAcpiViewFileName[] = L"ShellCommand";
EFI_HII_HANDLE gShellAcpiViewHiiHandle = NULL;
CONST CHAR16 gShellAcpiViewFileName[] = L"ShellCommand";
EFI_HII_HANDLE gShellAcpiViewHiiHandle = NULL;
/**
An array of acpiview command line parameters.
**/
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
{L"-q", TypeFlag},
{L"-d", TypeFlag},
{L"-h", TypeFlag},
{L"-l", TypeFlag},
{L"-s", TypeValue},
{L"-r", TypeValue},
{NULL, TypeMax}
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
{ L"-q", TypeFlag },
{ L"-d", TypeFlag },
{ L"-h", TypeFlag },
{ L"-l", TypeFlag },
{ L"-s", TypeValue },
{ L"-r", TypeValue },
{ NULL, TypeMax }
};
/**
@ -46,30 +46,30 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
*/
STATIC
CONST
ACPI_TABLE_PARSER ParserList[] = {
{EFI_ACPI_6_3_ARM_ERROR_SOURCE_TABLE_SIGNATURE, ParseAcpiAest},
{EFI_ACPI_6_2_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE, ParseAcpiBgrt},
{EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, ParseAcpiDbg2},
{EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
ParseAcpiDsdt},
{EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE, ParseAcpiFacs},
{EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiFadt},
{EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiGtdt},
{EFI_ACPI_6_4_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_SIGNATURE, ParseAcpiHmat},
{EFI_ACPI_6_2_IO_REMAPPING_TABLE_SIGNATURE, ParseAcpiIort},
{EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiMadt},
{EFI_ACPI_6_2_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
ParseAcpiMcfg},
{EFI_ACPI_6_4_PLATFORM_COMMUNICATIONS_CHANNEL_TABLE_SIGNATURE,
ParseAcpiPcct},
{EFI_ACPI_6_2_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE,
ParseAcpiPptt},
{RSDP_TABLE_INFO, ParseAcpiRsdp},
{EFI_ACPI_6_2_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE, ParseAcpiSlit},
{EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, ParseAcpiSpcr},
{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}
ACPI_TABLE_PARSER ParserList[] = {
{ EFI_ACPI_6_3_ARM_ERROR_SOURCE_TABLE_SIGNATURE, ParseAcpiAest },
{ EFI_ACPI_6_2_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE, ParseAcpiBgrt },
{ EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, ParseAcpiDbg2 },
{ EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
ParseAcpiDsdt },
{ EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE, ParseAcpiFacs },
{ EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiFadt },
{ EFI_ACPI_6_4_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiGtdt },
{ EFI_ACPI_6_4_HETEROGENEOUS_MEMORY_ATTRIBUTE_TABLE_SIGNATURE, ParseAcpiHmat },
{ EFI_ACPI_6_2_IO_REMAPPING_TABLE_SIGNATURE, ParseAcpiIort },
{ EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiMadt },
{ EFI_ACPI_6_2_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
ParseAcpiMcfg },
{ EFI_ACPI_6_4_PLATFORM_COMMUNICATIONS_CHANNEL_TABLE_SIGNATURE,
ParseAcpiPcct },
{ EFI_ACPI_6_2_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE,
ParseAcpiPptt },
{ RSDP_TABLE_INFO, ParseAcpiRsdp },
{ EFI_ACPI_6_2_SYSTEM_LOCALITY_INFORMATION_TABLE_SIGNATURE, ParseAcpiSlit },
{ EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, ParseAcpiSpcr },
{ 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 }
};
/**
@ -86,11 +86,11 @@ EFI_STATUS
RegisterAllParsers (
)
{
EFI_STATUS Status;
UINTN Count;
EFI_STATUS Status;
UINTN Count;
Status = EFI_SUCCESS;
Count = sizeof (ParserList) / sizeof (ParserList[0]);
Count = sizeof (ParserList) / sizeof (ParserList[0]);
while (Count-- != 0) {
Status = RegisterParser (
@ -101,6 +101,7 @@ RegisterAllParsers (
return Status;
}
}
return Status;
}
@ -116,14 +117,14 @@ RegisterAllParsers (
UINTN
EFIAPI
ShellDumpBufferToFile (
IN CONST CHAR16* FileNameBuffer,
IN CONST VOID* Buffer,
IN CONST CHAR16 *FileNameBuffer,
IN CONST VOID *Buffer,
IN CONST UINTN BufferSize
)
{
EFI_STATUS Status;
SHELL_FILE_HANDLE DumpFileHandle;
UINTN TransferBytes;
EFI_STATUS Status;
SHELL_FILE_HANDLE DumpFileHandle;
UINTN TransferBytes;
Status = ShellOpenFileByName (
FileNameBuffer,
@ -145,11 +146,11 @@ ShellDumpBufferToFile (
}
TransferBytes = BufferSize;
Status = ShellWriteFile (
DumpFileHandle,
&TransferBytes,
(VOID *) Buffer
);
Status = ShellWriteFile (
DumpFileHandle,
&TransferBytes,
(VOID *)Buffer
);
if (EFI_ERROR (Status)) {
Print (L"ERROR: Failed to write binary file.\n");
@ -167,7 +168,7 @@ ShellDumpBufferToFile (
@return The string pointer to the file name.
**/
CONST CHAR16*
CONST CHAR16 *
EFIAPI
ShellCommandGetManFileNameAcpiView (
VOID
@ -190,27 +191,27 @@ SHELL_STATUS
EFIAPI
ShellCommandRunAcpiView (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE* SystemTable
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
SHELL_STATUS ShellStatus;
LIST_ENTRY* Package;
CHAR16* ProblemParam;
LIST_ENTRY *Package;
CHAR16 *ProblemParam;
SHELL_FILE_HANDLE TmpDumpFileHandle;
CONST CHAR16* MandatoryTableSpecStr;
CONST CHAR16* SelectedTableName;
CONST CHAR16 *MandatoryTableSpecStr;
CONST CHAR16 *SelectedTableName;
// Set configuration defaults
AcpiConfigSetDefaults ();
ShellStatus = SHELL_SUCCESS;
Package = NULL;
ShellStatus = SHELL_SUCCESS;
Package = NULL;
TmpDumpFileHandle = NULL;
Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
if (EFI_ERROR (Status)) {
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
ShellPrintHiiEx (
-1,
-1,
@ -224,6 +225,7 @@ ShellCommandRunAcpiView (
} else {
Print (L"acpiview: Error processing input parameter(s)\n");
}
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
if (ShellCommandLineGetCount (Package) > 1) {
@ -246,7 +248,8 @@ ShellCommandRunAcpiView (
L"acpiview"
);
} else if (ShellCommandLineGetFlag (Package, L"-s") &&
ShellCommandLineGetValue (Package, L"-s") == NULL) {
(ShellCommandLineGetValue (Package, L"-s") == NULL))
{
ShellPrintHiiEx (
-1,
-1,
@ -258,7 +261,8 @@ ShellCommandRunAcpiView (
);
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellCommandLineGetFlag (Package, L"-r") &&
ShellCommandLineGetValue (Package, L"-r") == NULL) {
(ShellCommandLineGetValue (Package, L"-r") == NULL))
{
ShellPrintHiiEx (
-1,
-1,
@ -270,7 +274,8 @@ ShellCommandRunAcpiView (
);
ShellStatus = SHELL_INVALID_PARAMETER;
} else if ((ShellCommandLineGetFlag (Package, L"-s") &&
ShellCommandLineGetFlag (Package, L"-l"))) {
ShellCommandLineGetFlag (Package, L"-l")))
{
ShellPrintHiiEx (
-1,
-1,
@ -281,18 +286,19 @@ ShellCommandRunAcpiView (
);
ShellStatus = SHELL_INVALID_PARAMETER;
} else if (ShellCommandLineGetFlag (Package, L"-d") &&
!ShellCommandLineGetFlag (Package, L"-s")) {
ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_GEN_MISSING_OPTION),
gShellAcpiViewHiiHandle,
L"acpiview",
L"-s",
L"-d"
);
ShellStatus = SHELL_INVALID_PARAMETER;
!ShellCommandLineGetFlag (Package, L"-s"))
{
ShellPrintHiiEx (
-1,
-1,
NULL,
STRING_TOKEN (STR_GEN_MISSING_OPTION),
gShellAcpiViewHiiHandle,
L"acpiview",
L"-s",
L"-d"
);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
// Turn on colour highlighting if requested
SetColourHighlighting (ShellCommandLineGetFlag (Package, L"-h"));
@ -316,9 +322,9 @@ ShellCommandRunAcpiView (
SelectAcpiTable (SelectedTableName);
SetReportOption (ReportSelected);
if (ShellCommandLineGetFlag (Package, L"-d")) {
if (ShellCommandLineGetFlag (Package, L"-d")) {
// Create a temporary file to check if the media is writable.
CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
SetReportOption (ReportDumpBinFile);
UnicodeSPrint (
@ -337,7 +343,7 @@ ShellCommandRunAcpiView (
);
if (EFI_ERROR (Status)) {
ShellStatus = SHELL_INVALID_PARAMETER;
ShellStatus = SHELL_INVALID_PARAMETER;
TmpDumpFileHandle = NULL;
ShellPrintHiiEx (
-1,
@ -349,6 +355,7 @@ ShellCommandRunAcpiView (
);
goto Done;
}
// Delete Temporary file.
ShellDeleteFile (&TmpDumpFileHandle);
} // -d
@ -367,6 +374,7 @@ Done:
if (Package != NULL) {
ShellCommandLineFreeVarList (Package);
}
return ShellStatus;
}
@ -389,7 +397,8 @@ UefiShellAcpiViewCommandLibConstructor (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_STATUS Status;
gShellAcpiViewHiiHandle = NULL;
// Check Shell Profile Debug1 bit of the profiles mask
@ -412,6 +421,7 @@ UefiShellAcpiViewCommandLibConstructor (
if (gShellAcpiViewHiiHandle == NULL) {
return EFI_DEVICE_ERROR;
}
// Install our Shell command handler
ShellCommandRegisterCommandName (
L"acpiview",
@ -443,5 +453,6 @@ UefiShellAcpiViewCommandLibDestructor (
if (gShellAcpiViewHiiHandle != NULL) {
HiiRemovePackages (gShellAcpiViewHiiHandle);
}
return EFI_SUCCESS;
}