]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/acpica/lib-acpi/src/acpica/tools/acpiexec/aetables.c
Inital import
[l4.git] / l4 / pkg / acpica / lib-acpi / src / acpica / tools / acpiexec / aetables.c
1 /******************************************************************************
2  *
3  * Module Name: aetables - Miscellaneous ACPI tables for acpiexec utility
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 #include "aecommon.h"
117
118 #define _COMPONENT          ACPI_TOOLS
119         ACPI_MODULE_NAME    ("aetables")
120
121 /* Local prototypes */
122
123 void
124 AeTableOverride (
125     ACPI_TABLE_HEADER       *ExistingTable,
126     ACPI_TABLE_HEADER       **NewTable);
127
128 ACPI_PHYSICAL_ADDRESS
129 AeLocalGetRootPointer (
130     void);
131
132 /*
133  * Misc ACPI tables to be installed
134  */
135
136 /* Default DSDT. This will be replaced with the input DSDT */
137
138 unsigned char DsdtCode[] =
139 {
140     0x44,0x53,0x44,0x54,0x24,0x00,0x00,0x00,  /* 00000000    "DSDT$..." */
141     0x02,0x6F,0x49,0x6E,0x74,0x65,0x6C,0x00,  /* 00000008    ".oIntel." */
142     0x4E,0x75,0x6C,0x6C,0x44,0x53,0x44,0x54,  /* 00000010    "NullDSDT" */
143     0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
144     0x04,0x12,0x08,0x20,
145 };
146
147 unsigned char LocalDsdtCode[] =
148 {
149     0x44,0x53,0x44,0x54,0x24,0x00,0x00,0x00,  /* 00000000    "DSDT$..." */
150     0x02,0x2C,0x49,0x6E,0x74,0x65,0x6C,0x00,  /* 00000008    ".,Intel." */
151     0x4C,0x6F,0x63,0x61,0x6C,0x00,0x00,0x00,  /* 00000010    "Local..." */
152     0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
153     0x30,0x07,0x09,0x20,
154 };
155
156 /* Several example SSDTs */
157
158 unsigned char Ssdt1Code[] = /* Has method _T98 */
159 {
160     0x53,0x53,0x44,0x54,0x30,0x00,0x00,0x00,  /* 00000000    "SSDT0..." */
161     0x01,0xB8,0x49,0x6E,0x74,0x65,0x6C,0x00,  /* 00000008    "..Intel." */
162     0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00,  /* 00000010    "Many...." */
163     0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
164     0x24,0x04,0x03,0x20,0x14,0x0B,0x5F,0x54,  /* 00000020    "$.. .._T" */
165     0x39,0x38,0x00,0x70,0x0A,0x04,0x60,0xA4,  /* 00000028    "98.p..`." */
166 };
167
168 unsigned char Ssdt2Code[] = /* Has method _T99 */
169 {
170     0x53,0x53,0x44,0x54,0x30,0x00,0x00,0x00,  /* 00000000    "SSDT0..." */
171     0x01,0xB7,0x49,0x6E,0x74,0x65,0x6C,0x00,  /* 00000008    "..Intel." */
172     0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00,  /* 00000010    "Many...." */
173     0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
174     0x24,0x04,0x03,0x20,0x14,0x0B,0x5F,0x54,  /* 00000020    "$.. .._T" */
175     0x39,0x39,0x00,0x70,0x0A,0x04,0x60,0xA4,  /* 00000028    "99.p..`." */
176 };
177
178 unsigned char Ssdt3Code[] = /* Has method _T97 */
179 {
180     0x54,0x53,0x44,0x54,0x30,0x00,0x00,0x00,  /* 00000000    "TSDT0..." */
181     0x01,0xB8,0x49,0x6E,0x74,0x65,0x6C,0x00,  /* 00000008    "..Intel." */
182     0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00,  /* 00000010    "Many...." */
183     0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
184     0x24,0x04,0x03,0x20,0x14,0x0B,0x5F,0x54,  /* 00000020    "$.. .._T" */
185     0x39,0x37,0x00,0x70,0x0A,0x04,0x60,0xA4,  /* 00000028    "97.p..`." */
186 };
187
188 /* Example OEM table */
189
190 unsigned char Oem1Code[] =
191 {
192     0x4F,0x45,0x4D,0x31,0x38,0x00,0x00,0x00,  /* 00000000    "OEM18..." */
193     0x01,0x4B,0x49,0x6E,0x74,0x65,0x6C,0x00,  /* 00000008    ".KIntel." */
194     0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00,  /* 00000010    "Many...." */
195     0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
196     0x18,0x09,0x03,0x20,0x08,0x5F,0x58,0x54,  /* 00000020    "... ._XT" */
197     0x32,0x0A,0x04,0x14,0x0C,0x5F,0x58,0x54,  /* 00000028    "2...._XT" */
198     0x31,0x00,0x70,0x01,0x5F,0x58,0x54,0x32,  /* 00000030    "1.p._XT2" */
199 };
200
201 /*
202  * Example installable control method
203  *
204  * DefinitionBlock ("", "DSDT", 2, "Intel", "MTHDTEST", 0x20090512)
205  * {
206  *     Method (\_SI_._T97, 1, Serialized)
207  *     {
208  *         Store ("Example installed method", Debug)
209  *         Store (Arg0, Debug)
210  *         Return ()
211  *     }
212  * }
213  *
214  * Compiled byte code below.
215  */
216 unsigned char MethodCode[] =
217 {
218     0x44,0x53,0x44,0x54,0x53,0x00,0x00,0x00,  /* 00000000    "DSDTS..." */
219     0x02,0xF9,0x49,0x6E,0x74,0x65,0x6C,0x00,  /* 00000008    "..Intel." */
220     0x4D,0x54,0x48,0x44,0x54,0x45,0x53,0x54,  /* 00000010    "MTHDTEST" */
221     0x12,0x05,0x09,0x20,0x49,0x4E,0x54,0x4C,  /* 00000018    "... INTL" */
222     0x22,0x04,0x09,0x20,0x14,0x2E,0x2E,0x5F,  /* 00000020    "".. ..._" */
223     0x54,0x49,0x5F,0x5F,0x54,0x39,0x37,0x09,  /* 00000028    "SI__T97." */
224     0x70,0x0D,0x45,0x78,0x61,0x6D,0x70,0x6C,  /* 00000030    "p.Exampl" */
225     0x65,0x20,0x69,0x6E,0x73,0x74,0x61,0x6C,  /* 00000038    "e instal" */
226     0x6C,0x65,0x64,0x20,0x6D,0x65,0x74,0x68,  /* 00000040    "led meth" */
227     0x6F,0x64,0x00,0x5B,0x31,0x70,0x68,0x5B,  /* 00000048    "od.[1ph[" */
228     0x31,0xA4,0x00,
229 };
230
231
232 /*
233  * We need a local FADT so that the hardware subcomponent will function,
234  * even though the underlying OSD HW access functions don't do
235  * anything.
236  */
237 ACPI_TABLE_HEADER           *DsdtToInstallOverride;
238 ACPI_TABLE_RSDP             LocalRSDP;
239 ACPI_TABLE_FADT             LocalFADT;
240 ACPI_TABLE_FACS             LocalFACS;
241 ACPI_TABLE_HEADER           LocalTEST;
242 ACPI_TABLE_HEADER           LocalBADTABLE;
243 ACPI_TABLE_RSDT             *LocalRSDT;
244
245 #define BASE_RSDT_TABLES    6
246 #define BASE_RSDT_SIZE      (sizeof (ACPI_TABLE_RSDT) + ((BASE_RSDT_TABLES -1) * sizeof (UINT32)))
247
248 #define ACPI_MAX_INIT_TABLES (32)
249 static ACPI_TABLE_DESC      Tables[ACPI_MAX_INIT_TABLES];
250
251
252 /******************************************************************************
253  *
254  * FUNCTION:    AeTableOverride
255  *
256  * DESCRIPTION: Local implementation of AcpiOsTableOverride.
257  *              Exercise the override mechanism
258  *
259  *****************************************************************************/
260
261 void
262 AeTableOverride (
263     ACPI_TABLE_HEADER       *ExistingTable,
264     ACPI_TABLE_HEADER       **NewTable)
265 {
266
267     /* This code exercises the table override mechanism in the core */
268
269     if (ACPI_COMPARE_NAME (ExistingTable->Signature, ACPI_SIG_DSDT))
270     {
271         *NewTable = DsdtToInstallOverride;
272     }
273
274     /* This code tests override of dynamically loaded tables */
275
276     else if (ACPI_COMPARE_NAME (ExistingTable->Signature, "TSDT"))
277     {
278         *NewTable = ACPI_CAST_PTR (ACPI_TABLE_HEADER, Ssdt3Code);
279     }
280 }
281
282
283 /******************************************************************************
284  *
285  * FUNCTION:    AeBuildLocalTables
286  *
287  * PARAMETERS:  TableCount      - Number of tables on the command line
288  *              TableList       - List of actual tables from files
289  *
290  * RETURN:      Status
291  *
292  * DESCRIPTION: Build a complete ACPI table chain, with a local RSDP, RSDT,
293  *              FADT, and several other test tables.
294  *
295  *****************************************************************************/
296
297 ACPI_STATUS
298 AeBuildLocalTables (
299     UINT32                  TableCount,
300     AE_TABLE_DESC           *TableList)
301 {
302     ACPI_PHYSICAL_ADDRESS   DsdtAddress = 0;
303     UINT32                  RsdtSize;
304     AE_TABLE_DESC           *NextTable;
305     UINT32                  NextIndex;
306     ACPI_TABLE_FADT         *ExternalFadt = NULL;
307
308
309     /*
310      * Update the table count. For DSDT, it is not put into the RSDT. For
311      * FADT, this is already accounted for since we usually install a
312      * local FADT.
313      */
314     NextTable = TableList;
315     while (NextTable)
316     {
317         if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT) ||
318             ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT))
319         {
320             TableCount--;
321         }
322         NextTable = NextTable->Next;
323     }
324
325     RsdtSize = BASE_RSDT_SIZE + (TableCount * sizeof (UINT32));
326
327     /* Build an RSDT */
328
329     LocalRSDT = AcpiOsAllocate (RsdtSize);
330     if (!LocalRSDT)
331     {
332         return AE_NO_MEMORY;
333     }
334
335     ACPI_MEMSET (LocalRSDT, 0, RsdtSize);
336     ACPI_STRNCPY (LocalRSDT->Header.Signature, ACPI_SIG_RSDT, 4);
337     LocalRSDT->Header.Length = RsdtSize;
338
339     LocalRSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalTEST);
340     LocalRSDT->TableOffsetEntry[1] = ACPI_PTR_TO_PHYSADDR (&LocalBADTABLE);
341     LocalRSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (&LocalFADT);
342
343     /* Install two SSDTs to test multiple table support */
344
345     LocalRSDT->TableOffsetEntry[3] = ACPI_PTR_TO_PHYSADDR (&Ssdt1Code);
346     LocalRSDT->TableOffsetEntry[4] = ACPI_PTR_TO_PHYSADDR (&Ssdt2Code);
347
348     /* Install the OEM1 table to test LoadTable */
349
350     LocalRSDT->TableOffsetEntry[5] = ACPI_PTR_TO_PHYSADDR (&Oem1Code);
351
352     /*
353      * Install the user tables. The DSDT must be installed in the FADT.
354      * All other tables are installed directly into the RSDT.
355      */
356     NextIndex = BASE_RSDT_TABLES;
357     NextTable = TableList;
358     while (NextTable)
359     {
360         /*
361          * Incoming DSDT or FADT are special cases. All other tables are
362          * just immediately installed into the RSDT.
363          */
364         if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT))
365         {
366             if (DsdtAddress)
367             {
368                 printf ("Already found a DSDT, only one allowed\n");
369                 return AE_ALREADY_EXISTS;
370             }
371
372             /* The incoming user table is a DSDT */
373
374             DsdtAddress = ACPI_PTR_TO_PHYSADDR (&DsdtCode);
375             DsdtToInstallOverride = NextTable->Table;
376         }
377         else if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT))
378         {
379             ExternalFadt = ACPI_CAST_PTR (ACPI_TABLE_FADT, NextTable->Table);
380             LocalRSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (NextTable->Table);
381         }
382         else
383         {
384             /* Install the table in the RSDT */
385
386             LocalRSDT->TableOffsetEntry[NextIndex] = ACPI_PTR_TO_PHYSADDR (NextTable->Table);
387             NextIndex++;
388         }
389
390         NextTable = NextTable->Next;
391     }
392
393     /* Build an RSDP */
394
395     ACPI_MEMSET (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP));
396     ACPI_MEMCPY (LocalRSDP.Signature, ACPI_SIG_RSDP, 8);
397     ACPI_MEMCPY (LocalRSDP.OemId, "I_TEST", 6);
398     LocalRSDP.Revision = 1;
399     LocalRSDP.RsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalRSDT);
400     LocalRSDP.Length = sizeof (ACPI_TABLE_RSDT);
401
402     /* Set checksums for both RSDT and RSDP */
403
404     LocalRSDT->Header.Checksum = (UINT8) -AcpiTbChecksum (
405         (void *) LocalRSDT, LocalRSDT->Header.Length);
406     LocalRSDP.Checksum = (UINT8) -AcpiTbChecksum (
407         (void *) &LocalRSDP, ACPI_RSDP_CHECKSUM_LENGTH);
408
409     if (!DsdtAddress)
410     {
411         /* Use the local DSDT because incoming table(s) are all SSDT(s) */
412
413         DsdtAddress = ACPI_PTR_TO_PHYSADDR (LocalDsdtCode);
414         DsdtToInstallOverride = ACPI_CAST_PTR (ACPI_TABLE_HEADER, LocalDsdtCode);
415     }
416
417     if (ExternalFadt)
418     {
419         /*
420          * Use the external FADT, but we must update the DSDT/FACS addresses
421          * as well as the checksum
422          */
423         ExternalFadt->Dsdt = DsdtAddress;
424         ExternalFadt->Facs = ACPI_PTR_TO_PHYSADDR (&LocalFACS);
425
426         if (ExternalFadt->Header.Length > ACPI_PTR_DIFF (&ExternalFadt->XDsdt, ExternalFadt))
427         {
428             ExternalFadt->XDsdt = DsdtAddress;
429             ExternalFadt->XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS);
430         }
431         /* Complete the FADT with the checksum */
432
433         ExternalFadt->Header.Checksum = 0;
434         ExternalFadt->Header.Checksum = (UINT8) -AcpiTbChecksum (
435             (void *) ExternalFadt, ExternalFadt->Header.Length);
436     }
437     else
438     {
439         /*
440          * Build a local FADT so we can test the hardware/event init
441          */
442         ACPI_MEMSET (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT));
443         ACPI_STRNCPY (LocalFADT.Header.Signature, ACPI_SIG_FADT, 4);
444
445         /* Setup FADT header and DSDT/FACS addresses */
446
447         LocalFADT.Dsdt = DsdtAddress;
448         LocalFADT.Facs = ACPI_PTR_TO_PHYSADDR (&LocalFACS);
449
450         LocalFADT.XDsdt = DsdtAddress;
451         LocalFADT.XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS);
452
453         LocalFADT.Header.Revision = 3;
454         LocalFADT.Header.Length = sizeof (ACPI_TABLE_FADT);
455
456         /* Miscellaneous FADT fields */
457
458         LocalFADT.Gpe0BlockLength = 16;
459         LocalFADT.Gpe1BlockLength = 6;
460         LocalFADT.Gpe1Base = 96;
461
462         LocalFADT.Pm1EventLength = 4;
463         LocalFADT.Pm1ControlLength = 2;
464         LocalFADT.PmTimerLength  = 4;
465
466         LocalFADT.Gpe0Block = 0x00001234;
467         LocalFADT.Gpe1Block = 0x00005678;
468
469         LocalFADT.Pm1aEventBlock = 0x00001aaa;
470         LocalFADT.Pm1bEventBlock = 0x00001bbb;
471         LocalFADT.PmTimerBlock = 0xA0;
472         LocalFADT.Pm1aControlBlock = 0xB0;
473
474         /* Setup one example X-64 field */
475
476         LocalFADT.XPm1bEventBlock.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
477         LocalFADT.XPm1bEventBlock.Address = LocalFADT.Pm1bEventBlock;
478         LocalFADT.XPm1bEventBlock.BitWidth = (UINT8) ACPI_MUL_8 (LocalFADT.Pm1EventLength);
479
480         /* Complete the FADT with the checksum */
481
482         LocalFADT.Header.Checksum = 0;
483         LocalFADT.Header.Checksum = (UINT8) -AcpiTbChecksum (
484             (void *) &LocalFADT, LocalFADT.Header.Length);
485     }
486
487     /* Build a FACS */
488
489     ACPI_MEMSET (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS));
490     ACPI_STRNCPY (LocalFACS.Signature, ACPI_SIG_FACS, 4);
491
492     LocalFACS.Length = sizeof (ACPI_TABLE_FACS);
493     LocalFACS.GlobalLock = 0x11AA0011;
494
495     /* Build a fake table [TEST] so that we make sure that the CA core ignores it */
496
497     ACPI_MEMSET (&LocalTEST, 0, sizeof (ACPI_TABLE_HEADER));
498     ACPI_STRNCPY (LocalTEST.Signature, "TEST", 4);
499
500     LocalTEST.Revision = 1;
501     LocalTEST.Length = sizeof (ACPI_TABLE_HEADER);
502     LocalTEST.Checksum = (UINT8) -AcpiTbChecksum (
503         (void *) &LocalTEST, LocalTEST.Length);
504
505     /* Build a fake table with a bad signature [BAD!] so that we make sure that the CA core ignores it */
506
507     ACPI_MEMSET (&LocalBADTABLE, 0, sizeof (ACPI_TABLE_HEADER));
508     ACPI_STRNCPY (LocalBADTABLE.Signature, "BAD!", 4);
509
510     LocalBADTABLE.Revision = 1;
511     LocalBADTABLE.Length = sizeof (ACPI_TABLE_HEADER);
512     LocalBADTABLE.Checksum = (UINT8) -AcpiTbChecksum (
513         (void *) &LocalBADTABLE, LocalBADTABLE.Length);
514
515     return (AE_OK);
516 }
517
518
519 /******************************************************************************
520  *
521  * FUNCTION:    AeInstallTables
522  *
523  * PARAMETERS:  None
524  *
525  * RETURN:      Status
526  *
527  * DESCRIPTION: Install the various ACPI tables
528  *
529  *****************************************************************************/
530
531 ACPI_STATUS
532 AeInstallTables (
533     void)
534 {
535     ACPI_STATUS             Status;
536
537     Status = AcpiInitializeTables (Tables, ACPI_MAX_INIT_TABLES, TRUE);
538     Status = AcpiReallocateRootTable ();
539     Status = AcpiLoadTables ();
540
541     /*
542      * Test run-time control method installation. Do it twice to test code
543      * for an existing name.
544      */
545     Status = AcpiInstallMethod (MethodCode);
546     if (ACPI_FAILURE (Status))
547     {
548         AcpiOsPrintf ("%s, Could not install method\n",
549             AcpiFormatException (Status));
550     }
551
552     Status = AcpiInstallMethod (MethodCode);
553     if (ACPI_FAILURE (Status))
554     {
555         AcpiOsPrintf ("%s, Could not install method\n",
556             AcpiFormatException (Status));
557     }
558
559     return (AE_OK);
560 }
561
562
563 /******************************************************************************
564  *
565  * FUNCTION:    AeLocalGetRootPointer
566  *
567  * PARAMETERS:  Flags       - not used
568  *              Address     - Where the root pointer is returned
569  *
570  * RETURN:      Status
571  *
572  * DESCRIPTION: Return a local RSDP, used to dynamically load tables via the
573  *              standard ACPI mechanism.
574  *
575  *****************************************************************************/
576
577 ACPI_PHYSICAL_ADDRESS
578 AeLocalGetRootPointer (
579     void)
580 {
581
582     return ((ACPI_PHYSICAL_ADDRESS) &LocalRSDP);
583 }
584
585