aetables.c revision 1.1.1.2.4.2 1 1.1.1.2.4.2 rmind /******************************************************************************
2 1.1.1.2.4.2 rmind *
3 1.1.1.2.4.2 rmind * Module Name: aetables - ACPI table setup/install for acpiexec utility
4 1.1.1.2.4.2 rmind *
5 1.1.1.2.4.2 rmind *****************************************************************************/
6 1.1.1.2.4.2 rmind
7 1.1.1.2.4.2 rmind /*
8 1.1.1.2.4.2 rmind * Copyright (C) 2000 - 2011, Intel Corp.
9 1.1.1.2.4.2 rmind * All rights reserved.
10 1.1.1.2.4.2 rmind *
11 1.1.1.2.4.2 rmind * Redistribution and use in source and binary forms, with or without
12 1.1.1.2.4.2 rmind * modification, are permitted provided that the following conditions
13 1.1.1.2.4.2 rmind * are met:
14 1.1.1.2.4.2 rmind * 1. Redistributions of source code must retain the above copyright
15 1.1.1.2.4.2 rmind * notice, this list of conditions, and the following disclaimer,
16 1.1.1.2.4.2 rmind * without modification.
17 1.1.1.2.4.2 rmind * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1.1.2.4.2 rmind * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1.1.2.4.2 rmind * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1.1.2.4.2 rmind * including a substantially similar Disclaimer requirement for further
21 1.1.1.2.4.2 rmind * binary redistribution.
22 1.1.1.2.4.2 rmind * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1.1.2.4.2 rmind * of any contributors may be used to endorse or promote products derived
24 1.1.1.2.4.2 rmind * from this software without specific prior written permission.
25 1.1.1.2.4.2 rmind *
26 1.1.1.2.4.2 rmind * Alternatively, this software may be distributed under the terms of the
27 1.1.1.2.4.2 rmind * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1.1.2.4.2 rmind * Software Foundation.
29 1.1.1.2.4.2 rmind *
30 1.1.1.2.4.2 rmind * NO WARRANTY
31 1.1.1.2.4.2 rmind * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1.1.2.4.2 rmind * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.2.4.2 rmind * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.1.1.2.4.2 rmind * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1.1.2.4.2 rmind * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1.1.2.4.2 rmind * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1.1.2.4.2 rmind * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1.1.2.4.2 rmind * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1.1.2.4.2 rmind * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1.1.2.4.2 rmind * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1.1.2.4.2 rmind * POSSIBILITY OF SUCH DAMAGES.
42 1.1.1.2.4.2 rmind */
43 1.1.1.2.4.2 rmind
44 1.1.1.2.4.2 rmind #include "aecommon.h"
45 1.1.1.2.4.2 rmind #include "aetables.h"
46 1.1.1.2.4.2 rmind
47 1.1.1.2.4.2 rmind #define _COMPONENT ACPI_TOOLS
48 1.1.1.2.4.2 rmind ACPI_MODULE_NAME ("aetables")
49 1.1.1.2.4.2 rmind
50 1.1.1.2.4.2 rmind /* Local prototypes */
51 1.1.1.2.4.2 rmind
52 1.1.1.2.4.2 rmind void
53 1.1.1.2.4.2 rmind AeTableOverride (
54 1.1.1.2.4.2 rmind ACPI_TABLE_HEADER *ExistingTable,
55 1.1.1.2.4.2 rmind ACPI_TABLE_HEADER **NewTable);
56 1.1.1.2.4.2 rmind
57 1.1.1.2.4.2 rmind ACPI_PHYSICAL_ADDRESS
58 1.1.1.2.4.2 rmind AeLocalGetRootPointer (
59 1.1.1.2.4.2 rmind void);
60 1.1.1.2.4.2 rmind
61 1.1.1.2.4.2 rmind /* User table (DSDT) */
62 1.1.1.2.4.2 rmind
63 1.1.1.2.4.2 rmind static ACPI_TABLE_HEADER *DsdtToInstallOverride;
64 1.1.1.2.4.2 rmind
65 1.1.1.2.4.2 rmind /* Non-AML tables that are constructed locally and installed */
66 1.1.1.2.4.2 rmind
67 1.1.1.2.4.2 rmind static ACPI_TABLE_RSDP LocalRSDP;
68 1.1.1.2.4.2 rmind static ACPI_TABLE_FACS LocalFACS;
69 1.1.1.2.4.2 rmind static ACPI_TABLE_HEADER LocalTEST;
70 1.1.1.2.4.2 rmind static ACPI_TABLE_HEADER LocalBADTABLE;
71 1.1.1.2.4.2 rmind
72 1.1.1.2.4.2 rmind /*
73 1.1.1.2.4.2 rmind * We need a local FADT so that the hardware subcomponent will function,
74 1.1.1.2.4.2 rmind * even though the underlying OSD HW access functions don't do anything.
75 1.1.1.2.4.2 rmind */
76 1.1.1.2.4.2 rmind static ACPI_TABLE_FADT LocalFADT;
77 1.1.1.2.4.2 rmind
78 1.1.1.2.4.2 rmind /*
79 1.1.1.2.4.2 rmind * Use XSDT so that both 32- and 64-bit versions of this utility will
80 1.1.1.2.4.2 rmind * function automatically.
81 1.1.1.2.4.2 rmind */
82 1.1.1.2.4.2 rmind static ACPI_TABLE_XSDT *LocalXSDT;
83 1.1.1.2.4.2 rmind
84 1.1.1.2.4.2 rmind #define BASE_XSDT_TABLES 7
85 1.1.1.2.4.2 rmind #define BASE_XSDT_SIZE (sizeof (ACPI_TABLE_XSDT) + \
86 1.1.1.2.4.2 rmind ((BASE_XSDT_TABLES -1) * sizeof (UINT64)))
87 1.1.1.2.4.2 rmind
88 1.1.1.2.4.2 rmind #define ACPI_MAX_INIT_TABLES (32)
89 1.1.1.2.4.2 rmind static ACPI_TABLE_DESC Tables[ACPI_MAX_INIT_TABLES];
90 1.1.1.2.4.2 rmind
91 1.1.1.2.4.2 rmind
92 1.1.1.2.4.2 rmind /******************************************************************************
93 1.1.1.2.4.2 rmind *
94 1.1.1.2.4.2 rmind * FUNCTION: AeTableOverride
95 1.1.1.2.4.2 rmind *
96 1.1.1.2.4.2 rmind * DESCRIPTION: Local implementation of AcpiOsTableOverride.
97 1.1.1.2.4.2 rmind * Exercise the override mechanism
98 1.1.1.2.4.2 rmind *
99 1.1.1.2.4.2 rmind *****************************************************************************/
100 1.1.1.2.4.2 rmind
101 1.1.1.2.4.2 rmind void
102 1.1.1.2.4.2 rmind AeTableOverride (
103 1.1.1.2.4.2 rmind ACPI_TABLE_HEADER *ExistingTable,
104 1.1.1.2.4.2 rmind ACPI_TABLE_HEADER **NewTable)
105 1.1.1.2.4.2 rmind {
106 1.1.1.2.4.2 rmind
107 1.1.1.2.4.2 rmind /* This code exercises the table override mechanism in the core */
108 1.1.1.2.4.2 rmind
109 1.1.1.2.4.2 rmind if (ACPI_COMPARE_NAME (ExistingTable->Signature, ACPI_SIG_DSDT))
110 1.1.1.2.4.2 rmind {
111 1.1.1.2.4.2 rmind *NewTable = DsdtToInstallOverride;
112 1.1.1.2.4.2 rmind }
113 1.1.1.2.4.2 rmind
114 1.1.1.2.4.2 rmind /* This code tests override of dynamically loaded tables */
115 1.1.1.2.4.2 rmind
116 1.1.1.2.4.2 rmind else if (ACPI_COMPARE_NAME (ExistingTable->Signature, "TSDT"))
117 1.1.1.2.4.2 rmind {
118 1.1.1.2.4.2 rmind *NewTable = ACPI_CAST_PTR (ACPI_TABLE_HEADER, Ssdt3Code);
119 1.1.1.2.4.2 rmind }
120 1.1.1.2.4.2 rmind }
121 1.1.1.2.4.2 rmind
122 1.1.1.2.4.2 rmind
123 1.1.1.2.4.2 rmind /******************************************************************************
124 1.1.1.2.4.2 rmind *
125 1.1.1.2.4.2 rmind * FUNCTION: AeBuildLocalTables
126 1.1.1.2.4.2 rmind *
127 1.1.1.2.4.2 rmind * PARAMETERS: TableCount - Number of tables on the command line
128 1.1.1.2.4.2 rmind * TableList - List of actual tables from files
129 1.1.1.2.4.2 rmind *
130 1.1.1.2.4.2 rmind * RETURN: Status
131 1.1.1.2.4.2 rmind *
132 1.1.1.2.4.2 rmind * DESCRIPTION: Build a complete ACPI table chain, with a local RSDP, XSDT,
133 1.1.1.2.4.2 rmind * FADT, and several other test tables.
134 1.1.1.2.4.2 rmind *
135 1.1.1.2.4.2 rmind *****************************************************************************/
136 1.1.1.2.4.2 rmind
137 1.1.1.2.4.2 rmind ACPI_STATUS
138 1.1.1.2.4.2 rmind AeBuildLocalTables (
139 1.1.1.2.4.2 rmind UINT32 TableCount,
140 1.1.1.2.4.2 rmind AE_TABLE_DESC *TableList)
141 1.1.1.2.4.2 rmind {
142 1.1.1.2.4.2 rmind ACPI_PHYSICAL_ADDRESS DsdtAddress = 0;
143 1.1.1.2.4.2 rmind UINT32 XsdtSize;
144 1.1.1.2.4.2 rmind AE_TABLE_DESC *NextTable;
145 1.1.1.2.4.2 rmind UINT32 NextIndex;
146 1.1.1.2.4.2 rmind ACPI_TABLE_FADT *ExternalFadt = NULL;
147 1.1.1.2.4.2 rmind
148 1.1.1.2.4.2 rmind
149 1.1.1.2.4.2 rmind /*
150 1.1.1.2.4.2 rmind * Update the table count. For DSDT, it is not put into the XSDT. For
151 1.1.1.2.4.2 rmind * FADT, this is already accounted for since we usually install a
152 1.1.1.2.4.2 rmind * local FADT.
153 1.1.1.2.4.2 rmind */
154 1.1.1.2.4.2 rmind NextTable = TableList;
155 1.1.1.2.4.2 rmind while (NextTable)
156 1.1.1.2.4.2 rmind {
157 1.1.1.2.4.2 rmind if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT) ||
158 1.1.1.2.4.2 rmind ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT))
159 1.1.1.2.4.2 rmind {
160 1.1.1.2.4.2 rmind TableCount--;
161 1.1.1.2.4.2 rmind }
162 1.1.1.2.4.2 rmind NextTable = NextTable->Next;
163 1.1.1.2.4.2 rmind }
164 1.1.1.2.4.2 rmind
165 1.1.1.2.4.2 rmind XsdtSize = BASE_XSDT_SIZE + (TableCount * sizeof (UINT64));
166 1.1.1.2.4.2 rmind
167 1.1.1.2.4.2 rmind /* Build an XSDT */
168 1.1.1.2.4.2 rmind
169 1.1.1.2.4.2 rmind LocalXSDT = AcpiOsAllocate (XsdtSize);
170 1.1.1.2.4.2 rmind if (!LocalXSDT)
171 1.1.1.2.4.2 rmind {
172 1.1.1.2.4.2 rmind return (AE_NO_MEMORY);
173 1.1.1.2.4.2 rmind }
174 1.1.1.2.4.2 rmind
175 1.1.1.2.4.2 rmind ACPI_MEMSET (LocalXSDT, 0, XsdtSize);
176 1.1.1.2.4.2 rmind ACPI_STRNCPY (LocalXSDT->Header.Signature, ACPI_SIG_XSDT, 4);
177 1.1.1.2.4.2 rmind LocalXSDT->Header.Length = XsdtSize;
178 1.1.1.2.4.2 rmind LocalXSDT->Header.Revision = 1;
179 1.1.1.2.4.2 rmind
180 1.1.1.2.4.2 rmind LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalTEST);
181 1.1.1.2.4.2 rmind LocalXSDT->TableOffsetEntry[1] = ACPI_PTR_TO_PHYSADDR (&LocalBADTABLE);
182 1.1.1.2.4.2 rmind LocalXSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (&LocalFADT);
183 1.1.1.2.4.2 rmind
184 1.1.1.2.4.2 rmind /* Install two SSDTs to test multiple table support */
185 1.1.1.2.4.2 rmind
186 1.1.1.2.4.2 rmind LocalXSDT->TableOffsetEntry[3] = ACPI_PTR_TO_PHYSADDR (&Ssdt1Code);
187 1.1.1.2.4.2 rmind LocalXSDT->TableOffsetEntry[4] = ACPI_PTR_TO_PHYSADDR (&Ssdt2Code);
188 1.1.1.2.4.2 rmind
189 1.1.1.2.4.2 rmind /* Install the OEM1 table to test LoadTable */
190 1.1.1.2.4.2 rmind
191 1.1.1.2.4.2 rmind LocalXSDT->TableOffsetEntry[5] = ACPI_PTR_TO_PHYSADDR (&Oem1Code);
192 1.1.1.2.4.2 rmind
193 1.1.1.2.4.2 rmind /* Install the OEMx table to test LoadTable */
194 1.1.1.2.4.2 rmind
195 1.1.1.2.4.2 rmind LocalXSDT->TableOffsetEntry[6] = ACPI_PTR_TO_PHYSADDR (&OemxCode);
196 1.1.1.2.4.2 rmind
197 1.1.1.2.4.2 rmind /*
198 1.1.1.2.4.2 rmind * Install the user tables. The DSDT must be installed in the FADT.
199 1.1.1.2.4.2 rmind * All other tables are installed directly into the XSDT.
200 1.1.1.2.4.2 rmind */
201 1.1.1.2.4.2 rmind NextIndex = BASE_XSDT_TABLES;
202 1.1.1.2.4.2 rmind NextTable = TableList;
203 1.1.1.2.4.2 rmind while (NextTable)
204 1.1.1.2.4.2 rmind {
205 1.1.1.2.4.2 rmind /*
206 1.1.1.2.4.2 rmind * Incoming DSDT or FADT are special cases. All other tables are
207 1.1.1.2.4.2 rmind * just immediately installed into the XSDT.
208 1.1.1.2.4.2 rmind */
209 1.1.1.2.4.2 rmind if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT))
210 1.1.1.2.4.2 rmind {
211 1.1.1.2.4.2 rmind if (DsdtAddress)
212 1.1.1.2.4.2 rmind {
213 1.1.1.2.4.2 rmind printf ("Already found a DSDT, only one allowed\n");
214 1.1.1.2.4.2 rmind return (AE_ALREADY_EXISTS);
215 1.1.1.2.4.2 rmind }
216 1.1.1.2.4.2 rmind
217 1.1.1.2.4.2 rmind /* The incoming user table is a DSDT */
218 1.1.1.2.4.2 rmind
219 1.1.1.2.4.2 rmind DsdtAddress = ACPI_PTR_TO_PHYSADDR (&DsdtCode);
220 1.1.1.2.4.2 rmind DsdtToInstallOverride = NextTable->Table;
221 1.1.1.2.4.2 rmind }
222 1.1.1.2.4.2 rmind else if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT))
223 1.1.1.2.4.2 rmind {
224 1.1.1.2.4.2 rmind ExternalFadt = ACPI_CAST_PTR (ACPI_TABLE_FADT, NextTable->Table);
225 1.1.1.2.4.2 rmind LocalXSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (NextTable->Table);
226 1.1.1.2.4.2 rmind }
227 1.1.1.2.4.2 rmind else
228 1.1.1.2.4.2 rmind {
229 1.1.1.2.4.2 rmind /* Install the table in the XSDT */
230 1.1.1.2.4.2 rmind
231 1.1.1.2.4.2 rmind LocalXSDT->TableOffsetEntry[NextIndex] = ACPI_PTR_TO_PHYSADDR (NextTable->Table);
232 1.1.1.2.4.2 rmind NextIndex++;
233 1.1.1.2.4.2 rmind }
234 1.1.1.2.4.2 rmind
235 1.1.1.2.4.2 rmind NextTable = NextTable->Next;
236 1.1.1.2.4.2 rmind }
237 1.1.1.2.4.2 rmind
238 1.1.1.2.4.2 rmind /* Build an RSDP */
239 1.1.1.2.4.2 rmind
240 1.1.1.2.4.2 rmind ACPI_MEMSET (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP));
241 1.1.1.2.4.2 rmind ACPI_MEMCPY (LocalRSDP.Signature, ACPI_SIG_RSDP, 8);
242 1.1.1.2.4.2 rmind ACPI_MEMCPY (LocalRSDP.OemId, "I_TEST", 6);
243 1.1.1.2.4.2 rmind LocalRSDP.Revision = 2;
244 1.1.1.2.4.2 rmind LocalRSDP.XsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalXSDT);
245 1.1.1.2.4.2 rmind LocalRSDP.Length = sizeof (ACPI_TABLE_XSDT);
246 1.1.1.2.4.2 rmind
247 1.1.1.2.4.2 rmind /* Set checksums for both XSDT and RSDP */
248 1.1.1.2.4.2 rmind
249 1.1.1.2.4.2 rmind LocalXSDT->Header.Checksum = (UINT8) -AcpiTbChecksum (
250 1.1.1.2.4.2 rmind (void *) LocalXSDT, LocalXSDT->Header.Length);
251 1.1.1.2.4.2 rmind LocalRSDP.Checksum = (UINT8) -AcpiTbChecksum (
252 1.1.1.2.4.2 rmind (void *) &LocalRSDP, ACPI_RSDP_CHECKSUM_LENGTH);
253 1.1.1.2.4.2 rmind
254 1.1.1.2.4.2 rmind if (!DsdtAddress)
255 1.1.1.2.4.2 rmind {
256 1.1.1.2.4.2 rmind /* Use the local DSDT because incoming table(s) are all SSDT(s) */
257 1.1.1.2.4.2 rmind
258 1.1.1.2.4.2 rmind DsdtAddress = ACPI_PTR_TO_PHYSADDR (LocalDsdtCode);
259 1.1.1.2.4.2 rmind DsdtToInstallOverride = ACPI_CAST_PTR (ACPI_TABLE_HEADER, LocalDsdtCode);
260 1.1.1.2.4.2 rmind }
261 1.1.1.2.4.2 rmind
262 1.1.1.2.4.2 rmind if (ExternalFadt)
263 1.1.1.2.4.2 rmind {
264 1.1.1.2.4.2 rmind /*
265 1.1.1.2.4.2 rmind * Use the external FADT, but we must update the DSDT/FACS addresses
266 1.1.1.2.4.2 rmind * as well as the checksum
267 1.1.1.2.4.2 rmind */
268 1.1.1.2.4.2 rmind ExternalFadt->Dsdt = DsdtAddress;
269 1.1.1.2.4.2 rmind ExternalFadt->Facs = ACPI_PTR_TO_PHYSADDR (&LocalFACS);
270 1.1.1.2.4.2 rmind
271 1.1.1.2.4.2 rmind if (ExternalFadt->Header.Length > ACPI_PTR_DIFF (&ExternalFadt->XDsdt, ExternalFadt))
272 1.1.1.2.4.2 rmind {
273 1.1.1.2.4.2 rmind ExternalFadt->XDsdt = DsdtAddress;
274 1.1.1.2.4.2 rmind ExternalFadt->XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS);
275 1.1.1.2.4.2 rmind }
276 1.1.1.2.4.2 rmind /* Complete the FADT with the checksum */
277 1.1.1.2.4.2 rmind
278 1.1.1.2.4.2 rmind ExternalFadt->Header.Checksum = 0;
279 1.1.1.2.4.2 rmind ExternalFadt->Header.Checksum = (UINT8) -AcpiTbChecksum (
280 1.1.1.2.4.2 rmind (void *) ExternalFadt, ExternalFadt->Header.Length);
281 1.1.1.2.4.2 rmind }
282 1.1.1.2.4.2 rmind else
283 1.1.1.2.4.2 rmind {
284 1.1.1.2.4.2 rmind /*
285 1.1.1.2.4.2 rmind * Build a local FADT so we can test the hardware/event init
286 1.1.1.2.4.2 rmind */
287 1.1.1.2.4.2 rmind ACPI_MEMSET (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT));
288 1.1.1.2.4.2 rmind ACPI_STRNCPY (LocalFADT.Header.Signature, ACPI_SIG_FADT, 4);
289 1.1.1.2.4.2 rmind
290 1.1.1.2.4.2 rmind /* Setup FADT header and DSDT/FACS addresses */
291 1.1.1.2.4.2 rmind
292 1.1.1.2.4.2 rmind LocalFADT.Dsdt = 0;
293 1.1.1.2.4.2 rmind LocalFADT.Facs = 0;
294 1.1.1.2.4.2 rmind
295 1.1.1.2.4.2 rmind LocalFADT.XDsdt = DsdtAddress;
296 1.1.1.2.4.2 rmind LocalFADT.XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS);
297 1.1.1.2.4.2 rmind
298 1.1.1.2.4.2 rmind LocalFADT.Header.Revision = 3;
299 1.1.1.2.4.2 rmind LocalFADT.Header.Length = sizeof (ACPI_TABLE_FADT);
300 1.1.1.2.4.2 rmind
301 1.1.1.2.4.2 rmind /* Miscellaneous FADT fields */
302 1.1.1.2.4.2 rmind
303 1.1.1.2.4.2 rmind LocalFADT.Gpe0BlockLength = 16;
304 1.1.1.2.4.2 rmind LocalFADT.Gpe0Block = 0x00001234;
305 1.1.1.2.4.2 rmind
306 1.1.1.2.4.2 rmind LocalFADT.Gpe1BlockLength = 6;
307 1.1.1.2.4.2 rmind LocalFADT.Gpe1Block = 0x00005678;
308 1.1.1.2.4.2 rmind LocalFADT.Gpe1Base = 96;
309 1.1.1.2.4.2 rmind
310 1.1.1.2.4.2 rmind LocalFADT.Pm1EventLength = 4;
311 1.1.1.2.4.2 rmind LocalFADT.Pm1aEventBlock = 0x00001aaa;
312 1.1.1.2.4.2 rmind LocalFADT.Pm1bEventBlock = 0x00001bbb;
313 1.1.1.2.4.2 rmind
314 1.1.1.2.4.2 rmind LocalFADT.Pm1ControlLength = 2;
315 1.1.1.2.4.2 rmind LocalFADT.Pm1aControlBlock = 0xB0;
316 1.1.1.2.4.2 rmind
317 1.1.1.2.4.2 rmind LocalFADT.PmTimerLength = 4;
318 1.1.1.2.4.2 rmind LocalFADT.PmTimerBlock = 0xA0;
319 1.1.1.2.4.2 rmind
320 1.1.1.2.4.2 rmind LocalFADT.Pm2ControlBlock = 0xC0;
321 1.1.1.2.4.2 rmind LocalFADT.Pm2ControlLength = 1;
322 1.1.1.2.4.2 rmind
323 1.1.1.2.4.2 rmind /* Setup one example X-64 field */
324 1.1.1.2.4.2 rmind
325 1.1.1.2.4.2 rmind LocalFADT.XPm1bEventBlock.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
326 1.1.1.2.4.2 rmind LocalFADT.XPm1bEventBlock.Address = LocalFADT.Pm1bEventBlock;
327 1.1.1.2.4.2 rmind LocalFADT.XPm1bEventBlock.BitWidth = (UINT8) ACPI_MUL_8 (LocalFADT.Pm1EventLength);
328 1.1.1.2.4.2 rmind
329 1.1.1.2.4.2 rmind /* Complete the FADT with the checksum */
330 1.1.1.2.4.2 rmind
331 1.1.1.2.4.2 rmind LocalFADT.Header.Checksum = 0;
332 1.1.1.2.4.2 rmind LocalFADT.Header.Checksum = (UINT8) -AcpiTbChecksum (
333 1.1.1.2.4.2 rmind (void *) &LocalFADT, LocalFADT.Header.Length);
334 1.1.1.2.4.2 rmind }
335 1.1.1.2.4.2 rmind
336 1.1.1.2.4.2 rmind /* Build a FACS */
337 1.1.1.2.4.2 rmind
338 1.1.1.2.4.2 rmind ACPI_MEMSET (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS));
339 1.1.1.2.4.2 rmind ACPI_STRNCPY (LocalFACS.Signature, ACPI_SIG_FACS, 4);
340 1.1.1.2.4.2 rmind
341 1.1.1.2.4.2 rmind LocalFACS.Length = sizeof (ACPI_TABLE_FACS);
342 1.1.1.2.4.2 rmind LocalFACS.GlobalLock = 0x11AA0011;
343 1.1.1.2.4.2 rmind
344 1.1.1.2.4.2 rmind /*
345 1.1.1.2.4.2 rmind * Build a fake table [TEST] so that we make sure that the
346 1.1.1.2.4.2 rmind * ACPICA core ignores it
347 1.1.1.2.4.2 rmind */
348 1.1.1.2.4.2 rmind ACPI_MEMSET (&LocalTEST, 0, sizeof (ACPI_TABLE_HEADER));
349 1.1.1.2.4.2 rmind ACPI_STRNCPY (LocalTEST.Signature, "TEST", 4);
350 1.1.1.2.4.2 rmind
351 1.1.1.2.4.2 rmind LocalTEST.Revision = 1;
352 1.1.1.2.4.2 rmind LocalTEST.Length = sizeof (ACPI_TABLE_HEADER);
353 1.1.1.2.4.2 rmind LocalTEST.Checksum = (UINT8) -AcpiTbChecksum (
354 1.1.1.2.4.2 rmind (void *) &LocalTEST, LocalTEST.Length);
355 1.1.1.2.4.2 rmind
356 1.1.1.2.4.2 rmind /*
357 1.1.1.2.4.2 rmind * Build a fake table with a bad signature [BAD!] so that we make
358 1.1.1.2.4.2 rmind * sure that the ACPICA core ignores it
359 1.1.1.2.4.2 rmind */
360 1.1.1.2.4.2 rmind ACPI_MEMSET (&LocalBADTABLE, 0, sizeof (ACPI_TABLE_HEADER));
361 1.1.1.2.4.2 rmind ACPI_STRNCPY (LocalBADTABLE.Signature, "BAD!", 4);
362 1.1.1.2.4.2 rmind
363 1.1.1.2.4.2 rmind LocalBADTABLE.Revision = 1;
364 1.1.1.2.4.2 rmind LocalBADTABLE.Length = sizeof (ACPI_TABLE_HEADER);
365 1.1.1.2.4.2 rmind LocalBADTABLE.Checksum = (UINT8) -AcpiTbChecksum (
366 1.1.1.2.4.2 rmind (void *) &LocalBADTABLE, LocalBADTABLE.Length);
367 1.1.1.2.4.2 rmind
368 1.1.1.2.4.2 rmind return (AE_OK);
369 1.1.1.2.4.2 rmind }
370 1.1.1.2.4.2 rmind
371 1.1.1.2.4.2 rmind
372 1.1.1.2.4.2 rmind /******************************************************************************
373 1.1.1.2.4.2 rmind *
374 1.1.1.2.4.2 rmind * FUNCTION: AeInstallTables
375 1.1.1.2.4.2 rmind *
376 1.1.1.2.4.2 rmind * PARAMETERS: None
377 1.1.1.2.4.2 rmind *
378 1.1.1.2.4.2 rmind * RETURN: Status
379 1.1.1.2.4.2 rmind *
380 1.1.1.2.4.2 rmind * DESCRIPTION: Install the various ACPI tables
381 1.1.1.2.4.2 rmind *
382 1.1.1.2.4.2 rmind *****************************************************************************/
383 1.1.1.2.4.2 rmind
384 1.1.1.2.4.2 rmind ACPI_STATUS
385 1.1.1.2.4.2 rmind AeInstallTables (
386 1.1.1.2.4.2 rmind void)
387 1.1.1.2.4.2 rmind {
388 1.1.1.2.4.2 rmind ACPI_STATUS Status;
389 1.1.1.2.4.2 rmind
390 1.1.1.2.4.2 rmind
391 1.1.1.2.4.2 rmind Status = AcpiInitializeTables (Tables, ACPI_MAX_INIT_TABLES, TRUE);
392 1.1.1.2.4.2 rmind AE_CHECK_OK (AcpiInitializeTables, Status);
393 1.1.1.2.4.2 rmind
394 1.1.1.2.4.2 rmind Status = AcpiReallocateRootTable ();
395 1.1.1.2.4.2 rmind AE_CHECK_OK (AcpiReallocateRootTable, Status);
396 1.1.1.2.4.2 rmind
397 1.1.1.2.4.2 rmind Status = AcpiLoadTables ();
398 1.1.1.2.4.2 rmind AE_CHECK_OK (AcpiLoadTables, Status);
399 1.1.1.2.4.2 rmind
400 1.1.1.2.4.2 rmind /*
401 1.1.1.2.4.2 rmind * Test run-time control method installation. Do it twice to test code
402 1.1.1.2.4.2 rmind * for an existing name.
403 1.1.1.2.4.2 rmind */
404 1.1.1.2.4.2 rmind Status = AcpiInstallMethod (MethodCode);
405 1.1.1.2.4.2 rmind if (ACPI_FAILURE (Status))
406 1.1.1.2.4.2 rmind {
407 1.1.1.2.4.2 rmind AcpiOsPrintf ("%s, Could not install method\n",
408 1.1.1.2.4.2 rmind AcpiFormatException (Status));
409 1.1.1.2.4.2 rmind }
410 1.1.1.2.4.2 rmind
411 1.1.1.2.4.2 rmind Status = AcpiInstallMethod (MethodCode);
412 1.1.1.2.4.2 rmind if (ACPI_FAILURE (Status))
413 1.1.1.2.4.2 rmind {
414 1.1.1.2.4.2 rmind AcpiOsPrintf ("%s, Could not install method\n",
415 1.1.1.2.4.2 rmind AcpiFormatException (Status));
416 1.1.1.2.4.2 rmind }
417 1.1.1.2.4.2 rmind
418 1.1.1.2.4.2 rmind return (AE_OK);
419 1.1.1.2.4.2 rmind }
420 1.1.1.2.4.2 rmind
421 1.1.1.2.4.2 rmind
422 1.1.1.2.4.2 rmind /******************************************************************************
423 1.1.1.2.4.2 rmind *
424 1.1.1.2.4.2 rmind * FUNCTION: AeLocalGetRootPointer
425 1.1.1.2.4.2 rmind *
426 1.1.1.2.4.2 rmind * PARAMETERS: Flags - not used
427 1.1.1.2.4.2 rmind * Address - Where the root pointer is returned
428 1.1.1.2.4.2 rmind *
429 1.1.1.2.4.2 rmind * RETURN: Status
430 1.1.1.2.4.2 rmind *
431 1.1.1.2.4.2 rmind * DESCRIPTION: Return a local RSDP, used to dynamically load tables via the
432 1.1.1.2.4.2 rmind * standard ACPI mechanism.
433 1.1.1.2.4.2 rmind *
434 1.1.1.2.4.2 rmind *****************************************************************************/
435 1.1.1.2.4.2 rmind
436 1.1.1.2.4.2 rmind ACPI_PHYSICAL_ADDRESS
437 1.1.1.2.4.2 rmind AeLocalGetRootPointer (
438 1.1.1.2.4.2 rmind void)
439 1.1.1.2.4.2 rmind {
440 1.1.1.2.4.2 rmind
441 1.1.1.2.4.2 rmind return ((ACPI_PHYSICAL_ADDRESS) &LocalRSDP);
442 1.1.1.2.4.2 rmind }
443