]> CyberLeo.Net >> Repos - FreeBSD/releng/8.0.git/blob - sys/contrib/dev/acpica/tables/tbutils.c
Adjust to reflect 8.0-RELEASE.
[FreeBSD/releng/8.0.git] / sys / contrib / dev / acpica / tables / tbutils.c
1 /******************************************************************************
2  *
3  * Module Name: tbutils   - table utilities
4  *
5  *****************************************************************************/
6
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2009, 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 #define __TBUTILS_C__
117
118 #include <contrib/dev/acpica/include/acpi.h>
119 #include <contrib/dev/acpica/include/accommon.h>
120 #include <contrib/dev/acpica/include/actables.h>
121
122 #define _COMPONENT          ACPI_TABLES
123         ACPI_MODULE_NAME    ("tbutils")
124
125 /* Local prototypes */
126
127 static ACPI_PHYSICAL_ADDRESS
128 AcpiTbGetRootTableEntry (
129     UINT8                   *TableEntry,
130     UINT32                  TableEntrySize);
131
132
133 /*******************************************************************************
134  *
135  * FUNCTION:    AcpiTbInitializeFacs
136  *
137  * PARAMETERS:  None
138  *
139  * RETURN:      Status
140  *
141  * DESCRIPTION: Create a permanent mapping for the FADT and save it in a global
142  *              for accessing the Global Lock and Firmware Waking Vector
143  *
144  ******************************************************************************/
145
146 ACPI_STATUS
147 AcpiTbInitializeFacs (
148     void)
149 {
150     ACPI_STATUS             Status;
151
152
153     Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS,
154                 ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_FACS));
155     return (Status);
156 }
157
158
159 /*******************************************************************************
160  *
161  * FUNCTION:    AcpiTbTablesLoaded
162  *
163  * PARAMETERS:  None
164  *
165  * RETURN:      TRUE if required ACPI tables are loaded
166  *
167  * DESCRIPTION: Determine if the minimum required ACPI tables are present
168  *              (FADT, FACS, DSDT)
169  *
170  ******************************************************************************/
171
172 BOOLEAN
173 AcpiTbTablesLoaded (
174     void)
175 {
176
177     if (AcpiGbl_RootTableList.Count >= 3)
178     {
179         return (TRUE);
180     }
181
182     return (FALSE);
183 }
184
185
186 /*******************************************************************************
187  *
188  * FUNCTION:    AcpiTbPrintTableHeader
189  *
190  * PARAMETERS:  Address             - Table physical address
191  *              Header              - Table header
192  *
193  * RETURN:      None
194  *
195  * DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP.
196  *
197  ******************************************************************************/
198
199 void
200 AcpiTbPrintTableHeader (
201     ACPI_PHYSICAL_ADDRESS   Address,
202     ACPI_TABLE_HEADER       *Header)
203 {
204
205     /*
206      * The reason that the Address is cast to a void pointer is so that we
207      * can use %p which will work properly on both 32-bit and 64-bit hosts.
208      */
209     if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_FACS))
210     {
211         /* FACS only has signature and length fields */
212
213         ACPI_INFO ((AE_INFO, "%4.4s %p %05X",
214             Header->Signature, ACPI_CAST_PTR (void, Address),
215             Header->Length));
216     }
217     else if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_RSDP))
218     {
219         /* RSDP has no common fields */
220
221         ACPI_INFO ((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)",
222             ACPI_CAST_PTR (void, Address),
223             (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ?
224                 ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20,
225             ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision,
226             ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId));
227     }
228     else
229     {
230         /* Standard ACPI table with full common header */
231
232         ACPI_INFO ((AE_INFO,
233             "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
234             Header->Signature, ACPI_CAST_PTR (void, Address),
235             Header->Length, Header->Revision, Header->OemId,
236             Header->OemTableId, Header->OemRevision, Header->AslCompilerId,
237             Header->AslCompilerRevision));
238     }
239 }
240
241
242 /*******************************************************************************
243  *
244  * FUNCTION:    AcpiTbValidateChecksum
245  *
246  * PARAMETERS:  Table               - ACPI table to verify
247  *              Length              - Length of entire table
248  *
249  * RETURN:      Status
250  *
251  * DESCRIPTION: Verifies that the table checksums to zero. Optionally returns
252  *              exception on bad checksum.
253  *
254  ******************************************************************************/
255
256 ACPI_STATUS
257 AcpiTbVerifyChecksum (
258     ACPI_TABLE_HEADER       *Table,
259     UINT32                  Length)
260 {
261     UINT8                   Checksum;
262
263
264     /* Compute the checksum on the table */
265
266     Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Length);
267
268     /* Checksum ok? (should be zero) */
269
270     if (Checksum)
271     {
272         ACPI_WARNING ((AE_INFO,
273             "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X",
274             Table->Signature, Table->Checksum,
275             (UINT8) (Table->Checksum - Checksum)));
276
277 #if (ACPI_CHECKSUM_ABORT)
278         return (AE_BAD_CHECKSUM);
279 #endif
280     }
281
282     return (AE_OK);
283 }
284
285
286 /*******************************************************************************
287  *
288  * FUNCTION:    AcpiTbChecksum
289  *
290  * PARAMETERS:  Buffer          - Pointer to memory region to be checked
291  *              Length          - Length of this memory region
292  *
293  * RETURN:      Checksum (UINT8)
294  *
295  * DESCRIPTION: Calculates circular checksum of memory region.
296  *
297  ******************************************************************************/
298
299 UINT8
300 AcpiTbChecksum (
301     UINT8                   *Buffer,
302     UINT32                  Length)
303 {
304     UINT8                   Sum = 0;
305     UINT8                   *End = Buffer + Length;
306
307
308     while (Buffer < End)
309     {
310         Sum = (UINT8) (Sum + *(Buffer++));
311     }
312
313     return Sum;
314 }
315
316
317 /*******************************************************************************
318  *
319  * FUNCTION:    AcpiTbInstallTable
320  *
321  * PARAMETERS:  Address                 - Physical address of DSDT or FACS
322  *              Signature               - Table signature, NULL if no need to
323  *                                        match
324  *              TableIndex              - Index into root table array
325  *
326  * RETURN:      None
327  *
328  * DESCRIPTION: Install an ACPI table into the global data structure. The
329  *              table override mechanism is implemented here to allow the host
330  *              OS to replace any table before it is installed in the root
331  *              table array.
332  *
333  ******************************************************************************/
334
335 void
336 AcpiTbInstallTable (
337     ACPI_PHYSICAL_ADDRESS   Address,
338     char                    *Signature,
339     UINT32                  TableIndex)
340 {
341     UINT8                   Flags;
342     ACPI_STATUS             Status;
343     ACPI_TABLE_HEADER       *TableToInstall;
344     ACPI_TABLE_HEADER       *MappedTable;
345     ACPI_TABLE_HEADER       *OverrideTable = NULL;
346
347
348     if (!Address)
349     {
350         ACPI_ERROR ((AE_INFO, "Null physical address for ACPI table [%s]",
351             Signature));
352         return;
353     }
354
355     /* Map just the table header */
356
357     MappedTable = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
358     if (!MappedTable)
359     {
360         return;
361     }
362
363     /* Skip SSDT when DSDT is overriden */
364
365     if (ACPI_COMPARE_NAME (MappedTable->Signature, ACPI_SIG_SSDT) &&
366        (AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Flags &
367             ACPI_TABLE_ORIGIN_OVERRIDE))
368     {
369         ACPI_INFO ((AE_INFO,
370             "%4.4s @ 0x%p Table override, replaced with:", ACPI_SIG_SSDT,
371             ACPI_CAST_PTR (void, Address)));
372         AcpiTbPrintTableHeader (
373             AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Address,
374             AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer);
375         goto UnmapAndExit;
376     }
377
378     /* If a particular signature is expected (DSDT/FACS), it must match */
379
380     if (Signature &&
381         !ACPI_COMPARE_NAME (MappedTable->Signature, Signature))
382     {
383         ACPI_ERROR ((AE_INFO,
384             "Invalid signature 0x%X for ACPI table, expected [%s]",
385             *ACPI_CAST_PTR (UINT32, MappedTable->Signature), Signature));
386         goto UnmapAndExit;
387     }
388
389     /*
390      * ACPI Table Override:
391      *
392      * Before we install the table, let the host OS override it with a new
393      * one if desired. Any table within the RSDT/XSDT can be replaced,
394      * including the DSDT which is pointed to by the FADT.
395      */
396     Status = AcpiOsTableOverride (MappedTable, &OverrideTable);
397     if (ACPI_SUCCESS (Status) && OverrideTable)
398     {
399         ACPI_INFO ((AE_INFO,
400             "%4.4s @ 0x%p Table override, replaced with:",
401             MappedTable->Signature, ACPI_CAST_PTR (void, Address)));
402
403         AcpiGbl_RootTableList.Tables[TableIndex].Pointer = OverrideTable;
404         Address = ACPI_PTR_TO_PHYSADDR (OverrideTable);
405
406         TableToInstall = OverrideTable;
407         Flags = ACPI_TABLE_ORIGIN_OVERRIDE;
408     }
409     else
410     {
411         TableToInstall = MappedTable;
412         Flags = ACPI_TABLE_ORIGIN_MAPPED;
413     }
414
415     /* Initialize the table entry */
416
417     AcpiGbl_RootTableList.Tables[TableIndex].Address = Address;
418     AcpiGbl_RootTableList.Tables[TableIndex].Length = TableToInstall->Length;
419     AcpiGbl_RootTableList.Tables[TableIndex].Flags = Flags;
420
421     ACPI_MOVE_32_TO_32 (
422         &(AcpiGbl_RootTableList.Tables[TableIndex].Signature),
423         TableToInstall->Signature);
424
425     AcpiTbPrintTableHeader (Address, TableToInstall);
426
427     if (TableIndex == ACPI_TABLE_INDEX_DSDT)
428     {
429         /* Global integer width is based upon revision of the DSDT */
430
431         AcpiUtSetIntegerWidth (TableToInstall->Revision);
432     }
433
434 UnmapAndExit:
435     AcpiOsUnmapMemory (MappedTable, sizeof (ACPI_TABLE_HEADER));
436 }
437
438
439 /*******************************************************************************
440  *
441  * FUNCTION:    AcpiTbGetRootTableEntry
442  *
443  * PARAMETERS:  TableEntry          - Pointer to the RSDT/XSDT table entry
444  *              TableEntrySize      - sizeof 32 or 64 (RSDT or XSDT)
445  *
446  * RETURN:      Physical address extracted from the root table
447  *
448  * DESCRIPTION: Get one root table entry. Handles 32-bit and 64-bit cases on
449  *              both 32-bit and 64-bit platforms
450  *
451  * NOTE:        ACPI_PHYSICAL_ADDRESS is 32-bit on 32-bit platforms, 64-bit on
452  *              64-bit platforms.
453  *
454  ******************************************************************************/
455
456 static ACPI_PHYSICAL_ADDRESS
457 AcpiTbGetRootTableEntry (
458     UINT8                   *TableEntry,
459     UINT32                  TableEntrySize)
460 {
461     UINT64                  Address64;
462
463
464     /*
465      * Get the table physical address (32-bit for RSDT, 64-bit for XSDT):
466      * Note: Addresses are 32-bit aligned (not 64) in both RSDT and XSDT
467      */
468     if (TableEntrySize == sizeof (UINT32))
469     {
470         /*
471          * 32-bit platform, RSDT: Return 32-bit table entry
472          * 64-bit platform, RSDT: Expand 32-bit to 64-bit and return
473          */
474         return ((ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST_PTR (UINT32, TableEntry)));
475     }
476     else
477     {
478         /*
479          * 32-bit platform, XSDT: Truncate 64-bit to 32-bit and return
480          * 64-bit platform, XSDT: Move (unaligned) 64-bit to local,
481          *  return 64-bit
482          */
483         ACPI_MOVE_64_TO_64 (&Address64, TableEntry);
484
485 #if ACPI_MACHINE_WIDTH == 32
486         if (Address64 > ACPI_UINT32_MAX)
487         {
488             /* Will truncate 64-bit address to 32 bits, issue warning */
489
490             ACPI_WARNING ((AE_INFO,
491                 "64-bit Physical Address in XSDT is too large (%8.8X%8.8X),"
492                 " truncating",
493                 ACPI_FORMAT_UINT64 (Address64)));
494         }
495 #endif
496         return ((ACPI_PHYSICAL_ADDRESS) (Address64));
497     }
498 }
499
500
501 /*******************************************************************************
502  *
503  * FUNCTION:    AcpiTbParseRootTable
504  *
505  * PARAMETERS:  Rsdp                    - Pointer to the RSDP
506  *
507  * RETURN:      Status
508  *
509  * DESCRIPTION: This function is called to parse the Root System Description
510  *              Table (RSDT or XSDT)
511  *
512  * NOTE:        Tables are mapped (not copied) for efficiency. The FACS must
513  *              be mapped and cannot be copied because it contains the actual
514  *              memory location of the ACPI Global Lock.
515  *
516  ******************************************************************************/
517
518 ACPI_STATUS
519 AcpiTbParseRootTable (
520     ACPI_PHYSICAL_ADDRESS   RsdpAddress)
521 {
522     ACPI_TABLE_RSDP         *Rsdp;
523     UINT32                  TableEntrySize;
524     UINT32                  i;
525     UINT32                  TableCount;
526     ACPI_TABLE_HEADER       *Table;
527     ACPI_PHYSICAL_ADDRESS   Address;
528     UINT32                  Length;
529     UINT8                   *TableEntry;
530     ACPI_STATUS             Status;
531
532
533     ACPI_FUNCTION_TRACE (TbParseRootTable);
534
535
536     /*
537      * Map the entire RSDP and extract the address of the RSDT or XSDT
538      */
539     Rsdp = AcpiOsMapMemory (RsdpAddress, sizeof (ACPI_TABLE_RSDP));
540     if (!Rsdp)
541     {
542         return_ACPI_STATUS (AE_NO_MEMORY);
543     }
544
545     AcpiTbPrintTableHeader (RsdpAddress,
546         ACPI_CAST_PTR (ACPI_TABLE_HEADER, Rsdp));
547
548     /* Differentiate between RSDT and XSDT root tables */
549
550     if (Rsdp->Revision > 1 && Rsdp->XsdtPhysicalAddress)
551     {
552         /*
553          * Root table is an XSDT (64-bit physical addresses). We must use the
554          * XSDT if the revision is > 1 and the XSDT pointer is present, as per
555          * the ACPI specification.
556          */
557         Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->XsdtPhysicalAddress;
558         TableEntrySize = sizeof (UINT64);
559     }
560     else
561     {
562         /* Root table is an RSDT (32-bit physical addresses) */
563
564         Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->RsdtPhysicalAddress;
565         TableEntrySize = sizeof (UINT32);
566     }
567
568     /*
569      * It is not possible to map more than one entry in some environments,
570      * so unmap the RSDP here before mapping other tables
571      */
572     AcpiOsUnmapMemory (Rsdp, sizeof (ACPI_TABLE_RSDP));
573
574
575     /* Map the RSDT/XSDT table header to get the full table length */
576
577     Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
578     if (!Table)
579     {
580         return_ACPI_STATUS (AE_NO_MEMORY);
581     }
582
583     AcpiTbPrintTableHeader (Address, Table);
584
585     /* Get the length of the full table, verify length and map entire table */
586
587     Length = Table->Length;
588     AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
589
590     if (Length < sizeof (ACPI_TABLE_HEADER))
591     {
592         ACPI_ERROR ((AE_INFO, "Invalid length 0x%X in RSDT/XSDT", Length));
593         return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
594     }
595
596     Table = AcpiOsMapMemory (Address, Length);
597     if (!Table)
598     {
599         return_ACPI_STATUS (AE_NO_MEMORY);
600     }
601
602     /* Validate the root table checksum */
603
604     Status = AcpiTbVerifyChecksum (Table, Length);
605     if (ACPI_FAILURE (Status))
606     {
607         AcpiOsUnmapMemory (Table, Length);
608         return_ACPI_STATUS (Status);
609     }
610
611     /* Calculate the number of tables described in the root table */
612
613     TableCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) /
614         TableEntrySize);
615
616     /*
617      * First two entries in the table array are reserved for the DSDT
618      * and FACS, which are not actually present in the RSDT/XSDT - they
619      * come from the FADT
620      */
621     TableEntry = ACPI_CAST_PTR (UINT8, Table) + sizeof (ACPI_TABLE_HEADER);
622     AcpiGbl_RootTableList.Count = 2;
623
624     /*
625      * Initialize the root table array from the RSDT/XSDT
626      */
627     for (i = 0; i < TableCount; i++)
628     {
629         if (AcpiGbl_RootTableList.Count >= AcpiGbl_RootTableList.Size)
630         {
631             /* There is no more room in the root table array, attempt resize */
632
633             Status = AcpiTbResizeRootTableList ();
634             if (ACPI_FAILURE (Status))
635             {
636                 ACPI_WARNING ((AE_INFO, "Truncating %u table entries!",
637                     (unsigned) (TableCount -
638                     (AcpiGbl_RootTableList.Count - 2))));
639                 break;
640             }
641         }
642
643         /* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */
644
645         AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Address =
646             AcpiTbGetRootTableEntry (TableEntry, TableEntrySize);
647
648         TableEntry += TableEntrySize;
649         AcpiGbl_RootTableList.Count++;
650     }
651
652     /*
653      * It is not possible to map more than one entry in some environments,
654      * so unmap the root table here before mapping other tables
655      */
656     AcpiOsUnmapMemory (Table, Length);
657
658     /*
659      * Complete the initialization of the root table array by examining
660      * the header of each table
661      */
662     for (i = 2; i < AcpiGbl_RootTableList.Count; i++)
663     {
664         AcpiTbInstallTable (AcpiGbl_RootTableList.Tables[i].Address,
665             NULL, i);
666
667         /* Special case for FADT - get the DSDT and FACS */
668
669         if (ACPI_COMPARE_NAME (
670                 &AcpiGbl_RootTableList.Tables[i].Signature, ACPI_SIG_FADT))
671         {
672             AcpiTbParseFadt (i);
673         }
674     }
675
676     return_ACPI_STATUS (AE_OK);
677 }