1 /****************************************************************************** 2 * 3 * Module Name: axutils - Utility functions for acpixtract tool. 4 * 5 *****************************************************************************/ 6 7 /****************************************************************************** 8 * 9 * 1. Copyright Notice 10 * 11 * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. 12 * All rights reserved. 13 * 14 * 2. License 15 * 16 * 2.1. This is your license from Intel Corp. under its intellectual property 17 * rights. You may have additional license terms from the party that provided 18 * you this software, covering your right to use that party's intellectual 19 * property rights. 20 * 21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22 * copy of the source code appearing in this file ("Covered Code") an 23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24 * base code distributed originally by Intel ("Original Intel Code") to copy, 25 * make derivatives, distribute, use and display any portion of the Covered 26 * Code in any form, with the right to sublicense such rights; and 27 * 28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29 * license (with the right to sublicense), under only those claims of Intel 30 * patents that are infringed by the Original Intel Code, to make, use, sell, 31 * offer to sell, and import the Covered Code and derivative works thereof 32 * solely to the minimum extent necessary to exercise the above copyright 33 * license, and in no event shall the patent license extend to any additions 34 * to or modifications of the Original Intel Code. No other license or right 35 * is granted directly or by implication, estoppel or otherwise; 36 * 37 * The above copyright and patent license is granted only if the following 38 * conditions are met: 39 * 40 * 3. Conditions 41 * 42 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43 * Redistribution of source code of any substantial portion of the Covered 44 * Code or modification with rights to further distribute source must include 45 * the above Copyright Notice, the above License, this list of Conditions, 46 * and the following Disclaimer and Export Compliance provision. In addition, 47 * Licensee must cause all Covered Code to which Licensee contributes to 48 * contain a file documenting the changes Licensee made to create that Covered 49 * Code and the date of any change. Licensee must include in that file the 50 * documentation of any changes made by any predecessor Licensee. Licensee 51 * must include a prominent statement that the modification is derived, 52 * directly or indirectly, from Original Intel Code. 53 * 54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55 * Redistribution of source code of any substantial portion of the Covered 56 * Code or modification without rights to further distribute source must 57 * include the following Disclaimer and Export Compliance provision in the 58 * documentation and/or other materials provided with distribution. In 59 * addition, Licensee may not authorize further sublicense of source of any 60 * portion of the Covered Code, and must include terms to the effect that the 61 * license from Licensee to its licensee is limited to the intellectual 62 * property embodied in the software Licensee provides to its licensee, and 63 * not to intellectual property embodied in modifications its licensee may 64 * make. 65 * 66 * 3.3. Redistribution of Executable. Redistribution in executable form of any 67 * substantial portion of the Covered Code or modification must reproduce the 68 * above Copyright Notice, and the following Disclaimer and Export Compliance 69 * provision in the documentation and/or other materials provided with the 70 * distribution. 71 * 72 * 3.4. Intel retains all right, title, and interest in and to the Original 73 * Intel Code. 74 * 75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76 * Intel shall be used in advertising or otherwise to promote the sale, use or 77 * other dealings in products derived from or relating to the Covered Code 78 * without prior written authorization from Intel. 79 * 80 * 4. Disclaimer and Export Compliance 81 * 82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88 * PARTICULAR PURPOSE. 89 * 90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97 * LIMITED REMEDY. 98 * 99 * 4.3. Licensee shall not export, either directly or indirectly, any of this 100 * software or system incorporating such software without first obtaining any 101 * required license or other approval from the U. S. Department of Commerce or 102 * any other agency or department of the United States Government. In the 103 * event Licensee exports any such software from the United States or 104 * re-exports any such software from a foreign destination, Licensee shall 105 * ensure that the distribution and export/re-export of the software is in 106 * compliance with all laws, regulations, orders, or other restrictions of the 107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108 * any of its subsidiaries will export/re-export any technical data, process, 109 * software, or service, directly or indirectly, to any country for which the 110 * United States government or any agency thereof requires an export license, 111 * other governmental approval, or letter of assurance, without first obtaining 112 * such license, approval or letter. 113 * 114 ***************************************************************************** 115 * 116 * Alternatively, you may choose to be licensed under the terms of the 117 * following license: 118 * 119 * Redistribution and use in source and binary forms, with or without 120 * modification, are permitted provided that the following conditions 121 * are met: 122 * 1. Redistributions of source code must retain the above copyright 123 * notice, this list of conditions, and the following disclaimer, 124 * without modification. 125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 126 * substantially similar to the "NO WARRANTY" disclaimer below 127 * ("Disclaimer") and any redistribution must be conditioned upon 128 * including a substantially similar Disclaimer requirement for further 129 * binary redistribution. 130 * 3. Neither the names of the above-listed copyright holders nor the names 131 * of any contributors may be used to endorse or promote products derived 132 * from this software without specific prior written permission. 133 * 134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 145 * 146 * Alternatively, you may choose to be licensed under the terms of the 147 * GNU General Public License ("GPL") version 2 as published by the Free 148 * Software Foundation. 149 * 150 *****************************************************************************/ 151 152 #include "acpixtract.h" 153 154 155 /******************************************************************************* 156 * 157 * FUNCTION: AxCheckAscii 158 * 159 * PARAMETERS: Name - Ascii string, at least as long as Count 160 * Count - Number of characters to check 161 * 162 * RETURN: None 163 * 164 * DESCRIPTION: Ensure that the requested number of characters are printable 165 * Ascii characters. Sets non-printable and null chars to <space>. 166 * 167 ******************************************************************************/ 168 169 void 170 AxCheckAscii ( 171 char *Name, 172 int Count) 173 { 174 int i; 175 176 177 for (i = 0; i < Count; i++) 178 { 179 if (!Name[i] || !isprint ((int) Name[i])) 180 { 181 Name[i] = ' '; 182 } 183 } 184 } 185 186 187 /******************************************************************************* 188 * 189 * FUNCTION: AxIsFileAscii 190 * 191 * PARAMETERS: Handle - To open input file 192 * 193 * RETURN: TRUE if file is entirely ASCII and printable 194 * 195 * DESCRIPTION: Verify that the input file is entirely ASCII. 196 * 197 ******************************************************************************/ 198 199 BOOLEAN 200 AxIsFileAscii ( 201 FILE *Handle) 202 { 203 UINT8 Byte; 204 UINT32 Offset = 0; 205 206 207 /* Read the entire file */ 208 209 fseek (Handle, 0, SEEK_SET); 210 while (fread (&Byte, 1, 1, Handle) == 1) 211 { 212 /* 213 * Ignore null characters. Some acpidump-type utilities insert 214 * a few of these, probably a bug in the utility. As long as these 215 * characters are in lines that are tossed (non-data), they 216 * won't cause a problem. 217 */ 218 if (!Byte) 219 { 220 continue; 221 } 222 223 /* Check for an ASCII character */ 224 225 if (!ACPI_IS_ASCII (Byte)) 226 { 227 printf ("Found non-ascii char: %2.2X at file offset %u (0x%X)\n", 228 Byte, Offset, Offset); 229 if (!Gbl_ForceExtraction) 230 { 231 goto ErrorExit; 232 } 233 } 234 235 /* Ensure character is either printable or a "space" char */ 236 237 else if (!isprint (Byte) && !isspace (Byte)) 238 { 239 printf ("Found non-printable char: %2.2X at file offset %u (0x%X)\n", 240 Byte, Offset, Offset); 241 if (!Gbl_ForceExtraction) 242 { 243 goto ErrorExit; 244 } 245 } 246 247 Offset++; 248 } 249 250 /* File is OK (100% ASCII) */ 251 252 fseek (Handle, 0, SEEK_SET); 253 return (TRUE); 254 255 ErrorExit: 256 257 printf ("File appears to be binary " 258 "(contains non-text or non-ascii characters)\n"); 259 fseek (Handle, 0, SEEK_SET); 260 return (FALSE); 261 } 262 263 264 /****************************************************************************** 265 * 266 * FUNCTION: AxIsEmptyLine 267 * 268 * PARAMETERS: Buffer - Line from input file 269 * 270 * RETURN: TRUE if line is empty (zero or more blanks only) 271 * 272 * DESCRIPTION: Determine if an input line is empty. 273 * 274 ******************************************************************************/ 275 276 BOOLEAN 277 AxIsEmptyLine ( 278 char *Buffer) 279 { 280 281 /* Skip all spaces */ 282 283 while (*Buffer == ' ') 284 { 285 Buffer++; 286 } 287 288 /* Line is empty when a Unix or DOS-style line terminator is found. */ 289 290 if ((*Buffer == '\r') || (*Buffer == '\n')) 291 { 292 return (1); 293 } 294 295 return (0); 296 } 297 298 299 /****************************************************************************** 300 * 301 * FUNCTION: AxIsHexDataLine 302 * 303 * PARAMETERS: None 304 * 305 * RETURN: Status. 1 if the table header is valid, 0 otherwise. 306 * 307 * DESCRIPTION: Check for a valid line of hex data of the form: 308 * 309 * 00a0: 0c 00 00 00 03 00 00 00 43 48 41 35 0c 00 00 00 ........CHA5.... 310 * 311 ******************************************************************************/ 312 313 BOOLEAN 314 AxIsHexDataLine ( 315 void) 316 { 317 318 if (AxIsEmptyLine (Gbl_LineBuffer) || 319 (Gbl_LineBuffer[0] != ' ')) 320 { 321 return (FALSE); 322 } 323 324 if (!strstr (Gbl_LineBuffer, ": ")) 325 { 326 /* Not valid data line */ 327 328 return (FALSE); 329 } 330 331 return (TRUE); 332 } 333 334 335 /****************************************************************************** 336 * 337 * FUNCTION: AxIsDataBlockHeader 338 * 339 * PARAMETERS: None 340 * 341 * RETURN: Status. 1 if the table header is valid, 0 otherwise. 342 * 343 * DESCRIPTION: Check if the ACPI table identifier in the input acpidump text 344 * file is valid (of the form: <sig> @ <addr>). 345 * 346 ******************************************************************************/ 347 348 BOOLEAN 349 AxIsDataBlockHeader ( 350 void) 351 { 352 353 /* Ignore lines that are too short to be header lines */ 354 355 if (strlen (Gbl_LineBuffer) < AX_MIN_BLOCK_HEADER_LENGTH) 356 { 357 return (FALSE); 358 } 359 360 /* Ignore empty lines and lines that start with a space */ 361 362 if (AxIsEmptyLine (Gbl_LineBuffer) || 363 (Gbl_LineBuffer[0] == ' ')) 364 { 365 return (FALSE); 366 } 367 368 /* 369 * Ignore lines that are not headers of the form <sig> @ <addr>. 370 * Basically, just look for the '@' symbol, surrounded by spaces. 371 * 372 * Examples of headers that must be supported: 373 * 374 * DSDT @ 0x737e4000 375 * XSDT @ 0x737f2fff 376 * RSD PTR @ 0xf6cd0 377 * SSDT @ (nil) 378 */ 379 if (!AX_IS_TABLE_BLOCK_HEADER) 380 { 381 return (FALSE); 382 } 383 384 AxNormalizeSignature (Gbl_LineBuffer); 385 return (TRUE); 386 } 387 388 389 /******************************************************************************* 390 * 391 * FUNCTION: AxNormalizeSignature 392 * 393 * PARAMETERS: Name - Ascii string containing an ACPI signature 394 * 395 * RETURN: None 396 * 397 * DESCRIPTION: Change "RSD PTR" to "RSDP" 398 * 399 ******************************************************************************/ 400 401 void 402 AxNormalizeSignature ( 403 char *Signature) 404 { 405 406 if (!strncmp (Signature, "RSD ", 4)) 407 { 408 Signature[3] = 'P'; 409 } 410 } 411 412 413 /****************************************************************************** 414 * 415 * FUNCTION: AxConvertToBinary 416 * 417 * PARAMETERS: InputLine - One line from the input acpidump file 418 * OutputData - Where the converted data is returned 419 * 420 * RETURN: The number of bytes actually converted 421 * 422 * DESCRIPTION: Convert one line of ascii text binary (up to 16 bytes) 423 * 424 * NOTE: Assumes the input data line has been validated to be of the form: 425 * 426 * 0010: 48 53 57 55 4c 54 2d 52 01 00 00 00 49 4e 54 4c HSWULT-R....INTL 427 * 428 ******************************************************************************/ 429 430 size_t 431 AxConvertToBinary ( 432 char *InputLine, 433 unsigned char *OutputData) 434 { 435 char *ColonDelimiter; 436 int BytesConverted; 437 int Converted[16]; 438 int i; 439 440 441 /* 442 * Terminate input line immediately after the data. Otherwise, the 443 * second line below will not scan correctly. 444 * 445 * This handles varying lengths for the offset: line prefix. This support 446 * for tables larger than 1mb was added 05/2018. 447 * 448 * 00b0: 03 00 00 00 43 48 41 36 0c 00 00 00 03 00 00 00 ....CHA6........ 449 * 00c0: 43 48 41 37 CHA7 450 * 451 * 012340b0: 03 00 00 00 43 48 41 36 0c 00 00 00 03 00 00 00 ....CHA6........ 452 * 012340c0: 43 48 41 37 CHA7 453 */ 454 ColonDelimiter = strchr (InputLine, ':'); 455 ColonDelimiter [AX_HEX_DATA_LENGTH] = 0; 456 457 /* 458 * Convert one line of table data, of the form: 459 * <offset>: <up to 16 bytes of hex data> <ASCII representation> <newline> 460 * 461 * Example: 462 * 02C0: 5F 53 42 5F 4C 4E 4B 44 00 12 13 04 0C FF FF 08 _SB_LNKD........ 463 */ 464 BytesConverted = sscanf (InputLine, 465 "%*s %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X", 466 &Converted[0], &Converted[1], &Converted[2], &Converted[3], 467 &Converted[4], &Converted[5], &Converted[6], &Converted[7], 468 &Converted[8], &Converted[9], &Converted[10], &Converted[11], 469 &Converted[12], &Converted[13], &Converted[14], &Converted[15]); 470 471 /* Pack converted data into a byte array */ 472 473 for (i = 0; i < BytesConverted; i++) 474 { 475 OutputData[i] = (unsigned char) Converted[i]; 476 } 477 478 return ((size_t) BytesConverted); 479 } 480 481 482 /****************************************************************************** 483 * 484 * FUNCTION: AxCountTableInstances 485 * 486 * PARAMETERS: InputPathname - Filename for acpidump file 487 * Signature - Requested signature to count 488 * 489 * RETURN: The number of instances of the signature 490 * 491 * DESCRIPTION: Count the instances of tables with the given signature within 492 * the input acpidump file. 493 * 494 ******************************************************************************/ 495 496 unsigned int 497 AxCountTableInstances ( 498 char *InputPathname, 499 char *Signature) 500 { 501 FILE *InputFile; 502 unsigned int Instances = 0; 503 504 505 InputFile = fopen (InputPathname, "r"); 506 if (!InputFile) 507 { 508 printf ("Could not open input file %s\n", InputPathname); 509 return (0); 510 } 511 512 /* Count the number of instances of this signature */ 513 514 while (fgets (Gbl_InstanceBuffer, AX_LINE_BUFFER_SIZE, InputFile)) 515 { 516 /* Ignore empty lines and lines that start with a space */ 517 518 if (AxIsEmptyLine (Gbl_InstanceBuffer) || 519 (Gbl_InstanceBuffer[0] == ' ')) 520 { 521 continue; 522 } 523 524 AxNormalizeSignature (Gbl_InstanceBuffer); 525 if (ACPI_COMPARE_NAME (Gbl_InstanceBuffer, Signature)) 526 { 527 Instances++; 528 } 529 } 530 531 fclose (InputFile); 532 return (Instances); 533 } 534 535 536 /****************************************************************************** 537 * 538 * FUNCTION: AxGetNextInstance 539 * 540 * PARAMETERS: InputPathname - Filename for acpidump file 541 * Signature - Requested ACPI signature 542 * 543 * RETURN: The next instance number for this signature. Zero if this 544 * is the first instance of this signature. 545 * 546 * DESCRIPTION: Get the next instance number of the specified table. If this 547 * is the first instance of the table, create a new instance 548 * block. Note: only SSDT and PSDT tables can have multiple 549 * instances. 550 * 551 ******************************************************************************/ 552 553 unsigned int 554 AxGetNextInstance ( 555 char *InputPathname, 556 char *Signature) 557 { 558 AX_TABLE_INFO *Info; 559 560 561 Info = Gbl_TableListHead; 562 while (Info) 563 { 564 if (*(UINT32 *) Signature == Info->Signature) 565 { 566 break; 567 } 568 569 Info = Info->Next; 570 } 571 572 if (!Info) 573 { 574 /* Signature not found, create new table info block */ 575 576 Info = malloc (sizeof (AX_TABLE_INFO)); 577 if (!Info) 578 { 579 printf ("Could not allocate memory (0x%X bytes)\n", 580 (unsigned int) sizeof (AX_TABLE_INFO)); 581 exit (0); 582 } 583 584 Info->Signature = *(UINT32 *) Signature; 585 Info->Instances = AxCountTableInstances (InputPathname, Signature); 586 Info->NextInstance = 1; 587 Info->Next = Gbl_TableListHead; 588 Gbl_TableListHead = Info; 589 } 590 591 if (Info->Instances > 1) 592 { 593 return (Info->NextInstance++); 594 } 595 596 return (0); 597 } 598 599 600 /****************************************************************************** 601 * 602 * FUNCTION: AxConvertAndWrite 603 * 604 * PARAMETERS: OutputFile - Where to write the binary data 605 * ThisSignature - Signature of current ACPI table 606 * ThisTableBytesWritten - Total count of data written 607 * 608 * RETURN: Length of the converted line 609 * 610 * DESCRIPTION: Convert one line of input hex ascii text to binary, and write 611 * the binary data to the table output file. 612 * 613 * NOTE: Assumes the input data line has been validated to be of the form: 614 * 615 * 0010: 48 53 57 55 4c 54 2d 52 01 00 00 00 49 4e 54 4c HSWULT-R....INTL 616 * 617 ******************************************************************************/ 618 619 long 620 AxConvertAndWrite ( 621 FILE *OutputFile, 622 char *ThisSignature, 623 unsigned int ThisTableBytesWritten) 624 { 625 size_t BytesWritten; 626 size_t BytesConverted; 627 628 629 /* Convert one line of ascii hex data to binary */ 630 631 BytesConverted = AxConvertToBinary (Gbl_LineBuffer, Gbl_BinaryData); 632 633 /* Write the binary data */ 634 635 if (!BytesConverted) 636 { 637 return (0); 638 } 639 640 BytesWritten = fwrite (Gbl_BinaryData, 1, BytesConverted, OutputFile); 641 if (BytesWritten != BytesConverted) 642 { 643 printf ("Error while writing file %s\n", Gbl_OutputFilename); 644 return (-1); 645 } 646 647 return (BytesWritten); 648 } 649 650 651 /****************************************************************************** 652 * 653 * FUNCTION: AxDumpTableHeader 654 * 655 * PARAMETERS: Header - A binary ACPI table header 656 * 657 * RETURN: None 658 * 659 * DESCRIPTION: Display the contents of a standard ACPI table header 660 * 661 ******************************************************************************/ 662 663 void 664 AxDumpTableHeader ( 665 unsigned char *Header) 666 { 667 ACPI_TABLE_HEADER *TableHeader = (ACPI_TABLE_HEADER *) (void *) Header; 668 ACPI_TABLE_RSDP *Rsdp = (ACPI_TABLE_RSDP *) (void *) Header; 669 ACPI_TABLE_FACS *Facs = (ACPI_TABLE_FACS *) (void *) Header; 670 671 672 /* RSDP has an oddball signature and header */ 673 674 if (!strncmp (TableHeader->Signature, "RSD PTR ", 8)) 675 { 676 AxCheckAscii ((char *) &Header[9], 6); 677 678 Gbl_TableCount++; 679 printf (" %.2u) %5.4s 0x%8.8X 0x%2.2X \"%6.6s\"\n", 680 Gbl_TableCount, "RSDP", Rsdp->Length, Rsdp->Revision, Rsdp->OemId); 681 return; 682 } 683 684 if (!AcpiUtValidNameseg (TableHeader->Signature)) 685 { 686 return; 687 } 688 689 /* Signature and Table length */ 690 691 Gbl_TableCount++; 692 printf (" %.2u) %5.4s 0x%8.8X", Gbl_TableCount, TableHeader->Signature, 693 TableHeader->Length); 694 695 /* FACS has only signature and length */ 696 697 if (ACPI_COMPARE_NAME (TableHeader->Signature, "FACS")) 698 { 699 printf (" 0x%2.2X\n", Facs->Version); 700 return; 701 } 702 703 /* OEM IDs and Compiler IDs */ 704 705 AxCheckAscii (TableHeader->OemId, 6); 706 AxCheckAscii (TableHeader->OemTableId, 8); 707 AxCheckAscii (TableHeader->AslCompilerId, 4); 708 709 printf ( 710 " 0x%2.2X \"%6.6s\" \"%8.8s\" 0x%8.8X" 711 " \"%4.4s\" 0x%8.8X\n", 712 TableHeader->Revision, TableHeader->OemId, 713 TableHeader->OemTableId, TableHeader->OemRevision, 714 TableHeader->AslCompilerId, TableHeader->AslCompilerRevision); 715 } 716 717 718 #ifdef _AX_FUTURE_ENHANCEMENTS 719 720 /* Possible enhancement to validate table lengths */ 721 722 void 723 AxCheckTableLengths ( 724 UINT32 ByteCount, 725 UINT32 AmlByteCount) 726 { 727 728 if (AmlByteCount == 0) 729 { 730 return; 731 } 732 733 if (ByteCount == 0) 734 { 735 return; 736 } 737 738 if ((ByteCount < sizeof (ACPI_TABLE_HEADER)) && 739 (ByteCount >= ACPI_NAME_SIZE)) 740 { 741 printf (" : (Table too short for an ACPI table)"); 742 } 743 744 else if (ByteCount != AmlByteCount) 745 { 746 printf (" : (Hex data length mismatch with AML length 0x%X)", 747 AmlByteCount); 748 } 749 750 printf ("\n"); 751 } 752 #endif 753