1
2 /******************************************************************************
3 *
4 * Module Name: exresnte - AML Interpreter object resolution
5 *
6 *****************************************************************************/
7
8 /*
9 * Copyright (C) 2000 - 2011, Intel Corp.
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
118 EntryType = AcpiNsGetType ((ACPI_HANDLE) Node);
119 *ObjectPtr = Node;
120 }
121
122 /*
123 * Several object types require no further processing:
124 * 1) Device/Thermal objects don't have a "real" subobject, return the Node
125 * 2) Method locals and arguments have a pseudo-Node
126 * 3) 10/2007: Added method type to assist with Package construction.
127 */
128 if ((EntryType == ACPI_TYPE_DEVICE) ||
129 (EntryType == ACPI_TYPE_THERMAL) ||
130 (EntryType == ACPI_TYPE_METHOD) ||
131 (Node->Flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL)))
132 {
133 return_ACPI_STATUS (AE_OK);
134 }
135
136 if (!SourceDesc)
137 {
138 ACPI_ERROR ((AE_INFO, "No object attached to node %p",
139 Node));
140 return_ACPI_STATUS (AE_AML_NO_OPERAND);
141 }
142
143 /*
144 * Action is based on the type of the Node, which indicates the type
145 * of the attached object or pointer
146 */
147 switch (EntryType)
148 {
149 case ACPI_TYPE_PACKAGE:
150
151 if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE)
152 {
153 ACPI_ERROR ((AE_INFO, "Object not a Package, type %s",
154 AcpiUtGetObjectTypeName (SourceDesc)));
155 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
156 }
157
158 Status = AcpiDsGetPackageArguments (SourceDesc);
159 if (ACPI_SUCCESS (Status))
160 {
161 /* Return an additional reference to the object */
162
163 ObjDesc = SourceDesc;
164 AcpiUtAddReference (ObjDesc);
165 }
166 break;
167
168
169 case ACPI_TYPE_BUFFER:
170
171 if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)
172 {
173 ACPI_ERROR ((AE_INFO, "Object not a Buffer, type %s",
174 AcpiUtGetObjectTypeName (SourceDesc)));
175 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
176 }
177
178 Status = AcpiDsGetBufferArguments (SourceDesc);
179 if (ACPI_SUCCESS (Status))
180 {
181 /* Return an additional reference to the object */
182
183 ObjDesc = SourceDesc;
184 AcpiUtAddReference (ObjDesc);
185 }
186 break;
187
188
189 case ACPI_TYPE_STRING:
190
191 if (SourceDesc->Common.Type != ACPI_TYPE_STRING)
192 {
193 ACPI_ERROR ((AE_INFO, "Object not a String, type %s",
194 AcpiUtGetObjectTypeName (SourceDesc)));
195 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
196 }
197
198 /* Return an additional reference to the object */
199
200 ObjDesc = SourceDesc;
201 AcpiUtAddReference (ObjDesc);
202 break;
203
204
205 case ACPI_TYPE_INTEGER:
206
207 if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER)
208 {
209 ACPI_ERROR ((AE_INFO, "Object not a Integer, type %s",
210 AcpiUtGetObjectTypeName (SourceDesc)));
211 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
212 }
213
214 /* Return an additional reference to the object */
215
216 ObjDesc = SourceDesc;
217 AcpiUtAddReference (ObjDesc);
218 break;
219
220
221 case ACPI_TYPE_BUFFER_FIELD:
222 case ACPI_TYPE_LOCAL_REGION_FIELD:
223 case ACPI_TYPE_LOCAL_BANK_FIELD:
224 case ACPI_TYPE_LOCAL_INDEX_FIELD:
225
226 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
227 "FieldRead Node=%p SourceDesc=%p Type=%X\n",
228 Node, SourceDesc, EntryType));
229
230 Status = AcpiExReadDataFromField (WalkState, SourceDesc, &ObjDesc);
231 break;
232
233 /* For these objects, just return the object attached to the Node */
234
235 case ACPI_TYPE_MUTEX:
236 case ACPI_TYPE_POWER:
237 case ACPI_TYPE_PROCESSOR:
238 case ACPI_TYPE_EVENT:
239 case ACPI_TYPE_REGION:
240
241 /* Return an additional reference to the object */
242
243 ObjDesc = SourceDesc;
244 AcpiUtAddReference (ObjDesc);
245 break;
246
247 /* TYPE_ANY is untyped, and thus there is no object associated with it */
248
249 case ACPI_TYPE_ANY:
250
251 ACPI_ERROR ((AE_INFO,
252 "Untyped entry %p, no attached object!", Node));
253
254 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
255
256
257 case ACPI_TYPE_LOCAL_REFERENCE:
258
259 switch (SourceDesc->Reference.Class)
260 {
261 case ACPI_REFCLASS_TABLE: /* This is a DdbHandle */
262 case ACPI_REFCLASS_REFOF:
263 case ACPI_REFCLASS_INDEX:
264
265 /* Return an additional reference to the object */
266
267 ObjDesc = SourceDesc;
268 AcpiUtAddReference (ObjDesc);
269 break;
270
271 default:
272 /* No named references are allowed here */
273
274 ACPI_ERROR ((AE_INFO,
275 "Unsupported Reference type 0x%X",
276 SourceDesc->Reference.Class));
277
278 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
279 }
280 break;
281
282
283 default:
284
285 /* Default case is for unknown types */
286
287 ACPI_ERROR ((AE_INFO,
288 "Node %p - Unknown object type 0x%X",
289 Node, EntryType));
290
291 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
292
293 } /* switch (EntryType) */
294
295
296 /* Return the object descriptor */
297
298 *ObjectPtr = (void *) ObjDesc;
299 return_ACPI_STATUS (Status);
300 }
301
302
|
1 /******************************************************************************
2 *
3 * Module Name: exresnte - AML Interpreter object resolution
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
117 EntryType = AcpiNsGetType ((ACPI_HANDLE) Node);
118 *ObjectPtr = Node;
119 }
120
121 /*
122 * Several object types require no further processing:
123 * 1) Device/Thermal objects don't have a "real" subobject, return the Node
124 * 2) Method locals and arguments have a pseudo-Node
125 * 3) 10/2007: Added method type to assist with Package construction.
126 */
127 if ((EntryType == ACPI_TYPE_DEVICE) ||
128 (EntryType == ACPI_TYPE_THERMAL) ||
129 (EntryType == ACPI_TYPE_METHOD) ||
130 (Node->Flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL)))
131 {
132 return_ACPI_STATUS (AE_OK);
133 }
134
135 if (!SourceDesc)
136 {
137 ACPI_ERROR ((AE_INFO, "No object attached to node [%4.4s] %p",
138 Node->Name.Ascii, Node));
139 return_ACPI_STATUS (AE_AML_NO_OPERAND);
140 }
141
142 /*
143 * Action is based on the type of the Node, which indicates the type
144 * of the attached object or pointer
145 */
146 switch (EntryType)
147 {
148 case ACPI_TYPE_PACKAGE:
149
150 if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE)
151 {
152 ACPI_ERROR ((AE_INFO, "Object not a Package, type %s",
153 AcpiUtGetObjectTypeName (SourceDesc)));
154 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
155 }
156
157 Status = AcpiDsGetPackageArguments (SourceDesc);
158 if (ACPI_SUCCESS (Status))
159 {
160 /* Return an additional reference to the object */
161
162 ObjDesc = SourceDesc;
163 AcpiUtAddReference (ObjDesc);
164 }
165 break;
166
167 case ACPI_TYPE_BUFFER:
168
169 if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)
170 {
171 ACPI_ERROR ((AE_INFO, "Object not a Buffer, type %s",
172 AcpiUtGetObjectTypeName (SourceDesc)));
173 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
174 }
175
176 Status = AcpiDsGetBufferArguments (SourceDesc);
177 if (ACPI_SUCCESS (Status))
178 {
179 /* Return an additional reference to the object */
180
181 ObjDesc = SourceDesc;
182 AcpiUtAddReference (ObjDesc);
183 }
184 break;
185
186 case ACPI_TYPE_STRING:
187
188 if (SourceDesc->Common.Type != ACPI_TYPE_STRING)
189 {
190 ACPI_ERROR ((AE_INFO, "Object not a String, type %s",
191 AcpiUtGetObjectTypeName (SourceDesc)));
192 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
193 }
194
195 /* Return an additional reference to the object */
196
197 ObjDesc = SourceDesc;
198 AcpiUtAddReference (ObjDesc);
199 break;
200
201 case ACPI_TYPE_INTEGER:
202
203 if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER)
204 {
205 ACPI_ERROR ((AE_INFO, "Object not a Integer, type %s",
206 AcpiUtGetObjectTypeName (SourceDesc)));
207 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
208 }
209
210 /* Return an additional reference to the object */
211
212 ObjDesc = SourceDesc;
213 AcpiUtAddReference (ObjDesc);
214 break;
215
216 case ACPI_TYPE_BUFFER_FIELD:
217 case ACPI_TYPE_LOCAL_REGION_FIELD:
218 case ACPI_TYPE_LOCAL_BANK_FIELD:
219 case ACPI_TYPE_LOCAL_INDEX_FIELD:
220
221 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
222 "FieldRead Node=%p SourceDesc=%p Type=%X\n",
223 Node, SourceDesc, EntryType));
224
225 Status = AcpiExReadDataFromField (WalkState, SourceDesc, &ObjDesc);
226 break;
227
228 /* For these objects, just return the object attached to the Node */
229
230 case ACPI_TYPE_MUTEX:
231 case ACPI_TYPE_POWER:
232 case ACPI_TYPE_PROCESSOR:
233 case ACPI_TYPE_EVENT:
234 case ACPI_TYPE_REGION:
235
236 /* Return an additional reference to the object */
237
238 ObjDesc = SourceDesc;
239 AcpiUtAddReference (ObjDesc);
240 break;
241
242 /* TYPE_ANY is untyped, and thus there is no object associated with it */
243
244 case ACPI_TYPE_ANY:
245
246 ACPI_ERROR ((AE_INFO,
247 "Untyped entry %p, no attached object!", Node));
248
249 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
250
251 case ACPI_TYPE_LOCAL_REFERENCE:
252
253 switch (SourceDesc->Reference.Class)
254 {
255 case ACPI_REFCLASS_TABLE: /* This is a DdbHandle */
256 case ACPI_REFCLASS_REFOF:
257 case ACPI_REFCLASS_INDEX:
258
259 /* Return an additional reference to the object */
260
261 ObjDesc = SourceDesc;
262 AcpiUtAddReference (ObjDesc);
263 break;
264
265 default:
266
267 /* No named references are allowed here */
268
269 ACPI_ERROR ((AE_INFO,
270 "Unsupported Reference type 0x%X",
271 SourceDesc->Reference.Class));
272
273 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
274 }
275 break;
276
277 default:
278
279 /* Default case is for unknown types */
280
281 ACPI_ERROR ((AE_INFO,
282 "Node %p - Unknown object type 0x%X",
283 Node, EntryType));
284
285 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
286
287 } /* switch (EntryType) */
288
289
290 /* Return the object descriptor */
291
292 *ObjectPtr = (void *) ObjDesc;
293 return_ACPI_STATUS (Status);
294 }
|