dmextern.c revision 1.1.1.4 1 1.1 jruoho /******************************************************************************
2 1.1 jruoho *
3 1.1 jruoho * Module Name: dmextern - Support for External() ASL statements
4 1.1 jruoho *
5 1.1 jruoho *****************************************************************************/
6 1.1 jruoho
7 1.1.1.2 jruoho /*
8 1.1.1.4 christos * Copyright (C) 2000 - 2014, Intel Corp.
9 1.1 jruoho * All rights reserved.
10 1.1 jruoho *
11 1.1.1.2 jruoho * Redistribution and use in source and binary forms, with or without
12 1.1.1.2 jruoho * modification, are permitted provided that the following conditions
13 1.1.1.2 jruoho * are met:
14 1.1.1.2 jruoho * 1. Redistributions of source code must retain the above copyright
15 1.1.1.2 jruoho * notice, this list of conditions, and the following disclaimer,
16 1.1.1.2 jruoho * without modification.
17 1.1.1.2 jruoho * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1.1.2 jruoho * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1.1.2 jruoho * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1.1.2 jruoho * including a substantially similar Disclaimer requirement for further
21 1.1.1.2 jruoho * binary redistribution.
22 1.1.1.2 jruoho * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1.1.2 jruoho * of any contributors may be used to endorse or promote products derived
24 1.1.1.2 jruoho * from this software without specific prior written permission.
25 1.1.1.2 jruoho *
26 1.1.1.2 jruoho * Alternatively, this software may be distributed under the terms of the
27 1.1.1.2 jruoho * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1.1.2 jruoho * Software Foundation.
29 1.1.1.2 jruoho *
30 1.1.1.2 jruoho * NO WARRANTY
31 1.1.1.2 jruoho * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1.1.2 jruoho * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.2 jruoho * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.1.1.2 jruoho * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1.1.2 jruoho * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1.1.2 jruoho * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1.1.2 jruoho * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1.1.2 jruoho * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1.1.2 jruoho * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1.1.2 jruoho * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1.1.2 jruoho * POSSIBILITY OF SUCH DAMAGES.
42 1.1.1.2 jruoho */
43 1.1 jruoho
44 1.1 jruoho #include "acpi.h"
45 1.1 jruoho #include "accommon.h"
46 1.1 jruoho #include "amlcode.h"
47 1.1 jruoho #include "acnamesp.h"
48 1.1 jruoho #include "acdisasm.h"
49 1.1.1.3 christos #include "aslcompiler.h"
50 1.1.1.3 christos #include <stdio.h>
51 1.1.1.3 christos #include <errno.h>
52 1.1 jruoho
53 1.1 jruoho
54 1.1 jruoho /*
55 1.1 jruoho * This module is used for application-level code (iASL disassembler) only.
56 1.1 jruoho *
57 1.1 jruoho * It contains the code to create and emit any necessary External() ASL
58 1.1 jruoho * statements for the module being disassembled.
59 1.1 jruoho */
60 1.1 jruoho #define _COMPONENT ACPI_CA_DISASSEMBLER
61 1.1 jruoho ACPI_MODULE_NAME ("dmextern")
62 1.1 jruoho
63 1.1 jruoho
64 1.1 jruoho /*
65 1.1 jruoho * This table maps ACPI_OBJECT_TYPEs to the corresponding ASL
66 1.1 jruoho * ObjectTypeKeyword. Used to generate typed external declarations
67 1.1 jruoho */
68 1.1 jruoho static const char *AcpiGbl_DmTypeNames[] =
69 1.1 jruoho {
70 1.1.1.4 christos /* 00 */ ", UnknownObj", /* Type ANY */
71 1.1 jruoho /* 01 */ ", IntObj",
72 1.1 jruoho /* 02 */ ", StrObj",
73 1.1 jruoho /* 03 */ ", BuffObj",
74 1.1 jruoho /* 04 */ ", PkgObj",
75 1.1 jruoho /* 05 */ ", FieldUnitObj",
76 1.1 jruoho /* 06 */ ", DeviceObj",
77 1.1 jruoho /* 07 */ ", EventObj",
78 1.1 jruoho /* 08 */ ", MethodObj",
79 1.1 jruoho /* 09 */ ", MutexObj",
80 1.1 jruoho /* 10 */ ", OpRegionObj",
81 1.1 jruoho /* 11 */ ", PowerResObj",
82 1.1 jruoho /* 12 */ ", ProcessorObj",
83 1.1 jruoho /* 13 */ ", ThermalZoneObj",
84 1.1 jruoho /* 14 */ ", BuffFieldObj",
85 1.1 jruoho /* 15 */ ", DDBHandleObj",
86 1.1 jruoho /* 16 */ "", /* Debug object */
87 1.1 jruoho /* 17 */ ", FieldUnitObj",
88 1.1 jruoho /* 18 */ ", FieldUnitObj",
89 1.1 jruoho /* 19 */ ", FieldUnitObj"
90 1.1 jruoho };
91 1.1 jruoho
92 1.1.1.3 christos #define METHOD_SEPARATORS " \t,()\n"
93 1.1.1.3 christos
94 1.1 jruoho
95 1.1 jruoho /* Local prototypes */
96 1.1 jruoho
97 1.1 jruoho static const char *
98 1.1 jruoho AcpiDmGetObjectTypeName (
99 1.1 jruoho ACPI_OBJECT_TYPE Type);
100 1.1 jruoho
101 1.1 jruoho static char *
102 1.1 jruoho AcpiDmNormalizeParentPrefix (
103 1.1 jruoho ACPI_PARSE_OBJECT *Op,
104 1.1 jruoho char *Path);
105 1.1 jruoho
106 1.1.1.3 christos static void
107 1.1.1.3 christos AcpiDmAddPathToExternalList (
108 1.1.1.3 christos char *Path,
109 1.1.1.3 christos UINT8 Type,
110 1.1.1.3 christos UINT32 Value,
111 1.1.1.3 christos UINT16 Flags);
112 1.1.1.3 christos
113 1.1.1.3 christos static ACPI_STATUS
114 1.1.1.3 christos AcpiDmCreateNewExternal (
115 1.1.1.3 christos char *ExternalPath,
116 1.1.1.3 christos char *InternalPath,
117 1.1.1.3 christos UINT8 Type,
118 1.1.1.3 christos UINT32 Value,
119 1.1.1.3 christos UINT16 Flags);
120 1.1.1.3 christos
121 1.1 jruoho
122 1.1 jruoho /*******************************************************************************
123 1.1 jruoho *
124 1.1 jruoho * FUNCTION: AcpiDmGetObjectTypeName
125 1.1 jruoho *
126 1.1 jruoho * PARAMETERS: Type - An ACPI_OBJECT_TYPE
127 1.1 jruoho *
128 1.1 jruoho * RETURN: Pointer to a string
129 1.1 jruoho *
130 1.1 jruoho * DESCRIPTION: Map an object type to the ASL object type string.
131 1.1 jruoho *
132 1.1 jruoho ******************************************************************************/
133 1.1 jruoho
134 1.1 jruoho static const char *
135 1.1 jruoho AcpiDmGetObjectTypeName (
136 1.1 jruoho ACPI_OBJECT_TYPE Type)
137 1.1 jruoho {
138 1.1 jruoho
139 1.1 jruoho if (Type == ACPI_TYPE_LOCAL_SCOPE)
140 1.1 jruoho {
141 1.1 jruoho Type = ACPI_TYPE_DEVICE;
142 1.1 jruoho }
143 1.1 jruoho
144 1.1 jruoho else if (Type > ACPI_TYPE_LOCAL_INDEX_FIELD)
145 1.1 jruoho {
146 1.1 jruoho return ("");
147 1.1 jruoho }
148 1.1 jruoho
149 1.1 jruoho return (AcpiGbl_DmTypeNames[Type]);
150 1.1 jruoho }
151 1.1 jruoho
152 1.1 jruoho
153 1.1 jruoho /*******************************************************************************
154 1.1 jruoho *
155 1.1 jruoho * FUNCTION: AcpiDmNormalizeParentPrefix
156 1.1 jruoho *
157 1.1 jruoho * PARAMETERS: Op - Parse op
158 1.1 jruoho * Path - Path with parent prefix
159 1.1 jruoho *
160 1.1 jruoho * RETURN: The full pathname to the object (from the namespace root)
161 1.1 jruoho *
162 1.1 jruoho * DESCRIPTION: Returns the full pathname of a path with parent prefix
163 1.1 jruoho * The caller must free the fullpath returned.
164 1.1 jruoho *
165 1.1 jruoho ******************************************************************************/
166 1.1 jruoho
167 1.1 jruoho static char *
168 1.1 jruoho AcpiDmNormalizeParentPrefix (
169 1.1 jruoho ACPI_PARSE_OBJECT *Op,
170 1.1 jruoho char *Path)
171 1.1 jruoho {
172 1.1 jruoho ACPI_NAMESPACE_NODE *Node;
173 1.1 jruoho char *Fullpath;
174 1.1 jruoho char *ParentPath;
175 1.1 jruoho ACPI_SIZE Length;
176 1.1.1.3 christos UINT32 Index = 0;
177 1.1 jruoho
178 1.1 jruoho
179 1.1.1.3 christos if (!Op)
180 1.1.1.3 christos {
181 1.1.1.3 christos return (NULL);
182 1.1.1.3 christos }
183 1.1.1.3 christos
184 1.1.1.3 christos /* Search upwards in the parse tree until we reach the next namespace node */
185 1.1 jruoho
186 1.1.1.3 christos Op = Op->Common.Parent;
187 1.1 jruoho while (Op)
188 1.1 jruoho {
189 1.1 jruoho if (Op->Common.Node)
190 1.1 jruoho {
191 1.1 jruoho break;
192 1.1 jruoho }
193 1.1 jruoho
194 1.1 jruoho Op = Op->Common.Parent;
195 1.1 jruoho }
196 1.1 jruoho
197 1.1 jruoho if (!Op)
198 1.1 jruoho {
199 1.1 jruoho return (NULL);
200 1.1 jruoho }
201 1.1 jruoho
202 1.1 jruoho /*
203 1.1 jruoho * Find the actual parent node for the reference:
204 1.1 jruoho * Remove all carat prefixes from the input path.
205 1.1 jruoho * There may be multiple parent prefixes (For example, ^^^M000)
206 1.1 jruoho */
207 1.1 jruoho Node = Op->Common.Node;
208 1.1 jruoho while (Node && (*Path == (UINT8) AML_PARENT_PREFIX))
209 1.1 jruoho {
210 1.1 jruoho Node = Node->Parent;
211 1.1 jruoho Path++;
212 1.1 jruoho }
213 1.1 jruoho
214 1.1 jruoho if (!Node)
215 1.1 jruoho {
216 1.1 jruoho return (NULL);
217 1.1 jruoho }
218 1.1 jruoho
219 1.1 jruoho /* Get the full pathname for the parent node */
220 1.1 jruoho
221 1.1 jruoho ParentPath = AcpiNsGetExternalPathname (Node);
222 1.1 jruoho if (!ParentPath)
223 1.1 jruoho {
224 1.1 jruoho return (NULL);
225 1.1 jruoho }
226 1.1 jruoho
227 1.1 jruoho Length = (ACPI_STRLEN (ParentPath) + ACPI_STRLEN (Path) + 1);
228 1.1 jruoho if (ParentPath[1])
229 1.1 jruoho {
230 1.1 jruoho /*
231 1.1 jruoho * If ParentPath is not just a simple '\', increment the length
232 1.1 jruoho * for the required dot separator (ParentPath.Path)
233 1.1 jruoho */
234 1.1 jruoho Length++;
235 1.1.1.3 christos
236 1.1.1.3 christos /* For External() statements, we do not want a leading '\' */
237 1.1.1.3 christos
238 1.1.1.3 christos if (*ParentPath == AML_ROOT_PREFIX)
239 1.1.1.3 christos {
240 1.1.1.3 christos Index = 1;
241 1.1.1.3 christos }
242 1.1 jruoho }
243 1.1 jruoho
244 1.1 jruoho Fullpath = ACPI_ALLOCATE_ZEROED (Length);
245 1.1 jruoho if (!Fullpath)
246 1.1 jruoho {
247 1.1 jruoho goto Cleanup;
248 1.1 jruoho }
249 1.1 jruoho
250 1.1 jruoho /*
251 1.1 jruoho * Concatenate parent fullpath and path. For example,
252 1.1 jruoho * parent fullpath "\_SB_", Path "^INIT", Fullpath "\_SB_.INIT"
253 1.1 jruoho *
254 1.1 jruoho * Copy the parent path
255 1.1 jruoho */
256 1.1.1.3 christos ACPI_STRCPY (Fullpath, &ParentPath[Index]);
257 1.1 jruoho
258 1.1.1.3 christos /*
259 1.1.1.3 christos * Add dot separator
260 1.1.1.3 christos * (don't need dot if parent fullpath is a single backslash)
261 1.1.1.3 christos */
262 1.1 jruoho if (ParentPath[1])
263 1.1 jruoho {
264 1.1 jruoho ACPI_STRCAT (Fullpath, ".");
265 1.1 jruoho }
266 1.1 jruoho
267 1.1 jruoho /* Copy child path (carat parent prefix(es) were skipped above) */
268 1.1 jruoho
269 1.1 jruoho ACPI_STRCAT (Fullpath, Path);
270 1.1 jruoho
271 1.1 jruoho Cleanup:
272 1.1 jruoho ACPI_FREE (ParentPath);
273 1.1 jruoho return (Fullpath);
274 1.1 jruoho }
275 1.1 jruoho
276 1.1 jruoho
277 1.1 jruoho /*******************************************************************************
278 1.1 jruoho *
279 1.1.1.2 jruoho * FUNCTION: AcpiDmAddToExternalFileList
280 1.1.1.2 jruoho *
281 1.1.1.2 jruoho * PARAMETERS: PathList - Single path or list separated by comma
282 1.1.1.2 jruoho *
283 1.1.1.2 jruoho * RETURN: None
284 1.1.1.2 jruoho *
285 1.1.1.2 jruoho * DESCRIPTION: Add external files to global list
286 1.1.1.2 jruoho *
287 1.1.1.2 jruoho ******************************************************************************/
288 1.1.1.2 jruoho
289 1.1.1.2 jruoho ACPI_STATUS
290 1.1.1.2 jruoho AcpiDmAddToExternalFileList (
291 1.1.1.3 christos char *Pathname)
292 1.1.1.2 jruoho {
293 1.1.1.2 jruoho ACPI_EXTERNAL_FILE *ExternalFile;
294 1.1.1.3 christos char *LocalPathname;
295 1.1.1.2 jruoho
296 1.1.1.2 jruoho
297 1.1.1.3 christos if (!Pathname)
298 1.1.1.2 jruoho {
299 1.1.1.2 jruoho return (AE_OK);
300 1.1.1.2 jruoho }
301 1.1.1.2 jruoho
302 1.1.1.3 christos LocalPathname = ACPI_ALLOCATE (strlen (Pathname) + 1);
303 1.1.1.3 christos if (!LocalPathname)
304 1.1.1.2 jruoho {
305 1.1.1.3 christos return (AE_NO_MEMORY);
306 1.1.1.3 christos }
307 1.1.1.2 jruoho
308 1.1.1.3 christos ExternalFile = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_FILE));
309 1.1.1.3 christos if (!ExternalFile)
310 1.1.1.3 christos {
311 1.1.1.3 christos ACPI_FREE (LocalPathname);
312 1.1.1.3 christos return (AE_NO_MEMORY);
313 1.1.1.3 christos }
314 1.1.1.2 jruoho
315 1.1.1.3 christos /* Take a copy of the file pathname */
316 1.1.1.2 jruoho
317 1.1.1.3 christos strcpy (LocalPathname, Pathname);
318 1.1.1.3 christos ExternalFile->Path = LocalPathname;
319 1.1.1.2 jruoho
320 1.1.1.3 christos if (AcpiGbl_ExternalFileList)
321 1.1.1.3 christos {
322 1.1.1.3 christos ExternalFile->Next = AcpiGbl_ExternalFileList;
323 1.1.1.2 jruoho }
324 1.1.1.2 jruoho
325 1.1.1.3 christos AcpiGbl_ExternalFileList = ExternalFile;
326 1.1.1.2 jruoho return (AE_OK);
327 1.1.1.2 jruoho }
328 1.1.1.2 jruoho
329 1.1.1.2 jruoho
330 1.1.1.2 jruoho /*******************************************************************************
331 1.1.1.2 jruoho *
332 1.1.1.2 jruoho * FUNCTION: AcpiDmClearExternalFileList
333 1.1.1.2 jruoho *
334 1.1.1.2 jruoho * PARAMETERS: None
335 1.1.1.2 jruoho *
336 1.1.1.2 jruoho * RETURN: None
337 1.1.1.2 jruoho *
338 1.1.1.2 jruoho * DESCRIPTION: Clear the external file list
339 1.1.1.2 jruoho *
340 1.1.1.2 jruoho ******************************************************************************/
341 1.1.1.2 jruoho
342 1.1.1.2 jruoho void
343 1.1.1.2 jruoho AcpiDmClearExternalFileList (
344 1.1.1.2 jruoho void)
345 1.1.1.2 jruoho {
346 1.1.1.2 jruoho ACPI_EXTERNAL_FILE *NextExternal;
347 1.1.1.2 jruoho
348 1.1.1.2 jruoho
349 1.1.1.2 jruoho while (AcpiGbl_ExternalFileList)
350 1.1.1.2 jruoho {
351 1.1.1.2 jruoho NextExternal = AcpiGbl_ExternalFileList->Next;
352 1.1.1.2 jruoho ACPI_FREE (AcpiGbl_ExternalFileList->Path);
353 1.1.1.2 jruoho ACPI_FREE (AcpiGbl_ExternalFileList);
354 1.1.1.2 jruoho AcpiGbl_ExternalFileList = NextExternal;
355 1.1.1.2 jruoho }
356 1.1.1.2 jruoho }
357 1.1.1.2 jruoho
358 1.1.1.2 jruoho
359 1.1.1.2 jruoho /*******************************************************************************
360 1.1.1.2 jruoho *
361 1.1.1.3 christos * FUNCTION: AcpiDmGetExternalsFromFile
362 1.1.1.3 christos *
363 1.1.1.3 christos * PARAMETERS: None
364 1.1.1.3 christos *
365 1.1.1.3 christos * RETURN: None
366 1.1.1.3 christos *
367 1.1.1.3 christos * DESCRIPTION: Process the optional external reference file.
368 1.1.1.3 christos *
369 1.1.1.3 christos * Each line in the file should be of the form:
370 1.1.1.3 christos * External (<Method namepath>, MethodObj, <ArgCount>)
371 1.1.1.3 christos *
372 1.1.1.3 christos * Example:
373 1.1.1.3 christos * External (_SB_.PCI0.XHC_.PS0X, MethodObj, 4)
374 1.1.1.3 christos *
375 1.1.1.3 christos ******************************************************************************/
376 1.1.1.3 christos
377 1.1.1.3 christos void
378 1.1.1.3 christos AcpiDmGetExternalsFromFile (
379 1.1.1.3 christos void)
380 1.1.1.3 christos {
381 1.1.1.3 christos FILE *ExternalRefFile;
382 1.1.1.3 christos char *Token;
383 1.1.1.3 christos char *MethodName;
384 1.1.1.3 christos UINT32 ArgCount;
385 1.1.1.3 christos UINT32 ImportCount = 0;
386 1.1.1.3 christos
387 1.1.1.3 christos
388 1.1.1.3 christos if (!Gbl_ExternalRefFilename)
389 1.1.1.3 christos {
390 1.1.1.3 christos return;
391 1.1.1.3 christos }
392 1.1.1.3 christos
393 1.1.1.3 christos /* Open the file */
394 1.1.1.3 christos
395 1.1.1.3 christos ExternalRefFile = fopen (Gbl_ExternalRefFilename, "r");
396 1.1.1.3 christos if (!ExternalRefFile)
397 1.1.1.3 christos {
398 1.1.1.3 christos fprintf (stderr, "Could not open external reference file \"%s\"\n",
399 1.1.1.3 christos Gbl_ExternalRefFilename);
400 1.1.1.4 christos AslAbort ();
401 1.1.1.3 christos return;
402 1.1.1.3 christos }
403 1.1.1.3 christos
404 1.1.1.3 christos /* Each line defines a method */
405 1.1.1.3 christos
406 1.1.1.3 christos while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ExternalRefFile))
407 1.1.1.3 christos {
408 1.1.1.3 christos Token = strtok (StringBuffer, METHOD_SEPARATORS); /* "External" */
409 1.1.1.4 christos if (!Token)
410 1.1.1.4 christos {
411 1.1.1.4 christos continue;
412 1.1.1.4 christos }
413 1.1.1.4 christos if (strcmp (Token, "External"))
414 1.1.1.4 christos {
415 1.1.1.4 christos continue;
416 1.1.1.4 christos }
417 1.1.1.3 christos
418 1.1.1.3 christos MethodName = strtok (NULL, METHOD_SEPARATORS); /* Method namepath */
419 1.1.1.4 christos if (!MethodName)
420 1.1.1.4 christos {
421 1.1.1.4 christos continue;
422 1.1.1.4 christos }
423 1.1.1.3 christos
424 1.1.1.3 christos Token = strtok (NULL, METHOD_SEPARATORS); /* "MethodObj" */
425 1.1.1.4 christos if (!Token)
426 1.1.1.4 christos {
427 1.1.1.4 christos continue;
428 1.1.1.4 christos }
429 1.1.1.4 christos
430 1.1.1.4 christos if (strcmp (Token, "MethodObj"))
431 1.1.1.4 christos {
432 1.1.1.4 christos continue;
433 1.1.1.4 christos }
434 1.1.1.3 christos
435 1.1.1.3 christos Token = strtok (NULL, METHOD_SEPARATORS); /* Arg count */
436 1.1.1.4 christos if (!Token)
437 1.1.1.4 christos {
438 1.1.1.4 christos continue;
439 1.1.1.4 christos }
440 1.1.1.3 christos
441 1.1.1.3 christos /* Convert arg count string to an integer */
442 1.1.1.3 christos
443 1.1.1.3 christos errno = 0;
444 1.1.1.3 christos ArgCount = strtoul (Token, NULL, 0);
445 1.1.1.3 christos if (errno)
446 1.1.1.3 christos {
447 1.1.1.3 christos fprintf (stderr, "Invalid argument count (%s)\n", Token);
448 1.1.1.3 christos continue;
449 1.1.1.3 christos }
450 1.1.1.3 christos if (ArgCount > 7)
451 1.1.1.3 christos {
452 1.1.1.3 christos fprintf (stderr, "Invalid argument count (%u)\n", ArgCount);
453 1.1.1.3 christos continue;
454 1.1.1.3 christos }
455 1.1.1.3 christos
456 1.1.1.3 christos /* Add this external to the global list */
457 1.1.1.3 christos
458 1.1.1.3 christos AcpiOsPrintf ("%s: Importing method external (%u arguments) %s\n",
459 1.1.1.3 christos Gbl_ExternalRefFilename, ArgCount, MethodName);
460 1.1.1.3 christos
461 1.1.1.3 christos AcpiDmAddPathToExternalList (MethodName, ACPI_TYPE_METHOD,
462 1.1.1.3 christos ArgCount, (ACPI_EXT_RESOLVED_REFERENCE | ACPI_EXT_ORIGIN_FROM_FILE));
463 1.1.1.3 christos ImportCount++;
464 1.1.1.3 christos }
465 1.1.1.3 christos
466 1.1.1.3 christos if (!ImportCount)
467 1.1.1.3 christos {
468 1.1.1.3 christos fprintf (stderr, "Did not find any external methods in reference file \"%s\"\n",
469 1.1.1.3 christos Gbl_ExternalRefFilename);
470 1.1.1.3 christos }
471 1.1.1.3 christos else
472 1.1.1.3 christos {
473 1.1.1.3 christos /* Add the external(s) to the namespace */
474 1.1.1.3 christos
475 1.1.1.3 christos AcpiDmAddExternalsToNamespace ();
476 1.1.1.3 christos
477 1.1.1.3 christos AcpiOsPrintf ("%s: Imported %u external method definitions\n",
478 1.1.1.3 christos Gbl_ExternalRefFilename, ImportCount);
479 1.1.1.3 christos }
480 1.1.1.3 christos
481 1.1.1.3 christos fclose (ExternalRefFile);
482 1.1.1.3 christos }
483 1.1.1.3 christos
484 1.1.1.3 christos
485 1.1.1.3 christos /*******************************************************************************
486 1.1.1.3 christos *
487 1.1.1.3 christos * FUNCTION: AcpiDmAddOpToExternalList
488 1.1 jruoho *
489 1.1 jruoho * PARAMETERS: Op - Current parser Op
490 1.1 jruoho * Path - Internal (AML) path to the object
491 1.1 jruoho * Type - ACPI object type to be added
492 1.1 jruoho * Value - Arg count if adding a Method object
493 1.1.1.3 christos * Flags - To be passed to the external object
494 1.1 jruoho *
495 1.1 jruoho * RETURN: None
496 1.1 jruoho *
497 1.1 jruoho * DESCRIPTION: Insert a new name into the global list of Externals which
498 1.1 jruoho * will in turn be later emitted as an External() declaration
499 1.1 jruoho * in the disassembled output.
500 1.1 jruoho *
501 1.1.1.3 christos * This function handles the most common case where the referenced
502 1.1.1.3 christos * name is simply not found in the constructed namespace.
503 1.1.1.3 christos *
504 1.1 jruoho ******************************************************************************/
505 1.1 jruoho
506 1.1 jruoho void
507 1.1.1.3 christos AcpiDmAddOpToExternalList (
508 1.1 jruoho ACPI_PARSE_OBJECT *Op,
509 1.1 jruoho char *Path,
510 1.1 jruoho UINT8 Type,
511 1.1.1.3 christos UINT32 Value,
512 1.1.1.3 christos UINT16 Flags)
513 1.1 jruoho {
514 1.1 jruoho char *ExternalPath;
515 1.1.1.3 christos char *InternalPath = Path;
516 1.1.1.3 christos char *Temp;
517 1.1 jruoho ACPI_STATUS Status;
518 1.1 jruoho
519 1.1 jruoho
520 1.1.1.3 christos ACPI_FUNCTION_TRACE (DmAddOpToExternalList);
521 1.1.1.3 christos
522 1.1.1.3 christos
523 1.1 jruoho if (!Path)
524 1.1 jruoho {
525 1.1.1.3 christos return_VOID;
526 1.1.1.3 christos }
527 1.1.1.3 christos
528 1.1.1.3 christos /* Remove a root backslash if present */
529 1.1.1.3 christos
530 1.1.1.3 christos if ((*Path == AML_ROOT_PREFIX) && (Path[1]))
531 1.1.1.3 christos {
532 1.1.1.3 christos Path++;
533 1.1 jruoho }
534 1.1 jruoho
535 1.1.1.3 christos /* Externalize the pathname */
536 1.1 jruoho
537 1.1 jruoho Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path,
538 1.1.1.3 christos NULL, &ExternalPath);
539 1.1 jruoho if (ACPI_FAILURE (Status))
540 1.1 jruoho {
541 1.1.1.3 christos return_VOID;
542 1.1 jruoho }
543 1.1 jruoho
544 1.1.1.3 christos /*
545 1.1.1.3 christos * Get the full pathname from the root if "Path" has one or more
546 1.1.1.3 christos * parent prefixes (^). Note: path will not contain a leading '\'.
547 1.1.1.3 christos */
548 1.1 jruoho if (*Path == (UINT8) AML_PARENT_PREFIX)
549 1.1 jruoho {
550 1.1.1.3 christos Temp = AcpiDmNormalizeParentPrefix (Op, ExternalPath);
551 1.1.1.3 christos
552 1.1.1.3 christos /* Set new external path */
553 1.1.1.3 christos
554 1.1.1.3 christos ACPI_FREE (ExternalPath);
555 1.1.1.3 christos ExternalPath = Temp;
556 1.1.1.3 christos if (!Temp)
557 1.1 jruoho {
558 1.1.1.3 christos return_VOID;
559 1.1.1.3 christos }
560 1.1.1.3 christos
561 1.1.1.3 christos /* Create the new internal pathname */
562 1.1 jruoho
563 1.1.1.3 christos Flags |= ACPI_EXT_INTERNAL_PATH_ALLOCATED;
564 1.1.1.3 christos Status = AcpiNsInternalizeName (ExternalPath, &InternalPath);
565 1.1.1.3 christos if (ACPI_FAILURE (Status))
566 1.1.1.3 christos {
567 1.1 jruoho ACPI_FREE (ExternalPath);
568 1.1.1.3 christos return_VOID;
569 1.1.1.3 christos }
570 1.1.1.3 christos }
571 1.1.1.3 christos
572 1.1.1.3 christos /* Create the new External() declaration node */
573 1.1.1.3 christos
574 1.1.1.3 christos Status = AcpiDmCreateNewExternal (ExternalPath, InternalPath,
575 1.1.1.3 christos Type, Value, Flags);
576 1.1.1.3 christos if (ACPI_FAILURE (Status))
577 1.1.1.3 christos {
578 1.1.1.3 christos ACPI_FREE (ExternalPath);
579 1.1.1.3 christos if (Flags & ACPI_EXT_INTERNAL_PATH_ALLOCATED)
580 1.1.1.3 christos {
581 1.1.1.3 christos ACPI_FREE (InternalPath);
582 1.1 jruoho }
583 1.1 jruoho }
584 1.1 jruoho
585 1.1.1.3 christos return_VOID;
586 1.1.1.3 christos }
587 1.1.1.3 christos
588 1.1.1.3 christos
589 1.1.1.3 christos /*******************************************************************************
590 1.1.1.3 christos *
591 1.1.1.3 christos * FUNCTION: AcpiDmAddNodeToExternalList
592 1.1.1.3 christos *
593 1.1.1.3 christos * PARAMETERS: Node - Namespace node for object to be added
594 1.1.1.3 christos * Type - ACPI object type to be added
595 1.1.1.3 christos * Value - Arg count if adding a Method object
596 1.1.1.3 christos * Flags - To be passed to the external object
597 1.1.1.3 christos *
598 1.1.1.3 christos * RETURN: None
599 1.1.1.3 christos *
600 1.1.1.3 christos * DESCRIPTION: Insert a new name into the global list of Externals which
601 1.1.1.3 christos * will in turn be later emitted as an External() declaration
602 1.1.1.3 christos * in the disassembled output.
603 1.1.1.3 christos *
604 1.1.1.3 christos * This function handles the case where the referenced name has
605 1.1.1.3 christos * been found in the namespace, but the name originated in a
606 1.1.1.3 christos * table other than the one that is being disassembled (such
607 1.1.1.3 christos * as a table that is added via the iASL -e option).
608 1.1.1.3 christos *
609 1.1.1.3 christos ******************************************************************************/
610 1.1.1.3 christos
611 1.1.1.3 christos void
612 1.1.1.3 christos AcpiDmAddNodeToExternalList (
613 1.1.1.3 christos ACPI_NAMESPACE_NODE *Node,
614 1.1.1.3 christos UINT8 Type,
615 1.1.1.3 christos UINT32 Value,
616 1.1.1.3 christos UINT16 Flags)
617 1.1.1.3 christos {
618 1.1.1.3 christos char *ExternalPath;
619 1.1.1.3 christos char *InternalPath;
620 1.1.1.3 christos char *Temp;
621 1.1.1.3 christos ACPI_STATUS Status;
622 1.1.1.3 christos
623 1.1.1.3 christos
624 1.1.1.3 christos ACPI_FUNCTION_TRACE (DmAddNodeToExternalList);
625 1.1.1.3 christos
626 1.1.1.3 christos
627 1.1.1.3 christos if (!Node)
628 1.1.1.3 christos {
629 1.1.1.3 christos return_VOID;
630 1.1.1.3 christos }
631 1.1.1.3 christos
632 1.1.1.3 christos /* Get the full external and internal pathnames to the node */
633 1.1.1.3 christos
634 1.1.1.3 christos ExternalPath = AcpiNsGetExternalPathname (Node);
635 1.1.1.3 christos if (!ExternalPath)
636 1.1.1.3 christos {
637 1.1.1.3 christos return_VOID;
638 1.1.1.3 christos }
639 1.1.1.3 christos
640 1.1.1.3 christos Status = AcpiNsInternalizeName (ExternalPath, &InternalPath);
641 1.1.1.3 christos if (ACPI_FAILURE (Status))
642 1.1.1.3 christos {
643 1.1.1.3 christos ACPI_FREE (ExternalPath);
644 1.1.1.3 christos return_VOID;
645 1.1.1.3 christos }
646 1.1.1.3 christos
647 1.1.1.3 christos /* Remove the root backslash */
648 1.1.1.3 christos
649 1.1.1.3 christos if ((*ExternalPath == AML_ROOT_PREFIX) && (ExternalPath[1]))
650 1.1.1.3 christos {
651 1.1.1.3 christos Temp = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (ExternalPath) + 1);
652 1.1.1.3 christos if (!Temp)
653 1.1.1.3 christos {
654 1.1.1.3 christos return_VOID;
655 1.1.1.3 christos }
656 1.1.1.3 christos
657 1.1.1.3 christos ACPI_STRCPY (Temp, &ExternalPath[1]);
658 1.1.1.3 christos ACPI_FREE (ExternalPath);
659 1.1.1.3 christos ExternalPath = Temp;
660 1.1.1.3 christos }
661 1.1.1.3 christos
662 1.1.1.3 christos /* Create the new External() declaration node */
663 1.1.1.3 christos
664 1.1.1.3 christos Status = AcpiDmCreateNewExternal (ExternalPath, InternalPath, Type,
665 1.1.1.3 christos Value, (Flags | ACPI_EXT_INTERNAL_PATH_ALLOCATED));
666 1.1.1.3 christos if (ACPI_FAILURE (Status))
667 1.1.1.3 christos {
668 1.1.1.3 christos ACPI_FREE (ExternalPath);
669 1.1.1.3 christos ACPI_FREE (InternalPath);
670 1.1.1.3 christos }
671 1.1.1.3 christos
672 1.1.1.3 christos return_VOID;
673 1.1.1.3 christos }
674 1.1.1.3 christos
675 1.1.1.3 christos
676 1.1.1.3 christos /*******************************************************************************
677 1.1.1.3 christos *
678 1.1.1.3 christos * FUNCTION: AcpiDmAddPathToExternalList
679 1.1.1.3 christos *
680 1.1.1.3 christos * PARAMETERS: Path - External name of the object to be added
681 1.1.1.3 christos * Type - ACPI object type to be added
682 1.1.1.3 christos * Value - Arg count if adding a Method object
683 1.1.1.3 christos * Flags - To be passed to the external object
684 1.1.1.3 christos *
685 1.1.1.3 christos * RETURN: None
686 1.1.1.3 christos *
687 1.1.1.3 christos * DESCRIPTION: Insert a new name into the global list of Externals which
688 1.1.1.3 christos * will in turn be later emitted as an External() declaration
689 1.1.1.3 christos * in the disassembled output.
690 1.1.1.3 christos *
691 1.1.1.3 christos * This function currently is used to add externals via a
692 1.1.1.3 christos * reference file (via the -fe iASL option).
693 1.1.1.3 christos *
694 1.1.1.3 christos ******************************************************************************/
695 1.1.1.3 christos
696 1.1.1.3 christos static void
697 1.1.1.3 christos AcpiDmAddPathToExternalList (
698 1.1.1.3 christos char *Path,
699 1.1.1.3 christos UINT8 Type,
700 1.1.1.3 christos UINT32 Value,
701 1.1.1.3 christos UINT16 Flags)
702 1.1.1.3 christos {
703 1.1.1.3 christos char *InternalPath;
704 1.1.1.3 christos char *ExternalPath;
705 1.1.1.3 christos ACPI_STATUS Status;
706 1.1.1.3 christos
707 1.1.1.3 christos
708 1.1.1.3 christos ACPI_FUNCTION_TRACE (DmAddPathToExternalList);
709 1.1.1.3 christos
710 1.1.1.3 christos
711 1.1.1.3 christos if (!Path)
712 1.1.1.3 christos {
713 1.1.1.3 christos return_VOID;
714 1.1.1.3 christos }
715 1.1.1.3 christos
716 1.1.1.3 christos /* Remove a root backslash if present */
717 1.1.1.3 christos
718 1.1.1.3 christos if ((*Path == AML_ROOT_PREFIX) && (Path[1]))
719 1.1.1.3 christos {
720 1.1.1.3 christos Path++;
721 1.1.1.3 christos }
722 1.1.1.3 christos
723 1.1.1.3 christos /* Create the internal and external pathnames */
724 1.1.1.3 christos
725 1.1.1.3 christos Status = AcpiNsInternalizeName (Path, &InternalPath);
726 1.1.1.3 christos if (ACPI_FAILURE (Status))
727 1.1.1.3 christos {
728 1.1.1.3 christos return_VOID;
729 1.1.1.3 christos }
730 1.1.1.3 christos
731 1.1.1.3 christos Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalPath,
732 1.1.1.3 christos NULL, &ExternalPath);
733 1.1.1.3 christos if (ACPI_FAILURE (Status))
734 1.1.1.3 christos {
735 1.1.1.3 christos ACPI_FREE (InternalPath);
736 1.1.1.3 christos return_VOID;
737 1.1.1.3 christos }
738 1.1.1.3 christos
739 1.1.1.3 christos /* Create the new External() declaration node */
740 1.1.1.3 christos
741 1.1.1.3 christos Status = AcpiDmCreateNewExternal (ExternalPath, InternalPath,
742 1.1.1.3 christos Type, Value, (Flags | ACPI_EXT_INTERNAL_PATH_ALLOCATED));
743 1.1.1.3 christos if (ACPI_FAILURE (Status))
744 1.1.1.3 christos {
745 1.1.1.3 christos ACPI_FREE (ExternalPath);
746 1.1.1.3 christos ACPI_FREE (InternalPath);
747 1.1.1.3 christos }
748 1.1.1.3 christos
749 1.1.1.3 christos return_VOID;
750 1.1.1.3 christos }
751 1.1.1.3 christos
752 1.1.1.3 christos
753 1.1.1.3 christos /*******************************************************************************
754 1.1.1.3 christos *
755 1.1.1.3 christos * FUNCTION: AcpiDmCreateNewExternal
756 1.1.1.3 christos *
757 1.1.1.3 christos * PARAMETERS: ExternalPath - External path to the object
758 1.1.1.3 christos * InternalPath - Internal (AML) path to the object
759 1.1.1.3 christos * Type - ACPI object type to be added
760 1.1.1.3 christos * Value - Arg count if adding a Method object
761 1.1.1.3 christos * Flags - To be passed to the external object
762 1.1.1.3 christos *
763 1.1.1.3 christos * RETURN: Status
764 1.1.1.3 christos *
765 1.1.1.3 christos * DESCRIPTION: Common low-level function to insert a new name into the global
766 1.1.1.3 christos * list of Externals which will in turn be later emitted as
767 1.1.1.3 christos * External() declarations in the disassembled output.
768 1.1.1.3 christos *
769 1.1.1.3 christos * Note: The external name should not include a root prefix
770 1.1.1.3 christos * (backslash). We do not want External() statements to contain
771 1.1.1.3 christos * a leading '\', as this prevents duplicate external statements
772 1.1.1.3 christos * of the form:
773 1.1.1.3 christos *
774 1.1.1.3 christos * External (\ABCD)
775 1.1.1.3 christos * External (ABCD)
776 1.1.1.3 christos *
777 1.1.1.3 christos * This would cause a compile time error when the disassembled
778 1.1.1.3 christos * output file is recompiled.
779 1.1.1.3 christos *
780 1.1.1.3 christos * There are two cases that are handled here. For both, we emit
781 1.1.1.3 christos * an External() statement:
782 1.1.1.3 christos * 1) The name was simply not found in the namespace.
783 1.1.1.3 christos * 2) The name was found, but it originated in a table other than
784 1.1.1.3 christos * the table that is being disassembled.
785 1.1.1.3 christos *
786 1.1.1.3 christos ******************************************************************************/
787 1.1.1.3 christos
788 1.1.1.3 christos static ACPI_STATUS
789 1.1.1.3 christos AcpiDmCreateNewExternal (
790 1.1.1.3 christos char *ExternalPath,
791 1.1.1.3 christos char *InternalPath,
792 1.1.1.3 christos UINT8 Type,
793 1.1.1.3 christos UINT32 Value,
794 1.1.1.3 christos UINT16 Flags)
795 1.1.1.3 christos {
796 1.1.1.3 christos ACPI_EXTERNAL_LIST *NewExternal;
797 1.1.1.3 christos ACPI_EXTERNAL_LIST *NextExternal;
798 1.1.1.3 christos ACPI_EXTERNAL_LIST *PrevExternal = NULL;
799 1.1.1.3 christos
800 1.1.1.3 christos
801 1.1.1.3 christos ACPI_FUNCTION_TRACE (DmCreateNewExternal);
802 1.1.1.3 christos
803 1.1.1.3 christos
804 1.1 jruoho /* Check all existing externals to ensure no duplicates */
805 1.1 jruoho
806 1.1 jruoho NextExternal = AcpiGbl_ExternalList;
807 1.1 jruoho while (NextExternal)
808 1.1 jruoho {
809 1.1 jruoho if (!ACPI_STRCMP (ExternalPath, NextExternal->Path))
810 1.1 jruoho {
811 1.1 jruoho /* Duplicate method, check that the Value (ArgCount) is the same */
812 1.1 jruoho
813 1.1 jruoho if ((NextExternal->Type == ACPI_TYPE_METHOD) &&
814 1.1.1.4 christos (NextExternal->Value != Value) &&
815 1.1.1.4 christos (Value > 0))
816 1.1 jruoho {
817 1.1 jruoho ACPI_ERROR ((AE_INFO,
818 1.1.1.3 christos "External method arg count mismatch %s: Current %u, attempted %u",
819 1.1 jruoho NextExternal->Path, NextExternal->Value, Value));
820 1.1 jruoho }
821 1.1 jruoho
822 1.1 jruoho /* Allow upgrade of type from ANY */
823 1.1 jruoho
824 1.1 jruoho else if (NextExternal->Type == ACPI_TYPE_ANY)
825 1.1 jruoho {
826 1.1 jruoho NextExternal->Type = Type;
827 1.1 jruoho NextExternal->Value = Value;
828 1.1 jruoho }
829 1.1 jruoho
830 1.1.1.3 christos return_ACPI_STATUS (AE_ALREADY_EXISTS);
831 1.1 jruoho }
832 1.1 jruoho
833 1.1 jruoho NextExternal = NextExternal->Next;
834 1.1 jruoho }
835 1.1 jruoho
836 1.1 jruoho /* Allocate and init a new External() descriptor */
837 1.1 jruoho
838 1.1 jruoho NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST));
839 1.1 jruoho if (!NewExternal)
840 1.1 jruoho {
841 1.1.1.3 christos return_ACPI_STATUS (AE_NO_MEMORY);
842 1.1 jruoho }
843 1.1 jruoho
844 1.1.1.3 christos ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
845 1.1.1.3 christos "Adding external reference node (%s) type [%s]\n",
846 1.1.1.3 christos ExternalPath, AcpiUtGetTypeName (Type)));
847 1.1.1.3 christos
848 1.1.1.3 christos NewExternal->Flags = Flags;
849 1.1.1.3 christos NewExternal->Value = Value;
850 1.1 jruoho NewExternal->Path = ExternalPath;
851 1.1 jruoho NewExternal->Type = Type;
852 1.1 jruoho NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath);
853 1.1.1.3 christos NewExternal->InternalPath = InternalPath;
854 1.1 jruoho
855 1.1.1.3 christos /* Link the new descriptor into the global list, alphabetically ordered */
856 1.1 jruoho
857 1.1 jruoho NextExternal = AcpiGbl_ExternalList;
858 1.1 jruoho while (NextExternal)
859 1.1 jruoho {
860 1.1.1.3 christos if (AcpiUtStricmp (NewExternal->Path, NextExternal->Path) < 0)
861 1.1 jruoho {
862 1.1 jruoho if (PrevExternal)
863 1.1 jruoho {
864 1.1 jruoho PrevExternal->Next = NewExternal;
865 1.1 jruoho }
866 1.1 jruoho else
867 1.1 jruoho {
868 1.1 jruoho AcpiGbl_ExternalList = NewExternal;
869 1.1 jruoho }
870 1.1 jruoho
871 1.1 jruoho NewExternal->Next = NextExternal;
872 1.1.1.3 christos return_ACPI_STATUS (AE_OK);
873 1.1 jruoho }
874 1.1 jruoho
875 1.1 jruoho PrevExternal = NextExternal;
876 1.1 jruoho NextExternal = NextExternal->Next;
877 1.1 jruoho }
878 1.1 jruoho
879 1.1 jruoho if (PrevExternal)
880 1.1 jruoho {
881 1.1 jruoho PrevExternal->Next = NewExternal;
882 1.1 jruoho }
883 1.1 jruoho else
884 1.1 jruoho {
885 1.1 jruoho AcpiGbl_ExternalList = NewExternal;
886 1.1 jruoho }
887 1.1.1.3 christos
888 1.1.1.3 christos return_ACPI_STATUS (AE_OK);
889 1.1 jruoho }
890 1.1 jruoho
891 1.1 jruoho
892 1.1 jruoho /*******************************************************************************
893 1.1 jruoho *
894 1.1 jruoho * FUNCTION: AcpiDmAddExternalsToNamespace
895 1.1 jruoho *
896 1.1 jruoho * PARAMETERS: None
897 1.1 jruoho *
898 1.1 jruoho * RETURN: None
899 1.1 jruoho *
900 1.1 jruoho * DESCRIPTION: Add all externals to the namespace. Allows externals to be
901 1.1 jruoho * "resolved".
902 1.1 jruoho *
903 1.1 jruoho ******************************************************************************/
904 1.1 jruoho
905 1.1 jruoho void
906 1.1 jruoho AcpiDmAddExternalsToNamespace (
907 1.1 jruoho void)
908 1.1 jruoho {
909 1.1 jruoho ACPI_STATUS Status;
910 1.1 jruoho ACPI_NAMESPACE_NODE *Node;
911 1.1.1.3 christos ACPI_OPERAND_OBJECT *ObjDesc;
912 1.1 jruoho ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList;
913 1.1 jruoho
914 1.1 jruoho
915 1.1 jruoho while (External)
916 1.1 jruoho {
917 1.1 jruoho /* Add the external name (object) into the namespace */
918 1.1 jruoho
919 1.1 jruoho Status = AcpiNsLookup (NULL, External->InternalPath, External->Type,
920 1.1 jruoho ACPI_IMODE_LOAD_PASS1,
921 1.1.1.3 christos ACPI_NS_ERROR_IF_FOUND | ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
922 1.1 jruoho NULL, &Node);
923 1.1 jruoho
924 1.1 jruoho if (ACPI_FAILURE (Status))
925 1.1 jruoho {
926 1.1 jruoho ACPI_EXCEPTION ((AE_INFO, Status,
927 1.1 jruoho "while adding external to namespace [%s]",
928 1.1 jruoho External->Path));
929 1.1 jruoho }
930 1.1.1.3 christos
931 1.1.1.3 christos else switch (External->Type)
932 1.1 jruoho {
933 1.1.1.3 christos case ACPI_TYPE_METHOD:
934 1.1.1.3 christos
935 1.1 jruoho /* For methods, we need to save the argument count */
936 1.1 jruoho
937 1.1.1.3 christos ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD);
938 1.1.1.3 christos ObjDesc->Method.ParamCount = (UINT8) External->Value;
939 1.1.1.3 christos Node->Object = ObjDesc;
940 1.1.1.3 christos break;
941 1.1.1.3 christos
942 1.1.1.3 christos case ACPI_TYPE_REGION:
943 1.1.1.3 christos
944 1.1.1.3 christos /* Regions require a region sub-object */
945 1.1.1.3 christos
946 1.1.1.3 christos ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION);
947 1.1.1.3 christos ObjDesc->Region.Node = Node;
948 1.1.1.3 christos Node->Object = ObjDesc;
949 1.1.1.3 christos break;
950 1.1.1.3 christos
951 1.1.1.3 christos default:
952 1.1.1.3 christos
953 1.1.1.3 christos break;
954 1.1 jruoho }
955 1.1 jruoho
956 1.1 jruoho External = External->Next;
957 1.1 jruoho }
958 1.1 jruoho }
959 1.1 jruoho
960 1.1 jruoho
961 1.1 jruoho /*******************************************************************************
962 1.1 jruoho *
963 1.1 jruoho * FUNCTION: AcpiDmGetExternalMethodCount
964 1.1 jruoho *
965 1.1 jruoho * PARAMETERS: None
966 1.1 jruoho *
967 1.1 jruoho * RETURN: The number of control method externals in the external list
968 1.1 jruoho *
969 1.1 jruoho * DESCRIPTION: Return the number of method externals that have been generated.
970 1.1 jruoho * If any control method externals have been found, we must
971 1.1 jruoho * re-parse the entire definition block with the new information
972 1.1 jruoho * (number of arguments for the methods.) This is limitation of
973 1.1 jruoho * AML, we don't know the number of arguments from the control
974 1.1 jruoho * method invocation itself.
975 1.1 jruoho *
976 1.1 jruoho ******************************************************************************/
977 1.1 jruoho
978 1.1 jruoho UINT32
979 1.1 jruoho AcpiDmGetExternalMethodCount (
980 1.1 jruoho void)
981 1.1 jruoho {
982 1.1 jruoho ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList;
983 1.1 jruoho UINT32 Count = 0;
984 1.1 jruoho
985 1.1 jruoho
986 1.1 jruoho while (External)
987 1.1 jruoho {
988 1.1 jruoho if (External->Type == ACPI_TYPE_METHOD)
989 1.1 jruoho {
990 1.1 jruoho Count++;
991 1.1 jruoho }
992 1.1 jruoho
993 1.1 jruoho External = External->Next;
994 1.1 jruoho }
995 1.1 jruoho
996 1.1 jruoho return (Count);
997 1.1 jruoho }
998 1.1 jruoho
999 1.1 jruoho
1000 1.1 jruoho /*******************************************************************************
1001 1.1 jruoho *
1002 1.1 jruoho * FUNCTION: AcpiDmClearExternalList
1003 1.1 jruoho *
1004 1.1 jruoho * PARAMETERS: None
1005 1.1 jruoho *
1006 1.1 jruoho * RETURN: None
1007 1.1 jruoho *
1008 1.1 jruoho * DESCRIPTION: Free the entire External info list
1009 1.1 jruoho *
1010 1.1 jruoho ******************************************************************************/
1011 1.1 jruoho
1012 1.1 jruoho void
1013 1.1 jruoho AcpiDmClearExternalList (
1014 1.1 jruoho void)
1015 1.1 jruoho {
1016 1.1 jruoho ACPI_EXTERNAL_LIST *NextExternal;
1017 1.1 jruoho
1018 1.1 jruoho
1019 1.1 jruoho while (AcpiGbl_ExternalList)
1020 1.1 jruoho {
1021 1.1 jruoho NextExternal = AcpiGbl_ExternalList->Next;
1022 1.1 jruoho ACPI_FREE (AcpiGbl_ExternalList->Path);
1023 1.1 jruoho ACPI_FREE (AcpiGbl_ExternalList);
1024 1.1 jruoho AcpiGbl_ExternalList = NextExternal;
1025 1.1 jruoho }
1026 1.1 jruoho }
1027 1.1 jruoho
1028 1.1 jruoho
1029 1.1 jruoho /*******************************************************************************
1030 1.1 jruoho *
1031 1.1 jruoho * FUNCTION: AcpiDmEmitExternals
1032 1.1 jruoho *
1033 1.1 jruoho * PARAMETERS: None
1034 1.1 jruoho *
1035 1.1 jruoho * RETURN: None
1036 1.1 jruoho *
1037 1.1 jruoho * DESCRIPTION: Emit an External() ASL statement for each of the externals in
1038 1.1 jruoho * the global external info list.
1039 1.1 jruoho *
1040 1.1 jruoho ******************************************************************************/
1041 1.1 jruoho
1042 1.1 jruoho void
1043 1.1 jruoho AcpiDmEmitExternals (
1044 1.1 jruoho void)
1045 1.1 jruoho {
1046 1.1 jruoho ACPI_EXTERNAL_LIST *NextExternal;
1047 1.1 jruoho
1048 1.1 jruoho
1049 1.1 jruoho if (!AcpiGbl_ExternalList)
1050 1.1 jruoho {
1051 1.1 jruoho return;
1052 1.1 jruoho }
1053 1.1 jruoho
1054 1.1 jruoho /*
1055 1.1.1.3 christos * Determine the number of control methods in the external list, and
1056 1.1.1.3 christos * also how many of those externals were resolved via the namespace.
1057 1.1 jruoho */
1058 1.1.1.3 christos NextExternal = AcpiGbl_ExternalList;
1059 1.1.1.3 christos while (NextExternal)
1060 1.1 jruoho {
1061 1.1.1.3 christos if (NextExternal->Type == ACPI_TYPE_METHOD)
1062 1.1.1.3 christos {
1063 1.1.1.3 christos AcpiGbl_NumExternalMethods++;
1064 1.1.1.3 christos if (NextExternal->Flags & ACPI_EXT_RESOLVED_REFERENCE)
1065 1.1.1.3 christos {
1066 1.1.1.3 christos AcpiGbl_ResolvedExternalMethods++;
1067 1.1.1.3 christos }
1068 1.1.1.3 christos }
1069 1.1.1.3 christos
1070 1.1.1.3 christos NextExternal = NextExternal->Next;
1071 1.1.1.3 christos }
1072 1.1 jruoho
1073 1.1.1.3 christos /* Check if any control methods were unresolved */
1074 1.1.1.3 christos
1075 1.1.1.3 christos AcpiDmUnresolvedWarning (1);
1076 1.1.1.3 christos
1077 1.1.1.3 christos /* Emit any unresolved method externals in a single text block */
1078 1.1.1.3 christos
1079 1.1.1.3 christos NextExternal = AcpiGbl_ExternalList;
1080 1.1.1.3 christos while (NextExternal)
1081 1.1.1.3 christos {
1082 1.1.1.3 christos if ((NextExternal->Type == ACPI_TYPE_METHOD) &&
1083 1.1.1.3 christos (!(NextExternal->Flags & ACPI_EXT_RESOLVED_REFERENCE)))
1084 1.1 jruoho {
1085 1.1.1.3 christos AcpiOsPrintf (" External (%s%s",
1086 1.1.1.3 christos NextExternal->Path,
1087 1.1.1.3 christos AcpiDmGetObjectTypeName (NextExternal->Type));
1088 1.1.1.3 christos
1089 1.1.1.4 christos AcpiOsPrintf (") // Warning: Unresolved method, "
1090 1.1.1.4 christos "guessing %u arguments\n",
1091 1.1.1.3 christos NextExternal->Value);
1092 1.1.1.3 christos
1093 1.1.1.3 christos NextExternal->Flags |= ACPI_EXT_EXTERNAL_EMITTED;
1094 1.1 jruoho }
1095 1.1.1.3 christos
1096 1.1.1.3 christos NextExternal = NextExternal->Next;
1097 1.1.1.3 christos }
1098 1.1.1.3 christos
1099 1.1.1.3 christos AcpiOsPrintf ("\n");
1100 1.1.1.3 christos
1101 1.1.1.3 christos
1102 1.1.1.3 christos /* Emit externals that were imported from a file */
1103 1.1.1.3 christos
1104 1.1.1.3 christos if (Gbl_ExternalRefFilename)
1105 1.1.1.3 christos {
1106 1.1.1.3 christos AcpiOsPrintf (
1107 1.1.1.3 christos " /*\n * External declarations that were imported from\n"
1108 1.1.1.3 christos " * the reference file [%s]\n */\n",
1109 1.1.1.3 christos Gbl_ExternalRefFilename);
1110 1.1.1.3 christos
1111 1.1.1.3 christos NextExternal = AcpiGbl_ExternalList;
1112 1.1.1.3 christos while (NextExternal)
1113 1.1 jruoho {
1114 1.1.1.3 christos if (!(NextExternal->Flags & ACPI_EXT_EXTERNAL_EMITTED) &&
1115 1.1.1.3 christos (NextExternal->Flags & ACPI_EXT_ORIGIN_FROM_FILE))
1116 1.1.1.3 christos {
1117 1.1.1.3 christos AcpiOsPrintf (" External (%s%s",
1118 1.1.1.3 christos NextExternal->Path,
1119 1.1.1.3 christos AcpiDmGetObjectTypeName (NextExternal->Type));
1120 1.1.1.3 christos
1121 1.1.1.3 christos if (NextExternal->Type == ACPI_TYPE_METHOD)
1122 1.1.1.3 christos {
1123 1.1.1.3 christos AcpiOsPrintf (") // %u Arguments\n",
1124 1.1.1.3 christos NextExternal->Value);
1125 1.1.1.3 christos }
1126 1.1.1.3 christos else
1127 1.1.1.3 christos {
1128 1.1.1.3 christos AcpiOsPrintf (")\n");
1129 1.1.1.3 christos }
1130 1.1.1.3 christos NextExternal->Flags |= ACPI_EXT_EXTERNAL_EMITTED;
1131 1.1.1.3 christos }
1132 1.1.1.3 christos
1133 1.1.1.3 christos NextExternal = NextExternal->Next;
1134 1.1.1.3 christos }
1135 1.1.1.3 christos
1136 1.1.1.3 christos AcpiOsPrintf ("\n");
1137 1.1.1.3 christos }
1138 1.1.1.3 christos
1139 1.1.1.3 christos /*
1140 1.1.1.3 christos * Walk the list of externals found during the AML parsing
1141 1.1.1.3 christos */
1142 1.1.1.3 christos while (AcpiGbl_ExternalList)
1143 1.1.1.3 christos {
1144 1.1.1.3 christos if (!(AcpiGbl_ExternalList->Flags & ACPI_EXT_EXTERNAL_EMITTED))
1145 1.1.1.3 christos {
1146 1.1.1.3 christos AcpiOsPrintf (" External (%s%s",
1147 1.1.1.3 christos AcpiGbl_ExternalList->Path,
1148 1.1.1.3 christos AcpiDmGetObjectTypeName (AcpiGbl_ExternalList->Type));
1149 1.1.1.3 christos
1150 1.1.1.3 christos /* For methods, add a comment with the number of arguments */
1151 1.1.1.3 christos
1152 1.1.1.3 christos if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD)
1153 1.1.1.3 christos {
1154 1.1.1.3 christos AcpiOsPrintf (") // %u Arguments\n",
1155 1.1.1.3 christos AcpiGbl_ExternalList->Value);
1156 1.1.1.3 christos }
1157 1.1.1.3 christos else
1158 1.1.1.3 christos {
1159 1.1.1.3 christos AcpiOsPrintf (")\n");
1160 1.1.1.3 christos }
1161 1.1 jruoho }
1162 1.1 jruoho
1163 1.1 jruoho /* Free this external info block and move on to next external */
1164 1.1 jruoho
1165 1.1 jruoho NextExternal = AcpiGbl_ExternalList->Next;
1166 1.1.1.3 christos if (AcpiGbl_ExternalList->Flags & ACPI_EXT_INTERNAL_PATH_ALLOCATED)
1167 1.1 jruoho {
1168 1.1 jruoho ACPI_FREE (AcpiGbl_ExternalList->InternalPath);
1169 1.1 jruoho }
1170 1.1 jruoho
1171 1.1 jruoho ACPI_FREE (AcpiGbl_ExternalList->Path);
1172 1.1 jruoho ACPI_FREE (AcpiGbl_ExternalList);
1173 1.1 jruoho AcpiGbl_ExternalList = NextExternal;
1174 1.1 jruoho }
1175 1.1 jruoho
1176 1.1 jruoho AcpiOsPrintf ("\n");
1177 1.1 jruoho }
1178 1.1 jruoho
1179 1.1.1.3 christos
1180 1.1.1.3 christos /*******************************************************************************
1181 1.1.1.3 christos *
1182 1.1.1.3 christos * FUNCTION: AcpiDmUnresolvedWarning
1183 1.1.1.3 christos *
1184 1.1.1.3 christos * PARAMETERS: Type - Where to output the warning.
1185 1.1.1.3 christos * 0 means write to stderr
1186 1.1.1.3 christos * 1 means write to AcpiOsPrintf
1187 1.1.1.3 christos *
1188 1.1.1.3 christos * RETURN: None
1189 1.1.1.3 christos *
1190 1.1.1.3 christos * DESCRIPTION: Issue warning message if there are unresolved external control
1191 1.1.1.3 christos * methods within the disassembly.
1192 1.1.1.3 christos *
1193 1.1.1.3 christos ******************************************************************************/
1194 1.1.1.3 christos
1195 1.1.1.3 christos #if 0
1196 1.1.1.3 christos Summary of the external control method problem:
1197 1.1.1.3 christos
1198 1.1.1.3 christos When the -e option is used with disassembly, the various SSDTs are simply
1199 1.1.1.3 christos loaded into a global namespace for the disassembler to use in order to
1200 1.1.1.3 christos resolve control method references (invocations).
1201 1.1.1.3 christos
1202 1.1.1.3 christos The disassembler tracks any such references, and will emit an External()
1203 1.1.1.3 christos statement for these types of methods, with the proper number of arguments .
1204 1.1.1.3 christos
1205 1.1.1.3 christos Without the SSDTs, the AML does not contain enough information to properly
1206 1.1.1.3 christos disassemble the control method invocation -- because the disassembler does
1207 1.1.1.3 christos not know how many arguments to parse.
1208 1.1.1.3 christos
1209 1.1.1.3 christos An example: Assume we have two control methods. ABCD has one argument, and
1210 1.1.1.3 christos EFGH has zero arguments. Further, we have two additional control methods
1211 1.1.1.3 christos that invoke ABCD and EFGH, named T1 and T2:
1212 1.1.1.3 christos
1213 1.1.1.3 christos Method (ABCD, 1)
1214 1.1.1.3 christos {
1215 1.1.1.3 christos }
1216 1.1.1.3 christos Method (EFGH, 0)
1217 1.1.1.3 christos {
1218 1.1.1.3 christos }
1219 1.1.1.3 christos Method (T1)
1220 1.1.1.3 christos {
1221 1.1.1.3 christos ABCD (Add (2, 7, Local0))
1222 1.1.1.3 christos }
1223 1.1.1.3 christos Method (T2)
1224 1.1.1.3 christos {
1225 1.1.1.3 christos EFGH ()
1226 1.1.1.3 christos Add (2, 7, Local0)
1227 1.1.1.3 christos }
1228 1.1.1.3 christos
1229 1.1.1.3 christos Here is the AML code that is generated for T1 and T2:
1230 1.1.1.3 christos
1231 1.1.1.3 christos 185: Method (T1)
1232 1.1.1.3 christos
1233 1.1.1.3 christos 0000034C: 14 10 54 31 5F 5F 00 ... "..T1__."
1234 1.1.1.3 christos
1235 1.1.1.3 christos 186: {
1236 1.1.1.3 christos 187: ABCD (Add (2, 7, Local0))
1237 1.1.1.3 christos
1238 1.1.1.3 christos 00000353: 41 42 43 44 ............ "ABCD"
1239 1.1.1.3 christos 00000357: 72 0A 02 0A 07 60 ...... "r....`"
1240 1.1.1.3 christos
1241 1.1.1.3 christos 188: }
1242 1.1.1.3 christos
1243 1.1.1.3 christos 190: Method (T2)
1244 1.1.1.3 christos
1245 1.1.1.3 christos 0000035D: 14 10 54 32 5F 5F 00 ... "..T2__."
1246 1.1.1.3 christos
1247 1.1.1.3 christos 191: {
1248 1.1.1.3 christos 192: EFGH ()
1249 1.1.1.3 christos
1250 1.1.1.3 christos 00000364: 45 46 47 48 ............ "EFGH"
1251 1.1.1.3 christos
1252 1.1.1.3 christos 193: Add (2, 7, Local0)
1253 1.1.1.3 christos
1254 1.1.1.3 christos 00000368: 72 0A 02 0A 07 60 ...... "r....`"
1255 1.1.1.3 christos 194: }
1256 1.1.1.3 christos
1257 1.1.1.3 christos Note that the AML code for T1 and T2 is essentially identical. When
1258 1.1.1.3 christos disassembling this code, the methods ABCD and EFGH must be known to the
1259 1.1.1.3 christos disassembler, otherwise it does not know how to handle the method invocations.
1260 1.1.1.3 christos
1261 1.1.1.3 christos In other words, if ABCD and EFGH are actually external control methods
1262 1.1.1.3 christos appearing in an SSDT, the disassembler does not know what to do unless
1263 1.1.1.3 christos the owning SSDT has been loaded via the -e option.
1264 1.1.1.3 christos #endif
1265 1.1.1.3 christos
1266 1.1.1.3 christos void
1267 1.1.1.3 christos AcpiDmUnresolvedWarning (
1268 1.1.1.3 christos UINT8 Type)
1269 1.1.1.3 christos {
1270 1.1.1.3 christos
1271 1.1.1.3 christos if (!AcpiGbl_NumExternalMethods)
1272 1.1.1.3 christos {
1273 1.1.1.3 christos return;
1274 1.1.1.3 christos }
1275 1.1.1.3 christos
1276 1.1.1.3 christos if (Type)
1277 1.1.1.3 christos {
1278 1.1.1.3 christos if (!AcpiGbl_ExternalFileList)
1279 1.1.1.3 christos {
1280 1.1.1.3 christos /* The -e option was not specified */
1281 1.1.1.3 christos
1282 1.1.1.3 christos AcpiOsPrintf (" /*\n"
1283 1.1.1.3 christos " * iASL Warning: There were %u external control methods found during\n"
1284 1.1.1.3 christos " * disassembly, but additional ACPI tables to resolve these externals\n"
1285 1.1.1.3 christos " * were not specified. This resulting disassembler output file may not\n"
1286 1.1.1.3 christos " * compile because the disassembler did not know how many arguments\n"
1287 1.1.1.3 christos " * to assign to these methods. To specify the tables needed to resolve\n"
1288 1.1.1.4 christos " * external control method references, the -e option can be used to\n"
1289 1.1.1.4 christos " * specify the filenames. Example iASL invocations:\n"
1290 1.1.1.4 christos " * iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n"
1291 1.1.1.4 christos " * iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n"
1292 1.1.1.4 christos " * iasl -e ssdt*.aml -d dsdt.aml\n"
1293 1.1.1.4 christos " *\n"
1294 1.1.1.4 christos " * In addition, the -fe option can be used to specify a file containing\n"
1295 1.1.1.4 christos " * control method external declarations with the associated method\n"
1296 1.1.1.4 christos " * argument counts. Each line of the file must be of the form:\n"
1297 1.1.1.4 christos " * External (<method pathname>, MethodObj, <argument count>)\n"
1298 1.1.1.4 christos " * Invocation:\n"
1299 1.1.1.4 christos " * iasl -fe refs.txt -d dsdt.aml\n"
1300 1.1.1.4 christos " *\n"
1301 1.1.1.4 christos " * The following methods were unresolved and many not compile properly\n"
1302 1.1.1.4 christos " * because the disassembler had to guess at the number of arguments\n"
1303 1.1.1.4 christos " * required for each:\n"
1304 1.1.1.3 christos " */\n",
1305 1.1.1.4 christos AcpiGbl_NumExternalMethods);
1306 1.1.1.3 christos }
1307 1.1.1.3 christos else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods)
1308 1.1.1.3 christos {
1309 1.1.1.3 christos /* The -e option was specified, but there are still some unresolved externals */
1310 1.1.1.3 christos
1311 1.1.1.3 christos AcpiOsPrintf (" /*\n"
1312 1.1.1.3 christos " * iASL Warning: There were %u external control methods found during\n"
1313 1.1.1.3 christos " * disassembly, but only %u %s resolved (%u unresolved). Additional\n"
1314 1.1.1.4 christos " * ACPI tables may be required to properly disassemble the code. This\n"
1315 1.1.1.3 christos " * resulting disassembler output file may not compile because the\n"
1316 1.1.1.3 christos " * disassembler did not know how many arguments to assign to the\n"
1317 1.1.1.3 christos " * unresolved methods.\n"
1318 1.1.1.4 christos " *\n"
1319 1.1.1.4 christos " * If necessary, the -fe option can be used to specify a file containing\n"
1320 1.1.1.4 christos " * control method external declarations with the associated method\n"
1321 1.1.1.4 christos " * argument counts. Each line of the file must be of the form:\n"
1322 1.1.1.4 christos " * External (<method pathname>, MethodObj, <argument count>)\n"
1323 1.1.1.4 christos " * Invocation:\n"
1324 1.1.1.4 christos " * iasl -fe refs.txt -d dsdt.aml\n"
1325 1.1.1.4 christos " *\n"
1326 1.1.1.4 christos " * The following methods were unresolved and many not compile properly\n"
1327 1.1.1.4 christos " * because the disassembler had to guess at the number of arguments\n"
1328 1.1.1.4 christos " * required for each:\n"
1329 1.1.1.3 christos " */\n",
1330 1.1.1.3 christos AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods,
1331 1.1.1.3 christos (AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"),
1332 1.1.1.3 christos (AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods));
1333 1.1.1.3 christos }
1334 1.1.1.3 christos }
1335 1.1.1.3 christos else
1336 1.1.1.3 christos {
1337 1.1.1.3 christos if (!AcpiGbl_ExternalFileList)
1338 1.1.1.3 christos {
1339 1.1.1.3 christos /* The -e option was not specified */
1340 1.1.1.3 christos
1341 1.1.1.3 christos fprintf (stderr, "\n"
1342 1.1.1.3 christos "iASL Warning: There were %u external control methods found during\n"
1343 1.1.1.3 christos "disassembly, but additional ACPI tables to resolve these externals\n"
1344 1.1.1.3 christos "were not specified. The resulting disassembler output file may not\n"
1345 1.1.1.3 christos "compile because the disassembler did not know how many arguments\n"
1346 1.1.1.3 christos "to assign to these methods. To specify the tables needed to resolve\n"
1347 1.1.1.4 christos "external control method references, the -e option can be used to\n"
1348 1.1.1.4 christos "specify the filenames. Example iASL invocations:\n"
1349 1.1.1.4 christos " iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n"
1350 1.1.1.4 christos " iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n"
1351 1.1.1.4 christos " iasl -e ssdt*.aml -d dsdt.aml\n"
1352 1.1.1.4 christos "\n"
1353 1.1.1.4 christos "In addition, the -fe option can be used to specify a file containing\n"
1354 1.1.1.4 christos "control method external declarations with the associated method\n"
1355 1.1.1.4 christos "argument counts. Each line of the file must be of the form:\n"
1356 1.1.1.4 christos " External (<method pathname>, MethodObj, <argument count>)\n"
1357 1.1.1.4 christos "Invocation:\n"
1358 1.1.1.4 christos " iasl -fe refs.txt -d dsdt.aml\n",
1359 1.1.1.3 christos AcpiGbl_NumExternalMethods);
1360 1.1.1.3 christos }
1361 1.1.1.3 christos else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods)
1362 1.1.1.3 christos {
1363 1.1.1.3 christos /* The -e option was specified, but there are still some unresolved externals */
1364 1.1.1.3 christos
1365 1.1.1.3 christos fprintf (stderr, "\n"
1366 1.1.1.3 christos "iASL Warning: There were %u external control methods found during\n"
1367 1.1.1.3 christos "disassembly, but only %u %s resolved (%u unresolved). Additional\n"
1368 1.1.1.4 christos "ACPI tables may be required to properly disassemble the code. The\n"
1369 1.1.1.3 christos "resulting disassembler output file may not compile because the\n"
1370 1.1.1.3 christos "disassembler did not know how many arguments to assign to the\n"
1371 1.1.1.4 christos "unresolved methods.\n"
1372 1.1.1.4 christos "\n"
1373 1.1.1.4 christos "If necessary, the -fe option can be used to specify a file containing\n"
1374 1.1.1.4 christos "control method external declarations with the associated method\n"
1375 1.1.1.4 christos "argument counts. Each line of the file must be of the form:\n"
1376 1.1.1.4 christos " External (<method pathname>, MethodObj, <argument count>)\n"
1377 1.1.1.4 christos "Invocation:\n"
1378 1.1.1.4 christos " iasl -fe refs.txt -d dsdt.aml\n",
1379 1.1.1.3 christos AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods,
1380 1.1.1.3 christos (AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"),
1381 1.1.1.3 christos (AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods));
1382 1.1.1.3 christos }
1383 1.1.1.3 christos }
1384 1.1.1.3 christos }
1385