1 | #pragma once |
2 | |
3 | #include <uacpi/internal/compiler.h> |
4 | #include <uacpi/platform/types.h> |
5 | |
6 | #ifdef __cplusplus |
7 | extern "C" { |
8 | #endif |
9 | |
10 | typedef enum uacpi_status { |
11 | UACPI_STATUS_OK = 0, |
12 | UACPI_STATUS_MAPPING_FAILED = 1, |
13 | UACPI_STATUS_OUT_OF_MEMORY = 2, |
14 | UACPI_STATUS_BAD_CHECKSUM = 3, |
15 | UACPI_STATUS_INVALID_SIGNATURE = 4, |
16 | UACPI_STATUS_INVALID_TABLE_LENGTH = 5, |
17 | UACPI_STATUS_NOT_FOUND = 6, |
18 | UACPI_STATUS_INVALID_ARGUMENT = 7, |
19 | UACPI_STATUS_UNIMPLEMENTED = 8, |
20 | UACPI_STATUS_ALREADY_EXISTS = 9, |
21 | UACPI_STATUS_INTERNAL_ERROR = 10, |
22 | UACPI_STATUS_TYPE_MISMATCH = 11, |
23 | UACPI_STATUS_INIT_LEVEL_MISMATCH = 12, |
24 | UACPI_STATUS_NAMESPACE_NODE_DANGLING = 13, |
25 | UACPI_STATUS_NO_HANDLER = 14, |
26 | UACPI_STATUS_NO_RESOURCE_END_TAG = 15, |
27 | UACPI_STATUS_COMPILED_OUT = 16, |
28 | UACPI_STATUS_HARDWARE_TIMEOUT = 17, |
29 | UACPI_STATUS_TIMEOUT = 18, |
30 | UACPI_STATUS_OVERRIDEN = 19, |
31 | UACPI_STATUS_DENIED = 20, |
32 | |
33 | // All errors that have bytecode-related origin should go here |
34 | UACPI_STATUS_AML_UNDEFINED_REFERENCE = 0x0EFF0000, |
35 | UACPI_STATUS_AML_INVALID_NAMESTRING = 0x0EFF0001, |
36 | UACPI_STATUS_AML_OBJECT_ALREADY_EXISTS = 0x0EFF0002, |
37 | UACPI_STATUS_AML_INVALID_OPCODE = 0x0EFF0003, |
38 | UACPI_STATUS_AML_INCOMPATIBLE_OBJECT_TYPE = 0x0EFF0004, |
39 | UACPI_STATUS_AML_BAD_ENCODING = 0x0EFF0005, |
40 | UACPI_STATUS_AML_OUT_OF_BOUNDS_INDEX = 0x0EFF0006, |
41 | UACPI_STATUS_AML_SYNC_LEVEL_TOO_HIGH = 0x0EFF0007, |
42 | UACPI_STATUS_AML_INVALID_RESOURCE = 0x0EFF0008, |
43 | UACPI_STATUS_AML_LOOP_TIMEOUT = 0x0EFF0009, |
44 | UACPI_STATUS_AML_CALL_STACK_DEPTH_LIMIT = 0x0EFF000A, |
45 | } uacpi_status; |
46 | |
47 | const uacpi_char *uacpi_status_to_string(uacpi_status); |
48 | |
49 | #define uacpi_unlikely_error(expr) uacpi_unlikely((expr) != UACPI_STATUS_OK) |
50 | #define uacpi_likely_error(expr) uacpi_likely((expr) != UACPI_STATUS_OK) |
51 | |
52 | #define uacpi_unlikely_success(expr) uacpi_unlikely((expr) == UACPI_STATUS_OK) |
53 | #define uacpi_likely_success(expr) uacpi_likely((expr) == UACPI_STATUS_OK) |
54 | |
55 | #ifdef __cplusplus |
56 | } |
57 | #endif |
58 | |