Changeset 99404 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers
- Timestamp:
- Apr 14, 2023 3:17:44 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 156854
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 4 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776,129194-145445 /vendor/edk2/current 103735-103757,103769-103776,129194-156846
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c
r89983 r99404 19 19 20 20 // Local variables 21 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;22 STATIC UINT8 *AestNodeType;23 STATIC UINT16 *AestNodeLength;24 STATIC UINT32 *NodeDataOffset;25 STATIC UINT32 *NodeInterfaceOffset;26 STATIC UINT32 *NodeInterruptArrayOffset;27 STATIC UINT32 *NodeInterruptCount;28 STATIC UINT32 *ProcessorId;29 STATIC UINT8 *ProcessorFlags;30 STATIC UINT8 *ProcessorResourceType;21 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 22 STATIC UINT8 *AestNodeType; 23 STATIC UINT16 *AestNodeLength; 24 STATIC UINT32 *NodeDataOffset; 25 STATIC UINT32 *NodeInterfaceOffset; 26 STATIC UINT32 *NodeInterruptArrayOffset; 27 STATIC UINT32 *NodeInterruptCount; 28 STATIC UINT32 *ProcessorId; 29 STATIC UINT8 *ProcessorFlags; 30 STATIC UINT8 *ProcessorResourceType; 31 31 32 32 /** … … 41 41 EFIAPI 42 42 ValidateProcessorFlags ( 43 IN UINT8 *Ptr,44 IN VOID *Context43 IN UINT8 *Ptr, 44 IN VOID *Context 45 45 ) 46 46 { … … 49 49 if (((*Ptr & 0x3) != 0) && (*ProcessorId != 0)) { 50 50 IncrementErrorCount (); 51 Print (L"\nERROR: 'ACPI Processor ID' field must be set to 0 for global" 52 L" or shared nodes."); 51 Print ( 52 L"\nERROR: 'ACPI Processor ID' field must be set to 0 for global" 53 L" or shared nodes." 54 ); 53 55 } 54 56 } … … 65 67 EFIAPI 66 68 ValidateGicInterfaceType ( 67 IN UINT8 *Ptr,68 IN VOID *Context69 ) 70 { 71 UINT32 GicInterfaceType;72 73 GicInterfaceType = *(UINT32 *)Ptr;69 IN UINT8 *Ptr, 70 IN VOID *Context 71 ) 72 { 73 UINT32 GicInterfaceType; 74 75 GicInterfaceType = *(UINT32 *)Ptr; 74 76 if (GicInterfaceType > 3) { 75 77 IncrementErrorCount (); … … 89 91 EFIAPI 90 92 ValidateInterfaceType ( 91 IN UINT8 *Ptr,92 IN VOID *Context93 IN UINT8 *Ptr, 94 IN VOID *Context 93 95 ) 94 96 { … … 110 112 EFIAPI 111 113 ValidateInterruptType ( 112 IN UINT8 *Ptr,113 IN VOID *Context114 IN UINT8 *Ptr, 115 IN VOID *Context 114 116 ) 115 117 { … … 131 133 EFIAPI 132 134 ValidateInterruptFlags ( 133 IN UINT8 *Ptr,134 IN VOID *Context135 IN UINT8 *Ptr, 136 IN VOID *Context 135 137 ) 136 138 { … … 150 152 EFIAPI 151 153 DumpVendorSpecificData ( 152 IN CONST CHAR16 *Format OPTIONAL,153 IN UINT8 *Ptr154 IN CONST CHAR16 *Format OPTIONAL, 155 IN UINT8 *Ptr 154 156 ) 155 157 { … … 184 186 An ACPI_PARSER array describing the ACPI AEST Table. 185 187 **/ 186 STATIC CONST ACPI_PARSER AestParser[] = {188 STATIC CONST ACPI_PARSER AestParser[] = { 187 189 PARSE_ACPI_HEADER (&AcpiHdrInfo) 188 190 }; … … 191 193 An ACPI_PARSER array describing the AEST Node Header. 192 194 **/ 193 STATIC CONST ACPI_PARSER AestNodeHeaderParser[] = {194 { L"Type", 1, 0, L"%d", NULL, (VOID**)&AestNodeType, NULL, NULL},195 { L"Length", 2, 1, L"%d", NULL, (VOID**)&AestNodeLength, NULL, NULL},196 { L"Reserved", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},197 { L"Node Data Offset", 4, 4, L"%d", NULL, (VOID**)&NodeDataOffset, NULL, NULL},198 { L"Node Interface Offset", 4, 8, L"%d",NULL,199 (VOID **)&NodeInterfaceOffset, NULL, NULL},200 { L"Node Interrupt Array Offset", 4, 12, L"%d",NULL,201 (VOID **)&NodeInterruptArrayOffset, NULL, NULL},202 { L"Node Interrupt Count", 4, 16, L"%d",NULL,203 (VOID **)&NodeInterruptCount, NULL, NULL},204 { L"Timestamp Rate", 8, 20, L"%ld", NULL, NULL, NULL, NULL},205 { L"Reserved1", 8, 28, L"0x%lx", NULL, NULL, NULL, NULL},206 { L"Error Injection Countdown Rate", 8, 36, L"%ld", NULL, NULL, NULL, NULL}195 STATIC CONST ACPI_PARSER AestNodeHeaderParser[] = { 196 { L"Type", 1, 0, L"%d", NULL, (VOID **)&AestNodeType, NULL, NULL }, 197 { L"Length", 2, 1, L"%d", NULL, (VOID **)&AestNodeLength, NULL, NULL }, 198 { L"Reserved", 1, 3, L"0x%x", NULL, NULL, NULL, NULL }, 199 { L"Node Data Offset", 4, 4, L"%d", NULL, (VOID **)&NodeDataOffset, NULL, NULL }, 200 { L"Node Interface Offset", 4, 8, L"%d", NULL, 201 (VOID **)&NodeInterfaceOffset, NULL, NULL }, 202 { L"Node Interrupt Array Offset", 4, 12, L"%d", NULL, 203 (VOID **)&NodeInterruptArrayOffset, NULL, NULL }, 204 { L"Node Interrupt Count", 4, 16, L"%d", NULL, 205 (VOID **)&NodeInterruptCount, NULL, NULL }, 206 { L"Timestamp Rate", 8, 20, L"%ld", NULL, NULL, NULL, NULL }, 207 { L"Reserved1", 8, 28, L"0x%lx", NULL, NULL, NULL, NULL }, 208 { L"Error Injection Countdown Rate", 8, 36, L"%ld", NULL, NULL, NULL, NULL } 207 209 // Node specific data... 208 210 // Node interface... … … 213 215 An ACPI_PARSER array describing the Processor error node specific data. 214 216 **/ 215 STATIC CONST ACPI_PARSER AestProcessorStructure[] = {216 { L"ACPI Processor ID", 4, 0, L"0x%x", NULL, (VOID**)&ProcessorId, NULL, NULL},217 { L"Resource Type", 1, 4, L"%d", NULL, (VOID**)&ProcessorResourceType, NULL,218 NULL },219 { L"Reserved", 1, 5, L"0x%x", NULL, NULL, NULL, NULL},220 { L"Flags", 1, 6, L"0x%x", NULL, (VOID**)&ProcessorFlags,221 ValidateProcessorFlags, NULL },222 { L"Revision", 1, 7, L"%d", NULL, NULL, NULL, NULL},223 { L"Processor Affinity Level Indicator", 8, 8, L"0x%lx", NULL, NULL,NULL,224 NULL },217 STATIC CONST ACPI_PARSER AestProcessorStructure[] = { 218 { L"ACPI Processor ID", 4, 0, L"0x%x", NULL, (VOID **)&ProcessorId, NULL, NULL }, 219 { L"Resource Type", 1, 4, L"%d", NULL, (VOID **)&ProcessorResourceType, NULL, 220 NULL }, 221 { L"Reserved", 1, 5, L"0x%x", NULL, NULL, NULL, NULL }, 222 { L"Flags", 1, 6, L"0x%x", NULL, (VOID **)&ProcessorFlags, 223 ValidateProcessorFlags, NULL }, 224 { L"Revision", 1, 7, L"%d", NULL, NULL, NULL, NULL }, 225 { L"Processor Affinity Level Indicator", 8, 8, L"0x%lx", NULL, NULL, NULL, 226 NULL }, 225 227 // Resource specific data... 226 228 }; … … 229 231 An ACPI_PARSER array describing the processor cache resource substructure. 230 232 **/ 231 STATIC CONST ACPI_PARSER AestProcessorCacheResourceSubstructure[] = {232 { L"Cache reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},233 { L"Reserved", 4, 4, L"%d", NULL, NULL, NULL, NULL}233 STATIC CONST ACPI_PARSER AestProcessorCacheResourceSubstructure[] = { 234 { L"Cache reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL }, 235 { L"Reserved", 4, 4, L"%d", NULL, NULL, NULL, NULL } 234 236 }; 235 237 … … 237 239 An ACPI_PARSER array describing the processor TLB resource substructure. 238 240 **/ 239 STATIC CONST ACPI_PARSER AestProcessorTlbResourceSubstructure[] = {240 { L"TLB reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},241 { L"Reserved", 4, 4, L"%d", NULL, NULL, NULL, NULL}241 STATIC CONST ACPI_PARSER AestProcessorTlbResourceSubstructure[] = { 242 { L"TLB reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL }, 243 { L"Reserved", 4, 4, L"%d", NULL, NULL, NULL, NULL } 242 244 }; 243 245 … … 245 247 An ACPI_PARSER array describing the processor generic resource substructure. 246 248 **/ 247 STATIC CONST ACPI_PARSER AestProcessorGenericResourceSubstructure[] = {248 { L"Vendor-defined data", 4, 0, L"%x", NULL, NULL, NULL, NULL}249 STATIC CONST ACPI_PARSER AestProcessorGenericResourceSubstructure[] = { 250 { L"Vendor-defined data", 4, 0, L"%x", NULL, NULL, NULL, NULL } 249 251 }; 250 252 … … 252 254 An ACPI_PARSER array describing the memory controller structure. 253 255 **/ 254 STATIC CONST ACPI_PARSER AestMemoryControllerStructure[] = {255 { L"Proximity Domain", 4, 0, L"0x%x", NULL, NULL, NULL, NULL}256 STATIC CONST ACPI_PARSER AestMemoryControllerStructure[] = { 257 { L"Proximity Domain", 4, 0, L"0x%x", NULL, NULL, NULL, NULL } 256 258 }; 257 259 … … 259 261 An ACPI_PARSER array describing the SMMU structure. 260 262 **/ 261 STATIC CONST ACPI_PARSER AestSmmuStructure[] = {262 { L"IORT Node reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},263 { L"SubComponent reference ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}263 STATIC CONST ACPI_PARSER AestSmmuStructure[] = { 264 { L"IORT Node reference ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL }, 265 { L"SubComponent reference ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL } 264 266 }; 265 267 … … 267 269 An ACPI_PARSER array describing the vendor-defined structure. 268 270 **/ 269 STATIC CONST ACPI_PARSER AestVendorDefinedStructure[] = {270 { L"Hardware ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL},271 { L"Unique ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},272 { L"Vendor-specific data", 16, 8, NULL, DumpVendorSpecificData, NULL, NULL}271 STATIC CONST ACPI_PARSER AestVendorDefinedStructure[] = { 272 { L"Hardware ID", 4, 0, L"0x%x", NULL, NULL, NULL, NULL }, 273 { L"Unique ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 274 { L"Vendor-specific data", 16, 8, NULL, DumpVendorSpecificData, NULL, NULL } 273 275 }; 274 276 … … 276 278 An ACPI_PARSER array describing the GIC structure. 277 279 **/ 278 STATIC CONST ACPI_PARSER AestGicStructure[] = {279 { L"GIC Interface Type",4, 0, L"0x%x", NULL, NULL, ValidateGicInterfaceType,280 NULL },281 { L"GIC Interface reference ID", 4, 4, L"0x%x", NULL, NULL, NULL,NULL}280 STATIC CONST ACPI_PARSER AestGicStructure[] = { 281 { L"GIC Interface Type", 4, 0, L"0x%x", NULL, NULL, ValidateGicInterfaceType, 282 NULL }, 283 { L"GIC Interface reference ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL} 282 284 }; 283 285 … … 285 287 An ACPI_PARSER array describing the node interface. 286 288 **/ 287 STATIC CONST ACPI_PARSER AestNodeInterface[] = {288 { L"Interface Type", 1, 0, L"%d", NULL, NULL, ValidateInterfaceType, NULL},289 { L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},290 { L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},291 { L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},292 { L"Start Error Record Index", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},293 { L"Number of Error Records", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},294 { L"Error Records Implemented", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},295 { L"Error Records Support", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},296 { L"Addressing mode", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL}289 STATIC CONST ACPI_PARSER AestNodeInterface[] = { 290 { L"Interface Type", 1, 0, L"%d", NULL, NULL, ValidateInterfaceType, NULL }, 291 { L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL }, 292 { L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 293 { L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL }, 294 { L"Start Error Record Index", 4, 16, L"0x%x", NULL, NULL, NULL, NULL }, 295 { L"Number of Error Records", 4, 20, L"0x%x", NULL, NULL, NULL, NULL }, 296 { L"Error Records Implemented", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL }, 297 { L"Error Records Support", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL }, 298 { L"Addressing mode", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL } 297 299 }; 298 300 … … 300 302 An ACPI_PARSER array describing the node interrupts. 301 303 **/ 302 STATIC CONST ACPI_PARSER AestNodeInterrupt[] = {303 { L"Interrupt Type", 1, 0, L"%d", NULL, NULL, ValidateInterruptType, NULL},304 { L"Reserved", 2, 1, L"0x%x", NULL, NULL, NULL, NULL},305 { L"Interrupt Flags", 1, 3, L"0x%x", NULL, NULL, ValidateInterruptFlags, NULL},306 { L"Interrupt GSIV", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},307 { L"ID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL},308 { L"Reserved1", 3, 9, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}304 STATIC CONST ACPI_PARSER AestNodeInterrupt[] = { 305 { L"Interrupt Type", 1, 0, L"%d", NULL, NULL, ValidateInterruptType, NULL }, 306 { L"Reserved", 2, 1, L"0x%x", NULL, NULL, NULL, NULL }, 307 { L"Interrupt Flags", 1, 3, L"0x%x", NULL, NULL, ValidateInterruptFlags, NULL }, 308 { L"Interrupt GSIV", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 309 { L"ID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL }, 310 { L"Reserved1", 3, 9, L"%x %x %x", Dump3Chars, NULL, NULL, NULL } 309 311 }; 310 312 … … 319 321 VOID 320 322 DumpProcessorNode ( 321 IN UINT8 *Ptr,322 IN UINT32 Length323 ) 324 { 325 UINT32 Offset;323 IN UINT8 *Ptr, 324 IN UINT32 Length 325 ) 326 { 327 UINT32 Offset; 326 328 327 329 Offset = ParseAcpi ( … … 338 340 if ((ProcessorId == NULL) || 339 341 (ProcessorResourceType == NULL) || 340 (ProcessorFlags == NULL)) { 342 (ProcessorFlags == NULL)) 343 { 341 344 IncrementErrorCount (); 342 345 Print ( … … 394 397 VOID 395 398 DumpMemoryControllerNode ( 396 IN UINT8 *Ptr,397 IN UINT32 Length399 IN UINT8 *Ptr, 400 IN UINT32 Length 398 401 ) 399 402 { … … 417 420 VOID 418 421 DumpSmmuNode ( 419 IN UINT8 *Ptr,420 IN UINT32 Length422 IN UINT8 *Ptr, 423 IN UINT32 Length 421 424 ) 422 425 { … … 440 443 VOID 441 444 DumpVendorDefinedNode ( 442 IN UINT8 *Ptr,443 IN UINT32 Length445 IN UINT8 *Ptr, 446 IN UINT32 Length 444 447 ) 445 448 { … … 463 466 VOID 464 467 DumpGicNode ( 465 IN UINT8 *Ptr,466 IN UINT32 Length468 IN UINT8 *Ptr, 469 IN UINT32 Length 467 470 ) 468 471 { … … 486 489 VOID 487 490 DumpNodeInterface ( 488 IN UINT8 *Ptr,489 IN UINT32 Length491 IN UINT8 *Ptr, 492 IN UINT32 Length 490 493 ) 491 494 { … … 510 513 VOID 511 514 DumpNodeInterrupts ( 512 IN UINT8 *Ptr,513 IN UINT32 Length,514 IN UINT32 InterruptCount515 ) 516 { 517 UINT32 Offset;518 UINT32 Index;519 CHAR8 Buffer[64];515 IN UINT8 *Ptr, 516 IN UINT32 Length, 517 IN UINT32 InterruptCount 518 ) 519 { 520 UINT32 Offset; 521 UINT32 Index; 522 CHAR8 Buffer[64]; 520 523 521 524 if (Length < (InterruptCount * sizeof (EFI_ACPI_AEST_INTERRUPT_STRUCT))) { 522 525 IncrementErrorCount (); 523 526 Print ( 524 L"ERROR: Node not long enough for Interrupt Array.\n" \527 L"ERROR: Node not long enough for Interrupt Array.\n" \ 525 528 L" Length left = %d, Required = %d, Interrupt Count = %d\n", 526 529 Length, … … 548 551 PARSER_PARAMS (AestNodeInterrupt) 549 552 ); 550 } // for553 } // for 551 554 } 552 555 … … 565 568 VOID 566 569 DumpAestNodeStructure ( 567 IN UINT8 *Ptr,570 IN UINT8 *Ptr, 568 571 IN UINT32 Length, 569 572 IN UINT8 NodeType, … … 574 577 ) 575 578 { 576 UINT32 Offset;577 UINT32 RemainingLength;578 UINT8 *NodeDataPtr;579 UINT32 Offset; 580 UINT32 RemainingLength; 581 UINT8 *NodeDataPtr; 579 582 580 583 Offset = ParseAcpi ( … … 590 593 IncrementErrorCount (); 591 594 Print ( 592 L"ERROR: Invalid Node Data Offset: %d.\n" \595 L"ERROR: Invalid Node Data Offset: %d.\n" \ 593 596 L" It should be between %d and %d.\n", 594 597 DataOffset, … … 601 604 IncrementErrorCount (); 602 605 Print ( 603 L"ERROR: Invalid Node Interface Offset: %d.\n" \606 L"ERROR: Invalid Node Interface Offset: %d.\n" \ 604 607 L" It should be between %d and %d.\n", 605 608 InterfaceOffset, … … 612 615 IncrementErrorCount (); 613 616 Print ( 614 L"ERROR: Invalid Node Interrupt Array Offset: %d.\n" \617 L"ERROR: Invalid Node Interrupt Array Offset: %d.\n" \ 615 618 L" It should be between %d and %d.\n", 616 619 InterruptArrayOffset, … … 621 624 622 625 // Parse Node Data Field. 623 NodeDataPtr = Ptr + DataOffset;626 NodeDataPtr = Ptr + DataOffset; 624 627 RemainingLength = Length - DataOffset; 625 628 switch (NodeType) { … … 676 679 EFIAPI 677 680 ParseAcpiAest ( 678 IN BOOLEAN Trace,679 IN UINT8 *Ptr,680 IN UINT32 AcpiTableLength,681 IN UINT8 AcpiTableRevision681 IN BOOLEAN Trace, 682 IN UINT8 *Ptr, 683 IN UINT32 AcpiTableLength, 684 IN UINT8 AcpiTableRevision 682 685 ) 683 686 { 684 687 UINT32 Offset; 685 UINT8 *NodePtr;688 UINT8 *NodePtr; 686 689 687 690 if (!Trace) { … … 717 720 (NodeInterfaceOffset == NULL) || 718 721 (NodeInterruptArrayOffset == NULL) || 719 (NodeInterruptCount == NULL)) { 722 (NodeInterruptCount == NULL)) 723 { 720 724 IncrementErrorCount (); 721 725 Print ( 722 L"ERROR: Insufficient length left for Node Structure.\n" \726 L"ERROR: Insufficient length left for Node Structure.\n" \ 723 727 L" Length left = %d.\n", 724 728 AcpiTableLength - Offset … … 729 733 // Validate AEST Node length 730 734 if ((*AestNodeLength == 0) || 731 ((Offset + (*AestNodeLength)) > AcpiTableLength)) { 735 ((Offset + (*AestNodeLength)) > AcpiTableLength)) 736 { 732 737 IncrementErrorCount (); 733 738 Print ( 734 739 L"ERROR: Invalid AEST Node length. " \ 735 740 L"Length = %d. Offset = %d. AcpiTableLength = %d.\n", 736 741 *AestNodeLength, 737 742 Offset, -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c
r80721 r99404 15 15 16 16 // Local variables 17 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;17 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 18 18 19 19 /** 20 20 An ACPI_PARSER array describing the ACPI BDRT Table. 21 21 **/ 22 STATIC CONST ACPI_PARSER BgrtParser[] = {22 STATIC CONST ACPI_PARSER BgrtParser[] = { 23 23 PARSE_ACPI_HEADER (&AcpiHdrInfo), 24 { L"Version", 2, 36, L"0x%x", NULL, NULL, NULL, NULL},25 { L"Status", 1, 38, L"0x%x", NULL, NULL, NULL, NULL},26 { L"Image Type", 1, 39, L"0x%x", NULL, NULL, NULL, NULL},27 { L"Image Address", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL},28 { L"Image Offset X", 4, 48, L"%d", NULL, NULL, NULL, NULL},29 { L"Image Offset Y", 4, 52, L"%d", NULL, NULL, NULL, NULL}24 { L"Version", 2, 36, L"0x%x", NULL, NULL, NULL, NULL }, 25 { L"Status", 1, 38, L"0x%x", NULL, NULL, NULL, NULL }, 26 { L"Image Type", 1, 39, L"0x%x", NULL, NULL, NULL, NULL }, 27 { L"Image Address", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL }, 28 { L"Image Offset X", 4, 48, L"%d", NULL, NULL, NULL, NULL }, 29 { L"Image Offset Y", 4, 52, L"%d", NULL, NULL, NULL, NULL } 30 30 }; 31 31 … … 45 45 EFIAPI 46 46 ParseAcpiBgrt ( 47 IN BOOLEAN Trace,48 IN UINT8 *Ptr,49 IN UINT32 AcpiTableLength,50 IN UINT8 AcpiTableRevision47 IN BOOLEAN Trace, 48 IN UINT8 *Ptr, 49 IN UINT32 AcpiTableLength, 50 IN UINT8 AcpiTableRevision 51 51 ) 52 52 { -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c
r85718 r99404 15 15 16 16 // Local variables pointing to the table fields 17 STATIC CONST UINT32 *OffsetDbgDeviceInfo;18 STATIC CONST UINT32 *NumberDbgDeviceInfo;19 STATIC CONST UINT16 *DbgDevInfoLen;20 STATIC CONST UINT8 *GasCount;21 STATIC CONST UINT16 *NameSpaceStringLength;22 STATIC CONST UINT16 *NameSpaceStringOffset;23 STATIC CONST UINT16 *OEMDataLength;24 STATIC CONST UINT16 *OEMDataOffset;25 STATIC CONST UINT16 *BaseAddrRegOffset;26 STATIC CONST UINT16 *AddrSizeOffset;27 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;17 STATIC CONST UINT32 *OffsetDbgDeviceInfo; 18 STATIC CONST UINT32 *NumberDbgDeviceInfo; 19 STATIC CONST UINT16 *DbgDevInfoLen; 20 STATIC CONST UINT8 *GasCount; 21 STATIC CONST UINT16 *NameSpaceStringLength; 22 STATIC CONST UINT16 *NameSpaceStringOffset; 23 STATIC CONST UINT16 *OEMDataLength; 24 STATIC CONST UINT16 *OEMDataOffset; 25 STATIC CONST UINT16 *BaseAddrRegOffset; 26 STATIC CONST UINT16 *AddrSizeOffset; 27 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 28 28 29 29 /** … … 38 38 EFIAPI 39 39 ValidateNameSpaceStrLen ( 40 IN UINT8 *Ptr,41 IN VOID *Context40 IN UINT8 *Ptr, 41 IN VOID *Context 42 42 ) 43 43 { 44 UINT16 NameSpaceStrLen;45 46 NameSpaceStrLen = *(UINT16 *)Ptr;44 UINT16 NameSpaceStrLen; 45 46 NameSpaceStrLen = *(UINT16 *)Ptr; 47 47 48 48 if (NameSpaceStrLen < 2) { … … 50 50 Print ( 51 51 L"\nERROR: NamespaceString Length = %d. If no Namespace device exists, " \ 52 52 L"NamespaceString[] must contain a period '.'", 53 53 NameSpaceStrLen 54 54 ); … … 57 57 58 58 /// An ACPI_PARSER array describing the ACPI DBG2 table. 59 STATIC CONST ACPI_PARSER Dbg2Parser[] = {59 STATIC CONST ACPI_PARSER Dbg2Parser[] = { 60 60 PARSE_ACPI_HEADER (&AcpiHdrInfo), 61 { L"OffsetDbgDeviceInfo", 4,36, L"0x%x", NULL,62 (VOID**)&OffsetDbgDeviceInfo, NULL, NULL},63 { L"NumberDbgDeviceInfo", 4, 40, L"%d",NULL,64 (VOID**)&NumberDbgDeviceInfo, NULL, NULL}61 { L"OffsetDbgDeviceInfo", 4, 36, L"0x%x", NULL, 62 (VOID **)&OffsetDbgDeviceInfo, NULL, NULL }, 63 { L"NumberDbgDeviceInfo", 4, 40, L"%d", NULL, 64 (VOID **)&NumberDbgDeviceInfo, NULL, NULL } 65 65 }; 66 66 67 67 /// An ACPI_PARSER array describing the debug device information structure 68 68 /// header. 69 STATIC CONST ACPI_PARSER DbgDevInfoHeaderParser[] = {70 { L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},71 { L"Length", 2, 1, L"%d", NULL, (VOID**)&DbgDevInfoLen, NULL, NULL}69 STATIC CONST ACPI_PARSER DbgDevInfoHeaderParser[] = { 70 { L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 71 { L"Length", 2, 1, L"%d", NULL, (VOID **)&DbgDevInfoLen, NULL, NULL } 72 72 }; 73 73 74 74 /// An ACPI_PARSER array describing the debug device information. 75 STATIC CONST ACPI_PARSER DbgDevInfoParser[] = {76 { L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},77 { L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL},78 79 { L"Generic Address Registers Count", 1, 3,L"0x%x", NULL,80 (VOID**)&GasCount, NULL, NULL},81 { L"NameSpace String Length", 2, 4, L"%d",NULL,82 (VOID**)&NameSpaceStringLength, ValidateNameSpaceStrLen, NULL},83 { L"NameSpace String Offset", 2, 6,L"0x%x", NULL,84 (VOID**)&NameSpaceStringOffset, NULL, NULL},85 { L"OEM Data Length", 2, 8, L"%d", NULL, (VOID**)&OEMDataLength,86 NULL, NULL},87 { L"OEM Data Offset", 2, 10, L"0x%x", NULL, (VOID**)&OEMDataOffset,88 NULL, NULL},89 90 { L"Port Type", 2, 12, L"0x%x", NULL, NULL, NULL, NULL},91 { L"Port SubType", 2, 14, L"0x%x", NULL, NULL, NULL, NULL},92 { L"Reserved", 2, 16, L"%x", NULL, NULL, NULL, NULL},93 94 { L"Base Address Register Offset",2, 18, L"0x%x", NULL,95 (VOID**)&BaseAddrRegOffset, NULL, NULL},96 { L"Address Size Offset",2, 20, L"0x%x", NULL,97 (VOID**)&AddrSizeOffset, NULL, NULL}75 STATIC CONST ACPI_PARSER DbgDevInfoParser[] = { 76 { L"Revision", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 77 { L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL }, 78 79 { L"Generic Address Registers Count", 1, 3, L"0x%x", NULL, 80 (VOID **)&GasCount, NULL, NULL }, 81 { L"NameSpace String Length", 2, 4, L"%d", NULL, 82 (VOID **)&NameSpaceStringLength, ValidateNameSpaceStrLen, NULL }, 83 { L"NameSpace String Offset", 2, 6, L"0x%x", NULL, 84 (VOID **)&NameSpaceStringOffset, NULL, NULL }, 85 { L"OEM Data Length", 2, 8, L"%d", NULL, (VOID **)&OEMDataLength, 86 NULL, NULL }, 87 { L"OEM Data Offset", 2, 10, L"0x%x", NULL, (VOID **)&OEMDataOffset, 88 NULL, NULL }, 89 90 { L"Port Type", 2, 12, L"0x%x", NULL, NULL, NULL, NULL }, 91 { L"Port SubType", 2, 14, L"0x%x", NULL, NULL, NULL, NULL }, 92 { L"Reserved", 2, 16, L"%x", NULL, NULL, NULL, NULL }, 93 94 { L"Base Address Register Offset", 2, 18, L"0x%x", NULL, 95 (VOID **)&BaseAddrRegOffset, NULL, NULL }, 96 { L"Address Size Offset", 2, 20, L"0x%x", NULL, 97 (VOID **)&AddrSizeOffset, NULL, NULL } 98 98 }; 99 99 … … 108 108 EFIAPI 109 109 DumpDbgDeviceInfo ( 110 IN UINT8 *Ptr,111 IN UINT16 Length110 IN UINT8 *Ptr, 111 IN UINT16 Length 112 112 ) 113 113 { … … 132 132 (OEMDataOffset == NULL) || 133 133 (BaseAddrRegOffset == NULL) || 134 (AddrSizeOffset == NULL)) { 134 (AddrSizeOffset == NULL)) 135 { 135 136 IncrementErrorCount (); 136 137 Print ( 137 138 L"ERROR: Insufficient Debug Device Information Structure length. " \ 138 139 L"Length = %d.\n", 139 140 Length 140 141 ); … … 143 144 144 145 // GAS 145 Index = 0;146 Index = 0; 146 147 Offset = *BaseAddrRegOffset; 147 148 while ((Index++ < *GasCount) && 148 (Offset < Length)) { 149 (Offset < Length)) 150 { 149 151 PrintFieldName (4, L"BaseAddressRegister"); 150 152 Offset += (UINT16)DumpGasStruct ( … … 161 163 Print ( 162 164 L"ERROR: Invalid GAS count. GasCount = %d. RemainingBufferLength = %d. " \ 163 165 L"Parsing of the Debug Device Information structure aborted.\n", 164 166 *GasCount, 165 167 Length - *AddrSizeOffset … … 169 171 170 172 // Address Size 171 Index = 0;173 Index = 0; 172 174 Offset = *AddrSizeOffset; 173 175 while ((Index++ < *GasCount) && 174 (Offset < Length)) { 176 (Offset < Length)) 177 { 175 178 PrintFieldName (4, L"Address Size"); 176 Print (L"0x%x\n", *((UINT32 *)(Ptr + Offset)));179 Print (L"0x%x\n", *((UINT32 *)(Ptr + Offset))); 177 180 Offset += sizeof (UINT32); 178 181 } 179 182 180 183 // NameSpace String 181 Index = 0;184 Index = 0; 182 185 Offset = *NameSpaceStringOffset; 183 186 PrintFieldName (4, L"NameSpace String"); 184 187 while ((Index++ < *NameSpaceStringLength) && 185 (Offset < Length)) { 188 (Offset < Length)) 189 { 186 190 Print (L"%c", *(Ptr + Offset)); 187 191 Offset++; 188 192 } 193 189 194 Print (L"\n"); 190 195 191 196 // OEM Data 192 197 if (*OEMDataOffset != 0) { 193 Index = 0;198 Index = 0; 194 199 Offset = *OEMDataOffset; 195 200 PrintFieldName (4, L"OEM Data"); 196 201 while ((Index++ < *OEMDataLength) && 197 (Offset < Length)) { 202 (Offset < Length)) 203 { 198 204 Print (L"%x ", *(Ptr + Offset)); 199 205 if ((Index & 7) == 0) { 200 206 Print (L"\n%-*s ", OUTPUT_FIELD_COLUMN_WIDTH, L""); 201 207 } 208 202 209 Offset++; 203 210 } 211 204 212 Print (L"\n"); 205 213 } … … 221 229 EFIAPI 222 230 ParseAcpiDbg2 ( 223 IN BOOLEAN Trace,224 IN UINT8 *Ptr,225 IN UINT32 AcpiTableLength,226 IN UINT8 AcpiTableRevision231 IN BOOLEAN Trace, 232 IN UINT8 *Ptr, 233 IN UINT32 AcpiTableLength, 234 IN UINT8 AcpiTableRevision 227 235 ) 228 236 { 229 UINT32 Offset;230 UINT32 Index;237 UINT32 Offset; 238 UINT32 Index; 231 239 232 240 if (!Trace) { … … 246 254 // successfully read. 247 255 if ((OffsetDbgDeviceInfo == NULL) || 248 (NumberDbgDeviceInfo == NULL)) { 256 (NumberDbgDeviceInfo == NULL)) 257 { 249 258 IncrementErrorCount (); 250 259 Print ( … … 256 265 257 266 Offset = *OffsetDbgDeviceInfo; 258 Index = 0;267 Index = 0; 259 268 260 269 while (Index++ < *NumberDbgDeviceInfo) { 261 262 270 // Parse the Debug Device Information Structure header to obtain Length 263 271 ParseAcpi ( … … 276 284 Print ( 277 285 L"ERROR: Insufficient remaining table buffer length to read the " \ 278 279 286 L"Debug Device Information structure's 'Length' field. " \ 287 L"RemainingTableBufferLength = %d.\n", 280 288 AcpiTableLength - Offset 281 289 ); … … 285 293 // Validate Debug Device Information Structure length 286 294 if ((*DbgDevInfoLen == 0) || 287 ((Offset + (*DbgDevInfoLen)) > AcpiTableLength)) { 295 ((Offset + (*DbgDevInfoLen)) > AcpiTableLength)) 296 { 288 297 IncrementErrorCount (); 289 298 Print ( 290 299 L"ERROR: Invalid Debug Device Information Structure length. " \ 291 300 L"Length = %d. Offset = %d. AcpiTableLength = %d.\n", 292 301 *DbgDevInfoLen, 293 302 Offset, -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c
r80721 r99404 2 2 DSDT table parser 3 3 4 Copyright (c) 2016 - 20 18, ARM Limited. All rights reserved.4 Copyright (c) 2016 - 2022, ARM Limited. All rights reserved. 5 5 SPDX-License-Identifier: BSD-2-Clause-Patent 6 6 … … 29 29 EFIAPI 30 30 ParseAcpiDsdt ( 31 IN BOOLEAN Trace,32 IN UINT8 *Ptr,33 IN UINT32 AcpiTableLength,34 IN UINT8 AcpiTableRevision31 IN BOOLEAN Trace, 32 IN UINT8 *Ptr, 33 IN UINT32 AcpiTableLength, 34 IN UINT8 AcpiTableRevision 35 35 ) 36 36 { … … 40 40 41 41 DumpAcpiHeader (Ptr); 42 43 // As per 19.6.29 in the version 6.4 of the ACPI spec, a revision less than 2 44 // restricts integers to 32 bit width. This may not be intended, raise a 45 // warning 46 #if defined (MDE_CPU_AARCH64) || defined (MDE_CPU_ARM) 47 if (AcpiTableRevision < 2) { 48 IncrementWarningCount (); 49 Print ( 50 L"WARNING: DSDT Table Revision less than 2. Integer width restricted to " 51 L"32 bits. Table Revision = %d.\n", 52 AcpiTableRevision 53 ); 54 return; 55 } 56 57 #endif 42 58 } -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsParser.c
r85718 r99404 17 17 An ACPI_PARSER array describing the ACPI FACS Table. 18 18 **/ 19 STATIC CONST ACPI_PARSER FacsParser[] = {20 { L"Signature", 4, 0, L"%c%c%c%c", Dump4Chars, NULL, NULL, NULL},21 { L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL},22 { L"Hardware Signature", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},23 { L"Firmware Waking Vector", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},24 { L"Global Lock", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},25 { L"Flags", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},26 { L"X Firmware Walking Vector", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},27 { L"Version", 1, 32, L"%d", NULL, NULL, NULL, NULL},28 { L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},29 { L"OSPM Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL},30 { L"Reserved",8, 40, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,31 NULL },32 { L"Reserved",8, 48, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,33 NULL },34 { L"Reserved",8, 56, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL,35 NULL }19 STATIC CONST ACPI_PARSER FacsParser[] = { 20 { L"Signature", 4, 0, L"%c%c%c%c", Dump4Chars, NULL, NULL, NULL }, 21 { L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL }, 22 { L"Hardware Signature", 4, 8, L"0x%x", NULL, NULL, NULL, NULL }, 23 { L"Firmware Waking Vector", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }, 24 { L"Global Lock", 4, 16, L"0x%x", NULL, NULL, NULL, NULL }, 25 { L"Flags", 4, 20, L"0x%x", NULL, NULL, NULL, NULL }, 26 { L"X Firmware Walking Vector", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL }, 27 { L"Version", 1, 32, L"%d", NULL, NULL, NULL, NULL }, 28 { L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL }, 29 { L"OSPM Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL }, 30 { L"Reserved", 8, 40, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL, 31 NULL }, 32 { L"Reserved", 8, 48, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL, 33 NULL }, 34 { L"Reserved", 8, 56, L"%x %x %x %x %x %x %x %x", Dump8Chars, NULL, NULL, 35 NULL } 36 36 }; 37 37 … … 51 51 EFIAPI 52 52 ParseAcpiFacs ( 53 IN BOOLEAN Trace,54 IN UINT8 *Ptr,55 IN UINT32 AcpiTableLength,56 IN UINT8 AcpiTableRevision53 IN BOOLEAN Trace, 54 IN UINT8 *Ptr, 55 IN UINT32 AcpiTableLength, 56 IN UINT8 AcpiTableRevision 57 57 ) 58 58 { -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c
r85718 r99404 3 3 4 4 Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. 5 Copyright (c) 2022, AMD Incorporated. All rights reserved. 5 6 SPDX-License-Identifier: BSD-2-Clause-Patent 6 7 … … 16 17 17 18 // Local variables 18 STATIC CONST UINT32 *DsdtAddress;19 STATIC CONST UINT64 *X_DsdtAddress;20 STATIC CONST UINT32 *Flags;21 STATIC CONST UINT32 *FirmwareCtrl;22 STATIC CONST UINT64 *X_FirmwareCtrl;23 STATIC CONST UINT8 *FadtMinorRevision;24 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;19 STATIC CONST UINT32 *DsdtAddress; 20 STATIC CONST UINT64 *X_DsdtAddress; 21 STATIC CONST UINT32 *Flags; 22 STATIC CONST UINT32 *FirmwareCtrl; 23 STATIC CONST UINT64 *X_FirmwareCtrl; 24 STATIC CONST UINT8 *FadtMinorRevision; 25 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 25 26 26 27 /** 27 28 A macro defining the Hardware reduced ACPI flag 28 29 **/ 29 #define HW_REDUCED_ACPI 30 #define HW_REDUCED_ACPI BIT20 30 31 31 32 /** 32 33 Offset to the FACS signature from the start of the FACS. 33 34 **/ 34 #define FACS_SIGNATURE_OFFSET 35 #define FACS_SIGNATURE_OFFSET 0 35 36 36 37 /** 37 38 Offset to the FACS revision from the start of the FACS. 38 39 **/ 39 #define FACS_VERSION_OFFSET 40 #define FACS_VERSION_OFFSET 32 40 41 41 42 /** 42 43 Offset to the FACS length from the start of the FACS. 43 44 **/ 44 #define FACS_LENGTH_OFFSET 45 #define FACS_LENGTH_OFFSET 4 45 46 46 47 /** … … 64 65 EFIAPI 65 66 ValidateFirmwareCtrl ( 66 IN UINT8 *Ptr,67 IN VOID *Context68 )69 { 70 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)71 if (*(UINT32 *)Ptr != 0) {67 IN UINT8 *Ptr, 68 IN VOID *Context 69 ) 70 { 71 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) 72 if (*(UINT32 *)Ptr != 0) { 72 73 IncrementErrorCount (); 73 74 Print ( 74 75 L"\nERROR: Firmware Control must be zero for ARM platforms." 75 ); 76 } 77 #endif 76 ); 77 } 78 79 #endif 78 80 } 79 81 … … 89 91 EFIAPI 90 92 ValidateXFirmwareCtrl ( 91 IN UINT8 *Ptr,92 IN VOID *Context93 )94 { 95 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)96 if (*(UINT64 *)Ptr != 0) {93 IN UINT8 *Ptr, 94 IN VOID *Context 95 ) 96 { 97 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) 98 if (*(UINT64 *)Ptr != 0) { 97 99 IncrementErrorCount (); 98 100 Print ( 99 101 L"\nERROR: X Firmware Control must be zero for ARM platforms." 100 ); 101 } 102 #endif 102 ); 103 } 104 105 #endif 103 106 } 104 107 … … 114 117 EFIAPI 115 118 ValidateFlags ( 116 IN UINT8 *Ptr,117 IN VOID *Context118 )119 { 120 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)121 if (((*(UINT32 *)Ptr) & HW_REDUCED_ACPI) == 0) {119 IN UINT8 *Ptr, 120 IN VOID *Context 121 ) 122 { 123 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) 124 if (((*(UINT32 *)Ptr) & HW_REDUCED_ACPI) == 0) { 122 125 IncrementErrorCount (); 123 126 Print ( 124 127 L"\nERROR: HW_REDUCED_ACPI flag must be set for ARM platforms." 128 ); 129 } 130 131 #endif 132 } 133 134 STATIC CONST ACPI_PARSER FadtFlagParser[] = { 135 { L"WBINVD", 1, 0, L"%d", NULL, NULL, NULL, NULL }, 136 { L"WBINVD_FLUSH", 1, 1, L"%d", NULL, NULL, NULL, NULL }, 137 { L"PROC_C1", 1, 2, L"%d", NULL, NULL, NULL, NULL }, 138 { L"P_LVL2_UP", 1, 3, L"%d", NULL, NULL, NULL, NULL }, 139 { L"PWR_BUTTON", 1, 4, L"%d", NULL, NULL, NULL, NULL }, 140 { L"SLP_BUTTON", 1, 5, L"%d", NULL, NULL, NULL, NULL }, 141 { L"FIX_RTC", 1, 6, L"%d", NULL, NULL, NULL, NULL }, 142 { L"RTC_S4", 1, 7, L"%d", NULL, NULL, NULL, NULL }, 143 { L"TMR_VAL_EXT", 1, 8, L"%d", NULL, NULL, NULL, NULL }, 144 { L"DCK_CAP", 1, 9, L"%d", NULL, NULL, NULL, NULL }, 145 { L"RESET_REG_SUP", 1, 10, L"%d", NULL, NULL, NULL, NULL }, 146 { L"SEALED_CASE", 1, 11, L"%d", NULL, NULL, NULL, NULL }, 147 { L"HEADLESS", 1, 12, L"%d", NULL, NULL, NULL, NULL }, 148 { L"CPU_SW_SLP", 1, 13, L"%d", NULL, NULL, NULL, NULL }, 149 { L"PCI_EXP_WAK", 1, 14, L"%d", NULL, NULL, NULL, NULL }, 150 { L"USE_PLATFORM_CLOCK", 1, 15, L"%d", NULL, NULL, NULL, NULL }, 151 { L"S4_RTC_STS_VALID", 1, 16, L"%d", NULL, NULL, NULL, NULL }, 152 { L"REMOTE_POWER_ON_CAPABLE", 1, 17, L"%d", NULL, NULL, NULL, NULL }, 153 { L"FORCE_APIC_CLUSTER_MODEL", 1, 18, L"%d", NULL, NULL, NULL, NULL }, 154 { L"FORCE_APIC_PHYSICAL_DESTINATION_MODE", 1, 19, L"%d", NULL, NULL, NULL, NULL }, 155 { L"HW_REDUCED_ACPI", 1, 20, L"%d", NULL, NULL, NULL, NULL }, 156 { L"LOW_POWER_S0_IDLE_CAPABLE", 1, 21, L"%d", NULL, NULL, NULL, NULL }, 157 { L"Reserved", 10, 22, L"%d", NULL, NULL, NULL, NULL } 158 }; 159 160 /** 161 This function traces FADT Flags fields. 162 If no format string is specified the Format must be NULL. 163 164 @param [in] Format Optional format string for tracing the data. 165 @param [in] Ptr Pointer to the start of the buffer. 166 **/ 167 VOID 168 EFIAPI 169 DumpFadtFlags ( 170 IN CONST CHAR16 *Format OPTIONAL, 171 IN UINT8 *Ptr 172 ) 173 { 174 if (Format != NULL) { 175 Print (Format, *(UINT32 *)Ptr); 176 return; 177 } 178 179 Print (L"0x%X\n", *(UINT32 *)Ptr); 180 ParseAcpiBitFields ( 181 TRUE, 182 2, 183 NULL, 184 Ptr, 185 4, 186 PARSER_PARAMS (FadtFlagParser) 125 187 ); 126 }127 #endif128 188 } 129 189 … … 131 191 An ACPI_PARSER array describing the ACPI FADT Table. 132 192 **/ 133 STATIC CONST ACPI_PARSER FadtParser[] = {193 STATIC CONST ACPI_PARSER FadtParser[] = { 134 194 PARSE_ACPI_HEADER (&AcpiHdrInfo), 135 { L"FIRMWARE_CTRL", 4, 36, L"0x%x", NULL, (VOID**)&FirmwareCtrl,136 ValidateFirmwareCtrl, NULL},137 { L"DSDT", 4, 40, L"0x%x", NULL, (VOID**)&DsdtAddress, NULL, NULL},138 { L"Reserved", 1, 44, L"%x", NULL, NULL, NULL, NULL},139 { L"Preferred_PM_Profile", 1, 45, L"0x%x", NULL, NULL, NULL, NULL},140 { L"SCI_INT", 2, 46, L"0x%x", NULL, NULL, NULL, NULL},141 { L"SMI_CMD", 4, 48, L"0x%x", NULL, NULL, NULL, NULL},142 { L"ACPI_ENABLE", 1, 52, L"0x%x", NULL, NULL, NULL, NULL},143 { L"ACPI_DISABLE", 1, 53, L"0x%x", NULL, NULL, NULL, NULL},144 { L"S4BIOS_REQ", 1, 54, L"0x%x", NULL, NULL, NULL, NULL},145 { L"PSTATE_CNT", 1, 55, L"0x%x", NULL, NULL, NULL, NULL},146 { L"PM1a_EVT_BLK", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},147 { L"PM1b_EVT_BLK", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},148 { L"PM1a_CNT_BLK", 4, 64, L"0x%x", NULL, NULL, NULL, NULL},149 { L"PM1b_CNT_BLK", 4, 68, L"0x%x", NULL, NULL, NULL, NULL},150 { L"PM2_CNT_BLK", 4, 72, L"0x%x", NULL, NULL, NULL, NULL},151 { L"PM_TMR_BLK", 4, 76, L"0x%x", NULL, NULL, NULL, NULL},152 { L"GPE0_BLK", 4, 80, L"0x%x", NULL, NULL, NULL, NULL},153 { L"GPE1_BLK", 4, 84, L"0x%x", NULL, NULL, NULL, NULL},154 { L"PM1_EVT_LEN", 1, 88, L"0x%x", NULL, NULL, NULL, NULL},155 { L"PM1_CNT_LEN", 1, 89, L"0x%x", NULL, NULL, NULL, NULL},156 { L"PM2_CNT_LEN", 1, 90, L"0x%x", NULL, NULL, NULL, NULL},157 { L"PM_TMR_LEN", 1, 91, L"0x%x", NULL, NULL, NULL, NULL},158 { L"GPE0_BLK_LEN", 1, 92, L"0x%x", NULL, NULL, NULL, NULL},159 { L"GPE1_BLK_LEN", 1, 93, L"0x%x", NULL, NULL, NULL, NULL},160 { L"GPE1_BASE", 1, 94, L"0x%x", NULL, NULL, NULL, NULL},161 { L"CST_CNT", 1, 95, L"0x%x", NULL, NULL, NULL, NULL},162 { L"P_LVL2_LAT", 2, 96, L"0x%x", NULL, NULL, NULL, NULL},163 { L"P_LVL3_LAT", 2, 98, L"0x%x", NULL, NULL, NULL, NULL},164 { L"FLUSH_SIZE", 2, 100, L"0x%x", NULL, NULL, NULL, NULL},165 { L"FLUSH_STRIDE", 2, 102, L"0x%x", NULL, NULL, NULL, NULL},166 { L"DUTY_OFFSET", 1, 104, L"0x%x", NULL, NULL, NULL, NULL},167 { L"DUTY_WIDTH", 1, 105, L"0x%x", NULL, NULL, NULL, NULL},168 { L"DAY_ALRM", 1, 106, L"0x%x", NULL, NULL, NULL, NULL},169 { L"MON_ALRM", 1, 107, L"0x%x", NULL, NULL, NULL, NULL},170 { L"CENTURY", 1, 108, L"0x%x", NULL, NULL, NULL, NULL},171 { L"IAPC_BOOT_ARCH", 2, 109, L"0x%x", NULL, NULL, NULL, NULL},172 { L"Reserved", 1, 111, L"0x%x", NULL, NULL, NULL, NULL},173 { L"Flags", 4, 112, L"0x%x", NULL, (VOID**)&Flags, ValidateFlags, NULL},174 { L"RESET_REG", 12, 116, NULL, DumpGas, NULL, NULL, NULL},175 { L"RESET_VALUE", 1, 128, L"0x%x", NULL, NULL, NULL, NULL},176 { L"ARM_BOOT_ARCH", 2, 129, L"0x%x", NULL, NULL, NULL, NULL},177 { L"FADT Minor Version", 1, 131, L"0x%x", NULL, (VOID**)&FadtMinorRevision,178 NULL, NULL},179 { L"X_FIRMWARE_CTRL", 8, 132, L"0x%lx", NULL, (VOID**)&X_FirmwareCtrl,180 ValidateXFirmwareCtrl, NULL},181 { L"X_DSDT", 8, 140, L"0x%lx", NULL, (VOID**)&X_DsdtAddress, NULL, NULL},182 { L"X_PM1a_EVT_BLK", 12, 148, NULL, DumpGas, NULL, NULL, NULL},183 { L"X_PM1b_EVT_BLK", 12, 160, NULL, DumpGas, NULL, NULL, NULL},184 { L"X_PM1a_CNT_BLK", 12, 172, NULL, DumpGas, NULL, NULL, NULL},185 { L"X_PM1b_CNT_BLK", 12, 184, NULL, DumpGas, NULL, NULL, NULL},186 { L"X_PM2_CNT_BLK", 12, 196, NULL, DumpGas, NULL, NULL, NULL},187 { L"X_PM_TMR_BLK", 12, 208, NULL, DumpGas, NULL, NULL, NULL},188 { L"X_GPE0_BLK", 12, 220, NULL, DumpGas, NULL, NULL, NULL},189 { L"X_GPE1_BLK", 12, 232, NULL, DumpGas, NULL, NULL, NULL},190 { L"SLEEP_CONTROL_REG", 12, 244, NULL, DumpGas, NULL, NULL, NULL},191 { L"SLEEP_STATUS_REG", 12, 256, NULL, DumpGas, NULL, NULL, NULL},192 { L"Hypervisor VendorIdentity", 8, 268, L"%lx", NULL, NULL, NULL, NULL}195 { L"FIRMWARE_CTRL", 4, 36, L"0x%x", NULL, (VOID **)&FirmwareCtrl, 196 ValidateFirmwareCtrl, NULL }, 197 { L"DSDT", 4, 40, L"0x%x", NULL, (VOID **)&DsdtAddress, NULL, NULL }, 198 { L"Reserved", 1, 44, L"%x", NULL, NULL, NULL, NULL }, 199 { L"Preferred_PM_Profile", 1, 45, L"0x%x", NULL, NULL, NULL, NULL }, 200 { L"SCI_INT", 2, 46, L"0x%x", NULL, NULL, NULL, NULL }, 201 { L"SMI_CMD", 4, 48, L"0x%x", NULL, NULL, NULL, NULL }, 202 { L"ACPI_ENABLE", 1, 52, L"0x%x", NULL, NULL, NULL, NULL }, 203 { L"ACPI_DISABLE", 1, 53, L"0x%x", NULL, NULL, NULL, NULL }, 204 { L"S4BIOS_REQ", 1, 54, L"0x%x", NULL, NULL, NULL, NULL }, 205 { L"PSTATE_CNT", 1, 55, L"0x%x", NULL, NULL, NULL, NULL }, 206 { L"PM1a_EVT_BLK", 4, 56, L"0x%x", NULL, NULL, NULL, NULL }, 207 { L"PM1b_EVT_BLK", 4, 60, L"0x%x", NULL, NULL, NULL, NULL }, 208 { L"PM1a_CNT_BLK", 4, 64, L"0x%x", NULL, NULL, NULL, NULL }, 209 { L"PM1b_CNT_BLK", 4, 68, L"0x%x", NULL, NULL, NULL, NULL }, 210 { L"PM2_CNT_BLK", 4, 72, L"0x%x", NULL, NULL, NULL, NULL }, 211 { L"PM_TMR_BLK", 4, 76, L"0x%x", NULL, NULL, NULL, NULL }, 212 { L"GPE0_BLK", 4, 80, L"0x%x", NULL, NULL, NULL, NULL }, 213 { L"GPE1_BLK", 4, 84, L"0x%x", NULL, NULL, NULL, NULL }, 214 { L"PM1_EVT_LEN", 1, 88, L"0x%x", NULL, NULL, NULL, NULL }, 215 { L"PM1_CNT_LEN", 1, 89, L"0x%x", NULL, NULL, NULL, NULL }, 216 { L"PM2_CNT_LEN", 1, 90, L"0x%x", NULL, NULL, NULL, NULL }, 217 { L"PM_TMR_LEN", 1, 91, L"0x%x", NULL, NULL, NULL, NULL }, 218 { L"GPE0_BLK_LEN", 1, 92, L"0x%x", NULL, NULL, NULL, NULL }, 219 { L"GPE1_BLK_LEN", 1, 93, L"0x%x", NULL, NULL, NULL, NULL }, 220 { L"GPE1_BASE", 1, 94, L"0x%x", NULL, NULL, NULL, NULL }, 221 { L"CST_CNT", 1, 95, L"0x%x", NULL, NULL, NULL, NULL }, 222 { L"P_LVL2_LAT", 2, 96, L"0x%x", NULL, NULL, NULL, NULL }, 223 { L"P_LVL3_LAT", 2, 98, L"0x%x", NULL, NULL, NULL, NULL }, 224 { L"FLUSH_SIZE", 2, 100, L"0x%x", NULL, NULL, NULL, NULL }, 225 { L"FLUSH_STRIDE", 2, 102, L"0x%x", NULL, NULL, NULL, NULL }, 226 { L"DUTY_OFFSET", 1, 104, L"0x%x", NULL, NULL, NULL, NULL }, 227 { L"DUTY_WIDTH", 1, 105, L"0x%x", NULL, NULL, NULL, NULL }, 228 { L"DAY_ALRM", 1, 106, L"0x%x", NULL, NULL, NULL, NULL }, 229 { L"MON_ALRM", 1, 107, L"0x%x", NULL, NULL, NULL, NULL }, 230 { L"CENTURY", 1, 108, L"0x%x", NULL, NULL, NULL, NULL }, 231 { L"IAPC_BOOT_ARCH", 2, 109, L"0x%x", NULL, NULL, NULL, NULL }, 232 { L"Reserved", 1, 111, L"0x%x", NULL, NULL, NULL, NULL }, 233 { L"Flags", 4, 112, NULL, DumpFadtFlags, (VOID **)&Flags, ValidateFlags, NULL }, 234 { L"RESET_REG", 12, 116, NULL, DumpGas, NULL, NULL, NULL }, 235 { L"RESET_VALUE", 1, 128, L"0x%x", NULL, NULL, NULL, NULL }, 236 { L"ARM_BOOT_ARCH", 2, 129, L"0x%x", NULL, NULL, NULL, NULL }, 237 { L"FADT Minor Version", 1, 131, L"0x%x", NULL, (VOID **)&FadtMinorRevision, 238 NULL, NULL }, 239 { L"X_FIRMWARE_CTRL", 8, 132, L"0x%lx", NULL, (VOID **)&X_FirmwareCtrl, 240 ValidateXFirmwareCtrl, NULL }, 241 { L"X_DSDT", 8, 140, L"0x%lx", NULL, (VOID **)&X_DsdtAddress, NULL, NULL }, 242 { L"X_PM1a_EVT_BLK", 12, 148, NULL, DumpGas, NULL, NULL, NULL }, 243 { L"X_PM1b_EVT_BLK", 12, 160, NULL, DumpGas, NULL, NULL, NULL }, 244 { L"X_PM1a_CNT_BLK", 12, 172, NULL, DumpGas, NULL, NULL, NULL }, 245 { L"X_PM1b_CNT_BLK", 12, 184, NULL, DumpGas, NULL, NULL, NULL }, 246 { L"X_PM2_CNT_BLK", 12, 196, NULL, DumpGas, NULL, NULL, NULL }, 247 { L"X_PM_TMR_BLK", 12, 208, NULL, DumpGas, NULL, NULL, NULL }, 248 { L"X_GPE0_BLK", 12, 220, NULL, DumpGas, NULL, NULL, NULL }, 249 { L"X_GPE1_BLK", 12, 232, NULL, DumpGas, NULL, NULL, NULL }, 250 { L"SLEEP_CONTROL_REG", 12, 244, NULL, DumpGas, NULL, NULL, NULL }, 251 { L"SLEEP_STATUS_REG", 12, 256, NULL, DumpGas, NULL, NULL, NULL }, 252 { L"Hypervisor VendorIdentity", 8, 268, L"%lx", NULL, NULL, NULL, NULL } 193 253 }; 194 254 … … 207 267 EFIAPI 208 268 ParseAcpiFadt ( 209 IN BOOLEAN Trace,210 IN UINT8 *Ptr,211 IN UINT32 AcpiTableLength,212 IN UINT8 AcpiTableRevision213 ) 214 { 215 EFI_STATUS 216 UINT8 *DsdtPtr;217 UINT8 *FirmwareCtrlPtr;218 UINT32 219 UINT32 220 UINT8 221 PARSE_ACPI_TABLE_PROC 269 IN BOOLEAN Trace, 270 IN UINT8 *Ptr, 271 IN UINT32 AcpiTableLength, 272 IN UINT8 AcpiTableRevision 273 ) 274 { 275 EFI_STATUS Status; 276 UINT8 *DsdtPtr; 277 UINT8 *FirmwareCtrlPtr; 278 UINT32 FacsSignature; 279 UINT32 FacsLength; 280 UINT8 FacsRevision; 281 PARSE_ACPI_TABLE_PROC FacsParserProc; 222 282 223 283 ParseAcpi ( … … 234 294 Print (L"\nSummary:\n"); 235 295 PrintFieldName (2, L"FADT Version"); 236 Print (L"%d.%d\n", 296 Print (L"%d.%d\n", *AcpiHdrInfo.Revision, *FadtMinorRevision); 237 297 } 238 298 … … 246 306 // FIRMWARE_CTRL, else use FIRMWARE_CTRL. 247 307 if ((X_FirmwareCtrl != NULL) && (*X_FirmwareCtrl != 0)) { 248 FirmwareCtrlPtr = (UINT8 *)(UINTN)(*X_FirmwareCtrl);308 FirmwareCtrlPtr = (UINT8 *)(UINTN)(*X_FirmwareCtrl); 249 309 } else if ((FirmwareCtrl != NULL) && (*FirmwareCtrl != 0)) { 250 FirmwareCtrlPtr = (UINT8 *)(UINTN)(*FirmwareCtrl);310 FirmwareCtrlPtr = (UINT8 *)(UINTN)(*FirmwareCtrl); 251 311 } else { 252 312 FirmwareCtrlPtr = NULL; … … 256 316 if ((Trace) && 257 317 (Flags != NULL) && 258 ((*Flags & EFI_ACPI_6_3_HW_REDUCED_ACPI) != EFI_ACPI_6_3_HW_REDUCED_ACPI)) { 318 ((*Flags & EFI_ACPI_6_3_HW_REDUCED_ACPI) != EFI_ACPI_6_3_HW_REDUCED_ACPI)) 319 { 259 320 IncrementErrorCount (); 260 Print (L"ERROR: No FACS table found, " 261 L"both X_FIRMWARE_CTRL and FIRMWARE_CTRL are zero.\n"); 321 Print ( 322 L"ERROR: No FACS table found, " 323 L"both X_FIRMWARE_CTRL and FIRMWARE_CTRL are zero.\n" 324 ); 262 325 } 263 326 } … … 267 330 // the signature, length and version needs to be initially parsed. 268 331 // The FACS signature is 4 bytes starting at offset 0. 269 FacsSignature = *(UINT32 *)(FirmwareCtrlPtr + FACS_SIGNATURE_OFFSET);332 FacsSignature = *(UINT32 *)(FirmwareCtrlPtr + FACS_SIGNATURE_OFFSET); 270 333 271 334 // The FACS length is 4 bytes starting at offset 4. 272 FacsLength = *(UINT32 *)(FirmwareCtrlPtr + FACS_LENGTH_OFFSET);335 FacsLength = *(UINT32 *)(FirmwareCtrlPtr + FACS_LENGTH_OFFSET); 273 336 274 337 // The FACS version is 1 byte starting at offset 32. 275 FacsRevision = *(UINT8 *)(FirmwareCtrlPtr + FACS_VERSION_OFFSET);338 FacsRevision = *(UINT8 *)(FirmwareCtrlPtr + FACS_VERSION_OFFSET); 276 339 277 340 Trace = ProcessTableReportOptions ( … … 299 362 // If X_DSDT is valid then use X_DSDT and ignore DSDT, else use DSDT. 300 363 if ((X_DsdtAddress != NULL) && (*X_DsdtAddress != 0)) { 301 DsdtPtr = (UINT8 *)(UINTN)(*X_DsdtAddress);364 DsdtPtr = (UINT8 *)(UINTN)(*X_DsdtAddress); 302 365 } else if ((DsdtAddress != NULL) && (*DsdtAddress != 0)) { 303 DsdtPtr = (UINT8 *)(UINTN)(*DsdtAddress);366 DsdtPtr = (UINT8 *)(UINTN)(*DsdtAddress); 304 367 } else { 305 368 // Both DSDT and X_DSDT cannot be invalid. 306 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)369 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) 307 370 if (Trace) { 308 371 // The DSDT Table is mandatory for ARM systems … … 312 375 Print (L"ERROR: Both X_DSDT and DSDT are invalid.\n"); 313 376 } 314 #endif 377 378 #endif 315 379 return; 316 380 } -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c
r89983 r99404 2 2 GTDT table parser 3 3 4 Copyright (c) 2016 - 202 0, ARM Limited. All rights reserved.4 Copyright (c) 2016 - 2021, ARM Limited. All rights reserved. 5 5 SPDX-License-Identifier: BSD-2-Clause-Patent 6 6 7 7 @par Reference(s): 8 - ACPI 6. 3 Specification - January 20198 - ACPI 6.4 Specification - January 2021 9 9 **/ 10 10 … … 16 16 17 17 // "The number of GT Block Timers must be less than or equal to 8" 18 #define GT_BLOCK_TIMER_COUNT_MAX 818 #define GT_BLOCK_TIMER_COUNT_MAX 8 19 19 20 20 // Local variables 21 STATIC CONST UINT32 *GtdtPlatformTimerCount;22 STATIC CONST UINT32 *GtdtPlatformTimerOffset;23 STATIC CONST UINT8 *PlatformTimerType;24 STATIC CONST UINT16 *PlatformTimerLength;25 STATIC CONST UINT32 *GtBlockTimerCount;26 STATIC CONST UINT32 *GtBlockTimerOffset;27 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;21 STATIC CONST UINT32 *GtdtPlatformTimerCount; 22 STATIC CONST UINT32 *GtdtPlatformTimerOffset; 23 STATIC CONST UINT8 *PlatformTimerType; 24 STATIC CONST UINT16 *PlatformTimerLength; 25 STATIC CONST UINT32 *GtBlockTimerCount; 26 STATIC CONST UINT32 *GtBlockTimerOffset; 27 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 28 28 29 29 /** … … 38 38 EFIAPI 39 39 ValidateGtBlockTimerCount ( 40 IN UINT8 *Ptr,41 IN VOID *Context42 ) 43 { 44 UINT32 BlockTimerCount;45 46 BlockTimerCount = *(UINT32 *)Ptr;40 IN UINT8 *Ptr, 41 IN VOID *Context 42 ) 43 { 44 UINT32 BlockTimerCount; 45 46 BlockTimerCount = *(UINT32 *)Ptr; 47 47 48 48 if (BlockTimerCount > GT_BLOCK_TIMER_COUNT_MAX) { … … 67 67 EFIAPI 68 68 ValidateGtFrameNumber ( 69 IN UINT8 *Ptr,70 IN VOID *Context71 ) 72 { 73 UINT8 FrameNumber;74 75 FrameNumber = *(UINT8 *)Ptr;69 IN UINT8 *Ptr, 70 IN VOID *Context 71 ) 72 { 73 UINT8 FrameNumber; 74 75 FrameNumber = *(UINT8 *)Ptr; 76 76 77 77 if (FrameNumber >= GT_BLOCK_TIMER_COUNT_MAX) { … … 88 88 An ACPI_PARSER array describing the ACPI GTDT Table. 89 89 **/ 90 STATIC CONST ACPI_PARSER GtdtParser[] = {90 STATIC CONST ACPI_PARSER GtdtParser[] = { 91 91 PARSE_ACPI_HEADER (&AcpiHdrInfo), 92 { L"CntControlBase Physical Address", 8, 36,L"0x%lx", NULL, NULL,93 NULL, NULL},94 { L"Reserved", 4, 44, L"0x%x", NULL, NULL, NULL, NULL},95 { L"Secure EL1 timer GSIV", 4, 48, L"0x%x", NULL, NULL, NULL, NULL},96 { L"Secure EL1 timer FLAGS", 4, 52, L"0x%x", NULL, NULL, NULL, NULL},97 98 { L"Non-Secure EL1 timer GSIV", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},99 { L"Non-Secure EL1 timer FLAGS", 4, 60, L"0x%x", NULL, NULL, NULL, NULL},100 101 { L"Virtual timer GSIV", 4, 64, L"0x%x", NULL, NULL, NULL, NULL},102 { L"Virtual timer FLAGS", 4, 68, L"0x%x", NULL, NULL, NULL, NULL},103 104 { L"Non-Secure EL2 timer GSIV", 4, 72, L"0x%x", NULL, NULL, NULL, NULL},105 { L"Non-Secure EL2 timer FLAGS", 4, 76, L"0x%x", NULL, NULL, NULL, NULL},106 107 { L"CntReadBase Physical address", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL},108 { L"Platform Timer Count", 4, 88, L"%d",NULL,109 (VOID**)&GtdtPlatformTimerCount, NULL, NULL},110 { L"Platform Timer Offset", 4, 92, L"0x%x",NULL,111 (VOID**)&GtdtPlatformTimerOffset, NULL, NULL},112 { L"Virtual EL2 Timer GSIV", 4, 96, L"0x%x", NULL, NULL, NULL, NULL},113 { L"Virtual EL2 Timer Flags", 4, 100, L"0x%x", NULL, NULL, NULL, NULL}92 { L"CntControlBase Physical Address",8, 36, L"0x%lx", NULL, NULL, 93 NULL, NULL }, 94 { L"Reserved", 4, 44, L"0x%x", NULL, NULL,NULL, NULL }, 95 { L"Secure EL1 timer GSIV", 4, 48, L"0x%x", NULL, NULL,NULL, NULL }, 96 { L"Secure EL1 timer FLAGS", 4, 52, L"0x%x", NULL, NULL,NULL, NULL }, 97 98 { L"Non-Secure EL1 timer GSIV", 4, 56, L"0x%x", NULL, NULL,NULL, NULL }, 99 { L"Non-Secure EL1 timer FLAGS", 4, 60, L"0x%x", NULL, NULL,NULL, NULL }, 100 101 { L"Virtual timer GSIV", 4, 64, L"0x%x", NULL, NULL,NULL, NULL }, 102 { L"Virtual timer FLAGS", 4, 68, L"0x%x", NULL, NULL,NULL, NULL }, 103 104 { L"Non-Secure EL2 timer GSIV", 4, 72, L"0x%x", NULL, NULL,NULL, NULL }, 105 { L"Non-Secure EL2 timer FLAGS", 4, 76, L"0x%x", NULL, NULL,NULL, NULL }, 106 107 { L"CntReadBase Physical address", 8, 80, L"0x%lx", NULL, NULL,NULL, NULL }, 108 { L"Platform Timer Count", 4, 88, L"%d", NULL, 109 (VOID **)&GtdtPlatformTimerCount, NULL, NULL }, 110 { L"Platform Timer Offset", 4, 92, L"0x%x", NULL, 111 (VOID **)&GtdtPlatformTimerOffset,NULL, NULL }, 112 { L"Virtual EL2 Timer GSIV", 4, 96, L"0x%x", NULL, NULL,NULL, NULL }, 113 { L"Virtual EL2 Timer Flags", 4, 100, L"0x%x", NULL, NULL,NULL, NULL } 114 114 }; 115 115 … … 117 117 An ACPI_PARSER array describing the Platform timer header. 118 118 **/ 119 STATIC CONST ACPI_PARSER GtPlatformTimerHeaderParser[] = {120 { L"Type", 1, 0, NULL, NULL, (VOID**)&PlatformTimerType, NULL, NULL},121 { L"Length", 2, 1, NULL, NULL, (VOID**)&PlatformTimerLength, NULL, NULL},122 { L"Reserved", 1, 3, NULL, NULL, NULL, NULL, NULL}119 STATIC CONST ACPI_PARSER GtPlatformTimerHeaderParser[] = { 120 { L"Type", 1, 0, NULL, NULL, (VOID **)&PlatformTimerType, NULL, NULL }, 121 { L"Length", 2, 1, NULL, NULL, (VOID **)&PlatformTimerLength, NULL, NULL }, 122 { L"Reserved", 1, 3, NULL, NULL, NULL, NULL, NULL } 123 123 }; 124 124 … … 126 126 An ACPI_PARSER array describing the Platform GT Block. 127 127 **/ 128 STATIC CONST ACPI_PARSER GtBlockParser[] = {129 { L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL},130 { L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL},131 { L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL},132 { L"Physical address (CntCtlBase)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},133 { L"Timer Count", 4, 12, L"%d", NULL, (VOID**)&GtBlockTimerCount,134 ValidateGtBlockTimerCount, NULL},135 { L"Timer Offset", 4, 16, L"%d", NULL, (VOID**)&GtBlockTimerOffset, NULL,136 NULL }128 STATIC CONST ACPI_PARSER GtBlockParser[] = { 129 { L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL }, 130 { L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL }, 131 { L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL }, 132 { L"Physical address (CntCtlBase)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL }, 133 { L"Timer Count", 4, 12, L"%d", NULL, (VOID **)&GtBlockTimerCount, 134 ValidateGtBlockTimerCount, NULL }, 135 { L"Timer Offset", 4, 16, L"%d", NULL, (VOID **)&GtBlockTimerOffset, NULL, 136 NULL } 137 137 }; 138 138 … … 140 140 An ACPI_PARSER array describing the GT Block timer. 141 141 **/ 142 STATIC CONST ACPI_PARSER GtBlockTimerParser[] = {143 { L"Frame Number", 1, 0, L"%d", NULL, NULL, ValidateGtFrameNumber, NULL},144 { L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},145 { L"Physical address (CntBaseX)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},146 { L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx", NULL,NULL, NULL,147 NULL },148 { L"Physical Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},149 { L"Physical Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},150 { L"Virtual Timer GSIV", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},151 { L"Virtual Timer Flags", 4, 32, L"0x%x", NULL, NULL, NULL, NULL},152 { L"Common Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL}142 STATIC CONST ACPI_PARSER GtBlockTimerParser[] = { 143 { L"Frame Number", 1, 0, L"%d", NULL, NULL, ValidateGtFrameNumber, NULL }, 144 { L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL }, 145 { L"Physical address (CntBaseX)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL }, 146 { L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx", NULL, NULL, NULL, 147 NULL }, 148 { L"Physical Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL }, 149 { L"Physical Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL }, 150 { L"Virtual Timer GSIV", 4, 28, L"0x%x", NULL, NULL, NULL, NULL }, 151 { L"Virtual Timer Flags", 4, 32, L"0x%x", NULL, NULL, NULL, NULL }, 152 { L"Common Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL } 153 153 }; 154 154 … … 156 156 An ACPI_PARSER array describing the Platform Watchdog. 157 157 **/ 158 STATIC CONST ACPI_PARSER SBSAGenericWatchdogParser[] = {159 { L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL},160 { L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL},161 { L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL},162 { L"RefreshFrame Physical address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},163 { L"ControlFrame Physical address", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL},164 { L"Watchdog Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},165 { L"Watchdog Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}158 STATIC CONST ACPI_PARSER ArmGenericWatchdogParser[] = { 159 { L"Type", 1, 0, L"%d", NULL, NULL, NULL, NULL }, 160 { L"Length", 2, 1, L"%d", NULL, NULL, NULL, NULL }, 161 { L"Reserved", 1, 3, L"%x", NULL, NULL, NULL, NULL }, 162 { L"RefreshFrame Physical address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL }, 163 { L"ControlFrame Physical address", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL }, 164 { L"Watchdog Timer GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL }, 165 { L"Watchdog Timer Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL } 166 166 }; 167 167 … … 175 175 VOID 176 176 DumpGTBlock ( 177 IN UINT8 *Ptr,178 IN UINT16 Length179 ) 180 { 181 UINT32 Index;182 UINT32 Offset;177 IN UINT8 *Ptr, 178 IN UINT16 Length 179 ) 180 { 181 UINT32 Index; 182 UINT32 Offset; 183 183 184 184 ParseAcpi ( … … 194 194 // successfully read. 195 195 if ((GtBlockTimerCount == NULL) || 196 (GtBlockTimerOffset == NULL)) { 196 (GtBlockTimerOffset == NULL)) 197 { 197 198 IncrementErrorCount (); 198 199 Print ( … … 204 205 205 206 Offset = *GtBlockTimerOffset; 206 Index = 0;207 Index = 0; 207 208 208 209 // Parse the specified number of GT Block Timer Structures or the GT Block 209 210 // Structure buffer length. Whichever is minimum. 210 211 while ((Index++ < *GtBlockTimerCount) && 211 (Offset < Length)) { 212 (Offset < Length)) 213 { 212 214 Offset += ParseAcpi ( 213 215 TRUE, … … 230 232 VOID 231 233 DumpWatchdogTimer ( 232 IN UINT8 *Ptr,233 IN UINT16 Length234 IN UINT8 *Ptr, 235 IN UINT16 Length 234 236 ) 235 237 { … … 237 239 TRUE, 238 240 2, 239 " SBSAGeneric Watchdog",241 "Arm Generic Watchdog", 240 242 Ptr, 241 243 Length, 242 PARSER_PARAMS ( SBSAGenericWatchdogParser)244 PARSER_PARAMS (ArmGenericWatchdogParser) 243 245 ); 244 246 } … … 263 265 EFIAPI 264 266 ParseAcpiGtdt ( 265 IN BOOLEAN Trace,266 IN UINT8 *Ptr,267 IN UINT32 AcpiTableLength,268 IN UINT8 AcpiTableRevision269 ) 270 { 271 UINT32 Index;272 UINT32 Offset;273 UINT8 *TimerPtr;267 IN BOOLEAN Trace, 268 IN UINT8 *Ptr, 269 IN UINT32 AcpiTableLength, 270 IN UINT8 AcpiTableRevision 271 ) 272 { 273 UINT32 Index; 274 UINT32 Offset; 275 UINT8 *TimerPtr; 274 276 275 277 if (!Trace) { … … 289 291 // successfully read. 290 292 if ((GtdtPlatformTimerCount == NULL) || 291 (GtdtPlatformTimerOffset == NULL)) { 293 (GtdtPlatformTimerOffset == NULL)) 294 { 292 295 IncrementErrorCount (); 293 296 Print ( … … 299 302 300 303 TimerPtr = Ptr + *GtdtPlatformTimerOffset; 301 Offset = *GtdtPlatformTimerOffset;302 Index = 0;304 Offset = *GtdtPlatformTimerOffset; 305 Index = 0; 303 306 304 307 // Parse the specified number of Platform Timer Structures or the GTDT 305 308 // buffer length. Whichever is minimum. 306 309 while ((Index++ < *GtdtPlatformTimerCount) && 307 (Offset < AcpiTableLength)) { 310 (Offset < AcpiTableLength)) 311 { 308 312 // Parse the Platform Timer Header to obtain Length and Type 309 313 ParseAcpi ( … … 319 323 // successfully read. 320 324 if ((PlatformTimerType == NULL) || 321 (PlatformTimerLength == NULL)) { 325 (PlatformTimerLength == NULL)) 326 { 322 327 IncrementErrorCount (); 323 328 Print ( 324 329 L"ERROR: Insufficient remaining table buffer length to read the " \ 325 330 L"Platform Timer Structure header. Length = %d.\n", 326 331 AcpiTableLength - Offset 327 332 ); … … 331 336 // Validate Platform Timer Structure length 332 337 if ((*PlatformTimerLength == 0) || 333 ((Offset + (*PlatformTimerLength)) > AcpiTableLength)) { 338 ((Offset + (*PlatformTimerLength)) > AcpiTableLength)) 339 { 334 340 IncrementErrorCount (); 335 341 Print ( 336 342 L"ERROR: Invalid Platform Timer Structure length. " \ 337 343 L"Length = %d. Offset = %d. AcpiTableLength = %d.\n", 338 344 *PlatformTimerLength, 339 345 Offset, … … 344 350 345 351 switch (*PlatformTimerType) { 346 case EFI_ACPI_6_ 3_GTDT_GT_BLOCK:352 case EFI_ACPI_6_4_GTDT_GT_BLOCK: 347 353 DumpGTBlock (TimerPtr, *PlatformTimerLength); 348 354 break; 349 case EFI_ACPI_6_ 3_GTDT_SBSA_GENERIC_WATCHDOG:355 case EFI_ACPI_6_4_GTDT_ARM_GENERIC_WATCHDOG: 350 356 DumpWatchdogTimer (TimerPtr, *PlatformTimerLength); 351 357 break; … … 360 366 361 367 TimerPtr += *PlatformTimerLength; 362 Offset += *PlatformTimerLength;368 Offset += *PlatformTimerLength; 363 369 } // while 364 370 } -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c
r89983 r99404 22 22 23 23 // Maximum Memory Domain matrix print size. 24 #define MAX_MEMORY_DOMAIN_TARGET_PRINT_MATRIX 24 #define MAX_MEMORY_DOMAIN_TARGET_PRINT_MATRIX 10 25 25 26 26 // Local variables 27 STATIC CONST UINT16 *HmatStructureType;28 STATIC CONST UINT32 *HmatStructureLength;29 30 STATIC CONST UINT32 *NumberInitiatorProximityDomain;31 STATIC CONST UINT32 *NumberTargetProximityDomain;27 STATIC CONST UINT16 *HmatStructureType; 28 STATIC CONST UINT32 *HmatStructureLength; 29 30 STATIC CONST UINT32 *NumberInitiatorProximityDomain; 31 STATIC CONST UINT32 *NumberTargetProximityDomain; 32 32 STATIC CONST 33 EFI_ACPI_6_ 3_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO_FLAGS*34 SllbiFlags;35 36 STATIC CONST UINT8 *SllbiDataType;37 STATIC CONST UINT16 *NumberSMBIOSHandles;38 39 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;33 EFI_ACPI_6_4_HMAT_STRUCTURE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO_FLAGS * 34 SllbiFlags; 35 36 STATIC CONST UINT8 *SllbiDataType; 37 STATIC CONST UINT16 *NumberSMBIOSHandles; 38 39 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 40 40 41 41 /** 42 42 Names of System Locality Latency Bandwidth Information (SLLBI) data types 43 43 **/ 44 STATIC CONST CHAR16 *SllbiNames[] = {44 STATIC CONST CHAR16 *SllbiNames[] = { 45 45 L"Access %sLatency%s", 46 46 L"Read %sLatency%s", … … 62 62 EFIAPI 63 63 ValidateCacheAttributes ( 64 IN UINT8 *Ptr,65 IN VOID *Context64 IN UINT8 *Ptr, 65 IN VOID *Context 66 66 ) 67 67 { 68 EFI_ACPI_6_ 3_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*69 Attributes;68 EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES * 69 Attributes; 70 70 71 71 Attributes = 72 (EFI_ACPI_6_ 3_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*)Ptr;72 (EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *)Ptr; 73 73 74 74 if (Attributes->TotalCacheLevels > 0x3) { … … 79 79 ); 80 80 } 81 81 82 if (Attributes->CacheLevel > 0x3) { 82 83 IncrementErrorCount (); … … 86 87 ); 87 88 } 89 88 90 if (Attributes->CacheAssociativity > 0x2) { 89 91 IncrementErrorCount (); … … 93 95 ); 94 96 } 97 95 98 if (Attributes->WritePolicy > 0x2) { 96 99 IncrementErrorCount (); … … 112 115 EFIAPI 113 116 DumpCacheAttributes ( 114 IN CONST CHAR16 *Format OPTIONAL,115 IN UINT8 *Ptr117 IN CONST CHAR16 *Format OPTIONAL, 118 IN UINT8 *Ptr 116 119 ) 117 120 { 118 EFI_ACPI_6_ 3_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*119 Attributes;121 EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES * 122 Attributes; 120 123 121 124 Attributes = 122 (EFI_ACPI_6_ 3_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES*)Ptr;125 (EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES *)Ptr; 123 126 124 127 Print (L"\n"); … … 138 141 An ACPI_PARSER array describing the ACPI HMAT Table. 139 142 */ 140 STATIC CONST ACPI_PARSER HmatParser[] = {143 STATIC CONST ACPI_PARSER HmatParser[] = { 141 144 PARSE_ACPI_HEADER (&AcpiHdrInfo), 142 { L"Reserved", 4, 36, NULL, NULL, NULL, NULL, NULL}145 { L"Reserved", 4,36, NULL, NULL, NULL, NULL, NULL } 143 146 }; 144 147 … … 146 149 An ACPI_PARSER array describing the HMAT structure header. 147 150 */ 148 STATIC CONST ACPI_PARSER HmatStructureHeaderParser[] = {149 { L"Type", 2, 0, NULL, NULL, (VOID**)&HmatStructureType, NULL, NULL},150 { L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL},151 { L"Length", 4, 4, NULL, NULL, (VOID**)&HmatStructureLength, NULL, NULL}151 STATIC CONST ACPI_PARSER HmatStructureHeaderParser[] = { 152 { L"Type", 2, 0, NULL, NULL, (VOID **)&HmatStructureType, NULL, NULL }, 153 { L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL }, 154 { L"Length", 4, 4, NULL, NULL, (VOID **)&HmatStructureLength, NULL, NULL } 152 155 }; 153 156 … … 156 159 Structure - Type 0. 157 160 */ 158 STATIC CONST ACPI_PARSER MemProximityDomainAttributeParser[] = {159 { L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},160 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},161 { L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL},162 { L"Flags", 2, 8, L"0x%x", NULL, NULL, NULL, NULL},163 { L"Reserved", 2, 10, L"0x%x", NULL, NULL, NULL, NULL},164 { L"Proximity Dom for initiator", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},165 { L"Proximity Dom for memory", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},166 { L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},167 { L"Reserved", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},168 { L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}161 STATIC CONST ACPI_PARSER MemProximityDomainAttributeParser[] = { 162 { L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL }, 163 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL }, 164 { L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL }, 165 { L"Flags", 2, 8, L"0x%x", NULL, NULL, NULL, NULL }, 166 { L"Reserved", 2, 10, L"0x%x", NULL, NULL, NULL, NULL }, 167 { L"Proximity Dom for initiator", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }, 168 { L"Proximity Dom for memory", 4, 16, L"0x%x", NULL, NULL, NULL, NULL }, 169 { L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL }, 170 { L"Reserved", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL }, 171 { L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL } 169 172 }; 170 173 … … 173 176 Information Structure - Type 1. 174 177 */ 175 STATIC CONST ACPI_PARSER SllbiParser[] = { 176 {L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL}, 177 {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, 178 {L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL}, 179 {L"Flags", 1, 8, L"0x%x", NULL, (VOID**)&SllbiFlags, NULL, NULL}, 180 {L"Data type", 1, 9, L"0x%x", NULL, (VOID**)&SllbiDataType, NULL, NULL}, 181 {L"Reserved", 2, 10, L"0x%x", NULL, NULL, NULL, NULL}, 182 {L"Initiator Proximity Dom Count", 4, 12, L"%d", NULL, 183 (VOID**)&NumberInitiatorProximityDomain, NULL, NULL}, 184 {L"Target Proximity Dom Count", 4, 16, L"%d", NULL, 185 (VOID**)&NumberTargetProximityDomain, NULL, NULL}, 186 {L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL}, 187 {L"Entry Base Unit", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL} 178 STATIC CONST ACPI_PARSER SllbiParser[] = { 179 { L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL }, 180 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL }, 181 { L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL }, 182 { L"Flags", 1, 8, L"0x%x", NULL, (VOID **)&SllbiFlags, NULL, NULL }, 183 { L"Data type", 1, 9, L"0x%x", NULL, (VOID **)&SllbiDataType, NULL, NULL }, 184 { L"Min Transfer Size", 1, 10, L"%d", NULL, NULL, NULL, NULL }, 185 { L"Reserved", 1, 11, L"0x%x", NULL, NULL, NULL, NULL }, 186 { L"Initiator Proximity Dom Count", 4, 12, L"%d", NULL, 187 (VOID **)&NumberInitiatorProximityDomain, NULL, NULL }, 188 { L"Target Proximity Dom Count", 4, 16, L"%d", NULL, 189 (VOID **)&NumberTargetProximityDomain, NULL, NULL }, 190 { L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL }, 191 { L"Entry Base Unit", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL } 188 192 // initiator Proximity Domain list ... 189 193 // target Proximity Domain list ... … … 195 199 Structure - Type 2. 196 200 */ 197 STATIC CONST ACPI_PARSER MemSideCacheInfoParser[] = {198 { L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},199 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},200 { L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL},201 { L"Proximity Dom for memory", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},202 { L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},203 { L"Memory Side Cache Size", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL},204 { L"Cache Attributes", 4, 24, NULL,DumpCacheAttributes, NULL,205 ValidateCacheAttributes, NULL },206 { L"Reserved", 2, 28, L"0x%x", NULL, NULL, NULL, NULL},207 { L"SMBIOS Handle Count", 2, 30, L"%d",NULL,208 (VOID **)&NumberSMBIOSHandles, NULL, NULL}201 STATIC CONST ACPI_PARSER MemSideCacheInfoParser[] = { 202 { L"Type", 2, 0, L"0x%x", NULL, NULL, NULL, NULL }, 203 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL }, 204 { L"Length", 4, 4, L"%d", NULL, NULL, NULL, NULL }, 205 { L"Proximity Dom for memory", 4, 8, L"0x%x", NULL, NULL, NULL, NULL }, 206 { L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }, 207 { L"Memory Side Cache Size", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL }, 208 { L"Cache Attributes", 4, 24, NULL, DumpCacheAttributes, NULL, 209 ValidateCacheAttributes, NULL }, 210 { L"Reserved", 2, 28, L"0x%x", NULL, NULL, NULL, NULL }, 211 { L"SMBIOS Handle Count", 2, 30, L"%d", NULL, 212 (VOID **)&NumberSMBIOSHandles, NULL, NULL } 209 213 // SMBIOS handles List ... 210 214 }; … … 222 226 VOID 223 227 DumpMpda ( 224 IN UINT8 *Ptr,225 IN UINT32 Length228 IN UINT8 *Ptr, 229 IN UINT32 Length 226 230 ) 227 231 { … … 248 252 VOID 249 253 DumpSllbi ( 250 IN UINT8 *Ptr,251 IN UINT32 Length254 IN UINT8 *Ptr, 255 IN UINT32 Length 252 256 ) 253 257 { 254 CONST UINT32 *InitiatorProximityDomainList;255 CONST UINT32 *TargetProximityDomainList;256 CONST UINT16 *LatencyBandwidthMatrix;258 CONST UINT32 *InitiatorProximityDomainList; 259 CONST UINT32 *TargetProximityDomainList; 260 CONST UINT16 *LatencyBandwidthMatrix; 257 261 UINT32 Offset; 258 262 CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH]; … … 278 282 (SllbiDataType == NULL) || 279 283 (NumberInitiatorProximityDomain == NULL) || 280 (NumberTargetProximityDomain == NULL)) { 284 (NumberTargetProximityDomain == NULL)) 285 { 281 286 IncrementErrorCount (); 282 287 Print ( 283 288 L"ERROR: Insufficient remaining table buffer length to read the " \ 284 289 L"SLLBI structure header. Length = %d.\n", 285 290 Length 286 291 ); … … 306 311 } 307 312 308 InitiatorProximityDomainList = (UINT32 *)(Ptr + Offset);309 TargetProximityDomainList = InitiatorProximityDomainList +310 *NumberInitiatorProximityDomain;311 LatencyBandwidthMatrix = (UINT16 *)(TargetProximityDomainList +313 InitiatorProximityDomainList = (UINT32 *)(Ptr + Offset); 314 TargetProximityDomainList = InitiatorProximityDomainList + 315 *NumberInitiatorProximityDomain; 316 LatencyBandwidthMatrix = (UINT16 *)(TargetProximityDomainList + 312 317 *NumberTargetProximityDomain); 313 318 … … 350 355 return; 351 356 } 357 352 358 StrCpyS (Buffer, sizeof (Buffer), SllbiNames[*SllbiDataType]); 353 359 … … 381 387 ); 382 388 return; 383 384 389 } // switch 385 390 … … 400 405 for (IndexTarget = 0; 401 406 IndexTarget < *NumberTargetProximityDomain; 402 IndexTarget++) { 407 IndexTarget++) 408 { 403 409 Print (L" %2d", IndexTarget); 404 410 } … … 407 413 for (IndexTarget = 0; 408 414 IndexTarget < *NumberTargetProximityDomain; 409 IndexTarget++) { 415 IndexTarget++) 416 { 410 417 Print (L"------"); 411 418 } 419 412 420 Print (L"\n"); 413 421 … … 415 423 for (IndexInitiator = 0; 416 424 IndexInitiator < *NumberInitiatorProximityDomain; 417 IndexInitiator++) { 425 IndexInitiator++) 426 { 418 427 Print (L" %2d |", IndexInitiator); 419 428 for (IndexTarget = 0; 420 429 IndexTarget < *NumberTargetProximityDomain; 421 IndexTarget++) { 430 IndexTarget++) 431 { 422 432 Print ( 423 433 L" %5d", … … 425 435 ); 426 436 } // for Target 437 427 438 Print (L"\n"); 428 439 TargetStartOffset += (*NumberTargetProximityDomain); 429 440 } // for Initiator 441 430 442 Print (L"\n"); 431 443 } else { … … 441 453 for (IndexInitiator = 0; 442 454 IndexInitiator < *NumberInitiatorProximityDomain; 443 IndexInitiator++) { 455 IndexInitiator++) 456 { 444 457 for (IndexTarget = 0; 445 458 IndexTarget < *NumberTargetProximityDomain; 446 IndexTarget++) { 459 IndexTarget++) 460 { 447 461 UnicodeSPrint ( 448 462 SecondBuffer, … … 459 473 ); 460 474 } // for Target 475 461 476 TargetStartOffset += (*NumberTargetProximityDomain); 462 477 } // for Initiator … … 474 489 VOID 475 490 DumpMsci ( 476 IN UINT8 *Ptr,477 IN UINT32 Length491 IN UINT8 *Ptr, 492 IN UINT32 Length 478 493 ) 479 494 { 480 CONST UINT16 *SMBIOSHandlesList;495 CONST UINT16 *SMBIOSHandlesList; 481 496 CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH]; 482 497 UINT32 Offset; … … 498 513 Print ( 499 514 L"ERROR: Insufficient remaining table buffer length to read the " \ 500 515 L"MSCI structure header. Length = %d.\n", 501 516 Length 502 517 ); … … 515 530 } 516 531 517 SMBIOSHandlesList = (UINT16 *)(Ptr + Offset);532 SMBIOSHandlesList = (UINT16 *)(Ptr + Offset); 518 533 519 534 for (Index = 0; Index < *NumberSMBIOSHandles; Index++) { … … 553 568 EFIAPI 554 569 ParseAcpiHmat ( 555 IN BOOLEAN Trace,556 IN UINT8 *Ptr,557 IN UINT32 AcpiTableLength,558 IN UINT8 AcpiTableRevision570 IN BOOLEAN Trace, 571 IN UINT8 *Ptr, 572 IN UINT32 AcpiTableLength, 573 IN UINT8 AcpiTableRevision 559 574 ) 560 575 { 561 UINT32 Offset;562 UINT8 *HmatStructurePtr;576 UINT32 Offset; 577 UINT8 *HmatStructurePtr; 563 578 564 579 if (!Trace) { … … 591 606 // successfully read. 592 607 if ((HmatStructureType == NULL) || 593 (HmatStructureLength == NULL)) { 608 (HmatStructureLength == NULL)) 609 { 594 610 IncrementErrorCount (); 595 611 Print ( 596 612 L"ERROR: Insufficient remaining table buffer length to read the " \ 597 613 L"HMAT structure header. Length = %d.\n", 598 614 AcpiTableLength - Offset 599 615 ); … … 603 619 // Validate HMAT Structure length. 604 620 if ((*HmatStructureLength == 0) || 605 ((Offset + (*HmatStructureLength)) > AcpiTableLength)) { 621 ((Offset + (*HmatStructureLength)) > AcpiTableLength)) 622 { 606 623 IncrementErrorCount (); 607 624 Print ( 608 625 L"ERROR: Invalid HMAT Structure length. " \ 609 626 L"Length = %d. Offset = %d. AcpiTableLength = %d.\n", 610 627 *HmatStructureLength, 611 628 Offset, … … 616 633 617 634 switch (*HmatStructureType) { 618 case EFI_ACPI_6_ 3_HMAT_TYPE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES:635 case EFI_ACPI_6_4_HMAT_TYPE_MEMORY_PROXIMITY_DOMAIN_ATTRIBUTES: 619 636 DumpMpda ( 620 637 HmatStructurePtr, … … 622 639 ); 623 640 break; 624 case EFI_ACPI_6_ 3_HMAT_TYPE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO:641 case EFI_ACPI_6_4_HMAT_TYPE_SYSTEM_LOCALITY_LATENCY_AND_BANDWIDTH_INFO: 625 642 DumpSllbi ( 626 643 HmatStructurePtr, … … 628 645 ); 629 646 break; 630 case EFI_ACPI_6_ 3_HMAT_TYPE_MEMORY_SIDE_CACHE_INFO:631 647 case EFI_ACPI_6_4_HMAT_TYPE_MEMORY_SIDE_CACHE_INFO: 648 DumpMsci ( 632 649 HmatStructurePtr, 633 650 *HmatStructureLength … … 638 655 Print ( 639 656 L"ERROR: Unknown HMAT structure:" 640 657 L" Type = %d, Length = %d\n", 641 658 *HmatStructureType, 642 659 *HmatStructureLength … … 646 663 647 664 HmatStructurePtr += *HmatStructureLength; 648 Offset += *HmatStructureLength;665 Offset += *HmatStructureLength; 649 666 } // while 650 667 } -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
r89983 r99404 2 2 IORT table parser 3 3 4 Copyright (c) 2016 - 202 0, ARMLimited. All rights reserved.4 Copyright (c) 2016 - 2022, Arm Limited. All rights reserved. 5 5 SPDX-License-Identifier: BSD-2-Clause-Patent 6 6 7 7 @par Reference(s): 8 - IO Remapping Table, Platform Design Document, Revision D, March 2018 8 - IO Remapping Table, Platform Design Document, Revision E.d, Feb 2022 9 (https://developer.arm.com/documentation/den0049/) 10 11 @par Glossary: 12 - Ref - Reference 13 - Desc - Descriptor 9 14 **/ 10 15 … … 17 22 18 23 // Local variables 19 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 20 21 STATIC CONST UINT32* IortNodeCount; 22 STATIC CONST UINT32* IortNodeOffset; 23 24 STATIC CONST UINT8* IortNodeType; 25 STATIC CONST UINT16* IortNodeLength; 26 STATIC CONST UINT32* IortIdMappingCount; 27 STATIC CONST UINT32* IortIdMappingOffset; 28 29 STATIC CONST UINT32* InterruptContextCount; 30 STATIC CONST UINT32* InterruptContextOffset; 31 STATIC CONST UINT32* PmuInterruptCount; 32 STATIC CONST UINT32* PmuInterruptOffset; 33 34 STATIC CONST UINT32* ItsCount; 24 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 25 26 STATIC CONST UINT32 *IortNodeCount; 27 STATIC CONST UINT32 *IortNodeOffset; 28 29 STATIC CONST UINT8 *IortNodeType; 30 STATIC CONST UINT16 *IortNodeLength; 31 STATIC CONST UINT8 *IortNodeRevision; 32 STATIC CONST UINT32 *IortIdMappingCount; 33 STATIC CONST UINT32 *IortIdMappingOffset; 34 35 STATIC CONST UINT32 *InterruptContextCount; 36 STATIC CONST UINT32 *InterruptContextOffset; 37 STATIC CONST UINT32 *PmuInterruptCount; 38 STATIC CONST UINT32 *PmuInterruptOffset; 39 40 STATIC CONST UINT32 *ItsCount; 41 42 STATIC CONST UINT32 *RmrMemDescCount; 43 STATIC CONST UINT32 *RmrMemDescOffset; 35 44 36 45 /** … … 45 54 EFIAPI 46 55 ValidateItsIdMappingCount ( 47 IN UINT8 *Ptr,48 IN VOID *Context49 ) 50 { 51 if (*(UINT32 *)Ptr != 0) {56 IN UINT8 *Ptr, 57 IN VOID *Context 58 ) 59 { 60 if (*(UINT32 *)Ptr != 0) { 52 61 IncrementErrorCount (); 53 62 Print (L"\nERROR: IORT ID Mapping count must be zero."); … … 67 76 EFIAPI 68 77 ValidatePmcgIdMappingCount ( 69 IN UINT8 *Ptr,70 IN VOID *Context71 ) 72 { 73 if (*(UINT32 *)Ptr > 1) {78 IN UINT8 *Ptr, 79 IN VOID *Context 80 ) 81 { 82 if (*(UINT32 *)Ptr > 1) { 74 83 IncrementErrorCount (); 75 84 Print (L"\nERROR: IORT ID Mapping count must not be greater than 1."); … … 88 97 EFIAPI 89 98 ValidateItsIdArrayReference ( 90 IN UINT8 *Ptr,91 IN VOID *Context92 ) 93 { 94 if (*(UINT32 *)Ptr != 0) {99 IN UINT8 *Ptr, 100 IN VOID *Context 101 ) 102 { 103 if (*(UINT32 *)Ptr != 0) { 95 104 IncrementErrorCount (); 96 105 Print (L"\nERROR: IORT ID Mapping offset must be zero."); 106 } 107 } 108 109 /** 110 This function validates that the Physical Range address or length is not zero 111 and is 64K aligned. 112 113 @param [in] Ptr Pointer to the start of the field data. 114 @param [in] Context Pointer to context specific information e.g. this 115 could be a pointer to the ACPI table header. 116 **/ 117 STATIC 118 VOID 119 EFIAPI 120 ValidatePhysicalRange ( 121 IN UINT8 *Ptr, 122 IN VOID *Context 123 ) 124 { 125 UINT64 Value; 126 127 Value = *(UINT64 *)Ptr; 128 if ((Value == 0) || ((Value & (SIZE_64KB - 1)) != 0)) { 129 IncrementErrorCount (); 130 Print (L"\nERROR: Physical Range must be 64K aligned and cannot be zero."); 131 } 132 } 133 134 /** 135 This function validates that the RMR memory range descriptor count. 136 137 @param [in] Ptr Pointer to the start of the field data. 138 @param [in] Context Pointer to context specific information e.g. this 139 could be a pointer to the ACPI table header. 140 **/ 141 STATIC 142 VOID 143 EFIAPI 144 ValidateRmrMemDescCount ( 145 IN UINT8 *Ptr, 146 IN VOID *Context 147 ) 148 { 149 if (*(UINT32 *)Ptr == 0) { 150 IncrementErrorCount (); 151 Print (L"\nERROR: Memory Range Descriptor count must be >=1."); 97 152 } 98 153 } … … 106 161 validating the ID Array reference. 107 162 **/ 108 #define PARSE_IORT_NODE_HEADER(ValidateIdMappingCount, \109 ValidateIdArrayReference) \110 { L"Type", 1, 0, L"%d", NULL, (VOID**)&IortNodeType, NULL, NULL }, \111 { L"Length", 2, 1, L"%d", NULL, (VOID**)&IortNodeLength, NULL, NULL }, \112 { L"Revision", 1, 3, L"%d", NULL, NULL, NULL, NULL },\113 { L" Reserved", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },\114 { L"Number of ID mappings", 4, 8, L"%d", NULL, \115 (VOID**)&IortIdMappingCount, ValidateIdMappingCount, NULL }, \116 { L"Reference to ID Array", 4, 12, L"0x%x", NULL, \163 #define PARSE_IORT_NODE_HEADER(ValidateIdMappingCount, \ 164 ValidateIdArrayReference) \ 165 { L"Type", 1, 0, L"%d", NULL, (VOID**)&IortNodeType, NULL, NULL }, \ 166 { L"Length", 2, 1, L"%d", NULL, (VOID**)&IortNodeLength, NULL, NULL }, \ 167 { L"Revision", 1, 3, L"%d", NULL, (VOID**)&IortNodeRevision, NULL, NULL }, \ 168 { L"Identifier", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, \ 169 { L"Number of ID mappings", 4, 8, L"%d", NULL, \ 170 (VOID**)&IortIdMappingCount, ValidateIdMappingCount, NULL }, \ 171 { L"Reference to ID Array", 4, 12, L"0x%x", NULL, \ 117 172 (VOID**)&IortIdMappingOffset, ValidateIdArrayReference, NULL } 118 173 … … 120 175 An ACPI_PARSER array describing the ACPI IORT Table 121 176 **/ 122 STATIC CONST ACPI_PARSER IortParser[] = {177 STATIC CONST ACPI_PARSER IortParser[] = { 123 178 PARSE_ACPI_HEADER (&AcpiHdrInfo), 124 { L"Number of IORT Nodes", 4, 36, L"%d",NULL,125 (VOID**)&IortNodeCount, NULL, NULL},126 { L"Offset to Array of IORT Nodes", 4,40, L"0x%x", NULL,127 (VOID**)&IortNodeOffset, NULL, NULL},128 { L"Reserved", 4, 44, L"0x%x", NULL, NULL, NULL, NULL}179 { L"Number of IORT Nodes", 4, 36, L"%d", NULL, 180 (VOID **)&IortNodeCount, NULL, NULL }, 181 { L"Offset to Array of IORT Nodes",4, 40, L"0x%x", NULL, 182 (VOID **)&IortNodeOffset, NULL, NULL }, 183 { L"Reserved", 4, 44, L"0x%x", NULL,NULL,NULL, NULL } 129 184 }; 130 185 … … 132 187 An ACPI_PARSER array describing the IORT node header structure. 133 188 **/ 134 STATIC CONST ACPI_PARSER IortNodeHeaderParser[] = {189 STATIC CONST ACPI_PARSER IortNodeHeaderParser[] = { 135 190 PARSE_IORT_NODE_HEADER (NULL, NULL) 136 191 }; … … 139 194 An ACPI_PARSER array describing the IORT SMMUv1/2 node. 140 195 **/ 141 STATIC CONST ACPI_PARSER IortNodeSmmuV1V2Parser[] = { 196 STATIC CONST ACPI_PARSER IortNodeSmmuV1V2Parser[] = { 197 PARSE_IORT_NODE_HEADER (NULL, NULL), 198 { L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL }, 199 { L"Span", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL }, 200 { L"Model", 4, 32, L"%d", NULL, NULL, NULL, NULL }, 201 { L"Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL }, 202 { L"Global Interrupt Array Ref", 4, 40, L"0x%x", NULL, NULL, NULL, 203 NULL }, 204 { L"Number of context interrupts", 4, 44, L"%d", NULL, 205 (VOID **)&InterruptContextCount, NULL, NULL }, 206 { L"Context Interrupt Array Ref", 4, 48, L"0x%x", NULL, 207 (VOID **)&InterruptContextOffset, NULL, NULL }, 208 { L"Number of PMU Interrupts", 4, 52, L"%d", NULL, 209 (VOID **)&PmuInterruptCount, NULL, NULL }, 210 { L"PMU Interrupt Array Ref", 4, 56, L"0x%x", NULL, 211 (VOID **)&PmuInterruptOffset, NULL, NULL }, 212 213 // Interrupt Array 214 { L"SMMU_NSgIrpt", 4, 60, L"0x%x", NULL, NULL, NULL, NULL }, 215 { L"SMMU_NSgIrpt interrupt flags", 4, 64, L"0x%x", NULL, NULL, NULL, NULL }, 216 { L"SMMU_NSgCfgIrpt", 4, 68, L"0x%x", NULL, NULL, NULL, NULL }, 217 { L"SMMU_NSgCfgIrpt interrupt flags",4, 72, L"0x%x", NULL, NULL, NULL, NULL } 218 }; 219 220 /** 221 An ACPI_PARSER array describing the SMMUv1/2 Node Interrupt Array. 222 **/ 223 STATIC CONST ACPI_PARSER InterruptArrayParser[] = { 224 { L"Interrupt GSIV", 4, 0, L"0x%x", NULL, NULL, NULL, NULL }, 225 { L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL } 226 }; 227 228 /** 229 An ACPI_PARSER array describing the IORT ID Mapping. 230 **/ 231 STATIC CONST ACPI_PARSER IortNodeIdMappingParser[] = { 232 { L"Input base", 4, 0, L"0x%x", NULL, NULL, NULL, NULL }, 233 { L"Number of IDs", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 234 { L"Output base", 4, 8, L"0x%x", NULL, NULL, NULL, NULL }, 235 { L"Output reference", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }, 236 { L"Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL } 237 }; 238 239 /** 240 An ACPI_PARSER array describing the IORT SMMUv3 node. 241 **/ 242 STATIC CONST ACPI_PARSER IortNodeSmmuV3Parser[] = { 142 243 PARSE_IORT_NODE_HEADER (NULL, NULL), 143 {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, 144 {L"Span", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL}, 145 {L"Model", 4, 32, L"%d", NULL, NULL, NULL, NULL}, 146 {L"Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL}, 147 {L"Reference to Global Interrupt Array", 4, 40, L"0x%x", NULL, NULL, NULL, 148 NULL}, 149 {L"Number of context interrupts", 4, 44, L"%d", NULL, 150 (VOID**)&InterruptContextCount, NULL, NULL}, 151 {L"Reference to Context Interrupt Array", 4, 48, L"0x%x", NULL, 152 (VOID**)&InterruptContextOffset, NULL, NULL}, 153 {L"Number of PMU Interrupts", 4, 52, L"%d", NULL, 154 (VOID**)&PmuInterruptCount, NULL, NULL}, 155 {L"Reference to PMU Interrupt Array", 4, 56, L"0x%x", NULL, 156 (VOID**)&PmuInterruptOffset, NULL, NULL}, 157 158 // Interrupt Array 159 {L"SMMU_NSgIrpt", 4, 60, L"0x%x", NULL, NULL, NULL, NULL}, 160 {L"SMMU_NSgIrpt interrupt flags", 4, 64, L"0x%x", NULL, NULL, NULL, NULL}, 161 {L"SMMU_NSgCfgIrpt", 4, 68, L"0x%x", NULL, NULL, NULL, NULL}, 162 {L"SMMU_NSgCfgIrpt interrupt flags", 4, 72, L"0x%x", NULL, NULL, NULL, NULL} 163 }; 164 165 /** 166 An ACPI_PARSER array describing the SMMUv1/2 Node Interrupt Array. 167 **/ 168 STATIC CONST ACPI_PARSER InterruptArrayParser[] = { 169 {L"Interrupt GSIV", 4, 0, L"0x%x", NULL, NULL, NULL, NULL}, 170 {L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL} 171 }; 172 173 /** 174 An ACPI_PARSER array describing the IORT ID Mapping. 175 **/ 176 STATIC CONST ACPI_PARSER IortNodeIdMappingParser[] = { 177 {L"Input base", 4, 0, L"0x%x", NULL, NULL, NULL, NULL}, 178 {L"Number of IDs", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, 179 {L"Output base", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, 180 {L"Output reference", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}, 181 {L"Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL} 182 }; 183 184 /** 185 An ACPI_PARSER array describing the IORT SMMUv3 node. 186 **/ 187 STATIC CONST ACPI_PARSER IortNodeSmmuV3Parser[] = { 188 PARSE_IORT_NODE_HEADER (NULL, NULL), 189 {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, 190 {L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, 191 {L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, 192 {L"VATOS Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}, 193 {L"Model", 4, 40, L"%d", NULL, NULL, NULL, NULL}, 194 {L"Event", 4, 44, L"0x%x", NULL, NULL, NULL, NULL}, 195 {L"PRI", 4, 48, L"0x%x", NULL, NULL, NULL, NULL}, 196 {L"GERR", 4, 52, L"0x%x", NULL, NULL, NULL, NULL}, 197 {L"Sync", 4, 56, L"0x%x", NULL, NULL, NULL, NULL}, 198 {L"Proximity domain", 4, 60, L"0x%x", NULL, NULL, NULL, NULL}, 199 {L"Device ID mapping index", 4, 64, L"%d", NULL, NULL, NULL, NULL} 244 { L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL }, 245 { L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL }, 246 { L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL }, 247 { L"VATOS Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL }, 248 { L"Model", 4, 40, L"%d", NULL, NULL, NULL, NULL }, 249 { L"Event", 4, 44, L"0x%x", NULL, NULL, NULL, NULL }, 250 { L"PRI", 4, 48, L"0x%x", NULL, NULL, NULL, NULL }, 251 { L"GERR", 4, 52, L"0x%x", NULL, NULL, NULL, NULL }, 252 { L"Sync", 4, 56, L"0x%x", NULL, NULL, NULL, NULL }, 253 { L"Proximity domain", 4, 60, L"0x%x", NULL, NULL, NULL, NULL }, 254 { L"Device ID mapping index", 4, 64, L"%d", NULL, NULL, NULL, NULL } 200 255 }; 201 256 … … 203 258 An ACPI_PARSER array describing the IORT ITS node. 204 259 **/ 205 STATIC CONST ACPI_PARSER IortNodeItsParser[] = {260 STATIC CONST ACPI_PARSER IortNodeItsParser[] = { 206 261 PARSE_IORT_NODE_HEADER ( 207 262 ValidateItsIdMappingCount, 208 263 ValidateItsIdArrayReference 209 264 ), 210 { L"Number of ITSs", 4, 16, L"%d", NULL, (VOID**)&ItsCount, NULL}265 { L"Number of ITSs", 4,16, L"%d", NULL, (VOID **)&ItsCount, NULL } 211 266 }; 212 267 … … 214 269 An ACPI_PARSER array describing the ITS ID. 215 270 **/ 216 STATIC CONST ACPI_PARSER ItsIdParser[] = {271 STATIC CONST ACPI_PARSER ItsIdParser[] = { 217 272 { L"GIC ITS Identifier", 4, 0, L"%d", NULL, NULL, NULL } 218 273 }; … … 221 276 An ACPI_PARSER array describing the IORT Names Component node. 222 277 **/ 223 STATIC CONST ACPI_PARSER IortNodeNamedComponentParser[] = {278 STATIC CONST ACPI_PARSER IortNodeNamedComponentParser[] = { 224 279 PARSE_IORT_NODE_HEADER (NULL, NULL), 225 { L"Node Flags", 4, 16, L"%d", NULL, NULL, NULL, NULL},226 { L"Memory access properties", 8, 20, L"0x%lx", NULL, NULL, NULL, NULL},227 { L"Device memory address size limit", 1, 28, L"%d", NULL, NULL, NULL, NULL}280 { L"Node Flags", 4, 16, L"%d", NULL, NULL, NULL, NULL }, 281 { L"Memory access properties",8, 20, L"0x%lx", NULL, NULL, NULL, NULL }, 282 { L"Device memory address size limit",1, 28, L"%d", NULL, NULL, NULL, NULL } 228 283 }; 229 284 … … 231 286 An ACPI_PARSER array describing the IORT Root Complex node. 232 287 **/ 233 STATIC CONST ACPI_PARSER IortNodeRootComplexParser[] = {288 STATIC CONST ACPI_PARSER IortNodeRootComplexParser[] = { 234 289 PARSE_IORT_NODE_HEADER (NULL, NULL), 235 {L"Memory access properties", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, 236 {L"ATS Attribute", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, 237 {L"PCI Segment number", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, 238 {L"Memory access size limit", 1, 32, L"0x%x", NULL, NULL, NULL, NULL}, 239 {L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL} 290 { L"Memory access properties",8, 16, L"0x%lx", NULL, NULL, NULL, NULL }, 291 { L"ATS Attribute", 4, 24, L"0x%x", NULL, NULL, NULL, NULL }, 292 { L"PCI Segment number", 4, 28, L"0x%x", NULL, NULL, NULL, NULL }, 293 { L"Memory access size limit",1, 32, L"0x%x", NULL, NULL, NULL, NULL }, 294 { L"PASID capabilities", 2, 33, L"0x%x", NULL, NULL, NULL, NULL }, 295 { L"Reserved", 1, 35, L"%x", NULL, NULL, NULL, NULL }, 296 { L"Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL }, 240 297 }; 241 298 … … 243 300 An ACPI_PARSER array describing the IORT PMCG node. 244 301 **/ 245 STATIC CONST ACPI_PARSER IortNodePmcgParser[] = {302 STATIC CONST ACPI_PARSER IortNodePmcgParser[] = { 246 303 PARSE_IORT_NODE_HEADER (ValidatePmcgIdMappingCount, NULL), 247 {L"Page 0 Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, 248 {L"Overflow interrupt GSIV", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, 249 {L"Node reference", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, 250 {L"Page 1 Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL} 304 { L"Page 0 Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL }, 305 { L"Overflow interrupt GSIV", 4, 24, L"0x%x", NULL, NULL, NULL, NULL }, 306 { L"Node reference", 4, 28, L"0x%x", NULL, NULL, NULL, NULL }, 307 { L"Page 1 Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL } 308 }; 309 310 /** 311 An ACPI_PARSER array describing the IORT RMR node. 312 **/ 313 STATIC CONST ACPI_PARSER IortNodeRmrParser[] = { 314 PARSE_IORT_NODE_HEADER (NULL, NULL), 315 { L"Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL }, 316 { L"Memory Range Desc count", 4, 20, L"%d", NULL, 317 (VOID **)&RmrMemDescCount, ValidateRmrMemDescCount,NULL }, 318 { L"Memory Range Desc Ref", 4, 24, L"0x%x", NULL, 319 (VOID **)&RmrMemDescOffset, NULL, NULL } 320 }; 321 322 /** 323 An ACPI_PARSER array describing the IORT RMR Memory Range Descriptor. 324 **/ 325 STATIC CONST ACPI_PARSER IortNodeRmrMemRangeDescParser[] = { 326 { L"Physical Range offset", 8, 0, L"0x%lx", NULL, NULL, ValidatePhysicalRange, 327 NULL }, 328 { L"Physical Range length", 8, 8, L"0x%lx", NULL, NULL, ValidatePhysicalRange, 329 NULL }, 330 { L"Reserved", 4, 16, L"0x%x", NULL, NULL, NULL, NULL} 251 331 }; 252 332 … … 261 341 VOID 262 342 DumpIortNodeIdMappings ( 263 IN UINT8 *Ptr,264 IN UINT32 Length,265 IN UINT32 MappingCount266 ) 267 { 268 UINT32 Index;269 UINT32 Offset;270 CHAR8 Buffer[40];// Used for AsciiName param of ParseAcpi271 272 Index = 0;343 IN UINT8 *Ptr, 344 IN UINT32 Length, 345 IN UINT32 MappingCount 346 ) 347 { 348 UINT32 Index; 349 UINT32 Offset; 350 CHAR8 Buffer[40]; // Used for AsciiName param of ParseAcpi 351 352 Index = 0; 273 353 Offset = 0; 274 354 275 355 while ((Index < MappingCount) && 276 (Offset < Length)) { 356 (Offset < Length)) 357 { 277 358 AsciiSPrint ( 278 359 Buffer, … … 305 386 VOID 306 387 DumpIortNodeSmmuV1V2 ( 307 IN UINT8 *Ptr,308 IN UINT16 Length,309 IN UINT32 MappingCount,310 IN UINT32 MappingOffset311 ) 312 { 313 UINT32 Index;314 UINT32 Offset;315 CHAR8 Buffer[50];// Used for AsciiName param of ParseAcpi388 IN UINT8 *Ptr, 389 IN UINT16 Length, 390 IN UINT32 MappingCount, 391 IN UINT32 MappingOffset 392 ) 393 { 394 UINT32 Index; 395 UINT32 Offset; 396 CHAR8 Buffer[50]; // Used for AsciiName param of ParseAcpi 316 397 317 398 ParseAcpi ( … … 329 410 (InterruptContextOffset == NULL) || 330 411 (PmuInterruptCount == NULL) || 331 (PmuInterruptOffset == NULL)) { 412 (PmuInterruptOffset == NULL)) 413 { 332 414 IncrementErrorCount (); 333 415 Print ( … … 339 421 340 422 Offset = *InterruptContextOffset; 341 Index = 0;423 Index = 0; 342 424 343 425 while ((Index < *InterruptContextCount) && 344 (Offset < Length)) { 426 (Offset < Length)) 427 { 345 428 AsciiSPrint ( 346 429 Buffer, … … 361 444 362 445 Offset = *PmuInterruptOffset; 363 Index = 0;446 Index = 0; 364 447 365 448 while ((Index < *PmuInterruptCount) && 366 (Offset < Length)) { 449 (Offset < Length)) 450 { 367 451 AsciiSPrint ( 368 452 Buffer, … … 401 485 VOID 402 486 DumpIortNodeSmmuV3 ( 403 IN UINT8 *Ptr,404 IN UINT16 Length,405 IN UINT32 MappingCount,406 IN UINT32 MappingOffset487 IN UINT8 *Ptr, 488 IN UINT16 Length, 489 IN UINT32 MappingCount, 490 IN UINT32 MappingOffset 407 491 ) 408 492 { … … 432 516 VOID 433 517 DumpIortNodeIts ( 434 IN UINT8 *Ptr,435 IN UINT16 Length436 ) 437 { 438 UINT32 Offset;439 UINT32 Index;440 CHAR8 Buffer[80];// Used for AsciiName param of ParseAcpi518 IN UINT8 *Ptr, 519 IN UINT16 Length 520 ) 521 { 522 UINT32 Offset; 523 UINT32 Index; 524 CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi 441 525 442 526 Offset = ParseAcpi ( 443 TRUE,444 2,445 "ITS Node",446 Ptr,447 Length,448 PARSER_PARAMS (IortNodeItsParser)449 );527 TRUE, 528 2, 529 "ITS Node", 530 Ptr, 531 Length, 532 PARSER_PARAMS (IortNodeItsParser) 533 ); 450 534 451 535 // Check if the values used to control the parsing logic have been … … 463 547 464 548 while ((Index < *ItsCount) && 465 (Offset < Length)) { 549 (Offset < Length)) 550 { 466 551 AsciiSPrint ( 467 552 Buffer, … … 482 567 483 568 // Note: ITS does not have the ID Mappings Array 484 485 569 } 486 570 … … 497 581 VOID 498 582 DumpIortNodeNamedComponent ( 499 IN UINT8 *Ptr,500 IN UINT16 Length,501 IN UINT32 MappingCount,502 IN UINT32 MappingOffset503 ) 504 { 505 UINT32 Offset;583 IN UINT8 *Ptr, 584 IN UINT16 Length, 585 IN UINT32 MappingCount, 586 IN UINT32 MappingOffset 587 ) 588 { 589 UINT32 Offset; 506 590 507 591 Offset = ParseAcpi ( … … 518 602 519 603 while ((*(Ptr + Offset) != 0) && 520 (Offset < Length)) { 604 (Offset < Length)) 605 { 521 606 Print (L"%c", *(Ptr + Offset)); 522 607 Offset++; 523 608 } 609 524 610 Print (L"\n"); 525 611 … … 543 629 VOID 544 630 DumpIortNodeRootComplex ( 545 IN UINT8 *Ptr,546 IN UINT16 Length,547 IN UINT32 MappingCount,548 IN UINT32 MappingOffset631 IN UINT8 *Ptr, 632 IN UINT16 Length, 633 IN UINT32 MappingCount, 634 IN UINT32 MappingOffset 549 635 ) 550 636 { … … 577 663 VOID 578 664 DumpIortNodePmcg ( 579 IN UINT8 *Ptr,580 IN UINT16 Length,581 IN UINT32 MappingCount,582 IN UINT32 MappingOffset583 )665 IN UINT8 *Ptr, 666 IN UINT16 Length, 667 IN UINT32 MappingCount, 668 IN UINT32 MappingOffset 669 ) 584 670 { 585 671 ParseAcpi ( … … 600 686 601 687 /** 688 This function parses the IORT RMR Node Memory Range Descriptor array. 689 690 @param [in] Ptr Pointer to the start of the Memory Range Descriptor 691 array. 692 @param [in] Length Length of the buffer. 693 @param [in] DescCount Memory Range Descriptor count. 694 **/ 695 STATIC 696 VOID 697 DumpIortNodeRmrMemRangeDesc ( 698 IN UINT8 *Ptr, 699 IN UINT32 Length, 700 IN UINT32 DescCount 701 ) 702 { 703 UINT32 Index; 704 UINT32 Offset; 705 CHAR8 Buffer[40]; // Used for AsciiName param of ParseAcpi 706 707 Index = 0; 708 Offset = 0; 709 710 while ((Index < DescCount) && 711 (Offset < Length)) 712 { 713 AsciiSPrint ( 714 Buffer, 715 sizeof (Buffer), 716 "Mem range Descriptor [%d]", 717 Index 718 ); 719 Offset += ParseAcpi ( 720 TRUE, 721 4, 722 Buffer, 723 Ptr + Offset, 724 Length - Offset, 725 PARSER_PARAMS (IortNodeRmrMemRangeDescParser) 726 ); 727 Index++; 728 } 729 } 730 731 /** 732 This function parses the IORT RMR node. 733 734 @param [in] Ptr Pointer to the start of the buffer. 735 @param [in] Length Length of the buffer. 736 @param [in] MappingCount The ID Mapping count. 737 @param [in] MappingOffset The offset of the ID Mapping array 738 from the start of the IORT table. 739 **/ 740 STATIC 741 VOID 742 DumpIortNodeRmr ( 743 IN UINT8 *Ptr, 744 IN UINT16 Length, 745 IN UINT32 MappingCount, 746 IN UINT32 MappingOffset 747 ) 748 { 749 ParseAcpi ( 750 TRUE, 751 2, 752 "RMR Node", 753 Ptr, 754 Length, 755 PARSER_PARAMS (IortNodeRmrParser) 756 ); 757 758 if (*IortNodeRevision == EFI_ACPI_IORT_RMR_NODE_REVISION_02) { 759 IncrementErrorCount (); 760 Print ( 761 L"ERROR: RMR node Rev 2 (defined in IORT Rev E.c) must not be used." 762 L" IORT tabe Revision E.c is deprecated and must not be used.\n" 763 ); 764 } 765 766 DumpIortNodeIdMappings ( 767 Ptr + MappingOffset, 768 Length - MappingOffset, 769 MappingCount 770 ); 771 772 DumpIortNodeRmrMemRangeDesc ( 773 Ptr + (*RmrMemDescOffset), 774 Length - (*RmrMemDescOffset), 775 *RmrMemDescCount 776 ); 777 } 778 779 /** 602 780 This function parses the ACPI IORT table. 603 When trace is enabled this function parses the IORT table and traces the ACPI fields. 781 When trace is enabled this function parses the IORT table and traces the ACPI 782 fields. 604 783 605 784 This function also parses the following nodes: … … 610 789 - SMMUv3 611 790 - PMCG 791 - RMR 612 792 613 793 This function also performs validation of the ACPI table fields. … … 621 801 EFIAPI 622 802 ParseAcpiIort ( 623 IN BOOLEAN Trace,624 IN UINT8 *Ptr,625 IN UINT32 AcpiTableLength,626 IN UINT8 AcpiTableRevision627 ) 628 { 629 UINT32 Offset;630 UINT32 Index;631 UINT8 *NodePtr;803 IN BOOLEAN Trace, 804 IN UINT8 *Ptr, 805 IN UINT32 AcpiTableLength, 806 IN UINT8 AcpiTableRevision 807 ) 808 { 809 UINT32 Offset; 810 UINT32 Index; 811 UINT8 *NodePtr; 632 812 633 813 if (!Trace) { 814 return; 815 } 816 817 if ((AcpiTableRevision > EFI_ACPI_IO_REMAPPING_TABLE_REVISION_00) && 818 (AcpiTableRevision < EFI_ACPI_IO_REMAPPING_TABLE_REVISION_05)) 819 { 820 Print ( 821 L"ERROR: Parsing not supported for IORT tabe Revision E, E.<a,b,c>.\n" 822 ); 823 if (AcpiTableRevision == EFI_ACPI_IO_REMAPPING_TABLE_REVISION_04) { 824 IncrementErrorCount (); 825 Print ( 826 L"ERROR: IORT tabe Revision E.c is deprecated and must not be used.\n" 827 ); 828 } 829 634 830 return; 635 831 } … … 647 843 // successfully read. 648 844 if ((IortNodeCount == NULL) || 649 (IortNodeOffset == NULL)) { 845 (IortNodeOffset == NULL)) 846 { 650 847 IncrementErrorCount (); 651 848 Print ( … … 656 853 } 657 854 658 Offset = *IortNodeOffset;855 Offset = *IortNodeOffset; 659 856 NodePtr = Ptr + Offset; 660 Index = 0;857 Index = 0; 661 858 662 859 // Parse the specified number of IORT nodes or the IORT table buffer length. 663 860 // Whichever is minimum. 664 861 while ((Index++ < *IortNodeCount) && 665 (Offset < AcpiTableLength)) { 862 (Offset < AcpiTableLength)) 863 { 666 864 // Parse the IORT Node Header 667 865 ParseAcpi ( … … 679 877 (IortNodeLength == NULL) || 680 878 (IortIdMappingCount == NULL) || 681 (IortIdMappingOffset == NULL)) { 879 (IortIdMappingOffset == NULL)) 880 { 682 881 IncrementErrorCount (); 683 882 Print ( 684 883 L"ERROR: Insufficient remaining table buffer length to read the " \ 685 884 L"IORT node header. Length = %d.\n", 686 885 AcpiTableLength - Offset 687 886 ); … … 691 890 // Validate IORT Node length 692 891 if ((*IortNodeLength == 0) || 693 ((Offset + (*IortNodeLength)) > AcpiTableLength)) { 892 ((Offset + (*IortNodeLength)) > AcpiTableLength)) 893 { 694 894 IncrementErrorCount (); 695 895 Print ( 696 896 L"ERROR: Invalid IORT Node length. " \ 697 897 L"Length = %d. Offset = %d. AcpiTableLength = %d.\n", 698 898 *IortNodeLength, 699 899 Offset, … … 751 951 *IortIdMappingCount, 752 952 *IortIdMappingOffset 753 );953 ); 754 954 break; 755 955 case EFI_ACPI_IORT_TYPE_RMR: 956 DumpIortNodeRmr ( 957 NodePtr, 958 *IortNodeLength, 959 *IortIdMappingCount, 960 *IortIdMappingOffset 961 ); 962 break; 756 963 default: 757 964 IncrementErrorCount (); … … 760 967 761 968 NodePtr += (*IortNodeLength); 762 Offset += (*IortNodeLength);969 Offset += (*IortNodeLength); 763 970 } // while 764 971 } -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c
r89983 r99404 3 3 4 4 Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. 5 Copyright (c) 2022, AMD Incorporated. All rights reserved. 5 6 SPDX-License-Identifier: BSD-2-Clause-Patent 6 7 … … 20 21 21 22 // Local Variables 22 STATIC CONST UINT8 *MadtInterruptControllerType;23 STATIC CONST UINT8 *MadtInterruptControllerLength;24 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;23 STATIC CONST UINT8 *MadtInterruptControllerType; 24 STATIC CONST UINT8 *MadtInterruptControllerLength; 25 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 25 26 26 27 /** … … 35 36 EFIAPI 36 37 ValidateGICDSystemVectorBase ( 37 IN UINT8 *Ptr,38 IN VOID *Context39 )38 IN UINT8 *Ptr, 39 IN VOID *Context 40 ) 40 41 { 41 if (*(UINT32 *)Ptr != 0) {42 if (*(UINT32 *)Ptr != 0) { 42 43 IncrementErrorCount (); 43 44 Print ( 44 45 L"\nERROR: System Vector Base must be zero." 45 );46 ); 46 47 } 47 48 } … … 58 59 EFIAPI 59 60 ValidateSpeOverflowInterrupt ( 60 IN UINT8 *Ptr,61 IN VOID *Context61 IN UINT8 *Ptr, 62 IN VOID *Context 62 63 ) 63 64 { 64 UINT16 SpeOverflowInterrupt;65 66 SpeOverflowInterrupt = *(UINT16 *)Ptr;65 UINT16 SpeOverflowInterrupt; 66 67 SpeOverflowInterrupt = *(UINT16 *)Ptr; 67 68 68 69 // SPE not supported by this processor … … 74 75 ((SpeOverflowInterrupt > ARM_PPI_ID_MAX) && 75 76 (SpeOverflowInterrupt < ARM_PPI_ID_EXTENDED_MIN)) || 76 (SpeOverflowInterrupt > ARM_PPI_ID_EXTENDED_MAX)) { 77 (SpeOverflowInterrupt > ARM_PPI_ID_EXTENDED_MAX)) 78 { 77 79 IncrementErrorCount (); 78 80 Print ( 79 81 L"\nERROR: SPE Overflow Interrupt ID of %d is not in the allowed PPI ID " 80 82 L"ranges of %d-%d or %d-%d (for GICv3.1 or later).", 81 83 SpeOverflowInterrupt, 82 84 ARM_PPI_ID_MIN, … … 84 86 ARM_PPI_ID_EXTENDED_MIN, 85 87 ARM_PPI_ID_EXTENDED_MAX 86 );88 ); 87 89 } else if (SpeOverflowInterrupt != ARM_PPI_ID_PMBIRQ) { 88 IncrementWarningCount ();90 IncrementWarningCount (); 89 91 Print ( 90 92 L"\nWARNING: SPE Overflow Interrupt ID of %d is not compliant with SBSA " 91 93 L"Level 3 PPI ID assignment: %d.", 92 94 SpeOverflowInterrupt, 93 95 ARM_PPI_ID_PMBIRQ 94 );96 ); 95 97 } 96 98 } … … 99 101 An ACPI_PARSER array describing the GICC Interrupt Controller Structure. 100 102 **/ 101 STATIC CONST ACPI_PARSER GicCParser[] = {102 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},103 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},104 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},105 106 { L"CPU Interface Number", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},107 { L"ACPI Processor UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},108 { L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},109 { L"Parking Protocol Version", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},110 111 { L"Performance Interrupt GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},112 { L"Parked Address", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL},113 { L"Physical Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},114 { L"GICV", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL},115 { L"GICH", 8, 48, L"0x%lx", NULL, NULL, NULL, NULL},116 { L"VGIC Maintenance interrupt", 4, 56, L"0x%x", NULL, NULL, NULL, NULL},117 { L"GICR Base Address", 8, 60, L"0x%lx", NULL, NULL, NULL, NULL},118 { L"MPIDR", 8, 68, L"0x%lx", NULL, NULL, NULL, NULL},119 { L"Processor Power Efficiency Class", 1, 76, L"0x%x",NULL, NULL, NULL,120 NULL},121 { L"Reserved", 1, 77, L"0x%x", NULL, NULL, NULL, NULL},122 { L"SPE overflow Interrupt", 2, 78, L"0x%x",NULL, NULL,123 ValidateSpeOverflowInterrupt, NULL }103 STATIC CONST ACPI_PARSER GicCParser[] = { 104 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 105 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL }, 106 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL }, 107 108 { L"CPU Interface Number", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 109 { L"ACPI Processor UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL }, 110 { L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }, 111 { L"Parking Protocol Version", 4, 16, L"0x%x", NULL, NULL, NULL, NULL }, 112 113 { L"Performance Interrupt GSIV", 4, 20, L"0x%x", NULL, NULL, NULL, NULL }, 114 { L"Parked Address", 8, 24, L"0x%lx", NULL, NULL, NULL, NULL }, 115 { L"Physical Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL }, 116 { L"GICV", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL }, 117 { L"GICH", 8, 48, L"0x%lx", NULL, NULL, NULL, NULL }, 118 { L"VGIC Maintenance interrupt", 4, 56, L"0x%x", NULL, NULL, NULL, NULL }, 119 { L"GICR Base Address", 8, 60, L"0x%lx", NULL, NULL, NULL, NULL }, 120 { L"MPIDR", 8, 68, L"0x%lx", NULL, NULL, NULL, NULL }, 121 { L"Processor Power Efficiency Class", 1, 76, L"0x%x", NULL, NULL, NULL, 122 NULL }, 123 { L"Reserved", 1, 77, L"0x%x", NULL, NULL, NULL, NULL }, 124 { L"SPE overflow Interrupt", 2, 78, L"0x%x", NULL, NULL, 125 ValidateSpeOverflowInterrupt, NULL } 124 126 }; 125 127 … … 127 129 An ACPI_PARSER array describing the GICD Interrupt Controller Structure. 128 130 **/ 129 STATIC CONST ACPI_PARSER GicDParser[] = {130 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},131 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},132 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},133 134 { L"GIC ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},135 { L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},136 { L"System Vector Base", 4, 16, L"0x%x", NULL,NULL,137 ValidateGICDSystemVectorBase, NULL },138 { L"GIC Version", 1, 20, L"%d", NULL, NULL, NULL, NULL},139 { L"Reserved", 3, 21, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}131 STATIC CONST ACPI_PARSER GicDParser[] = { 132 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 133 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL }, 134 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL }, 135 136 { L"GIC ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 137 { L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL }, 138 { L"System Vector Base", 4, 16, L"0x%x", NULL, NULL, 139 ValidateGICDSystemVectorBase, NULL }, 140 { L"GIC Version", 1, 20, L"%d", NULL, NULL, NULL, NULL }, 141 { L"Reserved", 3, 21, L"%x %x %x", Dump3Chars, NULL, NULL, NULL } 140 142 }; 141 143 … … 143 145 An ACPI_PARSER array describing the MSI Frame Interrupt Controller Structure. 144 146 **/ 145 STATIC CONST ACPI_PARSER GicMSIFrameParser[] = {146 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},147 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},148 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},149 150 { L"MSI Frame ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},151 { L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},152 { L"Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},153 154 { L"SPI Count", 2, 20, L"%d", NULL, NULL, NULL, NULL},155 { L"SPI Base", 2, 22, L"0x%x", NULL, NULL, NULL, NULL}147 STATIC CONST ACPI_PARSER GicMSIFrameParser[] = { 148 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 149 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL }, 150 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL }, 151 152 { L"MSI Frame ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 153 { L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL }, 154 { L"Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL }, 155 156 { L"SPI Count", 2, 20, L"%d", NULL, NULL, NULL, NULL }, 157 { L"SPI Base", 2, 22, L"0x%x", NULL, NULL, NULL, NULL } 156 158 }; 157 159 … … 159 161 An ACPI_PARSER array describing the GICR Interrupt Controller Structure. 160 162 **/ 161 STATIC CONST ACPI_PARSER GicRParser[] = {162 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},163 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},164 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},165 166 { L"Discovery Range Base Address", 8, 4,L"0x%lx", NULL, NULL, NULL,167 NULL},168 { L"Discovery Range Length", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}163 STATIC CONST ACPI_PARSER GicRParser[] = { 164 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 165 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL }, 166 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL }, 167 168 { L"Discovery Range Base Address", 8, 4, L"0x%lx", NULL, NULL, NULL, 169 NULL }, 170 { L"Discovery Range Length", 4, 12, L"0x%x", NULL, NULL, NULL, NULL } 169 171 }; 170 172 … … 172 174 An ACPI_PARSER array describing the GIC ITS Interrupt Controller Structure. 173 175 **/ 174 STATIC CONST ACPI_PARSER GicITSParser[] = { 175 {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, 176 {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, 177 {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, 178 179 {L"GIC ITS ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, 180 {L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL}, 181 {L"Reserved", 4, 16, L"0x%x", NULL, NULL, NULL, NULL} 176 STATIC CONST ACPI_PARSER GicITSParser[] = { 177 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 178 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL }, 179 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL }, 180 181 { L"GIC ITS ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 182 { L"Physical Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL }, 183 { L"Reserved", 4, 16, L"0x%x", NULL, NULL, NULL, NULL } 184 }; 185 186 /** 187 An ACPI_PARSER array describing the IO APIC Structure. 188 **/ 189 STATIC CONST ACPI_PARSER IoApic[] = { 190 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 191 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL }, 192 { L"I/O APIC ID", 1, 2, L"0x%x", NULL, NULL, NULL, NULL }, 193 { L"Reserved", 1, 3, L"0x%x", NULL, NULL, NULL, NULL }, 194 { L"I/O APIC Address", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 195 { L"Global System Interrupt Base", 4, 8, L"0x%x", NULL, NULL, NULL, NULL } 196 }; 197 198 /** 199 An ACPI_PARSER array describing the Interrupt Source Override Structure. 200 **/ 201 STATIC CONST ACPI_PARSER InterruptSourceOverride[] = { 202 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 203 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL }, 204 { L"Bus", 1, 2, L"0x%x", NULL, NULL, NULL, NULL }, 205 { L"Source", 1, 3, L"0x%x", NULL, NULL, NULL, NULL }, 206 { L"Global System Interrupt", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 207 { L"Flags", 2, 8, L"0x%x", NULL, NULL, NULL, NULL } 208 }; 209 210 STATIC CONST ACPI_PARSER LocalApicFlags[] = { 211 { L"Enabled", 1, 0, L"%d", NULL, NULL, NULL, NULL }, 212 { L"Online Capable", 1, 1, L"%d", NULL, NULL, NULL, NULL }, 213 { L"Reserved", 30, 2, L"%d", NULL, NULL, NULL, NULL } 214 }; 215 216 /** 217 This function traces Bit Flags fields. 218 If no format string is specified the Format must be NULL. 219 220 @param [in] Format Optional format string for tracing the data. 221 @param [in] Ptr Pointer to the start of the buffer. 222 **/ 223 VOID 224 EFIAPI 225 DumpLocalApicBitFlags ( 226 IN CONST CHAR16 *Format OPTIONAL, 227 IN UINT8 *Ptr 228 ) 229 { 230 if (Format != NULL) { 231 Print (Format, *(UINT32 *)Ptr); 232 return; 233 } 234 235 Print (L"0x%X\n", *(UINT32 *)Ptr); 236 ParseAcpiBitFields ( 237 TRUE, 238 2, 239 NULL, 240 Ptr, 241 4, 242 PARSER_PARAMS (LocalApicFlags) 243 ); 244 } 245 246 /** 247 An ACPI_PARSER array describing the Processor Local APIC Structure. 248 **/ 249 STATIC CONST ACPI_PARSER ProcessorLocalApic[] = { 250 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 251 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL }, 252 253 { L"ACPI Processor UID", 1, 2, L"0x%x", NULL, NULL, NULL, NULL }, 254 { L"APIC ID", 1, 3, L"0x%x", NULL, NULL, NULL, NULL }, 255 { L"Flags", 4, 4, NULL, DumpLocalApicBitFlags, NULL, NULL, NULL } 256 }; 257 258 /** 259 An ACPI_PARSER array describing the Processor Local x2APIC Structure. 260 **/ 261 STATIC CONST ACPI_PARSER ProcessorLocalX2Apic[] = { 262 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 263 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL }, 264 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL }, 265 266 { L"X2APIC ID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 267 { L"Flags", 4, 8, NULL, DumpLocalApicBitFlags, NULL, NULL, NULL }, 268 { L"ACPI Processor UID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL } 269 }; 270 271 /** 272 An ACPI_PARSER array describing the Local x2APIC NMI Structure. 273 **/ 274 STATIC CONST ACPI_PARSER LocalX2ApicNmi[] = { 275 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 276 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL }, 277 { L"Flags", 2, 2, L"0x%x", NULL, NULL, NULL, NULL }, 278 279 { L"ACPI Processor UID", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 280 { L"Local x2APIC LINT#", 1, 8, L"0x%x", NULL, NULL, NULL, NULL }, 281 { L"Reserved", 3, 9, L"0x%x%x%x", Dump3Chars, NULL, NULL, NULL } 182 282 }; 183 283 … … 185 285 An ACPI_PARSER array describing the ACPI MADT Table. 186 286 **/ 187 STATIC CONST ACPI_PARSER MadtParser[] = {287 STATIC CONST ACPI_PARSER MadtParser[] = { 188 288 PARSE_ACPI_HEADER (&AcpiHdrInfo), 189 { L"Local Interrupt Controller Address", 4,36, L"0x%x", NULL, NULL, NULL,190 NULL},191 { L"Flags", 4, 40, L"0x%x", NULL, NULL, NULL,NULL}289 { L"Local Interrupt Controller Address",4, 36, L"0x%x", NULL, NULL, NULL, 290 NULL }, 291 { L"Flags", 4, 40, L"0x%x", NULL, NULL, NULL,NULL} 192 292 }; 193 293 … … 195 295 An ACPI_PARSER array describing the MADT Interrupt Controller Structure Header Structure. 196 296 **/ 197 STATIC CONST ACPI_PARSER MadtInterruptControllerHeaderParser[] = {198 { NULL, 1, 0, NULL, NULL, (VOID**)&MadtInterruptControllerType, NULL, NULL},199 { L"Length", 1, 1, NULL, NULL, (VOID**)&MadtInterruptControllerLength, NULL,200 NULL},201 { L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL}297 STATIC CONST ACPI_PARSER MadtInterruptControllerHeaderParser[] = { 298 { NULL, 1, 0, NULL, NULL, (VOID **)&MadtInterruptControllerType, NULL, NULL }, 299 { L"Length", 1, 1, NULL, NULL, (VOID **)&MadtInterruptControllerLength, NULL, 300 NULL }, 301 { L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL } 202 302 }; 203 303 … … 225 325 EFIAPI 226 326 ParseAcpiMadt ( 227 IN BOOLEAN Trace,228 IN UINT8 *Ptr,229 IN UINT32 AcpiTableLength,230 IN UINT8 AcpiTableRevision327 IN BOOLEAN Trace, 328 IN UINT8 *Ptr, 329 IN UINT32 AcpiTableLength, 330 IN UINT8 AcpiTableRevision 231 331 ) 232 332 { 233 UINT32 Offset;234 UINT8 *InterruptContollerPtr;235 UINT32 GICDCount;333 UINT32 Offset; 334 UINT8 *InterruptContollerPtr; 335 UINT32 GICDCount; 236 336 237 337 GICDCount = 0; … … 265 365 // successfully read. 266 366 if ((MadtInterruptControllerType == NULL) || 267 (MadtInterruptControllerLength == NULL)) { 367 (MadtInterruptControllerLength == NULL)) 368 { 268 369 IncrementErrorCount (); 269 370 Print ( 270 371 L"ERROR: Insufficient remaining table buffer length to read the " \ 271 372 L"Interrupt Controller Structure header. Length = %d.\n", 272 373 AcpiTableLength - Offset 273 374 ); … … 277 378 // Validate Interrupt Controller Structure length 278 379 if ((*MadtInterruptControllerLength == 0) || 279 ((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength)) { 380 ((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength)) 381 { 280 382 IncrementErrorCount (); 281 383 Print ( 282 384 L"ERROR: Invalid Interrupt Controller Structure length. " \ 283 385 L"Length = %d. Offset = %d. AcpiTableLength = %d.\n", 284 386 *MadtInterruptControllerLength, 285 387 Offset, … … 290 392 291 393 switch (*MadtInterruptControllerType) { 292 case EFI_ACPI_6_3_GIC: { 394 case EFI_ACPI_6_3_GIC: 395 { 293 396 ParseAcpi ( 294 397 TRUE, … … 302 405 } 303 406 304 case EFI_ACPI_6_3_GICD: { 407 case EFI_ACPI_6_3_GICD: 408 { 305 409 if (++GICDCount > 1) { 306 410 IncrementErrorCount (); 307 411 Print ( 308 412 L"ERROR: Only one GICD must be present," 309 413 L" GICDCount = %d\n", 310 414 GICDCount 311 415 ); 312 416 } 417 313 418 ParseAcpi ( 314 419 TRUE, … … 322 427 } 323 428 324 case EFI_ACPI_6_3_GIC_MSI_FRAME: { 429 case EFI_ACPI_6_3_GIC_MSI_FRAME: 430 { 325 431 ParseAcpi ( 326 432 TRUE, … … 334 440 } 335 441 336 case EFI_ACPI_6_3_GICR: { 442 case EFI_ACPI_6_3_GICR: 443 { 337 444 ParseAcpi ( 338 445 TRUE, … … 346 453 } 347 454 348 case EFI_ACPI_6_3_GIC_ITS: { 455 case EFI_ACPI_6_3_GIC_ITS: 456 { 349 457 ParseAcpi ( 350 458 TRUE, … … 358 466 } 359 467 360 default: { 468 case EFI_ACPI_6_3_IO_APIC: 469 { 470 ParseAcpi ( 471 TRUE, 472 2, 473 "IO APIC", 474 InterruptContollerPtr, 475 *MadtInterruptControllerLength, 476 PARSER_PARAMS (IoApic) 477 ); 478 break; 479 } 480 481 case EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE: 482 { 483 ParseAcpi ( 484 TRUE, 485 2, 486 "INTERRUPT SOURCE OVERRIDE", 487 InterruptContollerPtr, 488 *MadtInterruptControllerLength, 489 PARSER_PARAMS (InterruptSourceOverride) 490 ); 491 break; 492 } 493 case EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC: 494 { 495 ParseAcpi ( 496 TRUE, 497 2, 498 "PROCESSOR LOCAL APIC", 499 InterruptContollerPtr, 500 *MadtInterruptControllerLength, 501 PARSER_PARAMS (ProcessorLocalApic) 502 ); 503 break; 504 } 505 case EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC: 506 { 507 ParseAcpi ( 508 TRUE, 509 2, 510 "PROCESSOR LOCAL X2APIC", 511 InterruptContollerPtr, 512 *MadtInterruptControllerLength, 513 PARSER_PARAMS (ProcessorLocalX2Apic) 514 ); 515 break; 516 } 517 518 case EFI_ACPI_6_3_LOCAL_X2APIC_NMI: 519 { 520 ParseAcpi ( 521 TRUE, 522 2, 523 "LOCAL x2APIC NMI", 524 InterruptContollerPtr, 525 *MadtInterruptControllerLength, 526 PARSER_PARAMS (LocalX2ApicNmi) 527 ); 528 break; 529 } 530 531 default: 532 { 361 533 IncrementErrorCount (); 362 534 Print ( 363 535 L"ERROR: Unknown Interrupt Controller Structure," 364 536 L" Type = %d, Length = %d\n", 365 537 *MadtInterruptControllerType, 366 538 *MadtInterruptControllerLength … … 370 542 371 543 InterruptContollerPtr += *MadtInterruptControllerLength; 372 Offset += *MadtInterruptControllerLength;544 Offset += *MadtInterruptControllerLength; 373 545 } // while 374 546 } -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.h
r80721 r99404 17 17 /// Level 3 base server system Private Peripheral Inerrupt (PPI) ID assignments 18 18 /// 19 #define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTP 20 #define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTPS 21 #define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHV 22 #define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTV 23 #define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHP 24 #define ARM_PPI_ID_GIC_MAINTENANCE_INTERRUPT 25 #define ARM_PPI_ID_CTIIRQ 26 #define ARM_PPI_ID_PERFORMANCE_MONITORS_INTERRUPT 27 #define ARM_PPI_ID_COMMIRQ 28 #define ARM_PPI_ID_PMBIRQ 29 #define ARM_PPI_ID_CNTHPS 30 #define ARM_PPI_ID_CNTHVS 19 #define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTP 30 20 #define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTPS 29 21 #define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHV 28 22 #define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTV 27 23 #define ARM_PPI_ID_OVERFLOW_INTERRUPT_FROM_CNTHP 26 24 #define ARM_PPI_ID_GIC_MAINTENANCE_INTERRUPT 25 25 #define ARM_PPI_ID_CTIIRQ 24 26 #define ARM_PPI_ID_PERFORMANCE_MONITORS_INTERRUPT 23 27 #define ARM_PPI_ID_COMMIRQ 22 28 #define ARM_PPI_ID_PMBIRQ 21 29 #define ARM_PPI_ID_CNTHPS 20 30 #define ARM_PPI_ID_CNTHVS 19 31 31 32 32 /// 33 33 /// PPI ID allowed ranges 34 34 /// 35 #define ARM_PPI_ID_MAX 36 #define ARM_PPI_ID_MIN 37 #define ARM_PPI_ID_EXTENDED_MAX 38 #define ARM_PPI_ID_EXTENDED_MIN 35 #define ARM_PPI_ID_MAX 31 36 #define ARM_PPI_ID_MIN 16 37 #define ARM_PPI_ID_EXTENDED_MAX 1119 38 #define ARM_PPI_ID_EXTENDED_MIN 1056 39 39 40 40 #endif // MADT_PARSER_H_ -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c
r80721 r99404 15 15 16 16 // Local variables 17 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;17 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 18 18 19 19 /** 20 20 An ACPI_PARSER array describing the ACPI MCFG Table. 21 21 **/ 22 STATIC CONST ACPI_PARSER McfgParser[] = {22 STATIC CONST ACPI_PARSER McfgParser[] = { 23 23 PARSE_ACPI_HEADER (&AcpiHdrInfo), 24 { L"Reserved", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},24 { L"Reserved", 8,36, L"0x%lx", NULL, NULL, NULL, NULL }, 25 25 }; 26 26 … … 28 28 An ACPI_PARSER array describing the PCI configuration Space Base Address structure. 29 29 **/ 30 STATIC CONST ACPI_PARSER PciCfgSpaceBaseAddrParser[] = {31 { L"Base Address", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL},32 { L"PCI Segment Group No.", 2, 8, L"0x%x", NULL, NULL, NULL, NULL},33 { L"Start Bus No.", 1, 10, L"0x%x", NULL, NULL, NULL, NULL},34 { L"End Bus No.", 1, 11, L"0x%x", NULL, NULL, NULL, NULL},35 { L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}30 STATIC CONST ACPI_PARSER PciCfgSpaceBaseAddrParser[] = { 31 { L"Base Address", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL }, 32 { L"PCI Segment Group No.", 2, 8, L"0x%x", NULL, NULL, NULL, NULL }, 33 { L"Start Bus No.", 1, 10, L"0x%x", NULL, NULL, NULL, NULL }, 34 { L"End Bus No.", 1, 11, L"0x%x", NULL, NULL, NULL, NULL }, 35 { L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL } 36 36 }; 37 37 … … 51 51 EFIAPI 52 52 ParseAcpiMcfg ( 53 IN BOOLEAN Trace,54 IN UINT8 *Ptr,55 IN UINT32 AcpiTableLength,56 IN UINT8 AcpiTableRevision53 IN BOOLEAN Trace, 54 IN UINT8 *Ptr, 55 IN UINT32 AcpiTableLength, 56 IN UINT8 AcpiTableRevision 57 57 ) 58 58 { 59 UINT32 Offset;60 UINT32 PciCfgOffset;61 UINT8 *PciCfgSpacePtr;59 UINT32 Offset; 60 UINT32 PciCfgOffset; 61 UINT8 *PciCfgSpacePtr; 62 62 63 63 if (!Trace) { … … 86 86 ); 87 87 PciCfgSpacePtr += PciCfgOffset; 88 Offset += PciCfgOffset;88 Offset += PciCfgOffset; 89 89 } 90 90 } -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c
r89983 r99404 2 2 PCCT table parser 3 3 4 Copyright (c) 202 0, Arm Limited.4 Copyright (c) 2021, Arm Limited. 5 5 SPDX-License-Identifier: BSD-2-Clause-Patent 6 6 7 7 @par Reference(s): 8 - ACPI 6. 3 Specification - January 20198 - ACPI 6.4 Specification - January 2021 9 9 **/ 10 10 … … 18 18 19 19 // Local variables 20 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;21 22 STATIC UINT32 *PccGlobalFlags;23 STATIC UINT8 *PccSubspaceLength;24 STATIC UINT8 *PccSubspaceType;25 STATIC UINT8 *ExtendedPccSubspaceInterruptFlags;20 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 21 22 STATIC UINT32 *PccGlobalFlags; 23 STATIC UINT8 *PccSubspaceLength; 24 STATIC UINT8 *PccSubspaceType; 25 STATIC UINT8 *ExtendedPccSubspaceInterruptFlags; 26 26 27 27 /** … … 36 36 EFIAPI 37 37 ValidateRangeLength4 ( 38 IN UINT8 *Ptr,39 IN VOID *Context40 ) 41 { 42 if (*(UINT32 *)Ptr < MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN) {38 IN UINT8 *Ptr, 39 IN VOID *Context 40 ) 41 { 42 if (*(UINT32 *)Ptr < MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN) { 43 43 IncrementErrorCount (); 44 44 Print ( 45 45 L"\nError: Shared memory range length is too short.\n" 46 46 L"Length is %u when it should be greater than or equal to %u", 47 *(UINT32 *)Ptr,47 *(UINT32 *)Ptr, 48 48 MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN 49 49 ); … … 62 62 EFIAPI 63 63 ValidateRangeLength8 ( 64 IN UINT8 *Ptr,65 IN VOID *Context66 ) 67 { 68 if (*(UINT64 *)Ptr <= MIN_MEMORY_RANGE_LENGTH) {64 IN UINT8 *Ptr, 65 IN VOID *Context 66 ) 67 { 68 if (*(UINT64 *)Ptr <= MIN_MEMORY_RANGE_LENGTH) { 69 69 IncrementErrorCount (); 70 70 Print ( 71 71 L"\nError: Shared memory range length is too short.\n" 72 72 L"Length is %u when it should be greater than %u", 73 *(UINT64 *)Ptr,73 *(UINT64 *)Ptr, 74 74 MIN_MEMORY_RANGE_LENGTH 75 75 ); … … 78 78 79 79 /** 80 This function validates address space for type 0 structure.81 82 @param [in] Ptr Pointer to the start of the field data. 83 @param [in] Context Pointer to context specific information e.g. this 84 could be a pointer to the ACPI table header. 85 **/ 86 STATIC 87 VOID 88 EFIAPI 89 ValidatePcc Type0Gas (90 IN UINT8 *Ptr,91 IN VOID *Context92 ) 93 { 94 switch (*(UINT8 *)Ptr) {95 #if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))96 case EFI_ACPI_6_ 3_SYSTEM_IO:97 #endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))98 case EFI_ACPI_6_ 3_SYSTEM_MEMORY:80 This function validates address space for Memory/IO GAS. 81 82 @param [in] Ptr Pointer to the start of the field data. 83 @param [in] Context Pointer to context specific information e.g. this 84 could be a pointer to the ACPI table header. 85 **/ 86 STATIC 87 VOID 88 EFIAPI 89 ValidatePccMemoryIoGas ( 90 IN UINT8 *Ptr, 91 IN VOID *Context 92 ) 93 { 94 switch (*(UINT8 *)Ptr) { 95 #if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)) 96 case EFI_ACPI_6_4_SYSTEM_IO: 97 #endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)) 98 case EFI_ACPI_6_4_SYSTEM_MEMORY: 99 99 return; 100 100 default: … … 115 115 EFIAPI 116 116 ValidatePccGas ( 117 IN UINT8 *Ptr,118 IN VOID *Context119 ) 120 { 121 switch (*(UINT8 *)Ptr) {122 #if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))123 case EFI_ACPI_6_ 3_SYSTEM_IO:124 #endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64))125 case EFI_ACPI_6_ 3_FUNCTIONAL_FIXED_HARDWARE:126 case EFI_ACPI_6_ 3_SYSTEM_MEMORY:117 IN UINT8 *Ptr, 118 IN VOID *Context 119 ) 120 { 121 switch (*(UINT8 *)Ptr) { 122 #if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)) 123 case EFI_ACPI_6_4_SYSTEM_IO: 124 #endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)) 125 case EFI_ACPI_6_4_FUNCTIONAL_FIXED_HARDWARE: 126 case EFI_ACPI_6_4_SYSTEM_MEMORY: 127 127 return; 128 128 default: … … 143 143 EFIAPI 144 144 ValidatePccDoorbellGas ( 145 IN UINT8 *Ptr,146 IN VOID *Context147 ) 148 { 149 // For slavesubspaces this field is optional, if not present the field145 IN UINT8 *Ptr, 146 IN VOID *Context 147 ) 148 { 149 // For responder subspaces this field is optional, if not present the field 150 150 // should just contain zeros. 151 if (*PccSubspaceType == EFI_ACPI_6_ 3_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) {151 if (*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) { 152 152 if (IsZeroBuffer ( 153 153 Ptr, 154 sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE) 155 )) { 154 sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE) 155 )) 156 { 156 157 return; 157 158 } … … 173 174 EFIAPI 174 175 ValidatePccIntAckGas ( 175 IN UINT8 *Ptr,176 IN VOID *Context176 IN UINT8 *Ptr, 177 IN VOID *Context 177 178 ) 178 179 { … … 181 182 // 12 bytes of the GAS structure indicates the register is not 182 183 // present. 183 if (((*PccGlobalFlags & EFI_ACPI_6_ 3_PCCT_FLAGS_PLATFORM_INTERRUPT) !=184 EFI_ACPI_6_ 3_PCCT_FLAGS_PLATFORM_INTERRUPT) ||184 if (((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) != 185 EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) || 185 186 ((*ExtendedPccSubspaceInterruptFlags & 186 EFI_ACPI_6_3_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE) == 187 EFI_ACPI_6_3_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE)) { 187 EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE) == 188 EFI_ACPI_6_4_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE)) 189 { 188 190 if (IsZeroBuffer ( 189 191 Ptr, 190 sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE) 191 )) { 192 sizeof (EFI_ACPI_6_4_GENERIC_ADDRESS_STRUCTURE) 193 )) 194 { 192 195 return; 193 196 } … … 208 211 EFIAPI 209 212 ValidatePccErrStatusGas ( 210 IN UINT8 *Ptr,211 IN VOID *Context212 ) 213 { 214 // This field is ignored by the OSPM on slavechannels.215 if (*PccSubspaceType == EFI_ACPI_6_ 3_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) {213 IN UINT8 *Ptr, 214 IN VOID *Context 215 ) 216 { 217 // This field is ignored by the OSPM on responder channels. 218 if (*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) { 216 219 return; 217 220 } … … 231 234 EFIAPI 232 235 ValidatePlatInterrupt ( 233 IN UINT8 *Ptr,234 IN VOID *Context235 ) 236 { 237 // If a slavesubspace is present in the PCCT, then the global Platform236 IN UINT8 *Ptr, 237 IN VOID *Context 238 ) 239 { 240 // If a responder subspace is present in the PCCT, then the global Platform 238 241 // Interrupt flag must be set to 1. 239 if ((*PccSubspaceType == EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) && 240 ((*PccGlobalFlags & EFI_ACPI_6_3_PCCT_FLAGS_PLATFORM_INTERRUPT) != 241 EFI_ACPI_6_3_PCCT_FLAGS_PLATFORM_INTERRUPT)) { 242 if ((*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) && 243 ((*PccGlobalFlags & EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT) != 244 EFI_ACPI_6_4_PCCT_FLAGS_PLATFORM_INTERRUPT)) 245 { 242 246 IncrementErrorCount (); 243 247 Print ( 244 248 L"\nError: Global Platform interrupt flag must be set to 1" \ 245 249 L" if a PCC type 4 structure is present in PCCT." 246 250 ); 247 251 } … … 251 255 An ACPI_PARSER array describing the ACPI PCCT Table. 252 256 */ 253 STATIC CONST ACPI_PARSER PcctParser[] = {257 STATIC CONST ACPI_PARSER PcctParser[] = { 254 258 PARSE_ACPI_HEADER (&AcpiHdrInfo), 255 { L"Flags", 4, 36, NULL, NULL, (VOID**)&PccGlobalFlags, NULL, NULL},256 { L"Reserved", 8, 40, NULL, NULL, NULL, NULL, NULL}259 { L"Flags", 4, 36, NULL, NULL, (VOID **)&PccGlobalFlags, NULL, NULL }, 260 { L"Reserved", 8, 40, NULL, NULL, NULL, NULL, NULL } 257 261 }; 258 262 … … 261 265 structure header. 262 266 */ 263 STATIC CONST ACPI_PARSER PccSubspaceHeaderParser[] = {267 STATIC CONST ACPI_PARSER PccSubspaceHeaderParser[] = { 264 268 PCC_SUBSPACE_HEADER () 265 269 // ... Type Specific Fields ... … … 269 273 An ACPI_PARSER array describing the Generic Communications Subspace - Type 0 270 274 */ 271 STATIC CONST ACPI_PARSER PccSubspaceType0Parser[] = {275 STATIC CONST ACPI_PARSER PccSubspaceType0Parser[] = { 272 276 PCC_SUBSPACE_HEADER (), 273 { L"Reserved", 6, 2, L"%x %x %x %x %x %x", Dump6Chars, NULL, NULL, NULL},274 { L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},275 { L"Memory Range Length", 8, 16, L"0x%lx", NULL,NULL, ValidateRangeLength8,276 NULL },277 { L"Doorbell Register", 12, 24, NULL, DumpGas, NULL, ValidatePccType0Gas,278 NULL },279 { L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},280 { L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL},281 { L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL},282 { L"Maximum Periodic Access Rate", 4, 56, L"%u", NULL, NULL, NULL, NULL},283 { L"Minimum Request Turnaround Time", 2, 60, L"%u", NULL, NULL, NULL, NULL}277 { L"Reserved", 6, 2, L"%x %x %x %x %x %x", Dump6Chars, NULL, NULL, NULL }, 278 { L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL }, 279 { L"Memory Range Length",8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8, 280 NULL }, 281 { L"Doorbell Register",12, 24, NULL, DumpGas, NULL, ValidatePccMemoryIoGas, 282 NULL }, 283 { L"Doorbell Preserve",8, 36, L"0x%lx", NULL, NULL, NULL, NULL }, 284 { L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL }, 285 { L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL }, 286 { L"Maximum Periodic Access Rate",4, 56, L"%u", NULL, NULL, NULL, NULL }, 287 { L"Minimum Request Turnaround Time",2, 60, L"%u", NULL, NULL, NULL, NULL } 284 288 }; 285 289 … … 288 292 - Type 1 289 293 */ 290 STATIC CONST ACPI_PARSER PccSubspaceType1Parser[] = {294 STATIC CONST ACPI_PARSER PccSubspaceType1Parser[] = { 291 295 PCC_SUBSPACE_HEADER (), 292 { L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},293 { L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL, NULL, NULL, NULL},294 { L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL},295 { L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},296 { L"Memory Range Length", 8, 16, L"0x%lx", NULL,NULL, ValidateRangeLength8,297 NULL },298 { L"Doorbell Register", 12, 24, NULL,DumpGas, NULL,299 ValidatePccGas, NULL},300 { L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},301 { L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL},302 { L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL},303 { L"Maximum Periodic Access Rate", 4, 56, L"%u", NULL, NULL, NULL, NULL},304 { L"Minimum Request Turnaround Time", 2, 60, L"%u", NULL, NULL, NULL, NULL}296 { L"Platform Interrupt",4, 2, L"0x%x", NULL, NULL, NULL, NULL }, 297 { L"Platform Interrupt Flags",1, 6, L"0x%x", NULL, NULL, NULL, NULL }, 298 { L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL }, 299 { L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL }, 300 { L"Memory Range Length",8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8, 301 NULL }, 302 { L"Doorbell Register",12, 24, NULL, DumpGas, NULL, 303 ValidatePccGas, NULL }, 304 { L"Doorbell Preserve",8, 36, L"0x%lx", NULL, NULL, NULL, NULL }, 305 { L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL }, 306 { L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL }, 307 { L"Maximum Periodic Access Rate",4, 56, L"%u", NULL, NULL, NULL, NULL }, 308 { L"Minimum Request Turnaround Time",2, 60, L"%u", NULL, NULL, NULL, NULL } 305 309 }; 306 310 … … 309 313 - Type 2 310 314 */ 311 STATIC CONST ACPI_PARSER PccSubspaceType2Parser[] = {315 STATIC CONST ACPI_PARSER PccSubspaceType2Parser[] = { 312 316 PCC_SUBSPACE_HEADER (), 313 { L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},314 { L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL, NULL, NULL, NULL},315 { L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL},316 { L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},317 { L"Memory Range Length", 8, 16, L"0x%lx", NULL,NULL, ValidateRangeLength8,318 NULL },319 { L"Doorbell Register", 12, 24, NULL,DumpGas, NULL,320 ValidatePccGas, NULL},321 { L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},322 { L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL},323 { L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL},324 { L"Maximum Periodic Access Rate", 4, 56, L"%u", NULL, NULL, NULL, NULL},325 { L"Minimum Request Turnaround Time", 2, 60, L"%u", NULL, NULL, NULL, NULL},326 { L"Platform Interrupt Ack Register", 12, 62, NULL,DumpGas, NULL,327 ValidatePccGas, NULL},328 { L"Platform Interrupt Ack Preserve", 8, 74, L"0x%lx", NULL, NULL, NULL, NULL},329 { L"Platform Interrupt Ack Write", 8, 82, L"0x%lx", NULL,NULL,330 NULL, NULL},317 { L"Platform Interrupt",4, 2, L"0x%x", NULL, NULL, NULL, NULL }, 318 { L"Platform Interrupt Flags",1, 6, L"0x%x", NULL, NULL, NULL, NULL }, 319 { L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL }, 320 { L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL }, 321 { L"Memory Range Length",8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8, 322 NULL }, 323 { L"Doorbell Register",12, 24, NULL, DumpGas, NULL, 324 ValidatePccGas, NULL }, 325 { L"Doorbell Preserve",8, 36, L"0x%lx", NULL, NULL, NULL, NULL }, 326 { L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL }, 327 { L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL }, 328 { L"Maximum Periodic Access Rate",4, 56, L"%u", NULL, NULL, NULL, NULL }, 329 { L"Minimum Request Turnaround Time",2, 60, L"%u", NULL, NULL, NULL, NULL }, 330 { L"Platform Interrupt Ack Register",12, 62, NULL, DumpGas, NULL, 331 ValidatePccGas, NULL }, 332 { L"Platform Interrupt Ack Preserve",8, 74, L"0x%lx", NULL, NULL, NULL, NULL }, 333 { L"Platform Interrupt Ack Write",8, 82, L"0x%lx", NULL, NULL, 334 NULL, NULL }, 331 335 }; 332 336 … … 334 338 An ACPI_PARSER array describing the Extended PCC Subspaces - Type 3/4 335 339 */ 336 STATIC CONST ACPI_PARSER PccSubspaceType3Parser[] = {340 STATIC CONST ACPI_PARSER PccSubspaceType3Parser[] = { 337 341 PCC_SUBSPACE_HEADER (), 338 {L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL, 339 ValidatePlatInterrupt, NULL}, 340 {L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL, 341 (VOID**)&ExtendedPccSubspaceInterruptFlags, NULL, NULL}, 342 {L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL}, 343 {L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL}, 344 {L"Memory Range Length", 4, 16, L"0x%x", NULL, NULL, ValidateRangeLength4, 345 NULL}, 346 {L"Doorbell Register", 12, 20, NULL, DumpGas, NULL, 347 ValidatePccDoorbellGas, NULL}, 348 {L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}, 349 {L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL}, 350 {L"Nominal Latency", 4, 48, L"%u", NULL, NULL, NULL, NULL}, 351 {L"Maximum Periodic Access Rate", 4, 52, L"%u", NULL, NULL, NULL, NULL}, 352 {L"Minimum Request Turnaround Time", 4, 56, L"%u", NULL, NULL, NULL, NULL}, 353 {L"Platform Interrupt Ack Register", 12, 60, NULL, DumpGas, NULL, 354 ValidatePccIntAckGas, NULL}, 355 {L"Platform Interrupt Ack Preserve", 8, 72, L"0x%lx", NULL, NULL, NULL, NULL}, 356 {L"Platform Interrupt Ack Set", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL}, 357 {L"Reserved", 8, 88, L"0x%lx", NULL, NULL, NULL, NULL}, 358 {L"Cmd Complete Check Reg Addr", 12, 96, NULL, DumpGas, NULL, 359 ValidatePccGas, NULL}, 360 {L"Cmd Complete Check Mask", 8, 108, L"0x%lx", NULL, NULL, NULL, NULL}, 361 {L"Cmd Update Reg Addr", 12, 116, NULL, DumpGas, NULL, 362 ValidatePccGas, NULL}, 363 {L"Cmd Update Preserve mask", 8, 128, L"0x%lx", NULL, NULL, NULL, NULL}, 364 {L"Cmd Update Set mask", 8, 136, L"0x%lx", NULL, NULL, NULL, NULL}, 365 {L"Error Status Register", 12, 144, NULL, DumpGas, NULL, 366 ValidatePccErrStatusGas, NULL}, 367 {L"Error Status Mask", 8, 156, L"0x%lx", NULL, NULL, NULL, NULL}, 342 { L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL, 343 ValidatePlatInterrupt, NULL }, 344 { L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL, 345 (VOID **)&ExtendedPccSubspaceInterruptFlags,NULL, NULL }, 346 { L"Reserved", 1, 7, L"0x%x", NULL, NULL,NULL, NULL }, 347 { L"Base Address", 8, 8, L"0x%lx", NULL, NULL,NULL, NULL }, 348 { L"Memory Range Length", 4, 16, L"0x%x", NULL, NULL,ValidateRangeLength4, 349 NULL }, 350 { L"Doorbell Register", 12, 20, NULL, DumpGas, NULL, 351 ValidatePccDoorbellGas, NULL }, 352 { L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL,NULL, NULL }, 353 { L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL,NULL, NULL }, 354 { L"Nominal Latency", 4, 48, L"%u", NULL, NULL,NULL, NULL }, 355 { L"Maximum Periodic Access Rate", 4, 52, L"%u", NULL, NULL,NULL, NULL }, 356 { L"Minimum Request Turnaround Time", 4, 56, L"%u", NULL, NULL,NULL, NULL }, 357 { L"Platform Interrupt Ack Register", 12, 60, NULL, DumpGas, NULL, 358 ValidatePccIntAckGas, NULL }, 359 { L"Platform Interrupt Ack Preserve", 8, 72, L"0x%lx", NULL, NULL,NULL, NULL }, 360 { L"Platform Interrupt Ack Set", 8, 80, L"0x%lx", NULL, NULL,NULL, NULL }, 361 { L"Reserved", 8, 88, L"0x%lx", NULL, NULL,NULL, NULL }, 362 { L"Cmd Complete Check Reg Addr", 12, 96, NULL, DumpGas, NULL, 363 ValidatePccGas, NULL }, 364 { L"Cmd Complete Check Mask", 8, 108, L"0x%lx", NULL, NULL,NULL, NULL }, 365 { L"Cmd Update Reg Addr", 12, 116, NULL, DumpGas, NULL, 366 ValidatePccGas, NULL }, 367 { L"Cmd Update Preserve mask", 8, 128, L"0x%lx", NULL, NULL,NULL, NULL }, 368 { L"Cmd Update Set mask", 8, 136, L"0x%lx", NULL, NULL,NULL, NULL }, 369 { L"Error Status Register", 12, 144, NULL, DumpGas, NULL, 370 ValidatePccErrStatusGas, NULL }, 371 { L"Error Status Mask", 8, 156, L"0x%lx", NULL, NULL,NULL, NULL }, 372 }; 373 374 /** 375 An ACPI_PARSER array describing the HW Registers based Communications 376 Subspace Structure - Type 5 377 */ 378 STATIC CONST ACPI_PARSER PccSubspaceType5Parser[] = { 379 PCC_SUBSPACE_HEADER (), 380 { L"Version", 2, 2, L"0x%x", NULL, NULL, NULL, NULL }, 381 { L"Base Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL }, 382 { L"Shared Memory Range Length",8, 12, L"0x%lx", NULL, NULL, NULL, NULL }, 383 { L"Doorbell Register", 12, 20, NULL, DumpGas, NULL, 384 ValidatePccMemoryIoGas,NULL }, 385 { L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL }, 386 { L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL }, 387 { L"Command Complete Check Register",12, 48, NULL, DumpGas, NULL, 388 ValidatePccMemoryIoGas,NULL }, 389 { L"Command Complete Check Mask",8, 60, L"0x%lx", NULL, NULL, NULL, NULL }, 390 { L"Error Status Register",12, 68, NULL, DumpGas, NULL, 391 ValidatePccMemoryIoGas,NULL }, 392 { L"Error Status Mask", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL }, 393 { L"Nominal Latency", 4, 88, L"0x%x", NULL, NULL, NULL, NULL }, 394 { L"Minimum Request Turnaround Time",4, 92, L"0x%x", NULL, NULL, NULL, NULL } 368 395 }; 369 396 … … 377 404 VOID 378 405 DumpPccSubspaceType0 ( 379 IN UINT8 *Ptr,406 IN UINT8 *Ptr, 380 407 IN UINT8 Length 381 408 ) … … 400 427 VOID 401 428 DumpPccSubspaceType1 ( 402 IN UINT8 *Ptr,429 IN UINT8 *Ptr, 403 430 IN UINT8 Length 404 431 ) … … 423 450 VOID 424 451 DumpPccSubspaceType2 ( 425 IN UINT8 *Ptr,452 IN UINT8 *Ptr, 426 453 IN UINT8 Length 427 454 ) … … 446 473 VOID 447 474 DumpPccSubspaceType3 ( 448 IN UINT8 *Ptr,475 IN UINT8 *Ptr, 449 476 IN UINT8 Length 450 477 ) … … 469 496 VOID 470 497 DumpPccSubspaceType4 ( 471 IN UINT8 *Ptr,498 IN UINT8 *Ptr, 472 499 IN UINT8 Length 473 500 ) … … 484 511 485 512 /** 513 This function parses the PCC Subspace type 5. 514 515 @param [in] Ptr Pointer to the start of the Subspace Structure. 516 @param [in] Length Length of the Subspace Structure. 517 **/ 518 STATIC 519 VOID 520 DumpPccSubspaceType5 ( 521 IN UINT8 *Ptr, 522 IN UINT8 Length 523 ) 524 { 525 ParseAcpi ( 526 TRUE, 527 2, 528 "Subspace Type 5", 529 Ptr, 530 Length, 531 PARSER_PARAMS (PccSubspaceType5Parser) 532 ); 533 } 534 535 /** 486 536 This function parses the ACPI PCCT table including its sub-structures 487 537 of type 0 through 4. … … 499 549 EFIAPI 500 550 ParseAcpiPcct ( 501 IN BOOLEAN Trace,502 IN UINT8 *Ptr,503 IN UINT32 AcpiTableLength,504 IN UINT8 AcpiTableRevision505 ) 506 { 507 UINT32 Offset;508 UINT8 *PccSubspacePtr;509 UINTN SubspaceCount;551 IN BOOLEAN Trace, 552 IN UINT8 *Ptr, 553 IN UINT32 AcpiTableLength, 554 IN UINT8 AcpiTableRevision 555 ) 556 { 557 UINT32 Offset; 558 UINT8 *PccSubspacePtr; 559 UINTN SubspaceCount; 510 560 511 561 if (!Trace) { … … 539 589 // successfully read. 540 590 if ((PccSubspaceType == NULL) || 541 (PccSubspaceLength == NULL)) { 591 (PccSubspaceLength == NULL)) 592 { 542 593 IncrementErrorCount (); 543 594 Print ( 544 595 L"ERROR: Insufficient remaining table buffer length to read the " \ 545 596 L"structure header. Length = %u.\n", 546 597 AcpiTableLength - Offset 547 598 ); … … 551 602 // Validate Structure length 552 603 if ((*PccSubspaceLength == 0) || 553 ((Offset + (*PccSubspaceLength)) > AcpiTableLength)) { 604 ((Offset + (*PccSubspaceLength)) > AcpiTableLength)) 605 { 554 606 IncrementErrorCount (); 555 607 Print ( 556 608 L"ERROR: Invalid Structure length. " \ 557 609 L"Length = %u. Offset = %u. AcpiTableLength = %u.\n", 558 610 *PccSubspaceLength, 559 611 Offset, … … 564 616 565 617 switch (*PccSubspaceType) { 566 case EFI_ACPI_6_ 3_PCCT_SUBSPACE_TYPE_GENERIC:618 case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_GENERIC: 567 619 DumpPccSubspaceType0 ( 568 620 PccSubspacePtr, … … 570 622 ); 571 623 break; 572 case EFI_ACPI_6_ 3_PCCT_SUBSPACE_TYPE_1_HW_REDUCED_COMMUNICATIONS:624 case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_1_HW_REDUCED_COMMUNICATIONS: 573 625 DumpPccSubspaceType1 ( 574 626 PccSubspacePtr, … … 576 628 ); 577 629 break; 578 case EFI_ACPI_6_ 3_PCCT_SUBSPACE_TYPE_2_HW_REDUCED_COMMUNICATIONS:630 case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_2_HW_REDUCED_COMMUNICATIONS: 579 631 DumpPccSubspaceType2 ( 580 632 PccSubspacePtr, … … 582 634 ); 583 635 break; 584 case EFI_ACPI_6_ 3_PCCT_SUBSPACE_TYPE_3_EXTENDED_PCC:636 case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_3_EXTENDED_PCC: 585 637 DumpPccSubspaceType3 ( 586 638 PccSubspacePtr, … … 588 640 ); 589 641 break; 590 case EFI_ACPI_6_ 3_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC:642 case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC: 591 643 DumpPccSubspaceType4 ( 644 PccSubspacePtr, 645 *PccSubspaceLength 646 ); 647 break; 648 case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_5_HW_REGISTERS_COMMUNICATIONS: 649 DumpPccSubspaceType5 ( 592 650 PccSubspacePtr, 593 651 *PccSubspaceLength … … 598 656 Print ( 599 657 L"ERROR: Unknown PCC subspace structure:" 600 658 L" Type = %u, Length = %u\n", 601 659 PccSubspaceType, 602 660 *PccSubspaceLength … … 605 663 606 664 PccSubspacePtr += *PccSubspaceLength; 607 Offset += *PccSubspaceLength;665 Offset += *PccSubspaceLength; 608 666 SubspaceCount++; 609 667 } // while -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.h
r89983 r99404 12 12 Minimum value for the 'length' field in subspaces of types 0, 1 and 2. 13 13 */ 14 #define MIN_MEMORY_RANGE_LENGTH 14 #define MIN_MEMORY_RANGE_LENGTH 8 15 15 16 16 /** 17 17 Minimum value for the 'length' field in subspaces of types 3 and 4. 18 18 */ 19 #define MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN 19 #define MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN 16 20 20 21 21 /** 22 22 Maximum number of PCC subspaces. 23 23 */ 24 #define MAX_PCC_SUBSPACES 24 #define MAX_PCC_SUBSPACES 256 25 25 26 26 /** -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c
r89983 r99404 2 2 PPTT table parser 3 3 4 Copyright (c) 2019 - 202 0, ARM Limited. All rights reserved.4 Copyright (c) 2019 - 2021, ARM Limited. All rights reserved. 5 5 SPDX-License-Identifier: BSD-2-Clause-Patent 6 6 7 7 @par Reference(s): 8 - ACPI 6. 3 Specification - January 20198 - ACPI 6.4 Specification - January 2021 9 9 - ARM Architecture Reference Manual ARMv8 (D.a) 10 10 **/ … … 18 18 19 19 // Local variables 20 STATIC CONST UINT8* ProcessorTopologyStructureType; 21 STATIC CONST UINT8* ProcessorTopologyStructureLength; 22 STATIC CONST UINT32* NumberOfPrivateResources; 23 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 20 STATIC CONST UINT8 *ProcessorTopologyStructureType; 21 STATIC CONST UINT8 *ProcessorTopologyStructureLength; 22 STATIC CONST UINT32 *NumberOfPrivateResources; 23 STATIC CONST EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE_FLAGS *CacheFlags; 24 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 25 26 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) 27 28 /** 29 Increment the error count and print an error that a required flag is missing. 30 31 @param [in] FlagName Name of the missing flag. 32 **/ 33 STATIC 34 VOID 35 EFIAPI 36 LogCacheFlagError ( 37 IN CONST CHAR16 *FlagName 38 ) 39 { 40 IncrementErrorCount (); 41 Print ( 42 L"\nERROR: On Arm based systems, all cache properties must be" 43 L" provided in the cache type structure." 44 L" Missing '%s' flag.", 45 FlagName 46 ); 47 } 48 49 #endif 50 51 /** 52 This function validates the Cache Type Structure (Type 1) Cache Flags field. 53 54 @param [in] Ptr Pointer to the start of the field data. 55 @param [in] Context Pointer to context specific information e.g. this 56 could be a pointer to the ACPI table header. 57 **/ 58 STATIC 59 VOID 60 EFIAPI 61 ValidateCacheFlags ( 62 IN UINT8 *Ptr, 63 IN VOID *Context 64 ) 65 { 66 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) 67 CacheFlags = (EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE_FLAGS *)Ptr; 68 69 if (CacheFlags == NULL) { 70 IncrementErrorCount (); 71 Print (L"\nERROR: Cache Structure Flags were not successfully read."); 72 return; 73 } 74 75 if (CacheFlags->SizePropertyValid == EFI_ACPI_6_4_PPTT_CACHE_SIZE_INVALID) { 76 LogCacheFlagError (L"Size Property Valid"); 77 } 78 79 if (CacheFlags->NumberOfSetsValid == EFI_ACPI_6_4_PPTT_NUMBER_OF_SETS_INVALID) { 80 LogCacheFlagError (L"Number Of Sets Valid"); 81 } 82 83 if (CacheFlags->AssociativityValid == EFI_ACPI_6_4_PPTT_ASSOCIATIVITY_INVALID) { 84 LogCacheFlagError (L"Associativity Valid"); 85 } 86 87 if (CacheFlags->AllocationTypeValid == EFI_ACPI_6_4_PPTT_ALLOCATION_TYPE_INVALID) { 88 LogCacheFlagError (L"Allocation Type Valid"); 89 } 90 91 if (CacheFlags->CacheTypeValid == EFI_ACPI_6_4_PPTT_CACHE_TYPE_INVALID) { 92 LogCacheFlagError (L"Cache Type Valid"); 93 } 94 95 if (CacheFlags->WritePolicyValid == EFI_ACPI_6_4_PPTT_WRITE_POLICY_INVALID) { 96 LogCacheFlagError (L"Write Policy Valid"); 97 } 98 99 if (CacheFlags->LineSizeValid == EFI_ACPI_6_4_PPTT_LINE_SIZE_INVALID) { 100 LogCacheFlagError (L"Line Size Valid"); 101 } 102 103 // Cache ID was only introduced in revision 3 104 if (*(AcpiHdrInfo.Revision) >= 3) { 105 if (CacheFlags->CacheIdValid == EFI_ACPI_6_4_PPTT_CACHE_ID_INVALID) { 106 LogCacheFlagError (L"Cache Id Valid"); 107 } 108 } 109 110 #endif 111 } 24 112 25 113 /** … … 35 123 EFIAPI 36 124 ValidateCacheNumberOfSets ( 37 IN UINT8* Ptr, 38 IN VOID* Context 39 ) 40 { 41 UINT32 NumberOfSets; 42 NumberOfSets = *(UINT32*)Ptr; 125 IN UINT8 *Ptr, 126 IN VOID *Context 127 ) 128 { 129 UINT32 NumberOfSets; 130 131 NumberOfSets = *(UINT32 *)Ptr; 43 132 44 133 if (NumberOfSets == 0) { … … 48 137 } 49 138 50 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)139 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) 51 140 if (NumberOfSets > PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX) { 52 141 IncrementErrorCount (); 53 142 Print ( 54 143 L"\nERROR: When ARMv8.3-CCIDX is implemented the maximum cache number of " 55 144 L"sets must be less than or equal to %d", 56 145 PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX 57 146 ); … … 63 152 Print ( 64 153 L"\nWARNING: Without ARMv8.3-CCIDX, the maximum cache number of sets " 65 66 154 L"must be less than or equal to %d. Ignore this message if " 155 L"ARMv8.3-CCIDX is implemented", 67 156 PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX 68 157 ); 69 158 return; 70 159 } 71 #endif 72 160 161 #endif 73 162 } 74 163 … … 85 174 EFIAPI 86 175 ValidateCacheAssociativity ( 87 IN UINT8* Ptr, 88 IN VOID* Context 89 ) 90 { 91 UINT8 Associativity; 92 Associativity = *(UINT8*)Ptr; 176 IN UINT8 *Ptr, 177 IN VOID *Context 178 ) 179 { 180 UINT8 Associativity; 181 182 Associativity = *(UINT8 *)Ptr; 93 183 94 184 if (Associativity == 0) { … … 110 200 EFIAPI 111 201 ValidateCacheLineSize ( 112 IN UINT8 *Ptr,113 IN VOID *Context114 ) 115 { 116 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)202 IN UINT8 *Ptr, 203 IN VOID *Context 204 ) 205 { 206 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) 117 207 // Reference: ARM Architecture Reference Manual ARMv8 (D.a) 118 208 // Section D12.2.25: CCSIDR_EL1, Current Cache Size ID Register … … 120 210 // (Log2(Number of bytes in cache line)) - 4. 121 211 122 UINT16 LineSize;123 LineSize = *(UINT16 *)Ptr;212 UINT16 LineSize; 213 LineSize = *(UINT16 *)Ptr; 124 214 125 215 if ((LineSize < PPTT_ARM_CACHE_LINE_SIZE_MIN) || 126 (LineSize > PPTT_ARM_CACHE_LINE_SIZE_MAX)) { 216 (LineSize > PPTT_ARM_CACHE_LINE_SIZE_MAX)) 217 { 127 218 IncrementErrorCount (); 128 219 Print ( 129 220 L"\nERROR: The cache line size must be between %d and %d bytes" 130 221 L" on ARM Platforms.", 131 222 PPTT_ARM_CACHE_LINE_SIZE_MIN, 132 223 PPTT_ARM_CACHE_LINE_SIZE_MAX … … 139 230 Print (L"\nERROR: The cache line size is not a power of 2."); 140 231 } 141 #endif 142 } 143 144 /** 145 This function validates the Cache Type Structure (Type 1) Attributes field. 232 233 #endif 234 } 235 236 /** 237 This function validates the Cache Type Structure (Type 1) Cache ID field. 146 238 147 239 @param [in] Ptr Pointer to the start of the field data. … … 152 244 VOID 153 245 EFIAPI 246 ValidateCacheId ( 247 IN UINT8 *Ptr, 248 IN VOID *Context 249 ) 250 { 251 UINT32 CacheId; 252 253 CacheId = *(UINT32 *)Ptr; 254 255 // Cache ID was only introduced in revision 3 256 if (*(AcpiHdrInfo.Revision) < 3) { 257 return; 258 } 259 260 if (CacheFlags == NULL) { 261 IncrementErrorCount (); 262 Print (L"\nERROR: Cache Structure Flags were not successfully read."); 263 return; 264 } 265 266 if (CacheFlags->CacheIdValid == EFI_ACPI_6_4_PPTT_CACHE_ID_VALID) { 267 if (CacheId == 0) { 268 IncrementErrorCount (); 269 Print (L"\nERROR: 0 is not a valid Cache ID."); 270 return; 271 } 272 } 273 } 274 275 /** 276 This function validates the Cache Type Structure (Type 1) Attributes field. 277 278 @param [in] Ptr Pointer to the start of the field data. 279 @param [in] Context Pointer to context specific information e.g. this 280 could be a pointer to the ACPI table header. 281 **/ 282 STATIC 283 VOID 284 EFIAPI 154 285 ValidateCacheAttributes ( 155 IN UINT8 *Ptr,156 IN VOID *Context286 IN UINT8 *Ptr, 287 IN VOID *Context 157 288 ) 158 289 { 159 290 // Reference: Advanced Configuration and Power Interface (ACPI) Specification 160 // Version 6.2 Errata A, September 2017 161 // Table 5-153: Cache Type Structure 162 UINT8 Attributes; 163 Attributes = *(UINT8*)Ptr; 291 // Version 6.4, January 2021 292 // Table 5-140: Cache Type Structure 293 UINT8 Attributes; 294 295 Attributes = *(UINT8 *)Ptr; 164 296 165 297 if ((Attributes & 0xE0) != 0) { … … 176 308 An ACPI_PARSER array describing the ACPI PPTT Table. 177 309 **/ 178 STATIC CONST ACPI_PARSER PpttParser[] = {310 STATIC CONST ACPI_PARSER PpttParser[] = { 179 311 PARSE_ACPI_HEADER (&AcpiHdrInfo) 180 312 }; … … 183 315 An ACPI_PARSER array describing the processor topology structure header. 184 316 **/ 185 STATIC CONST ACPI_PARSER ProcessorTopologyStructureHeaderParser[] = {186 { L"Type", 1, 0, NULL, NULL, (VOID**)&ProcessorTopologyStructureType,187 NULL, NULL},188 { L"Length", 1, 1, NULL, NULL, (VOID**)&ProcessorTopologyStructureLength,189 NULL, NULL},190 { L"Reserved", 2, 2, NULL, NULL, NULL, NULL, NULL}317 STATIC CONST ACPI_PARSER ProcessorTopologyStructureHeaderParser[] = { 318 { L"Type", 1, 0, NULL, NULL, (VOID **)&ProcessorTopologyStructureType, 319 NULL, NULL }, 320 { L"Length", 1, 1, NULL, NULL, (VOID **)&ProcessorTopologyStructureLength, 321 NULL, NULL }, 322 { L"Reserved", 2, 2, NULL, NULL, NULL, NULL,NULL } 191 323 }; 192 324 … … 194 326 An ACPI_PARSER array describing the Processor Hierarchy Node Structure - Type 0. 195 327 **/ 196 STATIC CONST ACPI_PARSER ProcessorHierarchyNodeStructureParser[] = {197 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},198 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL},199 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},200 201 { L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},202 { L"Parent", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},203 { L"ACPI Processor ID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},204 { L"Number of private resources", 4, 16, L"%d",NULL,205 (VOID**)&NumberOfPrivateResources, NULL, NULL}328 STATIC CONST ACPI_PARSER ProcessorHierarchyNodeStructureParser[] = { 329 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 330 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL }, 331 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL }, 332 333 { L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 334 { L"Parent", 4, 8, L"0x%x", NULL, NULL, NULL, NULL }, 335 { L"ACPI Processor ID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }, 336 { L"Number of private resources", 4, 16, L"%d", NULL, 337 (VOID **)&NumberOfPrivateResources, NULL, NULL } 206 338 }; 207 339 … … 209 341 An ACPI_PARSER array describing the Cache Type Structure - Type 1. 210 342 **/ 211 STATIC CONST ACPI_PARSER CacheTypeStructureParser[] = { 212 {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, 213 {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, 214 {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, 215 216 {L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, 217 {L"Next Level of Cache", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, 218 {L"Size", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}, 219 {L"Number of sets", 4, 16, L"%d", NULL, NULL, ValidateCacheNumberOfSets, NULL}, 220 {L"Associativity", 1, 20, L"%d", NULL, NULL, ValidateCacheAssociativity, NULL}, 221 {L"Attributes", 1, 21, L"0x%x", NULL, NULL, ValidateCacheAttributes, NULL}, 222 {L"Line size", 2, 22, L"%d", NULL, NULL, ValidateCacheLineSize, NULL} 223 }; 224 225 /** 226 An ACPI_PARSER array describing the ID Type Structure - Type 2. 227 **/ 228 STATIC CONST ACPI_PARSER IdStructureParser[] = { 229 {L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL}, 230 {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, 231 {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, 232 233 {L"VENDOR_ID", 4, 4, NULL, Dump4Chars, NULL, NULL, NULL}, 234 {L"LEVEL_1_ID", 8, 8, L"0x%x", NULL, NULL, NULL, NULL}, 235 {L"LEVEL_2_ID", 8, 16, L"0x%x", NULL, NULL, NULL, NULL}, 236 {L"MAJOR_REV", 2, 24, L"0x%x", NULL, NULL, NULL, NULL}, 237 {L"MINOR_REV", 2, 26, L"0x%x", NULL, NULL, NULL, NULL}, 238 {L"SPIN_REV", 2, 28, L"0x%x", NULL, NULL, NULL, NULL}, 343 STATIC CONST ACPI_PARSER CacheTypeStructureParser[] = { 344 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 345 { L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL }, 346 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL }, 347 348 { L"Flags", 4, 4, L"0x%x", NULL, (VOID **)&CacheFlags, ValidateCacheFlags, 349 NULL }, 350 { L"Next Level of Cache", 4, 8, L"0x%x", NULL, NULL, NULL, NULL }, 351 { L"Size", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }, 352 { L"Number of sets", 4, 16, L"%d", NULL, NULL, ValidateCacheNumberOfSets, NULL }, 353 { L"Associativity", 1, 20, L"%d", NULL, NULL, ValidateCacheAssociativity, NULL }, 354 { L"Attributes", 1, 21, L"0x%x", NULL, NULL, ValidateCacheAttributes, NULL }, 355 { L"Line size", 2, 22, L"%d", NULL, NULL, ValidateCacheLineSize, NULL }, 356 { L"Cache ID", 4, 24, L"%d", NULL, NULL, ValidateCacheId, NULL } 239 357 }; 240 358 … … 249 367 VOID 250 368 DumpProcessorHierarchyNodeStructure ( 251 IN UINT8 *Ptr,369 IN UINT8 *Ptr, 252 370 IN UINT8 Length 253 371 ) 254 372 { 255 UINT32 Offset;256 UINT32 Index;257 CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];373 UINT32 Offset; 374 UINT32 Index; 375 CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH]; 258 376 259 377 Offset = ParseAcpi ( … … 282 400 Print ( 283 401 L"ERROR: Invalid Number of Private Resources. " \ 284 285 402 L"PrivateResourceCount = %d. RemainingBufferLength = %d. " \ 403 L"Parsing of this structure aborted.\n", 286 404 *NumberOfPrivateResources, 287 405 Length - Offset … … 305 423 Print ( 306 424 L"0x%x\n", 307 *((UINT32 *)(Ptr + Offset))425 *((UINT32 *)(Ptr + Offset)) 308 426 ); 309 427 … … 322 440 VOID 323 441 DumpCacheTypeStructure ( 324 IN UINT8 *Ptr,442 IN UINT8 *Ptr, 325 443 IN UINT8 Length 326 444 ) … … 337 455 338 456 /** 339 This function parses the ID Structure (Type 2).340 341 @param [in] Ptr Pointer to the start of the ID Structure data.342 @param [in] Length Length of the ID Structure.343 **/344 STATIC345 VOID346 DumpIDStructure (347 IN UINT8* Ptr,348 IN UINT8 Length349 )350 {351 ParseAcpi (352 TRUE,353 2,354 "ID Structure",355 Ptr,356 Length,357 PARSER_PARAMS (IdStructureParser)358 );359 }360 361 /**362 457 This function parses the ACPI PPTT table. 363 458 When trace is enabled this function parses the PPTT table and … … 367 462 - Processor hierarchy node structure (Type 0) 368 463 - Cache Type Structure (Type 1) 369 - ID structure (Type 2)370 464 371 465 This function also performs validation of the ACPI table fields. … … 379 473 EFIAPI 380 474 ParseAcpiPptt ( 381 IN BOOLEAN Trace,382 IN UINT8 *Ptr,383 IN UINT32 AcpiTableLength,384 IN UINT8 AcpiTableRevision385 ) 386 { 387 UINT32 Offset;388 UINT8 *ProcessorTopologyStructurePtr;475 IN BOOLEAN Trace, 476 IN UINT8 *Ptr, 477 IN UINT32 AcpiTableLength, 478 IN UINT8 AcpiTableRevision 479 ) 480 { 481 UINT32 Offset; 482 UINT8 *ProcessorTopologyStructurePtr; 389 483 390 484 if (!Trace) { … … 417 511 // successfully read. 418 512 if ((ProcessorTopologyStructureType == NULL) || 419 (ProcessorTopologyStructureLength == NULL)) { 513 (ProcessorTopologyStructureLength == NULL)) 514 { 420 515 IncrementErrorCount (); 421 516 Print ( 422 517 L"ERROR: Insufficient remaining table buffer length to read the " \ 423 518 L"processor topology structure header. Length = %d.\n", 424 519 AcpiTableLength - Offset 425 520 ); … … 429 524 // Validate Processor Topology Structure length 430 525 if ((*ProcessorTopologyStructureLength == 0) || 431 ((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength)) { 526 ((Offset + (*ProcessorTopologyStructureLength)) > AcpiTableLength)) 527 { 432 528 IncrementErrorCount (); 433 529 Print ( 434 530 L"ERROR: Invalid Processor Topology Structure length. " \ 435 531 L"Length = %d. Offset = %d. AcpiTableLength = %d.\n", 436 532 *ProcessorTopologyStructureLength, 437 533 Offset, … … 445 541 446 542 switch (*ProcessorTopologyStructureType) { 447 case EFI_ACPI_6_ 2_PPTT_TYPE_PROCESSOR:543 case EFI_ACPI_6_4_PPTT_TYPE_PROCESSOR: 448 544 DumpProcessorHierarchyNodeStructure ( 449 545 ProcessorTopologyStructurePtr, … … 451 547 ); 452 548 break; 453 case EFI_ACPI_6_ 2_PPTT_TYPE_CACHE:549 case EFI_ACPI_6_4_PPTT_TYPE_CACHE: 454 550 DumpCacheTypeStructure ( 455 551 ProcessorTopologyStructurePtr, … … 457 553 ); 458 554 break; 459 case EFI_ACPI_6_2_PPTT_TYPE_ID: 460 DumpIDStructure ( 461 ProcessorTopologyStructurePtr, 462 *ProcessorTopologyStructureLength 555 case EFI_ACPI_6_3_PPTT_TYPE_ID: 556 IncrementErrorCount (); 557 Print ( 558 L"ERROR: PPTT Type 2 - Processor ID has been removed and must not be" 559 L"used.\n" 463 560 ); 464 561 break; … … 467 564 Print ( 468 565 L"ERROR: Unknown processor topology structure:" 469 566 L" Type = %d, Length = %d\n", 470 567 *ProcessorTopologyStructureType, 471 568 *ProcessorTopologyStructureLength … … 474 571 475 572 ProcessorTopologyStructurePtr += *ProcessorTopologyStructureLength; 476 Offset += *ProcessorTopologyStructureLength;573 Offset += *ProcessorTopologyStructureLength; 477 574 } // while 478 575 } -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.h
r80721 r99404 17 17 /// ARMv8.3-CCIDX (Cache extended number of sets) 18 18 /// Derived from CCSIDR_EL1 when ID_AA64MMFR2_EL1.CCIDX==0001 19 #define PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX 20 #define PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX 19 #define PPTT_ARM_CCIDX_CACHE_NUMBER_OF_SETS_MAX (1 << 24) 20 #define PPTT_ARM_CCIDX_CACHE_ASSOCIATIVITY_MAX (1 << 21) 21 21 22 22 /// Cache parameters allowed by the architecture without 23 23 /// ARMv8.3-CCIDX (Cache extended number of sets) 24 24 /// Derived from CCSIDR_EL1 when ID_AA64MMFR2_EL1.CCIDX==0000 25 #define PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX 26 #define PPTT_ARM_CACHE_ASSOCIATIVITY_MAX 25 #define PPTT_ARM_CACHE_NUMBER_OF_SETS_MAX (1 << 15) 26 #define PPTT_ARM_CACHE_ASSOCIATIVITY_MAX (1 << 10) 27 27 28 28 /// Common cache parameters … … 31 31 /// (Log2(Number of bytes in cache line)) - 4 is used to represent 32 32 /// the LineSize bits. 33 #define PPTT_ARM_CACHE_LINE_SIZE_MAX 34 #define PPTT_ARM_CACHE_LINE_SIZE_MIN 33 #define PPTT_ARM_CACHE_LINE_SIZE_MAX (1 << 11) 34 #define PPTT_ARM_CACHE_LINE_SIZE_MIN (1 << 4) 35 35 36 36 #endif // if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c
r85718 r99404 14 14 15 15 // Local Variables 16 STATIC CONST UINT64 *XsdtAddress;16 STATIC CONST UINT64 *XsdtAddress; 17 17 18 18 /** … … 27 27 EFIAPI 28 28 ValidateRsdtAddress ( 29 IN UINT8 *Ptr,30 IN VOID *Context29 IN UINT8 *Ptr, 30 IN VOID *Context 31 31 ) 32 32 { 33 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)33 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) 34 34 // Reference: Server Base Boot Requirements System Software on ARM Platforms 35 35 // Section: 4.2.1.1 RSDP … … 37 37 // - Within the RSDP, the RsdtAddress field must be null (zero) and the 38 38 // XsdtAddresss MUST be a valid, non-null, 64-bit value. 39 UINT32 RsdtAddr;39 UINT32 RsdtAddr; 40 40 41 RsdtAddr = *(UINT32 *)Ptr;41 RsdtAddr = *(UINT32 *)Ptr; 42 42 43 43 if (RsdtAddr != 0) { … … 48 48 ); 49 49 } 50 #endif 50 51 #endif 51 52 } 52 53 … … 62 63 EFIAPI 63 64 ValidateXsdtAddress ( 64 IN UINT8 *Ptr,65 IN VOID *Context65 IN UINT8 *Ptr, 66 IN VOID *Context 66 67 ) 67 68 { 68 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)69 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) 69 70 // Reference: Server Base Boot Requirements System Software on ARM Platforms 70 71 // Section: 4.2.1.1 RSDP … … 72 73 // - Within the RSDP, the RsdtAddress field must be null (zero) and the 73 74 // XsdtAddresss MUST be a valid, non-null, 64-bit value. 74 UINT64 XsdtAddr;75 UINT64 XsdtAddr; 75 76 76 XsdtAddr = *(UINT64 *)Ptr;77 XsdtAddr = *(UINT64 *)Ptr; 77 78 78 79 if (XsdtAddr == 0) { … … 83 84 ); 84 85 } 85 #endif 86 87 #endif 86 88 } 87 89 … … 89 91 An array describing the ACPI RSDP Table. 90 92 **/ 91 STATIC CONST ACPI_PARSER RsdpParser[] = {92 { L"Signature", 8, 0, NULL, Dump8Chars, NULL, NULL, NULL},93 { L"Checksum", 1, 8, L"0x%x", NULL, NULL, NULL, NULL},94 { L"Oem ID", 6, 9, NULL, Dump6Chars, NULL, NULL, NULL},95 { L"Revision", 1, 15, L"%d", NULL, NULL, NULL, NULL},96 { L"RSDT Address", 4, 16, L"0x%x", NULL, NULL, ValidateRsdtAddress, NULL},97 { L"Length", 4, 20, L"%d", NULL, NULL, NULL, NULL},98 { L"XSDT Address", 8, 24, L"0x%lx", NULL, (VOID**)&XsdtAddress,99 ValidateXsdtAddress, NULL},100 { L"Extended Checksum", 1, 32, L"0x%x", NULL, NULL, NULL, NULL},101 { L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}93 STATIC CONST ACPI_PARSER RsdpParser[] = { 94 { L"Signature", 8, 0, NULL, Dump8Chars, NULL, NULL, NULL }, 95 { L"Checksum", 1, 8, L"0x%x", NULL, NULL, NULL, NULL }, 96 { L"Oem ID", 6, 9, NULL, Dump6Chars, NULL, NULL, NULL }, 97 { L"Revision", 1, 15, L"%d", NULL, NULL, NULL, NULL }, 98 { L"RSDT Address", 4, 16, L"0x%x", NULL, NULL, ValidateRsdtAddress, NULL }, 99 { L"Length", 4, 20, L"%d", NULL, NULL, NULL, NULL }, 100 { L"XSDT Address", 8, 24, L"0x%lx", NULL, (VOID **)&XsdtAddress, 101 ValidateXsdtAddress, NULL }, 102 { L"Extended Checksum", 1, 32, L"0x%x", NULL, NULL, NULL, NULL }, 103 { L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL } 102 104 }; 103 105 … … 119 121 EFIAPI 120 122 ParseAcpiRsdp ( 121 IN BOOLEAN Trace,122 IN UINT8 *Ptr,123 IN UINT32 AcpiTableLength,124 IN UINT8 AcpiTableRevision123 IN BOOLEAN Trace, 124 IN UINT8 *Ptr, 125 IN UINT32 AcpiTableLength, 126 IN UINT8 AcpiTableRevision 125 127 ) 126 128 { … … 145 147 Print ( 146 148 L"ERROR: Insufficient table length. AcpiTableLength = %d." \ 147 149 L"RSDP parsing aborted.\n", 148 150 AcpiTableLength 149 151 ); … … 161 163 } 162 164 163 ProcessAcpiTable ((UINT8 *)(UINTN)(*XsdtAddress));165 ProcessAcpiTable ((UINT8 *)(UINTN)(*XsdtAddress)); 164 166 } -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c
r85718 r99404 16 16 17 17 // Local Variables 18 STATIC CONST UINT64 *SlitSystemLocalityCount;19 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;18 STATIC CONST UINT64 *SlitSystemLocalityCount; 19 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 20 20 21 21 /** 22 22 An ACPI_PARSER array describing the ACPI SLIT table. 23 23 **/ 24 STATIC CONST ACPI_PARSER SlitParser[] = {24 STATIC CONST ACPI_PARSER SlitParser[] = { 25 25 PARSE_ACPI_HEADER (&AcpiHdrInfo), 26 { L"Number of System Localities", 8,36, L"0x%lx", NULL,27 (VOID**)&SlitSystemLocalityCount, NULL, NULL}26 { L"Number of System Localities", 8, 36, L"0x%lx", NULL, 27 (VOID **)&SlitSystemLocalityCount,NULL, NULL } 28 28 }; 29 29 … … 31 31 Macro to get the value of a System Locality 32 32 **/ 33 #define SLIT_ELEMENT(Ptr, i, j) *(Ptr + (i * LocalityCount) + j)33 #define SLIT_ELEMENT(Ptr, i, j) *(Ptr + (i * LocalityCount) + j) 34 34 35 35 /** … … 51 51 EFIAPI 52 52 ParseAcpiSlit ( 53 IN BOOLEAN Trace,54 IN UINT8 *Ptr,55 IN UINT32 AcpiTableLength,56 IN UINT8 AcpiTableRevision53 IN BOOLEAN Trace, 54 IN UINT8 *Ptr, 55 IN UINT32 AcpiTableLength, 56 IN UINT8 AcpiTableRevision 57 57 ) 58 58 { 59 UINT32 Offset;60 UINT32 Count;61 UINT32 Index;62 UINT32 LocalityCount;63 UINT8 *LocalityPtr;64 CHAR16 Buffer[80];// Used for AsciiName param of ParseAcpi59 UINT32 Offset; 60 UINT32 Count; 61 UINT32 Index; 62 UINT32 LocalityCount; 63 UINT8 *LocalityPtr; 64 CHAR16 Buffer[80]; // Used for AsciiName param of ParseAcpi 65 65 66 66 if (!Trace) { … … 104 104 Print ( 105 105 L"ERROR: The Number of System Localities provided can't be represented " \ 106 107 106 L"in the SLIT table. SlitSystemLocalityCount = %ld. " \ 107 L"MaxLocalityCountAllowed = %d.\n", 108 108 *SlitSystemLocalityCount, 109 109 MAX_UINT16 … … 119 119 Print ( 120 120 L"ERROR: Invalid Number of System Localities. " \ 121 121 L"SlitSystemLocalityCount = %ld. AcpiTableLength = %d.\n", 122 122 *SlitSystemLocalityCount, 123 123 AcpiTableLength … … 145 145 Print (L" (%3d) ", Index); 146 146 } 147 147 148 Print (L"\n"); 148 for (Count = 0; Count < LocalityCount; Count++) {149 for (Count = 0; Count < LocalityCount; Count++) { 149 150 Print (L" (%3d) ", Count); 150 151 for (Index = 0; Index < LocalityCount; Index++) { 151 152 Print (L" %3d ", SLIT_ELEMENT (LocalityPtr, Count, Index)); 152 153 } 154 153 155 Print (L"\n"); 154 156 } … … 159 161 for (Index = 0; Index < LocalityCount; Index++) { 160 162 // Element[x][x] must be equal to 10 161 if ((Count == Index) && (SLIT_ELEMENT (LocalityPtr, Count, Index) != 10)) {163 if ((Count == Index) && (SLIT_ELEMENT (LocalityPtr, Count, Index) != 10)) { 162 164 IncrementErrorCount (); 163 165 Print ( 164 166 L"ERROR: Diagonal Element[0x%lx][0x%lx] (%3d)." 165 167 L" Normalized Value is not 10\n", 166 168 Count, 167 169 Index, … … 169 171 ); 170 172 } 173 171 174 // Element[i][j] must be equal to Element[j][i] 172 175 if (SLIT_ELEMENT (LocalityPtr, Count, Index) != 173 SLIT_ELEMENT (LocalityPtr, Index, Count)) { 176 SLIT_ELEMENT (LocalityPtr, Index, Count)) 177 { 174 178 IncrementErrorCount (); 175 179 Print ( 176 180 L"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and \n" 177 181 L"Element[0x%lx][0x%lx] (%3d) do not match.\n", 178 182 Count, 179 183 Index, -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c
r80721 r99404 17 17 18 18 // Local variables 19 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;19 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 20 20 21 21 /** … … 30 30 EFIAPI 31 31 ValidateInterruptType ( 32 IN UINT8 *Ptr,33 IN VOID *Context32 IN UINT8 *Ptr, 33 IN VOID *Context 34 34 ) 35 35 { 36 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)37 UINT8 InterruptType;36 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) 37 UINT8 InterruptType; 38 38 39 39 InterruptType = *Ptr; 40 40 41 41 if (InterruptType != 42 EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC) { 42 EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC) 43 { 43 44 IncrementErrorCount (); 44 45 Print ( … … 47 48 ); 48 49 } 49 #endif 50 51 #endif 50 52 } 51 53 … … 61 63 EFIAPI 62 64 ValidateIrq ( 63 IN UINT8 *Ptr,64 IN VOID *Context65 IN UINT8 *Ptr, 66 IN VOID *Context 65 67 ) 66 68 { 67 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)68 UINT8 Irq;69 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) 70 UINT8 Irq; 69 71 70 72 Irq = *Ptr; … … 77 79 ); 78 80 } 79 #endif 81 82 #endif 80 83 } 81 84 … … 83 86 An ACPI_PARSER array describing the ACPI SPCR Table. 84 87 **/ 85 STATIC CONST ACPI_PARSER SpcrParser[] = {88 STATIC CONST ACPI_PARSER SpcrParser[] = { 86 89 PARSE_ACPI_HEADER (&AcpiHdrInfo), 87 { L"Interface Type", 1, 36, L"%d", NULL, NULL, NULL, NULL},88 { L"Reserved", 3, 37, L"%x %x %x", Dump3Chars, NULL, NULL, NULL},89 { L"Base Address", 12, 40, NULL, DumpGas, NULL, NULL, NULL},90 { L"Interrupt Type", 1, 52, L"%d", NULL, NULL, ValidateInterruptType, NULL},91 { L"IRQ", 1, 53, L"%d", NULL, NULL, ValidateIrq, NULL},92 { L"Global System Interrupt", 4, 54, L"0x%x", NULL, NULL, NULL, NULL},93 { L"Baud Rate", 1, 58, L"%d", NULL, NULL, NULL, NULL},94 { L"Parity", 1, 59, L"%d", NULL, NULL, NULL, NULL},95 { L"Stop Bits", 1, 60, L"%d", NULL, NULL, NULL, NULL},96 { L"Flow Control", 1, 61, L"0x%x", NULL, NULL, NULL, NULL},97 { L"Terminal Type", 1, 62, L"%d", NULL, NULL, NULL, NULL},98 { L"Reserved", 1, 63, L"%x", NULL, NULL, NULL, NULL},90 { L"Interface Type", 1, 36, L"%d", NULL, NULL, NULL, NULL }, 91 { L"Reserved", 3, 37, L"%x %x %x", Dump3Chars, NULL, NULL, NULL }, 92 { L"Base Address", 12, 40, NULL, DumpGas, NULL, NULL, NULL }, 93 { L"Interrupt Type", 1, 52, L"%d", NULL, NULL, ValidateInterruptType, NULL }, 94 { L"IRQ", 1, 53, L"%d", NULL, NULL, ValidateIrq, NULL }, 95 { L"Global System Interrupt", 4, 54, L"0x%x", NULL, NULL, NULL, NULL }, 96 { L"Baud Rate", 1, 58, L"%d", NULL, NULL, NULL, NULL }, 97 { L"Parity", 1, 59, L"%d", NULL, NULL, NULL, NULL }, 98 { L"Stop Bits", 1, 60, L"%d", NULL, NULL, NULL, NULL }, 99 { L"Flow Control", 1, 61, L"0x%x", NULL, NULL, NULL, NULL }, 100 { L"Terminal Type", 1, 62, L"%d", NULL, NULL, NULL, NULL }, 101 { L"Reserved", 1, 63, L"%x", NULL, NULL, NULL, NULL }, 99 102 100 { L"PCI Device ID", 2, 64, L"0x%x", NULL, NULL, NULL, NULL},101 { L"PCI Vendor ID", 2, 66, L"0x%x", NULL, NULL, NULL, NULL},102 { L"PCI Bus Number", 1, 68, L"0x%x", NULL, NULL, NULL, NULL},103 { L"PCI Device Number", 1, 69, L"0x%x", NULL, NULL, NULL, NULL},104 { L"PCI Function Number", 1, 70, L"0x%x", NULL, NULL, NULL, NULL},105 { L"PCI Flags", 4, 71, L"0x%x", NULL, NULL, NULL, NULL},106 { L"PCI Segment", 1, 75, L"0x%x", NULL, NULL, NULL, NULL},107 { L"Reserved", 4, 76, L"%x", NULL, NULL, NULL, NULL}103 { L"PCI Device ID", 2, 64, L"0x%x", NULL, NULL, NULL, NULL }, 104 { L"PCI Vendor ID", 2, 66, L"0x%x", NULL, NULL, NULL, NULL }, 105 { L"PCI Bus Number", 1, 68, L"0x%x", NULL, NULL, NULL, NULL }, 106 { L"PCI Device Number", 1, 69, L"0x%x", NULL, NULL, NULL, NULL }, 107 { L"PCI Function Number", 1, 70, L"0x%x", NULL, NULL, NULL, NULL }, 108 { L"PCI Flags", 4, 71, L"0x%x", NULL, NULL, NULL, NULL }, 109 { L"PCI Segment", 1, 75, L"0x%x", NULL, NULL, NULL, NULL }, 110 { L"Reserved", 4, 76, L"%x", NULL, NULL, NULL, NULL } 108 111 }; 109 112 … … 123 126 EFIAPI 124 127 ParseAcpiSpcr ( 125 IN BOOLEAN Trace,126 IN UINT8 *Ptr,127 IN UINT32 AcpiTableLength,128 IN UINT8 AcpiTableRevision128 IN BOOLEAN Trace, 129 IN UINT8 *Ptr, 130 IN UINT32 AcpiTableLength, 131 IN UINT8 AcpiTableRevision 129 132 ) 130 133 { -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c
r89983 r99404 17 17 18 18 // Local Variables 19 STATIC CONST UINT8 *SratRAType;20 STATIC CONST UINT8 *SratRALength;21 STATIC CONST UINT8 *SratDeviceHandleType;22 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;19 STATIC CONST UINT8 *SratRAType; 20 STATIC CONST UINT8 *SratRALength; 21 STATIC CONST UINT8 *SratDeviceHandleType; 22 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 23 23 24 24 /** … … 33 33 EFIAPI 34 34 ValidateSratReserved ( 35 IN UINT8 *Ptr,36 IN VOID *Context35 IN UINT8 *Ptr, 36 IN VOID *Context 37 37 ) 38 38 { 39 if (*(UINT32 *)Ptr != 1) {39 if (*(UINT32 *)Ptr != 1) { 40 40 IncrementErrorCount (); 41 41 Print (L"\nERROR: Reserved should be 1 for backward compatibility.\n"); … … 55 55 EFIAPI 56 56 ValidateSratDeviceHandleType ( 57 IN UINT8 *Ptr,58 IN VOID *Context57 IN UINT8 *Ptr, 58 IN VOID *Context 59 59 ) 60 60 { 61 UINT8 61 UINT8 DeviceHandleType; 62 62 63 63 DeviceHandleType = *Ptr; … … 83 83 EFIAPI 84 84 DumpSratPciBdfNumber ( 85 IN CONST CHAR16 *Format,86 IN UINT8 *Ptr85 IN CONST CHAR16 *Format, 86 IN UINT8 *Ptr 87 87 ) 88 88 { 89 CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH];89 CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH]; 90 90 91 91 Print (L"\n"); … … 144 144 An ACPI_PARSER array describing the Device Handle - ACPI 145 145 **/ 146 STATIC CONST ACPI_PARSER SratDeviceHandleAcpiParser[] = {147 { L"ACPI_HID", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL},148 { L"ACPI_UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},149 { L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}146 STATIC CONST ACPI_PARSER SratDeviceHandleAcpiParser[] = { 147 { L"ACPI_HID", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL }, 148 { L"ACPI_UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL }, 149 { L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL } 150 150 }; 151 151 … … 153 153 An ACPI_PARSER array describing the Device Handle - PCI 154 154 **/ 155 STATIC CONST ACPI_PARSER SratDeviceHandlePciParser[] = {156 { L"PCI Segment", 2, 0, L"0x%x", NULL, NULL, NULL, NULL},157 { L"PCI BDF Number", 2, 2, NULL, DumpSratPciBdfNumber, NULL, NULL, NULL},158 { L"Reserved",12, 4, L"%x %x %x %x - %x %x %x %x - %x %x %x %x", Dump12Chars,159 NULL, NULL, NULL}155 STATIC CONST ACPI_PARSER SratDeviceHandlePciParser[] = { 156 { L"PCI Segment", 2, 0, L"0x%x", NULL, NULL, NULL, NULL }, 157 { L"PCI BDF Number", 2, 2, NULL, DumpSratPciBdfNumber, NULL, NULL, NULL }, 158 { L"Reserved", 12, 4, L"%x %x %x %x - %x %x %x %x - %x %x %x %x", Dump12Chars, 159 NULL, NULL, NULL } 160 160 }; 161 161 … … 171 171 EFIAPI 172 172 DumpSratDeviceHandle ( 173 IN CONST CHAR16 *Format,174 IN UINT8 *Ptr175 )173 IN CONST CHAR16 *Format, 174 IN UINT8 *Ptr 175 ) 176 176 { 177 177 if (SratDeviceHandleType == NULL) { … … 214 214 EFIAPI 215 215 DumpSratApicProximity ( 216 IN CONST CHAR16*Format,217 IN UINT8*Ptr218 )216 IN CONST CHAR16 *Format, 217 IN UINT8 *Ptr 218 ) 219 219 { 220 UINT32 ProximityDomain;220 UINT32 ProximityDomain; 221 221 222 222 ProximityDomain = Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16); … … 228 228 An ACPI_PARSER array describing the SRAT Table. 229 229 **/ 230 STATIC CONST ACPI_PARSER SratParser[] = {230 STATIC CONST ACPI_PARSER SratParser[] = { 231 231 PARSE_ACPI_HEADER (&AcpiHdrInfo), 232 { L"Reserved", 4, 36, L"0x%x", NULL, NULL, ValidateSratReserved, NULL},233 { L"Reserved", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL}232 { L"Reserved", 4, 36, L"0x%x", NULL, NULL, ValidateSratReserved, NULL }, 233 { L"Reserved", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL } 234 234 }; 235 235 … … 237 237 An ACPI_PARSER array describing the Resource Allocation structure header. 238 238 **/ 239 STATIC CONST ACPI_PARSER SratResourceAllocationParser[] = {240 { L"Type", 1, 0, NULL, NULL, (VOID**)&SratRAType, NULL, NULL},241 { L"Length", 1, 1, NULL, NULL, (VOID**)&SratRALength, NULL, NULL}239 STATIC CONST ACPI_PARSER SratResourceAllocationParser[] = { 240 { L"Type", 1, 0, NULL, NULL, (VOID **)&SratRAType, NULL, NULL }, 241 { L"Length", 1, 1, NULL, NULL, (VOID **)&SratRALength, NULL, NULL } 242 242 }; 243 243 … … 245 245 An ACPI_PARSER array describing the GICC Affinity structure. 246 246 **/ 247 STATIC CONST ACPI_PARSER SratGicCAffinityParser[] = {248 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},249 { L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},250 251 { L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},252 { L"ACPI Processor UID", 4, 6, L"0x%x", NULL, NULL, NULL, NULL},253 { L"Flags", 4, 10, L"0x%x", NULL, NULL, NULL, NULL},254 { L"Clock Domain", 4, 14, L"0x%x", NULL, NULL, NULL, NULL}247 STATIC CONST ACPI_PARSER SratGicCAffinityParser[] = { 248 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 249 { L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL }, 250 251 { L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL }, 252 { L"ACPI Processor UID", 4, 6, L"0x%x", NULL, NULL, NULL, NULL }, 253 { L"Flags", 4, 10, L"0x%x", NULL, NULL, NULL, NULL }, 254 { L"Clock Domain", 4, 14, L"0x%x", NULL, NULL, NULL, NULL } 255 255 }; 256 256 … … 258 258 An ACPI_PARSER array describing the GIC ITS Affinity structure. 259 259 **/ 260 STATIC CONST ACPI_PARSER SratGicITSAffinityParser[] = {261 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},262 { L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},263 264 { L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},265 { L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL},266 { L"ITS Id", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},260 STATIC CONST ACPI_PARSER SratGicITSAffinityParser[] = { 261 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 262 { L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL }, 263 264 { L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL }, 265 { L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL }, 266 { L"ITS Id", 4, 8, L"0x%x", NULL, NULL, NULL, NULL }, 267 267 }; 268 268 … … 270 270 An ACPI_PARSER array describing the Generic Initiator Affinity Structure 271 271 **/ 272 STATIC CONST ACPI_PARSER SratGenericInitiatorAffinityParser[] = {273 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},274 { L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},275 276 { L"Reserved", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},277 { L"Device Handle Type", 1, 3, L"%d", NULL, (VOID**)&SratDeviceHandleType,278 ValidateSratDeviceHandleType, NULL},279 { L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},280 { L"Device Handle", 16, 8, L"%s", DumpSratDeviceHandle, NULL, NULL, NULL},281 { L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},282 { L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}272 STATIC CONST ACPI_PARSER SratGenericInitiatorAffinityParser[] = { 273 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 274 { L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL }, 275 276 { L"Reserved", 1, 2, L"0x%x", NULL, NULL, NULL, NULL }, 277 { L"Device Handle Type", 1, 3, L"%d", NULL, (VOID **)&SratDeviceHandleType, 278 ValidateSratDeviceHandleType, NULL }, 279 { L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 280 { L"Device Handle", 16, 8, L"%s", DumpSratDeviceHandle, NULL, NULL, NULL }, 281 { L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL }, 282 { L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL } 283 283 }; 284 284 … … 286 286 An ACPI_PARSER array describing the Memory Affinity structure. 287 287 **/ 288 STATIC CONST ACPI_PARSER SratMemAffinityParser[] = {289 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},290 { L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},291 292 { L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL},293 { L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL},294 { L"Base Address Low", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},295 { L"Base Address High", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},296 { L"Length Low", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},297 { L"Length High", 4, 20, L"0x%x", NULL, NULL, NULL, NULL},298 { L"Reserved", 4, 24, L"0x%x", NULL, NULL, NULL, NULL},299 { L"Flags", 4, 28, L"0x%x", NULL, NULL, NULL, NULL},300 { L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}288 STATIC CONST ACPI_PARSER SratMemAffinityParser[] = { 289 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 290 { L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL }, 291 292 { L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL }, 293 { L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL }, 294 { L"Base Address Low", 4, 8, L"0x%x", NULL, NULL, NULL, NULL }, 295 { L"Base Address High", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }, 296 { L"Length Low", 4, 16, L"0x%x", NULL, NULL, NULL, NULL }, 297 { L"Length High", 4, 20, L"0x%x", NULL, NULL, NULL, NULL }, 298 { L"Reserved", 4, 24, L"0x%x", NULL, NULL, NULL, NULL }, 299 { L"Flags", 4, 28, L"0x%x", NULL, NULL, NULL, NULL }, 300 { L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL } 301 301 }; 302 302 … … 304 304 An ACPI_PARSER array describing the APIC/SAPIC Affinity structure. 305 305 **/ 306 STATIC CONST ACPI_PARSER SratApciSapicAffinityParser[] = {307 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},308 { L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},309 310 { L"Proximity Domain [7:0]", 1, 2, L"0x%x", NULL, NULL, NULL, NULL},311 { L"APIC ID", 1, 3, L"0x%x", NULL, NULL, NULL, NULL},312 { L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},313 { L"Local SAPIC EID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL},314 { L"Proximity Domain [31:8]", 3, 9,L"0x%x", DumpSratApicProximity,315 NULL, NULL, NULL},316 { L"Clock Domain", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}306 STATIC CONST ACPI_PARSER SratApciSapicAffinityParser[] = { 307 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 308 { L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL }, 309 310 { L"Proximity Domain [7:0]", 1, 2, L"0x%x", NULL, NULL, NULL, NULL }, 311 { L"APIC ID", 1, 3, L"0x%x", NULL, NULL, NULL, NULL }, 312 { L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 313 { L"Local SAPIC EID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL }, 314 { L"Proximity Domain [31:8]", 3, 9, L"0x%x", DumpSratApicProximity, 315 NULL, NULL, NULL }, 316 { L"Clock Domain", 4, 12, L"0x%x", NULL, NULL, NULL, NULL } 317 317 }; 318 318 … … 320 320 An ACPI_PARSER array describing the Processor Local x2APIC Affinity structure. 321 321 **/ 322 STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] = {323 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL},324 { L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL},325 326 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},327 { L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL},328 { L"X2APIC ID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL},329 { L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL},330 { L"Clock Domain", 4, 16, L"0x%x", NULL, NULL, NULL, NULL},331 { L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL}322 STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] = { 323 { L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL }, 324 { L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL }, 325 326 { L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL }, 327 { L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, 328 { L"X2APIC ID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL }, 329 { L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }, 330 { L"Clock Domain", 4, 16, L"0x%x", NULL, NULL, NULL, NULL }, 331 { L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL } 332 332 }; 333 333 … … 353 353 EFIAPI 354 354 ParseAcpiSrat ( 355 IN BOOLEAN Trace,356 IN UINT8 *Ptr,357 IN UINT32 AcpiTableLength,358 IN UINT8 AcpiTableRevision355 IN BOOLEAN Trace, 356 IN UINT8 *Ptr, 357 IN UINT32 AcpiTableLength, 358 IN UINT8 AcpiTableRevision 359 359 ) 360 360 { 361 UINT32 Offset;362 UINT8 *ResourcePtr;363 UINT32 GicCAffinityIndex;364 UINT32 GicITSAffinityIndex;365 UINT32 GenericInitiatorAffinityIndex;366 UINT32 MemoryAffinityIndex;367 UINT32 ApicSapicAffinityIndex;368 UINT32 X2ApicAffinityIndex;369 CHAR8 Buffer[80];// Used for AsciiName param of ParseAcpi370 371 GicCAffinityIndex = 0;372 GicITSAffinityIndex = 0;361 UINT32 Offset; 362 UINT8 *ResourcePtr; 363 UINT32 GicCAffinityIndex; 364 UINT32 GicITSAffinityIndex; 365 UINT32 GenericInitiatorAffinityIndex; 366 UINT32 MemoryAffinityIndex; 367 UINT32 ApicSapicAffinityIndex; 368 UINT32 X2ApicAffinityIndex; 369 CHAR8 Buffer[80]; // Used for AsciiName param of ParseAcpi 370 371 GicCAffinityIndex = 0; 372 GicITSAffinityIndex = 0; 373 373 GenericInitiatorAffinityIndex = 0; 374 MemoryAffinityIndex = 0;375 ApicSapicAffinityIndex = 0;376 X2ApicAffinityIndex = 0;374 MemoryAffinityIndex = 0; 375 ApicSapicAffinityIndex = 0; 376 X2ApicAffinityIndex = 0; 377 377 378 378 if (!Trace) { … … 404 404 // successfully read. 405 405 if ((SratRAType == NULL) || 406 (SratRALength == NULL)) { 406 (SratRALength == NULL)) 407 { 407 408 IncrementErrorCount (); 408 409 Print ( 409 410 L"ERROR: Insufficient remaining table buffer length to read the " \ 410 411 L"Static Resource Allocation structure header. Length = %d.\n", 411 412 AcpiTableLength - Offset 412 413 ); … … 416 417 // Validate Static Resource Allocation Structure length 417 418 if ((*SratRALength == 0) || 418 ((Offset + (*SratRALength)) > AcpiTableLength)) { 419 ((Offset + (*SratRALength)) > AcpiTableLength)) 420 { 419 421 IncrementErrorCount (); 420 422 Print ( 421 423 L"ERROR: Invalid Static Resource Allocation Structure length. " \ 422 424 L"Length = %d. Offset = %d. AcpiTableLength = %d.\n", 423 425 *SratRALength, 424 426 Offset, … … 452 454 "GIC ITS Affinity Structure [%d]", 453 455 GicITSAffinityIndex++ 454 );456 ); 455 457 ParseAcpi ( 456 458 TRUE, … … 469 471 "Generic Initiator Affinity Structure [%d]", 470 472 GenericInitiatorAffinityIndex++ 471 );473 ); 472 474 ParseAcpi ( 473 475 TRUE, … … 477 479 *SratRALength, 478 480 PARSER_PARAMS (SratGenericInitiatorAffinityParser) 479 );481 ); 480 482 break; 481 483 … … 538 540 539 541 ResourcePtr += (*SratRALength); 540 Offset += (*SratRALength);542 Offset += (*SratRALength); 541 543 } 542 544 } -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c
r80721 r99404 29 29 EFIAPI 30 30 ParseAcpiSsdt ( 31 IN BOOLEAN Trace,32 IN UINT8 *Ptr,33 IN UINT32 AcpiTableLength,34 IN UINT8 AcpiTableRevision31 IN BOOLEAN Trace, 32 IN UINT8 *Ptr, 33 IN UINT32 AcpiTableLength, 34 IN UINT8 AcpiTableRevision 35 35 ) 36 36 { -
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c
r80721 r99404 16 16 17 17 // Local variables 18 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;18 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; 19 19 20 20 /** An ACPI_PARSER array describing the ACPI XSDT table. 21 21 */ 22 STATIC CONST ACPI_PARSER XsdtParser[] = {22 STATIC CONST ACPI_PARSER XsdtParser[] = { 23 23 PARSE_ACPI_HEADER (&AcpiHdrInfo) 24 24 }; … … 31 31 GetAcpiXsdtHeaderInfo ( 32 32 VOID 33 )33 ) 34 34 { 35 35 return &AcpiHdrInfo; … … 49 49 EFIAPI 50 50 ParseAcpiXsdt ( 51 IN BOOLEAN Trace,52 IN UINT8 *Ptr,53 IN UINT32 AcpiTableLength,54 IN UINT8 AcpiTableRevision51 IN BOOLEAN Trace, 52 IN UINT8 *Ptr, 53 IN UINT32 AcpiTableLength, 54 IN UINT8 AcpiTableRevision 55 55 ) 56 56 { 57 UINT32 58 UINT32 59 UINT64 *TablePointer;60 UINTN 61 CHAR16 57 UINT32 Offset; 58 UINT32 TableOffset; 59 UINT64 *TablePointer; 60 UINTN EntryIndex; 61 CHAR16 Buffer[32]; 62 62 63 63 Offset = ParseAcpi ( … … 73 73 74 74 if (Trace) { 75 EntryIndex = 0;76 TablePointer = (UINT64 *)(Ptr + TableOffset);75 EntryIndex = 0; 76 TablePointer = (UINT64 *)(Ptr + TableOffset); 77 77 while (Offset < AcpiTableLength) { 78 CONST UINT32 *Signature;79 CONST UINT32 *Length;80 CONST UINT8 *Revision;78 CONST UINT32 *Signature; 79 CONST UINT32 *Length; 80 CONST UINT8 *Revision; 81 81 82 if ((UINT64 *)(UINTN)(*TablePointer) != NULL) {83 UINT8 *SignaturePtr;82 if ((UINT64 *)(UINTN)(*TablePointer) != NULL) { 83 UINT8 *SignaturePtr; 84 84 85 85 ParseAcpiHeader ( 86 (UINT8 *)(UINTN)(*TablePointer),86 (UINT8 *)(UINTN)(*TablePointer), 87 87 &Signature, 88 88 &Length, … … 90 90 ); 91 91 92 SignaturePtr = (UINT8 *)Signature;92 SignaturePtr = (UINT8 *)Signature; 93 93 94 94 UnicodeSPrint ( … … 115 115 116 116 // Validate the table pointers are not NULL 117 if ((UINT64 *)(UINTN)(*TablePointer) == NULL) {117 if ((UINT64 *)(UINTN)(*TablePointer) == NULL) { 118 118 IncrementErrorCount (); 119 119 Print ( … … 123 123 ); 124 124 } 125 125 126 Offset += sizeof (UINT64); 126 127 TablePointer++; … … 129 130 130 131 // Process the tables 131 Offset = TableOffset;132 TablePointer = (UINT64 *)(Ptr + TableOffset);132 Offset = TableOffset; 133 TablePointer = (UINT64 *)(Ptr + TableOffset); 133 134 while (Offset < AcpiTableLength) { 134 if ((UINT64 *)(UINTN)(*TablePointer) != NULL) {135 ProcessAcpiTable ((UINT8 *)(UINTN)(*TablePointer));135 if ((UINT64 *)(UINTN)(*TablePointer) != NULL) { 136 ProcessAcpiTable ((UINT8 *)(UINTN)(*TablePointer)); 136 137 } 138 137 139 Offset += sizeof (UINT64); 138 140 TablePointer++;
Note:
See TracChangeset
for help on using the changeset viewer.