62 if (*(UINT32 *)Ptr != 0) {
64 Print (L
"\nERROR: IORT ID Mapping count must be zero.");
86 if (*(UINT32 *)Ptr > 1) {
88 Print (L
"\nERROR: IORT ID Mapping count must not be greater than 1.");
109 if (*(UINT32 *)Ptr != 0) {
111 Print (L
"\nERROR: IORT ID Mapping offset must be zero.");
135 Value = *(UINT64 *)Ptr;
136 if ((Value == 0) || ((Value & (SIZE_64KB - 1)) != 0)) {
138 Print (L
"\nERROR: Physical Range must be 64K aligned and cannot be zero.");
159 if (*(UINT32 *)Ptr == 0) {
161 Print (L
"\nERROR: Memory Range Descriptor count must be >=1.");
173#define PARSE_IORT_NODE_HEADER(ValidateIdMappingCount, \
174 ValidateIdArrayReference) \
175 { L"Type", 1, 0, L"%d", NULL, (VOID**)&IortNodeType, NULL, NULL }, \
176 { L"Length", 2, 1, L"%d", NULL, (VOID**)&IortNodeLength, NULL, NULL }, \
177 { L"Revision", 1, 3, L"%d", NULL, (VOID**)&IortNodeRevision, NULL, NULL }, \
178 { L"Identifier", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, \
179 { L"Number of ID mappings", 4, 8, L"%d", NULL, \
180 (VOID**)&IortIdMappingCount, ValidateIdMappingCount, NULL }, \
181 { L"Reference to ID Array", 4, 12, L"0x%x", NULL, \
182 (VOID**)&IortIdMappingOffset, ValidateIdArrayReference, NULL }
189 { L
"Number of IORT Nodes", 4, 36, L
"%d",
NULL,
190 (VOID **)&IortNodeCount,
NULL,
NULL },
191 { L
"Offset to Array of IORT Nodes",4, 40, L
"0x%x",
NULL,
192 (VOID **)&IortNodeOffset,
NULL,
NULL },
212 { L
"Global Interrupt Array Ref", 4, 40, L
"0x%x",
NULL,
NULL,
NULL,
214 { L
"Number of context interrupts", 4, 44, L
"%d",
NULL,
215 (VOID **)&InterruptContextCount,
NULL,
NULL },
216 { L
"Context Interrupt Array Ref", 4, 48, L
"0x%x",
NULL,
217 (VOID **)&InterruptContextOffset,
NULL,
NULL },
218 { L
"Number of PMU Interrupts", 4, 52, L
"%d",
NULL,
219 (VOID **)&PmuInterruptCount,
NULL,
NULL },
220 { L
"PMU Interrupt Array Ref", 4, 56, L
"0x%x",
NULL,
221 (VOID **)&PmuInterruptOffset,
NULL,
NULL },
225 { L
"SMMU_NSgIrpt interrupt flags", 4, 64, L
"0x%x",
NULL,
NULL,
NULL,
NULL },
227 { L
"SMMU_NSgCfgIrpt interrupt flags",4, 72, L
"0x%x",
NULL,
NULL,
NULL,
NULL }
275 { L
"Number of ITSs", 4,16, L
"%d",
NULL, (VOID **)&ItsCount,
NULL }
282 { L
"GIC ITS Identifier", 4, 0, L
"%d",
NULL,
NULL,
NULL }
292 { L
"Device memory address size limit",1, 28, L
"%d",
NULL,
NULL,
NULL,
NULL }
326 { L
"Memory Range Desc count", 4, 20, L
"%d",
NULL,
328 { L
"Memory Range Desc Ref", 4, 24, L
"0x%x",
NULL,
329 (VOID **)&RmrMemDescOffset,
NULL,
NULL }
355 IN UINT32 MappingCount
365 while ((Index < MappingCount) &&
400 IN UINT32 MappingCount,
401 IN UINT32 MappingOffset
411 "SMMUv1 or SMMUv2 Node",
419 if ((InterruptContextCount ==
NULL) ||
420 (InterruptContextOffset ==
NULL) ||
421 (PmuInterruptCount ==
NULL) ||
422 (PmuInterruptOffset ==
NULL))
426 L
"ERROR: Insufficient SMMUv1/2 node length. Length = %d\n",
432 Offset = *InterruptContextOffset;
435 while ((Index < *InterruptContextCount) &&
441 "Context Interrupts Array [%d]",
455 Offset = *PmuInterruptOffset;
458 while ((Index < *PmuInterruptCount) &&
464 "PMU Interrupts Array [%d]",
480 Length - MappingOffset,
499 IN UINT32 MappingCount,
500 IN UINT32 MappingOffset
514 Length - MappingOffset,
547 if (ItsCount ==
NULL) {
550 L
"ERROR: Insufficient ITS group length. Length = %d.\n",
558 while ((Index < *ItsCount) &&
564 "GIC ITS Identifier Array [%d]",
595 IN UINT32 MappingCount,
596 IN UINT32 MappingOffset
604 "Named Component Node",
613 while ((*(Ptr + Offset) != 0) &&
616 Print (L
"%c", *(Ptr + Offset));
624 Length - MappingOffset,
643 IN UINT32 MappingCount,
644 IN UINT32 MappingOffset
658 Length - MappingOffset,
677 IN UINT32 MappingCount,
678 IN UINT32 MappingOffset
692 Length - MappingOffset,
720 while ((Index < DescCount) &&
726 "Mem range Descriptor [%d]",
755 IN UINT32 MappingCount,
756 IN UINT32 MappingOffset
768 if (*IortNodeRevision == EFI_ACPI_IORT_RMR_NODE_REVISION_02) {
771 L
"ERROR: RMR node Rev 2 (defined in IORT Rev E.c) must not be used."
772 L
" IORT tabe Revision E.c is deprecated and must not be used.\n"
778 Length - MappingOffset,
783 Ptr + (*RmrMemDescOffset),
784 Length - (*RmrMemDescOffset),
815 IN UINT32 AcpiTableLength,
816 IN UINT8 AcpiTableRevision
827 if ((AcpiTableRevision > EFI_ACPI_IO_REMAPPING_TABLE_REVISION_00) &&
828 (AcpiTableRevision < EFI_ACPI_IO_REMAPPING_TABLE_REVISION_05))
831 L
"ERROR: Parsing not supported for IORT tabe Revision E, E.<a,b,c>.\n"
833 if (AcpiTableRevision == EFI_ACPI_IO_REMAPPING_TABLE_REVISION_04) {
836 L
"ERROR: IORT tabe Revision E.c is deprecated and must not be used.\n"
854 if ((IortNodeCount ==
NULL) ||
855 (IortNodeOffset ==
NULL))
859 L
"ERROR: Insufficient table length. AcpiTableLength = %d.\n",
865 Offset = *IortNodeOffset;
866 NodePtr = Ptr + Offset;
871 while ((Index++ < *IortNodeCount) &&
872 (Offset < AcpiTableLength))
880 AcpiTableLength - Offset,
886 if ((IortNodeType ==
NULL) ||
887 (IortNodeLength ==
NULL) ||
888 (IortIdMappingCount ==
NULL) ||
889 (IortIdMappingOffset ==
NULL))
893 L
"ERROR: Insufficient remaining table buffer length to read the " \
894 L
"IORT node header. Length = %d.\n",
895 AcpiTableLength - Offset
901 if ((*IortNodeLength == 0) ||
902 ((Offset + (*IortNodeLength)) > AcpiTableLength))
906 L
"ERROR: Invalid IORT Node length. " \
907 L
"Length = %d. Offset = %d. AcpiTableLength = %d.\n",
916 Print (L
"0x%x\n", Offset);
918 switch (*IortNodeType) {
919 case EFI_ACPI_IORT_TYPE_ITS_GROUP:
925 case EFI_ACPI_IORT_TYPE_NAMED_COMP:
933 case EFI_ACPI_IORT_TYPE_ROOT_COMPLEX:
941 case EFI_ACPI_IORT_TYPE_SMMUv1v2:
949 case EFI_ACPI_IORT_TYPE_SMMUv3:
957 case EFI_ACPI_IORT_TYPE_PMCG:
965 case EFI_ACPI_IORT_TYPE_RMR:
975 Print (L
"ERROR: Unsupported IORT Node type = %d\n", *IortNodeType);
978 NodePtr += (*IortNodeLength);
979 Offset += (*IortNodeLength);
VOID EFIAPI PrintFieldName(IN UINT32 Indent, IN CONST CHAR16 *FieldName)
VOID EFIAPI IncrementErrorCount(VOID)
UINT32 EFIAPI ParseAcpi(IN BOOLEAN Trace, IN UINT32 Indent, IN CONST CHAR8 *AsciiName OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length, IN CONST ACPI_PARSER *Parser, IN UINT32 ParserItems)
#define PARSER_PARAMS(Parser)
#define PARSE_ACPI_HEADER(Info)
STATIC CONST ACPI_PARSER InterruptArrayParser[]
STATIC CONST ACPI_PARSER IortNodeHeaderParser[]
VOID EFIAPI ParseAcpiIort(IN BOOLEAN Trace, IN UINT8 *Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision)
STATIC CONST ACPI_PARSER ItsIdParser[]
STATIC CONST ACPI_PARSER IortNodePmcgParser[]
STATIC CONST ACPI_PARSER IortNodeRmrParser[]
STATIC CONST ACPI_PARSER IortNodeRootComplexParser[]
STATIC CONST ACPI_PARSER IortNodeSmmuV1V2Parser[]
STATIC CONST ACPI_PARSER IortNodeRmrMemRangeDescParser[]
STATIC VOID DumpIortNodeIts(IN UINT8 *Ptr, IN UINT16 Length)
STATIC VOID DumpIortNodeRmrMemRangeDesc(IN UINT8 *Ptr, IN UINT32 Length, IN UINT32 DescCount)
STATIC VOID DumpIortNodePmcg(IN UINT8 *Ptr, IN UINT16 Length, IN UINT32 MappingCount, IN UINT32 MappingOffset)
STATIC VOID EFIAPI ValidatePmcgIdMappingCount(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
STATIC CONST ACPI_PARSER IortNodeSmmuV3Parser[]
STATIC VOID EFIAPI ValidateItsIdMappingCount(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
STATIC VOID DumpIortNodeSmmuV1V2(IN UINT8 *Ptr, IN UINT16 Length, IN UINT32 MappingCount, IN UINT32 MappingOffset)
STATIC CONST ACPI_PARSER IortNodeNamedComponentParser[]
STATIC VOID DumpIortNodeRmr(IN UINT8 *Ptr, IN UINT16 Length, IN UINT32 MappingCount, IN UINT32 MappingOffset)
STATIC VOID DumpIortNodeIdMappings(IN UINT8 *Ptr, IN UINT32 Length, IN UINT32 MappingCount)
STATIC VOID DumpIortNodeNamedComponent(IN UINT8 *Ptr, IN UINT16 Length, IN UINT32 MappingCount, IN UINT32 MappingOffset)
STATIC VOID DumpIortNodeRootComplex(IN UINT8 *Ptr, IN UINT16 Length, IN UINT32 MappingCount, IN UINT32 MappingOffset)
STATIC CONST ACPI_PARSER IortNodeIdMappingParser[]
#define PARSE_IORT_NODE_HEADER(ValidateIdMappingCount, ValidateIdArrayReference)
STATIC VOID DumpIortNodeSmmuV3(IN UINT8 *Ptr, IN UINT16 Length, IN UINT32 MappingCount, IN UINT32 MappingOffset)
STATIC VOID EFIAPI ValidateItsIdArrayReference(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
STATIC CONST ACPI_PARSER IortNodeItsParser[]
STATIC VOID EFIAPI ValidatePhysicalRange(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
STATIC VOID EFIAPI ValidateRmrMemDescCount(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
STATIC CONST ACPI_PARSER IortParser[]
UINTN EFIAPI AsciiSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString,...)
UINTN EFIAPI Print(IN CONST CHAR16 *Format,...)