Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1498 | serge | 1 | |
2 | * |
||
3 | * Module Name: aslopcode - AML opcode generation |
||
4 | * |
||
5 | *****************************************************************************/ |
||
6 | |||
7 | |||
8 | * |
||
9 | * 1. Copyright Notice |
||
10 | * |
||
11 | * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. |
||
12 | * All rights reserved. |
||
13 | * |
||
14 | * 2. License |
||
15 | * |
||
16 | * 2.1. This is your license from Intel Corp. under its intellectual property |
||
17 | * rights. You may have additional license terms from the party that provided |
||
18 | * you this software, covering your right to use that party's intellectual |
||
19 | * property rights. |
||
20 | * |
||
21 | * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a |
||
22 | * copy of the source code appearing in this file ("Covered Code") an |
||
23 | * irrevocable, perpetual, worldwide license under Intel's copyrights in the |
||
24 | * base code distributed originally by Intel ("Original Intel Code") to copy, |
||
25 | * make derivatives, distribute, use and display any portion of the Covered |
||
26 | * Code in any form, with the right to sublicense such rights; and |
||
27 | * |
||
28 | * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent |
||
29 | * license (with the right to sublicense), under only those claims of Intel |
||
30 | * patents that are infringed by the Original Intel Code, to make, use, sell, |
||
31 | * offer to sell, and import the Covered Code and derivative works thereof |
||
32 | * solely to the minimum extent necessary to exercise the above copyright |
||
33 | * license, and in no event shall the patent license extend to any additions |
||
34 | * to or modifications of the Original Intel Code. No other license or right |
||
35 | * is granted directly or by implication, estoppel or otherwise; |
||
36 | * |
||
37 | * The above copyright and patent license is granted only if the following |
||
38 | * conditions are met: |
||
39 | * |
||
40 | * 3. Conditions |
||
41 | * |
||
42 | * 3.1. Redistribution of Source with Rights to Further Distribute Source. |
||
43 | * Redistribution of source code of any substantial portion of the Covered |
||
44 | * Code or modification with rights to further distribute source must include |
||
45 | * the above Copyright Notice, the above License, this list of Conditions, |
||
46 | * and the following Disclaimer and Export Compliance provision. In addition, |
||
47 | * Licensee must cause all Covered Code to which Licensee contributes to |
||
48 | * contain a file documenting the changes Licensee made to create that Covered |
||
49 | * Code and the date of any change. Licensee must include in that file the |
||
50 | * documentation of any changes made by any predecessor Licensee. Licensee |
||
51 | * must include a prominent statement that the modification is derived, |
||
52 | * directly or indirectly, from Original Intel Code. |
||
53 | * |
||
54 | * 3.2. Redistribution of Source with no Rights to Further Distribute Source. |
||
55 | * Redistribution of source code of any substantial portion of the Covered |
||
56 | * Code or modification without rights to further distribute source must |
||
57 | * include the following Disclaimer and Export Compliance provision in the |
||
58 | * documentation and/or other materials provided with distribution. In |
||
59 | * addition, Licensee may not authorize further sublicense of source of any |
||
60 | * portion of the Covered Code, and must include terms to the effect that the |
||
61 | * license from Licensee to its licensee is limited to the intellectual |
||
62 | * property embodied in the software Licensee provides to its licensee, and |
||
63 | * not to intellectual property embodied in modifications its licensee may |
||
64 | * make. |
||
65 | * |
||
66 | * 3.3. Redistribution of Executable. Redistribution in executable form of any |
||
67 | * substantial portion of the Covered Code or modification must reproduce the |
||
68 | * above Copyright Notice, and the following Disclaimer and Export Compliance |
||
69 | * provision in the documentation and/or other materials provided with the |
||
70 | * distribution. |
||
71 | * |
||
72 | * 3.4. Intel retains all right, title, and interest in and to the Original |
||
73 | * Intel Code. |
||
74 | * |
||
75 | * 3.5. Neither the name Intel nor any other trademark owned or controlled by |
||
76 | * Intel shall be used in advertising or otherwise to promote the sale, use or |
||
77 | * other dealings in products derived from or relating to the Covered Code |
||
78 | * without prior written authorization from Intel. |
||
79 | * |
||
80 | * 4. Disclaimer and Export Compliance |
||
81 | * |
||
82 | * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED |
||
83 | * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE |
||
84 | * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, |
||
85 | * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY |
||
86 | * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY |
||
87 | * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A |
||
88 | * PARTICULAR PURPOSE. |
||
89 | * |
||
90 | * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES |
||
91 | * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR |
||
92 | * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, |
||
93 | * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY |
||
94 | * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL |
||
95 | * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS |
||
96 | * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY |
||
97 | * LIMITED REMEDY. |
||
98 | * |
||
99 | * 4.3. Licensee shall not export, either directly or indirectly, any of this |
||
100 | * software or system incorporating such software without first obtaining any |
||
101 | * required license or other approval from the U. S. Department of Commerce or |
||
102 | * any other agency or department of the United States Government. In the |
||
103 | * event Licensee exports any such software from the United States or |
||
104 | * re-exports any such software from a foreign destination, Licensee shall |
||
105 | * ensure that the distribution and export/re-export of the software is in |
||
106 | * compliance with all laws, regulations, orders, or other restrictions of the |
||
107 | * U.S. Export Administration Regulations. Licensee agrees that neither it nor |
||
108 | * any of its subsidiaries will export/re-export any technical data, process, |
||
109 | * software, or service, directly or indirectly, to any country for which the |
||
110 | * United States government or any agency thereof requires an export license, |
||
111 | * other governmental approval, or letter of assurance, without first obtaining |
||
112 | * such license, approval or letter. |
||
113 | * |
||
114 | *****************************************************************************/ |
||
115 | |||
116 | |||
117 | |||
118 | #include "aslcompiler.y.h" |
||
119 | #include "amlcode.h" |
||
120 | |||
121 | |||
122 | ACPI_MODULE_NAME ("aslopcodes") |
||
123 | |||
124 | |||
125 | |||
126 | |||
127 | |||
128 | { |
||
129 | 6,4,2,0,11,9,16,14,19,21,24,26,28,30,32,34 |
||
130 | }; |
||
131 | |||
132 | |||
133 | |||
134 | |||
135 | OpcDoAccessAs ( |
||
136 | ACPI_PARSE_OBJECT *Op); |
||
137 | |||
138 | |||
139 | OpcDoUnicode ( |
||
140 | ACPI_PARSE_OBJECT *Op); |
||
141 | |||
142 | |||
143 | OpcDoEisaId ( |
||
144 | ACPI_PARSE_OBJECT *Op); |
||
145 | |||
146 | |||
147 | OpcDoUuId ( |
||
148 | ACPI_PARSE_OBJECT *Op); |
||
149 | |||
150 | |||
151 | |||
152 | * |
||
153 | * FUNCTION: OpcAmlOpcodeUpdateWalk |
||
154 | * |
||
155 | * PARAMETERS: ASL_WALK_CALLBACK |
||
156 | * |
||
157 | * RETURN: Status |
||
158 | * |
||
159 | * DESCRIPTION: Opcode update walk, ascending callback |
||
160 | * |
||
161 | ******************************************************************************/ |
||
162 | |||
163 | |||
164 | OpcAmlOpcodeUpdateWalk ( |
||
165 | ACPI_PARSE_OBJECT *Op, |
||
166 | UINT32 Level, |
||
167 | void *Context) |
||
168 | { |
||
169 | |||
170 | |||
171 | * Handle the Package() case where the actual opcode cannot be determined |
||
172 | * until the PackageLength operand has been folded and minimized. |
||
173 | * (PackageOp versus VarPackageOp) |
||
174 | * |
||
175 | * This is (as of ACPI 3.0) the only case where the AML opcode can change |
||
176 | * based upon the value of a parameter. |
||
177 | * |
||
178 | * The parser always inserts a VarPackage opcode, which can possibly be |
||
179 | * optimized to a Package opcode. |
||
180 | */ |
||
181 | if (Op->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE) |
||
182 | { |
||
183 | OpnDoPackage (Op); |
||
184 | } |
||
185 | |||
186 | |||
187 | } |
||
188 | |||
189 | |||
190 | |||
191 | * |
||
192 | * FUNCTION: OpcAmlOpcodeWalk |
||
193 | * |
||
194 | * PARAMETERS: ASL_WALK_CALLBACK |
||
195 | * |
||
196 | * RETURN: Status |
||
197 | * |
||
198 | * DESCRIPTION: Parse tree walk to generate both the AML opcodes and the AML |
||
199 | * operands. |
||
200 | * |
||
201 | ******************************************************************************/ |
||
202 | |||
203 | |||
204 | OpcAmlOpcodeWalk ( |
||
205 | ACPI_PARSE_OBJECT *Op, |
||
206 | UINT32 Level, |
||
207 | void *Context) |
||
208 | { |
||
209 | |||
210 | |||
211 | |||
212 | |||
213 | OpnGenerateAmlOperands (Op); |
||
214 | return (AE_OK); |
||
215 | } |
||
216 | |||
217 | |||
218 | |||
219 | * |
||
220 | * FUNCTION: OpcGetIntegerWidth |
||
221 | * |
||
222 | * PARAMETERS: Op - DEFINITION BLOCK op |
||
223 | * |
||
224 | * RETURN: none |
||
225 | * |
||
226 | * DESCRIPTION: Extract integer width from the table revision |
||
227 | * |
||
228 | ******************************************************************************/ |
||
229 | |||
230 | |||
231 | OpcGetIntegerWidth ( |
||
232 | ACPI_PARSE_OBJECT *Op) |
||
233 | { |
||
234 | ACPI_PARSE_OBJECT *Child; |
||
235 | |||
236 | |||
237 | |||
238 | { |
||
239 | return; |
||
240 | } |
||
241 | |||
242 | |||
243 | { |
||
244 | AcpiUtSetIntegerWidth (Gbl_RevisionOverride); |
||
245 | } |
||
246 | else |
||
247 | { |
||
248 | Child = Op->Asl.Child; |
||
249 | Child = Child->Asl.Next; |
||
250 | Child = Child->Asl.Next; |
||
251 | |||
252 | |||
253 | |||
254 | |||
255 | } |
||
256 | } |
||
257 | |||
258 | |||
259 | |||
260 | * |
||
261 | * FUNCTION: OpcSetOptimalIntegerSize |
||
262 | * |
||
263 | * PARAMETERS: Op - A parse tree node |
||
264 | * |
||
265 | * RETURN: Integer width, in bytes. Also sets the node AML opcode to the |
||
266 | * optimal integer AML prefix opcode. |
||
267 | * |
||
268 | * DESCRIPTION: Determine the optimal AML encoding of an integer. All leading |
||
269 | * zeros can be truncated to squeeze the integer into the |
||
270 | * minimal number of AML bytes. |
||
271 | * |
||
272 | ******************************************************************************/ |
||
273 | |||
274 | |||
275 | OpcSetOptimalIntegerSize ( |
||
276 | ACPI_PARSE_OBJECT *Op) |
||
277 | { |
||
278 | |||
279 | |||
280 | /* |
||
281 | * TBD: - we don't want to optimize integers in the block header, but the |
||
282 | * code below does not work correctly. |
||
283 | */ |
||
284 | if (Op->Asl.Parent && |
||
285 | Op->Asl.Parent->Asl.Parent && |
||
286 | (Op->Asl.Parent->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK)) |
||
287 | { |
||
288 | return 0; |
||
289 | } |
||
290 | #endif |
||
291 | |||
292 | |||
293 | * Check for the special AML integers first - Zero, One, Ones. |
||
294 | * These are single-byte opcodes that are the smallest possible |
||
295 | * representation of an integer. |
||
296 | * |
||
297 | * This optimization is optional. |
||
298 | */ |
||
299 | if (Gbl_IntegerOptimizationFlag) |
||
300 | { |
||
301 | switch (Op->Asl.Value.Integer) |
||
302 | { |
||
303 | case 0: |
||
304 | |||
305 | |||
306 | AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, |
||
307 | Op, "Zero"); |
||
308 | return 1; |
||
309 | |||
310 | |||
311 | |||
312 | |||
313 | AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, |
||
314 | Op, "One"); |
||
315 | return 1; |
||
316 | |||
317 | |||
318 | |||
319 | |||
320 | |||
321 | |||
322 | { |
||
323 | Op->Asl.AmlOpcode = AML_ONES_OP; |
||
324 | AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, |
||
325 | Op, "Ones"); |
||
326 | return 1; |
||
327 | } |
||
328 | break; |
||
329 | |||
330 | |||
331 | |||
332 | |||
333 | |||
334 | |||
335 | { |
||
336 | Op->Asl.AmlOpcode = AML_ONES_OP; |
||
337 | AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, |
||
338 | Op, "Ones"); |
||
339 | return 1; |
||
340 | } |
||
341 | break; |
||
342 | |||
343 | |||
344 | break; |
||
345 | } |
||
346 | } |
||
347 | |||
348 | |||
349 | |||
350 | |||
351 | { |
||
352 | Op->Asl.AmlOpcode = AML_BYTE_OP; |
||
353 | return 1; |
||
354 | } |
||
355 | if (Op->Asl.Value.Integer <= ACPI_UINT16_MAX) |
||
356 | { |
||
357 | Op->Asl.AmlOpcode = AML_WORD_OP; |
||
358 | return 2; |
||
359 | } |
||
360 | if (Op->Asl.Value.Integer <= ACPI_UINT32_MAX) |
||
361 | { |
||
362 | Op->Asl.AmlOpcode = AML_DWORD_OP; |
||
363 | return 4; |
||
364 | } |
||
365 | else |
||
366 | { |
||
367 | if (AcpiGbl_IntegerByteWidth == 4) |
||
368 | { |
||
369 | AslError (ASL_WARNING, ASL_MSG_INTEGER_LENGTH, |
||
370 | Op, NULL); |
||
371 | |||
372 | |||
373 | { |
||
374 | /* Truncate the integer to 32-bit */ |
||
375 | Op->Asl.AmlOpcode = AML_DWORD_OP; |
||
376 | return 4; |
||
377 | } |
||
378 | } |
||
379 | |||
380 | |||
381 | return 8; |
||
382 | } |
||
383 | } |
||
384 | |||
385 | |||
386 | |||
387 | * |
||
388 | * FUNCTION: OpcDoAccessAs |
||
389 | * |
||
390 | * PARAMETERS: Op - Parse node |
||
391 | * |
||
392 | * RETURN: None |
||
393 | * |
||
394 | * DESCRIPTION: Implement the ACCESS_AS ASL keyword. |
||
395 | * |
||
396 | ******************************************************************************/ |
||
397 | |||
398 | |||
399 | OpcDoAccessAs ( |
||
400 | ACPI_PARSE_OBJECT *Op) |
||
401 | { |
||
402 | ACPI_PARSE_OBJECT *Next; |
||
403 | |||
404 | |||
405 | |||
406 | Next = Op->Asl.Child; |
||
407 | |||
408 | |||
409 | |||
410 | |||
411 | Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; |
||
412 | |||
413 | |||
414 | |||
415 | |||
416 | if (Next->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) |
||
417 | { |
||
418 | Next->Asl.Value.Integer = 0; |
||
419 | } |
||
420 | Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; |
||
421 | Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; |
||
422 | } |
||
423 | |||
424 | |||
425 | |||
426 | * |
||
427 | * FUNCTION: OpcDoUnicode |
||
428 | * |
||
429 | * PARAMETERS: Op - Parse node |
||
430 | * |
||
431 | * RETURN: None |
||
432 | * |
||
433 | * DESCRIPTION: Implement the UNICODE ASL "macro". Convert the input string |
||
434 | * to a unicode buffer. There is no Unicode AML opcode. |
||
435 | * |
||
436 | * Note: The Unicode string is 16 bits per character, no leading signature, |
||
437 | * with a 16-bit terminating NULL. |
||
438 | * |
||
439 | ******************************************************************************/ |
||
440 | |||
441 | |||
442 | OpcDoUnicode ( |
||
443 | ACPI_PARSE_OBJECT *Op) |
||
444 | { |
||
445 | ACPI_PARSE_OBJECT *InitializerOp; |
||
446 | UINT32 Length; |
||
447 | UINT32 Count; |
||
448 | UINT32 i; |
||
449 | UINT8 *AsciiString; |
||
450 | UINT16 *UnicodeString; |
||
451 | ACPI_PARSE_OBJECT *BufferLengthOp; |
||
452 | |||
453 | |||
454 | |||
455 | |||
456 | |||
457 | Op->Asl.ParseOpcode = PARSEOP_BUFFER; |
||
458 | UtSetParseOpName (Op); |
||
459 | |||
460 | |||
461 | |||
462 | |||
463 | InitializerOp = BufferLengthOp->Asl.Next; |
||
464 | |||
465 | |||
466 | |||
467 | |||
468 | |||
469 | |||
470 | Length = Count * sizeof (UINT16); |
||
471 | UnicodeString = UtLocalCalloc (Length); |
||
472 | |||
473 | |||
474 | |||
475 | |||
476 | { |
||
477 | UnicodeString[i] = (UINT16) AsciiString[i]; |
||
478 | } |
||
479 | |||
480 | |||
481 | * Just set the buffer size node to be the buffer length, regardless |
||
482 | * of whether it was previously an integer or a default_arg placeholder |
||
483 | */ |
||
484 | BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; |
||
485 | BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP; |
||
486 | BufferLengthOp->Asl.Value.Integer = Length; |
||
487 | UtSetParseOpName (BufferLengthOp); |
||
488 | |||
489 | |||
490 | |||
491 | |||
492 | |||
493 | |||
494 | InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; |
||
495 | InitializerOp->Asl.AmlLength = Length; |
||
496 | InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; |
||
497 | InitializerOp->Asl.Child = NULL; |
||
498 | UtSetParseOpName (InitializerOp); |
||
499 | } |
||
500 | |||
501 | |||
502 | |||
503 | * |
||
504 | * FUNCTION: OpcDoEisaId |
||
505 | * |
||
506 | * PARAMETERS: Op - Parse node |
||
507 | * |
||
508 | * RETURN: None |
||
509 | * |
||
510 | * DESCRIPTION: Convert a string EISA ID to numeric representation. See the |
||
511 | * Pnp BIOS Specification for details. Here is an excerpt: |
||
512 | * |
||
513 | * A seven character ASCII representation of the product |
||
514 | * identifier compressed into a 32-bit identifier. The seven |
||
515 | * character ID consists of a three character manufacturer code, |
||
516 | * a three character hexadecimal product identifier, and a one |
||
517 | * character hexadecimal revision number. The manufacturer code |
||
518 | * is a 3 uppercase character code that is compressed into 3 5-bit |
||
519 | * values as follows: |
||
520 | * 1) Find hex ASCII value for each letter |
||
521 | * 2) Subtract 40h from each ASCII value |
||
522 | * 3) Retain 5 least signficant bits for each letter by |
||
523 | * discarding upper 3 bits because they are always 0. |
||
524 | * 4) Compressed code = concatenate 0 and the 3 5-bit values |
||
525 | * |
||
526 | * The format of the compressed product identifier is as follows: |
||
527 | * Byte 0: Bit 7 - Reserved (0) |
||
528 | * Bits 6-2: - 1st character of compressed mfg code |
||
529 | * Bits 1-0 - Upper 2 bits of 2nd character of mfg code |
||
530 | * Byte 1: Bits 7-5 - Lower 3 bits of 2nd character of mfg code |
||
531 | * Bits 4-0 - 3rd character of mfg code |
||
532 | * Byte 2: Bits 7-4 - 1st hex digit of product number |
||
533 | * Bits 3-0 - 2nd hex digit of product number |
||
534 | * Byte 3: Bits 7-4 - 3st hex digit of product number |
||
535 | * Bits 3-0 - Hex digit of the revision number |
||
536 | * |
||
537 | ******************************************************************************/ |
||
538 | |||
539 | |||
540 | OpcDoEisaId ( |
||
541 | ACPI_PARSE_OBJECT *Op) |
||
542 | { |
||
543 | UINT32 EisaId = 0; |
||
544 | UINT32 BigEndianId; |
||
545 | char *InString; |
||
546 | ACPI_STATUS Status = AE_OK; |
||
547 | UINT32 i; |
||
548 | |||
549 | |||
550 | |||
551 | |||
552 | |||
553 | * The EISAID string must be exactly 7 characters and of the form |
||
554 | * "UUUXXXX" -- 3 uppercase letters and 4 hex digits (e.g., "PNP0001") |
||
555 | */ |
||
556 | if (ACPI_STRLEN (InString) != 7) |
||
557 | { |
||
558 | Status = AE_BAD_PARAMETER; |
||
559 | } |
||
560 | else |
||
561 | { |
||
562 | /* Check all 7 characters for correct format */ |
||
563 | |||
564 | |||
565 | { |
||
566 | /* First 3 characters must be uppercase letters */ |
||
567 | |||
568 | |||
569 | { |
||
570 | if (!isupper ((int) InString[i])) |
||
571 | { |
||
572 | Status = AE_BAD_PARAMETER; |
||
573 | } |
||
574 | } |
||
575 | |||
576 | |||
577 | |||
578 | |||
579 | { |
||
580 | Status = AE_BAD_PARAMETER; |
||
581 | } |
||
582 | } |
||
583 | } |
||
584 | |||
585 | |||
586 | { |
||
587 | AslError (ASL_ERROR, ASL_MSG_INVALID_EISAID, Op, Op->Asl.Value.String); |
||
588 | } |
||
589 | else |
||
590 | { |
||
591 | /* Create ID big-endian first (bits are contiguous) */ |
||
592 | |||
593 | |||
594 | (UINT32) (InString[0] - 0x40) << 26 | |
||
595 | (UINT32) (InString[1] - 0x40) << 21 | |
||
596 | (UINT32) (InString[2] - 0x40) << 16 | |
||
597 | |||
598 | |||
599 | (UtHexCharToValue (InString[4])) << 8 | |
||
600 | (UtHexCharToValue (InString[5])) << 4 | |
||
601 | UtHexCharToValue (InString[6]); |
||
602 | |||
603 | |||
604 | |||
605 | |||
606 | } |
||
607 | |||
608 | |||
609 | * Morph the Op into an integer, regardless of whether there |
||
610 | * was an error in the EISAID string |
||
611 | */ |
||
612 | Op->Asl.Value.Integer = EisaId; |
||
613 | |||
614 | |||
615 | Op->Asl.ParseOpcode = PARSEOP_INTEGER; |
||
616 | (void) OpcSetOptimalIntegerSize (Op); |
||
617 | |||
618 | |||
619 | |||
620 | |||
621 | } |
||
622 | |||
623 | |||
624 | |||
625 | * |
||
626 | * FUNCTION: OpcDoUiId |
||
627 | * |
||
628 | * PARAMETERS: Op - Parse node |
||
629 | * |
||
630 | * RETURN: None |
||
631 | * |
||
632 | * DESCRIPTION: Convert UUID string to 16-byte buffer |
||
633 | * |
||
634 | ******************************************************************************/ |
||
635 | |||
636 | |||
637 | OpcDoUuId ( |
||
638 | ACPI_PARSE_OBJECT *Op) |
||
639 | { |
||
640 | char *InString; |
||
641 | char *Buffer; |
||
642 | ACPI_STATUS Status = AE_OK; |
||
643 | UINT32 i; |
||
644 | ACPI_PARSE_OBJECT *NewOp; |
||
645 | |||
646 | |||
647 | |||
648 | |||
649 | |||
650 | { |
||
651 | Status = AE_BAD_PARAMETER; |
||
652 | } |
||
653 | else |
||
654 | { |
||
655 | /* Check all 36 characters for correct format */ |
||
656 | |||
657 | |||
658 | { |
||
659 | if ((i == 8) || (i == 13) || (i == 18) || (i == 23)) |
||
660 | { |
||
661 | if (InString[i] != '-') |
||
662 | { |
||
663 | Status = AE_BAD_PARAMETER; |
||
664 | } |
||
665 | } |
||
666 | else |
||
667 | { |
||
668 | if (!isxdigit ((int) InString[i])) |
||
669 | { |
||
670 | Status = AE_BAD_PARAMETER; |
||
671 | } |
||
672 | } |
||
673 | } |
||
674 | } |
||
675 | |||
676 | |||
677 | |||
678 | |||
679 | { |
||
680 | AslError (ASL_ERROR, ASL_MSG_INVALID_UUID, Op, Op->Asl.Value.String); |
||
681 | } |
||
682 | else for (i = 0; i < 16; i++) |
||
683 | { |
||
684 | Buffer[i] = (char) (UtHexCharToValue (InString[OpcMapToUUID[i]]) << 4); |
||
685 | Buffer[i] |= (char) UtHexCharToValue (InString[OpcMapToUUID[i] + 1]); |
||
686 | } |
||
687 | |||
688 | |||
689 | |||
690 | |||
691 | Op->Common.AmlOpcode = AML_BUFFER_OP; |
||
692 | |||
693 | |||
694 | |||
695 | |||
696 | UtSetParseOpName (Op); |
||
697 | |||
698 | |||
699 | |||
700 | |||
701 | |||
702 | |||
703 | NewOp->Asl.Value.Integer = 16; |
||
704 | NewOp->Asl.Parent = Op; |
||
705 | |||
706 | |||
707 | Op = NewOp; |
||
708 | |||
709 | |||
710 | |||
711 | |||
712 | NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; |
||
713 | NewOp->Asl.AmlLength = 16; |
||
714 | NewOp->Asl.Value.String = (char *) Buffer; |
||
715 | NewOp->Asl.Parent = Op->Asl.Parent; |
||
716 | |||
717 | |||
718 | } |
||
719 | |||
720 | |||
721 | |||
722 | * |
||
723 | * FUNCTION: OpcGenerateAmlOpcode |
||
724 | * |
||
725 | * PARAMETERS: Op - Parse node |
||
726 | * |
||
727 | * RETURN: None |
||
728 | * |
||
729 | * DESCRIPTION: Generate the AML opcode associated with the node and its |
||
730 | * parse (lex/flex) keyword opcode. Essentially implements |
||
731 | * a mapping between the parse opcodes and the actual AML opcodes. |
||
732 | * |
||
733 | ******************************************************************************/ |
||
734 | |||
735 | |||
736 | OpcGenerateAmlOpcode ( |
||
737 | ACPI_PARSE_OBJECT *Op) |
||
738 | { |
||
739 | |||
740 | |||
741 | |||
742 | |||
743 | |||
744 | |||
745 | |||
746 | Op->Asl.AcpiBtype = AslKeywordMapping[Index].AcpiBtype; |
||
747 | Op->Asl.CompileFlags |= AslKeywordMapping[Index].Flags; |
||
748 | |||
749 | |||
750 | { |
||
751 | Op->Asl.Value.Integer = AslKeywordMapping[Index].Value; |
||
752 | } |
||
753 | |||
754 | |||
755 | |||
756 | |||
757 | { |
||
758 | case PARSEOP_INTEGER: |
||
759 | /* |
||
760 | * Set the opcode based on the size of the integer |
||
761 | */ |
||
762 | (void) OpcSetOptimalIntegerSize (Op); |
||
763 | break; |
||
764 | |||
765 | |||
766 | |||
767 | |||
768 | break; |
||
769 | |||
770 | |||
771 | |||
772 | |||
773 | break; |
||
774 | |||
775 | |||
776 | |||
777 | |||
778 | break; |
||
779 | |||
780 | |||
781 | |||
782 | |||
783 | break; |
||
784 | |||
785 | |||
786 | |||
787 | |||
788 | break; |
||
789 | |||
790 | |||
791 | |||
792 | |||
793 | Gbl_HasIncludeFiles = TRUE; |
||
794 | break; |
||
795 | |||
796 | |||
797 | |||
798 | |||
799 | Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; |
||
800 | break; |
||
801 | |||
802 | |||
803 | /* Nothing to do for other opcodes */ |
||
804 | break; |
||
805 | } |
||
806 | |||
807 | |||
808 | }><>>>><>><>><>><>><>><>>>>=>=>=> |
||
809 |