extables.c revision 1.1.1.1.4.2 1 /******************************************************************************
2 *
3 * Module Name: extables - ACPI tables for Example program
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
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.
25 *
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.
29 *
30 * NO WARRANTY
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.
42 */
43
44 #define __EXTABLES_C__
45
46 #include "examples.h"
47 #include "actables.h"
48
49 #define _COMPONENT ACPI_EXAMPLE
50 ACPI_MODULE_NAME ("extables")
51
52 ACPI_PHYSICAL_ADDRESS
53 AeLocalGetRootPointer (
54 void);
55
56
57 /******************************************************************************
58 *
59 * ACPICA Example tables and table setup
60 *
61 * This module contains the ACPI tables used for the example program. The
62 * original source code for the tables appears at the end of the module.
63 *
64 *****************************************************************************/
65
66
67 /* These tables will be modified at runtime */
68
69 unsigned char RsdpCode[] =
70 {
71 0x52,0x53,0x44,0x20,0x50,0x54,0x52,0x20, /* 00000000 "RSD PTR " */
72 0x43,0x49,0x4E,0x54,0x45,0x4C,0x20,0x02, /* 00000008 "CINTEL ." */
73 0x00,0x00,0x00,0x00,0x24,0x00,0x00,0x00, /* 00000010 "....$..." */
74 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000018 "........" */
75 0xDC,0x00,0x00,0x00 /* 00000020 "...." */
76 };
77
78 unsigned char RsdtCode[] =
79 {
80 0x52,0x53,0x44,0x54,0x28,0x00,0x00,0x00, /* 00000000 "RSDT(..." */
81 0x01,0x10,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
82 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
83 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
84 0x15,0x11,0x13,0x20,0x01,0x00,0x00,0x00 /* 00000020 "... ...." */
85 };
86
87 unsigned char XsdtCode[] =
88 {
89 0x58,0x53,0x44,0x54,0x2C,0x00,0x00,0x00, /* 00000000 "XSDT,..." */
90 0x01,0x06,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
91 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
92 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
93 0x15,0x11,0x13,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */
94 0x00,0x00,0x00,0x00 /* 00000028 "...." */
95 };
96
97 unsigned char FadtCode[] =
98 {
99 0x46,0x41,0x43,0x50,0x0C,0x01,0x00,0x00, /* 00000000 "FACP...." */
100 0x05,0x64,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".dINTEL " */
101 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
102 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
103 0x15,0x11,0x13,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */
104 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
105 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
106 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
107 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
108 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000048 "........" */
109 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */
110 0x04,0x02,0x01,0x04,0x08,0x00,0x00,0x00, /* 00000058 "........" */
111 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
112 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */
113 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 00000070 "........" */
114 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
115 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000080 "........" */
116 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000088 "........" */
117 0x00,0x00,0x00,0x00,0x01,0x20,0x00,0x02, /* 00000090 "..... .." */
118 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */
119 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */
120 0x00,0x00,0x00,0x00,0x01,0x10,0x00,0x02, /* 000000A8 "........" */
121 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "........" */
122 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */
123 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x00, /* 000000C0 "........" */
124 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */
125 0x01,0x20,0x00,0x03,0x01,0x00,0x00,0x00, /* 000000D0 ". ......" */
126 0x00,0x00,0x00,0x00,0x01,0x40,0x00,0x01, /* 000000D8 ".....@.." */
127 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */
128 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */
129 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 000000F0 "........" */
130 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */
131 0x01,0x08,0x00,0x01,0x00,0x00,0x00,0x00, /* 00000100 "........" */
132 0x00,0x00,0x00,0x00 /* 00000108 "...." */
133 };
134
135 /* Fixed tables */
136
137 static unsigned char FacsCode[] =
138 {
139 0x46,0x41,0x43,0x53,0x40,0x00,0x00,0x00, /* 00000000 "FACS (at) ..." */
140 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000008 "........" */
141 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000010 "........" */
142 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000018 "........" */
143 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000020 "........" */
144 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
145 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
146 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000038 "........" */
147 };
148
149 static unsigned char DsdtCode[] =
150 {
151 0x44,0x53,0x44,0x54,0x67,0x00,0x00,0x00, /* 00000000 "DSDTg..." */
152 0x02,0x97,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */
153 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */
154 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
155 0x15,0x11,0x13,0x20,0x14,0x42,0x04,0x4D, /* 00000020 "... .B.M" */
156 0x41,0x49,0x4E,0x01,0x70,0x73,0x0D,0x4D, /* 00000028 "AIN.ps.M" */
157 0x61,0x69,0x6E,0x2F,0x41,0x72,0x67,0x30, /* 00000030 "ain/Arg0" */
158 0x3A,0x20,0x00,0x68,0x00,0x5B,0x31,0xA4, /* 00000038 ": .h.[1." */
159 0x0D,0x4D,0x61,0x69,0x6E,0x20,0x73,0x75, /* 00000040 ".Main su" */
160 0x63,0x63,0x65,0x73,0x73,0x66,0x75,0x6C, /* 00000048 "ccessful" */
161 0x6C,0x79,0x20,0x63,0x6F,0x6D,0x70,0x6C, /* 00000050 "ly compl" */
162 0x65,0x74,0x65,0x64,0x20,0x65,0x78,0x65, /* 00000058 "eted exe" */
163 0x63,0x75,0x74,0x69,0x6F,0x6E,0x00 /* 00000060 "cution." */
164 };
165
166
167 /* Useful pointers */
168
169 ACPI_TABLE_RSDP *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, RsdpCode);
170 ACPI_TABLE_RSDT *Rsdt = ACPI_CAST_PTR (ACPI_TABLE_RSDT, RsdtCode);
171 ACPI_TABLE_XSDT *Xsdt = ACPI_CAST_PTR (ACPI_TABLE_XSDT, XsdtCode);
172 ACPI_TABLE_FADT *Fadt = ACPI_CAST_PTR (ACPI_TABLE_FADT, FadtCode);
173
174
175 /******************************************************************************
176 *
177 * Build the various required ACPI tables:
178 *
179 * 1) Setup RSDP to point to the RSDT and XSDT
180 * 2) Setup RSDT/XSDT to point to the FADT
181 * 3) Setup FADT to point to the DSDT and FACS
182 * 4) Update checksums for all modified tables
183 *
184 *****************************************************************************/
185
186 void
187 ExInitializeAcpiTables (
188 void)
189 {
190
191 /* Setup RSDP */
192
193 Rsdp->RsdtPhysicalAddress = (UINT32) ACPI_TO_INTEGER (RsdtCode);
194 Rsdp->XsdtPhysicalAddress = (UINT64) ACPI_TO_INTEGER (XsdtCode);
195
196 /* RSDT and XSDT */
197
198 Rsdt->TableOffsetEntry[0] = (UINT32) ACPI_TO_INTEGER (FadtCode);
199 Xsdt->TableOffsetEntry[0] = (UINT64) ACPI_TO_INTEGER (FadtCode);
200
201 /* FADT */
202
203 Fadt->Facs = 0;
204 Fadt->Dsdt = 0;
205 Fadt->XFacs = (UINT64) ACPI_TO_INTEGER (FacsCode);
206 Fadt->XDsdt = (UINT64) ACPI_TO_INTEGER (DsdtCode);
207
208 /* Set new checksums for the modified tables */
209
210 Rsdp->Checksum = 0;
211 Rsdp->Checksum = (UINT8) -AcpiTbChecksum (
212 (void *) RsdpCode, ACPI_RSDP_CHECKSUM_LENGTH);
213
214 Rsdt->Header.Checksum = 0;
215 Rsdt->Header.Checksum = (UINT8) -AcpiTbChecksum (
216 (void *) Rsdt, Rsdt->Header.Length);
217
218 Xsdt->Header.Checksum = 0;
219 Xsdt->Header.Checksum = (UINT8) -AcpiTbChecksum (
220 (void *) Xsdt, Xsdt->Header.Length);
221
222 Fadt->Header.Checksum = 0;
223 Fadt->Header.Checksum = (UINT8) -AcpiTbChecksum (
224 (void *) Fadt, Fadt->Header.Length);
225 }
226
227
228 /******************************************************************************
229 *
230 * OSL support - return the address of the RSDP
231 *
232 *****************************************************************************/
233
234 ACPI_PHYSICAL_ADDRESS
235 AeLocalGetRootPointer (
236 void)
237 {
238
239 return ((ACPI_PHYSICAL_ADDRESS) RsdpCode);
240 }
241
242
243 #ifdef DO_NOT_COMPILE_ACPI_TABLE_CODE
244 /******************************************************************************
245 *
246 * ACPICA Example table source code
247 *
248 * This is the original source code for the tables above
249 *
250 *****************************************************************************/
251
252 /* RSDP */
253
254 [0008] Signature : "RSD PTR "
255 [0001] Checksum : 43
256 [0006] Oem ID : "INTEL "
257 [0001] Revision : 02
258 [0004] RSDT Address : 00000000
259 [0004] Length : 00000024
260 [0008] XSDT Address : 0000000000000000
261 [0001] Extended Checksum : DC
262 [0003] Reserved : 000000
263
264
265 /* RSDT */
266
267 [0004] Signature : "RSDT" [Root System Description Table]
268 [0004] Table Length : 00000044
269 [0001] Revision : 01
270 [0001] Checksum : B1
271 [0006] Oem ID : "INTEL "
272 [0008] Oem Table ID : "TEMPLATE"
273 [0004] Oem Revision : 00000001
274 [0004] Asl Compiler ID : "INTL"
275 [0004] Asl Compiler Revision : 20100528
276
277 [0004] ACPI Table Address 0 : 00000001
278
279
280 /* XSDT */
281
282 [0004] Signature : "XSDT" [Extended System Description Table]
283 [0004] Table Length : 00000064
284 [0001] Revision : 01
285 [0001] Checksum : 8B
286 [0006] Oem ID : "INTEL "
287 [0008] Oem Table ID : "TEMPLATE"
288 [0004] Oem Revision : 00000001
289 [0004] Asl Compiler ID : "INTL"
290 [0004] Asl Compiler Revision : 20100528
291
292 [0008] ACPI Table Address 0 : 0000000000000001
293
294
295 /* FADT */
296
297 [0004] Signature : "FACP" [Fixed ACPI Description Table (FADT)]
298 [0004] Table Length : 0000010C
299 [0001] Revision : 05
300 [0001] Checksum : 18
301 [0006] Oem ID : "INTEL "
302 [0008] Oem Table ID : "TEMPLATE"
303 [0004] Oem Revision : 00000000
304 [0004] Asl Compiler ID : "INTL"
305 [0004] Asl Compiler Revision : 20111123
306
307 [0004] FACS Address : 00000001
308 [0004] DSDT Address : 00000001
309 [0001] Model : 00
310 [0001] PM Profile : 00 [Unspecified]
311 [0002] SCI Interrupt : 0000
312 [0004] SMI Command Port : 00000000
313 [0001] ACPI Enable Value : 00
314 [0001] ACPI Disable Value : 00
315 [0001] S4BIOS Command : 00
316 [0001] P-State Control : 00
317 [0004] PM1A Event Block Address : 00000001
318 [0004] PM1B Event Block Address : 00000000
319 [0004] PM1A Control Block Address : 00000001
320 [0004] PM1B Control Block Address : 00000000
321 [0004] PM2 Control Block Address : 00000001
322 [0004] PM Timer Block Address : 00000001
323 [0004] GPE0 Block Address : 00000001
324 [0004] GPE1 Block Address : 00000000
325 [0001] PM1 Event Block Length : 04
326 [0001] PM1 Control Block Length : 02
327 [0001] PM2 Control Block Length : 01
328 [0001] PM Timer Block Length : 04
329 [0001] GPE0 Block Length : 08
330 [0001] GPE1 Block Length : 00
331 [0001] GPE1 Base Offset : 00
332 [0001] _CST Support : 00
333 [0002] C2 Latency : 0000
334 [0002] C3 Latency : 0000
335 [0002] CPU Cache Size : 0000
336 [0002] Cache Flush Stride : 0000
337 [0001] Duty Cycle Offset : 00
338 [0001] Duty Cycle Width : 00
339 [0001] RTC Day Alarm Index : 00
340 [0001] RTC Month Alarm Index : 00
341 [0001] RTC Century Index : 00
342 [0002] Boot Flags (decoded below) : 0000
343 Legacy Devices Supported (V2) : 0
344 8042 Present on ports 60/64 (V2) : 0
345 VGA Not Present (V4) : 0
346 MSI Not Supported (V4) : 0
347 PCIe ASPM Not Supported (V4) : 0
348 CMOS RTC Not Present (V5) : 0
349 [0001] Reserved : 00
350 [0004] Flags (decoded below) : 00000000
351 WBINVD instruction is operational (V1) : 0
352 WBINVD flushes all caches (V1) : 0
353 All CPUs support C1 (V1) : 0
354 C2 works on MP system (V1) : 0
355 Control Method Power Button (V1) : 0
356 Control Method Sleep Button (V1) : 0
357 RTC wake not in fixed reg space (V1) : 0
358 RTC can wake system from S4 (V1) : 0
359 32-bit PM Timer (V1) : 0
360 Docking Supported (V1) : 0
361 Reset Register Supported (V2) : 0
362 Sealed Case (V3) : 0
363 Headless - No Video (V3) : 0
364 Use native instr after SLP_TYPx (V3) : 0
365 PCIEXP_WAK Bits Supported (V4) : 0
366 Use Platform Timer (V4) : 0
367 RTC_STS valid on S4 wake (V4) : 0
368 Remote Power-on capable (V4) : 0
369 Use APIC Cluster Model (V4) : 0
370 Use APIC Physical Destination Mode (V4) : 0
371 Hardware Reduced (V5) : 0
372 Low Power S0 Idle (V5) : 0
373
374 [0012] Reset Register : [Generic Address Structure]
375 [0001] Space ID : 01 [SystemIO]
376 [0001] Bit Width : 08
377 [0001] Bit Offset : 00
378 [0001] Encoded Access Width : 01 [Byte Access:8]
379 [0008] Address : 0000000000000001
380
381 [0001] Value to cause reset : 00
382 [0003] Reserved : 000000
383 [0008] FACS Address : 0000000000000001
384 [0008] DSDT Address : 0000000000000001
385 [0012] PM1A Event Block : [Generic Address Structure]
386 [0001] Space ID : 01 [SystemIO]
387 [0001] Bit Width : 20
388 [0001] Bit Offset : 00
389 [0001] Encoded Access Width : 02 [Word Access:16]
390 [0008] Address : 0000000000000001
391
392 [0012] PM1B Event Block : [Generic Address Structure]
393 [0001] Space ID : 01 [SystemIO]
394 [0001] Bit Width : 00
395 [0001] Bit Offset : 00
396 [0001] Encoded Access Width : 00 [Undefined/Legacy]
397 [0008] Address : 0000000000000000
398
399 [0012] PM1A Control Block : [Generic Address Structure]
400 [0001] Space ID : 01 [SystemIO]
401 [0001] Bit Width : 10
402 [0001] Bit Offset : 00
403 [0001] Encoded Access Width : 02 [Word Access:16]
404 [0008] Address : 0000000000000001
405
406 [0012] PM1B Control Block : [Generic Address Structure]
407 [0001] Space ID : 01 [SystemIO]
408 [0001] Bit Width : 00
409 [0001] Bit Offset : 00
410 [0001] Encoded Access Width : 00 [Undefined/Legacy]
411 [0008] Address : 0000000000000000
412
413 [0012] PM2 Control Block : [Generic Address Structure]
414 [0001] Space ID : 01 [SystemIO]
415 [0001] Bit Width : 08
416 [0001] Bit Offset : 00
417 [0001] Encoded Access Width : 00 [Undefined/Legacy]
418 [0008] Address : 0000000000000001
419
420 [0012] PM Timer Block : [Generic Address Structure]
421 [0001] Space ID : 01 [SystemIO]
422 [0001] Bit Width : 20
423 [0001] Bit Offset : 00
424 [0001] Encoded Access Width : 03 [DWord Access:32]
425 [0008] Address : 0000000000000001
426
427 [0012] GPE0 Block : [Generic Address Structure]
428 [0001] Space ID : 01 [SystemIO]
429 [0001] Bit Width : 40
430 [0001] Bit Offset : 00
431 [0001] Encoded Access Width : 01 [Byte Access:8]
432 [0008] Address : 0000000000000001
433
434 [0012] GPE1 Block : [Generic Address Structure]
435 [0001] Space ID : 01 [SystemIO]
436 [0001] Bit Width : 00
437 [0001] Bit Offset : 00
438 [0001] Encoded Access Width : 00 [Undefined/Legacy]
439 [0008] Address : 0000000000000000
440
441
442 [0012] Sleep Control Register : [Generic Address Structure]
443 [0001] Space ID : 01 [SystemIO]
444 [0001] Bit Width : 08
445 [0001] Bit Offset : 00
446 [0001] Encoded Access Width : 01 [Byte Access:8]
447 [0008] Address : 0000000000000000
448
449 [0012] Sleep Status Register : [Generic Address Structure]
450 [0001] Space ID : 01 [SystemIO]
451 [0001] Bit Width : 08
452 [0001] Bit Offset : 00
453 [0001] Encoded Access Width : 01 [Byte Access:8]
454 [0008] Address : 0000000000000000
455
456
457 /* FACS */
458
459 [0004] Signature : "FACS"
460 [0004] Length : 00000040
461 [0004] Hardware Signature : 00000000
462 [0004] 32 Firmware Waking Vector : 00000000
463 [0004] Global Lock : 00000000
464 [0004] Flags (decoded below) : 00000000
465 S4BIOS Support Present : 0
466 64-bit Wake Supported (V2) : 0
467 [0008] 64 Firmware Waking Vector : 0000000000000000
468 [0001] Version : 02
469 [0003] Reserved : 000000
470 [0004] OspmFlags (decoded below) : 00000000
471 64-bit Wake Env Required (V2) : 0
472
473
474 /* DSDT - ASL code */
475
476 DefinitionBlock ("dsdt.aml", "DSDT", 2, "Intel", "Template", 0x00000001)
477 {
478 Method (MAIN, 1, NotSerialized)
479 {
480 Store (Concatenate ("Main/Arg0: ", Arg0), Debug)
481 Return ("Main successfully completed execution")
482 }
483 }
484 #endif
485