ReactOS 0.4.16-dev-1946-g52006dd
context.h
Go to the documentation of this file.
1#pragma once
2
3#include <uacpi/acpi.h>
4#include <uacpi/types.h>
5#include <uacpi/uacpi.h>
8#include <uacpi/context.h>
9
11 /*
12 * A local copy of FADT that has been verified & converted to most optimal
13 * format for faster access to the registers.
14 */
15 struct acpi_fadt fadt;
16
18
19#ifndef UACPI_BAREBONES_MODE
20 /*
21 * A cached pointer to FACS so that we don't have to look it up in interrupt
22 * contexts as we can't take mutexes.
23 */
24 struct acpi_facs *facs;
25
26 /*
27 * pm1{a,b}_evt_blk split into two registers for convenience
28 */
29 struct acpi_gas pm1a_status_blk;
30 struct acpi_gas pm1b_status_blk;
31 struct acpi_gas pm1a_enable_blk;
32 struct acpi_gas pm1b_enable_blk;
33
34#define UACPI_SLEEP_TYP_INVALID 0xFF
37
40
42
43#ifndef UACPI_REDUCED_HARDWARE
48#endif
50
53
55
56 /*
57 * These are stored here to protect against stuff like:
58 * - CopyObject(JUNK, \‍)
59 * - CopyObject(JUNK, \_GL)
60 */
63
64#ifndef UACPI_REDUCED_HARDWARE
68#endif
69
72#endif // !UACPI_BAREBONES_MODE
73
74#ifndef UACPI_REDUCED_HARDWARE
76#endif
77
78 /*
79 * This is a per-table value but we mimic the NT implementation:
80 * treat all other definition blocks as if they were the same revision
81 * as DSDT.
82 */
84
86};
87
89
91{
92 return (g_uacpi_rt_ctx.flags & flag) == flag;
93}
94
96{
97 return lvl <= g_uacpi_rt_ctx.log_level;
98}
99
101{
102#ifndef UACPI_REDUCED_HARDWARE
103 return g_uacpi_rt_ctx.is_hardware_reduced;
104#else
105 return UACPI_TRUE;
106#endif
107}
108
109#ifndef UACPI_BAREBONES_MODE
110
112{
113 switch (lvl) {
115 return "early";
117 return "subsystem initialized";
119 return "namespace loaded";
121 return "namespace initialized";
122 default:
123 return "<invalid>";
124 }
125}
126
127#define UACPI_ENSURE_INIT_LEVEL_AT_LEAST(lvl) \
128 do { \
129 if (uacpi_unlikely(g_uacpi_rt_ctx.init_level < lvl)) { \
130 uacpi_error( \
131 "while evaluating %s: init level %d (%s) is too low, " \
132 "expected at least %d (%s)\n", __FUNCTION__, \
133 g_uacpi_rt_ctx.init_level, \
134 uacpi_init_level_to_string(g_uacpi_rt_ctx.init_level), lvl, \
135 uacpi_init_level_to_string(lvl) \
136 ); \
137 return UACPI_STATUS_INIT_LEVEL_MISMATCH; \
138 } \
139 } while (0)
140
141#define UACPI_ENSURE_INIT_LEVEL_IS(lvl) \
142 do { \
143 if (uacpi_unlikely(g_uacpi_rt_ctx.init_level != lvl)) { \
144 uacpi_error( \
145 "while evaluating %s: invalid init level %d (%s), " \
146 "expected %d (%s)\n", __FUNCTION__, \
147 g_uacpi_rt_ctx.init_level, \
148 uacpi_init_level_to_string(g_uacpi_rt_ctx.init_level), lvl, \
149 uacpi_init_level_to_string(lvl) \
150 ); \
151 return UACPI_STATUS_INIT_LEVEL_MISMATCH; \
152 } \
153 } while (0)
154
155#endif // !UACPI_BAREBONES_MODE
static const uacpi_char * uacpi_init_level_to_string(uacpi_u8 lvl)
Definition: context.h:111
static uacpi_bool uacpi_check_flag(uacpi_u64 flag)
Definition: context.h:90
static uacpi_bool uacpi_is_hardware_reduced(void)
Definition: context.h:100
struct uacpi_runtime_context g_uacpi_rt_ctx
Definition: uacpi.c:17
static uacpi_bool uacpi_should_log(enum uacpi_log_level lvl)
Definition: context.h:95
uacpi_log_level
Definition: log.h:7
uint32_t uacpi_u32
Definition: types.h:21
bool uacpi_bool
Definition: types.h:31
uint64_t uacpi_u64
Definition: types.h:22
char uacpi_char
Definition: types.h:44
uint8_t uacpi_u8
Definition: types.h:19
#define UACPI_TRUE
Definition: types.h:29
@ UACPI_INIT_LEVEL_EARLY
Definition: types.h:60
@ UACPI_INIT_LEVEL_SUBSYSTEM_INITIALIZED
Definition: types.h:66
@ UACPI_INIT_LEVEL_NAMESPACE_INITIALIZED
Definition: types.h:78
@ UACPI_INIT_LEVEL_NAMESPACE_LOADED
Definition: types.h:72
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
uacpi_object * root_object
Definition: context.h:62
uacpi_bool is_rev1
Definition: context.h:83
struct acpi_facs * facs
Definition: context.h:24
struct acpi_gas pm1b_status_blk
Definition: context.h:30
uacpi_u8 s0_sleep_typ_a
Definition: context.h:38
uacpi_bool bad_timesource
Definition: context.h:70
uacpi_bool global_lock_acquired
Definition: context.h:41
uacpi_handle * global_lock_spinlock
Definition: context.h:66
uacpi_handle * global_lock_event
Definition: context.h:65
uacpi_u32 max_call_stack_depth
Definition: context.h:52
uacpi_u8 last_sleep_typ_b
Definition: context.h:36
uacpi_bool sci_handle_valid
Definition: context.h:46
struct acpi_gas pm1a_enable_blk
Definition: context.h:31
uacpi_u8 last_sleep_typ_a
Definition: context.h:35
uacpi_bool has_global_lock
Definition: context.h:45
uacpi_bool was_in_legacy_mode
Definition: context.h:44
uacpi_handle sci_handle
Definition: context.h:47
uacpi_u32 global_lock_seq_num
Definition: context.h:54
uacpi_bool global_lock_pending
Definition: context.h:67
uacpi_u8 s0_sleep_typ_b
Definition: context.h:39
uacpi_u8 log_level
Definition: context.h:85
uacpi_u8 init_level
Definition: context.h:71
struct acpi_gas pm1b_enable_blk
Definition: context.h:32
uacpi_u64 opcodes_executed
Definition: context.h:49
uacpi_bool is_hardware_reduced
Definition: context.h:75
struct acpi_fadt fadt
Definition: context.h:15
uacpi_u32 loop_timeout_seconds
Definition: context.h:51
struct acpi_gas pm1a_status_blk
Definition: context.h:29
uacpi_u64 flags
Definition: context.h:17
uacpi_mutex * global_lock_mutex
Definition: context.h:61