1 /******************************************************************************
3 * Module Name: extables - ACPI tables for Example program
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2015, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
47 #define _COMPONENT ACPI_EXAMPLE
48 ACPI_MODULE_NAME ("extables")
51 /******************************************************************************
53 * ACPICA Example tables and table setup
55 * This module contains the ACPI tables used for the example program. The
56 * original source code for the tables appears at the end of the module.
58 *****************************************************************************/
61 /* These tables will be modified at runtime */
63 unsigned char RsdpCode[] =
65 0x52,0x53,0x44,0x20,0x50,0x54,0x52,0x20, /* 00000000 "RSD PTR " */
66 0x43,0x49,0x4E,0x54,0x45,0x4C,0x20,0x02, /* 00000008 "CINTEL ." */
67 0x00,0x00,0x00,0x00,0x24,0x00,0x00,0x00, /* 00000010 "....$..." */
68 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000018 "........" */
69 0xDC,0x00,0x00,0x00 /* 00000020 "...." */
72 unsigned char RsdtCode[] =
74 0x52,0x53,0x44,0x54,0x28,0x00,0x00,0x00, /* 00000000 "RSDT(..." */
75 0x01,0x10,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
76 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
77 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
78 0x15,0x11,0x13,0x20,0x01,0x00,0x00,0x00 /* 00000020 "... ...." */
81 unsigned char XsdtCode[] =
83 0x58,0x53,0x44,0x54,0x2C,0x00,0x00,0x00, /* 00000000 "XSDT,..." */
84 0x01,0x06,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
85 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
86 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
87 0x15,0x11,0x13,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */
88 0x00,0x00,0x00,0x00 /* 00000028 "...." */
91 unsigned char FadtCode[] =
93 0x46,0x41,0x43,0x50,0x0C,0x01,0x00,0x00, /* 00000000 "FACP...." */
94 0x05,0x64,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".dINTEL " */
95 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
96 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
97 0x15,0x11,0x13,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */
98 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
99 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
100 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
101 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
102 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000048 "........" */
103 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */
104 0x04,0x02,0x01,0x04,0x08,0x00,0x00,0x00, /* 00000058 "........" */
105 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
106 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */
107 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 00000070 "........" */
108 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
109 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000080 "........" */
110 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000088 "........" */
111 0x00,0x00,0x00,0x00,0x01,0x20,0x00,0x02, /* 00000090 "..... .." */
112 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */
113 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */
114 0x00,0x00,0x00,0x00,0x01,0x10,0x00,0x02, /* 000000A8 "........" */
115 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "........" */
116 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */
117 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x00, /* 000000C0 "........" */
118 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */
119 0x01,0x20,0x00,0x03,0x01,0x00,0x00,0x00, /* 000000D0 ". ......" */
120 0x00,0x00,0x00,0x00,0x01,0x40,0x00,0x01, /* 000000D8 ".....@.." */
121 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */
122 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */
123 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 000000F0 "........" */
124 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */
125 0x01,0x08,0x00,0x01,0x00,0x00,0x00,0x00, /* 00000100 "........" */
126 0x00,0x00,0x00,0x00 /* 00000108 "...." */
131 static unsigned char FacsCode[] =
133 0x46,0x41,0x43,0x53,0x40,0x00,0x00,0x00, /* 00000000 "FACS@..." */
134 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000008 "........" */
135 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000010 "........" */
136 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000018 "........" */
137 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000020 "........" */
138 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
139 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
140 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000038 "........" */
143 static unsigned char DsdtCode[] =
145 0x44,0x53,0x44,0x54,0x8C,0x00,0x00,0x00, /* 00000000 "DSDT...." */
146 0x02,0x76,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".vIntel." */
147 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */
148 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
149 0x24,0x04,0x14,0x20,0x5B,0x80,0x47,0x4E, /* 00000020 "$.. [.GN" */
150 0x56,0x53,0x00,0x0C,0x98,0xEE,0xBB,0xDF, /* 00000028 "VS......" */
151 0x0A,0x13,0x5B,0x81,0x0B,0x47,0x4E,0x56, /* 00000030 "..[..GNV" */
152 0x53,0x00,0x46,0x4C,0x44,0x31,0x08,0x14, /* 00000038 "S.FLD1.." */
153 0x4C,0x04,0x4D,0x41,0x49,0x4E,0x01,0x70, /* 00000040 "L.MAIN.p" */
154 0x73,0x0D,0x4D,0x61,0x69,0x6E,0x2F,0x41, /* 00000048 "s.Main/A" */
155 0x72,0x67,0x30,0x3A,0x20,0x00,0x68,0x00, /* 00000050 "rg0: .h." */
156 0x5B,0x31,0x70,0x00,0x46,0x4C,0x44,0x31, /* 00000058 "[1p.FLD1" */
157 0x86,0x5C,0x00,0x00,0xA4,0x0D,0x4D,0x61, /* 00000060 ".\....Ma" */
158 0x69,0x6E,0x20,0x73,0x75,0x63,0x63,0x65, /* 00000068 "in succe" */
159 0x73,0x73,0x66,0x75,0x6C,0x6C,0x79,0x20, /* 00000070 "ssfully " */
160 0x63,0x6F,0x6D,0x70,0x6C,0x65,0x74,0x65, /* 00000078 "complete" */
161 0x64,0x20,0x65,0x78,0x65,0x63,0x75,0x74, /* 00000080 "d execut" */
162 0x69,0x6F,0x6E,0x00 /* 00000088 "ion." */
166 /* Useful pointers */
168 ACPI_TABLE_RSDP *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, RsdpCode);
169 ACPI_TABLE_RSDT *Rsdt = ACPI_CAST_PTR (ACPI_TABLE_RSDT, RsdtCode);
170 ACPI_TABLE_XSDT *Xsdt = ACPI_CAST_PTR (ACPI_TABLE_XSDT, XsdtCode);
171 ACPI_TABLE_FADT *Fadt = ACPI_CAST_PTR (ACPI_TABLE_FADT, FadtCode);
174 /******************************************************************************
176 * Build the various required ACPI tables:
178 * 1) Setup RSDP to point to the RSDT and XSDT
179 * 2) Setup RSDT/XSDT to point to the FADT
180 * 3) Setup FADT to point to the DSDT and FACS
181 * 4) Update checksums for all modified tables
183 *****************************************************************************/
186 ExInitializeAcpiTables (
192 Rsdp->RsdtPhysicalAddress = (UINT32) ACPI_TO_INTEGER (RsdtCode);
193 Rsdp->XsdtPhysicalAddress = (UINT64) ACPI_TO_INTEGER (XsdtCode);
197 Rsdt->TableOffsetEntry[0] = (UINT32) ACPI_TO_INTEGER (FadtCode);
198 Xsdt->TableOffsetEntry[0] = (UINT64) ACPI_TO_INTEGER (FadtCode);
204 Fadt->XFacs = (UINT64) ACPI_TO_INTEGER (FacsCode);
205 Fadt->XDsdt = (UINT64) ACPI_TO_INTEGER (DsdtCode);
207 /* Set new checksums for the modified tables */
210 Rsdp->Checksum = (UINT8) -AcpiTbChecksum (
211 (void *) RsdpCode, ACPI_RSDP_CHECKSUM_LENGTH);
213 Rsdt->Header.Checksum = 0;
214 Rsdt->Header.Checksum = (UINT8) -AcpiTbChecksum (
215 (void *) Rsdt, Rsdt->Header.Length);
217 Xsdt->Header.Checksum = 0;
218 Xsdt->Header.Checksum = (UINT8) -AcpiTbChecksum (
219 (void *) Xsdt, Xsdt->Header.Length);
221 Fadt->Header.Checksum = 0;
222 Fadt->Header.Checksum = (UINT8) -AcpiTbChecksum (
223 (void *) Fadt, Fadt->Header.Length);
227 /******************************************************************************
229 * OSL support - return the address of the RSDP
231 *****************************************************************************/
233 ACPI_PHYSICAL_ADDRESS
234 AcpiOsGetRootPointer (
238 return (ACPI_PTR_TO_PHYSADDR (RsdpCode));
242 #ifdef DO_NOT_COMPILE_ACPI_TABLE_CODE
243 /******************************************************************************
245 * ACPICA Example table source code
247 * This is the original source code for the tables above
249 *****************************************************************************/
253 [0008] Signature : "RSD PTR "
255 [0006] Oem ID : "INTEL "
257 [0004] RSDT Address : 00000000
258 [0004] Length : 00000024
259 [0008] XSDT Address : 0000000000000000
260 [0001] Extended Checksum : DC
261 [0003] Reserved : 000000
266 [0004] Signature : "RSDT" [Root System Description Table]
267 [0004] Table Length : 00000044
270 [0006] Oem ID : "INTEL "
271 [0008] Oem Table ID : "TEMPLATE"
272 [0004] Oem Revision : 00000001
273 [0004] Asl Compiler ID : "INTL"
274 [0004] Asl Compiler Revision : 20100528
276 [0004] ACPI Table Address 0 : 00000001
281 [0004] Signature : "XSDT" [Extended System Description Table]
282 [0004] Table Length : 00000064
285 [0006] Oem ID : "INTEL "
286 [0008] Oem Table ID : "TEMPLATE"
287 [0004] Oem Revision : 00000001
288 [0004] Asl Compiler ID : "INTL"
289 [0004] Asl Compiler Revision : 20100528
291 [0008] ACPI Table Address 0 : 0000000000000001
296 [0004] Signature : "FACP" [Fixed ACPI Description Table (FADT)]
297 [0004] Table Length : 0000010C
300 [0006] Oem ID : "INTEL "
301 [0008] Oem Table ID : "TEMPLATE"
302 [0004] Oem Revision : 00000000
303 [0004] Asl Compiler ID : "INTL"
304 [0004] Asl Compiler Revision : 20111123
306 [0004] FACS Address : 00000001
307 [0004] DSDT Address : 00000001
309 [0001] PM Profile : 00 [Unspecified]
310 [0002] SCI Interrupt : 0000
311 [0004] SMI Command Port : 00000000
312 [0001] ACPI Enable Value : 00
313 [0001] ACPI Disable Value : 00
314 [0001] S4BIOS Command : 00
315 [0001] P-State Control : 00
316 [0004] PM1A Event Block Address : 00000001
317 [0004] PM1B Event Block Address : 00000000
318 [0004] PM1A Control Block Address : 00000001
319 [0004] PM1B Control Block Address : 00000000
320 [0004] PM2 Control Block Address : 00000001
321 [0004] PM Timer Block Address : 00000001
322 [0004] GPE0 Block Address : 00000001
323 [0004] GPE1 Block Address : 00000000
324 [0001] PM1 Event Block Length : 04
325 [0001] PM1 Control Block Length : 02
326 [0001] PM2 Control Block Length : 01
327 [0001] PM Timer Block Length : 04
328 [0001] GPE0 Block Length : 08
329 [0001] GPE1 Block Length : 00
330 [0001] GPE1 Base Offset : 00
331 [0001] _CST Support : 00
332 [0002] C2 Latency : 0000
333 [0002] C3 Latency : 0000
334 [0002] CPU Cache Size : 0000
335 [0002] Cache Flush Stride : 0000
336 [0001] Duty Cycle Offset : 00
337 [0001] Duty Cycle Width : 00
338 [0001] RTC Day Alarm Index : 00
339 [0001] RTC Month Alarm Index : 00
340 [0001] RTC Century Index : 00
341 [0002] Boot Flags (decoded below) : 0000
342 Legacy Devices Supported (V2) : 0
343 8042 Present on ports 60/64 (V2) : 0
344 VGA Not Present (V4) : 0
345 MSI Not Supported (V4) : 0
346 PCIe ASPM Not Supported (V4) : 0
347 CMOS RTC Not Present (V5) : 0
349 [0004] Flags (decoded below) : 00000000
350 WBINVD instruction is operational (V1) : 0
351 WBINVD flushes all caches (V1) : 0
352 All CPUs support C1 (V1) : 0
353 C2 works on MP system (V1) : 0
354 Control Method Power Button (V1) : 0
355 Control Method Sleep Button (V1) : 0
356 RTC wake not in fixed reg space (V1) : 0
357 RTC can wake system from S4 (V1) : 0
358 32-bit PM Timer (V1) : 0
359 Docking Supported (V1) : 0
360 Reset Register Supported (V2) : 0
362 Headless - No Video (V3) : 0
363 Use native instr after SLP_TYPx (V3) : 0
364 PCIEXP_WAK Bits Supported (V4) : 0
365 Use Platform Timer (V4) : 0
366 RTC_STS valid on S4 wake (V4) : 0
367 Remote Power-on capable (V4) : 0
368 Use APIC Cluster Model (V4) : 0
369 Use APIC Physical Destination Mode (V4) : 0
370 Hardware Reduced (V5) : 0
371 Low Power S0 Idle (V5) : 0
373 [0012] Reset Register : [Generic Address Structure]
374 [0001] Space ID : 01 [SystemIO]
375 [0001] Bit Width : 08
376 [0001] Bit Offset : 00
377 [0001] Encoded Access Width : 01 [Byte Access:8]
378 [0008] Address : 0000000000000001
380 [0001] Value to cause reset : 00
381 [0003] Reserved : 000000
382 [0008] FACS Address : 0000000000000001
383 [0008] DSDT Address : 0000000000000001
384 [0012] PM1A Event Block : [Generic Address Structure]
385 [0001] Space ID : 01 [SystemIO]
386 [0001] Bit Width : 20
387 [0001] Bit Offset : 00
388 [0001] Encoded Access Width : 02 [Word Access:16]
389 [0008] Address : 0000000000000001
391 [0012] PM1B Event Block : [Generic Address Structure]
392 [0001] Space ID : 01 [SystemIO]
393 [0001] Bit Width : 00
394 [0001] Bit Offset : 00
395 [0001] Encoded Access Width : 00 [Undefined/Legacy]
396 [0008] Address : 0000000000000000
398 [0012] PM1A Control Block : [Generic Address Structure]
399 [0001] Space ID : 01 [SystemIO]
400 [0001] Bit Width : 10
401 [0001] Bit Offset : 00
402 [0001] Encoded Access Width : 02 [Word Access:16]
403 [0008] Address : 0000000000000001
405 [0012] PM1B Control Block : [Generic Address Structure]
406 [0001] Space ID : 01 [SystemIO]
407 [0001] Bit Width : 00
408 [0001] Bit Offset : 00
409 [0001] Encoded Access Width : 00 [Undefined/Legacy]
410 [0008] Address : 0000000000000000
412 [0012] PM2 Control Block : [Generic Address Structure]
413 [0001] Space ID : 01 [SystemIO]
414 [0001] Bit Width : 08
415 [0001] Bit Offset : 00
416 [0001] Encoded Access Width : 00 [Undefined/Legacy]
417 [0008] Address : 0000000000000001
419 [0012] PM Timer Block : [Generic Address Structure]
420 [0001] Space ID : 01 [SystemIO]
421 [0001] Bit Width : 20
422 [0001] Bit Offset : 00
423 [0001] Encoded Access Width : 03 [DWord Access:32]
424 [0008] Address : 0000000000000001
426 [0012] GPE0 Block : [Generic Address Structure]
427 [0001] Space ID : 01 [SystemIO]
428 [0001] Bit Width : 40
429 [0001] Bit Offset : 00
430 [0001] Encoded Access Width : 01 [Byte Access:8]
431 [0008] Address : 0000000000000001
433 [0012] GPE1 Block : [Generic Address Structure]
434 [0001] Space ID : 01 [SystemIO]
435 [0001] Bit Width : 00
436 [0001] Bit Offset : 00
437 [0001] Encoded Access Width : 00 [Undefined/Legacy]
438 [0008] Address : 0000000000000000
441 [0012] Sleep Control Register : [Generic Address Structure]
442 [0001] Space ID : 01 [SystemIO]
443 [0001] Bit Width : 08
444 [0001] Bit Offset : 00
445 [0001] Encoded Access Width : 01 [Byte Access:8]
446 [0008] Address : 0000000000000000
448 [0012] Sleep Status Register : [Generic Address Structure]
449 [0001] Space ID : 01 [SystemIO]
450 [0001] Bit Width : 08
451 [0001] Bit Offset : 00
452 [0001] Encoded Access Width : 01 [Byte Access:8]
453 [0008] Address : 0000000000000000
458 [0004] Signature : "FACS"
459 [0004] Length : 00000040
460 [0004] Hardware Signature : 00000000
461 [0004] 32 Firmware Waking Vector : 00000000
462 [0004] Global Lock : 00000000
463 [0004] Flags (decoded below) : 00000000
464 S4BIOS Support Present : 0
465 64-bit Wake Supported (V2) : 0
466 [0008] 64 Firmware Waking Vector : 0000000000000000
468 [0003] Reserved : 000000
469 [0004] OspmFlags (decoded below) : 00000000
470 64-bit Wake Env Required (V2) : 0
473 /* DSDT - ASL code */
475 DefinitionBlock ("dsdt.aml", "DSDT", 2, "Intel", "Template", 0x00000001)
477 OperationRegion (GNVS, SystemMemory, 0xDFBBEE98, 0x00000013)
478 Field (GNVS, AnyAcc, NoLock, Preserve)
483 Method (MAIN, 1, NotSerialized)
485 Store (Concatenate ("Main/Arg0: ", Arg0), Debug)
488 Return ("Main successfully completed execution")