Deleted Added
full compact
dsobject.c (107325) dsobject.c (114237)
1/******************************************************************************
2 *
3 * Module Name: dsobject - Dispatcher object management routines
1/******************************************************************************
2 *
3 * Module Name: dsobject - Dispatcher object management routines
4 * $Revision: 110 $
4 * $Revision: 114 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
12 * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.

--- 102 unchanged lines hidden (view full) ---

123#include "acnamesp.h"
124#include "acinterp.h"
125
126#define _COMPONENT ACPI_DISPATCHER
127 ACPI_MODULE_NAME ("dsobject")
128
129
130#ifndef ACPI_NO_METHOD_EXECUTION
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.

--- 102 unchanged lines hidden (view full) ---

123#include "acnamesp.h"
124#include "acinterp.h"
125
126#define _COMPONENT ACPI_DISPATCHER
127 ACPI_MODULE_NAME ("dsobject")
128
129
130#ifndef ACPI_NO_METHOD_EXECUTION
131/*******************************************************************************
132 *
133 * FUNCTION: AcpiDsInitOneObject
134 *
135 * PARAMETERS: ObjHandle - Node
136 * Level - Current nesting level
137 * Context - Points to a init info struct
138 * ReturnValue - Not used
139 *
140 * RETURN: Status
141 *
142 * DESCRIPTION: Callback from AcpiWalkNamespace. Invoked for every object
143 * within the namespace.
144 *
145 * Currently, the only objects that require initialization are:
146 * 1) Methods
147 * 2) Operation Regions
148 *
149 ******************************************************************************/
150
151ACPI_STATUS
152AcpiDsInitOneObject (
153 ACPI_HANDLE ObjHandle,
154 UINT32 Level,
155 void *Context,
156 void **ReturnValue)
157{
158 ACPI_OBJECT_TYPE Type;
159 ACPI_STATUS Status;
160 ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context;
161
162
163 ACPI_FUNCTION_NAME ("DsInitOneObject");
164
165
166 /*
167 * We are only interested in objects owned by the table that
168 * was just loaded
169 */
170 if (((ACPI_NAMESPACE_NODE *) ObjHandle)->OwnerId !=
171 Info->TableDesc->TableId)
172 {
173 return (AE_OK);
174 }
175
176 Info->ObjectCount++;
177
178 /* And even then, we are only interested in a few object types */
179
180 Type = AcpiNsGetType (ObjHandle);
181
182 switch (Type)
183 {
184 case ACPI_TYPE_REGION:
185
186 Status = AcpiDsInitializeRegion (ObjHandle);
187 if (ACPI_FAILURE (Status))
188 {
189 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %p [%4.4s] - Init failure, %s\n",
190 ObjHandle, ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii,
191 AcpiFormatException (Status)));
192 }
193
194 Info->OpRegionCount++;
195 break;
196
197
198 case ACPI_TYPE_METHOD:
199
200 Info->MethodCount++;
201
202 if (!(AcpiDbgLevel & ACPI_LV_INIT))
203 {
204 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
205 }
206
207 /*
208 * Set the execution data width (32 or 64) based upon the
209 * revision number of the parent ACPI table.
210 * TBD: This is really for possible future support of integer width
211 * on a per-table basis. Currently, we just use a global for the width.
212 */
213 if (Info->TableDesc->Pointer->Revision == 1)
214 {
215 ((ACPI_NAMESPACE_NODE *) ObjHandle)->Flags |= ANOBJ_DATA_WIDTH_32;
216 }
217
218 /*
219 * Always parse methods to detect errors, we may delete
220 * the parse tree below
221 */
222 Status = AcpiDsParseMethod (ObjHandle);
223 if (ACPI_FAILURE (Status))
224 {
225 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n",
226 ObjHandle, ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii,
227 AcpiFormatException (Status)));
228
229 /* This parse failed, but we will continue parsing more methods */
230
231 break;
232 }
233
234 /*
235 * Delete the parse tree. We simple re-parse the method
236 * for every execution since there isn't much overhead
237 */
238 AcpiNsDeleteNamespaceSubtree (ObjHandle);
239 AcpiNsDeleteNamespaceByOwner (((ACPI_NAMESPACE_NODE *) ObjHandle)->Object->Method.OwningId);
240 break;
241
242
243 case ACPI_TYPE_DEVICE:
244
245 Info->DeviceCount++;
246 break;
247
248
249 default:
250 break;
251 }
252
253 /*
254 * We ignore errors from above, and always return OK, since
255 * we don't want to abort the walk on a single error.
256 */
257 return (AE_OK);
258}
259
260
261/*******************************************************************************
262 *
263 * FUNCTION: AcpiDsInitializeObjects
264 *
265 * PARAMETERS: TableDesc - Descriptor for parent ACPI table
266 * StartNode - Root of subtree to be initialized.
267 *
268 * RETURN: Status
269 *
270 * DESCRIPTION: Walk the namespace starting at "StartNode" and perform any
271 * necessary initialization on the objects found therein
272 *
273 ******************************************************************************/
274
275ACPI_STATUS
276AcpiDsInitializeObjects (
277 ACPI_TABLE_DESC *TableDesc,
278 ACPI_NAMESPACE_NODE *StartNode)
279{
280 ACPI_STATUS Status;
281 ACPI_INIT_WALK_INFO Info;
282
283
284 ACPI_FUNCTION_TRACE ("DsInitializeObjects");
285
286
287 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
288 "**** Starting initialization of namespace objects ****\n"));
289 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Parsing Methods:"));
290
291 Info.MethodCount = 0;
292 Info.OpRegionCount = 0;
293 Info.ObjectCount = 0;
294 Info.DeviceCount = 0;
295 Info.TableDesc = TableDesc;
296
297 /* Walk entire namespace from the supplied root */
298
299 Status = AcpiWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX,
300 AcpiDsInitOneObject, &Info, NULL);
301 if (ACPI_FAILURE (Status))
302 {
303 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed, %s\n",
304 AcpiFormatException (Status)));
305 }
306
307 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
308 "\nTable [%4.4s] - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
309 TableDesc->Pointer->Signature, Info.ObjectCount,
310 Info.DeviceCount, Info.MethodCount, Info.OpRegionCount));
311
312 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
313 "%hd Methods, %hd Regions\n", Info.MethodCount, Info.OpRegionCount));
314
315 return_ACPI_STATUS (AE_OK);
316}
317
318
319/*****************************************************************************
320 *
321 * FUNCTION: AcpiDsBuildInternalObject
322 *
323 * PARAMETERS: WalkState - Current walk state
324 * Op - Parser object to be translated
325 * ObjDescPtr - Where the ACPI internal object is returned
326 *

--- 147 unchanged lines hidden (view full) ---

474 }
475
476 /* Allocate the buffer */
477
478 if (ObjDesc->Buffer.Length == 0)
479 {
480 ObjDesc->Buffer.Pointer = NULL;
481 ACPI_REPORT_WARNING (("Buffer created with zero length in AML\n"));
131/*****************************************************************************
132 *
133 * FUNCTION: AcpiDsBuildInternalObject
134 *
135 * PARAMETERS: WalkState - Current walk state
136 * Op - Parser object to be translated
137 * ObjDescPtr - Where the ACPI internal object is returned
138 *

--- 147 unchanged lines hidden (view full) ---

286 }
287
288 /* Allocate the buffer */
289
290 if (ObjDesc->Buffer.Length == 0)
291 {
292 ObjDesc->Buffer.Pointer = NULL;
293 ACPI_REPORT_WARNING (("Buffer created with zero length in AML\n"));
482 return_ACPI_STATUS (AE_OK);
483 }
294 }
484
485 ObjDesc->Buffer.Pointer = ACPI_MEM_CALLOCATE (
486 ObjDesc->Buffer.Length);
487 if (!ObjDesc->Buffer.Pointer)
295 else
488 {
296 {
489 AcpiUtDeleteObjectDesc (ObjDesc);
490 return_ACPI_STATUS (AE_NO_MEMORY);
491 }
297 ObjDesc->Buffer.Pointer = ACPI_MEM_CALLOCATE (
298 ObjDesc->Buffer.Length);
299 if (!ObjDesc->Buffer.Pointer)
300 {
301 AcpiUtDeleteObjectDesc (ObjDesc);
302 return_ACPI_STATUS (AE_NO_MEMORY);
303 }
492
304
493 /* Initialize buffer from the ByteList (if present) */
305 /* Initialize buffer from the ByteList (if present) */
494
306
495 if (ByteList)
496 {
497 ACPI_MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Named.Data,
498 ByteListLength);
307 if (ByteList)
308 {
309 ACPI_MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Named.Data,
310 ByteListLength);
311 }
499 }
500
501 ObjDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
502 Op->Common.Node = (ACPI_NAMESPACE_NODE *) ObjDesc;
503 return_ACPI_STATUS (AE_OK);
504}
505
506

--- 173 unchanged lines hidden (view full) ---

680 /* Build an internal object for the argument(s) */
681
682 Status = AcpiDsBuildInternalObject (WalkState, Op->Common.Value.Arg, &ObjDesc);
683 if (ACPI_FAILURE (Status))
684 {
685 return_ACPI_STATUS (Status);
686 }
687
312 }
313
314 ObjDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
315 Op->Common.Node = (ACPI_NAMESPACE_NODE *) ObjDesc;
316 return_ACPI_STATUS (AE_OK);
317}
318
319

--- 173 unchanged lines hidden (view full) ---

493 /* Build an internal object for the argument(s) */
494
495 Status = AcpiDsBuildInternalObject (WalkState, Op->Common.Value.Arg, &ObjDesc);
496 if (ACPI_FAILURE (Status))
497 {
498 return_ACPI_STATUS (Status);
499 }
500
688 /* Re-type the object according to it's argument */
501 /* Re-type the object according to its argument */
689
690 Node->Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
691
692 /* Attach obj to node */
693
694 Status = AcpiNsAttachObject (Node, ObjDesc, Node->Type);
695
696 /* Remove local reference to the object */

--- 211 unchanged lines hidden ---
502
503 Node->Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
504
505 /* Attach obj to node */
506
507 Status = AcpiNsAttachObject (Node, ObjDesc, Node->Type);
508
509 /* Remove local reference to the object */

--- 211 unchanged lines hidden ---