This source file includes following definitions.
- ACPI_MODULE_NAME
- acpi_ps_init_op
- acpi_ps_alloc_op
- acpi_ps_free_op
- acpi_ps_is_leading_char
- acpi_ps_get_name
- acpi_ps_set_name
1
2
3
4
5
6
7
8
9
10 #include <acpi/acpi.h>
11 #include "accommon.h"
12 #include "acparser.h"
13 #include "amlcode.h"
14 #include "acconvert.h"
15
16 #define _COMPONENT ACPI_PARSER
17 ACPI_MODULE_NAME("psutils")
18
19
20
21
22
23
24
25
26
27
28
29
30 union acpi_parse_object *acpi_ps_create_scope_op(u8 *aml)
31 {
32 union acpi_parse_object *scope_op;
33
34 scope_op = acpi_ps_alloc_op(AML_SCOPE_OP, aml);
35 if (!scope_op) {
36 return (NULL);
37 }
38
39 scope_op->named.name = ACPI_ROOT_NAME;
40 return (scope_op);
41 }
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56 void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
57 {
58 ACPI_FUNCTION_ENTRY();
59
60 op->common.descriptor_type = ACPI_DESC_TYPE_PARSER;
61 op->common.aml_opcode = opcode;
62
63 ACPI_DISASM_ONLY_MEMBERS(acpi_ut_safe_strncpy(op->common.aml_op_name,
64 (acpi_ps_get_opcode_info
65 (opcode))->name,
66 sizeof(op->common.
67 aml_op_name)));
68 }
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85 union acpi_parse_object *acpi_ps_alloc_op(u16 opcode, u8 *aml)
86 {
87 union acpi_parse_object *op;
88 const struct acpi_opcode_info *op_info;
89 u8 flags = ACPI_PARSEOP_GENERIC;
90
91 ACPI_FUNCTION_ENTRY();
92
93 op_info = acpi_ps_get_opcode_info(opcode);
94
95
96
97 if (op_info->flags & AML_DEFER) {
98 flags = ACPI_PARSEOP_DEFERRED;
99 } else if (op_info->flags & AML_NAMED) {
100 flags = ACPI_PARSEOP_NAMED_OBJECT;
101 } else if (opcode == AML_INT_BYTELIST_OP) {
102 flags = ACPI_PARSEOP_BYTELIST;
103 }
104
105
106
107 if (flags == ACPI_PARSEOP_GENERIC) {
108
109
110
111 op = acpi_os_acquire_object(acpi_gbl_ps_node_cache);
112 } else {
113
114
115 op = acpi_os_acquire_object(acpi_gbl_ps_node_ext_cache);
116 }
117
118
119
120 if (op) {
121 acpi_ps_init_op(op, opcode);
122 op->common.aml = aml;
123 op->common.flags = flags;
124 ASL_CV_CLEAR_OP_COMMENTS(op);
125
126 if (opcode == AML_SCOPE_OP) {
127 acpi_gbl_current_scope = op;
128 }
129
130 if (acpi_gbl_capture_comments) {
131 ASL_CV_TRANSFER_COMMENTS(op);
132 }
133 }
134
135 return (op);
136 }
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151 void acpi_ps_free_op(union acpi_parse_object *op)
152 {
153 ACPI_FUNCTION_NAME(ps_free_op);
154
155 ASL_CV_CLEAR_OP_COMMENTS(op);
156 if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
157 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
158 "Free retval op: %p\n", op));
159 }
160
161 if (op->common.flags & ACPI_PARSEOP_GENERIC) {
162 (void)acpi_os_release_object(acpi_gbl_ps_node_cache, op);
163 } else {
164 (void)acpi_os_release_object(acpi_gbl_ps_node_ext_cache, op);
165 }
166 }
167
168
169
170
171
172
173
174
175
176
177
178
179 u8 acpi_ps_is_leading_char(u32 c)
180 {
181 return ((u8) (c == '_' || (c >= 'A' && c <= 'Z')));
182 }
183
184
185
186
187 u32 acpi_ps_get_name(union acpi_parse_object * op)
188 {
189
190
191
192 if (op->common.flags & ACPI_PARSEOP_GENERIC) {
193 return (0);
194 }
195
196
197
198 return (op->named.name);
199 }
200
201
202
203
204 void acpi_ps_set_name(union acpi_parse_object *op, u32 name)
205 {
206
207
208
209 if (op->common.flags & ACPI_PARSEOP_GENERIC) {
210 return;
211 }
212
213 op->named.name = name;
214 }