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