This source file includes following definitions.
- ACPI_MODULE_NAME
- acpi_ex_opcode_3A_1T_1R
1
2
3
4
5
6
7
8
9
10 #include <acpi/acpi.h>
11 #include "accommon.h"
12 #include "acinterp.h"
13 #include "acparser.h"
14 #include "amlcode.h"
15
16 #define _COMPONENT ACPI_EXECUTER
17 ACPI_MODULE_NAME("exoparg3")
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state)
52 {
53 union acpi_operand_object **operand = &walk_state->operands[0];
54 struct acpi_signal_fatal_info *fatal;
55 acpi_status status = AE_OK;
56
57 ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_0T_0R,
58 acpi_ps_get_opcode_name(walk_state->opcode));
59
60 switch (walk_state->opcode) {
61 case AML_FATAL_OP:
62
63 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
64 "FatalOp: Type %X Code %X Arg %X "
65 "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
66 (u32)operand[0]->integer.value,
67 (u32)operand[1]->integer.value,
68 (u32)operand[2]->integer.value));
69
70 fatal = ACPI_ALLOCATE(sizeof(struct acpi_signal_fatal_info));
71 if (fatal) {
72 fatal->type = (u32) operand[0]->integer.value;
73 fatal->code = (u32) operand[1]->integer.value;
74 fatal->argument = (u32) operand[2]->integer.value;
75 }
76
77
78
79 status = acpi_os_signal(ACPI_SIGNAL_FATAL, fatal);
80
81
82
83 ACPI_FREE(fatal);
84 goto cleanup;
85
86 case AML_EXTERNAL_OP:
87
88
89
90
91
92
93
94
95 ACPI_ERROR((AE_INFO, "Executed External Op"));
96 status = AE_OK;
97 goto cleanup;
98
99 default:
100
101 ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X",
102 walk_state->opcode));
103
104 status = AE_AML_BAD_OPCODE;
105 goto cleanup;
106 }
107
108 cleanup:
109
110 return_ACPI_STATUS(status);
111 }
112
113
114
115
116
117
118
119
120
121
122
123
124
125 acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
126 {
127 union acpi_operand_object **operand = &walk_state->operands[0];
128 union acpi_operand_object *return_desc = NULL;
129 char *buffer = NULL;
130 acpi_status status = AE_OK;
131 u64 index;
132 acpi_size length;
133
134 ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_1T_1R,
135 acpi_ps_get_opcode_name(walk_state->opcode));
136
137 switch (walk_state->opcode) {
138 case AML_MID_OP:
139
140
141
142
143 return_desc = acpi_ut_create_internal_object((operand[0])->
144 common.type);
145 if (!return_desc) {
146 status = AE_NO_MEMORY;
147 goto cleanup;
148 }
149
150
151
152 index = operand[1]->integer.value;
153 length = (acpi_size)operand[2]->integer.value;
154
155
156
157
158
159 if (index >= operand[0]->string.length) {
160 length = 0;
161 }
162
163
164
165 else if ((index + length) > operand[0]->string.length) {
166 length =
167 (acpi_size)operand[0]->string.length -
168 (acpi_size)index;
169 }
170
171
172
173 switch ((operand[0])->common.type) {
174 case ACPI_TYPE_STRING:
175
176
177
178 buffer = ACPI_ALLOCATE_ZEROED((acpi_size)length + 1);
179 if (!buffer) {
180 status = AE_NO_MEMORY;
181 goto cleanup;
182 }
183 break;
184
185 case ACPI_TYPE_BUFFER:
186
187
188
189 if (length > 0) {
190
191
192
193 buffer = ACPI_ALLOCATE_ZEROED(length);
194 if (!buffer) {
195 status = AE_NO_MEMORY;
196 goto cleanup;
197 }
198 }
199 break;
200
201 default:
202
203 status = AE_AML_OPERAND_TYPE;
204 goto cleanup;
205 }
206
207 if (buffer) {
208
209
210
211 memcpy(buffer,
212 operand[0]->string.pointer + index, length);
213 }
214
215
216
217 return_desc->string.pointer = buffer;
218 return_desc->string.length = (u32) length;
219
220
221
222 return_desc->buffer.flags |= AOPOBJ_DATA_VALID;
223 break;
224
225 default:
226
227 ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X",
228 walk_state->opcode));
229
230 status = AE_AML_BAD_OPCODE;
231 goto cleanup;
232 }
233
234
235
236 status = acpi_ex_store(return_desc, operand[3], walk_state);
237
238 cleanup:
239
240
241
242 if (ACPI_FAILURE(status) || walk_state->result_obj) {
243 acpi_ut_remove_reference(return_desc);
244 walk_state->result_obj = NULL;
245 } else {
246
247
248 walk_state->result_obj = return_desc;
249 }
250
251 return_ACPI_STATUS(status);
252 }