TianoCore EDK2 master
Loading...
Searching...
No Matches
MpamParser.c
Go to the documentation of this file.
1
20#include <Library/PrintLib.h>
21#include <Library/UefiLib.h>
22#include "AcpiParser.h"
23#include "AcpiView.h"
24#include "AcpiViewConfig.h"
25
26// Local variables
27STATIC CONST UINT8 *MscInterfaceType;
28STATIC CONST UINT8 *ResourceLocatorType;
29STATIC UINT32 MpamMscNodeStart;
30STATIC CONST UINT16 *MpamMscNodeLength;
31STATIC CONST UINT32 *NumberOfMscResources;
32STATIC CONST UINT32 *NumberOfFunctionalDependencies;
33STATIC CONST UINT32 *NumberOfInterconnectDescriptors;
34STATIC CONST UINT64 *InterconnectTableOffset;
36
37// Array of locator type names. New types should be added keeping the order
38// preserved as locator type is used to index into the array while parsing.
39STATIC CONST CHAR16 *MpamMscLocatorTitles[] = {
40 L"Processor cache",
41 L"Memory",
42 L"SMMU",
43 L"Memory cache",
44 L"ACPI device",
45 L"Interconnect"
46};
47
58VOID
59EFIAPI
61 IN CONST CHAR16 *ErrorMsg
62 )
63{
65 Print (L"\nERROR : ");
66 Print (ErrorMsg);
67 Print (
68 L"\nError : Insufficient MPAM MSC Node length. Table length : %u.\n",
69 *(AcpiHdrInfo.Length)
70 );
71}
72
84VOID
85EFIAPI
87 IN UINT8 *Ptr,
88 IN UINT32 Length,
89 IN VOID *Context
90 )
91{
92 while (Length > 0) {
93 if (Ptr[Length-1] != 0) {
95 Print (L"\nERROR : Reserved field must be 0\n");
96 break;
97 }
98
99 Length--;
100 }
101}
102
113STATIC
114VOID
115EFIAPI
117 IN UINT8 *Ptr,
118 IN UINT32 Length,
119 IN VOID *Context
120 )
121{
122 UINT32 ByteLength;
123
124 ByteLength = (Length + 7) >> 3;
125 ValidateReserved (Ptr, ByteLength, Context);
126}
127
140STATIC
141VOID
142EFIAPI
144 IN UINT8 *Ptr,
145 IN UINT32 Length,
146 IN VOID *Context
147 )
148{
149 UINT8 InterfaceType;
150 UINT32 MmioSize;
151
152 InterfaceType = *MscInterfaceType;
153
154 if (InterfaceType == EFI_ACPI_MPAM_INTERFACE_PCC) {
155 MmioSize = *((UINT32 *)Ptr);
156
157 if (MmioSize != 0) {
159 Print (
160 L"\nERROR: MMIO size must be 0 for PCC interface type. Size - %u\n",
161 MmioSize
162 );
163 }
164 }
165}
166
176STATIC
177VOID
178EFIAPI
180 IN UINT8 *Ptr,
181 IN UINT32 Length,
182 IN VOID *Context
183 )
184{
185 UINT8 LinkType;
186
187 LinkType = *Ptr;
188
189 if (LinkType == EFI_ACPI_MPAM_LINK_TYPE_NUMA) {
190 Print (
191 L" (NUMA)"
192 );
193 } else if (LinkType == EFI_ACPI_MPAM_LINK_TYPE_PROC) {
194 Print (
195 L" (PROC)"
196 );
197 } else {
199 Print (
200 L"\nERROR: Invalid link type - %u\n",
201 (UINT32)LinkType
202 );
203 }
204}
205
216STATIC
217VOID
218EFIAPI
220 IN UINT8 *Ptr,
221 IN UINT32 Length,
222 IN VOID *Context
223 )
224{
225 UINT64 HardwareId;
226
227 HardwareId = *((UINT64 *)Ptr);
228
229 if (HardwareId != 0) {
230 Print (L" (");
231 Dump8Chars (NULL, Ptr, Length);
232 Print (L")");
233 }
234}
235
245STATIC
246VOID
247EFIAPI
249 IN UINT8 *Ptr,
250 IN UINT32 Length,
251 IN VOID *Context
252 )
253{
254 UINT8 InterfaceType;
255
256 InterfaceType = *Ptr;
257
258 if (InterfaceType == EFI_ACPI_MPAM_INTERFACE_MMIO) {
259 Print (L" (MMIO)");
260 } else if (InterfaceType == EFI_ACPI_MPAM_INTERFACE_PCC) {
261 Print (L" (PCC)");
262 } else {
264 Print (
265 L"\nERROR: Invalid interface type - %u\n",
266 (UINT32)InterfaceType
267 );
268 }
269}
270
282STATIC
283VOID
284EFIAPI
286 IN UINT8 *Ptr,
287 IN UINT32 Length,
288 IN VOID *Context
289 )
290{
291 UINT8 InterruptMode;
292
293 InterruptMode = *Ptr;
294
295 if (InterruptMode == EFI_ACPI_MPAM_INTERRUPT_LEVEL_TRIGGERED) {
296 Print (L" (Level triggered)");
297 } else {
298 Print (L" (Edge triggered)");
299 }
300}
301
313STATIC
314VOID
315EFIAPI
317 IN UINT8 *Ptr,
318 IN UINT32 Length,
319 IN VOID *Context
320 )
321{
322 UINT8 InterruptType;
323
324 InterruptType = *Ptr;
325
326 if (InterruptType == EFI_ACPI_MPAM_INTERRUPT_WIRED) {
327 Print (L" (Wired interrupt)");
328 } else {
330 Print (L" (Reserved value!)");
331 }
332}
333
345STATIC
346VOID
347EFIAPI
349 IN UINT8 *Ptr,
350 IN UINT32 Length,
351 IN VOID *Context
352 )
353{
354 UINT8 InterruptAffinityValid;
355
356 InterruptAffinityValid = *Ptr;
357
358 if (InterruptAffinityValid != EFI_ACPI_MPAM_INTERRUPT_AFFINITY_VALID) {
359 Print (L" (Affinity not valid)");
360 } else {
361 Print (L" (Affinity valid)");
362 }
363}
364
377STATIC
378VOID
379EFIAPI
381 IN UINT8 *Ptr,
382 IN UINT32 Length,
383 IN VOID *Context
384 )
385{
386 UINT8 InterruptAffinityType;
387
388 InterruptAffinityType = *Ptr;
389
390 if (InterruptAffinityType == EFI_ACPI_MPAM_INTERRUPT_PROCESSOR_AFFINITY) {
391 Print (L" (Processor affinity)");
392 } else {
393 Print (L" (Processor container affinity)");
394 }
395}
396
407STATIC
408VOID
409EFIAPI
411 IN UINT8 *Ptr,
412 IN UINT32 Length,
413 IN VOID *Context
414 )
415{
416 UINT8 LocatorType;
417
418 LocatorType = *Ptr;
419
420 if (LocatorType <= EFI_ACPI_MPAM_LOCATION_INTERCONNECT) {
421 Print (L" (%s)", MpamMscLocatorTitles[LocatorType]);
422 } else if (LocatorType == EFI_ACPI_MPAM_LOCATION_UNKNOWN) {
423 Print (L" (Unknown)");
424 } else {
425 Print (L" (Reserved)");
426 }
427}
428
433 { L"Interrupt Mode", 1, 0, L"%u", NULL, NULL,
435 { L"Interrupt Type", 2, 1, L"%u", NULL, NULL,
437 { L"Affinity Type", 1, 3, L"%u", NULL, NULL,
439 { L"Affinity Valid", 1, 4, L"%u", NULL, NULL,
441 { L"Reserved", 27, 5, NULL, DumpReservedBits, NULL,
443};
444
453STATIC
454VOID
455EFIAPI
457 IN CONST CHAR16 *Format OPTIONAL,
458 IN UINT8 *Ptr,
459 IN UINT32 Length
460 )
461{
462 Print (L"%u\n", *(UINT32 *)Ptr);
463
465 TRUE,
466 2,
467 NULL,
468 Ptr,
469 4,
471 );
472}
473
478 { L"Cache reference", 8, 0, L"%lu", NULL, NULL, NULL, NULL },
479 { L"Reserved", 4, 8, NULL, DumpReserved, NULL,
481};
482
487 { L"Proximity domain", 8, 0, L"%lu", NULL, NULL, NULL, NULL },
488 { L"Reserved", 4, 8, NULL, DumpReserved, NULL,
490};
491
496 { L"SMMU interface", 8, 0, L"%lu", NULL, NULL, NULL, NULL },
497 { L"Reserved", 4, 8, NULL, DumpReserved, NULL,
499};
500
505 { L"Reserved", 7, 0, NULL, DumpReserved, NULL,
507 { L"Level", 1, 7, L"%u", NULL, NULL,NULL, NULL },
508 { L"Reference", 4, 8, L"%u", NULL, NULL,NULL, NULL }
509};
510
515 { L"ACPI hardware ID", 8, 0, L"0x%lx", NULL, NULL,
517 { L"ACPI unique ID", 4, 8, L"%u", NULL, NULL,NULL,NULL }
518};
519
524 { L"Interconnect desc tbl offset", 8, 0, L"%lu", NULL,
525 (VOID **)&InterconnectTableOffset, NULL, NULL },
526 { L"Reserved", 4, 8, NULL, DumpReserved,
528};
529
534 { L"Descriptor1", 8, 0, L"%lu", NULL, NULL, NULL, NULL },
535 { L"Descriptor2", 4, 8, L"%u", NULL, NULL, NULL, NULL }
536};
537
546STATIC
547VOID
548EFIAPI
550 IN CONST CHAR16 *Format OPTIONAL,
551 IN UINT8 *Ptr,
552 IN UINT32 Length
553 )
554{
555 Print (L"\n");
556 switch (*ResourceLocatorType) {
558 ParseAcpi (
559 TRUE,
560 2,
561 NULL,
562 Ptr,
563 12,
565 );
566 break;
567 case EFI_ACPI_MPAM_LOCATION_MEMORY:
568 ParseAcpi (
569 TRUE,
570 2,
571 NULL,
572 Ptr,
573 12,
575 );
576 break;
577 case EFI_ACPI_MPAM_LOCATION_SMMU:
578 ParseAcpi (
579 TRUE,
580 2,
581 NULL,
582 Ptr,
583 12,
585 );
586 break;
587 case EFI_ACPI_MPAM_LOCATION_MEMORY_CACHE:
588 ParseAcpi (
589 TRUE,
590 2,
591 NULL,
592 Ptr,
593 12,
595 );
596 break;
597 case EFI_ACPI_MPAM_LOCATION_ACPI_DEVICE:
598 ParseAcpi (
599 TRUE,
600 2,
601 NULL,
602 Ptr,
603 12,
605 );
606 break;
607 case EFI_ACPI_MPAM_LOCATION_INTERCONNECT:
608 ParseAcpi (
609 TRUE,
610 2,
611 NULL,
612 Ptr,
613 12,
615 );
616 break;
617 // For both UNKNOWN and RESERVED locator types, the locator is parsed using
618 // the generic locator parser as the spec does not define any format.
619 case EFI_ACPI_MPAM_LOCATION_UNKNOWN:
620 ParseAcpi (
621 TRUE,
622 2,
623 NULL,
624 Ptr,
625 12,
627 );
628 break;
629 default:
630 Print (L"\nWARNING : Reserved locator type\n");
631 ParseAcpi (
632 TRUE,
633 2,
634 NULL,
635 Ptr,
636 12,
638 );
640 break;
641 } // switch
642}
643
648 PARSE_ACPI_HEADER (&AcpiHdrInfo)
649};
650
655 { L"Length", 2, 0, L"%u", NULL,
656 (VOID **)&MpamMscNodeLength, NULL, NULL },
657 // Once Interface type is decoded, the address of interface type field is
658 // captured into InterfaceType pointer so that it could be used to check if
659 // MMIO Size field is set as per the specification.
660 { L"Interface type", 1, 2, L"0x%x", NULL,
661 (VOID **)&MscInterfaceType, DecodeInterfaceType, NULL },
662 { L"Reserved", 1, 3, NULL, DumpReserved,
664 { L"Identifier", 4, 4, L"%u", NULL,
665 NULL, NULL, NULL },
666 { L"Base address", 8, 8, L"0x%lx", NULL,
667 NULL, NULL, NULL },
668 { L"MMIO Size", 4, 16, L"0x%x", NULL,
669 NULL, ValidateMmioSize, (VOID **)&MscInterfaceType },
670 { L"Overflow interrupt", 4, 20, L"%u", NULL,
671 NULL, NULL, NULL },
672 { L"Overflow interrupt flags", 4, 24, NULL, DumpMpamMscInterruptFlags,
673 NULL, NULL, NULL },
674 { L"Reserved1", 4, 28, NULL, DumpReserved,
676 { L"Overflow interrupt affinity", 4, 32, L"0x%x", NULL,
677 NULL, NULL, NULL },
678 { L"Error interrupt", 4, 36, L"%u", NULL,
679 NULL, NULL, NULL },
680 { L"Error interrupt flags", 4, 40, NULL, DumpMpamMscInterruptFlags,
681 NULL, NULL, NULL },
682 { L"Reserved2", 4, 44, NULL, DumpReserved,
684 { L"Error interrupt affinity", 4, 48, L"0x%x", NULL,
685 NULL, NULL, NULL },
686 { L"MAX_NRDY_USEC", 4, 52, L"0x%x", NULL,
687 NULL, NULL, NULL },
688 { L"Hardware ID of linked device", 8, 56, L"0x%lx", NULL,
690 { L"Instance ID of linked device", 4, 64, L"0x%x", NULL,
691 NULL, NULL, NULL },
692 { L"Number of resource nodes", 4, 68, L"%u", NULL,
693 (VOID **)&NumberOfMscResources, NULL, NULL }
694};
695
700 { L"Identifier", 4, 0, L"%u", NULL,
701 NULL, NULL, NULL },
702 { L"RIS index", 1, 4, L"%u", NULL,
703 NULL, NULL, NULL },
704 { L"Reserved1", 2, 5, NULL, DumpReserved,
706 { L"Locator type", 1, 7, L"0x%x", NULL,
707 (VOID **)&ResourceLocatorType,
709 { L"Locator", 12, 8, NULL, ParseLocator,
710 NULL, NULL, NULL },
711 { L"Number of func dependencies", 4, 20, L"%u", NULL,
712 (VOID **)&NumberOfFunctionalDependencies, NULL, NULL }
713};
714
719 { L"Producer", 4, 0, L"0x%x", NULL, NULL, NULL, NULL },
720 { L"Reserved", 4, 4, NULL, DumpReserved,
722};
723
729 { L"Signature", 16, 0,
730 L"%x%x%x%x-%x%x-%x%x-%x%x-%x%x%x%x%x%x", Dump16Chars, NULL, NULL, NULL },
731 { L"Number of Interconnect desc", 4, 16,L"0x%x", NULL,
732 (VOID **)&NumberOfInterconnectDescriptors, NULL, NULL }
733};
734
740 { L"Source ID", 4, 0, L"%u", NULL, NULL, NULL, NULL },
741 { L"Destination ID", 4, 4, L"%u", NULL, NULL, NULL, NULL },
742 { L"Link type", 1, 8, L"0x%x", NULL,
744 { L"Reserved", 3, 9, NULL, DumpReserved, NULL,
746};
747
763STATIC
764VOID
765EFIAPI
767 IN UINT32 Indent,
768 IN CONST CHAR16 *Title,
769 IN CONST UINT32 Index
770 )
771{
772 Print (L"\n");
773 PrintFieldName (Indent, Title);
774 Print (L"%u\n\n", Index);
775}
776
793STATIC
795EFIAPI
797 IN UINT8 *CONST Ptr,
798 IN CONST UINT32 AcpiTableLength,
799 IN OUT UINT32 *CONST Offset
800 )
801{
802 UINT32 InterconnectDescriptorIndex;
803
804 InterconnectDescriptorIndex = 0;
805
806 if (NumberOfInterconnectDescriptors == NULL) {
807 MpamLengthError (L"Number of interconnect descriptors not set!");
808 return EFI_BAD_BUFFER_SIZE;
809 }
810
811 while (InterconnectDescriptorIndex < *NumberOfInterconnectDescriptors) {
813 6,
814 L"* Interconnect descriptor *",
815 InterconnectDescriptorIndex
816 );
817
818 // Parse interconnect descriptor
819 *Offset += ParseAcpi (
820 TRUE,
821 4,
822 NULL,
823 Ptr + *Offset,
824 AcpiTableLength - *Offset,
826 );
827
828 InterconnectDescriptorIndex++;
829 }
830
831 return EFI_SUCCESS;
832}
833
854STATIC
856EFIAPI
858 IN UINT8 *CONST Ptr,
859 IN CONST UINT32 AcpiTableLength,
860 IN UINT32 Offset,
861 IN CONST UINT64 InterconnectOffset
862 )
863{
864 EFI_STATUS Status;
865
866 // Lower bound check
867 if (Offset > (MpamMscNodeStart + InterconnectOffset)) {
869 Print (L"\nERROR : Parsing Interconnect descriptor table failed!\n");
870 Print (
871 L"ERROR : Offset overlaps with other objects within the MSC. Offset %u.\n",
872 InterconnectOffset
873 );
874
875 return EFI_INVALID_PARAMETER;
876 }
877
878 // Upper bound check
879 if (InterconnectOffset > (*MpamMscNodeLength)) {
881 Print (L"\nERROR : Parsing Interconnect descriptor table failed!\n");
882 Print (
883 L"ERROR : Offset falls outside MSC's space. Offset %u.\n",
884 InterconnectOffset
885 );
886
887 return EFI_INVALID_PARAMETER;
888 }
889
890 // It is safe to cast InterconnectOffset to UINT32 as IntercconnectOffset can
891 // never exceed the MPAM table length which is at max 2 bytes.
892 Offset = MpamMscNodeStart + (UINT32)InterconnectOffset;
893
894 Print (L"\n");
895 PrintFieldName (6, L"* Interconnect desc table *");
896 Print (L"\n\n");
897
898 // Parse interconnect descriptor table
899 Offset += ParseAcpi (
900 TRUE,
901 4,
902 NULL,
903 Ptr + Offset,
904 AcpiTableLength - Offset,
906 );
907
909 Ptr,
910 AcpiTableLength,
911 &Offset
912 );
913
914 return Status;
915}
916
933STATIC
935EFIAPI
937 IN UINT8 *CONST Ptr,
938 IN CONST UINT32 AcpiTableLength,
939 IN OUT UINT32 *CONST Offset
940 )
941{
942 UINT32 FunctionalDependencyIndex;
943
944 FunctionalDependencyIndex = 0;
945
946 if (NumberOfFunctionalDependencies == NULL) {
947 MpamLengthError (L"Number of functional dependencies not set!");
948 return EFI_BAD_BUFFER_SIZE;
949 }
950
951 while (FunctionalDependencyIndex < *NumberOfFunctionalDependencies) {
953 6,
954 L"* Functional dependency *",
955 FunctionalDependencyIndex
956 );
957
958 // Parse functional dependency
959 *Offset += ParseAcpi (
960 TRUE,
961 4,
962 NULL,
963 Ptr + *Offset,
964 AcpiTableLength - *Offset,
966 );
967
968 FunctionalDependencyIndex++;
969 }
970
971 return EFI_SUCCESS;
972}
973
991STATIC
993EFIAPI
995 IN UINT8 *CONST Ptr,
996 IN CONST UINT32 AcpiTableLength,
997 IN UINT32 Offset
998 )
999{
1000 EFI_STATUS Status;
1001 UINT32 ResourceIndex;
1002
1003 ResourceIndex = 0;
1004
1005 if (NumberOfMscResources == NULL) {
1006 MpamLengthError (L"Number of MSC resource not set!");
1007 return EFI_BAD_BUFFER_SIZE;
1008 }
1009
1010 while (ResourceIndex < *NumberOfMscResources) {
1012 4,
1013 L"* Resource *",
1014 ResourceIndex
1015 );
1016
1017 // Parse MPAM MSC resources within the MSC body.
1018 Offset += ParseAcpi (
1019 TRUE,
1020 2,
1021 NULL,
1022 Ptr + Offset,
1023 AcpiTableLength - Offset,
1025 );
1026
1027 Status = ParseMpamMscFunctionalDependencies (Ptr, AcpiTableLength, &Offset);
1028 if (Status != EFI_SUCCESS) {
1029 return Status;
1030 }
1031
1032 // If the InterconnectTableOffset field has been set, proceed to parse the
1033 // interconnect descriptor table. Please note that the interconnect
1034 // descriptors are placed within the MSC node body in the resource specific
1035 // region. However since its easier to map an interconnect descriptor to
1036 // its corresponding resource, proceed to parse it along with its parent
1037 // resource. This design choice is made to keep the trace view as intuitive
1038 // as possible.
1039 //
1040 // +---------------------+
1041 // | MPAM ACPI Header |
1042 // +---------------------+-------
1043 // | MSC Node 0 Hdr | ^
1044 // | +-----------------+ | |
1045 // | | Res Node 0 | | |
1046 // | | +-------------+ | | |
1047 // | | | Res Node Hdr| | | |
1048 // | | +-------------+ | | |
1049 // | | | Res Data | | | |
1050 // | | | | | | |
1051 // | | | +---------+ | | | | +---------------------------+
1052 // | | | | Locator | | | | ..|..| Interconnect locator desc |
1053 // | | | | | | | | | | Descriptor Table Offset |--points-to->+
1054 // | | | | | | | | | | Reserved [4] | |
1055 // | | | +---------+ | | | | +---------------------------+ |
1056 // | | | |FnDep Cnt| | | | | |
1057 // | | | +---------+ | | | | |
1058 // | | | |FnDep 1 | | | | | |
1059 // | | | +---------+ | | | Interconnect |
1060 // | | | |FnDep 2 | | | | descriptor |
1061 // | | | +---------+ | | | table |
1062 // | | | |FnDep n | | | | offset |
1063 // | | | +---------+ | | | value |
1064 // | | +-------------+ | | | |
1065 // | +-----------------+ | | |
1066 // | ... | | |
1067 // | +-----------------+ | | |
1068 // | | Res Node N | | | |
1069 // | | +-------------+ | | | |
1070 // | | | Res Node Hdr| | | | |
1071 // | | +-------------+ | | | |
1072 // | | | Res Data | | | | |
1073 // | | | | | | | |
1074 // | | | +---------+ | | | | |
1075 // | | | | Locator | | | | | |
1076 // | | | | | | | | | |
1077 // | | | | | | | | | |
1078 // | | | +---------+ | | | | |
1079 // | | | |FnDep Cnt| | | | | |
1080 // | | | +---------+ | | | | |
1081 // | | | |FnDep 1 | | | | | |
1082 // | | | +---------+ | | | | |
1083 // | | | |FnDep 2 | | | | | |
1084 // | | | +---------+ | | | | |
1085 // | | | |FnDep n | | | | | |
1086 // | | | +---------+ | | | | |
1087 // | | +-------------+ | | | |
1088 // | +-----------------+ | | |
1089 // \ Resource-specific / v |
1090 // / data region. <-----------------------------------------------+
1091 // \ /
1092 // +---------------------+
1093 // | MSC Node 1 Hdr |
1094 // | ... |
1095 // +---------------------+
1096 if ( (*ResourceLocatorType == EFI_ACPI_MPAM_LOCATION_INTERCONNECT)
1097 && (InterconnectTableOffset != NULL))
1098 {
1100 Ptr,
1101 AcpiTableLength,
1102 Offset,
1103 *InterconnectTableOffset
1104 );
1105 if (Status != EFI_SUCCESS) {
1106 return Status;
1107 }
1108 }
1109
1110 ResourceIndex++;
1111 }
1112
1113 return EFI_SUCCESS;
1114}
1115
1133STATIC
1135EFIAPI
1137 IN UINT8 *CONST Ptr,
1138 IN CONST UINT32 AcpiTableLength,
1139 IN OUT UINT32 *CONST Offset
1140 )
1141{
1142 EFI_STATUS Status;
1143 UINT32 MscIndex;
1144
1145 MscIndex = 0;
1146
1147 while (*Offset < AcpiTableLength) {
1148 MpamMscNodeStart = *Offset;
1149
1150 PrintBlockTitle (2, L"* MSC *", MscIndex);
1151 // Parse MPAM MSC node
1152 *Offset += ParseAcpi (
1153 TRUE,
1154 0,
1155 NULL,
1156 Ptr + *Offset,
1157 AcpiTableLength - *Offset,
1159 );
1160
1161 if (MpamMscNodeLength == NULL) {
1162 MpamLengthError (L"MPAM MSC node length not set!");
1163 return EFI_BAD_BUFFER_SIZE;
1164 }
1165
1166 if (*MpamMscNodeLength < sizeof (EFI_ACPI_MPAM_MSC_NODE)) {
1168 Print (L"\nERROR: MSC length should be at least the size of node body! ");
1169 Print (L"MSC Length %u\n", *MpamMscNodeLength);
1170 return EFI_BAD_BUFFER_SIZE;
1171 }
1172
1173 // Parse MPAM MSC resources within the MSC body
1174 Status = ParseMpamMscResources (Ptr, AcpiTableLength, *Offset);
1175 if (Status != EFI_SUCCESS) {
1176 return Status;
1177 }
1178
1179 *Offset = MpamMscNodeStart + *MpamMscNodeLength;
1180 MscIndex++;
1181 }
1182
1183 return EFI_SUCCESS;
1184}
1185
1195VOID
1196EFIAPI
1198 IN BOOLEAN Trace,
1199 IN UINT8 *Ptr,
1200 IN UINT32 AcpiTableLength,
1201 IN UINT8 AcpiTableRevision
1202 )
1203{
1204 EFI_STATUS Status;
1205 UINT32 Offset;
1206
1207 if (!Trace) {
1208 return;
1209 }
1210
1211 // Parse generic table header
1212 Offset = ParseAcpi (
1213 TRUE,
1214 0,
1215 "MPAM",
1216 Ptr,
1217 AcpiTableLength,
1219 );
1220
1221 Status = ParseMpamMscNodes (
1222 Ptr,
1223 AcpiTableLength,
1224 &Offset
1225 );
1226
1227 if (Status == EFI_SUCCESS) {
1228 // Check if the length of all MPAM MSCs with the header, matches with the
1229 // ACPI table's length field.
1230 if (*(AcpiHdrInfo.Length) != Offset) {
1232 Print (L"\nERROR: Length mismatch! : ");
1233 Print (L"MSC Length total != MPAM table length.");
1234 Print (
1235 L"Table length : %u MSC total : %u\n",
1236 *(AcpiHdrInfo.Length),
1237 Offset
1238 );
1239 }
1240 }
1241}
VOID EFIAPI Dump16Chars(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: AcpiParser.c:474
VOID EFIAPI IncrementWarningCount(VOID)
Definition: AcpiParser.c:95
VOID EFIAPI DumpReservedBits(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: AcpiParser.c:615
VOID EFIAPI PrintFieldName(IN UINT32 Indent, IN CONST CHAR16 *FieldName)
Definition: AcpiParser.c:641
VOID EFIAPI Dump8Chars(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: AcpiParser.c:408
VOID EFIAPI IncrementErrorCount(VOID)
Definition: AcpiParser.c:83
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)
Definition: AcpiParser.c:683
VOID EFIAPI DumpReserved(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: AcpiParser.c:513
UINT32 EFIAPI ParseAcpiBitFields(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)
Definition: AcpiParser.c:968
#define PARSER_PARAMS(Parser)
Definition: AcpiParser.h:494
#define PARSE_ACPI_HEADER(Info)
Definition: AcpiParser.h:501
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define STATIC
Definition: Base.h:264
#define TRUE
Definition: Base.h:301
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define EFI_ACPI_MPAM_INTERFACE_MMIO
Definition: Mpam.h:88
#define EFI_ACPI_MPAM_INTERRUPT_WIRED
Definition: Mpam.h:40
#define EFI_ACPI_MPAM_INTERRUPT_PROCESSOR_AFFINITY
Definition: Mpam.h:45
#define EFI_ACPI_MPAM_LOCATION_PROCESSOR_CACHE
Definition: Mpam.h:76
#define EFI_ACPI_MPAM_LINK_TYPE_NUMA
Definition: Mpam.h:95
#define EFI_ACPI_MPAM_INTERRUPT_LEVEL_TRIGGERED
Definition: Mpam.h:34
STATIC CONST ACPI_PARSER MpamMscGenericLocatorParser[]
Definition: MpamParser.c:533
STATIC CONST ACPI_PARSER MpamMscInterconnectLocatorParser[]
Definition: MpamParser.c:523
STATIC EFI_STATUS EFIAPI ParseInterconnectDescriptorTable(IN UINT8 *CONST Ptr, IN CONST UINT32 AcpiTableLength, IN UINT32 Offset, IN CONST UINT64 InterconnectOffset)
Definition: MpamParser.c:857
STATIC VOID EFIAPI DecodeLinkType(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: MpamParser.c:179
STATIC CONST ACPI_PARSER MpamMscMemoryCacheLocatorParser[]
Definition: MpamParser.c:504
STATIC VOID EFIAPI ParseLocator(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: MpamParser.c:549
STATIC CONST ACPI_PARSER MpamMscFunctionalDependencyParser[]
Definition: MpamParser.c:718
STATIC VOID EFIAPI DecodeInterruptAffinityType(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: MpamParser.c:380
STATIC VOID EFIAPI DecodeInterruptMode(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: MpamParser.c:285
STATIC CONST ACPI_PARSER MpamMscSMMULocatorParser[]
Definition: MpamParser.c:495
STATIC CONST ACPI_PARSER MpamInterconnectDescriptorParser[]
Definition: MpamParser.c:739
STATIC CONST ACPI_PARSER MpamInterconnectDescriptorTableParser[]
Definition: MpamParser.c:728
VOID EFIAPI ParseAcpiMpam(IN BOOLEAN Trace, IN UINT8 *Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision)
Definition: MpamParser.c:1197
STATIC VOID EFIAPI PrintBlockTitle(IN UINT32 Indent, IN CONST CHAR16 *Title, IN CONST UINT32 Index)
Definition: MpamParser.c:766
STATIC VOID EFIAPI ValidateReserved(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: MpamParser.c:86
STATIC CONST ACPI_PARSER MpamMscMemoryLocatorParser[]
Definition: MpamParser.c:486
STATIC EFI_STATUS EFIAPI ParseMpamMscResources(IN UINT8 *CONST Ptr, IN CONST UINT32 AcpiTableLength, IN UINT32 Offset)
Definition: MpamParser.c:994
STATIC VOID EFIAPI ValidateMmioSize(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: MpamParser.c:143
STATIC CONST ACPI_PARSER MpamParser[]
Definition: MpamParser.c:647
STATIC VOID EFIAPI ValidateReservedBits(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: MpamParser.c:116
STATIC EFI_STATUS EFIAPI ParseMpamMscFunctionalDependencies(IN UINT8 *CONST Ptr, IN CONST UINT32 AcpiTableLength, IN OUT UINT32 *CONST Offset)
Definition: MpamParser.c:936
STATIC CONST ACPI_PARSER MpamMscInterruptFlagParser[]
Definition: MpamParser.c:432
STATIC EFI_STATUS EFIAPI ParseInterconnectDescriptors(IN UINT8 *CONST Ptr, IN CONST UINT32 AcpiTableLength, IN OUT UINT32 *CONST Offset)
Definition: MpamParser.c:796
STATIC CONST ACPI_PARSER MpamMscNodeParser[]
Definition: MpamParser.c:654
STATIC CONST ACPI_PARSER MpamMscProcessorCacheLocatorParser[]
Definition: MpamParser.c:477
STATIC EFI_STATUS EFIAPI ParseMpamMscNodes(IN UINT8 *CONST Ptr, IN CONST UINT32 AcpiTableLength, IN OUT UINT32 *CONST Offset)
Definition: MpamParser.c:1136
STATIC VOID EFIAPI DecodeLocatorType(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: MpamParser.c:410
STATIC VOID EFIAPI DumpMpamMscInterruptFlags(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: MpamParser.c:456
STATIC VOID EFIAPI DecodeInterruptType(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: MpamParser.c:316
STATIC VOID EFIAPI DecodeInterfaceType(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: MpamParser.c:248
STATIC VOID EFIAPI DecodeInterruptAffinityValid(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: MpamParser.c:348
STATIC VOID EFIAPI MpamLengthError(IN CONST CHAR16 *ErrorMsg)
Definition: MpamParser.c:60
STATIC CONST ACPI_PARSER MpamMscAcpiDeviceLocatorParser[]
Definition: MpamParser.c:514
STATIC CONST ACPI_PARSER MpamMscResourceParser[]
Definition: MpamParser.c:699
STATIC VOID EFIAPI DecodeHardwareId(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: MpamParser.c:219
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
UINTN EFIAPI Print(IN CONST CHAR16 *Format,...)
Definition: UefiLibPrint.c:113
UINT32 * Length
Length of the ACPI table.
Definition: AcpiParser.h:394