PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
expression.h
Go to the documentation of this file.
1#pragma once
2
6
7typedef struct aml_object aml_object_t;
8typedef struct aml_term_list_ctx aml_term_list_ctx_t;
9
10/**
11 * @brief Expression Opcodes Encoding
12 * @defgroup modules_acpi_aml_encoding_expression Expression Opcodes
13 * @ingroup modules_acpi_aml
14 *
15 * @see Section 20.2.5.4 of the ACPI specification for more details.
16 *
17 * @{
18 */
19
20/**
21 * @brief TermArgList structure.
22 * @struct aml_term_arg_list_t
23 */
24typedef struct aml_term_arg_list
25{
26 aml_object_t* args[AML_MAX_ARGS + 1]; // null-terminated
28
29/**
30 * @brief Reads an Operand structure from the AML byte stream.
31 *
32 * An Operand structure is defined as `Operand := TermArg => Integer` in the spec but this must be wrong.
33 *
34 * For example, Operand is used in the definition of DefLGreaterEqual which is defined as `DefLGreaterEqual :=
35 * LgreaterEqualOp Operand Operand`. Clearly using the Operand structure.
36 *
37 * However, this does not make any sense as in section 19.6.72, regarding LGreaterEqual, it states that "Source1 and
38 * Source2 must each evaluate to an integer, a string or a buffer" clearly contradicting the definition of Operand as
39 * only being able to evaluate to an integer. More examples of this can be found all over the place.
40 *
41 * So instead we use let the caller specify what types are allowed.
42 *
43 * @param ctx The TermList context.
44 * @param out Output pointer to be filled with the object pointer storing the result.
45 * @param allowedTypes The allowed types that the TermArg can evaluate to.
46 * @return On success, `0`. On failure, `ERR` and `errno` is set.
47 */
49
50/**
51 * @brief Reads a BufferSize structure from the AML byte stream.
52 *
53 * A BufferSize structure is defined as `BufferSize := TermArg => Integer`.
54 *
55 * @see Section 19.6.10 of the ACPI specification for more details.
56 *
57 * @param ctx The TermList context.
58 * @param out Output pointer where the buffer size will be stored.
59 * @return On success, the buffer size. On failure, `ERR` and `errno` is set.
60 */
62
63/**
64 * @brief Reads a DefBuffer structure from the AML byte stream.
65 *
66 * The DefBuffer structure is defined as `DefBuffer := BufferOp PkgLength BufferSize ByteList`.
67 *
68 * @see Section 19.6.10 of the ACPI specification for more details.
69 *
70 * @param ctx The TermList context.
71 * @param out Output pointer to the object to store the result.
72 * @return On success, `0`. On failure, `ERR` and `errno` is set.
73 */
75
76/**
77 * @brief Reads a TermArgList structure from the AML byte stream.
78 *
79 * A TermArgList structure is defined as `TermArgList := Nothing | <termarg termarglist>`.
80 *
81 * The number of arguments to read is determined by knowing ahead of time what object the arguments will be passed to.
82 *
83 * @param ctx The TermList context.
84 * @param argCount The number of arguments to read.
85 * @param out Pointer to the buffer where the TermArgList will be stored.
86 * @return On success, `0`. On failure, `ERR` and `errno` is set.
87 */
89
90/**
91 * @brief Reads a MethodInvocation structure from the AML byte stream.
92 *
93 * A MethodInvocation structure is defined as `MethodInvocation := NameString TermArgList`.
94 *
95 * So this is a bit confusing, but my interpretation is that despite the name, a MethodInvocation can be any object, not
96 * just methods. For example, fields. In such cases, the TermArgList is empty. Its the only thing that makes any sense
97 * when I inspect the aml bytecode as there are clearly named objects referenced in TermArgs, but there is no "child"
98 * definition that contains such a thing, atleast that i can find. But the specification says literally nothing about
99 * this. I guess you could say that any object is being "invoked" when it is being read, it just happens to not take any
100 * arguments.
101 *
102 * The result may have the `AML_OBJECT_EXCEPTION_ON_USE` flag set.
103 *
104 * @param ctx The TermList context.
105 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
106 */
108
109/**
110 * @brief Reads a DefCondRefOf structure from the AML byte stream.
111 *
112 * A DefCondRefOf structure is defined as `DefCondRefOf := CondRefOfOp SuperName Target`.
113 *
114 * @see Section 19.6.14 of the ACPI specification for more details.
115 *
116 * @param ctx The TermList context.
117 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
118 */
120
121/**
122 * @brief Reads a DefStore structure from the AML byte stream.
123 *
124 * A DefStore structure is defined as `DefStore := StoreOp TermArg SuperName`.
125 *
126 * @see Section 19.6.132 of the ACPI specification for more details.
127 *
128 * @param ctx The TermList context.
129 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
130 */
132
133/**
134 * @brief Reads a Dividend structure from the AML byte stream.
135 *
136 * A Dividend structure is defined as `Dividend := TermArg => Integer`.
137 *
138 * @param ctx The TermList context.
139 * @param out Output pointer where the integer value of the dividend will be stored.
140 * @return On success, `0`. On failure, `ERR` and `errno` is set.
141 */
143
144/**
145 * @brief Reads a Divisor structure from the AML byte stream.
146 *
147 * A Divisor structure is defined as `Divisor := TermArg => Integer`.
148 *
149 * @param ctx The TermList context.
150 * @param out Output pointer where the integer value of the divisor will be stored.
151 * @return On success, `0`. On failure, `ERR` and `errno` is set.
152 */
154
155/**
156 * @brief Reads a Remainder structure from the AML byte stream.
157 *
158 * A Remainder structure is defined as `Remainder := Target`.
159 *
160 * @param ctx The TermList context.
161 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
162 */
164
165/**
166 * @brief Reads a Quotient structure from the AML byte stream.
167 *
168 * A Quotient structure is defined as `Quotient := Target`.
169 *
170 * @param ctx The TermList context.
171 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
172 */
174
175/**
176 * @brief Reads a DefAdd structure from the AML byte stream.
177 *
178 * The DefAdd structure is defined as `DefAdd := AddOp Operand Operand Target`.
179 *
180 * @see Section 19.6.3 of the ACPI specification for more details.
181 *
182 * @param ctx The TermList context.
183 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
184 */
186
187/**
188 * @brief Reads a DefSubtract structure from the AML byte stream.
189 *
190 * The DefSubtract structure is defined as `DefSubtract := SubtractOp Operand Operand Target`.
191 *
192 * @see Section 19.6.133 of the ACPI specification for more details.
193 *
194 * @param ctx The TermList context.
195 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
196 */
198
199/**
200 * @brief Reads a DefMultiply structure from the AML byte stream.
201 *
202 * The DefMultiply structure is defined as `DefMultiply := MultiplyOp Operand Operand Target`.
203 *
204 * @see Section 19.6.88 of the ACPI specification for more details.
205 *
206 * @param ctx The TermList context.
207 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
208 */
210
211/**
212 * @brief Reads a DefDivide structure from the AML byte stream.
213 *
214 * The DefDivide structure is defined as `DefDivide := DivideOp Dividend Divisor Remainder Quotient`.
215 *
216 * The specification says that a division by zero is not allowed, for the sake of compatibility we ignore this and
217 * instead set the divisor to 1.
218 *
219 * @see Section 19.6.32 of the ACPI specification for more details.
220 *
221 * @param ctx The TermList context.
222 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
223 */
225
226/**
227 * @brief Reads a DefMod structure from the AML byte stream.
228 *
229 * The DefMod structure is defined as `DefMod := ModOp Dividend Divisor Target`.
230 *
231 * The specification says that a division by zero is not allowed, for the sake of compatibility we ignore this and
232 * instead set the divisor to 1.
233 *
234 * @see Section 19.6.87 of the ACPI specification for more details.
235 *
236 * @param ctx The TermList context.
237 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
238 */
240
241/**
242 * @brief Reads a DefAnd structure from the AML byte stream.
243 *
244 * The DefAnd structure is defined as `DefAnd := AndOp Operand Operand Target`.
245 *
246 * @see Section 19.6.5 of the ACPI specification for more details.
247 *
248 * @param ctx The TermList context.
249 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
250 */
252
253/**
254 * @brief Reads a DefNAnd structure from the AML byte stream.
255 *
256 * The DefNAnd structure is defined as `DefNAnd := NandOp Operand Operand Target`.
257 *
258 * @see Section 19.6.69 of the ACPI specification for more details.
259 *
260 * @param ctx The TermList context.
261 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
262 */
264
265/**
266 * @brief Reads a DefOr structure from the AML byte stream.
267 *
268 * The DefOr structure is defined as `DefOr := OrOp Operand Operand Target`.
269 *
270 * @see Section 19.6.100 of the ACPI specification for more details.
271 *
272 * @param ctx The TermList context.
273 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
274 */
276
277/**
278 * @brief Reads a DefNOr structure from the AML byte stream.
279 *
280 * The DefNOr structure is defined as `DefNOr := NorOp Operand Operand Target`.
281 *
282 * @see Section 19.6.93 of the ACPI specification for more details.
283 *
284 * @param ctx The TermList context.
285 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
286 */
288
289/**
290 * @brief Reads a DefXOr structure from the AML byte stream.
291 *
292 * The DefXOr structure is defined as `DefXOr := XorOp Operand Operand Target`.
293 *
294 * @see Section 19.6.155 of the ACPI specification for more details.
295 *
296 * @param ctx The TermList context.
297 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
298 */
300
301/**
302 * @brief Reads a DefNot structure from the AML byte stream.
303 *
304 * The DefNot structure is defined as `DefNot := NotOp Operand Target`.
305 *
306 * @see Section 19.6.94 of the ACPI specification for more details.
307 *
308 * @param ctx The TermList context.
309 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
310 */
312
313/**
314 * @brief Reads a ShiftCount structure from the AML byte stream.
315 *
316 * A ShiftCount structure is defined as `ShiftCount := TermArg => Integer`.
317 *
318 * @param ctx The TermList context.
319 * @param out Output pointer where the integer result will be stored.
320 * @return On success, `0`. On failure, `ERR` and `errno` is set.
321 */
323
324/**
325 * @brief Reads a DefShiftLeft structure from the AML byte stream.
326 *
327 * The DefShiftLeft structure is defined as `DefShiftLeft := ShiftLeftOp Operand ShiftCount Target`.
328 *
329 * @see Section 19.6.123 of the ACPI specification for more details.
330 *
331 * @param ctx The TermList context.
332 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
333 */
335
336/**
337 * @brief Reads a DefShiftRight structure from the AML byte stream.
338 *
339 * The DefShiftRight structure is defined as `DefShiftRight := ShiftRightOp Operand ShiftCount Target`.
340 *
341 * @see Section 19.6.124 of the ACPI specification for more details.
342 *
343 * @param ctx The TermList context.
344 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
345 */
347
348/**
349 * @brief Reads a DefIncrement structure from the AML byte stream.
350 *
351 * The DefIncrement structure is defined as `DefIncrement := IncrementOp SuperName`.
352 *
353 * @see Section 19.6.62 of the ACPI specification for more details.
354 *
355 * @param ctx The TermList context.
356 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
357 */
359
360/**
361 * @brief Reads a DefDecrement structure from the AML byte stream.
362 *
363 * The DefDecrement structure is defined as `DefDecrement := DecrementOp SuperName`.
364 *
365 * @see Section 19.6.27 of the ACPI specification for more details.
366 *
367 * @param ctx The TermList context.
368 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
369 */
371
372/**
373 * @brief Reads an ObjReference structure from the AML byte stream.
374 *
375 * An ObjReference structure is defined as `ObjReference := TermArg => ObjectReference | String`.
376 *
377 * If a String is read then it is considered a path to an object and will be resolved to an ObjectReference.
378 *
379 * @param ctx The TermList context.
380 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
381 */
383
384/**
385 * @brief Reads a DefDerefOf structure from the AML byte stream.
386 *
387 * A DefDerefOf structure is defined as `DefDerefOf := DerefOfOp ObjReference`.
388 *
389 * @see Section 19.6.30 of the ACPI specification for more details.
390 *
391 * @param ctx The TermList context.
392 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
393 */
395
396/**
397 * @brief Reads a BuffPkgStrObj structure from the AML byte stream.
398 *
399 * A BuffPkgStrObj structure is defined as `BuffPkgStrObj := TermArg => Buffer, Package, or String`.
400 *
401 * Note that the TermArg must resolve to an ObjectReference that points to a Buffer, Package, or String.
402 * Becouse taking a reference to an object within a temporary object does not make sense, temporary objects are not
403 * allowed.
404 *
405 * @param ctx The TermList context.
406 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
407 */
409
410/**
411 * @brief Reads an IndexValue structure from the AML byte stream.
412 *
413 * An IndexValue structure is defined as `IndexValue := TermArg => Integer`.
414 *
415 * @param ctx The TermList context.
416 * @param out Output pointer where the integer result will be stored.
417 * @return On success, `0`. On failure, `ERR` and `errno` is set.
418 */
420
421/**
422 * @brief Reads a DefIndex structure from the AML byte stream.
423 *
424 * A DefIndex structure is defined as `DefIndex := IndexOp BuffPkgStrObj IndexValue Target`.
425 *
426 * Returns a reference to an indexed element within the buffer, package or string stored in BuffPkgStrObj, and
427 * optionally stores that reference in Target.
428 *
429 * @see Section 19.6.63 of the ACPI specification for more details.
430 *
431 * @param ctx The TermList context.
432 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
433 */
435
436/**
437 * @brief Reads a DefLAnd structure from the AML byte stream.
438 *
439 * A DefLAnd structure is defined as `DefLAnd := LandOp Operand Operand`.
440 *
441 * @see Section 19.6.69 of the ACPI specification for more details.
442 *
443 * @param ctx The TermList context.
444 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
445 */
447
448/**
449 * @brief Reads a DefLEqual structure from the AML byte stream.
450 *
451 * A DefLEqual structure is defined as `DefLEqual := LequalOp Operand Operand`.
452 *
453 * @see Section 19.6.70 of the ACPI specification for more details.
454 *
455 * @param ctx The TermList context.
456 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
457 */
459
460/**
461 * @brief Reads a DefLGreater structure from the AML byte stream.
462 *
463 * A DefLGreater structure is defined as `DefLGreater := LgreaterOp Operand Operand`.
464 *
465 * @see Section 19.6.71 of the ACPI specification for more details.
466 *
467 * @param ctx The TermList context.
468 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
469 */
471
472/**
473 * @brief Reads a DefLGreaterEqual structure from the AML byte stream.
474 *
475 * A DefLGreaterEqual structure is defined as `DefLGreaterEqual := LgreaterEqualOp Operand Operand`.
476 *
477 * @see Section 19.6.72 of the ACPI specification for more details.
478 *
479 * @param ctx The TermList context.
480 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
481 */
483
484/**
485 * @brief Reads a DefLLess structure from the AML byte stream.
486 *
487 * A DefLLess structure is defined as `DefLLess := LlessOp Operand Operand`.
488 *
489 * @see Section 19.6.73 of the ACPI specification for more details.
490 *
491 * @param ctx The TermList context.
492 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
493 */
495
496/**
497 * @brief Reads a DefLLessEqual structure from the AML byte stream.
498 *
499 * A DefLLessEqual structure is defined as `DefLLessEqual := LlessEqualOp Operand Operand`.
500 *
501 * @see Section 19.6.74 of the ACPI specification for more details.
502 *
503 * @param ctx The TermList context.
504 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
505 */
507
508/**
509 * @brief Reads a DefLNot structure from the AML byte stream.
510 *
511 * A DefLNot structure is defined as `DefLNot := LnotOp Operand`.
512 *
513 * @see Section 19.6.75 of the ACPI specification for more details.
514 *
515 * @param ctx The TermList context.
516 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
517 */
519
520/**
521 * @brief Reads a DefLNotEqual structure from the AML byte stream.
522 *
523 * A DefLNotEqual structure is defined as `DefLNotEqual := LnotEqualOp Operand Operand`.
524 *
525 * @see Section 19.6.76 of the ACPI specification for more details.
526 *
527 * @param ctx The TermList context.
528 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
529 */
531
532/**
533 * @brief Reads a DefLOr structure from the AML byte stream.
534 *
535 * A DefLOr structure is defined as `DefLOr := LorOp Operand Operand`.
536 *
537 * @see Section 19.6.80 of the ACPI specification for more details.
538 *
539 * @param ctx The TermList context.
540 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
541 */
543
544/**
545 * @brief Reads a MutexObject structure from the AML byte stream.
546 *
547 * A MutexObject structure is defined as `MutexObject := SuperName`.
548 *
549 * @param ctx The TermList context.
550 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
551 */
553
554/**
555 * @brief Reads a Timeout structure from the AML byte stream.
556 *
557 * A Timeout structure is defined as `Timeout := WordData`.
558 *
559 * @param ctx The TermList context.
560 * @param out Output pointer where the integer result will be stored.
561 * @return On success, `0`. On failure, `ERR` and `errno` is set.
562 */
564
565/**
566 * @brief Reads a DefAcquire structure from the AML byte stream.
567 *
568 * A DefAcquire structure is defined as `DefAcquire := AcquireOp MutexObject Timeout`.
569 *
570 * @see Section 19.6.2 of the ACPI specification for more details.
571 * @see Section 19.6.89 of the ACPI specification for details about SyncLevel handling.
572 *
573 * @param ctx The TermList context.
574 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
575 */
577
578/**
579 * @brief Reads a DefToBcd structure from the AML byte stream.
580 *
581 * A DefToBcd structure is defined as `DefToBCD := ToBCDOp Operand Target`.
582 *
583 * @see Section 19.6.137 of the ACPI specification for more details.
584 *
585 * @param ctx The TermList context.
586 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
587 */
589
590/**
591 * @brief Reads a DefToBuffer structure from the AML byte stream.
592 *
593 * A DefToBuffer structure is defined as `DefToBuffer := ToBufferOp Operand Target`.
594 *
595 * @see Section 19.6.138 of the ACPI specification for more details.
596 *
597 * @param ctx The TermList context.
598 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
599 */
601
602/**
603 * @brief Reads a DefToDecimalString structure from the AML byte stream.
604 *
605 * A DefToDecimalString structure is defined as `DefToDecimalString := ToDecimalStringOp Operand Target`.
606 *
607 * @see Section 19.6.139 of the ACPI specification for more details.
608 *
609 * @param ctx The TermList context.
610 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
611 */
613
614/**
615 * @brief Reads a DefToHexString structure from the AML byte stream.
616 *
617 * A DefToHexString structure is defined as `DefToHexString := ToHexStringOp Operand Target`.
618 *
619 * @see Section 19.6.140 of the ACPI specification for more details.
620 *
621 * @param ctx The TermList context.
622 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
623 */
625
626/**
627 * @brief Reads a DefToInteger structure from the AML byte stream.
628 *
629 * A DefToInteger structure is defined as `DefToInteger := ToIntegerOp Operand Target`.
630 *
631 * @see Section 19.6.141 of the ACPI specification for more details.
632 *
633 * @param ctx The TermList context.
634 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
635 */
637
638/**
639 * @brief Reads a LengthArg structure from the AML byte stream.
640 *
641 * A LengthArg structure is defined as `LengthArg := TermArg => Integer`.
642 *
643 * @param ctx The TermList context.
644 * @param out Output pointer where the integer result will be stored.
645 * @return On success, the integer value. On failure, `ERR` and `errno` is set.
646 */
648
649/**
650 * @brief Reads a DefToString structure from the AML byte stream.
651 *
652 * A DefToString structure is defined as `DefToString := ToStringOp TermArg LengthArg Target`.
653 *
654 * @see Section 19.6.143 of the ACPI specification for more details.
655 *
656 * @param ctx The TermList context.
657 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
658 */
660
661/**
662 * @brief Reads a DefTimer structure from the AML byte stream.
663 *
664 * A DefTimer structure is defined as `DefTimer := TimerOp`.
665 *
666 * @see Section 19.6.136 of the ACPI specification for more details.
667 *
668 * @param ctx The TermList context.
669 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
670 */
672
673/**
674 * @brief Reads a DefCopyObject structure from the AML byte stream.
675 *
676 * A DefCopyObject structure is defined as `DefCopyObject := CopyObjectOp TermArg SimpleName`.
677 *
678 * @see Section 19.6.17 of the ACPI specification for more details.
679 *
680 * @param ctx The TermList context.
681 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
682 */
684
685/**
686 * @brief Reads a Data structure from the AML byte stream.
687 *
688 * A Data structure is defined as `Data := TermArg => ComputationalData`.
689 *
690 * @param ctx The TermList context.
691 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
692 */
694
695/**
696 * @brief Reads a DefConcat structure from the AML byte stream.
697 *
698 * A DefConcat structure is defined as `DefConcat := ConcatOp Data Data Target`.
699 *
700 * @see Section 19.6.20 of the ACPI specification for more details.
701 *
702 * @param ctx The TermList context.
703 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
704 */
706
707/**
708 * @brief Reads a DefSizeOf structure from the AML byte stream.
709 *
710 * A DefSizeOf structure is defined as `DefSizeOf := SizeOfOp SuperName`.
711 *
712 * @see Section 19.6.126 of the ACPI specification for more details.
713 *
714 * @param ctx The TermList context.
715 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
716 */
718
719/**
720 * @brief Reads a DefRefOf structure from the AML byte stream.
721 *
722 * A DefRefOf structure is defined as `DefRefOf := RefOfOp SuperName`.
723 *
724 * @see Section 19.6.115 of the ACPI specification for more details.
725 *
726 * @param ctx The TermList context.
727 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
728 */
730
731/**
732 * @brief Reads a DefObjectType structure from the AML byte stream.
733 *
734 * A DefObjectType structure is defined as `DefObjectType := ObjectTypeOp <SimpleName | DebugObj | DefRefOf | DefDerefOf
735 * | DefIndex>`.
736 *
737 * @see Section 19.6.97 of the ACPI specification for more details.
738 *
739 * @param ctx The TermList context.
740 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
741 */
743
744/*
745 * @brief Reads a ReferenceTypeOpcode structure from the AML byte stream.
746 *
747 * A ReferenceTypeOpcode structure is defined as `ReferenceTypeOpcode := DefRefOf | DefDerefOf | DefIndex |
748 * UserTermObj`.
749 *
750 * I have no idea what the `UserTermObj` is supposed to be, so its currently unimplemented.
751 *
752 * @param ctx The TermList context.
753 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
754 */
756
757/**
758 * @brief Reads a DefFindSetLeftBit structure from the AML byte stream.
759 *
760 * A DefFindSetLeftBit structure is defined as `DefFindSetLeftBit := FindSetLeftBitOp Operand Target`.
761 *
762 * @see Section 19.6.49 the ACPI specification for more details.
763 *
764 * @param ctx The TermList context.
765 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
766 */
768
769/**
770 * @brief Reads a DefFindSetRightBit structure from the AML byte stream.
771 *
772 * A DefFindSetRightBit structure is defined as `DefFindSetRightBit := FindSetRightBitOp Operand Target`.
773 *
774 * @see Section 19.6.50 of the ACPI specification for more details.
775 *
776 * @param ctx The TermList context.
777 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
778 */
780
781/**
782 * @brief Reads a SearchPkg structure from the AML byte stream.
783 *
784 * A SearchPkg structure is defined as `SearchPkg := TermArg => Package`.
785 *
786 * @param ctx The TermList context.
787 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
788 */
790
791/**
792 * @brief Match opcodes for DefMatch.
793 * @enum aml_match_opcode_t
794 */
804
805/**
806 * @brief Reads a MatchOpcode structure from the AML byte stream.
807 *
808 * A MatchOpcode structure is defined as `MatchOpcode :=
809 * ByteData // 0 MTR
810 * // 1 MEQ
811 * // 2 MLE
812 * // 3 MLT
813 * // 4 MGE
814 * // 5 MGT`.
815 *
816 * @param ctx The TermList context.
817 * @param out Output pointer where the match opcode will be stored.
818 * @return On success, the match opcode. On failure, `ERR` and `errno` is set.
819 */
821
822/**
823 * @brief Reads a StartIndex structure from the AML byte stream.
824 *
825 * A StartIndex structure is defined as `StartIndex := TermArg => Integer`.
826 *
827 * @param ctx The TermList context.
828 * @param out Output pointer where the integer result will be stored.
829 * @return On success, `0`. On failure, `ERR` and `errno` is set.
830 */
832
833/**
834 * @brief Reads a DefMatch structure from the AML byte stream.
835 *
836 * A DefMatch structure is defined as `DefMatch := MatchOp SearchPkg MatchOpcode Operand MatchOpcode Operand
837 * StartIndex`.
838 *
839 * @see Section 19.6.81 of the ACPI specification for more details.
840 *
841 * @param ctx The TermList context.
842 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
843 */
845
846/**
847 * @brief Reads a MidObj structure from the AML byte stream.
848 *
849 * A MidObj structure is defined as `MidObj := TermArg => Buffer | String`.
850 *
851 * @param ctx The TermList context.
852 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
853 */
855
856/**
857 * @brief Reads a DefMid structure from the AML byte stream.
858 *
859 * A DefMid structure is defined as `DefMid := MidOp MidObj TermArg TermArg Target`.
860 *
861 * @see Section 19.6.86 of the ACPI specification for more details.
862 *
863 * @param ctx The TermList context.
864 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
865 */
867
868/**
869 * @brief Reads an ExpressionOpcode structure from the AML byte stream.
870 *
871 * An ExpressionOpcode structure is defined as `ExpressionOpcode := DefAcquire | DefAdd | DefAnd | DefBuffer | DefConcat
872 * | DefConcatRes | DefCondRefOf | DefCopyObject | DefDecrement | DefDerefOf | DefDivide | DefFindSetLeftBit |
873 * DefFindSetRightBit | DefFromBCD | DefIncrement | DefIndex | DefLAnd | DefLEqual | DefLGreater | DefLGreaterEqual |
874 * DefLLess | DefLLessEqual | DefMid | DefLNot | DefLNotEqual | DefLoadTable | DefLOr | DefMatch | DefMod | DefMultiply
875 * | DefNAnd | DefNOr | DefNot | DefObjectType | DefOr | DefPackage | DefVarPackage | DefRefOf | DefShiftLeft |
876 * DefShiftRight | DefSizeOf | DefStore | DefSubtract | DefTimer | DefToBCD | DefToBuffer | DefToDecimalString |
877 * DefToHexString | DefToInteger | DefToString | DefWait | DefXOr | MethodInvocation`.
878 *
879 * Currently unimplemented Opcodes are:
880 * - `DefConcatRes`
881 * - `DefFromBCD`
882 * - `DefMid`
883 * - `DefLoadTable`
884 * - `DefWait`
885 *
886 * @param ctx The TermList context.
887 * @return On success, the object pointer storing the result. On failure, `NULL` and `errno` is set.
888 */
890
891/** @} */
#define AML_MAX_ARGS
Maximum number of arguments that can be passed to a method.
Definition arg.h:19
uint64_t aml_def_buffer_read(aml_term_list_ctx_t *ctx, aml_object_t *out)
Reads a DefBuffer structure from the AML byte stream.
Definition expression.c:297
aml_object_t * aml_def_acquire_read(aml_term_list_ctx_t *ctx)
Reads a DefAcquire structure from the AML byte stream.
uint64_t aml_term_arg_list_read(aml_term_list_ctx_t *ctx, uint64_t argCount, aml_term_arg_list_t *out)
Reads a TermArgList structure from the AML byte stream.
Definition expression.c:334
aml_object_t * aml_def_to_string_read(aml_term_list_ctx_t *ctx)
Reads a DefToString structure from the AML byte stream.
aml_object_t * aml_def_add_read(aml_term_list_ctx_t *ctx)
Reads a DefAdd structure from the AML byte stream.
Definition expression.c:545
uint64_t aml_timeout_read(aml_term_list_ctx_t *ctx, uint16_t *out)
Reads a Timeout structure from the AML byte stream.
aml_object_t * aml_def_increment_read(aml_term_list_ctx_t *ctx)
Reads a DefIncrement structure from the AML byte stream.
uint64_t aml_start_index_read(aml_term_list_ctx_t *ctx, aml_uint_t *out)
Reads a StartIndex structure from the AML byte stream.
aml_object_t * aml_def_concat_read(aml_term_list_ctx_t *ctx)
Reads a DefConcat structure from the AML byte stream.
uint64_t aml_index_value_read(aml_term_list_ctx_t *ctx, aml_uint_t *out)
Reads an IndexValue structure from the AML byte stream.
aml_object_t * aml_def_land_read(aml_term_list_ctx_t *ctx)
Reads a DefLAnd structure from the AML byte stream.
aml_object_t * aml_def_to_hex_string_read(aml_term_list_ctx_t *ctx)
Reads a DefToHexString structure from the AML byte stream.
uint64_t aml_dividend_read(aml_term_list_ctx_t *ctx, aml_uint_t *out)
Reads a Dividend structure from the AML byte stream.
Definition expression.c:499
aml_object_t * aml_def_mid_read(aml_term_list_ctx_t *ctx)
Reads a DefMid structure from the AML byte stream.
aml_object_t * aml_mid_obj_read(aml_term_list_ctx_t *ctx)
Reads a MidObj structure from the AML byte stream.
aml_object_t * aml_def_find_set_left_bit_read(aml_term_list_ctx_t *ctx)
Reads a DefFindSetLeftBit structure from the AML byte stream.
aml_object_t * aml_def_match_read(aml_term_list_ctx_t *ctx)
Reads a DefMatch structure from the AML byte stream.
aml_object_t * aml_def_cond_ref_of_read(aml_term_list_ctx_t *ctx)
Reads a DefCondRefOf structure from the AML byte stream.
Definition expression.c:407
aml_object_t * aml_def_to_integer_read(aml_term_list_ctx_t *ctx)
Reads a DefToInteger structure from the AML byte stream.
aml_object_t * aml_mutex_object_read(aml_term_list_ctx_t *ctx)
Reads a MutexObject structure from the AML byte stream.
aml_object_t * aml_def_lgreater_equal_read(aml_term_list_ctx_t *ctx)
Reads a DefLGreaterEqual structure from the AML byte stream.
aml_object_t * aml_def_object_type_read(aml_term_list_ctx_t *ctx)
Reads a DefObjectType structure from the AML byte stream.
aml_object_t * aml_def_to_decimal_string_read(aml_term_list_ctx_t *ctx)
Reads a DefToDecimalString structure from the AML byte stream.
aml_object_t * aml_def_size_of_read(aml_term_list_ctx_t *ctx)
Reads a DefSizeOf structure from the AML byte stream.
aml_object_t * aml_def_decrement_read(aml_term_list_ctx_t *ctx)
Reads a DefDecrement structure from the AML byte stream.
aml_object_t * aml_remainder_read(aml_term_list_ctx_t *ctx)
Reads a Remainder structure from the AML byte stream.
Definition expression.c:521
aml_object_t * aml_def_lor_read(aml_term_list_ctx_t *ctx)
Reads a DefLOr structure from the AML byte stream.
aml_object_t * aml_def_copy_object_read(aml_term_list_ctx_t *ctx)
Reads a DefCopyObject structure from the AML byte stream.
uint64_t aml_buffer_size_read(aml_term_list_ctx_t *ctx, aml_uint_t *out)
Reads a BufferSize structure from the AML byte stream.
Definition expression.c:287
aml_object_t * aml_def_nor_read(aml_term_list_ctx_t *ctx)
Reads a DefNOr structure from the AML byte stream.
Definition expression.c:843
aml_object_t * aml_data_read(aml_term_list_ctx_t *ctx)
Reads a Data structure from the AML byte stream.
aml_object_t * aml_def_xor_read(aml_term_list_ctx_t *ctx)
Reads a DefXOr structure from the AML byte stream.
Definition expression.c:873
uint64_t aml_length_arg_read(aml_term_list_ctx_t *ctx, aml_uint_t *out)
Reads a LengthArg structure from the AML byte stream.
aml_object_t * aml_def_multiply_read(aml_term_list_ctx_t *ctx)
Reads a DefMultiply structure from the AML byte stream.
Definition expression.c:605
aml_object_t * aml_def_to_bcd_read(aml_term_list_ctx_t *ctx)
Reads a DefToBcd structure from the AML byte stream.
aml_object_t * aml_expression_opcode_read(aml_term_list_ctx_t *ctx)
Reads an ExpressionOpcode structure from the AML byte stream.
aml_object_t * aml_def_lnot_read(aml_term_list_ctx_t *ctx)
Reads a DefLNot structure from the AML byte stream.
aml_object_t * aml_operand_read(aml_term_list_ctx_t *ctx, aml_type_t allowedTypes)
Reads an Operand structure from the AML byte stream.
Definition expression.c:25
aml_object_t * aml_def_nand_read(aml_term_list_ctx_t *ctx)
Reads a DefNAnd structure from the AML byte stream.
Definition expression.c:783
uint64_t aml_match_opcode_read(aml_term_list_ctx_t *ctx, aml_match_opcode_t *out)
Reads a MatchOpcode structure from the AML byte stream.
aml_object_t * aml_def_store_read(aml_term_list_ctx_t *ctx)
Reads a DefStore structure from the AML byte stream.
Definition expression.c:477
aml_object_t * aml_def_shift_right_read(aml_term_list_ctx_t *ctx)
Reads a DefShiftRight structure from the AML byte stream.
Definition expression.c:987
aml_object_t * aml_def_lequal_read(aml_term_list_ctx_t *ctx)
Reads a DefLEqual structure from the AML byte stream.
aml_object_t * aml_def_shift_left_read(aml_term_list_ctx_t *ctx)
Reads a DefShiftLeft structure from the AML byte stream.
Definition expression.c:941
aml_object_t * aml_def_lless_equal_read(aml_term_list_ctx_t *ctx)
Reads a DefLLessEqual structure from the AML byte stream.
uint64_t aml_shift_count_read(aml_term_list_ctx_t *ctx, aml_uint_t *out)
Reads a ShiftCount structure from the AML byte stream.
Definition expression.c:930
aml_object_t * aml_def_lless_read(aml_term_list_ctx_t *ctx)
Reads a DefLLess structure from the AML byte stream.
aml_object_t * aml_def_subtract_read(aml_term_list_ctx_t *ctx)
Reads a DefSubtract structure from the AML byte stream.
Definition expression.c:575
aml_object_t * aml_def_timer_read(aml_term_list_ctx_t *ctx)
Reads a DefTimer structure from the AML byte stream.
aml_object_t * aml_reference_type_opcode_read(aml_term_list_ctx_t *ctx)
aml_object_t * aml_def_mod_read(aml_term_list_ctx_t *ctx)
Reads a DefMod structure from the AML byte stream.
Definition expression.c:703
aml_object_t * aml_obj_reference_read(aml_term_list_ctx_t *ctx)
Reads an ObjReference structure from the AML byte stream.
aml_object_t * aml_def_and_read(aml_term_list_ctx_t *ctx)
Reads a DefAnd structure from the AML byte stream.
Definition expression.c:753
aml_object_t * aml_quotient_read(aml_term_list_ctx_t *ctx)
Reads a Quotient structure from the AML byte stream.
Definition expression.c:533
aml_object_t * aml_def_to_buffer_read(aml_term_list_ctx_t *ctx)
Reads a DefToBuffer structure from the AML byte stream.
aml_object_t * aml_def_not_read(aml_term_list_ctx_t *ctx)
Reads a DefNot structure from the AML byte stream.
Definition expression.c:903
aml_object_t * aml_def_lgreater_read(aml_term_list_ctx_t *ctx)
Reads a DefLGreater structure from the AML byte stream.
aml_object_t * aml_method_invocation_read(aml_term_list_ctx_t *ctx)
Reads a MethodInvocation structure from the AML byte stream.
Definition expression.c:361
aml_match_opcode_t
Match opcodes for DefMatch.
Definition expression.h:796
aml_object_t * aml_def_lnot_equal_read(aml_term_list_ctx_t *ctx)
Reads a DefLNotEqual structure from the AML byte stream.
aml_object_t * aml_buff_pkg_str_obj_read(aml_term_list_ctx_t *ctx)
Reads a BuffPkgStrObj structure from the AML byte stream.
aml_object_t * aml_def_index_read(aml_term_list_ctx_t *ctx)
Reads a DefIndex structure from the AML byte stream.
aml_object_t * aml_def_divide_read(aml_term_list_ctx_t *ctx)
Reads a DefDivide structure from the AML byte stream.
Definition expression.c:635
aml_object_t * aml_def_deref_of_read(aml_term_list_ctx_t *ctx)
Reads a DefDerefOf structure from the AML byte stream.
aml_package_t * aml_search_pkg_read(aml_term_list_ctx_t *ctx)
Reads a SearchPkg structure from the AML byte stream.
aml_object_t * aml_def_or_read(aml_term_list_ctx_t *ctx)
Reads a DefOr structure from the AML byte stream.
Definition expression.c:813
aml_object_t * aml_def_find_set_right_bit_read(aml_term_list_ctx_t *ctx)
Reads a DefFindSetRightBit structure from the AML byte stream.
aml_object_t * aml_def_ref_of_read(aml_term_list_ctx_t *ctx)
Reads a DefRefOf structure from the AML byte stream.
uint64_t aml_divisor_read(aml_term_list_ctx_t *ctx, aml_uint_t *out)
Reads a Divisor structure from the AML byte stream.
Definition expression.c:510
@ AML_MATCH_MGT
Definition expression.h:802
@ AML_MATCH_MLT
Definition expression.h:800
@ AML_MATCH_MTR
Definition expression.h:797
@ AML_MATCH_MGE
Definition expression.h:801
@ AML_MATCH_MLE
Definition expression.h:799
@ AML_MATCH_MEQ
Definition expression.h:798
uint64_t aml_uint_t
AML Integer type.
Definition integer.h:20
aml_type_t
ACPI data types.
Definition object.h:59
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
__UINT16_TYPE__ uint16_t
Definition stdint.h:13
ACPI object.
Definition object.h:447
Data for a package object.
Definition object.h:359
TermArgList structure.
Definition expression.h:25
Context for reading a TermList.
Definition term.h:37