1888c055d10f47f73fbbc1cbb175864121eb5970
1 /******************************************************************************
3 * Module Name: dsinit - Object initialization namespace walk
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2006, R. Byron Moore
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
44 #include <acpi/acpi.h>
45 #include <acpi/acdispat.h>
46 #include <acpi/acnamesp.h>
48 #define _COMPONENT ACPI_DISPATCHER
49 ACPI_MODULE_NAME("dsinit")
51 /* Local prototypes */
53 acpi_ds_init_one_object(acpi_handle obj_handle
,
54 u32 level
, void *context
, void **return_value
);
56 /*******************************************************************************
58 * FUNCTION: acpi_ds_init_one_object
60 * PARAMETERS: obj_handle - Node for the object
61 * Level - Current nesting level
62 * Context - Points to a init info struct
63 * return_value - Not used
67 * DESCRIPTION: Callback from acpi_walk_namespace. Invoked for every object
68 * within the namespace.
70 * Currently, the only objects that require initialization are:
72 * 2) Operation Regions
74 ******************************************************************************/
77 acpi_ds_init_one_object(acpi_handle obj_handle
,
78 u32 level
, void *context
, void **return_value
)
80 struct acpi_init_walk_info
*info
=
81 (struct acpi_init_walk_info
*)context
;
82 struct acpi_namespace_node
*node
=
83 (struct acpi_namespace_node
*)obj_handle
;
84 acpi_object_type type
;
87 ACPI_FUNCTION_ENTRY();
90 * We are only interested in NS nodes owned by the table that
93 if (node
->owner_id
!= info
->table_desc
->owner_id
) {
99 /* And even then, we are only interested in a few object types */
101 type
= acpi_ns_get_type(obj_handle
);
104 case ACPI_TYPE_REGION
:
106 status
= acpi_ds_initialize_region(obj_handle
);
107 if (ACPI_FAILURE(status
)) {
108 ACPI_EXCEPTION((AE_INFO
, status
,
109 "During Region initialization %p [%4.4s]",
111 acpi_ut_get_node_name(obj_handle
)));
114 info
->op_region_count
++;
117 case ACPI_TYPE_METHOD
:
119 info
->method_count
++;
122 case ACPI_TYPE_DEVICE
:
124 info
->device_count
++;
132 * We ignore errors from above, and always return OK, since
133 * we don't want to abort the walk on a single error.
138 /*******************************************************************************
140 * FUNCTION: acpi_ds_initialize_objects
142 * PARAMETERS: table_desc - Descriptor for parent ACPI table
143 * start_node - Root of subtree to be initialized.
147 * DESCRIPTION: Walk the namespace starting at "StartNode" and perform any
148 * necessary initialization on the objects found therein
150 ******************************************************************************/
153 acpi_ds_initialize_objects(struct acpi_table_desc
* table_desc
,
154 struct acpi_namespace_node
* start_node
)
157 struct acpi_init_walk_info info
;
159 ACPI_FUNCTION_TRACE(ds_initialize_objects
);
161 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH
,
162 "**** Starting initialization of namespace objects ****\n"));
163 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT
, "Parsing all Control Methods:"));
165 info
.method_count
= 0;
166 info
.op_region_count
= 0;
167 info
.object_count
= 0;
168 info
.device_count
= 0;
169 info
.table_desc
= table_desc
;
171 /* Walk entire namespace from the supplied root */
173 status
= acpi_walk_namespace(ACPI_TYPE_ANY
, start_node
, ACPI_UINT32_MAX
,
174 acpi_ds_init_one_object
, &info
, NULL
);
175 if (ACPI_FAILURE(status
)) {
176 ACPI_EXCEPTION((AE_INFO
, status
, "During WalkNamespace"));
179 ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT
,
180 "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
181 table_desc
->pointer
->signature
,
182 table_desc
->owner_id
, info
.object_count
,
183 info
.device_count
, info
.method_count
,
184 info
.op_region_count
));
186 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH
,
187 "%hd Methods, %hd Regions\n", info
.method_count
,
188 info
.op_region_count
));
190 return_ACPI_STATUS(AE_OK
);
This page took 0.042492 seconds and 4 git commands to generate.