1 /******************************************************************************
3 * Module Name: a16find - 16-bit (real mode) routines to find ACPI
6 *****************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
13 * All rights reserved.
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
38 * The above copyright and patent license is granted only if the following
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
73 * 3.4. Intel retains all right, title, and interest in and to the Original
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
81 * 4. Disclaimer and Export Compliance
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
115 *****************************************************************************/
121 #include "accommon.h"
123 #include "acparser.h"
124 #include "actables.h"
129 #define _COMPONENT ACPI_TABLES
130 ACPI_MODULE_NAME ("a16find")
133 * This module finds ACPI tables located in memory.
134 * It is only generated for the 16-bit (real-mode) version of the utility.
137 #define ACPI_TABLE_FILE_SUFFIX ".dat"
140 #if ACPI_MACHINE_WIDTH == 16
142 UINT32 ACPI_INTERNAL_VAR_XFACE dIn32 (UINT16 port);
143 void ACPI_INTERNAL_VAR_XFACE vOut32 (UINT16 port, UINT32 Val);
144 #define ACPI_ENABLE_HPET 0x00020000
146 char FilenameBuf[20];
147 ACPI_TABLE_HEADER AcpiTblHeader;
150 UINT32 AcpiGbl_SystemFlags;
151 UINT32 AcpiGbl_RsdpOriginalLocation;
154 /******************************************************************************
156 * FUNCTION: AfWriteBuffer
162 * DESCRIPTION: Open a file and write out a single buffer
164 ******************************************************************************/
173 ACPI_NATIVE_INT Actual;
176 fp = fopen (Filename, "wb");
179 printf ("Couldn't open %s\n", Filename);
183 Actual = fwrite (Buffer, (size_t) Length, 1, fp);
189 /******************************************************************************
191 * FUNCTION: AfGenerateFilename
197 * DESCRIPTION: Build an output filename from an ACPI table ID string
199 ******************************************************************************/
202 AfGenerateFilename (char *TableId)
207 for (i = 0; i < 8 && TableId[i] != ' ' && TableId[i] != 0; i++)
209 FilenameBuf [i] = TableId[i];
213 strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX);
218 /******************************************************************************
220 * FUNCTION: AfDumpTables
226 * DESCRIPTION: Dump the loaded tables to a file (or files)
228 ******************************************************************************/
238 AcpiOsPrintf ("No DSDT!\n");
243 Filename = AfGenerateFilename (AcpiGbl_DSDT->OemTableId);
244 AfWriteBuffer (Filename,
245 (char *) AcpiGbl_DSDT, AcpiGbl_DSDT->Length);
247 AcpiOsPrintf ("DSDT AML written to \"%s\"\n", Filename);
257 AcpiOsPrintf ("Seq: 0x%8.8X\n", value);
261 /******************************************************************************
263 * FUNCTION: CopyExtendedToReal
269 * DESCRIPTION: Copy memory above 1meg
271 ******************************************************************************/
276 UINT32 PhysicalSource,
282 RetVal = FlatMove32 (GET_PHYSICAL_ADDRESS (Destination),
283 PhysicalSource, (UINT16) Size);
285 AcpiOsPrintf ("FlatMove return: 0x%hX From %X To %X Len %X\n",
286 (int) RetVal, PhysicalSource, GET_PHYSICAL_ADDRESS (Destination), Size);
291 /******************************************************************************
293 * FUNCTION: AfFindRsdp
299 * DESCRIPTION: Scan memory to find the RSDP
301 ******************************************************************************/
304 AfFindRsdp (RSDP_DESCRIPTOR **RSDP)
309 PTR_OVL_BUILD_PTR (Rove, 0, 0);
312 /* Scan low memory */
316 if (strncmp (Rove.ptr, ACPI_SIG_RSDP, (size_t) 8) == 0)
319 /* TBD: Checksum check is invalid for X descriptor */
321 /* if (AcpiTbSumTable (Rove.ptr, sizeof(RSDP_DESCRIPTOR)) != 0)
324 AcpiOsPrintf ("RSDP found at %p (Lo block)\n", Rove.ptr);
331 while (Rove.ovl.base < 0x3F);
333 /* Scan high memory */
335 PTR_OVL_BUILD_PTR (Rove, 0xE000, 0);
338 if (strncmp (Rove.ptr, ACPI_SIG_RSDP, (size_t) 8) == 0)
340 AcpiOsPrintf ("RSDP found at %p (Hi block)\n", Rove.ptr);
347 while (Rove.ovl.base < 0xFFFF);
353 /******************************************************************************
355 * FUNCTION: AfRecognizeTable
357 * PARAMETERS: TablePtr - Input buffer pointer, optional
358 * TableInfo - Return value from AcpiTbGetTable
362 * DESCRIPTION: Check a table signature for a match against known table types
364 ******************************************************************************/
370 ACPI_TABLE_DESC *TableInfo)
372 ACPI_TABLE_HEADER *TableHeader;
374 ACPI_TABLE_TYPE TableType = 0;
375 void **TableGlobalPtr;
379 ACPI_FUNCTION_TRACE (AfRecognizeTable);
382 /* Ensure that we have a valid table pointer */
384 TableHeader = (ACPI_TABLE_HEADER *) TableInfo->Pointer;
387 return_ACPI_STATUS (AE_BAD_PARAMETER);
390 /* Search for a signature match among the known table types */
393 for (i = 1; i < NUM_ACPI_TABLE_TYPES; i++) /* Start at one -> Skip RSDP */
395 if (!ACPI_STRNCMP (TableHeader->Signature,
396 AcpiGbl_TableData[i].Signature,
397 AcpiGbl_TableData[i].SigLength))
399 AcpiOsPrintf ("Found table [%s] Length 0x%X\n",
400 AcpiGbl_TableData[i].Signature, (UINT32) TableHeader->Length);
403 TableGlobalPtr = AcpiGbl_TableData[i].GlobalPtr;
409 /* Return the table type via the info struct */
411 TableInfo->Type = (UINT8) TableType;
412 TableInfo->Length = (ACPI_SIZE) TableHeader->Length;
415 * An AE_SUPPORT means that the table was not recognized.
416 * We ignore this table; just print a debug message
418 if (Status == AE_SUPPORT)
420 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
421 "Unsupported table %s (Type %d) was found and discarded\n",
422 AcpiGbl_TableData[TableType].Name, (UINT32) TableType));
424 return_ACPI_STATUS (Status);
427 Status = AcpiTbValidateTableHeader (TableHeader);
428 if (ACPI_FAILURE (Status))
430 /* Table failed verification, map all errors to BAD_DATA */
432 ACPI_ERROR ((AE_INFO,
433 "Invalid table header found in table named %s (Type %d)",
434 AcpiGbl_TableData[TableType].Name, (UINT32) TableType));
436 return_ACPI_STATUS (AE_BAD_DATA);
439 /* Now get the rest of the table */
441 *TableGlobalPtr = ACPI_ALLOCATE (AcpiTblHeader.Length);
442 if (!*TableGlobalPtr)
445 "Could not allocate buffer for Acpi table of length 0x%X\n",
446 (UINT32) ((FACS_DESCRIPTOR *) &AcpiTblHeader)->Length);
447 return_ACPI_STATUS (AE_NO_MEMORY);
450 TableInfo->Pointer = *TableGlobalPtr;
452 CopyExtendedToReal (*TableGlobalPtr, PhysAddr, AcpiTblHeader.Length);
454 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s=%p, (TableGlobalPtr=%p)\n",
455 AcpiGbl_TableData[TableType].Signature,
456 *TableGlobalPtr, TableGlobalPtr));
458 if (AcpiGbl_DbOpt_verbose)
460 AcpiUtDumpBuffer (*TableGlobalPtr, 48, 0, 0);
464 * Validate checksum for _most_ tables,
465 * even the ones whose signature we don't recognize
467 if (TableType != ACPI_TABLE_FACS)
469 /* But don't abort if the checksum is wrong */
470 /* TBD: make this a configuration option? */
472 AcpiTbVerifyTableChecksum (*TableGlobalPtr);
475 return_ACPI_STATUS (Status);
479 /******************************************************************************
481 * FUNCTION: AfGetAllTables
483 * PARAMETERS: Root - Root of the parse tree
489 *****************************************************************************/
493 UINT32 NumberOfTables,
496 ACPI_STATUS Status = AE_OK;
498 ACPI_TABLE_DESC TableInfo;
501 ACPI_FUNCTION_TRACE (AfGetAllTables);
504 if (AcpiGbl_DbOpt_verbose)
506 AcpiOsPrintf ("Number of tables: %d\n", (UINT32) NumberOfTables);
510 * Loop through all table pointers found in RSDT.
511 * This will NOT include the FACS and DSDT - we must get
512 * them after the loop
514 for (Index = 0; Index < NumberOfTables; Index++)
516 /* Get the table via the RSDT */
518 CopyExtendedToReal (&AcpiTblHeader, ACPI_GET_ADDRESS (AcpiGbl_XSDT->TableOffsetEntry[Index]),
519 sizeof (ACPI_TABLE_HEADER));
521 TableInfo.Pointer = &AcpiTblHeader;
522 TableInfo.Length = (ACPI_SIZE) AcpiTblHeader.Length;
523 TableInfo.Allocation = ACPI_MEM_ALLOCATED;
525 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Table pointer: %X\n",
526 (UINT32) ACPI_GET_ADDRESS (AcpiGbl_XSDT->TableOffsetEntry[Index])));
528 Status = AfRecognizeTable (NULL, ACPI_GET_ADDRESS (AcpiGbl_XSDT->TableOffsetEntry[Index]), &TableInfo);
529 if (ACPI_SUCCESS (Status))
531 AcpiTbInitTableDescriptor (TableInfo.Type, &TableInfo);
534 /* Ignore errors, just move on to next table */
539 AcpiOsPrintf ("FADT was not found, cannot obtain FACS and DSDT!\n");
540 return (AE_NO_ACPI_TABLES);
543 Status = AcpiTbConvertTableFadt ();
544 if (ACPI_FAILURE (Status))
546 return_ACPI_STATUS (Status);
552 CopyExtendedToReal (&AcpiTblHeader, ACPI_GET_ADDRESS (AcpiGbl_FADT->XFirmwareCtrl),
553 sizeof (ACPI_TABLE_HEADER));
554 AcpiGbl_FACS = ACPI_ALLOCATE (AcpiTblHeader.Length);
557 AcpiOsPrintf ("Could not allocate buffer for FADT length 0x%X\n",
558 (UINT32) AcpiTblHeader.Length);
559 return_ACPI_STATUS (AE_NO_MEMORY);
562 CopyExtendedToReal (AcpiGbl_FACS, ACPI_GET_ADDRESS (AcpiGbl_FADT->XFirmwareCtrl), AcpiTblHeader.Length);
564 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "FACS at %p (Phys %8.8X) length %X FADT at%p\n",
565 AcpiGbl_FACS, (UINT32) ACPI_GET_ADDRESS (AcpiGbl_FADT->XFirmwareCtrl),
566 (UINT32) AcpiTblHeader.Length, AcpiGbl_FADT));
567 if (AcpiGbl_DbOpt_verbose)
569 AcpiUtDumpBuffer ((char *) AcpiGbl_FADT, sizeof (ACPI_TABLE_HEADER), 0, 0);
572 TableInfo.Type = ACPI_TABLE_FADT;
573 TableInfo.Pointer = (void *) AcpiGbl_FADT;
574 TableInfo.Length = (ACPI_SIZE) AcpiTblHeader.Length;
575 TableInfo.Allocation = ACPI_MEM_ALLOCATED;
577 /* There is no checksum for the FACS, nothing to verify */
579 AcpiTbInitTableDescriptor (TableInfo.Type, &TableInfo);
581 AcpiTbBuildCommonFacs (&TableInfo);
586 CopyExtendedToReal (&AcpiTblHeader, ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt), sizeof (ACPI_TABLE_HEADER));
587 AcpiGbl_DSDT = ACPI_ALLOCATE (AcpiTblHeader.Length);
590 AcpiOsPrintf ("Could not allocate buffer for DSDT length 0x%X\n", (UINT32) AcpiTblHeader.Length);
591 return_ACPI_STATUS (AE_NO_MEMORY);
594 CopyExtendedToReal (AcpiGbl_DSDT, ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt), AcpiTblHeader.Length);
596 AcpiOsPrintf ("DSDT at %p (Phys %8.8X) length %X FADT at %p\n",
597 AcpiGbl_DSDT, (UINT32) ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt),
598 (UINT32) AcpiTblHeader.Length, AcpiGbl_FADT);
599 if (AcpiGbl_DbOpt_verbose)
601 AcpiUtDumpBuffer ((char *) AcpiGbl_DSDT, sizeof (ACPI_TABLE_HEADER), 0, 0);
604 TableInfo.Type = ACPI_TABLE_DSDT;
605 TableInfo.Pointer = (void *) AcpiGbl_DSDT;
606 TableInfo.Length = (ACPI_SIZE) AcpiTblHeader.Length;
607 TableInfo.Allocation = ACPI_MEM_ALLOCATED;
609 AcpiTbInitTableDescriptor (TableInfo.Type, &TableInfo);
610 AcpiTbVerifyTableChecksum ((ACPI_TABLE_HEADER *) AcpiGbl_DSDT);
612 return_ACPI_STATUS (AE_OK);
620 UINT32 PhysicalAddress;
621 UINT32 SignatureLength;
622 char *TableSignature;
624 ACPI_TABLE_DESC TableInfo;
627 ACPI_FUNCTION_TRACE (AfGetRsdt);
634 Found = AfFindRsdp (&AcpiGbl_RSDP);
637 AcpiOsPrintf ("Could not find RSDP in the low megabyte\n");
638 return (AE_NO_ACPI_TABLES);
641 /* Use XSDT if it is present */
643 if ((AcpiGbl_RSDP->Revision >= 2) &&
644 ACPI_GET_ADDRESS (AcpiGbl_RSDP->XsdtPhysicalAddress))
646 PhysicalAddress = ACPI_GET_ADDRESS (AcpiGbl_RSDP->XsdtPhysicalAddress);
647 TableSignature = ACPI_SIG_XSDT;
648 SignatureLength = sizeof (ACPI_SIG_XSDT) -1;
649 AcpiGbl_RootTableType = ACPI_TABLE_TYPE_XSDT;
651 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Found XSDT\n"));
655 /* No XSDT, use the RSDT */
657 PhysicalAddress = AcpiGbl_RSDP->RsdtPhysicalAddress;
658 TableSignature = ACPI_SIG_RSDT;
659 SignatureLength = sizeof (ACPI_SIG_RSDT) -1;
660 AcpiGbl_RootTableType = ACPI_TABLE_TYPE_RSDT;
662 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Found RSDT\n"));
665 if (AcpiGbl_DbOpt_verbose)
667 AcpiUtDumpBuffer ((char *) AcpiGbl_RSDP, sizeof (RSDP_DESCRIPTOR), 0, ACPI_UINT32_MAX);
670 /* Get the RSDT/XSDT header to determine the table length */
672 CopyExtendedToReal (&AcpiTblHeader, PhysicalAddress, sizeof (ACPI_TABLE_HEADER));
674 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDT/XSDT at %8.8X\n", (UINT32) PhysicalAddress));
675 if (AcpiGbl_DbOpt_verbose)
677 AcpiUtDumpBuffer ((char *) &AcpiTblHeader, sizeof (ACPI_TABLE_HEADER), 0, ACPI_UINT32_MAX);
680 /* Validate the table header */
682 Status = AcpiTbValidateTableHeader (&AcpiTblHeader);
683 if (ACPI_FAILURE (Status))
685 /* Table failed verification, map all errors to BAD_DATA */
687 ACPI_ERROR ((AE_INFO, "Invalid RSDT table header"));
688 return (AE_BAD_DATA);
691 /* Allocate a buffer for the entire table */
693 AcpiGbl_XSDT = (void *) malloc ((size_t) AcpiTblHeader.Length);
696 AcpiOsPrintf ("Could not allocate buffer for RSDT length 0x%X\n",
697 (UINT32) AcpiTblHeader.Length);
701 /* Get the entire RSDT/XSDT */
703 CopyExtendedToReal (AcpiGbl_XSDT, PhysicalAddress, AcpiTblHeader.Length);
704 AcpiOsPrintf ("%s at %p (Phys %8.8X)\n",
705 TableSignature, AcpiGbl_XSDT, (UINT32) PhysicalAddress);
707 if (AcpiGbl_DbOpt_verbose)
709 AcpiUtDumpBuffer ((char *) &AcpiTblHeader, sizeof (ACPI_TABLE_HEADER), 0, 0);
712 /* Convert to common format XSDT */
714 TableInfo.Pointer = (ACPI_TABLE_HEADER *) AcpiGbl_XSDT;
715 TableInfo.Length = (ACPI_SIZE) AcpiTblHeader.Length;
716 TableInfo.Allocation = ACPI_MEM_ALLOCATED;
718 AcpiGbl_RsdtTableCount = AcpiTbGetTableCount (AcpiGbl_RSDP, TableInfo.Pointer);
720 Status = AcpiTbConvertToXsdt (&TableInfo);
721 if (ACPI_FAILURE (Status))
726 AcpiGbl_XSDT = (XSDT_DESCRIPTOR *) TableInfo.Pointer;
738 UINT32 PhysicalAddress;
739 ACPI_TABLE_HEADER **Table;
740 ACPI_TABLE_HEADER ThisTable;
743 NumTables = (AcpiGbl_XSDT->Length - sizeof (ACPI_TABLE_HEADER)) / 8;
745 AcpiOsPrintf ("%d Tables defined in RSDT/XSDT:\n", NumTables);
747 for (i = 0; i < NumTables; i++)
749 PhysicalAddress = (UINT32) AcpiGbl_XSDT->TableOffsetEntry[i].Lo;
750 CopyExtendedToReal (&ThisTable, PhysicalAddress, sizeof (ACPI_TABLE_HEADER));
751 AcpiOsPrintf ("[%4.4s] ", ThisTable.Signature);
752 ((char *) Table) += 8;
760 ACPI_TABLE_HEADER *TableHeader,
761 UINT32 PhysicalAddress,
765 /* Allocate a buffer for the entire table */
767 *TablePtr = (void *) malloc ((size_t) TableHeader->Length);
770 AcpiOsPrintf ("Could not allocate buffer for table length 0x%X\n",
771 (UINT32) TableHeader->Length);
775 /* Get the entire table */
777 CopyExtendedToReal (*TablePtr, PhysicalAddress, TableHeader->Length);
778 AcpiOsPrintf ("%4.4s at %p (Phys %8.8X)\n",
779 TableHeader->Signature, *TablePtr, (UINT32) PhysicalAddress);
781 if (AcpiGbl_DbOpt_verbose)
783 AcpiUtDumpBuffer ((char *) TableHeader, sizeof (ACPI_TABLE_HEADER), 0, 0);
797 UINT32 PhysicalAddress;
798 ACPI_TABLE_HEADER ThisTable;
801 NumTables = (AcpiGbl_XSDT->Length - sizeof (ACPI_TABLE_HEADER)) / 8;
803 for (i = 0; i < NumTables; i++)
805 PhysicalAddress = (UINT32) AcpiGbl_XSDT->TableOffsetEntry[i].Lo;
806 CopyExtendedToReal (&ThisTable, PhysicalAddress, sizeof (ACPI_TABLE_HEADER));
808 if (ACPI_COMPARE_NAME (TableName, ThisTable.Signature))
810 AfGetTable (&ThisTable, PhysicalAddress, TablePtr);
815 return (AE_NOT_FOUND);
819 /******************************************************************************
821 * FUNCTION: AfFindTable
827 * DESCRIPTION: Load the DSDT from the file pointer
829 *****************************************************************************/
840 ACPI_FUNCTION_TRACE (AfFindTable);
845 Status = AfGetRsdt ();
846 if (ACPI_FAILURE (Status))
853 /* Get the rest of the required tables (DSDT, FADT) */
855 Status = AfGetAllTables (AcpiGbl_RsdtTableCount, NULL);
856 if (ACPI_FAILURE (Status))
861 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
865 if (ACPI_COMPARE_NAME (TableName, ACPI_SIG_DSDT))
867 *TablePtr = (UINT8 *) AcpiGbl_DSDT;
868 *TableLength = AcpiGbl_DSDT->Length;
870 else if (ACPI_COMPARE_NAME (TableName, ACPI_SIG_FADT))
872 *TablePtr = (UINT8 *) AcpiGbl_FADT;
873 *TableLength = AcpiGbl_FADT->Length;
875 else if (ACPI_COMPARE_NAME (TableName, ACPI_SIG_FACS))
877 *TablePtr = (UINT8 *) AcpiGbl_FACS;
878 *TableLength = AcpiGbl_FACS->Length;
880 else if (ACPI_COMPARE_NAME (TableName, ACPI_SIG_RSDT))
882 *TablePtr = (UINT8 *) AcpiGbl_XSDT;
883 *TableLength = AcpiGbl_XSDT->Length;
885 else if (ACPI_COMPARE_NAME (TableName, ACPI_SIG_SSDT))
887 AcpiOsPrintf ("Unsupported table signature: [%4.4s]\n", TableName);
893 Status = AfGetTableFromXsdt (TableName, TablePtr);
894 if (ACPI_FAILURE (Status))
899 *TableLength = (*((ACPI_TABLE_HEADER **)TablePtr))->Length;
906 ACPI_EXCEPTION ((AE_INFO, Status, "During ACPI Table initialization");
916 HPET_DESCRIPTION_TABLE *NewTable;
917 ACPI_TABLE_HEADER TableHeader;
926 ACPI_STRNCPY (TableHeader.Signature, "HPET", 4);
927 Status = AcpiOsTableOverride (&TableHeader, (ACPI_TABLE_HEADER **) &NewTable);
928 if (ACPI_FAILURE (Status))
933 AcpiDbgLevel |= ACPI_LV_TABLES;
934 AcpiOsPrintf ("HPET table :\n");
935 AcpiUtDumpBuffer ((char *) NewTable, NewTable->Header.Length, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
937 for (i = 0; i < 1024; i++)
944 CopyExtendedToReal (&Value, 0xD0, 4);
945 AcpiOsPrintf ("Reg 0xD0: %8.8X\n", Value);
947 Value = dIn32 (0xD0);
948 AcpiOsPrintf ("Port 0xD0: %8.8X\n", Value);
949 Value |= ACPI_ENABLE_HPET;
951 vOut32 (0xD0, Value);
952 Value2 = dIn32 (0xD0);
953 AcpiOsPrintf ("Port 0xD0: Wrote: %8.8X got %8.8X\n", Value, Value2);
955 AcpiOsPrintf ("HPET block(at %8.8X):\n", NewTable->BaseAddress[2]);
956 CopyExtendedToReal (Hbuf, NewTable->BaseAddress[2], 1024);
957 AcpiUtDumpBuffer ((char *) Hbuf, 1024, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);